/* Tidy Up: AISA's purple bar, one reading column, the paper tracker's tables. Purple carries structure, gold marks today. */
:root {
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --bg: #F7F5FC; --surface: #FFFFFF; --tint: #F2EFFA; --ink: #1A1A1A; --ink-2: #4E4A57; --ink-3: #6E6979;
  --line: #E6E1F2; --line-2: #C8BEE8; --brand: #21076C; --brand-ink: #21076C; --bar: #21076C; --bar-ink: #FFFFFF;
  --gold: #D8B664; --gold-soft: #F7F0DC; --focus: #6A4FE0;
  --good: #1F7A4D; --good-bg: #E6F3EC; --warn: #8A5D00; --warn-bg: #FBF1D9; --bad: #B3261E; --bad-bg: #FBE9E7;
  --radius: 8px; --shadow: 0 1px 2px rgba(33, 7, 108, .05), 0 6px 20px rgba(33, 7, 108, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13101A; --surface: #1B1725; --tint: #241E33; --ink: #ECE8F4; --ink-2: #B8B1C8; --ink-3: #8D86A0;
    --line: #2B2538; --line-2: #3D3552; --brand: #2A1470; --brand-ink: #C9BCFF; --bar: #1C1240; --bar-ink: #F1EDFA;
    --gold-soft: #2D2617; --focus: #B3A2FA;
    --good: #5CC08B; --good-bg: #15271D; --warn: #E3B34A; --warn-bg: #2A2313; --bad: #F08A80; --bad-bg: #2C1716;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }

.topbar { background: var(--bar); color: var(--bar-ink); display: flex; align-items: center; gap: 16px; padding: 10px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand b { display: block; font-size: 18px; line-height: 1.1; }
.brand small { display: block; font-size: 12px; opacity: .8; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.tabs a { color: var(--bar-ink); text-decoration: none; padding: 7px 12px; border-radius: 6px; font-size: 15px; opacity: .85; }
.tabs a:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.tabs a[aria-current="page"] { background: rgba(255, 255, 255, .16); opacity: 1; box-shadow: inset 0 -2px 0 var(--gold); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }

main { flex: 1; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px 20px 40px; }
h1 { margin: 0 0 4px; font-size: 28px; color: var(--brand-ink); }
h2 { font-size: 19px; margin: 28px 0 10px; color: var(--brand-ink); }
h2 small, h3 small { font-weight: 400; color: var(--ink-3); font-size: 14px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.sub { margin: 0 0 18px; color: var(--ink-2); }
.msg { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: var(--radius); }
.msg.error, .flash.error { color: var(--bad); }
.msg.error { background: var(--bad-bg); }
.flash { font-size: 14px; color: var(--good); min-height: 1em; margin: 0; }
.flash:empty { display: none; }

.btn { font: inherit; font-size: 15px; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
.btn:hover { filter: brightness(1.15); }
.btn.ghost { background: transparent; color: var(--brand-ink); border-color: var(--line-2); }
.btn.small { font-size: 14px; padding: 5px 10px; }
.btn.tiny { font-size: 13px; padding: 3px 9px; }
.btn.on-bar { background: transparent; border-color: rgba(255, 255, 255, .5); }
.btn[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.ok-btn[aria-pressed="true"] { background: var(--good); border-color: var(--good); }
.btn.fu-btn[aria-pressed="true"] { background: var(--warn); border-color: var(--warn); }
.btn.ok-btn, .btn.fu-btn { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn.ok-btn[aria-pressed="true"], .btn.fu-btn[aria-pressed="true"] { color: #fff; }
.gate .btn { margin-top: 8px; }
input[type=text], input[type=email], input[type=date], input[type=time], select {
  font: inherit; font-size: 15px; padding: 6px 9px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); color: var(--ink); min-width: 0; }

.navbar { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.navbar b { min-width: 170px; text-align: center; font-size: 17px; }
.toolbar, .addrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.addrow label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.addrow input[type=email] { width: 260px; }

/* today */
.today { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: var(--radius); padding: 16px 18px; margin: 4px 0 22px; box-shadow: var(--shadow); }
.today.all-done { border-left-color: var(--good); }
.today.quiet { border-left-color: var(--line-2); box-shadow: none; }
.today h2 { margin: 0 0 12px; }
.bigs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.big { font: inherit; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; text-align: left; padding: 14px; border-radius: var(--radius);
  border: 2px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; min-height: 64px; }
.big .box { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.big[aria-pressed="true"] { border-color: var(--good); background: var(--good-bg); }
.big[aria-pressed="true"] .box { background: var(--good); border-color: var(--good); }
.big[aria-pressed="true"] .box::after { content: ''; width: 6px; height: 12px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.big:disabled { opacity: .5; cursor: default; }
.today-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.today-foot input { flex: 1; min-width: 200px; }
.good-line { margin: 10px 0 0; color: var(--good); font-weight: 600; }

/* the tracker */
.week.quiet { padding: 10px 16px; background: transparent; }
.week.quiet h3 { margin: 0; font-weight: 500; color: var(--ink-3); }
.week { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 15px; }
thead th { font-size: 13px; color: var(--ink-3); font-weight: 600; text-transform: none; }
tbody th small, .grid th small { display: block; font-weight: 400; color: var(--ink-3); font-size: 13px; }
tbody th { font-weight: 600; }
.tracker td.tick { text-align: center; width: 92px; }
.tracker thead th:nth-child(n+2):nth-child(-n+5) { text-align: center; }
.tracker input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); cursor: pointer; }
.tracker input[type=checkbox]:disabled { cursor: default; }
.tracker tr.off th, .tracker tr.off td { background: var(--tint); }
.tracker tr.is-today th { box-shadow: inset 4px 0 0 var(--gold); }
.tracker td.notes { min-width: 220px; }
.tracker .note { width: 100%; }
.away { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.away input { width: 16px !important; height: 16px !important; }
.st { white-space: nowrap; }
.late { display: block; color: var(--warn); font-size: 12px; }
.check { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.check.c-follow-up b { color: var(--warn); }
.check.c-yes b { color: var(--good); }

.chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.chip:empty { display: none; }
.s-done { background: var(--good-bg); color: var(--good); }
.s-away { background: var(--tint); color: var(--ink-2); }
.s-partial { background: var(--warn-bg); color: var(--warn); }
.s-missed { background: var(--bad-bg); color: var(--bad); }
.s-today { background: var(--gold-soft); color: var(--warn); }

/* leaders */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile b { display: block; font-size: 26px; color: var(--brand-ink); }
.tile span { color: var(--ink-2); font-size: 14px; }
.grid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grid thead th.off { color: var(--line-2); }
.grid tr.inactive th, .grid tr.inactive td { opacity: .6; }
.checkcell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.checkcell .cnote { width: 150px; font-size: 14px; padding: 3px 7px; }
.roster input[type=text] { width: 100%; max-width: 200px; }
.sheet { margin: 0 0 28px; }
.sheet-head h2 { margin: 0 0 4px; }
.sheet-head p { margin: 0 0 10px; color: var(--ink-2); }
ul.plain { padding-left: 18px; color: var(--ink-2); }

.gate { max-width: 560px; margin: 48px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.gate .kicker { color: var(--ink-3); font-size: 13px; letter-spacing: .04em; margin: 0; }
.gate h1 { margin: 4px 0 8px; }
.gate-status { color: var(--ink-3); }
.gate-status.error { color: var(--bad); }

.foot { text-align: center; font-size: 13px; color: var(--ink-3); padding: 18px; }

@media (max-width: 760px) {
  .page { padding: 18px 16px 32px; }
  .bigs { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: 1fr; }
  /* the tracker on a phone: the day and its four ticks on one line, the notes and status under them */
  .tracker, .tracker tbody, .tracker thead { display: block; }
  .tracker thead tr, .tracker tbody tr { display: grid; grid-template-columns: 1fr repeat(4, 50px); align-items: center; border-bottom: 1px solid var(--line); }
  .tracker th, .tracker td { border: 0; padding: 6px 4px; }
  .tracker thead th:nth-child(n+6) { display: none; }
  .tracker thead th { font-size: 12px; line-height: 1.2; text-align: center; }
  .tracker thead th:first-child { text-align: left; }
  .tracker td.tick { width: auto; }
  .tracker td.notes, .tracker td.st { grid-column: 1 / -1; min-width: 0; padding-top: 0; }
  .tracker tr.off td.tick { display: none; }
  .tracker tr.off td.notes { grid-column: 2 / -1; grid-row: 1; }
  .tracker tr.off td.st { display: none; }
  .who-name { display: none; }
}

/* printing the month's trackers (or saving them as PDF): one teacher per page, nothing but the trackers */
@media print {
  :root { --bg: #fff; --surface: #fff; --tint: #F2F2F2; --ink: #000; --ink-2: #222; --ink-3: #444; --line: #999; --brand-ink: #000; }
  .topbar, .foot, .navbar, .toolbar, .tiles, .page > h1, .page > .sub, .skip { display: none !important; }
  body { font-size: 12px; background: #fff; }
  .page { padding: 0; max-width: none; }
  .sheet { break-after: page; margin: 0; }
  .sheet:last-child { break-after: auto; }
  .week { border: 1px solid #999; padding: 6px 8px; margin: 0 0 8px; break-inside: avoid; }
  th, td { padding: 3px 6px; font-size: 11px; }
  .chip { padding: 0; background: none !important; }
  .tracker input[type=checkbox] { width: 14px; height: 14px; }
}
