/* ==========================================================================
   School Portal design system
   Motif: the bus route. Navigation items are "stops" on a dashed route line;
   the public hero shows how a child gets to school (day / boarding / bus).
   Themes: light, dark, and follow-system. Colours are tokens on :root.
   ========================================================================== */

:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #eceff0;
  --ink: #12282b;
  --ink-2: #33494c;
  --muted: #5c6f71;
  --line: #dbe1dc;
  --line-2: #c6cfc9;
  --brand: #2e7d32;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, var(--surface));
  --accent: #f4b400;
  --accent-ink: #231a00;
  --good: #167a4f;
  --good-bg: #e2f4ea;
  --warn: #8a5a00;
  --warn-bg: #fdf0cf;
  --bad: #b3261e;
  --bad-bg: #fbe4e1;
  --info: #1f5fa8;
  --info-bg: #e1edfa;
  --side: #0d2226;
  --side-ink: #c9dadb;
  --side-muted: #7f9a9c;
  --side-line: #2a474b;
  --focus: #1d6fe0;
  --shadow: 0 1px 2px rgba(10, 30, 32, .06), 0 8px 24px -12px rgba(10, 30, 32, .18);
  --r: 10px;
  --r-sm: 6px;
  --font: "Public Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", "Public Sans", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a1416;
  --surface: #11201f;
  --surface-2: #172a2b;
  --ink: #e7f0ee;
  --ink-2: #bdcfcc;
  --muted: #8fa6a3;
  --line: #243a3a;
  --line-2: #345050;
  --brand: color-mix(in srgb, var(--brand-base, #2e7d32) 45%, #a5e3a8);
  --brand-ink: #0c2b0f;
  --brand-soft: color-mix(in srgb, var(--brand) 14%, var(--surface));
  --good: #5fd49b;
  --good-bg: #123a29;
  --warn: #f1c35a;
  --warn-bg: #3a2d0c;
  --bad: #ff8d84;
  --bad-bg: #3f1a17;
  --info: #7db6f5;
  --info-bg: #14304f;
  --side: #07171a;
  --focus: #7db6f5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a1416;
    --surface: #11201f;
    --surface-2: #172a2b;
    --ink: #e7f0ee;
    --ink-2: #bdcfcc;
    --muted: #8fa6a3;
    --line: #243a3a;
    --line-2: #345050;
    --brand: color-mix(in srgb, var(--brand-base, #2e7d32) 45%, #a5e3a8);
    --brand-ink: #0c2b0f;
    --brand-soft: color-mix(in srgb, var(--brand) 14%, var(--surface));
    --good: #5fd49b;
    --good-bg: #123a29;
    --warn: #f1c35a;
    --warn-bg: #3a2d0c;
    --bad: #ff8d84;
    --bad-bg: #3f1a17;
    --info: #7db6f5;
    --info-bg: #14304f;
    --side: #07171a;
    --focus: #7db6f5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-flex; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .only-dark { display: inline-flex; }
  :root:not([data-theme]) .only-light { display: none; }
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }
.ic { flex: none; vertical-align: -3px; }
.hidden { display: none !important; }

/* ------------------------------------------------------------- app shell -- */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font: 700 1.1rem var(--display); flex: none;
}
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.brand-name { font: 700 1.02rem/1.15 var(--display); color: #fff; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: var(--side-line) transparent; }
.nav-group { margin-top: 14px; position: relative; }
.nav-title { font-size: .72rem; font-weight: 600; color: var(--side-muted); padding: 0 10px 6px 34px; letter-spacing: .02em; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 34px; margin: 1px 0;
  color: var(--side-ink); text-decoration: none; border-radius: 8px; font-size: .92rem;
}
/* the route line */
.nav-group::before {
  content: ""; position: absolute; left: 19px; top: 22px; bottom: 6px; border-left: 2px dashed var(--side-line);
}
.nav-link .stop {
  position: absolute; left: 14px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%;
  background: var(--side); border: 2px solid var(--side-line); transition: background .15s, border-color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link:hover .stop { border-color: var(--side-muted); }
.nav-link.on { background: rgba(255, 255, 255, .09); color: #fff; font-weight: 600; }
.nav-link.on .stop { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(244, 180, 0, .18); }
.nav-badge { margin-left: auto; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.side-foot { padding: 12px 20px; border-top: 1px solid var(--side-line); font-size: .85rem; }
.side-foot a { color: var(--side-muted); text-decoration: none; display: flex; gap: 8px; align-items: center; }
.side-foot a:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top-search { flex: 1; max-width: 460px; position: relative; display: flex; align-items: center; }
.top-search > span { position: absolute; left: 12px; color: var(--muted); display: flex; }
.top-search input { width: 100%; padding: 9px 12px 9px 36px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.top-search.spacer { flex: 1; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; background: var(--accent); border-radius: 50%; border: 2px solid var(--bg); }
.menu-btn { display: none; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 99px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--surface-2); }
.uname { display: flex; flex-direction: column; font-size: .88rem; font-weight: 600; line-height: 1.2; }
.uname small { font-weight: 400; color: var(--muted); font-size: .75rem; }
.usermenu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 30;
}
.usermenu .menu a, .usermenu .menu button {
  display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border: 0; background: none; color: var(--ink);
  font: inherit; text-decoration: none; border-radius: 6px; cursor: pointer; text-align: left;
}
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--surface-2); }
.content { padding: 26px 28px 40px; flex: 1; width: 100%; max-width: 1400px; }
.foot { padding: 16px 28px; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }
.scrim { display: none; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--brand); color: var(--brand-ink);
  display: inline-grid; place-items: center; font: 700 .85rem var(--display); flex: none;
}
.avatar.sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.6rem; border-radius: 22px; }

/* ----------------------------------------------------------- page chrome -- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: inherit; }

.flashes { display: grid; gap: 8px; margin-bottom: 18px; }
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); border-left-width: 4px;
}
.flash.success { border-left-color: var(--good); background: var(--good-bg); }
.flash.error { border-left-color: var(--bad); background: var(--bad-bg); }
.flash.warning { border-left-color: var(--accent); background: var(--warn-bg); }
.flash.info { border-left-color: var(--info); background: var(--info-bg); }
.flash-x { background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; display: grid; }
.flash-x:hover { opacity: 1; }

/* ---------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 .9rem var(--font);
  text-decoration: none; cursor: pointer; line-height: 1.2; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.accent:hover { background: color-mix(in srgb, var(--accent) 90%, #000); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 6px; }
.btn.block { width: 100%; }
form.inline { display: inline; margin: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------------ forms -- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 20px; }
.form-heading { grid-column: 1 / -1; margin: 10px 0 -4px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 1rem; }
.form-grid > .form-heading:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: .87rem; color: var(--ink-2); }
.req { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=tel], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface);
  color: var(--ink); font: inherit; min-height: 40px;
}
textarea { resize: vertical; min-height: 90px; }
input[type=file] { font: inherit; padding: 7px; border: 1px dashed var(--line-2); border-radius: 8px; background: var(--surface); width: 100%; color: var(--ink-2); }
input[type=color] { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500 !important; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.help { font-size: .8rem; color: var(--muted); }
.err { font-size: .82rem; color: var(--bad); font-weight: 600; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.search-box { position: relative; }
.filter-input { margin-bottom: 4px; font-size: .85rem; padding: 6px 10px; min-height: 32px; }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.toolbar .field { min-width: 150px; flex: 1 1 150px; max-width: 260px; }
.toolbar .field.grow { flex: 2 1 220px; max-width: 360px; }
.toolbar .btn { align-self: flex-end; min-height: 40px; }

/* ----------------------------------------------------------------- panels -- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; margin-bottom: 20px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.grid-2 > .panel, .grid-3 > .panel { margin-bottom: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; align-items: start; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.stack > * + * { margin-top: 20px; }

/* figures are a ruled strip, not a row of cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 22px; overflow: hidden; }
.stat { padding: 16px 20px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.stat:first-child { border-left: 0; }
.stat-label { font-size: .82rem; color: var(--muted); font-weight: 500; }
.stat strong { font: 700 clamp(1.15rem, .9rem + .9vw, 1.6rem)/1.15 var(--display); overflow-wrap: anywhere; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: .78rem; color: var(--muted); }

/* ----------------------------------------------------------------- tables -- */
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; margin-bottom: 16px; }
.panel .tbl-wrap { border: 0; border-radius: 0; margin-bottom: 0; background: none; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--brand-soft); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .who { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.tbl .who a { font-weight: 600; color: var(--ink); text-decoration: none; }
.tbl .who a:hover { color: var(--brand); text-decoration: underline; }
.tbl .who small { display: block; color: var(--muted); font-size: .8rem; }
.tbl .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line-2); border-bottom: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .88rem; margin-bottom: 8px; }
.pager nav { display: flex; gap: 4px; }
.pg { padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink); background: var(--surface); }
.pg.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pg.off { color: var(--muted); background: none; border-color: transparent; }
a.pg:hover { background: var(--surface-2); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.bus { background: var(--accent); color: var(--accent-ink); }

.empty { text-align: center; padding: 44px 20px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty h2, .empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 16px; }

/* ----------------------------------------------------------- key/value list -- */
.kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 0; margin: 0; }
.kv dt, .kv dd { padding: 9px 0; border-bottom: 1px solid var(--line); margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { font-weight: 500; overflow-wrap: anywhere; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }

.profile-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.profile-head h1 { margin: 0 0 4px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit; font-size: .92rem; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--brand); border-bottom-color: var(--accent); }
.tab-panel[hidden] { display: none; }

/* ----------------------------------------------------------------- charts -- */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .ax { stroke: var(--line); }
.chart .lbl { fill: var(--muted); font: 11px var(--font); }
.chart .val { fill: var(--ink-2); font: 600 11px var(--font); }
.bar-a { fill: var(--brand); }
.bar-b { fill: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.donut-wrap svg { width: 150px; height: 150px; flex: none; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.meter.bus > span { background: var(--accent); }

/* ------------------------------------------------------- domain components -- */
.att-grid { display: grid; gap: 0; }
.att-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) 3fr 2fr; gap: 12px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.att-row:last-child { border-bottom: 0; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg label { cursor: pointer; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 13px; font-size: .84rem; font-weight: 600; color: var(--ink-2); border-left: 1px solid var(--line-2); background: var(--surface); }
.seg label:first-child span { border-left: 0; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }
.seg input:checked + span.p { background: var(--good); color: #fff; }
.seg input:checked + span.a { background: var(--bad); color: #fff; }
.seg input:checked + span.l { background: var(--accent); color: var(--accent-ink); }
.seg input:checked + span.e { background: var(--info); color: #fff; }
.tt-grid { display: grid; grid-template-columns: 90px repeat(var(--cols, 5), minmax(130px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; background: var(--surface); }
.tt-h { padding: 10px; font-weight: 700; font-size: .82rem; color: var(--muted); border-bottom: 1px solid var(--line-2); background: var(--surface); position: sticky; top: 0; }
.tt-t { padding: 10px; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tt-c { padding: 6px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); min-height: 64px; }
.tt-slot { background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 4px; padding: 6px 8px; font-size: .82rem; margin-bottom: 4px; }
.tt-slot b { display: block; }
.tt-slot small { color: var(--muted); }
.route-line { position: relative; margin: 0; padding: 0 0 0 28px; list-style: none; }
.route-line::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; border-left: 2px dashed var(--line-2); }
.route-line li { position: relative; padding: 6px 0; display: flex; gap: 14px; align-items: baseline; }
.route-line li::before { content: ""; position: absolute; left: -26px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.route-line li:first-child::before, .route-line li:last-child::before { background: var(--accent); border-color: var(--accent); }
.route-line time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 48px; font-size: .88rem; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.invoice-doc { max-width: 820px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 36px 40px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 18px; margin-bottom: 20px; }
.doc-head h2 { margin: 0 0 4px; font-size: 1.5rem; }
.doc-title { font: 700 1.6rem var(--display); text-align: right; }
.sig { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; }
.sig div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: .85rem; color: var(--muted); }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--brand); }
.question { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px; background: var(--surface); }
.question .opt { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.question .opt:hover { background: var(--surface-2); }
.question .opt input { accent-color: var(--brand); width: 18px; height: 18px; }
.msg-body { white-space: pre-wrap; line-height: 1.65; }
.timer { font: 700 1.3rem var(--display); font-variant-numeric: tabular-nums; }
.cred-box { background: var(--warn-bg); border: 1px solid var(--accent); border-radius: var(--r); padding: 14px 18px; margin-bottom: 18px; }
.cred-box code { font-size: 1.05rem; font-weight: 700; background: var(--surface); padding: 2px 8px; border-radius: 6px; }

/* ------------------------------------------------------------- auth screen -- */
body.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.auth-art {
  background: var(--side); color: #dcebe9; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-art::after {
  content: ""; position: absolute; right: 54px; top: 0; bottom: 0; border-right: 3px dashed rgba(255, 255, 255, .13);
}
.auth-art h1 { color: #fff; font-size: clamp(2rem, 1.2rem + 2.6vw, 3.4rem); max-width: 14ch; }
.auth-art p { max-width: 38ch; color: #a9c2c0; font-size: 1.05rem; }
.auth-modes { display: grid; gap: 14px; margin: 0; padding: 0 0 0 0; list-style: none; position: relative; z-index: 1; }
.auth-modes li { display: flex; gap: 14px; align-items: center; }
.auth-modes i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(244, 180, 0, .18); flex: none; }
.auth-form { display: grid; place-items: center; padding: 32px; position: relative; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 1.7rem; }
.auth-top { position: absolute; top: 18px; right: 22px; display: flex; gap: 8px; align-items: center; }

/* ================================================================ public site */
body.site { background: var(--bg); }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 780px; }
.s-head { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.s-head-in { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.s-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font: 700 1.1rem var(--display); }
.s-nav { display: flex; gap: 4px; margin-left: 12px; flex: 1; }
.s-nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .93rem; }
.s-nav a:hover { background: var(--surface-2); }
.s-nav a.on { color: var(--brand); font-weight: 700; box-shadow: inset 0 -3px 0 var(--accent); border-radius: 0; }
.s-actions { display: flex; gap: 8px; align-items: center; }
.s-menu-btn { display: none; }

.hero { background: var(--side); color: #e4f0ee; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px); background-size: 22px 22px;
}
.hero-in { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 56px; padding: 72px 24px 80px; align-items: center; }
.hero h1 { color: #fff; font-size: clamp(2.3rem, 1.4rem + 3.4vw, 4.2rem); line-height: 1.02; letter-spacing: -.025em; margin-bottom: 18px; max-width: 15ch; }
.hero p.lead { font-size: 1.15rem; color: #b8cfcc; max-width: 46ch; margin-bottom: 28px; }
.hero .btn { border-color: rgba(255, 255, 255, .28); background: transparent; color: #fff; }
.hero .btn:hover { background: rgba(255, 255, 255, .1); }
.hero .btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hero .btn.accent:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.way { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); border-radius: 16px; padding: 22px 24px; backdrop-filter: blur(4px); }
.way h2 { color: #fff; font-size: 1.15rem; margin-bottom: 14px; }
.way-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.way-tab { padding: 8px 14px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .22); background: transparent; color: #cfe3e0; font: 600 .86rem var(--font); cursor: pointer; }
.way-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.way-panel[hidden] { display: none; }
.way .route-line::before { border-color: rgba(255, 255, 255, .28); }
.way .route-line li::before { background: var(--side); border-color: #a5e3a8; }
.way .route-line li:first-child::before, .way .route-line li:last-child::before { background: var(--accent); border-color: var(--accent); }
.way .route-line time { color: #9bb9b6; }
.way .way-note { color: #9bb9b6; font-size: .88rem; margin: 14px 0 0; }

.band { padding: 72px 0; }
.band.alt { background: var(--surface); border-block: 1px solid var(--line); }
.band h2.big { font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.5rem); margin-bottom: 14px; letter-spacing: -.02em; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; align-items: start; }
.prose { max-width: 66ch; font-size: 1.05rem; line-height: 1.7; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; border-top: 2px solid var(--ink); margin-top: 36px; }
.fact { padding: 18px 20px 6px 0; }
.fact strong { display: block; font: 700 2.6rem/1 var(--display); letter-spacing: -.03em; }
.fact span { color: var(--muted); font-size: .92rem; }
.rows { border-top: 1px solid var(--line-2); }
.row-item { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); align-items: baseline; text-decoration: none; color: inherit; }
a.row-item:hover h3 { color: var(--brand); text-decoration: underline; }
.row-item h3 { margin: 0 0 4px; }
.row-item p { margin: 0; color: var(--muted); }
.row-date { font: 700 .95rem var(--display); color: var(--brand); }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); }
.level { padding: 18px 20px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.level b { font: 700 1.1rem var(--display); display: block; }
.level span { color: var(--muted); font-size: .88rem; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px 24px; }
.staff-card img, .staff-card .avatar { width: 100%; aspect-ratio: 1; border-radius: 14px; height: auto; font-size: 2.4rem; object-fit: cover; }
.staff-card h3 { margin: 12px 0 0; font-size: 1.02rem; }
.gallery { columns: 3 240px; column-gap: 14px; }
.gallery figure { margin: 0 0 14px; break-inside: avoid; }
.gallery img { width: 100%; border-radius: 10px; display: block; }
.gallery figcaption { font-size: .85rem; color: var(--muted); padding: 6px 2px 0; }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.album img, .album .ph { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; background: var(--surface-2); display: block; }
.album h3 { margin: 10px 0 2px; }
.cta-band { background: var(--accent); color: var(--accent-ink); }
.cta-band .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-block: 44px; flex-wrap: wrap; }
.cta-band h2 { margin: 0 0 4px; font-size: clamp(1.4rem, 1rem + 1.4vw, 2.1rem); }
.cta-band p { margin: 0; }
.cta-band .btn { background: var(--accent-ink); color: #fff; border-color: var(--accent-ink); }
.s-foot { background: var(--side); color: #b3cac8; padding: 52px 0 40px; margin-top: 0; }
.s-foot-in { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.s-foot h4 { color: #fff; }
.s-foot a { color: #e5f1ef; }
.s-foot .muted { color: #7f9a98; }
.s-foot-name { font: 700 1.3rem var(--display); color: #fff; }
.page-title { padding: 54px 0 34px; border-bottom: 1px solid var(--line); background: var(--surface); }
.page-title h1 { margin: 0 0 6px; font-size: clamp(1.9rem, 1.3rem + 2vw, 3rem); }
.page-title p { margin: 0; color: var(--muted); max-width: 60ch; font-size: 1.05rem; }
.apply-form { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.article h1 { font-size: clamp(1.8rem, 1.2rem + 2vw, 2.8rem); }
.article .body { font-size: 1.08rem; line-height: 1.75; max-width: 66ch; }
.article img.cover { width: 100%; border-radius: 14px; margin-bottom: 24px; max-height: 420px; object-fit: cover; }
.map-embed { width: 100%; height: 320px; border: 0; border-radius: 12px; }

/* =============================================================== installer */
.install-wrap { max-width: 720px; margin: 40px auto; padding: 0 20px; }

/* ================================================================= responsive */
@media (max-width: 1000px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 280px; transform: translateX(-102%); transition: transform .22s ease; }
  .side.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 50; }
  .menu-btn { display: inline-grid; }
  .top { padding: 10px 16px; }
  .content { padding: 20px 16px 32px; }
  .split { grid-template-columns: 1fr; }
  .uname { display: none; }
  .hero-in, .cols-2 { grid-template-columns: 1fr; gap: 36px; }
  .hero-in { padding: 48px 24px 56px; }
  body.auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .s-foot-in { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 760px) {
  .s-menu-btn { display: inline-grid; margin-left: auto; }
  .s-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; margin: 0; }
  .s-nav.open { display: flex; }
  .s-head-in { gap: 8px; }
  .s-actions .btn { display: none; }
  .row-item { grid-template-columns: 1fr; gap: 4px; }
  .att-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
  .invoice-doc { padding: 22px 18px; }
  .band { padding: 48px 0; }
  .stat { border-left: 0; border-top: 1px solid var(--line); }
  .stat:first-child { border-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------- print -- */
@media print {
  .side, .top, .foot, .no-print, .flashes, .s-head, .s-foot, .toolbar, .tabs, .skip { display: none !important; }
  body, .shell { background: #fff !important; color: #000 !important; display: block; }
  .content { padding: 0; max-width: none; }
  .invoice-doc, .panel, .tbl-wrap { border: 0 !important; box-shadow: none; padding: 0; background: #fff; color: #000; }
  :root { --ink: #000; --muted: #444; --line: #bbb; --line-2: #888; --surface: #fff; --bg: #fff; }
  a { color: inherit; text-decoration: none; }
  .badge { border: 1px solid #888; background: none; color: #000; }
  .page-break { page-break-after: always; }
}

/* ---- additions: modules written late ------------------------------------ */
.tabs > a { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: .92rem; }
.tabs > a:hover { color: var(--ink); }
.tabs > a.on { color: var(--brand); border-bottom-color: var(--accent); }
.tabs .count { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 1px 8px; font-size: .75rem; margin-left: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card-link { text-decoration: none; color: inherit; display: block; transition: transform .15s ease, border-color .15s ease; }
.card-link:hover { transform: translateY(-2px); border-color: var(--brand); }
.card-link h2 { margin: 0 0 6px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-top: 16px; }
.gallery-grid .album, .gallery-grid figure.album { margin: 0; text-decoration: none; color: inherit; display: block; }
.gallery-grid .album > span { display: block; padding-top: 8px; }
.gallery-grid .album small { display: block; color: var(--muted); }
.gallery-grid figcaption { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 8px; font-size: .88rem; }
.notice.urgent { border-left: 4px solid var(--bad); }
.notice p { margin: 0 0 10px; }
tr.unread td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.q-item { margin-bottom: 14px; border: 0; padding: 16px 18px; }
.q-item legend { padding: 0 6px; }
.q-item ol { margin: 8px 0; padding-left: 22px; }
.q-item li.correct { color: var(--good); font-weight: 600; }
.q-item li.wrong { color: var(--bad); }
fieldset.q-item { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
fieldset.q-item .check { display: flex; gap: 10px; padding: 6px 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font: 700 .78rem var(--font); margin: 0 0 14px; }
.check-list { list-style: none; padding: 0; margin: 14px 0 20px; display: grid; gap: 4px; }
.social a { margin-right: 6px; }
.pick, .line { }
.s-foot .social { margin-top: 10px; }

.top-search input[type=search] { padding-left: 38px !important; }
.top-search { position: relative; }
.top-search > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; pointer-events: none; z-index: 1; }
