/* TutorTrack design system
   Brand: deep navy → ocean blue → teal (from the logo). Calm neutrals, clear hierarchy.
   Layout: phone = one column + bottom tab bar; computer (≥ 900px) = left sidebar + content column. */

:root {
  --navy: #0f3b5f; --blue: #1b6a99; --teal: #1fae95;
  --brand-grad: linear-gradient(120deg, #14456f 0%, #1b78a3 55%, #27c2a0 100%);
  --bg: #f4f7fb; --card: #ffffff; --ink: #0f2233; --ink-2: #304558; --muted: #5f7286; --line: #e2e8f0; --line-2: #cfd9e4;
  --accent: #1b6a99; --accent-ink: #145179; --accent-bg: #e8f1f8; --on-accent: #ffffff;
  --green: #128a6f; --green-bg: #e3f5ef; --red: #c2382f; --red-bg: #fdecea;
  --amber: #9a6500; --warn-bg: #fff5dc; --soft: #eef2f7; --faint: #c7d2de;
  --shadow-sm: 0 1px 2px rgba(15, 34, 51, .06); --shadow: 0 4px 16px rgba(15, 34, 51, .08); --shadow-lg: 0 18px 50px rgba(15, 34, 51, .18);
  --scrim: rgba(10, 22, 34, .45);
  --radius: 14px; --radius-sm: 10px;
  --font: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b1724; --card: #122233; --ink: #e8eef5; --ink-2: #c3d0dd; --muted: #8fa3b7; --line: #1f3347; --line-2: #2b4359;
  --accent: #4fb2e0; --accent-ink: #8fd0ef; --accent-bg: #133048; --on-accent: #ffffff;
  --green: #3ccfa6; --green-bg: #103329; --red: #ff7a70; --red-bg: #3a1c1b;
  --amber: #f0c060; --warn-bg: #33290f; --soft: #18293b; --faint: #34495e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 4px 16px rgba(0, 0, 0, .35); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  --scrim: rgba(0, 0, 0, .6); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0b1724; --card: #122233; --ink: #e8eef5; --ink-2: #c3d0dd; --muted: #8fa3b7; --line: #1f3347; --line-2: #2b4359;
  --accent: #4fb2e0; --accent-ink: #8fd0ef; --accent-bg: #133048; --on-accent: #ffffff;
  --green: #3ccfa6; --green-bg: #103329; --red: #ff7a70; --red-bg: #3a1c1b;
  --amber: #f0c060; --warn-bg: #33290f; --soft: #18293b; --faint: #34495e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 4px 16px rgba(0, 0, 0, .35); --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  --scrim: rgba(0, 0, 0, .6); color-scheme: dark; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { font-size: 16px; }
html.large { font-size: 18.5px; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { font-size: 1rem; line-height: 1.45; padding-top: env(safe-area-inset-top, 0px); min-height: 100vh; min-height: 100dvh; }
img { max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.sub { color: var(--muted); font-size: 0.875rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .5px; }
.red { color: var(--red); } .green { color: var(--green); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- brand ---------- */
.wordmark { font-family: var(--font-display); font-weight: 750; font-size: 1.9rem; letter-spacing: -0.02em; color: var(--navy); line-height: 1.05; }
.wordmark span { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark.sm { font-size: 1.2rem; }
:root[data-theme="dark"] .wordmark { color: #e8eef5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wordmark { color: #e8eef5; } }
.tagline { color: var(--muted); font-size: 0.92rem; margin-top: 4px; }

/* ---------- app shell ---------- */
#app { min-height: 100vh; min-height: 100dvh; }
.main { max-width: 760px; margin: 0 auto; padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px max(16px, env(safe-area-inset-left, 0px)) 4px; }
.brand-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { flex-shrink: 0; }
.brand-text { min-width: 0; }
.org { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 10px; }
.hdate { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.icon-btn:hover { border-color: var(--line-2); }
.banner { margin: 8px 16px 0; background: var(--warn-bg); color: var(--ink); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 0.9rem; border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); }

.view { display: none; padding-block: 6px 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.view.on { display: block; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; }
.page-head h1 { margin: 0; font-size: 1.55rem; font-weight: 700; flex: 1; }
.back-btn { flex: 0 0 auto; }
h3 { font-size: 0.78rem; margin: 26px 2px 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; display: flex; align-items: center; gap: 8px; }
.hint { color: var(--muted); text-align: center; margin: 4px 0 16px; font-size: 0.9rem; }

/* bottom tab bar (phones) */
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); z-index: 10; }
nav.tabs .side-brand, nav.tabs .side-only { display: none; }
nav.tabs .inner { display: flex; max-width: 760px; margin: 0 auto; }
nav.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; border: none; background: none; padding: 9px 0 8px; font-size: 0.72rem; font-weight: 600; color: var(--muted); position: relative; }
nav.tabs button .i { width: 24px; height: 24px; }
nav.tabs button.on { color: var(--accent); }
nav.tabs button.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand-grad); }
.dot { position: absolute; top: 4px; left: 50%; margin-left: 8px; min-width: 18px; background: var(--red); color: #fff; border-radius: 999px; font-size: 0.66rem; padding: 1px 5px; font-weight: 700; }

/* sidebar (computers) */
@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: 248px 1fr; }
  nav.tabs { position: sticky; top: 0; bottom: auto; height: 100vh; height: 100dvh; border-top: none; border-right: 1px solid var(--line); background: var(--card); backdrop-filter: none; padding: 22px 14px; }
  nav.tabs .side-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 26px; }
  nav.tabs .side-only { display: flex; }
  nav.tabs .inner { flex-direction: column; gap: 4px; }
  nav.tabs button { flex: 0 0 auto; flex-direction: row; gap: 12px; padding: 11px 12px; border-radius: 10px; font-size: 0.95rem; justify-content: flex-start; color: var(--ink-2); }
  nav.tabs button .i { width: 20px; height: 20px; color: var(--muted); }
  nav.tabs button:hover { background: var(--soft); }
  nav.tabs button.on { background: var(--accent-bg); color: var(--accent-ink); }
  nav.tabs button.on .i { color: var(--accent); }
  nav.tabs button.on::before { top: 10px; bottom: 10px; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .dot { position: static; margin-left: auto; }
  .main { padding-bottom: 40px; width: 100%; }
  .topbar .brand-row { visibility: hidden; }
  #gearBtn { display: none; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 11px 16px; font-weight: 600; background: var(--soft); color: var(--ink); text-decoration: none; transition: filter .12s, background .12s; }
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.big { width: 100%; padding: 15px; font-size: 1.02rem; }
.btn.small { padding: 9px 13px; font-size: 0.88rem; }
.btn.primary, .btn.orange { background: var(--brand-grad); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--blue) 30%, transparent); }
.btn.primary:hover, .btn.orange:hover { filter: brightness(1.05); }
.btn.green { background: var(--green); color: #fff; }
.btn.ghost { background: var(--card); border-color: var(--line-2); color: var(--ink-2); }
.btn.ghost:hover { background: var(--soft); filter: none; }
.btn.link { background: none; color: var(--muted); text-decoration: underline; padding: 8px; font-weight: 500; }
.btn.danger { background: var(--red); color: #fff; }
.danger-text { color: var(--red) !important; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }
.btnrow > * { flex: 1 1 140px; }
label.btn { cursor: pointer; }

/* ---------- cards & lists ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.card .btnrow { margin-top: 12px; }
.who { display: flex; align-items: center; gap: 12px; }
.who .grow { flex: 1; min-width: 0; }
.who .nm { font-weight: 650; }
.who .amt { font-weight: 750; font-size: 1.05rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tap { cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; }
.empty .e { display: block; margin: 0 auto 10px; color: var(--faint); }
.empty .e .ic { width: 44px; height: 44px; stroke-width: 1.5; }
details > summary { cursor: pointer; color: var(--muted); padding: 12px 2px; list-style: none; font-weight: 600; font-size: 0.9rem; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; } details[open] > summary::before { content: '▾ '; }
.badge, .tag, .mode-tag { display: inline-block; font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 3px 9px; white-space: nowrap; letter-spacing: .02em; }
.badge.owe { background: var(--red-bg); color: var(--red); }
.badge.ok { background: var(--green-bg); color: var(--green); }
.tag, .mode-tag { background: var(--soft); color: var(--ink-2); }
.mode-tag { margin-left: 6px; vertical-align: 1px; }
.tag.admin { background: var(--accent-bg); color: var(--accent-ink); text-transform: none; letter-spacing: 0; }
.tag.warn { background: var(--warn-bg); color: var(--amber); }
.tag.off { background: var(--red-bg); color: var(--red); }
.tags { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.warnbox { background: var(--warn-bg); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 0.9rem; margin-bottom: 10px; }

/* ---------- attendance ---------- */
.daybar { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.daybar .mid { text-align: center; }
.daybar .big { font-size: 1.08rem; font-weight: 700; }
.daybar a { color: var(--accent); }
.round { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); }
.round:hover { background: var(--soft); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.tile { position: relative; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px 8px 12px; text-align: center; transition: transform .08s, border-color .12s, background .12s; box-shadow: var(--shadow-sm); }
.tile:hover { border-color: var(--line-2); }
.tile:active { transform: scale(.97); }
.tile .av { margin: 0 auto 8px; }
.tile .nm { font-weight: 600; font-size: 0.93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .chk { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--green); color: #fff; font-size: 0.8rem; line-height: 22px; display: none; font-weight: 700; }
.tile.on { border-color: var(--green); background: var(--green-bg); }
.tile.on .chk { display: block; }
.group-title { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .07em; margin: 8px 2px 0; }
.count-pill { text-align: center; margin: 16px 0 0; font-weight: 600; color: var(--green); font-size: 0.92rem; }

/* avatars */
.av { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.05rem; flex-shrink: 0; letter-spacing: .02em; }
.av.sm { width: 40px; height: 40px; font-size: 0.9rem; }
.av.lg { width: 72px; height: 72px; font-size: 1.6rem; margin: 0 auto 8px; }
.avatar-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.avatar-ic .ic { width: 22px; height: 22px; }

/* ---------- fees ---------- */
.hero { background: var(--brand-grad); color: #fff; border-radius: 18px; padding: 22px; text-align: center; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.hero .lbl { opacity: .9; font-size: 0.9rem; }
.hero .amt { font-size: 2.2rem; font-weight: 750; margin: 4px 0; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero.ok { background: linear-gradient(120deg, #0f7a62, #1fae95); }
.minis { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.mini { flex: 1; min-width: 140px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.mini .lbl { font-size: 0.78rem; color: var(--muted); }
.mini .v { font-weight: 700; font-size: 1.12rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero .amt, .mini .v, .stat .v { white-space: pre-line; line-height: 1.2; }

/* ---------- sheet (dialog) ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: none; }
.sheet.open { display: block; }
.sheet-bg { position: absolute; inset: 0; background: var(--scrim); }
.sheet-card { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 22px 18px calc(24px + env(safe-area-inset-bottom, 0px)); animation: up .2s ease-out; box-shadow: var(--shadow-lg); }
@media (min-width: 700px) { .sheet-card { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 18px; animation: pop .18s ease-out; max-height: 88vh; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes pop { from { opacity: .4; } to { opacity: 1; } }
.small-card { max-width: 420px; }
.small-card h2 { font-size: 1.1rem; margin: 0 0 18px; padding-right: 0; }
.sheet-x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.sheet h2 { margin: 0 0 4px; font-size: 1.25rem; padding-right: 48px; }
.menu { display: grid; gap: 8px; margin-top: 16px; }
.menu .btn { justify-content: flex-start; }
.cred { background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 14px; margin: 14px 0; display: grid; gap: 10px; }
.cred div { display: flex; flex-direction: column; gap: 2px; }
.cred b { font-size: 1.1rem; word-break: break-all; }

/* ---------- forms ---------- */
.f { display: block; margin: 16px 0; }
.flbl, .f > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.88rem; color: var(--ink-2); }
.f input, .pair input, details input, .input, .bigsel, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); transition: border-color .12s, box-shadow .12s; }
.f input:focus, .pair input:focus, details input:focus, .input:focus, .bigsel:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
input.huge { font-size: 1.7rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
textarea { font-size: 0.95rem; resize: vertical; }
.pair { display: flex; gap: 8px; margin-bottom: 8px; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choices.cur { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.choice { border: 1.5px solid var(--line-2); background: var(--card); border-radius: var(--radius-sm); padding: 11px 8px; text-align: center; transition: border-color .12s, background .12s; }
.choice:hover { border-color: var(--accent); }
.choice b { display: block; font-weight: 650; }
.choice span { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
.choice.on { border-color: var(--accent); background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.choice.on b { color: var(--accent-ink); }
.choices.cur .choice { padding: 9px 4px; }
.form-err { color: var(--red); min-height: 1.2em; margin: 10px 0 0; font-weight: 600; font-size: 0.9rem; }

/* ---------- student profile ---------- */
.profile-top { text-align: center; margin-bottom: 14px; }
.balance { text-align: center; border-radius: var(--radius); padding: 16px; margin: 10px 0 12px; }
.balance .v { font-size: 1.8rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.balance.owe { background: var(--red-bg); color: var(--red); }
.balance.ok { background: var(--green-bg); color: var(--green); }
.actions3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.actions3 .btn { flex-direction: column; gap: 4px; padding: 12px 4px; font-size: 0.85rem; }
.actions3 .btn:not(.green) { background: var(--card); border-color: var(--line-2); color: var(--ink-2); }
.actions3 .btn .i .ic { width: 22px; height: 22px; }
.info { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 14px; }
.info .line { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.info .line:last-child { border: none; }
.info .line .k { color: var(--muted); }
.info .line .v { text-align: right; font-weight: 600; }
.info a { color: var(--accent); text-decoration: none; }
.hist .h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); width: 100%; }
.hist .h:last-child { border: none; }
.hist .h.person { background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; padding: 12px 0; }
.hist .h.person:last-child { border-bottom: 0; }
.hist .h.person:hover { color: var(--accent-ink); }
.who-line { display: inline-flex; align-items: center; gap: 8px; }
.act.bad b { color: var(--red); }
.x { border: none; background: none; color: var(--muted); padding: 4px 8px; }

/* calendar */
.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head .round { width: 36px; height: 36px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-grid .wd { font-size: 0.7rem; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-grid .d { padding: 8px 0; border-radius: 8px; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.cal-grid .d.came { background: var(--green); color: #fff; font-weight: 700; }
.cal-grid .d.missed { background: var(--red-bg); color: var(--red); }
.cal-grid .d.today { outline: 2px solid var(--accent); }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 0.78rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }

/* ---------- reports ---------- */
.seg { display: flex; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.seg button { flex: 1; border: none; background: none; padding: 9px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); }
.stat .lbl { font-size: 0.78rem; color: var(--muted); }
.stat .v { font-size: 1.3rem; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; }
.grid-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
table.grid { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
table.grid th, table.grid td { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid tr:last-child td { border-bottom: none; }
table.grid th { font-size: 0.72rem; color: var(--muted); font-weight: 600; background: var(--soft); }
table.grid td:first-child, table.grid th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); font-weight: 600; }
table.grid th:first-child { background: var(--soft); }
.tick { color: var(--green); font-weight: 800; } .miss { color: var(--faint); }

/* ---------- toast & misc ---------- */
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: all .22s; z-index: 30; display: flex; gap: 14px; align-items: center; white-space: nowrap; box-shadow: var(--shadow-lg); font-size: 0.92rem; }
#toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
#toast button { background: none; border: none; color: var(--teal); font-weight: 700; padding: 0; }
@media (min-width: 900px) { #toast { bottom: 28px; } }
.spinner { display: block; width: 28px; height: 28px; margin: 0 auto 10px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- sign in ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding-block: 24px;
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  background: radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--teal) 18%, transparent), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--blue) 16%, transparent), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 30px 24px 22px; box-shadow: var(--shadow-lg); }
.logo-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.logo-lockup img { width: 78px; height: 78px; flex-shrink: 0; margin: -6px -4px -6px -6px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 70px !important; }
.pw-show { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); border: none; background: var(--soft); border-radius: 7px; padding: 6px 10px; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.remember { display: flex; align-items: center; gap: 10px; margin: 2px 0 18px; font-size: 0.92rem; cursor: pointer; color: var(--ink-2); }
.remember input { width: 18px; height: 18px; accent-color: var(--accent); }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 0.78rem; margin: 14px 0 0; }
