/* SkoolBase - application styles (dark design system). No external fonts. */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
  /* Surfaces: pure black panels on a near-black page, separated by hairlines */
  --bg: #090909;
  --bg-elevated: #050505;
  --sidebar-bg: #000000;
  --surface: #000000;
  --surface-2: #121212;
  --surface-3: #1b1b1b;
  --border: #2a2a2a;
  --border-soft: #1c1c1c;
  --overlay: rgba(0, 0, 0, 0.72);
  --topbar-bg: rgba(0, 0, 0, 0.88);
  --hover-bg: #070707;
  --row-hover: #0a0a0a;
  --tick-bg: #262626;
  --scroll-thumb: #2f2f2f;

  /* Text */
  --text: #f5f5f5;
  --text-muted: #9a9a9a;
  --text-faint: #7d7d7d;
  --text-strong: #ffffff;
  --text-2: #c9c9c9;

  /* Accents: periwinkle for links/focus/charts; buttons stay neutral */
  --primary: #7f8cff;
  --primary-strong: #aab3ff;
  --primary-deep: #5a67e8;
  --primary-soft: rgba(127, 140, 255, 0.14);
  --primary-ring: rgba(127, 140, 255, 0.5);
  --teal: #4fd8c4;
  --teal-soft: rgba(79, 216, 196, 0.13);
  --gradient-primary: linear-gradient(180deg, #333333 0%, #262626 100%);
  --gradient-primary-hover: linear-gradient(180deg, #3d3d3d 0%, #2e2e2e 100%);
  --gradient-segment: linear-gradient(180deg, #2f2f2f 0%, #232323 100%);
  --control-border: #3a3a3a;
  --control-border-strong: #666666;
  --focus: #c9ceff;
  --gradient-accent: linear-gradient(135deg, #7f8cff 0%, #4fd8c4 100%);

  /* Status (always paired with an icon or label) */
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.13);
  --warning: #f0933a;
  --warning-soft: rgba(240, 147, 58, 0.13);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.13);
  --info: #6b8bff;
  --info-soft: rgba(107, 139, 255, 0.14);

  /* Chart palette (contrast and colour-blind separation checked on --surface) */
  --chart-1: #8b8dff;
  --chart-2: #e8873a;
  --chart-present: #3fb950;
  --chart-late: #e6ab45;
  --chart-absent: #f56d76;
  --chart-grid: #1f1f1f;

  /* Legacy aliases (pages written against earlier themes) */
  --brand: var(--primary);
  --brand-strong: var(--primary-strong);
  --brand-soft: var(--primary-soft);
  --accent: var(--teal);

  /* Shape, depth, rhythm (4px grid) */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow: none;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;

  --rail-w: 80px;
  --topbar-h: 64px;
  --content-max: 1480px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --font: "Inter", "Inter var", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font);
  --sun: #f2b544; /* the logo's tassel: the one warm accent on public pages */
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* Bricolage Grotesque (SIL OFL 1.1, see assets/fonts/OFL-BricolageGrotesque.txt),
   self-hosted because the CSP only allows same-origin fonts. */
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../assets/fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../assets/fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--primary-strong); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: #c9ceff; text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.375rem; letter-spacing: -0.02em; }
h2 { font-size: 1rem; }
h3 { font-size: 0.9375rem; }
p { margin: 0 0 0.75rem; }
ol, ul { padding-left: 1.25rem; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s4) 0; }
details summary { cursor: pointer; color: var(--text-muted); }
::selection { background: rgba(127, 140, 255, 0.35); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 0.8125rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.sr-only:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100; padding: 8px 12px; background: var(--surface); border-radius: var(--radius-sm); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.icon { flex: none; display: inline-block; vertical-align: middle; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #3c3c3c transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3c3c3c; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ==========================================================================
   3. App shell: sidebar, topbar, content
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

.initials {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; color: #fff; letter-spacing: 0.02em;
  background: linear-gradient(135deg, #5a67e8, #0fa594);
}
.initials.sm { width: 30px; height: 30px; font-size: 0.6875rem; }
.initials.lg { width: 56px; height: 56px; font-size: 1.05rem; }

.main { flex: 1; margin-left: var(--rail-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s3);
  min-height: var(--topbar-h); padding: 10px 28px;
  background: rgba(9, 9, 9, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
.topbar .title-wrap { flex: 1; min-width: 0; }
.topbar .title-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.topbar .title-row .icon-btn { width: 28px; height: 28px; }
.topbar .title { font-weight: 600; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--text-faint); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .icon { opacity: 0.7; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 10px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn.plain:hover { background: var(--surface); }
.count-badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-pill); background: var(--danger); color: #1a0b0c;
  font-size: 0.6875rem; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.profile-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; height: 38px;
  border-radius: var(--radius-pill); border: 1px solid var(--border-soft); background: var(--surface);
  color: var(--text); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.profile-btn:hover { background: var(--surface-2); }
.profile-btn .pname { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Popover panels (notifications, profile menu) */
.pop { position: relative; }
.pop-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: min(340px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px;
  opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top right;
  visibility: hidden; transition: opacity 0.14s var(--ease), transform 0.14s var(--ease), visibility 0.14s;
}
.pop-panel.open { opacity: 1; transform: none; visibility: visible; }
.pop-panel.narrow { width: 240px; }
.pop-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 6px; font-weight: 600; font-size: 0.8125rem; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--radius-sm);
  border: 0; background: none; color: var(--text); font: inherit; font-size: 0.8125rem; text-align: left; cursor: pointer; text-decoration: none;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); text-decoration: none; color: var(--text); }
.menu-item .icon { color: var(--text-muted); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border-soft); margin: 6px 4px; }
.menu-meta { padding: 8px 10px; font-size: 0.75rem; color: var(--text-muted); }

.content { padding: 24px 28px 40px; max-width: var(--content-max); width: 100%; margin: 0 auto; animation: page-in 0.28s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.content:focus { outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; font-size: 0.8125rem; }

@media (max-width: 900px) {
  .content { padding: 16px 16px 32px; }
  .topbar { padding: 8px 16px; gap: 8px; }
  .profile-btn .pname, .profile-btn > .icon { display: none; }
  .profile-btn { padding: 3px; }

}
@media (max-width: 600px) {
  /* Panels position against the full-width top bar; notifications are centred. */
  .topbar .pop { position: static; }
  .topbar .pop-panel { right: 12px; }
  .topbar .pop-panel:not(.narrow) { left: 12px; width: auto; max-width: 420px; margin-inline: auto; transform-origin: top center; }
}

/* ==========================================================================
   4. Banners & alerts
   ========================================================================== */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 28px; font-size: 0.8125rem; border-bottom: 1px solid var(--border-soft); }
.banner.warning { background: var(--warning-soft); color: var(--warning); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner a { color: inherit; font-weight: 600; text-decoration: underline; }
@media (max-width: 900px) { .banner { padding: 10px 16px; } }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.8125rem; border: 1px solid transparent; line-height: 1.45; }
.alert > .icon { margin-top: 1px; }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.alert.info { background: var(--info-soft); color: #b9d8ff; border-color: rgba(124, 183, 255, 0.2); }
.alert.warning { background: var(--warning-soft); color: #f7d08a; border-color: rgba(240, 181, 74, 0.22); }
.alert.danger { background: var(--danger-soft); color: #ffb3b5; border-color: rgba(242, 119, 122, 0.25); }
.alert.success { background: var(--success-soft); color: #94e3c0; border-color: rgba(61, 190, 139, 0.22); }

/* ==========================================================================
   5. Cards, grids, KPI tiles
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 0.9375rem; }
.card-head .sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.card-head a { font-size: 0.8125rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.card.flush { padding: 0; }
.card.flush > .card-head { padding: 16px 18px 0; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
@media (max-width: 560px) { .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .grid.kpis .kpi .value { font-size: 1.2rem; } }
@media (max-width: 340px) { .grid.kpis { grid-template-columns: minmax(0, 1fr); } }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid.dash { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid.dash-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: stretch; }
@media (max-width: 1180px) { .grid.dash, .grid.dash-wide { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 16px; }
.stack.tight > * + * { margin-top: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.section-title h2 { margin: 0; font-size: 0.9375rem; }

.kpi {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
a.kpi:hover { border-color: var(--control-border); background: #262626; text-decoration: none; color: inherit; }
.kpi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.kpi-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary-strong);
}
.kpi-icon.teal { background: var(--teal-soft); color: var(--teal); }
.kpi-icon.success { background: var(--success-soft); color: var(--success); }
.kpi-icon.warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.info { background: var(--info-soft); color: var(--info); }
.kpi .label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.kpi .value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .sub { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi.alert .value { color: var(--danger); }
.kpi .spark { position: absolute; right: 14px; bottom: 14px; width: 72px; height: 26px; opacity: 0.9; }
.kpi:has(.spark) .sub { padding-right: 80px; }
@media (max-width: 560px) { .kpi .spark { display: none; } .kpi:has(.spark) .sub { padding-right: 0; } }
.kpi .go { position: absolute; top: 12px; right: 12px; color: var(--text-faint); opacity: 0; transition: opacity 0.15s; }
a.kpi:hover .go { opacity: 1; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 0.75rem; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-muted); }

/* Quick actions */
.quick-actions { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
@media (max-width: 560px) { .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .qa { min-height: 96px; padding: 12px; } }
.qa {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border-radius: var(--radius); border: 1px solid var(--border-soft);
  background: var(--surface); color: var(--text); text-decoration: none; min-height: 112px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.qa::after {
  content: ""; position: absolute; width: 120px; height: 120px; right: -40px; top: -40px; border-radius: 50%;
  background: var(--qa-tint, rgba(127, 140, 255, 0.12)); filter: blur(4px); transition: transform 0.25s var(--ease);
}
.qa:hover { border-color: var(--control-border); background: #262626; text-decoration: none; color: var(--text); }
.qa .qa-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: var(--qa-grad, var(--gradient-primary)); position: relative; z-index: 1;
}
.qa .qa-title { font-weight: 600; font-size: 0.875rem; position: relative; z-index: 1; }
.qa .qa-desc { font-size: 0.75rem; color: var(--text-muted); position: relative; z-index: 1; margin-top: -6px; }
.qa .qa-go { position: absolute; top: 12px; right: 12px; color: var(--text-muted); z-index: 1; }
.qa.indigo { --qa-grad: linear-gradient(135deg, #5a67e8, #7f8cff); --qa-tint: rgba(127, 140, 255, 0.14); }
.qa.teal { --qa-grad: linear-gradient(135deg, #0b8f80, #2dd4bf); --qa-tint: rgba(79, 216, 196, 0.12); }
.qa.violet { --qa-grad: linear-gradient(135deg, #7a4fe0, #a78bfa); --qa-tint: rgba(167, 139, 250, 0.13); }
.qa.rose { --qa-grad: linear-gradient(135deg, #c2416a, #f472b6); --qa-tint: rgba(244, 114, 182, 0.12); }
.qa.amber { --qa-grad: linear-gradient(135deg, #b87412, #f0b54a); --qa-tint: rgba(240, 181, 74, 0.12); }
.qa.sky { --qa-grad: linear-gradient(135deg, #2f6fd6, #7cb7ff); --qa-tint: rgba(124, 183, 255, 0.12); }

/* Compact lists (recent items, alerts, timetables) */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-soft); min-width: 0; }
.list-item:first-child { border-top: 0; padding-top: 2px; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 0.75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-end { text-align: right; font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
a.list-item { color: inherit; text-decoration: none; border-radius: var(--radius-sm); }
a.list-item:hover { color: inherit; text-decoration: none; background: rgba(255, 255, 255, 0.02); }
.li-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-muted); }
.li-icon.warning { background: var(--warning-soft); color: var(--warning); }
.li-icon.danger { background: var(--danger-soft); color: var(--danger); }
.li-icon.success { background: var(--success-soft); color: var(--success); }
.li-icon.info { background: var(--info-soft); color: var(--info); }
.li-icon.primary { background: var(--primary-soft); color: var(--primary-strong); }

/* Meter rows (labelled bars) */
.meter-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 7px 0; }
.meter-row .m-label { font-size: 0.8125rem; display: flex; align-items: center; gap: 8px; min-width: 0; }
.meter-row .m-value { font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-row .progress { grid-column: 1 / -1; }

/* ==========================================================================
   6. Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 500; font-size: 0.8125rem; cursor: pointer; text-decoration: none;
  min-height: 36px; line-height: 1.2;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: #444444; color: var(--text); text-decoration: none; }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn.primary {
  background: var(--gradient-primary); border-color: var(--control-border); color: #fff; font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}
.btn.primary:hover { background: var(--gradient-primary-hover); border-color: var(--control-border-strong); color: #fff; }
.btn.danger { background: #c8464b; border-color: transparent; color: #fff; font-weight: 600; }
.btn.danger:hover { background: #d4545a; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 0.78rem; }
.btn.block { width: 100%; }
.btn.lg { min-height: 44px; font-size: 0.9rem; padding: 10px 18px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }
.btn.primary .spinner { border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary-strong); cursor: pointer; font: inherit; font-weight: 500; }
.link-btn:hover { color: #c9ceff; text-decoration: underline; text-underline-offset: 3px; }

.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border-soft); }
.segmented button {
  border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 0.75rem; font-weight: 600;
  padding: 5px 10px; border-radius: 6px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); }

/* ==========================================================================
   7. Forms
   ========================================================================== */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 500; font-size: 0.8125rem; color: #d9d9d9; }
.field .hint { font-size: 0.75rem; color: var(--text-muted); }
.field .error { font-size: 0.75rem; color: var(--danger); }
.field .error:empty { display: none; }
input, select, textarea {
  font: inherit; font-size: 0.875rem; color: var(--text); background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 11px; min-height: 38px; width: 100%;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s;
}
input::placeholder, textarea::placeholder { color: #797979; }
input:hover, select:hover, textarea:hover { border-color: #444444; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--surface); color: var(--text); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--control-border-strong); outline: none; box-shadow: 0 0 0 3px rgba(214, 214, 214, 0.12); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(242, 119, 122, 0.15); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: auto; accent-color: #565656; padding: 0; }
input[type="file"] { padding: 6px; }
input[type="file"]::file-selector-button { font: inherit; font-size: 0.78rem; margin-right: 10px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
.otp-input { font-family: var(--mono); font-size: 1.4rem; letter-spacing: 0.4em; text-align: center; max-width: 240px; }

/* Inputs with a leading icon and optional trailing action (password reveal) */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon.lead { position: absolute; left: 12px; color: var(--text-faint); pointer-events: none; transition: color 0.15s; }
.input-wrap > input { padding-left: 38px; }
.input-wrap.has-trail > input { padding-right: 42px; }
.input-wrap:focus-within > .icon.lead { color: var(--text); }
.input-wrap .trail {
  position: absolute; right: 4px; width: 34px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 6px; background: none; color: var(--text-faint); cursor: pointer;
}
.input-wrap .trail:hover { color: var(--text); background: var(--surface-2); }

/* ==========================================================================
   8. Tables
   ========================================================================== */
.table-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.table-tools input, .table-tools select, .row > select, .row > input:not([type="checkbox"]) { width: auto; max-width: 100%; }
.table-tools input[type="search"] { width: min(280px, 100%); padding-left: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a92a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 11px 50%; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
th {
  background: #262626; font-weight: 600; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); white-space: nowrap; position: sticky; top: 0;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th[aria-sort]::after { content: " ↑"; color: var(--primary-strong); }
th[aria-sort="descending"]::after { content: " ↓"; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.card table th { background: transparent; }
.card > table td:first-child, .card > table th:first-child { padding-left: 0; }
.card > table td:last-child, .card > table th:last-child { padding-right: 0; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 0 0; font-size: 0.78rem; color: var(--text-muted); }
.pager .page-size { margin-right: auto; width: auto; min-height: 0; padding: 4px 28px 4px 8px; font-size: inherit; }

/* ==========================================================================
   9. Badges, tabs, states
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--text-muted); white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--primary-soft); color: var(--primary-strong); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-soft); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; font: inherit; font-size: 0.8125rem; padding: 10px 14px; cursor: pointer; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500;
  transition: color 0.15s;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

.state { padding: 36px 16px; text-align: center; color: var(--text-muted); font-size: 0.8125rem; }
.state .state-icon { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-faint); }
.state .state-title { font-weight: 600; color: var(--text); margin-bottom: 4px; font-size: 0.875rem; }
.state.error .state-title { color: var(--danger); }
.state.compact { padding: 20px 12px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(127, 140, 255, 0.22); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; min-height: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.skeleton-grid .skeleton { height: 96px; border-radius: var(--radius); }

/* ==========================================================================
   10. Toasts & dialogs
   ========================================================================== */
/* Top-right, above everything (including modal dialogs: see raiseToasts() in ui.js). */
.toasts {
  position: fixed; inset: 16px 16px auto auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible;
  width: min(420px, calc(100vw - 32px)); max-width: none; height: auto; color: inherit;
  display: grid; gap: 8px; z-index: 2147483647; pointer-events: none;
}
.toasts:popover-open { display: grid; }
.toasts[popover]:not(:popover-open) { display: none; }
.toast {
  pointer-events: auto; display: flex; align-items: baseline; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: rgba(36, 36, 36, 0.66); color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 0.8125rem; word-break: break-word; animation: toast-in 0.2s var(--ease);
}
.toast::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--info); transform: translateY(-1px); }
.toast.success::before { background: var(--success); }
.toast.error::before { background: var(--danger); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .toast { background: #2e2e2e; }
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
dialog {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; box-shadow: var(--shadow-lg);
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  background: var(--surface); color: var(--text);
}
dialog[open] { animation: dlg-in 0.18s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
dialog.wide { width: min(960px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(3, 3, 3, 0.66); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.dialog-head h2 { margin: 0; font-size: 1rem; }
.dialog-body { padding: 18px; overflow-y: auto; max-height: calc(100vh - 160px); }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border-soft); background: rgba(0, 0, 0, 0.08); }

/* ==========================================================================
   11. Charts
   ========================================================================== */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--text-faint); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .mark { transition: opacity 0.12s; }
.chart .mark.dim { opacity: 0.45; }
.chart-wrap { position: relative; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 140px;
  background: #101010; border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 0.75rem;
  opacity: 0; transform: translateY(4px); transition: opacity 0.1s, transform 0.1s;
}
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip .tt-title { color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .tt-key { width: 10px; height: 2px; border-radius: 2px; background: var(--c); flex: none; }
.chart-tip .tt-val { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 10px; }
.chart-tip .tt-name { color: var(--text-muted); }
.chart-empty { display: grid; place-items: center; min-height: 180px; color: var(--text-muted); font-size: 0.8125rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); text-align: center; padding: 16px; }
.legend { display: flex; gap: 14px; font-size: 0.75rem; color: var(--text-muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); }
.legend.lines span::before { height: 2px; width: 12px; border-radius: 2px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { position: relative; width: 132px; height: 132px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .donut-value { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.donut .donut-label { font-size: 0.6875rem; color: var(--text-muted); }
.donut-legend { display: grid; gap: 6px; font-size: 0.78rem; flex: 1; min-width: 140px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.donut-legend b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ==========================================================================
   12. Misc components
   ========================================================================== */
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; border: 1px solid var(--border); }
.avatar.lg { width: 88px; height: 88px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 0.8125rem; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; }
.ph-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; }
.ph-label { font-size: 0.75rem; color: var(--text-muted); margin-right: 2px; }
.ph-chip {
  font: inherit; font-family: var(--mono); font-size: 0.72rem; padding: 3px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}
.ph-chip:hover { background: var(--surface-3); border-color: var(--control-border-strong); }
.ph-chip:active { transform: translateY(1px); }
/* Multi-select chips (checkbox inside a pill), e.g. classes and subjects for a new assessment */
/* Getting-started checklist */
.setup-steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
.setup-steps li { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.setup-steps li.done { color: var(--text-muted); text-decoration: line-through; }
.setup-steps li.done .icon { color: var(--success, #3fb950); }

/* Bulk actions on the Students list */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; margin: 0 0 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); position: sticky; top: 0; z-index: 5; }
.bulk-bar[hidden] { display: none; }

/* Loading placeholders (instead of a spinner) */
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: skeleton 1.2s ease infinite; }
.skeleton.title { height: 22px; width: 40%; }
.skeleton.block { height: 90px; }
.skeleton-rows { display: grid; gap: 10px; padding: 8px 0; }
.skeleton-rows .skeleton:nth-child(3n) { width: 70%; }
.skeleton-page { display: grid; gap: 14px; padding: 4px 0; }
.skeleton-page .skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Show on phones only / hide on phones */
.only-narrow { display: none; }
@media (max-width: 640px) {
  .only-narrow { display: block; }
  .hide-narrow { display: none; }
}

/* Lists become cards on phones: each cell shows its column name. */
@media (max-width: 640px) {
  .table-wrap.responsive table, .table-wrap.responsive tbody { display: block; width: 100%; }
  .table-wrap.responsive thead { display: none; }
  .table-wrap.responsive tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .table-wrap.responsive td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .table-wrap.responsive td.num { justify-content: space-between; }
  .table-wrap.responsive td::before { content: attr(data-label); color: var(--text-faint); font-size: 0.75rem; text-align: left; flex: none; }
  .table-wrap.responsive td[data-label=""]::before { content: none; }
  .table-wrap.responsive td:first-child { justify-content: flex-start; }
  .table-wrap.responsive td > :only-child { margin-left: auto; }
}

/* Registers on phones: big targets and the Save button always in reach. */
@media (max-width: 768px) {
  .attendance-toggle label, .status-chips label { min-height: 44px; min-width: 44px; padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; }
  .mark-input { min-height: 44px; font-size: 1.05rem; }
  .sticky-actions { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); z-index: 6; background: var(--bg-elevated); border-top: 1px solid var(--border); padding: 10px 12px; margin: 12px -12px 0; }
}

/* One student at a time (marks on phones) */
.one-at-a-time { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.one-at-a-time .oat-name { font-size: 1.2rem; font-weight: 700; }
.one-at-a-time .oat-input { font-size: 2rem; text-align: center; padding: 12px; min-height: 64px; }
.one-at-a-time .oat-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.one-at-a-time .oat-nav .btn { min-height: 48px; }

/* Toast with an Undo / action button */
.toast .toast-action { margin-left: 10px; }

.sum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 16px; }
.sum-tile { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: inherit; text-decoration: none; min-width: 0; }
a.sum-tile:hover { border-color: var(--text-muted); text-decoration: none; }
.sum-tile .sum-label { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.sum-tile .sum-value { font-size: 1.15rem; font-weight: 700; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-tile .sum-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-tile.warn { border-color: var(--warning, #e6ab45); }
.sum-tile.warn .sum-value { color: var(--warning, #e6ab45); }
.sum-tile.ok .sum-value { color: var(--success, #3fb950); }

/* Birthdays this week (admin home) */
.birthdays .bday-today { font-size: 0.75rem; font-weight: 700; color: var(--success); }

/* Admission forms (online application page and Settings) */
.apply-forms h2 { margin-bottom: 4px; }
.apply-form-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.apply-form-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.apply-form-list a { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; min-height: 32px; }

/* School health (admin) */
.health-hero-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
@media (max-width: 640px) { .health-hero-body { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 16px; } .health-summary { width: 100%; } }
.health-score { display: grid; justify-items: center; gap: 10px; }
.score-ring { position: relative; width: 148px; height: 148px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .score-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.score-ring .score-value { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.score-ring .score-of { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.health-lead { font-size: 1rem; font-weight: 600; margin: 0 0 10px; }
.health-callout { font-size: 0.8125rem; color: var(--text-2); padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 6px; }
.health-band { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: var(--radius-pill); white-space: nowrap; background: var(--surface-3); color: var(--text-muted); }
.health-band.good { background: var(--success-soft); color: var(--success); }
.health-band.fair { background: var(--warning-soft); color: var(--warning); }
.health-band.poor { background: var(--danger-soft); color: var(--danger); }
.health-band.big { font-size: 0.8125rem; padding: 4px 10px; }
.health-chart-title { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin: 14px 0 6px; }
.health-bars { display: grid; gap: 7px; }
.health-bar-row { display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr) 28px 16px; gap: 10px; align-items: center; font-size: 0.8125rem; }
.health-bar-row .hb-name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-bar-row .hb-track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.health-bar-row .hb-fill { display: block; height: 100%; border-radius: 4px; background: var(--chart-1); }
.health-bar-row .hb-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.health-bar-row .hb-band { display: inline-flex; color: var(--text-faint); }
.health-bar-row .hb-band.good { color: var(--success); }
.health-bar-row .hb-band.fair { color: var(--warning); }
.health-bar-row .hb-band.poor { color: var(--danger); }
.health-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); margin-top: 16px; align-items: start; }
.health-area { display: flex; flex-direction: column; min-width: 0; }
.health-area-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.health-area-head h2 { margin: 0; font-size: 0.9375rem; flex: 1; min-width: 0; }
.health-area-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--text-muted); flex: none; }
.health-headline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.health-big { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.health-what { font-size: 0.8125rem; color: var(--text-muted); }
.health-delta { margin-top: 2px; font-size: 0.75rem; }
.health-delta .delta { display: inline-flex; align-items: center; gap: 4px; }
.health-delta .delta.flat { color: var(--text-muted); }
.chart.mini text { font-size: 10px; }
.chart-empty.mini { min-height: 72px; font-size: 0.75rem; }
.health-facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin: 12px 0 0; font-size: 0.8125rem; }
.health-facts dt { color: var(--text-muted); }
.health-facts dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.health-reading { font-size: 0.8125rem; color: var(--text-2); margin: 12px 0 0; }
.health-next { display: flex; gap: 6px; align-items: flex-start; font-size: 0.8125rem; margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.health-next .icon { flex: none; margin-top: 2px; color: var(--text-muted); }
.health-link { margin-top: 12px; font-size: 0.8125rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; }
.health-area.is-empty p { margin: 0; font-size: 0.8125rem; }
.health-weight { color: var(--text-faint); margin-top: 6px !important; }
.health-how { margin-top: 16px; }
.health-how summary { cursor: pointer; font-weight: 600; }
.health-targets { width: 100%; border-collapse: collapse; font-size: 0.8125rem; margin: 10px 0; }
.health-targets th, .health-targets td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--border-soft); }
.health-targets td:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.btn.disabled { opacity: 0.45; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); font-size: 0.8rem; }
.photo-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--surface-3); border: 1px solid var(--border); flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.photo-thumb.lg { width: 96px; height: 96px; }
.person-card { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.person-card .pc-main { flex: 1 1 auto; min-width: 0; }
.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.status-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.status-chips label { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); cursor: pointer; font-size: 0.8rem; }
.status-chips input { margin: 0; }
.status-chips label:has(input:checked) { background: var(--surface-3); border-color: var(--text-muted); font-weight: 600; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 168px; overflow: auto; padding: 2px; }
.pick { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); font-size: 0.8rem; cursor: pointer; user-select: none; transition: background 0.12s, border-color 0.12s; }
.pick:hover { border-color: var(--control-border-strong); }
.pick input { width: 14px; height: 14px; margin: 0; }
.pick:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); font-weight: 600; }
.pick:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.pick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pick-head .link-btn { font-size: 0.75rem; }
.sms-meter { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.78rem; color: var(--text-muted); padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.sms-meter strong { color: var(--text); }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: var(--gradient-accent); border-radius: inherit; transition: width 0.6s var(--ease); }
.progress.success > div { background: var(--success); }
.progress.warning > div { background: var(--warning); }
.progress.danger > div { background: var(--danger); }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-family: var(--mono); font-size: 0.95rem; padding: 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.qr { background: #fff; padding: 10px; border-radius: var(--radius-sm); width: 200px; height: 200px; }
.attendance-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-elevated); }
.attendance-toggle label { padding: 5px 10px; cursor: pointer; font-size: 0.78rem; border-right: 1px solid var(--border); color: var(--text-muted); transition: background 0.12s, color 0.12s; }
.attendance-toggle label:last-child { border-right: 0; }
.attendance-toggle label:hover { color: var(--text); }
.attendance-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.attendance-toggle label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.attendance-toggle input:checked + span { font-weight: 700; }
.attendance-toggle label:has(input[value="present"]:checked) { background: var(--success-soft); color: var(--success); }
.attendance-toggle label:has(input[value="late"]:checked) { background: var(--warning-soft); color: var(--warning); }
.attendance-toggle label:has(input[value="absent"]:checked) { background: var(--danger-soft); color: var(--danger); }
.mark-input { width: 90px; }
.pill-select { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-select button {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
}
.pill-select button[aria-pressed="true"] { border-color: var(--control-border-strong); color: var(--text); background: var(--surface-2); }
.att-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(14px, 1fr)); gap: 4px; }
.att-strip i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-3); }
.att-strip i.present { background: var(--chart-present); }
.att-strip i.late { background: var(--chart-late); }
.att-strip i.absent { background: var(--chart-absent); }
.grade-chip { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 6px; border-radius: 6px; font-weight: 700; font-size: 0.75rem; background: var(--primary-soft); color: var(--primary-strong); }

/* ==========================================================================
   13. Auth pages (login, sign-up, offline) - glassmorphism over campus image
   ========================================================================== */
.auth-wrap {
  position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 85% 0%, rgba(127, 140, 255, 0.22), transparent 60%),
    radial-gradient(700px 480px at 0% 100%, rgba(79, 216, 196, 0.14), transparent 60%),
    linear-gradient(180deg, rgba(13, 13, 13, 0.78) 0%, rgba(13, 13, 13, 0.62) 45%, rgba(13, 13, 13, 0.9) 100%),
    url("../assets/images/login-background.jpg");
  background-size: auto, auto, auto, cover;
  background-position: center, center, center, center 40%;
  background-repeat: no-repeat;
  isolation: isolate;
}
.auth-wrap::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(600px 400px at 50% 45%, rgba(9, 9, 9, 0.55), transparent 70%);
}
.auth-card {
  position: relative;
  width: min(440px, 100%);
  padding: 28px;
  background: rgba(29, 29, 29, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: rise-in 0.5s var(--ease) both;
  transition: border-color 0.25s var(--ease);
}
.auth-card:focus-within { border-color: rgba(255, 255, 255, 0.14); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .auth-card { background: rgba(29, 29, 29, 0.95); }
}
.auth-card .brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; }
.auth-card .brand img { width: 40px; height: 40px; border-radius: 11px; }
.auth-card .brand .brand-mark { width: 40px; height: 40px; }
.auth-card .auth-sub { text-align: center; color: var(--text-muted); font-size: 0.8125rem; margin-bottom: 20px; }
.auth-card h1 { font-size: 1.2rem; }
.auth-card input:not([type="checkbox"]):not([type="radio"]) { background: rgba(13, 13, 13, 0.55); border-color: rgba(255, 255, 255, 0.1); min-height: 42px; }
.auth-card input:not([type="checkbox"]):not([type="radio"]):focus { border-color: var(--control-border-strong); background: rgba(13, 13, 13, 0.7); }
.auth-card .btn.primary[type="submit"] { min-height: 44px; font-size: 0.875rem; }
.auth-tabs {
  --i: 0;
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(13, 13, 13, 0.5); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 10px; padding: 4px; margin-bottom: 18px;
}
/* Sliding selection pill: moves between tabs instead of re-painting them. */
.auth-tabs::before {
  content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3);
  border-radius: 7px; background: var(--gradient-segment); border: 1px solid var(--control-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transform: translateX(calc(var(--i) * 100%)); transition: transform 0.28s var(--ease);
}
.auth-tabs button { position: relative; z-index: 1; border: 0; background: none; padding: 8px 4px; border-radius: 7px; font: inherit; font-weight: 600; font-size: 0.78rem; color: var(--text-muted); cursor: pointer; transition: color 0.2s var(--ease); }
.auth-tabs button:hover { color: var(--text); }
.auth-tabs button[aria-selected="true"] { color: #fff; }
.auth-body, .auth-panel { min-width: 0; }

/* Sign-up introduction: cards that snap as you swipe, with Back/Next and dots. */
.intro-card { width: min(480px, 100%); }
/* contain: the cards side by side must not widen the sign-up card (they scroll inside it). */
.intro-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; contain: inline-size;
  scrollbar-width: none; border-radius: var(--radius-sm); outline-offset: 4px;
}
.intro-track::-webkit-scrollbar { display: none; }
.intro-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; padding: 2px; }
.intro-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.intro-slide h2 { font-size: 1.15rem; line-height: 1.25; margin: 0; }
.intro-slide p { margin: 0 0 12px; font-size: 0.875rem; line-height: 1.55; }
.intro-slide p.small { font-size: 0.8125rem; }
.intro-icon {
  flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary-strong); border: 1px solid rgba(127, 140, 255, 0.25);
}
.intro-points { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 9px; }
.intro-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 0.8125rem; line-height: 1.45; }
.intro-point-icon {
  flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.06); color: var(--teal);
}
.intro-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 16px; }
.intro-nav .btn { min-height: 44px; }
.intro-nav .btn.ghost { justify-self: start; }
.intro-nav .btn.primary { justify-self: end; }
.intro-dots { display: flex; justify-content: center; }
.intro-dot { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.intro-dot::before {
  content: ""; width: 8px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.24);
  transition: width 0.25s var(--ease), background-color 0.25s var(--ease);
}
.intro-dot[aria-current]::before { width: 22px; background: var(--primary); }
@media (max-width: 420px) {
  .intro-nav { grid-template-columns: 1fr 1fr; }
  .intro-dots { grid-column: 1 / -1; grid-row: 1; }
}
@media (prefers-reduced-motion: reduce) { .intro-dot::before { transition: none; } }

/* Sign-in page fits the viewport (100vh, then 100svh where supported); taller
   steps such as 2FA enrolment scroll inside it without clipping the top. */
.auth-wrap.auth-fit {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  height: 100vh; height: 100svh; min-height: 0; overflow-y: auto; padding: 16px;
}
.auth-fit > .auth-card { margin: auto 0; flex: none; }
.auth-fit > .install-hint { flex: none; margin-top: 10px; }
@media (max-height: 780px) {
  .auth-fit .auth-card { padding: 20px 22px; }
  .auth-fit .auth-card .brand { margin-bottom: 2px; }
  .auth-fit .auth-sub { margin-bottom: 12px; }
  .auth-fit .auth-card h1 { margin-bottom: 10px !important; }
  .auth-fit .auth-tabs { margin-bottom: 12px; }
  .auth-fit .form { gap: 10px; }
  .auth-fit .auth-legal { margin-top: 12px; }
}
@media (max-height: 640px) {
  .auth-fit .auth-sub { margin-bottom: 10px; }
  .auth-fit .auth-legal { margin-top: 10px; }
  .auth-fit .auth-card .btn.primary[type="submit"] { min-height: 40px; }
}
.auth-legal { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; margin-top: 18px; font-size: 0.72rem; color: var(--text-faint); }
.auth-legal a { color: var(--text-faint); }
.auth-legal a:hover { color: var(--text); }
.version-tag {
  padding: 1px 7px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.66rem; letter-spacing: 0.02em; color: var(--text-faint);
}
.install-hint { margin-top: 14px; font-size: 0.8125rem; text-align: center; color: var(--text-muted); }
.auth-wrap > .install-hint { position: relative; }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .auth-card { padding: 22px 18px; border-radius: 16px; } }

/* ==========================================================================
   14. Landing page & public pages (flat, editorial; display font)
   ========================================================================== */
.landing {
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
}
.site-head, .site-foot {
  width: min(1200px, 100%); margin: 0 auto; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; color: var(--text); }
.wordmark:hover { color: var(--text); text-decoration: none; }
.wordmark img { width: 36px; height: 36px; }
.site-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-pill); border: 1px solid var(--control-border); color: var(--text); font-weight: 600; font-size: 0.8125rem; }
.site-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.site-foot { padding-top: 12px; padding-bottom: 24px; font-size: 0.78rem; color: var(--text-faint); flex-wrap: wrap; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-foot a { color: var(--text-muted); white-space: nowrap; }
.site-foot a:hover { color: var(--text); }

/* Entrance */
.reveal { opacity: 0; transform: translateY(14px); animation: reveal 0.6s var(--ease) forwards; }
.reveal.d1 { animation-delay: 0.05s; }
.reveal.d2 { animation-delay: 0.15s; }
.reveal.d3 { animation-delay: 0.25s; }
.reveal.d4 { animation-delay: 0.35s; }
@keyframes reveal { to { opacity: 1; transform: none; } }
/* ---- Home: full-bleed photo hero with text on it ------------------------
   The photo is web/assets/images/hero.jpg (replace the file to change it; keep
   the subject on the right). The page is exactly one viewport tall and the
   photo fills the whole screen, edge to edge. */
.landing.home { height: 100vh; height: 100svh; min-height: 0; overflow: hidden; padding: 0; background: #0e0e0e; }
.stage {
  position: relative; isolation: isolate; height: 100%; overflow: hidden;
  display: flex; flex-direction: column;
  background: #0e0e0e;
}
/* The photo fades in close up, then slowly pulls back and pans across the scene
   (a "Ken Burns" move), alternating so it never jumps if the page stays open. */
.stage-photo {
  position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%;
  object-fit: cover; object-position: 70% 50%; transform-origin: 70% 55%;
  will-change: scale, translate;
  animation: settle 1.2s var(--ease) both, ken-burns 9s cubic-bezier(0.37, 0, 0.25, 1) infinite alternate both;
}
/* One scrim for legibility: solid on the text side, clear over the subject. */
.stage::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(12, 12, 12, 0.9) 0%, rgba(12, 12, 12, 0.72) 38%, rgba(12, 12, 12, 0.18) 68%, rgba(12, 12, 12, 0.05) 100%);
}
/* Warm late-afternoon light drifting across the photo. */
.stage::after {
  content: ""; position: absolute; inset: -20%; z-index: -1; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(35% 45% at 50% 50%, rgba(242, 181, 68, 0.22) 0%, rgba(242, 181, 68, 0.07) 45%, transparent 70%);
  animation: sun-drift 9s ease-in-out infinite alternate both;
}
@keyframes settle { from { opacity: 0; } to { opacity: 1; } }
@keyframes ken-burns {
  from { scale: 1.12; translate: 2.5% 1%; }
  to { scale: 1.03; translate: -0.6% -0.5%; } /* keep scale overflow > pan so no edge shows */
}
@keyframes sun-drift {
  from { translate: 28% -22%; opacity: 0.6; }
  to { translate: 8% -6%; opacity: 1; }
}
.stage .site-head, .stage .site-foot { width: 100%; padding-left: clamp(18px, 4.5vw, 64px); padding-right: clamp(18px, 4.5vw, 64px); }
.stage .site-head { padding-top: clamp(14px, 3vh, 28px); padding-bottom: 0; }
.stage .site-foot { padding-top: 8px; padding-bottom: clamp(12px, 2.6vh, 26px); color: rgba(244, 244, 244, 0.6); }
.stage .site-foot a { color: rgba(244, 244, 244, 0.75); }
.stage .site-foot a:hover { color: #fff; }
.stage .site-link { background: rgba(15, 15, 15, 0.45); border-color: rgba(255, 255, 255, 0.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.stage .site-link:hover { background: rgba(15, 15, 15, 0.7); }

.hero {
  flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(8px, 2vh, 24px) clamp(18px, 4.5vw, 64px);
}
.hero-copy { max-width: min(640px, 100%); }
.hero h1 {
  font-family: var(--font-display); font-weight: 750; color: #fff;
  font-size: clamp(2.2rem, min(5.6vw, 9.6vh), 5rem);
  line-height: 1.02; letter-spacing: -0.04em; margin: 0 0 clamp(12px, 2.6vh, 24px);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}
.hero h1 .accent { position: relative; display: inline-block; }
.hero h1 .squiggle { position: absolute; left: -3%; width: 106%; bottom: -0.2em; height: 0.34em; overflow: visible; }
.hero h1 .squiggle path { fill: none; stroke: var(--sun); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 420; stroke-dashoffset: 420; animation: draw 0.9s 0.6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.hero .lede { font-size: clamp(0.92rem, min(1.5vw, 2.3vh), 1.12rem); color: rgba(244, 244, 244, 0.86); max-width: 470px; margin: 0 0 clamp(16px, 3.6vh, 34px); line-height: 1.6; }
.hero .lede strong { color: #fff; }

.boot { width: min(380px, 100%); }
.boot-status { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 0.8125rem; color: rgba(244, 244, 244, 0.75); margin-bottom: 10px; }
.boot-status strong { font-family: var(--font-display); font-size: 1.05rem; color: #fff; font-variant-numeric: tabular-nums; }
.boot-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.boot-bar > div { height: 100%; width: 0; border-radius: inherit; background: var(--sun); }
.boot-bar.run > div { animation: fill 5s linear forwards; }
@keyframes fill { to { width: 100%; } }
.skip { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 0.8125rem; font-weight: 600; color: #fff; }
.skip:hover { color: var(--sun); text-decoration: none; }

/* Feature badges down the right edge (decorative; the copy carries the meaning) */
.badges { position: absolute; right: clamp(16px, 3.5vw, 48px); top: 50%; transform: translateY(-50%); display: grid; gap: 14px; }
.badge-gem {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.55); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  transform: rotate(-8deg); opacity: 0; animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.badge-gem:nth-child(1) { background: #f29b38; animation-delay: 0.5s; }
.badge-gem:nth-child(2) { background: #3dbe8b; animation-delay: 0.62s; transform: rotate(6deg); }
.badge-gem:nth-child(3) { background: #5b7cfa; animation-delay: 0.74s; }
@keyframes pop { from { opacity: 0; scale: 0.6; } to { opacity: 1; scale: 1; } }

/* Home page links for new visitors (a signed-in device sees the countdown instead). */
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.hero-cta .mk-btn:not(.primary) { background: rgba(15, 15, 15, 0.45); border-color: rgba(255, 255, 255, 0.28); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.hero-more { flex-basis: 100%; font-size: 0.8125rem; font-weight: 600; color: rgba(244, 244, 244, 0.8); }
.hero-more:hover { color: #fff; }
.stage .site-nav > a:not(.site-link) { color: rgba(244, 244, 244, 0.82); }
.stage .site-nav > a:not(.site-link):hover { color: #fff; }

@media (max-width: 760px) {
  .stage-photo { object-position: 62% 50%; }
  .stage::before { background: linear-gradient(180deg, rgba(12, 12, 12, 0.55) 0%, rgba(12, 12, 12, 0.35) 30%, rgba(12, 12, 12, 0.8) 62%, rgba(12, 12, 12, 0.94) 100%); }
  .hero { justify-content: flex-end; }
  .hero h1 { font-size: clamp(2rem, min(10.5vw, 6.6vh), 3.2rem); }
  .badges { top: clamp(70px, 14vh, 120px); transform: none; gap: 10px; }
  .badge-gem { width: 38px; height: 38px; border-radius: 12px; }
}
@media (max-height: 460px) { .hero .lede, .hero-more { display: none; } .badges { display: none; } }
@media (max-width: 760px) and (max-height: 640px) { .badges { display: none; } }

/* Legal pages (privacy, terms) */
.legal { width: min(760px, 100%); margin: 0 auto; padding: 16px 24px 48px; }
.legal h1 { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.035em; line-height: 1.05; margin: 12px 0 8px; }
.legal .updated { color: var(--text-muted); font-size: 0.8125rem; margin-bottom: 28px; }
.legal .intro { font-size: 1.02rem; color: #d9d9d9; }
.legal h2 { font-family: var(--font-display); font-size: 1.3rem; letter-spacing: -0.02em; margin: 36px 0 10px; padding-top: 4px; }
.legal h3 { font-size: 0.95rem; margin: 18px 0 6px; }
.legal p, .legal li { color: #cecece; font-size: 0.9375rem; line-height: 1.7; }
.legal ul { padding-left: 1.2rem; margin: 0 0 12px; }
.legal li + li { margin-top: 4px; }
.legal strong { color: var(--text); }
.legal .toc { margin: 0 0 8px; padding: 16px 20px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); }
.legal .toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 28px; }
.legal .toc li { font-size: 0.8125rem; }
.legal .toc a { color: var(--text-muted); }
.legal .toc a:hover { color: var(--text); }
.legal .note { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border-soft); }
@media (max-width: 560px) { .legal .toc ol { columns: 1; } .legal { padding-left: 16px; padding-right: 16px; } }

/* Contact page */
.contact-card {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 28px 0 8px; padding: 20px 22px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg); background: var(--surface);
}
.contact-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: rgba(242, 181, 68, 0.14); color: var(--sun); }
.contact-main { flex: 1 1 220px; min-width: 0; }
.contact-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.legal .contact-value { display: inline-block; margin: 2px 0; font-family: var(--font-display); font-size: clamp(1.35rem, 4.6vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; }
.legal .contact-value:hover { color: var(--sun); text-decoration: none; }
.contact-sub { font-size: 0.8125rem; color: var(--text-muted); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 560px) { .contact-actions { width: 100%; } .contact-actions .mk-btn { flex: 1; justify-content: center; } }

/* Public header links (About, Documentation, Sign in) */
.site-nav { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.site-nav > a:not(.site-link) { padding: 8px 12px; border-radius: var(--radius-pill); color: var(--text-muted); font-weight: 600; font-size: 0.8125rem; }
.site-nav > a:not(.site-link):hover, .site-nav > a[aria-current="page"] { color: var(--text); text-decoration: none; }
.site-nav > a[aria-current="page"] { background: var(--surface-2); }
.site-nav .site-link { margin-left: 6px; }
@media (max-width: 520px) {
  .site-head { padding-left: 16px; padding-right: 16px; gap: 8px; }
  .site-nav { gap: 0; }
  .site-nav > a:not(.site-link) { padding: 8px 7px; }
  .site-nav .site-link { margin-left: 4px; padding: 7px 12px; }
  .wordmark { font-size: 1.1rem; gap: 8px; } .wordmark img { width: 28px; height: 28px; }
}
/* Small phones: Docs and Contact move to the footer only (unless it's the page you're on). */
@media (max-width: 520px) { .site-nav > a[href="/docs/"]:not([aria-current]), .site-nav > a[href="/contact/"]:not([aria-current]) { display: none; } }
@media (max-width: 400px) { .site-nav > a:not(.site-link) { padding-left: 5px; padding-right: 5px; } }

/* ---- About (marketing) ---- */
.mk { width: min(1200px, 100%); margin: 0 auto; padding: 0 24px 24px; }
.mk-hero {
  position: relative; isolation: isolate; overflow: hidden; border-radius: clamp(18px, 2.4vw, 28px);
  padding: clamp(40px, 8vw, 96px) clamp(22px, 6vw, 72px); margin-top: 8px;
  background: radial-gradient(90% 120% at 100% 0%, rgba(242, 181, 68, 0.18) 0%, transparent 55%),
    radial-gradient(80% 110% at 0% 100%, rgba(127, 140, 255, 0.2) 0%, transparent 60%), #0f0f0f;
  border: 1px solid var(--border-soft);
}
.mk-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.35;
  background: url("/assets/images/hero.jpg") 85% 40% / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000 100%); mask-image: linear-gradient(90deg, transparent 35%, #000 100%);
}
.mk-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sun); margin: 0 0 14px; }
.mk-hero h1, .mk h2 { font-family: var(--font-display); color: #fff; letter-spacing: -0.035em; }
.mk-hero h1 { font-size: clamp(2.2rem, 6vw, 4.4rem); line-height: 1.02; margin: 0 0 18px; max-width: 760px; font-weight: 750; }
.mk-hero h1 em { font-style: normal; color: var(--sun); }
.mk-hero .lede { font-size: clamp(1rem, 1.6vw, 1.15rem); color: rgba(244, 244, 244, 0.82); line-height: 1.65; max-width: 600px; margin: 0 0 28px; }
.mk-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.mk-btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: var(--radius-pill); font-weight: 700; font-size: 0.9rem; border: 1px solid var(--control-border); color: var(--text); background: rgba(15, 15, 15, 0.5); }
.mk-btn:hover { text-decoration: none; color: #fff; border-color: var(--control-border-strong); }
.mk-btn.primary { background: var(--sun); border-color: var(--sun); color: #141414; }
.mk-btn.primary:hover { background: #f6c460; color: #141414; }
.mk-proof { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; }
.mk-proof li { padding: 16px 18px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); }
.mk-proof strong { display: block; font-family: var(--font-display); font-size: 1.15rem; color: #fff; letter-spacing: -0.02em; }
.mk-proof span { font-size: 0.8125rem; color: var(--text-muted); }
.mk-section { padding: clamp(48px, 8vw, 88px) 0 0; }
.mk-section > header { max-width: 720px; margin-bottom: 28px; }
.mk h2 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); line-height: 1.08; margin: 0 0 12px; font-weight: 720; }
.mk-section > header p { color: var(--text-2); font-size: 1rem; line-height: 1.65; margin: 0; }
.mk-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mk-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mk-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mk-card {
  --tone: var(--primary);
  padding: 22px; border-radius: 18px; border: 1px solid color-mix(in srgb, var(--tone) 22%, var(--border-soft));
  background: radial-gradient(140% 120% at 0% 0%, color-mix(in srgb, var(--tone) 16%, transparent) 0%, transparent 60%), var(--surface);
}
.mk-card h3 { font-size: 1.05rem; color: #fff; margin: 14px 0 8px; letter-spacing: -0.01em; }
.mk-card p { color: var(--text-2); font-size: 0.9rem; line-height: 1.6; margin: 0; }
.mk-card ul { margin: 10px 0 0; padding-left: 1.1rem; color: var(--text-2); font-size: 0.875rem; line-height: 1.6; }
.mk-card li + li { margin-top: 4px; }
.mk-card.t-sun { --tone: var(--sun); } .mk-card.t-teal { --tone: #4fd8c4; } .mk-card.t-green { --tone: #4ade80; }
.mk-card.t-violet { --tone: #b197fc; } .mk-card.t-blue { --tone: #60a5fa; } .mk-card.t-rose { --tone: #f87171; }
.mk-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mk-compare > div { padding: 22px; border-radius: 18px; border: 1px solid var(--border-soft); background: var(--surface); }
.mk-compare h3 { margin: 0 0 12px; font-size: 1rem; color: #fff; }
.mk-compare ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mk-compare li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; color: var(--text-2); font-size: 0.9rem; line-height: 1.5; }
.mk-compare li svg { margin-top: 2px; }
.mk-compare .before li svg { color: var(--danger); }
.mk-compare .after { border-color: color-mix(in srgb, var(--success) 30%, var(--border-soft)); background: radial-gradient(140% 120% at 0% 0%, rgba(74, 222, 128, 0.1) 0%, transparent 60%), var(--surface); }
.mk-compare .after li svg { color: var(--success); }
.mk-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; counter-reset: step; }
.mk-steps li { counter-increment: step; padding: 22px; border-radius: 18px; border: 1px solid var(--border-soft); background: var(--surface); }
.mk-steps li::before { content: counter(step, decimal-leading-zero); display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 750; color: var(--sun); margin-bottom: 10px; }
.mk-steps h3 { margin: 0 0 6px; font-size: 1rem; color: #fff; }
.mk-steps p { margin: 0; color: var(--text-2); font-size: 0.875rem; line-height: 1.6; }
.mk-band {
  margin-top: clamp(48px, 8vw, 88px); padding: clamp(32px, 6vw, 56px); border-radius: 24px; text-align: center;
  background: radial-gradient(80% 140% at 50% 0%, rgba(242, 181, 68, 0.2) 0%, transparent 60%), #0f0f0f; border: 1px solid var(--border-soft);
}
.mk-band h2 { margin-bottom: 10px; }
.mk-band p { color: var(--text-2); margin: 0 auto 24px; max-width: 560px; line-height: 1.6; }
.mk-band .mk-cta { justify-content: center; }
.mk-fine { color: var(--text-muted); font-size: 0.8125rem; line-height: 1.6; margin: 14px 0 0; }

/* Pricing page: the formula, what's included, the calculator and examples */
.price-plan { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; margin-top: 8px; }
.price-formula {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; padding: clamp(22px, 4vw, 34px);
  border: 1px solid rgba(242, 181, 68, 0.3); border-radius: 22px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(242, 181, 68, 0.14) 0%, transparent 60%), var(--surface);
}
.price-part { display: grid; gap: 4px; }
.price-amount { font-family: var(--font-display); font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 750; letter-spacing: -0.04em; line-height: 1; color: #fff; white-space: nowrap; }
.price-amount small, .price-calc-total small { font-size: 0.4em; font-weight: 700; letter-spacing: 0; color: var(--sun); vertical-align: 0.9em; }
.price-unit { font-size: 0.875rem; color: var(--text-2); }
.price-plus { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--sun); }
.price-volume { flex-basis: 100%; margin: 4px 0 0; font-size: 0.875rem; color: var(--text-muted); }
.price-included { list-style: none; margin: 0; padding: clamp(20px, 3vw, 28px); display: grid; gap: 12px; align-content: center; border: 1px solid var(--border-soft); border-radius: 22px; background: var(--surface); }
.price-included li { position: relative; padding-left: 28px; color: var(--text-2); font-size: 0.9rem; line-height: 1.5; }
.price-included li::before { content: ""; position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--success-soft); box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.4); }
.price-included li::after { content: ""; position: absolute; left: 6px; top: 6px; width: 6px; height: 9px; border: solid var(--success); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.price-calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.price-calc-input, .price-calc-result { display: grid; gap: 10px; align-content: center; padding: 24px; border-radius: 22px; border: 1px solid var(--border-soft); background: var(--surface); }
.price-calc-input label { font-weight: 600; color: #fff; }
.price-calc-input input[type="number"] { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; max-width: 220px; min-height: 52px; }
.price-calc-input input[type="range"] { width: 100%; accent-color: var(--sun); }
.price-calc-result { border-color: rgba(242, 181, 68, 0.3); }
.price-calc-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sun); }
.price-calc-total { font-family: var(--font-display); font-size: clamp(2.4rem, 6vw, 3.2rem); font-weight: 750; letter-spacing: -0.04em; line-height: 1; color: #fff; }
.price-calc-sub { font-size: 0.875rem; color: var(--text-2); }
.price-examples { margin-top: 14px; }
.price-examples td a { color: var(--sun); }
@media (max-width: 760px) { .price-plan, .price-calc { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 960px) {
  .mk-grid, .mk-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-steps, .mk-proof { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .mk { padding: 0 16px 16px; }
  .mk-grid, .mk-grid.two, .mk-grid.four, .mk-compare, .mk-steps { grid-template-columns: minmax(0, 1fr); }
  .mk-hero::after { opacity: 0.18; -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 70%); mask-image: linear-gradient(180deg, #000 0%, transparent 70%); }
}

/* ---- Documentation ---- */
.docs { width: min(1200px, 100%); margin: 0 auto; padding: 8px 24px 48px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
.docs-nav { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 4px 0; }
.docs-toc { display: none; }
.docs-nav p { margin: 18px 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.docs-nav p:first-of-type { margin-top: 0; }
.docs-nav ol { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--text-muted); font-size: 0.85rem; }
.docs-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.docs-body { min-width: 0; max-width: 780px; }
.docs-body h1 { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.035em; line-height: 1.05; margin: 8px 0 10px; }
.docs-body .intro { font-size: 1.02rem; color: var(--text-2); line-height: 1.7; margin: 0 0 8px; }
.docs-body section { padding-top: 12px; scroll-margin-top: 16px; }
.docs-body h2 { font-family: var(--font-display); font-size: 1.45rem; letter-spacing: -0.02em; margin: 36px 0 10px; padding-top: 20px; border-top: 1px solid var(--border-soft); color: #fff; }
.docs-body h3 { font-size: 1rem; margin: 22px 0 6px; color: var(--text); }
.docs-body p, .docs-body li { color: #cecece; font-size: 0.9375rem; line-height: 1.7; }
.docs-body ul, .docs-body ol { padding-left: 1.25rem; margin: 0 0 12px; }
.docs-body li + li { margin-top: 4px; }
.docs-body strong { color: var(--text); }
.docs-body code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text); }
.docs-body table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 0.875rem; }
.docs-body th, .docs-body td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; color: #cecece; }
.docs-body th { color: var(--text); font-weight: 600; background: var(--surface); }
.docs-table { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius); margin: 8px 0 16px; }
.docs-table table { margin: 0; }
.docs-table tr:last-child td { border-bottom: 0; }
.callout { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border-soft); background: var(--surface); margin: 12px 0 16px; }
.callout p { margin: 0; font-size: 0.9rem; }
.callout.tip { border-color: rgba(79, 216, 196, 0.3); background: rgba(79, 216, 196, 0.06); }
.callout.warn { border-color: rgba(240, 147, 58, 0.35); background: rgba(240, 147, 58, 0.07); }
.callout strong:first-child { margin-right: 4px; }
.docs-body details, .mk-faq details { border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); padding: 0 16px; margin: 0 0 8px; }
.docs-body details summary, .mk-faq details summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--text); }
.docs-body details[open] summary, .mk-faq details[open] summary { border-bottom: 1px solid var(--border-soft); margin-bottom: 8px; }
.mk-faq { max-width: 860px; }
.mk-faq details p { color: var(--text-2); font-size: 0.9rem; line-height: 1.6; margin: 0 0 12px; }
@media (max-width: 900px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-left: 16px; padding-right: 16px; }
  .docs > .docs-nav { display: none; }
  .docs-toc { display: block; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); padding: 0 14px; margin: 16px 0 0; }
  .docs-toc summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--text); }
  .docs-toc .docs-nav { position: static; max-height: none; padding: 0 0 12px; }
  .docs-toc .docs-nav ol { padding-left: 0; margin: 0; }
  .docs-toc .docs-nav li + li { margin-top: 0; }
}

/* ---- Stickers (public pages): colour emoji with a die-cut white edge ----
   Set --tilt to rotate one; --size to scale it. Always aria-hidden: decoration only. */
.sticker {
  --tilt: -6deg; --size: 2rem;
  display: inline-block; font-size: var(--size); line-height: 1; user-select: none;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-style: normal;
  transform: rotate(var(--tilt));
  filter: drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff) drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff)
    drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sticker.r { --tilt: 7deg; }
.sticker:hover, .mk-card:hover .sticker, .mk-steps li:hover .sticker { transform: rotate(calc(var(--tilt) * -1)) scale(1.12); }
/* Word stickers: a tilted, white-edged label */
.sticker-tag {
  --tilt: -5deg; --tag: var(--sun);
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--tag); color: #161616; border: 3px solid #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 0.95rem; letter-spacing: -0.01em; white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45); transform: rotate(var(--tilt));
}
/* Scattered stickers that pop in and drift gently */
.sticker-field { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.sticker-field > * {
  position: absolute; left: var(--x); top: var(--y);
  opacity: 0; animation: sticker-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) var(--d, 0s) forwards, sticker-drift 6s ease-in-out calc(var(--d, 0s) + 0.6s) infinite;
}
@keyframes sticker-pop { from { opacity: 0; scale: 0.4; } to { opacity: 1; scale: 1; } }
@keyframes sticker-drift { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@media (prefers-reduced-motion: reduce) {
  .sticker-field > * { animation: none; opacity: 1; }
  .sticker { transition: none; }
}

/* About page sticker placement */
.mk-hero > :not(.sticker-field) { position: relative; z-index: 1; }
.mk-hero .sticker-field .sticker { --size: clamp(2.2rem, 4vw, 3.2rem); }
.mk-card > .sticker { --size: 2.3rem; margin: 2px 0 0 2px; }
.mk-card > .sticker + h3 { margin-top: 12px; }
.mk-compare h3 { display: flex; align-items: center; gap: 10px; }
.mk-compare h3 .sticker { --size: 1.5rem; }
.mk-steps li { position: relative; }
.mk-steps li > .sticker { position: absolute; top: 18px; right: 18px; --size: 1.9rem; }
.mk-band { position: relative; overflow: hidden; }
.mk-band > :not(.sticker-field) { position: relative; z-index: 1; }
.mk-band .sticker-field .sticker { --size: clamp(2rem, 4vw, 3rem); }
@media (max-width: 760px) {
  .mk-hero .sticker-field > .opt, .mk-band .sticker-field > .opt { display: none; }
  .mk-hero .sticker-field .sticker { --size: 2rem; }
  .mk-hero .sticker-field > :first-child { left: auto; right: 14px; top: 14px; }
  .mk-hero .mk-eyebrow { padding-right: 44px; }
}

/* Docs title stickers */
.docs-title { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin: 8px 0 14px; }
.docs-body .docs-title h1 { margin: 0; }
.docs-title .stickers { display: flex; gap: 14px; padding-right: 6px; }
.docs-title .sticker { --size: 1.9rem; }

/* ---- 404 ---- */
.nf { flex: 1; width: min(720px, 100%); margin: 0 auto; padding: clamp(16px, 6vh, 64px) 24px 48px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.nf-art { position: relative; width: min(440px, 100%); padding: 28px 40px; margin-bottom: 8px; }
.nf-art > .sticker { position: absolute; left: var(--x); top: var(--y); --size: clamp(1.8rem, 5vw, 2.4rem);
  opacity: 0; animation: sticker-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) var(--d, 0s) forwards, sticker-drift 6s ease-in-out calc(var(--d, 0s) + 0.6s) infinite; }
.nf-code { display: inline-flex; align-items: center; gap: 0.08em; font-family: var(--font-display); font-weight: 800; font-size: clamp(5.5rem, 22vw, 9.5rem); line-height: 1; letter-spacing: -0.06em; color: #fff; }
.nf-zero { --size: 0.82em; margin: 0 0.06em; animation: nf-wobble 2.8s ease-in-out 0.8s infinite; }
@keyframes nf-wobble { 0%, 100% { transform: rotate(var(--tilt)); } 50% { transform: rotate(calc(var(--tilt) * -1)) scale(1.05); } }
.nf .sticker-tag { margin: 4px 0 14px; }
.nf h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 5vw, 2.8rem); letter-spacing: -0.035em; line-height: 1.08; margin: 0 0 10px; color: #fff; }
.nf > p { color: var(--text-2); line-height: 1.65; margin: 0 0 26px; max-width: 480px; }
.nf .boot { margin: 0 0 22px; }
.nf .boot-status { color: var(--text-muted); }
.nf .mk-cta { justify-content: center; }
@media (prefers-reduced-motion: reduce) { .nf-art > .sticker { animation: none; opacity: 1; } .nf-zero { animation: none; } }

/* ==========================================================================
   15. Guardian portal
   ========================================================================== */
.portal { max-width: 1120px; margin: 0 auto; padding: 20px 16px 40px; }
.portal-bar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: rgba(9, 9, 9, 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.portal-bar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); flex: 1; min-width: 0; }
.portal-head {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px; padding: 18px;
  background: linear-gradient(135deg, rgba(127, 140, 255, 0.12), rgba(79, 216, 196, 0.06)), var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg); flex-wrap: wrap;
}
.portal-head h1 { margin: 0; font-size: 1.25rem; }
.portal-head .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8125rem; color: var(--text-muted); margin-top: 4px; }
.portal-head .meta span { display: inline-flex; align-items: center; gap: 6px; }

/* ==========================================================================
   16a. School life: timetable, calendar, homework, payroll
   ========================================================================== */
.tt-week { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.tt-day { background: var(--bg-elevated); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tt-day.is-today { border-color: var(--control-border-strong); }
.tt-day h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 2px; font-size: 0.8125rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tt-slot { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-soft); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); padding: 8px 10px; }
button.tt-slot { cursor: pointer; }
button.tt-slot:hover { border-color: var(--control-border); background: var(--surface-2); }
.tt-slot.is-break { border-left-color: var(--text-faint); background: transparent; }
.tt-time { font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tt-title { font-weight: 600; font-size: 0.8125rem; }
.tt-sub { font-size: 0.72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-empty { font-size: 0.75rem; color: var(--text-faint); padding: 6px 2px; }

.cal-scroll { overflow-x: auto; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; min-width: 660px; }
.cal-head { padding: 8px; font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); background: #262626; border-bottom: 1px solid var(--border-soft); }
.cal-cell { min-height: 96px; padding: 6px; border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.is-other { background: rgba(0, 0, 0, 0.18); }
.cal-cell.is-other .cal-num { color: var(--text-faint); }
.cal-cell.is-today .cal-num { color: #141414; background: var(--sun); border-radius: 999px; width: 24px; text-align: center; }
.cal-num { font-size: 0.78rem; font-weight: 600; line-height: 24px; height: 24px; }
.cal-num .link-btn { color: inherit; font-weight: 600; }
.cal-chip { display: block; width: 100%; text-align: left; font: inherit; font-size: 0.7rem; line-height: 1.3; padding: 2px 6px; border-radius: 5px; border: 0; color: #fff; background: var(--surface-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.cal-chip { cursor: pointer; }
.cal-more { font-size: 0.7rem; color: var(--text-muted); }
.cal-row { width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-top: 1px solid var(--border-soft); cursor: pointer; }
div.cal-row { cursor: default; }
.ev-date { width: 42px; height: 46px; border-radius: 10px; flex: none; display: grid; place-content: center; text-align: center; line-height: 1.05; background: var(--surface-2); }
.ev-date b { font-size: 1.05rem; }
.ev-date span { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
/* Category colours (each paired with a text label) */
.cat-academic { --cat: #7f8cff; }
.cat-holiday { --cat: #3dbe8b; }
.cat-exam { --cat: #f2777a; }
.cat-meeting { --cat: #7cb7ff; }
.cat-sports { --cat: #f29b38; }
.cat-cultural { --cat: #c084fc; }
.cat-other { --cat: #949494; }
.cat-term { --cat: #565656; }
.cal-chip[class*="cat-"] { background: color-mix(in srgb, var(--cat) 30%, var(--surface)); border-left: 3px solid var(--cat); }
.badge[class*="cat-"] { background: color-mix(in srgb, var(--cat) 16%, transparent); color: var(--cat); }
.ev-date[class*="cat-"] { box-shadow: inset 0 -3px 0 var(--cat); }

.doc-sheet { background: #fff; color: #111; border-radius: var(--radius); padding: 28px; }
.doc-sheet .muted { color: #555; }
.rc-wrap { margin: 0 auto 20px; max-width: 860px; }
.rc-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.report-card { max-width: 860px; margin: 0 auto; font-size: 0.8125rem; line-height: 1.45; break-after: page; }
.report-card .mono { color: #111; }
.rc-head { display: flex; align-items: center; gap: 16px; padding-bottom: 14px; border-bottom: 3px solid #111; margin-bottom: 14px; }
.rc-logo { width: 64px; height: 64px; object-fit: contain; flex: none; }
.rc-school { flex: 1; min-width: 0; }
.rc-school-name { font-family: var(--font-display); font-size: 1.45rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.rc-contact { font-size: 0.72rem; color: #555; }
.rc-exam { text-align: right; font-weight: 600; }
.rc-kicker { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: #666; font-weight: 700; margin-bottom: 2px; }
.rc-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; margin: 0 0 14px; }
.rc-facts dt { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: #666; }
.rc-facts dd { margin: 0; font-weight: 600; }
.rc-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; color: #111; }
.rc-table th { background: #f2f2f2; color: #333; position: static; border-bottom: 1px solid #ccc; }
.rc-table td { border-bottom: 1px solid #e5e5e5; color: #111; }
.rc-table tbody tr:hover { background: none; }
.rc-annual { margin-top: 16px; }
.rc-annual .rc-kicker { margin-bottom: 6px; }
.rc-annual tfoot td { border-top: 2px solid #ccc; color: #111; padding-top: 6px; }
.rc-comments { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.rc-comments p { margin: 0; padding: 10px 12px; background: #f7f7f7; border-radius: 6px; min-height: 44px; }
.rc-comments > :nth-child(3) { grid-column: 1 / -1; }
.rc-comments p.rc-contact { background: none; padding: 4px 0 0; min-height: 0; }
.rc-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; border-top: 1px solid #ddd; padding-top: 12px; }
.rc-sign { min-width: 180px; }
.rc-sign img { height: 48px; max-width: 200px; object-fit: contain; display: block; margin-bottom: 2px; }
.rc-sign-line { width: 180px; height: 40px; border-bottom: 1px solid #333; margin-bottom: 4px; }
@media (max-width: 600px) {
  .doc-sheet { padding: 16px; }
  .rc-head { flex-wrap: wrap; }
  .rc-exam { text-align: left; width: 100%; }
  .rc-comments { grid-template-columns: 1fr; }
  .rc-table { font-size: 0.72rem; }
}

/* ==========================================================================
   15b. Theme layer: flat black dashboard
   Overrides earlier component rules (same specificity, later in the file) so the
   look can be tuned in one place. Reference: black panels with hairline borders,
   neutral grey buttons, tinted rectangular status chips, tick-style meters.
   ========================================================================== */
html { background: var(--bg); }
body { background: var(--bg); letter-spacing: -0.003em; }

/* ---- Shell: area rail (desktop), top bar with page tabs, tab bar (phones) ---- */
.rail {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--rail-w);
  display: flex; flex-direction: column; gap: 4px; padding: 12px 8px 14px;
  background: var(--sidebar-bg); border-right: 1px solid var(--border-soft);
  overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-brand { display: grid; place-items: center; height: 46px; margin-bottom: 10px; border-radius: 14px; }
.rail-brand:hover { background: var(--surface-2); }
.rail-brand-mark { width: 32px; height: 32px; display: grid; place-items: center; overflow: hidden; }
.rail-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.rail-spacer { flex: 1; min-height: 12px; }
.rail-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 58px; padding: 8px 2px; border: 0; border-radius: 14px; background: none; cursor: pointer;
  color: var(--text-muted); font: inherit; font-size: 0.6875rem; font-weight: 500; text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.rail-item .icon { color: var(--text-faint); transition: color 0.15s var(--ease); }
.rail-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.rail-item:hover .icon { color: var(--text); }
.rail-item[aria-current="page"] { background: var(--primary-soft); color: var(--text-strong); }
.rail-item[aria-current="page"] .icon { color: var(--primary-strong); }

.chrome {
  position: sticky; top: 0; z-index: 30; background: var(--topbar-bg); border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.chrome .topbar { position: static; min-height: 64px; padding: 12px 28px; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.topbar-brand { display: none; }
.subnav { display: flex; gap: 2px; padding: 0 20px; overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav[hidden] { display: none; }
.subnav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 10px 11px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 0.8125rem; font-weight: 500;
  white-space: nowrap; text-decoration: none; transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.subnav a .icon { color: var(--text-faint); }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a[aria-current="page"] { color: var(--text-strong); border-bottom-color: var(--primary); }
.subnav a[aria-current="page"] .icon { color: var(--primary-strong); }

.search-trigger {
  display: flex; align-items: center; gap: 8px; width: min(360px, 32vw); height: 38px; padding: 0 8px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-elevated);
  color: var(--text-faint); font: inherit; font-size: 0.8125rem; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.search-trigger:hover { border-color: var(--control-border); color: var(--text-muted); }
.search-trigger .st-label { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-btn { min-height: 38px; padding: 6px 14px 6px 11px; border-radius: var(--radius-pill); }
kbd {
  font-family: var(--font); font-size: 0.65rem; font-weight: 600; line-height: 1; white-space: nowrap;
  padding: 3px 5px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}

/* "More" sheet on phones */
.tabbar { display: none; }
dialog.sheet { width: min(560px, 100vw); max-width: 100vw; margin: auto auto 0; border-radius: 22px 22px 0 0; max-height: 84vh; }
.sheet-body { padding: 4px 16px 22px; overflow-y: auto; max-height: calc(84vh - 60px); }
.sheet-group h3 { margin: 14px 4px 8px; font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }
.sheet-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sheet-link {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px; border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: 0.8125rem; font-weight: 500; text-decoration: none;
}
.sheet-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-link .icon { color: var(--primary-strong); }
.sheet-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }

@media (max-width: 900px) {
  .rail { display: none; }
  .main { margin-left: 0; }
  .chrome .topbar { min-height: 58px; padding: 9px 14px; gap: 8px; }
  .topbar-brand { display: grid; place-items: center; flex: none; }
  .topbar-brand .rail-brand-mark { width: 28px; height: 28px; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; border-radius: 50%; }
  .search-trigger .st-label, .search-trigger kbd { display: none; }
  .new-btn { width: 38px; padding: 0; border-radius: 50%; }
  .new-btn span { display: none; }
  .subnav { padding: 0 6px; }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--topbar-bg); border-top: 1px solid var(--border-soft);
    backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%);
  }
  .tabbar .rail-item { min-height: 52px; border-radius: 12px; }
}
@media (max-width: 420px) {
  .chrome .topbar .crumbs { display: none; }
  .theme-toggle { display: none; }
}

.initials {
  background: linear-gradient(145deg, #343434, #1a1a1a); color: #fff;
  box-shadow: inset 0 0 0 1px #3a3a3a;
}

/* Search palette (Ctrl/Cmd + K) */
dialog.jump { width: min(560px, calc(100vw - 24px)); margin: 12vh auto auto; border-radius: 16px; background: var(--bg-elevated); overflow: hidden; }
.jump-search { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); color: var(--text-faint); }
.jump-search input, .jump-search input:focus, .jump-search input:hover { border: 0; background: transparent; box-shadow: none; padding: 0; min-height: 36px; font-size: 0.9375rem; }
.jump-search input::-webkit-search-cancel-button { display: none; }
.jump-list { max-height: min(56vh, 420px); overflow-y: auto; padding: 6px; }
.jump-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 0.875rem; color: var(--text-muted); }
.jump-item[aria-selected="true"] { background: var(--surface-3); color: var(--text-strong); }
.jump-item[aria-selected="true"] .icon { color: var(--primary-strong); }
.jump-sec { margin-left: auto; font-size: 0.72rem; color: var(--text-faint); }
.jump-group { padding: 10px 10px 4px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.pin-btn { color: var(--text-faint); flex: none; }
.pin-btn[aria-pressed="true"] { color: var(--warning, #e6ab45); }
.pin-btn[aria-pressed="true"] svg { fill: currentColor; }
.subnav .more-tabs { position: relative; display: flex; align-items: stretch; }
.subnav .more-tabs > button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); font: inherit; font-size: 0.8125rem; padding: 7px 10px 9px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.subnav .more-tabs > button[aria-current="page"] { color: var(--text-strong); border-bottom-color: var(--primary); }
.subnav .more-tabs .pop-panel { top: 100%; right: auto; left: 0; }
.jump-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.8125rem; }

.topbar {
  background: var(--topbar-bg); border-bottom: 1px solid var(--border-soft);
  padding: 12px 28px;
}
.topbar .title { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.015em; }
.crumbs { font-size: 0.75rem; }
.icon-btn { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 50%; }
.icon-btn:hover { background: var(--surface-3); border-color: var(--control-border); }
.icon-btn.plain { background: transparent; border-color: transparent; border-radius: var(--radius-sm); }
.icon-btn.plain:hover { background: var(--surface-2); }
.count-badge { background: var(--danger); color: #fff; box-shadow: 0 0 0 2px var(--surface); }
.profile-btn { background: transparent; border: 0; border-radius: var(--radius-pill); padding-right: 6px; }
.profile-btn:hover { background: var(--surface-2); }
.pop-panel { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.menu-item { border-radius: 8px; }

.content { padding: 24px 28px 48px; }
.page-head h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.025em; }
.page-head p { color: var(--text-muted); }

/* ---- Cards ---- */
.card, .kpi, .qa, .table-wrap, .tt-day {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: none;
}
.card { padding: 20px; }
.card-head h2, .card-head h3, .section-title h2 { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
.section-title h2 { color: var(--text); }

/* ---- KPI tiles: each tinted with its tone so the figures stand out ---- */
.tone-brand { --tone: #8b93ff; }
.tone-teal { --tone: #2dd4bf; }
.tone-success { --tone: #4ade80; }
.tone-warning { --tone: #f5a35b; }
.tone-danger { --tone: #f87171; }
.tone-info { --tone: #60a5fa; }
.tone-violet { --tone: #b197fc; }
/* Tiles without a tone take one from their position. */
.kpi:not([class*="tone-"]):nth-child(5n+1) { --tone: #8b93ff; }
.kpi:not([class*="tone-"]):nth-child(5n+2) { --tone: #2dd4bf; }
.kpi:not([class*="tone-"]):nth-child(5n+3) { --tone: #60a5fa; }
.kpi:not([class*="tone-"]):nth-child(5n+4) { --tone: #b197fc; }
.kpi:not([class*="tone-"]):nth-child(5n+5) { --tone: #f5a35b; }
.kpi {
  padding: 16px 18px; gap: 4px;
  --kpi-bg:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--tone) 20%, transparent) 0%, transparent 55%),
    linear-gradient(160deg, color-mix(in srgb, var(--tone) 11%, var(--bg-elevated)) 0%, var(--bg-elevated) 75%);
  background: var(--kpi-bg);
  border-color: color-mix(in srgb, var(--tone) 24%, var(--border-soft));
}
a.kpi:hover { border-color: color-mix(in srgb, var(--tone) 55%, var(--border-soft)); background: var(--kpi-bg); }
a.kpi:hover .value { color: var(--text-strong); }
.kpi-top { gap: 10px; margin-bottom: 10px; }
.kpi-icon, .kpi-icon.teal, .kpi-icon.success, .kpi-icon.warning, .kpi-icon.danger, .kpi-icon.info {
  width: 30px; height: 30px; border-radius: 9px; color: var(--tone);
  background: color-mix(in srgb, var(--tone) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 28%, transparent);
}
.kpi .label { font-size: 0.8125rem; color: var(--text-2); font-weight: 500; }
.kpi .value { font-size: 1.625rem; font-weight: 650; letter-spacing: -0.025em; margin-top: 2px; color: var(--text-strong); }
.kpi .sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.kpi .go { color: var(--tone); }
.kpi.alert .value { color: var(--danger); }
@media (max-width: 560px) {
  .kpi { padding: 12px; }
  .kpi-top { gap: 8px; margin-bottom: 6px; align-items: flex-start; }
  .kpi-icon, .kpi-icon.teal, .kpi-icon.success, .kpi-icon.warning, .kpi-icon.danger, .kpi-icon.info { width: 26px; height: 26px; border-radius: 8px; }
  .kpi .label { font-size: 0.75rem; line-height: 1.3; }
  .kpi .value, .grid.kpis .kpi .value { font-size: 1.15rem; }
  .kpi .sub { font-size: 0.7rem; }
}

/* Home: four key figures in one row, a progress meter inside a tile */
.grid.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi .kpi-meter { height: 8px; margin: 8px 0 2px; --bar: var(--tone); }
.kpi .kpi-meter > div { background: var(--tone); }

/* "Needs your attention": action rows, coloured by urgency */
.attention .card-head { margin-bottom: 6px; }
.attention h2 { display: flex; align-items: center; gap: 8px; }
.attn-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted); font-size: 0.72rem; font-weight: 600;
}
.attn-list { display: flex; flex-direction: column; }
.attn-row { --tone: var(--info); display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.attn-row:first-child { border-top: 0; padding-top: 2px; }
.attn-row.warning { --tone: var(--warning); }
.attn-row.danger { --tone: var(--danger); }
.attn-icon {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 10px; color: var(--tone);
  background: color-mix(in srgb, var(--tone) 14%, transparent);
}
.attn-main { flex: 1; min-width: 0; }
.attn-title { font-size: 0.875rem; font-weight: 500; }
.attn-sub { font-size: 0.75rem; color: var(--text-muted); }
.attn-row .btn { flex: none; }
.attn-empty { display: flex; align-items: center; gap: 10px; padding: 4px 0 2px; color: var(--text-muted); font-size: 0.8125rem; }
.attn-empty .icon { color: var(--success); }
@media (max-width: 560px) {
  .attn-row { flex-wrap: wrap; row-gap: 8px; }
  .attn-main { flex: 1 1 calc(100% - 44px); }
  .attn-row .btn { margin-left: 44px; }
}

/* Compact stat strip: several small figures in one card (billing status, etc.) */
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--surface); overflow: hidden;
}
.stat:not([class*="tone-"]) { --tone: var(--text-faint); }
.stat {
  padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  border-left: 1px solid var(--border-soft); margin-left: -1px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 9%, transparent), transparent 80%);
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--tone) 70%, transparent);
}
.stat-label { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); }
.stat-value { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.015em; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stat .badge { align-self: flex-start; margin-top: 1px; }
.stat .progress { height: 8px; margin-top: 4px; }

/* Monthly bill breakdown (subscription & billing) */
.bill { display: grid; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--bg-elevated); }
.bill-line { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; font-size: 0.875rem; color: var(--text-2); }
.bill-line + .bill-line { border-top: 1px solid var(--border-soft); }
.bill-line .num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.bill-line.total { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.delta {
  padding: 2px 8px; border-radius: 6px; font-size: 0.6875rem; font-weight: 600; gap: 3px;
  border: 1px solid transparent;
}
.delta.up { background: var(--success-soft); color: var(--success); border-color: rgba(74, 222, 128, 0.25); }
.delta.down { background: var(--danger-soft); color: var(--danger); border-color: rgba(248, 113, 113, 0.25); }
.delta.flat { background: var(--surface-3); color: var(--text-muted); }

/* ---- Quick actions: small bordered tiles with a plain icon and wrapped title ---- */
.qa { min-height: 92px; padding: 14px 16px; gap: 14px; justify-content: space-between; }
.qa::after { display: none; }
.quick-actions { grid-template-columns: repeat(auto-fit, minmax(min(100%, 142px), 1fr)); gap: 10px; }
.qa { min-height: 84px; padding: 12px 14px; gap: 12px; }
.qa.indigo { --qa-c: #8b93ff; }
.qa.teal { --qa-c: #2dd4bf; }
.qa.violet { --qa-c: #b197fc; }
.qa.rose { --qa-c: #f472b6; }
.qa.amber { --qa-c: #f5a35b; }
.qa.sky { --qa-c: #60a5fa; }
.qa .qa-icon {
  width: 32px; height: 32px; border-radius: 9px; place-items: center; color: var(--qa-c, var(--primary));
  background: color-mix(in srgb, var(--qa-c, var(--primary)) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--qa-c, var(--primary)) 26%, transparent);
}
.qa .qa-title { font-weight: 550; font-size: 0.875rem; line-height: 1.3; }
.qa .qa-desc { margin-top: -10px; }
.qa:hover { background: var(--hover-bg); border-color: color-mix(in srgb, var(--qa-c, var(--primary)) 45%, var(--border-soft)); }
.qa:hover .qa-go { color: var(--qa-c, var(--primary)); }

/* ---- Buttons: neutral grey, rounded rectangles ---- */
.btn {
  border-radius: var(--radius-sm); background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); font-weight: 500; min-height: 38px; padding: 8px 16px;
}
.btn:hover { background: var(--surface-3); border-color: var(--control-border); }
.btn.primary { background: var(--gradient-primary); border-color: var(--control-border); color: #fff; box-shadow: none; }
.btn.primary:hover { background: var(--gradient-primary-hover); border-color: var(--control-border-strong); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 30px; padding: 4px 11px; border-radius: 8px; }
.segmented { background: var(--bg-elevated); border-radius: var(--radius-sm); }
.segmented button { border-radius: 8px; }
.segmented button[aria-pressed="true"] { background: var(--surface-3); }

/* ---- Forms ---- */
input, select, textarea { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }
input:hover, select:hover, textarea:hover { border-color: var(--control-border); }
input:focus, select:focus, textarea:focus { border-color: var(--control-border-strong); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07); }
.field label { color: var(--text-2); }

/* ---- Tables: borderless header row on black, hairline row separators ---- */
.table-wrap { overflow-x: auto; }
th {
  background: transparent; text-transform: none; letter-spacing: 0; font-size: 0.8125rem; font-weight: 500;
  color: var(--text-muted); padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
}
/* Header row tinted with the brand colour (opaque, so sticky headers hide rows scrolling under them). */
th, .card table th {
  background: color-mix(in srgb, var(--primary) 26%, var(--bg-elevated));
  color: var(--text); font-weight: 600;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border-soft));
}
th.sortable:hover { background: color-mix(in srgb, var(--primary) 34%, var(--bg-elevated)); color: var(--text-strong); }
th[aria-sort] { color: var(--text-strong); }
td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); }
tbody tr:hover { background: var(--row-hover); }
.table-tools input[type="search"] { border-radius: var(--radius-pill); }

/* ---- Chips and badges: tinted rectangles with a tinted hairline ---- */
.badge {
  gap: 0; padding: 3px 10px; border-radius: 7px; font-size: 0.75rem; font-weight: 500; letter-spacing: 0;
  background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border);
}
.badge::before { display: none; }
.badge.success { background: var(--success-soft); color: var(--success); border-color: rgba(74, 222, 128, 0.3); }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(240, 147, 58, 0.32); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(248, 113, 113, 0.32); }
.badge.info { background: var(--info-soft); color: var(--info); border-color: rgba(107, 139, 255, 0.34); }
.badge.brand { background: var(--primary-soft); color: var(--primary-strong); border-color: rgba(127, 140, 255, 0.34); }
.badge.teal { background: var(--teal-soft); color: var(--teal); border-color: rgba(79, 216, 196, 0.3); }
.badge[class*="cat-"] { border-color: color-mix(in srgb, var(--cat) 35%, transparent); }
.grade-chip { border-radius: 7px; }

/* ---- Tabs ---- */
.tabs { border-bottom: 1px solid var(--border-soft); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--text-strong); }

/* ---- Tick-style meters: segmented bars, filled to the value ---- */
.progress {
  height: 14px; border-radius: 2px; overflow: hidden;
  background: repeating-linear-gradient(90deg, var(--tick-bg) 0 3px, transparent 3px 6px);
}
.progress > div {
  height: 100%; border-radius: 0; background: var(--bar, var(--chart-1));
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 6px);
  mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 6px);
}
.progress.success { --bar: var(--chart-present); }
.progress.warning { --bar: var(--chart-2); }
.progress.danger { --bar: var(--danger); }
.progress.success > div, .progress.warning > div, .progress.danger > div { background: var(--bar); }
.meter-row { padding: 9px 0; }

/* ---- Lists, dialogs, tooltips, banners ---- */
.list-item { border-top-color: var(--border-soft); }
.li-icon { border-radius: 10px; background: var(--surface-3); }
dialog { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.dialog-head { border-bottom-color: var(--border-soft); }
.dialog-foot { background: transparent; border-top-color: var(--border-soft); }
.chart-tip { background: var(--bg-elevated); border-color: var(--border); }
.banner { border-bottom-color: var(--border-soft); }
.alert { border-radius: var(--radius-sm); }
.state .state-icon { background: var(--surface-3); border-radius: 12px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; }
.codes, .avatar { background: var(--bg-elevated); }
::selection { background: rgba(127, 140, 255, 0.35); }
* { scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); background-clip: content-box; }

/* ---- Auth pages: black glass over the campus image ---- */
.auth-card {
  background: rgba(0, 0, 0, 0.7); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius-lg);
}
.auth-tabs { background: rgba(0, 0, 0, 0.5); border-radius: var(--radius-sm); }
.auth-tabs::before { border-radius: 8px; }
.auth-card input:not([type="checkbox"]):not([type="radio"]) { background: rgba(0, 0, 0, 0.55); border-radius: var(--radius-sm); }

@media (max-width: 900px) {
  .content { padding: 16px 16px 32px; }
  .topbar { padding: 10px 16px; }
}

/* ==========================================================================
   15c. Light theme: html[data-theme="light"] (set by js/theme-init.js and
   the toggle in js/theme.js). Same components, light tokens; accent tones are
   deepened so coloured text and icons keep their contrast on white.
   ========================================================================== */
html[data-theme="light"] {
  --bg: #f3f4f6;
  --bg-elevated: #ffffff;
  --sidebar-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --surface-3: #e7e9ed;
  --border: #d9dce2;
  --border-soft: #e6e8ec;
  --overlay: rgba(17, 19, 24, 0.45);
  --topbar-bg: rgba(255, 255, 255, 0.86);
  --hover-bg: #fafafb;
  --row-hover: #f7f8fa;
  --tick-bg: #e1e3e8;
  --scroll-thumb: #c9ccd3;

  --text: #15171c;
  --text-strong: #0b0c10;
  --text-2: #3d424d;
  --text-muted: #5a606c;
  --text-faint: #6b717d;

  --primary: #4f5bd5;
  --primary-strong: #3a46c2;
  --primary-deep: #2f3aa8;
  --primary-soft: rgba(79, 91, 213, 0.1);
  --primary-ring: rgba(79, 91, 213, 0.4);
  --teal: #0d9488;
  --teal-soft: rgba(13, 148, 136, 0.1);
  --gradient-primary: linear-gradient(180deg, #2a2d35 0%, #15171c 100%);
  --gradient-primary-hover: linear-gradient(180deg, #363a43 0%, #1f2228 100%);
  --gradient-segment: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
  --control-border: #c9cdd4;
  --control-border-strong: #7c828d;
  --focus: #4f5bd5;
  --gradient-accent: linear-gradient(135deg, #4f5bd5 0%, #0d9488 100%);

  --success: #15803d;
  --success-soft: rgba(22, 163, 74, 0.1);
  --warning: #b45309;
  --warning-soft: rgba(217, 119, 6, 0.11);
  --danger: #c2262b;
  --danger-soft: rgba(220, 38, 38, 0.09);
  --info: #1d4ed8;
  --info-soft: rgba(37, 99, 235, 0.09);

  --chart-1: #5b63f0;
  --chart-2: #e07b24;
  --chart-present: #16a34a;
  --chart-late: #d97706;
  --chart-absent: #dc2626;
  --chart-grid: #e5e7eb;
  --shadow-lg: 0 18px 48px rgba(17, 19, 24, 0.14), 0 2px 8px rgba(17, 19, 24, 0.06);
  color-scheme: light;
}
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }
html[data-theme="light"] .card, html[data-theme="light"] .kpi, html[data-theme="light"] .qa,
html[data-theme="light"] .table-wrap, html[data-theme="light"] .stat-strip { box-shadow: 0 1px 2px rgba(17, 19, 24, 0.04); }
html[data-theme="light"] .card .table-wrap { box-shadow: none; }

/* Deeper accent tones on white */
html[data-theme="light"] .tone-brand { --tone: #4f5bd5; }
html[data-theme="light"] .tone-teal { --tone: #0d9488; }
html[data-theme="light"] .tone-success { --tone: #16a34a; }
html[data-theme="light"] .tone-warning { --tone: #d97706; }
html[data-theme="light"] .tone-danger { --tone: #dc2626; }
html[data-theme="light"] .tone-info { --tone: #2563eb; }
html[data-theme="light"] .tone-violet { --tone: #7c3aed; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+1) { --tone: #4f5bd5; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+2) { --tone: #0d9488; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+3) { --tone: #2563eb; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+4) { --tone: #7c3aed; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+5) { --tone: #d97706; }
html[data-theme="light"] .qa.indigo { --qa-c: #4f5bd5; }
html[data-theme="light"] .qa.teal { --qa-c: #0d9488; }
html[data-theme="light"] .qa.violet { --qa-c: #7c3aed; }
html[data-theme="light"] .qa.rose { --qa-c: #db2777; }
html[data-theme="light"] .qa.amber { --qa-c: #d97706; }
html[data-theme="light"] .qa.sky { --qa-c: #2563eb; }

/* Older rules with fixed light-on-dark colours */
html[data-theme="light"] a:hover, html[data-theme="light"] .link-btn:hover { color: var(--primary-deep); }
html[data-theme="light"] input:focus, html[data-theme="light"] select:focus, html[data-theme="light"] textarea:focus { box-shadow: 0 0 0 3px rgba(79, 91, 213, 0.15); }
html[data-theme="light"] .alert.info { color: #1e3a8a; border-color: rgba(37, 99, 235, 0.25); }
html[data-theme="light"] .alert.warning { color: #7c2d12; border-color: rgba(217, 119, 6, 0.3); }
html[data-theme="light"] .alert.danger { color: #991b1b; border-color: rgba(220, 38, 38, 0.25); }
html[data-theme="light"] .alert.success { color: #14532d; border-color: rgba(22, 163, 74, 0.25); }
html[data-theme="light"] .toast { background: rgba(255, 255, 255, 0.92); border-color: rgba(17, 19, 24, 0.1); box-shadow: 0 12px 32px rgba(17, 19, 24, 0.16); }
html[data-theme="light"] .cal-head { background: var(--surface-2); }
html[data-theme="light"] .cal-cell.is-other { background: rgba(17, 19, 24, 0.025); }
html[data-theme="light"] .cal-chip { color: var(--text-strong); }
html[data-theme="light"] .portal-bar { background: rgba(255, 255, 255, 0.86); }
html[data-theme="light"] .doc-sheet { box-shadow: inset 0 0 0 1px var(--border); }
html[data-theme="light"] .initials { background: linear-gradient(145deg, #3a3e47, #1d2026); box-shadow: none; }

/* ==========================================================================
   15d. Control style: pill buttons and fields, solid-colour KPI tiles
   Black canvas, warm off-white text, sage accent; pill-shaped buttons and
   inputs on #1c1c1c, light primary buttons with ink text, rounded panels with
   hairline borders, and KPI tiles filled with a soft solid colour.
   ========================================================================== */
:root {
  --bg: #000000;
  --bg-elevated: #0b0b0b;
  --sidebar-bg: #000000;
  --surface: #000000;
  --surface-2: #1c1c1c;
  --surface-3: #262626;
  --border: rgba(255, 255, 255, 0.13);
  --border-soft: rgba(255, 255, 255, 0.08);
  --topbar-bg: rgba(0, 0, 0, 0.82);
  --hover-bg: #111111;
  --row-hover: #0d0d0d;

  --text: #f1f3ee;
  --text-strong: #ffffff;
  --text-2: #d9ddd7;
  --text-muted: #a3a3a3;
  --text-faint: #8a8a8a;

  --primary: #b9d48f;
  --primary-strong: #cfe3ad;
  --primary-deep: #9dbb70;
  --primary-soft: rgba(185, 212, 143, 0.14);
  --primary-ring: rgba(185, 212, 143, 0.5);
  --focus: #b9d48f;
  --gradient-accent: linear-gradient(135deg, #b9d48f 0%, #6fd6c8 100%);

  --success: #5fd38d;
  --success-soft: rgba(95, 211, 141, 0.14);
  --warning: #f1c08f;
  --warning-soft: rgba(241, 192, 143, 0.14);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.14);
  --info: #7cb4ff;
  --info-soft: rgba(124, 180, 255, 0.14);
  --gold: #f5c542;

  --chart-1: #b9d48f;
  --chart-2: #f5c542;

  /* Controls */
  --field-bg: #1c1c1c;
  --field-bg-focus: #1c1c1c;
  --btn-bg: #1c1c1c;
  --btn-bg-hover: #262626;
  --btn-primary-bg: #f2f3ee;
  --btn-primary-hover: #ffffff;
  --btn-primary-fg: #1b1f1d;
  --ink: #1b1f1d;

  --radius: 24px;
  --radius-sm: 14px;
  --radius-lg: 30px;
}

/* ---- Panels ---- */
.card, .table-wrap, .stat-strip { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); }
.card { padding: 20px 22px; }
.qa, .plan, .tt-day { border-radius: 20px; }
.sheet-link, .attn-icon, .li-icon { border-radius: 12px; }

/* ---- Buttons: pills ---- */
.btn {
  border-radius: var(--radius-pill); border: 1px solid transparent; background: var(--btn-bg); color: var(--text);
  font-weight: 600; font-size: 0.875rem; min-height: 42px; padding: 9px 18px;
}
.btn:hover { background: var(--btn-bg-hover); border-color: transparent; color: var(--text); }
.btn.primary { background: var(--btn-primary-bg); border-color: transparent; color: var(--btn-primary-fg); }
.btn.primary:hover { background: var(--btn-primary-hover); border-color: transparent; color: var(--btn-primary-fg); }
.btn.primary .spinner { border-color: rgba(27, 31, 29, 0.25); border-top-color: var(--btn-primary-fg); }
.btn.success { background: var(--primary); color: var(--ink); }
.btn.success:hover { background: #c6dd9f; color: var(--ink); }
.btn.danger { background: var(--danger); border-color: transparent; color: var(--ink); }
.btn.danger:hover { background: #ff8585; color: var(--ink); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.3); }
.btn.small { min-height: 34px; padding: 6px 14px; font-size: 0.8125rem; border-radius: var(--radius-pill); }
.btn.lg { min-height: 50px; padding: 13px 22px; font-size: 1rem; }
.new-btn { min-height: 40px; }
.icon-btn { background: transparent; border-color: transparent; border-radius: 50%; color: var(--text); }
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); border-color: transparent; }
.link-btn { color: var(--primary-strong); }

/* Segmented switches: black pill, light active segment */
.segmented { background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-pill); padding: 4px; gap: 4px; }
.segmented button { border-radius: var(--radius-pill); padding: 6px 14px; color: var(--text-muted); font-weight: 500; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--btn-primary-bg); color: var(--btn-primary-fg); font-weight: 600; box-shadow: none; }
.pill-select button { border-color: transparent; background: var(--btn-bg); }
.pill-select button[aria-pressed="true"] { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: transparent; }

/* ---- Fields: filled pills, sage outline on focus ---- */
input, select, textarea {
  background-color: var(--field-bg); border: 1px solid transparent; border-radius: var(--radius-pill);
  color: var(--text); font-size: 1rem; min-height: 46px; padding: 11px 18px;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.12); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); background-color: var(--field-bg-focus); box-shadow: none; outline: none; }
input::placeholder, textarea::placeholder { color: #767676; }
textarea { border-radius: 20px; padding: 12px 16px; line-height: 1.45; min-height: 110px; }
select {
  padding-right: 42px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 23px) 52%, calc(100% - 18px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
select[multiple] { background-image: none; padding-right: 18px; border-radius: 18px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: none; }
input[type="checkbox"], input[type="radio"] { min-height: auto; padding: 0; border-radius: 4px; accent-color: var(--primary); background: none; }
input[type="file"] { border-radius: 18px; padding: 8px; }
input[type="file"]::file-selector-button { border-radius: var(--radius-pill); border: 0; background: var(--btn-primary-bg); color: var(--btn-primary-fg); font-weight: 600; padding: 6px 14px; }
.field label { font-weight: 500; padding-left: 4px; }
.field .hint, .field .error { padding-left: 4px; }
.input-wrap > .icon.lead { left: 16px; }
.input-wrap > input { padding-left: 44px; }
.input-wrap.has-trail > input { padding-right: 52px; }
.input-wrap .trail { right: 5px; width: 36px; height: 36px; border-radius: 50%; }
.otp-input { border-radius: 18px; }
.mark-input { border-radius: 12px; min-height: 38px; padding: 6px 10px; }
.table-tools input[type="search"] { padding-left: 40px; background-position: 14px 50%; }
.search-trigger { background: var(--field-bg); border-color: transparent; }
.search-trigger:hover { border-color: rgba(255, 255, 255, 0.12); }
.jump-search input, .jump-search input:focus, .jump-search input:hover { background: transparent; border: 0; border-radius: 0; min-height: 40px; padding: 0; }
.attendance-toggle { border-radius: var(--radius-pill); border-color: transparent; background: var(--field-bg); padding: 3px; gap: 2px; }
.attendance-toggle label { border-right: 0; border-radius: var(--radius-pill); }

/* ---- KPI tiles: solid soft colour, dark text ---- */
.tone-brand { --tone: #b9d48f; }
.tone-teal { --tone: #6fd6c8; }
.tone-success { --tone: #5fd38d; }
.tone-warning { --tone: #f1c08f; }
.tone-danger { --tone: #ff8a7a; }
.tone-info { --tone: #7cb4ff; }
.tone-violet { --tone: #b79cff; }
.tone-gold { --tone: #f5c542; }
.kpi:not([class*="tone-"]):nth-child(5n+1) { --tone: #b9d48f; }
.kpi:not([class*="tone-"]):nth-child(5n+2) { --tone: #7cb4ff; }
.kpi:not([class*="tone-"]):nth-child(5n+3) { --tone: #f1c08f; }
.kpi:not([class*="tone-"]):nth-child(5n+4) { --tone: #b79cff; }
.kpi:not([class*="tone-"]):nth-child(5n+5) { --tone: #6fd6c8; }
/* The tone fades from the top-left corner into the card, so text uses the theme colours. */
.kpi, a.kpi:hover {
  --kpi-fade: 55%;
  --kpi-ink: var(--tone);
  --kpi-bg:
    radial-gradient(150% 130% at 0% 0%, color-mix(in srgb, var(--tone) var(--kpi-fade), transparent) 0%,
      color-mix(in srgb, var(--tone) 15%, transparent) 50%, transparent 85%),
    var(--bg-elevated);
  background: var(--kpi-bg); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--tone) 30%, var(--border-soft)); border-radius: 20px;
}
a.kpi:hover { --kpi-fade: 70%; border-color: color-mix(in srgb, var(--tone) 60%, var(--border-soft)); }
.kpi-icon, .kpi-icon.teal, .kpi-icon.success, .kpi-icon.warning, .kpi-icon.danger, .kpi-icon.info {
  width: 32px; height: 32px; border-radius: 10px; color: var(--kpi-ink); background: color-mix(in srgb, var(--tone) 20%, transparent); box-shadow: none;
}
.kpi .label { color: var(--text-2); font-weight: 600; }
.kpi .value, a.kpi:hover .value { color: var(--text-strong); font-weight: 800; letter-spacing: -0.02em; }
.kpi.alert .value { color: var(--danger); }
.kpi .sub { color: var(--text-muted); }
.kpi .go { color: var(--kpi-ink); }
.kpi .delta { border-radius: var(--radius-pill); }
.kpi .kpi-meter { background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--tone) 25%, transparent) 0 3px, transparent 3px 6px); }
.kpi .kpi-meter > div { background: var(--kpi-ink); }
.kpi .spark path { stroke: var(--kpi-ink) !important; }
.kpi .spark path[fill^="url"] { opacity: 0.35; }
.kpi :focus-visible, a.kpi:focus-visible { outline-color: var(--kpi-ink); }

/* ---- Chips, badges, stat strip ---- */
.badge { border-radius: var(--radius-pill); padding: 3px 11px; }
.grade-chip { border-radius: var(--radius-pill); }
.stat-strip .stat { border-radius: 0; }

/* ---- Dialogs: rounded sheets with a round light close button ---- */
dialog { border-radius: var(--radius-lg); border: 1px solid var(--border); background: #000000; }
dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.dialog-head { padding: 18px 20px 14px 24px; border-bottom: 0; }
.dialog-head h2 { font-size: 1.25rem; font-weight: 500; letter-spacing: -0.02em; }
.dialog-head .btn.ghost.small {
  width: 36px; min-height: 36px; height: 36px; padding: 0; border-radius: 50%; border: 0;
  background: var(--btn-primary-bg); color: var(--btn-primary-fg); font-size: 1rem;
}
.dialog-head .btn.ghost.small:hover { background: var(--btn-primary-hover); }
.dialog-body { padding: 6px 24px 20px; }
.dialog-foot { padding: 14px 20px 20px; border-top: 0; gap: 10px; }

/* ---- Headings: lighter, larger ---- */
.page-head h1 { font-size: 1.75rem; font-weight: 500; letter-spacing: -0.03em; }
.card-head h2, .card-head h3, .section-title h2 { font-weight: 600; }

/* ---- Navigation accents ---- */
.rail-item[aria-current="page"] { background: var(--primary-soft); }
.subnav a[aria-current="page"] { border-bottom-color: var(--primary); }
@media (max-width: 900px) {
  /* Floating pill tab bar */
  .tabbar {
    left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 5px; border: 1px solid var(--border); border-radius: 28px;
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  }
  .tabbar .rail-item { border-radius: 22px; min-height: 50px; }
  .content { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
}

/* ---- Sign-in card: same controls, kept dark over the photo ---- */
.auth-card input:not([type="checkbox"]):not([type="radio"]) { background-color: rgba(28, 28, 28, 0.88); border: 1px solid transparent; border-radius: var(--radius-pill); min-height: 48px; }
.auth-card input:not([type="checkbox"]):not([type="radio"]):focus { border-color: var(--primary); background-color: rgba(28, 28, 28, 0.95); }
.auth-tabs { border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.55); }
.auth-tabs::before { border-radius: var(--radius-pill); background: var(--btn-primary-bg); border-color: transparent; box-shadow: none; }
.auth-tabs button { border-radius: var(--radius-pill); }
.auth-tabs button[aria-selected="true"] { color: var(--btn-primary-fg); }
.auth-card .btn.primary[type="submit"] { min-height: 50px; font-size: 0.9375rem; }

/* ---- Light theme: same shapes, light surfaces, ink primary ---- */
html[data-theme="light"] {
  --field-bg: #eff0eb;
  --field-bg-focus: #ffffff;
  --btn-bg: #ecede8;
  --btn-bg-hover: #e2e4dd;
  --btn-primary-bg: #1b1f1d;
  --btn-primary-hover: #000000;
  --btn-primary-fg: #f2f3ee;
  --primary: #5f7d2c;
  --primary-strong: #4a6420;
  --primary-deep: #3d5419;
  --primary-soft: rgba(95, 125, 44, 0.12);
  --primary-ring: rgba(95, 125, 44, 0.4);
  --focus: #5f7d2c;
  --chart-1: #6f9233;
  --chart-2: #d49b12;
}
html[data-theme="light"] dialog { background: #ffffff; }
html[data-theme="light"] .btn.ghost:hover { background: rgba(0, 0, 0, 0.04); border-color: rgba(0, 0, 0, 0.25); }
html[data-theme="light"] .icon-btn:hover { background: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] input:hover, html[data-theme="light"] select:hover, html[data-theme="light"] textarea:hover { border-color: rgba(0, 0, 0, 0.12); }
html[data-theme="light"] input::placeholder, html[data-theme="light"] textarea::placeholder { color: #80857c; }
html[data-theme="light"] .search-trigger:hover { border-color: rgba(0, 0, 0, 0.12); }
/* Pastel KPI tiles read the same on white; keep them, with a soft edge. */
html[data-theme="light"] .tone-brand { --tone: #b9d48f; }
html[data-theme="light"] .tone-teal { --tone: #6fd6c8; }
html[data-theme="light"] .tone-success { --tone: #5fd38d; }
html[data-theme="light"] .tone-warning { --tone: #f1c08f; }
html[data-theme="light"] .tone-danger { --tone: #ff8a7a; }
html[data-theme="light"] .tone-info { --tone: #7cb4ff; }
html[data-theme="light"] .tone-violet { --tone: #b79cff; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+1) { --tone: #b9d48f; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+2) { --tone: #7cb4ff; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+3) { --tone: #f1c08f; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+4) { --tone: #b79cff; }
html[data-theme="light"] .kpi:not([class*="tone-"]):nth-child(5n+5) { --tone: #6fd6c8; }
/* Pastels are faint on white: a stronger wash, and darker icons and bars. */
html[data-theme="light"] .kpi { --kpi-fade: 70%; --kpi-ink: color-mix(in srgb, var(--tone) 45%, #000000); }
html[data-theme="light"] a.kpi:hover { --kpi-fade: 85%; }
@media (max-width: 900px) {
  html[data-theme="light"] .tabbar { background: rgba(255, 255, 255, 0.85); box-shadow: 0 10px 30px rgba(17, 19, 24, 0.12); }
}

/* ==========================================================================
   15e. Compact density: tighter forms, cards, KPIs, tables and page chrome.
   Overrides spacing only; colours and shapes come from the layers above.
   ========================================================================== */
/* Page chrome */
.content { padding: 16px 24px 32px; }
.page-head { margin-bottom: 14px; gap: 10px; }
.page-head h1 { font-size: 1.5rem; margin-bottom: 0; }
.page-head p { margin-top: 2px; }
.chrome .topbar { min-height: 56px; padding: 8px 24px; }
.subnav a { padding: 7px 10px 9px; }
.stack > * + * { margin-top: 12px; }
.stack.tight > * + * { margin-top: 8px; }
.grid { gap: 12px; }
.tabs { margin-bottom: 12px; }
.tabs button { padding: 8px 12px; }
.section-title { margin: 2px 0 8px; }

/* Cards and lists */
.card { padding: 14px 16px; }
.card + .card { margin-top: 12px; }
.card-head { margin-bottom: 10px; }
.card.flush > .card-head { padding: 12px 16px 0; }
.list-item { padding: 8px 0; gap: 10px; }
.attn-row { padding: 8px 0; gap: 10px; }
.attn-icon, .li-icon { width: 30px; height: 30px; }
.meter-row { padding: 6px 0; }

/* KPI tiles */
.kpi { padding: 12px 14px; gap: 2px; border-radius: 16px; }
.kpi-top { margin-bottom: 6px; gap: 8px; }
.kpi-icon, .kpi-icon.teal, .kpi-icon.success, .kpi-icon.warning, .kpi-icon.danger, .kpi-icon.info { width: 28px; height: 28px; border-radius: 9px; }
.kpi .value { font-size: 1.4rem; margin-top: 0; }
.kpi .sub { margin-top: 4px; }
.kpi .kpi-meter { margin: 6px 0 0; }
.stat { padding: 10px 14px; }
.qa { min-height: 72px; padding: 10px 12px; gap: 8px; }

/* Forms */
.form { gap: 10px; }
.form-grid { gap: 10px 12px; }
.form h3, .form h2 { margin: 6px 0 -2px; font-size: 0.875rem; }
.field { gap: 4px; }
.field label { font-size: 0.78rem; }
.field .hint { font-size: 0.72rem; }
input, select, textarea { min-height: 38px; padding: 7px 14px; font-size: 0.875rem; }
select { padding-right: 36px; background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%; }
textarea { min-height: 76px; padding: 9px 14px; border-radius: 16px; }
.input-wrap > input { padding-left: 38px; }
.input-wrap > .icon.lead { left: 13px; }
.input-wrap .trail { width: 32px; height: 32px; }
input[type="file"] { padding: 4px; min-height: 38px; }
input[type="file"]::file-selector-button { padding: 5px 12px; }
input[type="checkbox"], input[type="radio"] { min-height: auto; padding: 0; }
.mark-input { min-height: 32px; padding: 4px 8px; }
.search-trigger { height: 36px; }

/* Buttons */
.btn { min-height: 36px; padding: 7px 15px; font-size: 0.8125rem; }
.btn.small { min-height: 30px; padding: 4px 12px; font-size: 0.78rem; }
.btn.lg { min-height: 44px; padding: 10px 20px; font-size: 0.9375rem; }
.new-btn { min-height: 36px; }
.icon-btn { width: 36px; height: 36px; }
.segmented { padding: 3px; }
.segmented button { padding: 5px 12px; }

/* Tables */
th { padding: 9px 14px; }
td { padding: 9px 14px; }
.table-tools { margin-bottom: 10px; gap: 8px; }
.pager { padding-top: 8px; }

/* Dialogs */
.dialog-head { padding: 14px 16px 10px 20px; }
.dialog-head .btn.ghost.small { width: 32px; height: 32px; min-height: 32px; }
.dialog-body { padding: 4px 20px 16px; }
.dialog-foot { padding: 10px 16px 16px; }

/* Large screens: the rail widens into a slim sidebar, icon and label on one line */
.rail-brand-name { display: none; }
@media (min-width: 1200px) {
  :root { --rail-w: 212px; }
  .rail { padding: 12px 12px 14px; gap: 2px; }
  .rail-brand { display: flex; align-items: center; justify-content: flex-start; gap: 10px; height: 48px; padding: 0 10px; margin-bottom: 8px; }
  .rail-brand-name { display: block; min-width: 0; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rail-item {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 42px; padding: 9px 12px; border-radius: 12px; font-size: 0.875rem; font-weight: 500;
  }
  .rail-item .icon { flex: none; width: 19px; height: 19px; }
  .rail-item span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Sign-in card keeps its comfortable size */
.auth-card input:not([type="checkbox"]):not([type="radio"]) { min-height: 44px; font-size: 0.9375rem; }
.auth-card .btn.primary[type="submit"] { min-height: 46px; }

@media (max-width: 900px) {
  .content { padding: 12px 12px calc(104px + env(safe-area-inset-bottom)); }
  .chrome .topbar { padding: 8px 12px; min-height: 52px; }
  /* 16px text stops iPhones zooming into a field on focus */
  input, select, textarea { font-size: 1rem; }
}

/* ==========================================================================
   16. Motion & print
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal, .badge-gem { opacity: 1; transform: none; scale: 1; }
  .stage-photo, .stage::after { animation: none; }
  .hero h1 .squiggle path { stroke-dashoffset: 0; }
}

.print-only { display: none; }
.print-host { display: none; }
@media print {
  :root { color-scheme: light; }
  html, body { background: #fff !important; color: #000; font-size: 12px; }
  .rail, .chrome, .tabbar, .topbar, .banner, .no-print, .toasts, .tabs, .table-tools, .pager, .btn, .portal-bar { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; animation: none; }
  .card, .table-wrap, .portal-head { background: #fff; color: #000; box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .table-wrap { border: 0; overflow: visible; }
  th { background: #eee !important; color: #000; position: static; }
  td, th { border-color: #ccc; }
  .muted, .dl dt { color: #444; }
  .print-only { display: block; }
  a { color: #000; text-decoration: none; }
  body.print-one > *:not(.print-host) { display: none !important; }
  .print-host { display: block !important; }
  .doc-sheet { border-radius: 0; padding: 0; box-shadow: none; border: 0; }
  .rc-wrap { margin: 0; }
  .rc-batch .rc-wrap { break-after: page; }
  .rc-batch .rc-actions { display: none; }
  .bs-table { font-size: 10px; }
  .bs-table td, .bs-table th { padding: 3px 5px; }
  .bs-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
}
/* Broadsheet */
.bs-table th.num, .bs-table td.num { white-space: nowrap; }
.bs-table tfoot td { border-top: 2px solid var(--border); font-weight: 600; }
.bs-grade { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background: var(--surface-2); color: var(--text-muted); }
.rc-batch { display: grid; gap: 18px; }
@media (max-width: 560px) {
  .portal-bar { padding: 8px 12px; gap: 8px; }
  .portal-bar .badge, .portal-bar .btn > span { display: none; }
  .portal-bar .btn { padding: 4px 8px; }
}
.sig-preview { display: inline-grid; place-items: center; min-height: 72px; min-width: 200px; padding: 10px; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--border); }
.sig-preview img { max-height: 60px; max-width: 240px; object-fit: contain; }
.payslip { max-width: 760px; margin: 0 auto; font-size: 0.8125rem; break-after: page; }
.pay-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pay-total td { font-weight: 700; border-top: 1px solid #999; }
.pay-net { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0; padding: 12px 14px; background: #f2f2f2; border-radius: 6px; font-weight: 600; }
.pay-net strong { font-family: var(--font-display); font-size: 1.4rem; }
.pay-preview { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.875rem; }
@media (max-width: 600px) { .pay-cols { grid-template-columns: 1fr; } }
.attendance-toggle label:has(input[value="on_leave"]:checked) { background: var(--info-soft); color: var(--info); }
.attendance-toggle label:has(input[value="off_duty"]:checked) { background: var(--surface-3); color: var(--text); }
.staff-toggle { flex-wrap: nowrap; }
.staff-toggle label { white-space: nowrap; }
