/* HSH Fleet dashboard. Phone-first: the base layout is built for 360px and
   widens at 560px and 900px. Light and dark both come from the same tokens. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --line: #d7dde7;
  --ink: #15202b;
  --ink-2: #51606f;
  --ink-3: #5d6b7c;          /* was #78879a — failed AA at small sizes */
  --brand: #0d1b2a;
  --brand-ink: #ffffff;
  --accent: #175cd3;         /* was #1f6feb — margin on white button text */
  --accent-ink: #ffffff;     /* NEW: text colour on accent buttons */

  --red: #b3261e;
  --red-bg: #fdecea;
  --red-line: #f3c2bd;
  --amber: #8a5300;          /* unchanged: 5.76:1 on amber-bg — passes */
  --amber-bg: #fdf3e2;
  --amber-line: #efd9ac;
  --green: #156b3f;
  --green-bg: #e8f5ee;
  --green-line: #b7ddc7;

  /* type scale (never go below --fs-0 anywhere) */
  --fs-0: 11px;              /* micro caps labels, badges, table headers */
  --fs-1: 13px;              /* secondary rows, reasons, meta */
  --fs-2: 14px;              /* controls, kv pairs */
  --fs-3: 16px;              /* body */
  --fs-4: 17px;              /* card titles */
  --fs-5: 22px;              /* page h1 */
  --fs-6: 26px;              /* summary-chip numbers */

  /* spacing scale: use these, not ad-hoc values */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b;
    --surface: #161e27;
    --surface-2: #1d2731;
    --line: #2b3744;
    --ink: #e8eef5;
    --ink-2: #a7b4c2;
    --ink-3: #919fae;        /* was #7e8c9b — failed AA on surface-2 */
    --brand: #060b11;
    --brand-ink: #e8eef5;
    --accent: #5aa0ff;
    --accent-ink: #0b1420;   /* NEW: dark ink on light-blue buttons (was #fff = 2.66:1 FAIL) */

    --red: #ff9c91;
    --red-bg: #2e1715;
    --red-line: #5c2a24;
    --amber: #f0c070;        /* unchanged: 9.50:1 on amber-bg — passes */
    --amber-bg: #2a2012;
    --amber-line: #53401d;
    --green: #7fd4a1;
    --green-bg: #11291d;
    --green-line: #255138;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
  }
}

/* Forced themes, so the screenshot run can capture both without touching the OS. */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --line: #d7dde7;
  --ink: #15202b;
  --ink-2: #51606f;
  --ink-3: #5d6b7c;          /* was #78879a — failed AA at small sizes */
  --brand: #0d1b2a;
  --brand-ink: #ffffff;
  --accent: #175cd3;         /* was #1f6feb — margin on white button text */
  --accent-ink: #ffffff;     /* NEW: text colour on accent buttons */

  --red: #b3261e;
  --red-bg: #fdecea;
  --red-line: #f3c2bd;
  --amber: #8a5300;          /* unchanged: 5.76:1 on amber-bg — passes */
  --amber-bg: #fdf3e2;
  --amber-line: #efd9ac;
  --green: #156b3f;
  --green-bg: #e8f5ee;
  --green-line: #b7ddc7;

  /* type scale (never go below --fs-0 anywhere) */
  --fs-0: 11px;              /* micro caps labels, badges, table headers */
  --fs-1: 13px;              /* secondary rows, reasons, meta */
  --fs-2: 14px;              /* controls, kv pairs */
  --fs-3: 16px;              /* body */
  --fs-4: 17px;              /* card titles */
  --fs-5: 22px;              /* page h1 */
  --fs-6: 26px;              /* summary-chip numbers */

  /* spacing scale: use these, not ad-hoc values */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .05);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
html[data-theme="dark"] {
  color-scheme: dark;
    --bg: #0e141b;
    --surface: #161e27;
    --surface-2: #1d2731;
    --line: #2b3744;
    --ink: #e8eef5;
    --ink-2: #a7b4c2;
    --ink-3: #919fae;        /* was #7e8c9b — failed AA on surface-2 */
    --brand: #060b11;
    --brand-ink: #e8eef5;
    --accent: #5aa0ff;
    --accent-ink: #0b1420;   /* NEW: dark ink on light-blue buttons (was #fff = 2.66:1 FAIL) */

    --red: #ff9c91;
    --red-bg: #2e1715;
    --red-line: #5c2a24;
    --amber: #f0c070;        /* unchanged: 9.50:1 on amber-bg — passes */
    --amber-bg: #2a2012;
    --amber-line: #53401d;
    --green: #7fd4a1;
    --green-bg: #11291d;
    --green-line: #255138;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-3)/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
a { color: var(--accent); }

.skip {
  position: absolute; left: -9999px;
}
.skip:focus {
  left: 8px; top: 8px; z-index: 50; background: var(--surface);
  padding: 8px 12px; border-radius: 8px;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
  background: var(--brand);
  color: var(--brand-ink);
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
}
.topbar-in {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark {
  font: 700 12px/1 var(--sans); letter-spacing: .09em;
  border: 1.5px solid currentColor; border-radius: 6px;
  padding: 6px 7px; opacity: .92; flex: none;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.brand-text small { font-size: 12px; opacity: .68; }

.topnav { display: flex; gap: 2px; flex: none; }
.topnav a {
  color: inherit; text-decoration: none; font-size: 13.5px; font-weight: 550;
  padding: 12px 12px; border-radius: 8px; opacity: .72; white-space: nowrap;
  min-height: 44px; display: inline-flex; align-items: center;
}
.topnav a[aria-current="page"] { background: rgba(255, 255, 255, .14); opacity: 1; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 14px 14px 36px; }
.loading { color: var(--ink-2); padding: 28px 2px; }

.foot {
  max-width: 1100px; margin: 0 auto; padding: 0 14px 30px;
  color: var(--ink-3); font-size: 12px;
}
.foot p { margin: 2px 0; }
.foot-note { color: var(--amber); }

/* ------------------------------------------------------------- page header */

.page-head { margin: 4px 0 14px; }
.page-head h1 { font-size: var(--fs-5); font-weight: 650; }
.page-head .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }
.back {
  display: inline-block; font-size: 13px; text-decoration: none;
  color: var(--ink-2); margin-bottom: 8px;
}

/* --------------------------------------------------------------- summary */

.summary { display: flex; gap: 8px; margin-bottom: 16px; }
.summary .chip { flex: 1 1 0; min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow); }
.summary .chip b { display: block; font-size: var(--fs-6); font-weight: 650; line-height: 1.1; }
.summary .chip span { font-size: var(--fs-0); color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .05em; }
.summary .chip.is-red b { color: var(--red); }
.summary .chip.is-amber b { color: var(--amber); }
.summary .chip.is-green b { color: var(--green); }

/* ------------------------------------------------------------- bus cards */

.band-title {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin: 20px 0 9px;
}
.band-title h2 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.band-title .note { font-size: 12px; color: var(--ink-3); }

.buses { display: grid; gap: 12px; }
@media (min-width: 760px) { .buses { grid-template-columns: repeat(3, 1fr); } }

.bus {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.bus.is-red { border-left-color: var(--red); }
.bus.is-amber { border-left-color: var(--amber); }
.bus.is-green { border-left-color: var(--green); }

.bus-top { display: flex; align-items: center; gap: 9px; }
.bus-no { font-size: var(--fs-4); font-weight: 650; letter-spacing: -.01em; }
.bus-reg {
  font: 600 12px/1 var(--mono); letter-spacing: .06em;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 5px 6px; color: var(--ink-2);
}
.bus-light { margin-left: auto; }

.light {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 10px 5px 8px;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.light::before { content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: currentColor; flex: none; }
.light.is-red { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.light.is-amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.light.is-green { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }

.bus-meta { color: var(--ink-2); font-size: 12.5px; margin-top: 6px; }

.reasons { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.reasons li {
  font-size: var(--fs-1); line-height: 1.45;
  padding: 8px 10px 8px 28px;
  border-radius: 7px; border: 1px solid transparent; position: relative;
}
.reasons li.is-red { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.reasons li.is-amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.reasons .ok { color: var(--green); background: var(--green-bg); border-color: var(--green-line);  padding-left: 28px; }

.dates { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 10px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
@media (min-width: 420px) and (max-width: 759.98px) { .dates { grid-template-columns: repeat(4, 1fr); } }
.dates div { background: var(--surface); padding: 7px 8px; }
.dates dt { font-size: var(--fs-0); text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); }
.dates dd { margin: 2px 0 0; font: 600 13px/1.25 var(--mono); }
.dates dd.none { color: var(--amber); font-family: var(--sans);
  font-weight: 600; font-style: normal; }
.dates dd.warn { color: var(--amber); }
.dates dd.bad { color: var(--red); }

/* ----------------------------------------------------------------- tiles */

.tiles { display: grid; gap: 12px; }
@media (min-width: 900px) { .tiles { grid-template-columns: 1fr 1fr; grid-auto-flow: dense; } .tile.span { grid-column: 1 / -1; } }

.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.tile > header {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 13px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.tile > header h2 { font-size: 13.5px; font-weight: 650; }
.tile > header .light { margin-left: auto; }
.tile > header .count { margin-left: auto; font-size: 12px; color: var(--ink-2); }
.tile .body { padding: 11px 13px; }
.tile .body.flush { padding: 0; }
.empty { color: var(--ink-3); font-size: 13px; font-style: italic; }

.licence-state { font-size: 14px; font-weight: 600; }
.licence-state + p { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }

/* rows */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.rows a, .rows .row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  text-decoration: none; color: inherit;
}
.rows .main { min-width: 0; flex: 1; }
.rows .main b { display: block; font-size: 13.5px; font-weight: 600; }
.rows .main span { display: block; font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.rows .right { text-align: right; flex: none; }
.rows .right b { display: block; font: 600 12.5px/1.3 var(--mono); }
.rows .right span { font-size: var(--fs-0); color: var(--ink-3); }

.badge {
  font-size: var(--fs-0); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.badge.b-overdue { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.badge.b-7 { color: var(--red); background: var(--red-bg); border-color: var(--red-line); }
.badge.b-30 { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.badge.b-60 { color: var(--ink-2); background: var(--surface-2); border-color: var(--line); }
.badge.b-90 { color: var(--ink-3); background: var(--surface-2); border-color: var(--line); }
.badge.noproof { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }

/* repair tracker */
.track { display: flex; gap: 4px; margin: 2px 0 10px; flex-wrap: wrap; }
.track span {
  font-size: var(--fs-0); font-weight: 600;
  padding: 5px 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-3);
}
.track span.done { background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
.track span.at {
  background: var(--amber-bg); border-color: var(--amber); color: var(--amber);
  font-weight: 700;
}

.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 550; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); }
@media (min-width: 560px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpis div { background: var(--surface); padding: 10px 12px; }
.kpis b { display: block; font-size: 19px; font-weight: 650; }
.kpis b.pending { color: var(--ink-3); font-size: 14px; font-weight: 500; font-style: italic; }
.kpis span { font-size: var(--fs-0); color: var(--ink-2); }
.kpis::after { content: ""; background: var(--surface); }

/* digest */
pre.digest {
  margin: 0; padding: 12px 13px; background: var(--surface-2);
  font: 400 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word;
  color: var(--ink-2); max-height: 320px; overflow: auto;
}

/* ----------------------------------------------------------------- tables */

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: var(--fs-0); text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3); font-weight: 650; }
td.num, th.num { text-align: right; font-family: var(--mono); }
tr:last-child td { border-bottom: 0; }
td .none { color: var(--ink-3); font-style: italic; }

/* ------------------------------------------------------------------ forms */

form.admin { display: grid; gap: 10px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; margin: 0; }
legend { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); padding: 0 5px; }
label { display: block; font-size: var(--fs-1); color: var(--ink-2); margin-bottom: 10px; }
label span { display: block; margin-bottom: 3px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: var(--fs-2); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.grid2 { display: grid; gap: 0 12px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }

button {
  font: inherit; font-size: var(--fs-2); font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 0;
  border-radius: 9px; padding: 11px 16px; min-height: 44px;
}
button.ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.form-msg { font-size: 13px; margin: 0; }
.form-msg.ok { color: var(--green); }
.form-msg.bad { color: var(--red); }
.hint { font-size: 12px; color: var(--ink-3); margin: 2px 0 0; }

.warnbox {
  background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
.warnbox b { font-weight: 700; }

/* Presentation details and narrow-screen containment. */
.bus:active { filter: brightness(.97); }
.reasons li::before {
  position: absolute; left: 10px; top: 8px;
  font: 700 12px/1.45 var(--mono);
}
.reasons li.is-red::before { content: "!"; }
.reasons li.is-amber::before { content: "?"; }
.reasons .ok::before { content: "\2713"; position: absolute; left: 10px; top: 8px;
  font: 700 12px/1.45 var(--mono); }
.dates dd .nodoc {
  display: inline-block; margin-left: 4px;
  font: 600 var(--fs-0)/1 var(--sans); letter-spacing: .03em; text-transform: uppercase;
  color: var(--amber); vertical-align: 1px;
}
.rows > li.is-overdue { box-shadow: inset 3px 0 0 var(--red); }
.track span.done::before { content: "\2713\00a0"; }
.track-sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.repair-head { margin: 0 0 6px; font-size: var(--fs-1); }
.today-tiles { margin-top: var(--sp-5); }
.buses > *, .tiles > *, .dates > *, .kpis > *, .grid2 > * { min-width: 0; }
.bus, .tile { overflow-wrap: anywhere; }
.bus-top, .topbar-in { flex-wrap: wrap; }
.kv { grid-template-columns: auto minmax(0, 1fr); }
fieldset { min-width: 0; }
.brand, .back, .warnbox a, .page-head + p > a { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
.skip:focus { min-height: 44px; min-width: 44px; }
.print-actions .back { align-self: center; }
.kv .none { color: var(--ink-3); font-style: italic; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
.warnbox .hint { color: inherit; }

/* --------------------------------------------------- the printable register */

.seat-sheet { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: var(--sp-4); box-shadow: var(--shadow); overflow-y: auto; }
.seat-sheet::backdrop { background: #0009; }
.seat-sheet-head { display: flex; gap: var(--sp-2); align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.seat-sheet-head h2 { font-size: var(--fs-4); margin: 0; }
.seat-sheet-head button { min-width: 44px; flex: none; }
.seat-sheet-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-4) 0; }
.seat-form fieldset { margin-top: var(--sp-4); }
.seat-form .form-msg, .layout-form .form-msg { margin: var(--sp-3) 0; }
.layout-rows { margin-top: var(--sp-3); }
.layout-row { display: grid; grid-template-columns: repeat(var(--layout-cols, 4), minmax(0, 1fr)); gap: 4px; }
.layout-row label { min-width: 0; font-size: var(--fs-0); }
.layout-row input { padding: 8px 2px; font-size: var(--fs-0); text-align: center; }

/* HSH Fleet — seat map component (design mock, 22 Nov 2026).
   Everything is scoped under .sm / #sm-print and uses ONLY the dashboard tokens
   from app.css (--surface, --ink, --accent, --fs-*, --sp-* ...). No new colours:
   the three derived values below are mixes of existing tokens.
   Lift this whole file into app.css in place of the old ".seat-*" block. */

.sm {
  --sm-line: var(--ink-3);                                   /* van outline */
  --sm-body: var(--surface-2);                               /* van body + cabin floor */
  --sm-glass: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
  --sm-tyre: var(--ink-2);
  --sm-seat-h: 54px;
  --sm-gap: 6px;
  --sm-row-gap: 12px;
  --sm-pad: 12px;                                            /* cabin inner padding */
  --sm-ease: cubic-bezier(.2, .8, .2, 1);
}
.sm *, #sm-print * { box-sizing: border-box; }
.sm-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Seats view is the one screen that wants more than 1100px: two vans + two lists. */
.wrap.sm-wide { max-width: 1240px; }

/* ---------------------------------------------------------------- toolbar */

.sm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }

.sm-trip { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.sm-trip button {
  display: inline-flex; align-items: baseline; gap: 6px; min-height: 44px; min-width: 64px; padding: 8px 14px;
  background: transparent; color: var(--ink-2); border: 1px solid transparent; border-radius: 9px;
  font-size: var(--fs-2); font-weight: 600;
  transition: background-color .18s, color .18s, box-shadow .18s;
}
.sm-trip button small { font-size: var(--fs-0); font-weight: 500; color: var(--ink-3); }
.sm-trip button[aria-pressed="true"] { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); font-weight: 700; }
.sm-trip button[aria-pressed="true"]::before { content: "\2713"; font: 700 12px/1 var(--mono); }
.sm-trip button[aria-pressed="true"] small { color: var(--ink-2); }

.sm-search { flex: 1 1 200px; max-width: 340px; margin: 0; position: relative; }
.sm-search input { padding-left: 34px; border-radius: 10px; }
.sm-search::before {                                        /* magnifier drawn in CSS: no icon set */
  content: ""; position: absolute; left: 13px; top: 50%; width: 11px; height: 11px; margin-top: -8px;
  border: 2px solid var(--ink-3); border-radius: 50%; pointer-events: none;
}
.sm-search::after { content: ""; position: absolute; left: 23px; top: 50%; width: 6px; height: 2px; margin-top: 4px;
  background: var(--ink-3); transform: rotate(45deg); transform-origin: left center; border-radius: 1px; pointer-events: none; }
.sm-bar .sm-print-btn { margin-left: auto; }

.sm-testnote { font-size: var(--fs-1); color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-line);
  border-radius: var(--radius-sm); padding: 8px 12px; margin: 0 0 var(--sp-3); }
.sm-testnote b { font-weight: 700; }

/* ----------------------------------------------------------------- legend */

.sm-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 var(--sp-4); padding: 0;
  font-size: var(--fs-1); color: var(--ink-2); }
.sm-legend li { display: inline-flex; align-items: center; gap: 8px; }
.sm-key {
  position: relative; flex: none; width: 26px; height: 24px; display: inline-grid; place-items: center;
  border: 1.5px solid var(--ink-3); border-radius: 7px 7px 6px 6px; background: var(--surface);
  font: 700 var(--fs-0)/1 var(--sans); color: var(--ink-2); padding-bottom: 4px;
}
.sm-key::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: 2px; height: 3px; border-radius: 2px; background: currentColor; opacity: .3; }
.sm-key.k-taken { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sm-key.k-selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); margin: 0 3px; }
.sm-key.k-blocked { border-style: dashed; color: var(--ink-3);
  background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--ink-3) 30%, transparent) 4px 5.5px), var(--surface-2); }
.sm-key.k-driver { background: color-mix(in srgb, var(--ink-3) 22%, var(--surface)); color: var(--ink); }

/* ------------------------------------------------------- bus tabs (phone) */

.sm-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: var(--sp-3); }
.sm-tabs button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; min-height: 52px; padding: 8px 10px;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 11px;
  text-align: left; transition: border-color .18s, background-color .18s, color .18s;
}
.sm-tabs button b { font-size: var(--fs-2); font-weight: 650; color: var(--ink); }
.sm-tabs button span { font-size: var(--fs-0); white-space: nowrap; }
.sm-tabs button[aria-selected="true"] { border-color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.sm-tabs button[aria-selected="true"] b::after { content: " \2713"; font: 700 12px/1 var(--mono); }
.sm-tabs button.is-off b { color: var(--ink-2); }

/* ------------------------------------------------------------------ cards */

.sm-buses { display: grid; gap: var(--sp-4); align-items: start; }
.sm-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--sp-3) var(--sp-3) var(--sp-4); }
.sm-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 2px 2px var(--sp-3); border-bottom: 1px solid var(--line); }
.sm-card-head h2 { font-size: var(--fs-4); font-weight: 650; }
.sm-plate { font: 600 12px/1 var(--mono); letter-spacing: .06em; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 5px 6px; color: var(--ink-2); white-space: nowrap; }
.sm-offroad { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 10px 5px 8px; border-radius: 999px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--ink-3); white-space: nowrap; }
.sm-offroad::before { content: "\00d7"; font: 700 13px/1 var(--mono); }
.sm-count { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 2px 0 0; font-size: var(--fs-2); color: var(--ink-2); }
.sm-count b { font-size: var(--fs-5); font-weight: 650; color: var(--ink); line-height: 1; margin-right: 2px; font-variant-numeric: tabular-nums; }
.sm-count .sm-free-n { color: var(--ink-3); }
.sm-meter { display: inline-flex; gap: 3px; margin-left: auto; }
.sm-meter i { width: 7px; height: 14px; border-radius: 2px; border: 1.5px solid var(--ink-3); background: transparent; transition: background-color .25s, border-color .25s; }
.sm-meter i.on { background: var(--accent); border-color: var(--accent); }

.sm-card-body { display: grid; gap: var(--sp-4); padding-top: var(--sp-4); }
.sm-side { min-width: 0; }

/* -------------------------------------------------------------- the van */

.sm-van-wrap { min-width: 0; }
.sm-cap { display: block; text-align: center; font-size: var(--fs-0); font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.sm-cap.top { margin-bottom: 4px; }
.sm-cap.bottom { margin-top: 5px; }
.sm-van { position: relative; width: 100%; max-width: 296px; margin: 0 auto; }
.sm-van svg { display: block; width: 100%; height: auto; overflow: visible; }
.sm-van .v-body { fill: var(--sm-body); stroke: var(--sm-line); stroke-width: 2; stroke-linejoin: round; }
.sm-van .v-line { fill: none; stroke: var(--sm-line); stroke-width: 1.25; stroke-linecap: round; opacity: .55; }
.sm-van .v-strong { fill: none; stroke: var(--sm-line); stroke-width: 3; stroke-linecap: round; }
.sm-van .v-glass { fill: var(--sm-glass); stroke: var(--sm-line); stroke-width: 1.5; stroke-linejoin: round; }
.sm-van .v-solid { fill: var(--sm-line); }
.sm-van .v-lamp { fill: var(--amber); opacity: .85; }
.sm-van .v-tail { fill: var(--red); opacity: .8; }
.sm-nose { margin-bottom: -1px; }
.sm-tail { margin-top: -1px; }

.sm-cabin {
  position: relative; margin: 0 5.405%;                      /* 16 / 296: lines up with the SVG body edges at any size */
  padding: 10px var(--sm-pad) 12px;
  background: var(--sm-body); border-left: 2px solid var(--sm-line); border-right: 2px solid var(--sm-line);
}
.sm-wheel { position: absolute; width: 7px; height: 46px; background: var(--sm-tyre); }
.sm-wheel.fl, .sm-wheel.rl { left: -9px; border-radius: 4px 0 0 4px; }
.sm-wheel.fr, .sm-wheel.rr { right: -9px; border-radius: 0 4px 4px 0; }
.sm-wheel.fl, .sm-wheel.fr { top: -22px; }
.sm-wheel.rl, .sm-wheel.rr { bottom: 58px; }

.sm-grid { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: var(--sm-row-gap) var(--sm-gap); }

/* seats: forward-facing, seen from above — cushion, backrest band and headrest at the rear (bottom) edge */
.sm-seat {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-width: 0; min-height: 0; height: var(--sm-seat-h); padding: 0 2px 9px; margin: 0;
  background: var(--surface); color: var(--ink-2);
  border: 1.5px solid var(--ink-3); border-radius: 12px 12px 9px 9px;
  font: 600 var(--fs-1)/1.1 var(--sans); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .16s var(--sm-ease), box-shadow .16s, background-color .2s, border-color .2s, color .2s, opacity .2s;
}
.sm-seat::after {                                           /* backrest */
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 3px; height: 6px;
  border-radius: 3px 3px 5px 5px; background: currentColor; opacity: .26;
}
.sm-seat::before {                                          /* headrest */
  content: ""; position: absolute; left: 30%; right: 30%; bottom: -5px; height: 7px;
  border-radius: 3px 3px 5px 5px; background: inherit; border: 1.5px solid; border-color: inherit; z-index: 1;
}
.sm-seat-code { font: 600 var(--fs-0)/1 var(--mono); letter-spacing: .02em; }
.sm-seat-who { font-size: 15px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.sm-seat.is-empty .sm-seat-code { font-size: 12.5px; }
.sm-seat.is-empty .sm-seat-who { display: none; }

.sm-seat.is-taken { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sm-seat.is-taken .sm-seat-code { opacity: .85; }
.sm-seat-flag {                                             /* "has a note": a quiet dot in the corner; the note itself is in the tooltip + list */
  position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.sm-seat-swap {                                             /* move mode: this seat is taken, tapping it swaps */
  position: absolute; top: -6px; right: -5px; min-width: 18px; height: 18px; padding: 0 2px; border-radius: 9px;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--ink);
  font: 700 12px/15px var(--sans); text-align: center; z-index: 2;
}

.sm-seat.is-blocked, .sm-van.is-off .sm-seat {
  cursor: not-allowed; border-style: dashed; color: var(--ink-3);
  background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--ink-3) 26%, transparent) 6px 7.5px), var(--surface-2);
}
.sm-seat.is-blocked::before, .sm-van.is-off .sm-seat::before { background: var(--surface-2); }

@media (hover: hover) {
  .sm-van:not(.is-off) .sm-seat:not(.is-blocked):hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(16, 24, 40, .18); }
}
.sm-seat:active { transform: translateY(0) scale(.97); }
.sm-seat:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; z-index: 3; }

/* selected = double ring + lift + a tick; never colour alone */
.sm-seat.is-selected { transform: translateY(-2px); box-shadow: 0 0 0 2.5px var(--sm-body), 0 0 0 5.5px var(--ink), 0 6px 14px rgba(16, 24, 40, .22); z-index: 2; }
.sm-seat.is-selected .sm-seat-flag { display: none; }
.sm-seat.is-selected > .sm-seat-code::before { content: "\2713\00a0"; font-weight: 700; }

/* search */
.sm-seat.is-dim { opacity: .38; }
.sm-seat.is-match { box-shadow: 0 0 0 2.5px var(--sm-body), 0 0 0 5px var(--ink); }

/* move mode */
.sm-van.is-moving .sm-seat.is-source { border-style: dashed; background: var(--surface); color: var(--ink-2); border-color: var(--ink-2); }
.sm-van.is-moving .sm-seat.is-source .sm-seat-who { opacity: .6; }
.sm-van.is-moving .sm-seat.is-target { border: 2px dashed var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.sm-van.is-moving .sm-seat.is-target .sm-seat-who { display: block; font-size: var(--fs-0); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.sm-van.is-moving .sm-seat-flag { display: none; }
.sm-van.is-moving .sm-seat.is-swap-pick { box-shadow: 0 0 0 2.5px var(--sm-body), 0 0 0 5.5px var(--ink); }
.sm-van.is-waiting .sm-seat { opacity: .45; }

/* a calm confirmation after a save / move: one soft settle, no flash */
@keyframes sm-settle { from { transform: scale(.9); opacity: .5; } to { transform: none; opacity: 1; } }
.sm-seat.is-just { animation: sm-settle .32s var(--sm-ease); }

/* tooltip: name + note on hover and on keyboard focus */
.sm-tip {
  position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translate(-50%, 4px);
  max-width: 220px; width: max-content; padding: 6px 9px; border-radius: 8px;
  background: var(--ink); color: var(--surface); font: 600 12px/1.35 var(--sans); text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 6;
  transition: opacity .14s, transform .14s var(--sm-ease), visibility 0s .14s;
}
.sm-tip small { display: block; font-weight: 400; font-size: var(--fs-0); opacity: .85; }
.sm-seat.tip-l .sm-tip { left: 0; transform: translate(0, 4px); }
.sm-seat.tip-r .sm-tip { left: auto; right: 0; transform: translate(0, 4px); }
.sm-seat:focus-visible .sm-tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
.sm-seat.tip-l:focus-visible .sm-tip, .sm-seat.tip-r:focus-visible .sm-tip { transform: none; }
@media (hover: hover) {
  .sm-seat:hover .sm-tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: .25s; }
  .sm-seat.tip-l:hover .sm-tip, .sm-seat.tip-r:hover .sm-tip { transform: none; }
}

/* driver, door, aisle */
.sm-driver {
  position: relative; height: var(--sm-seat-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding-bottom: 8px; border: 1.5px solid var(--ink-3); border-radius: 12px 12px 9px 9px;
  background: color-mix(in srgb, var(--ink-3) 22%, var(--surface)); color: var(--ink);
  font: 650 var(--fs-0)/1 var(--sans); letter-spacing: .03em;
}
.sm-driver::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 3px; height: 6px; border-radius: 3px 3px 5px 5px; background: currentColor; opacity: .3; }
.sm-driver::before { content: ""; position: absolute; left: 30%; right: 30%; bottom: -5px; height: 7px; border-radius: 3px 3px 5px 5px; background: inherit; border: 1.5px solid var(--ink-3); }
.sm-driver svg { width: 20px; height: 20px; }
.sm-driver svg * { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.sm-door { position: relative; height: var(--sm-seat-h); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  padding-left: 2px; font: 650 var(--fs-0)/1.15 var(--sans); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); }
.sm-door b { font: 700 15px/1 var(--mono); color: var(--accent); letter-spacing: -.12em; }
.sm-door::before {                                          /* cut the opening in the body wall ... */
  content: ""; position: absolute; left: calc(-1 * var(--sm-pad) - 3px); width: 4px; top: -3px; bottom: -3px; background: var(--surface);
}
.sm-door::after {                                           /* ... and mark the step */
  content: ""; position: absolute; left: calc(-1 * var(--sm-pad) - 4.5px); width: 5px; top: 0; bottom: 0;
  border-radius: 3px; background: var(--accent);
}
.sm-aisle { position: relative; }
.sm-aisle::before { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 2px dotted var(--sm-line); opacity: .35; }
.sm-van.is-off .sm-door b, .sm-van.is-off .sm-door { color: var(--ink-3); }
.sm-van.is-off .sm-door::after { background: var(--ink-3); }
.sm-van.is-off .v-lamp, .sm-van.is-off .v-tail { fill: var(--ink-3); opacity: .5; }
.sm-van.is-off .v-glass { fill: var(--surface-2); }

/* ------------------------------------------------------- passenger list */

.sm-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 2px 6px; }
.sm-list-head h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.sm-list-head span { font-size: 12px; color: var(--ink-3); }
.sm-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.sm-list li + li { border-top: 1px solid var(--line); }
.sm-prow {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 6px 10px; margin: 0;
  background: var(--surface); color: var(--ink); border: 0; border-radius: 0; text-align: left; font-weight: 400;
  transition: background-color .15s;
}
.sm-prow:hover { background: var(--surface-2); }
.sm-prow:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.sm-prow[aria-current="true"] { background: var(--surface-2); box-shadow: inset 4px 0 0 var(--ink); }
.sm-pcode { flex: none; width: 34px; padding: 6px 0; text-align: center; font: 700 12px/1 var(--mono); border-radius: 7px 7px 5px 5px;
  background: var(--accent); color: var(--accent-ink); }
.sm-pmain { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.sm-pmain b { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.sm-pmain span { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.sm-pmain mark { background: var(--amber-bg); color: var(--amber); border-radius: 3px; padding: 0 1px; text-decoration: underline; }
.sm-freeline { margin: 8px 2px 0; font-size: 12px; color: var(--ink-3); }
.sm-freeline b { font-family: var(--mono); font-weight: 600; color: var(--ink-2); }
.sm-none { margin: 0; padding: 14px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); font-size: var(--fs-1); color: var(--ink-3); font-style: italic; }
.sm-offnote { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--fs-1); color: var(--ink-2); }
.sm-offnote b { display: block; color: var(--ink); font-size: var(--fs-2); margin-bottom: 2px; }

/* ------------------------------------------- editor: bottom sheet / side panel */

.sm-scrim { position: fixed; inset: 0; z-index: 38; background: rgba(8, 12, 18, .32); opacity: 0; visibility: hidden; transition: opacity .22s, visibility 0s .22s; }
.sm-scrim.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }

.sm-editor {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 520px;
  max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(8, 12, 18, .28);
  padding: 8px var(--sp-4) max(16px, env(safe-area-inset-bottom));
  transform: translateY(104%); visibility: hidden;
  transition: transform .26s var(--sm-ease), visibility 0s .26s;
}
.sm-editor.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.sm-editor:focus { outline: none; }
.sm-ed-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 8px; }
.sm-ed-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: var(--sp-3); }
.sm-ed-kicker { margin: 0 0 2px; font-size: var(--fs-0); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.sm-ed-head h3 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-5); font-weight: 650; }
.sm-ed-state { font-size: var(--fs-0); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }
.sm-ed-state.taken { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sm-ed-close { flex: none; width: 44px; padding: 0; font-size: 20px; line-height: 1; }
.sm-editor label { margin-bottom: 10px; }
.sm-editor label i { font-style: normal; color: var(--ink-3); }
.sm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; }
.sm-chips button {
  min-height: 36px; padding: 6px 11px; border-radius: 999px; font-size: var(--fs-1); font-weight: 550;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); position: relative;
  transition: background-color .15s, border-color .15s, color .15s;
}
.sm-chips button::after { content: ""; position: absolute; inset: -4px 0; }   /* 44px tap height without 44px of chrome */
.sm-chips button[aria-pressed="true"] { background: var(--surface-2); border-color: var(--ink); color: var(--ink); font-weight: 650; }
.sm-chips button[aria-pressed="true"]::before { content: "\2713\00a0"; font: 700 12px/1 var(--mono); }
.sm-editor .form-msg { min-height: 0; margin: 0 0 8px; }
.sm-ed-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sm-ed-actions button { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.sm-ed-actions [type="submit"] { grid-column: 1 / -1; }
.sm-ed-actions .sm-danger { color: var(--red); border-color: var(--red-line); background: var(--red-bg); }
.sm-ed-hint { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); }

/* ------------------------------------------ dock: move bar + undo toast */

.sm-dock { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; pointer-events: none;
  padding: 0 12px max(12px, env(safe-area-inset-bottom)); }
.sm-dock > div {
  pointer-events: auto; width: 100%; max-width: 560px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  background: var(--ink); color: var(--surface); border-radius: 14px; padding: 10px 10px 10px 14px;
  box-shadow: 0 8px 28px rgba(8, 12, 18, .35); font-size: var(--fs-1); line-height: 1.4;
  animation: sm-rise .24s var(--sm-ease);
}
@keyframes sm-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.sm-dock p { margin: 0; flex: 1 1 180px; min-width: 0; }
.sm-dock p b { font-weight: 700; }
.sm-dock .sm-dock-actions { display: flex; gap: 6px; margin-left: auto; }
.sm-dock button { background: var(--surface); color: var(--ink); border: 0; padding: 8px 14px; white-space: nowrap; }
.sm-dock button.quiet { background: transparent; color: var(--surface); border: 1px solid color-mix(in srgb, var(--surface) 45%, transparent); }
.sm-dock button:focus-visible { outline: 3px solid var(--surface); outline-offset: 2px; }

#sm-print { display: none; }

/* ------------------------------------------------------------ breakpoints */

@media (max-width: 759.98px) {
  .sm-card { display: none; }
  .sm-card.is-tab { display: block; }
  .sm-trip button { min-width: 0; padding: 8px 10px; gap: 5px; }
  .sm-bar .sm-print-btn { margin-left: auto; padding: 11px 12px; }
  .sm-search { flex-basis: 100%; max-width: none; order: 3; }
}
@media (min-width: 760px) {
  .sm-tabs { display: none; }
  .sm-buses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm-card { padding: var(--sp-4); }
}
@media (min-width: 1100px) {
  .sm-card-body { grid-template-columns: 296px minmax(0, 1fr); }
  .sm-scrim { display: none; }
  /* the editor becomes a panel inside the card, beside its own map: no overlay, the seat stays in view */
  .sm-editor {
    position: static; display: none; width: auto; max-width: none; max-height: none; overflow: visible; margin: 0 0 var(--sp-4);
    border: 1px solid var(--ink-3); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: var(--sp-3);
    transform: none; visibility: visible; transition: none;
  }
  .sm-editor.is-open { display: block; animation: sm-rise .2s var(--sm-ease); }
  .sm-ed-grab { display: none; }
  .sm-ed-head h3 { font-size: var(--fs-4); }
}

@media (prefers-reduced-motion: reduce) {
  .sm *, .sm *::before, .sm *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation: none !important; }
  .sm-seat:hover, .sm-seat.is-selected, .sm-seat:active { transform: none !important; }
}

/* ------------------------------------------------------------------ print */
/* A4 portrait, one bus per page: names in the seats + a tick-off list. Black on white, photocopy-safe. */

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.sm-has-print { background: #fff !important; }
  body.sm-has-print > :not(#sm-print) { display: none !important; }
  body.sm-has-print #sm-print { display: block; }
}
#sm-print {
  --surface: #fff; --surface-2: #fff; --line: #999; --ink: #111; --ink-2: #333; --ink-3: #555;
  --accent: #111; --accent-ink: #fff; --amber: #777; --red: #555;
  --sm-line: #333; --sm-body: #fff; --sm-glass: #e9e9e9; --sm-tyre: #333;
  --sm-seat-h: 19mm; --sm-gap: 2mm; --sm-row-gap: 4mm; --sm-pad: 3.5mm;
  color: #111; font: 10pt/1.35 var(--sans);
}
.sm-pp { width: 186mm; break-after: page; break-inside: avoid; }
#sm-print.sm-print-measuring { display: block !important; position: absolute; left: -10000px; top: 0; width: 186mm; visibility: hidden; }
.sm-pp:last-child { break-after: auto; }
.sm-pp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 6mm; border-bottom: 1.5pt solid #111; padding-bottom: 3mm; margin-bottom: 5mm; }
.sm-pp-head h1 { font-size: 20pt; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 4mm; }
.sm-pp-head h1 span { font: 700 13pt/1 var(--mono); letter-spacing: .06em; border: 1.2pt solid #111; border-radius: 1.2mm; padding: 1.4mm 2.2mm; }
.sm-pp-head p { margin: 1.5mm 0 0; font-size: 10.5pt; color: #333; }
.sm-pp-count { text-align: right; font-size: 10.5pt; white-space: nowrap; }
.sm-pp-count b { display: block; font-size: 22pt; line-height: 1; }
.sm-pp-body { display: grid; grid-template-columns: 96mm minmax(0, 1fr); gap: 7mm; align-items: start; }
.sm-pp .sm-van { max-width: none; width: 96mm; }
.sm-pp .sm-cap { font-size: 7.5pt; color: #333; }
.sm-pp .sm-cabin { padding: 3mm var(--sm-pad) 4mm; border-width: 1.5pt; }
.sm-pp .sm-wheel { width: 2.2mm; height: 15mm; }
.sm-pp .sm-wheel.fl, .sm-pp .sm-wheel.rl { left: -2.8mm; }
.sm-pp .sm-wheel.fr, .sm-pp .sm-wheel.rr { right: -2.8mm; }
.sm-pp .sm-wheel.fl, .sm-pp .sm-wheel.fr { top: -7mm; }
.sm-pp .sm-wheel.rl, .sm-pp .sm-wheel.rr { bottom: 20mm; }
.sm-pp .sm-seat { cursor: default; justify-content: flex-start; gap: .6mm; padding: 1.3mm .8mm 3mm; border-radius: 3mm 3mm 2.2mm 2.2mm; overflow: hidden;
  border: .8pt solid #777; background: #fff; color: #111; }
.sm-pp .sm-seat::before { display: none; }
.sm-pp .sm-seat::after { left: 1.2mm; right: 1.2mm; bottom: .9mm; height: 1.4mm; background: #111; opacity: .25; }
.sm-pp .sm-seat.is-taken { border: 1.6pt solid #111; }
.sm-pp .sm-seat.is-taken::after { opacity: .8; }
.sm-pp .sm-seat-code { font: 700 7.5pt/1 var(--mono); opacity: 1 !important; align-self: flex-start; padding-left: .6mm; }
.sm-pp .sm-seat-name { font: 700 8.4pt/1.15 var(--sans); text-align: center; overflow-wrap: anywhere;
  display: block; }
.sm-pp .sm-seat.is-empty .sm-seat-name { font-weight: 400; font-style: italic; color: #666; }
.sm-pp .sm-seat.is-blocked { border-style: dashed; }
.sm-pp .sm-driver { font-size: 7.5pt; border: .8pt solid #555; background: #e4e4e4; border-radius: 3mm 3mm 2.2mm 2.2mm; }
.sm-pp .sm-driver::before { display: none; }
.sm-pp .sm-driver svg { width: 6mm; height: 6mm; }
.sm-pp .sm-door { font-size: 7.5pt; color: #111; }
.sm-pp .sm-door b { color: #111; font-size: 11pt; }
.sm-pp .sm-door::after { background: #111; width: 1.2mm; left: calc(-1 * var(--sm-pad) - 1.3mm); }
.sm-pp .sm-door::before { left: calc(-1 * var(--sm-pad) - 1mm); width: 1.2mm; }
.sm-pp table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 9.5pt; }
.sm-pp th, .sm-pp td { border: .6pt solid #888; padding: 1.25mm 1.8mm; text-align: left; vertical-align: top; white-space: normal; height: 8.6mm; }
.sm-pp th { background: #eee; font-size: 7.5pt; text-transform: uppercase; letter-spacing: .05em; color: #222; height: auto; }
.sm-pp td.c { font: 700 9.5pt/1.3 var(--mono); width: 11mm; }
.sm-pp td.n { font-weight: 700; overflow-wrap: anywhere; }
.sm-pp td.n small { display: block; font-weight: 400; font-size: 8pt; color: #333; }
.sm-pp td.n.free { font-weight: 400; font-style: italic; color: #666; }
.sm-pp td.t, .sm-pp th.t { width: 11mm; text-align: center; }
.sm-pp th:first-child { width: 11mm; }
.sm-pp tr:last-child td { border-bottom: .6pt solid #888; }
.sm-pp td.t i { display: inline-block; width: 4.4mm; height: 4.4mm; border: 1pt solid #111; border-radius: .6mm; }
.sm-pp-foot { margin-top: 6mm; }
.sm-pp-sign { display: flex; gap: 8mm; font-size: 8.5pt; color: #333; }
.sm-pp-sign div { flex: 1; border-top: .8pt solid #111; padding-top: 1.5mm; }
.sm-pp-fine { margin: 4mm 0 0; font-size: 8pt; color: #444; }

#seat-maps { margin-bottom: var(--sp-6); }
.sm [hidden] { display: none !important; }
.sm-layout-note { color: var(--ink-3); font-size: var(--fs-1); margin: 10px 2px 0; }
.sm-card-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: var(--sp-4); }
.sm-buses.single { grid-template-columns: minmax(0, 680px); justify-content: center; }
.sm .sm-van[style*="--cols:5"] { --sm-pad: 8px; --sm-gap: 4px; }
.sm-dock p { overflow-wrap: anywhere; }
@media (max-width: 540px) {
  .seat-sheet { margin: auto auto 0; width: 100%; max-width: 100%; max-height: 94dvh; border-radius: 18px 18px 0 0; }
}

.print-actions { margin-bottom: 12px; display: flex; gap: 8px; }

.sheet {
  background: #fff; color: #111;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.sheet * { color: inherit; }
.sheet h1 { font-size: 18px; }
.sheet .sheet-head { border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 12px; }
.sheet .sheet-head p { margin: 3px 0 0; font-size: 12px; color: #444; }
.sheet h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 6px; }
.sheet table { font-size: 11px; }
.sheet th, .sheet td { border: 1px solid #bbb; padding: 5px 6px; white-space: normal; }
.sheet th { background: #f0f0f0; color: #222; }
.sheet .sign { margin-top: 18px; display: flex; gap: 24px; font-size: 11px; color: #444; }
.sheet .sign div { flex: 1; border-top: 1px solid #111; padding-top: 5px; }
.sheet .fineprint { margin-top: 14px; font-size: 10px; color: #555; }
.sheet .r { color: #a1160d; font-weight: 700; }
.sheet .a { color: #7a4a00; font-weight: 700; }
.sheet .g { color: #0f5c35; font-weight: 700; }

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  .topbar, .foot, .print-actions, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .wrap { max-width: none; padding: 0; }
  .sheet { border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .sheet table { page-break-inside: auto; }
  .sheet tr { page-break-inside: avoid; }
}
.bus-route { font-size: var(--fs-1); color: var(--ink-2); overflow-wrap: anywhere; margin: var(--sp-2) 0; }
.fleet-route { min-width: 0; padding: var(--sp-3); margin: 0 var(--sp-3) var(--sp-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.route-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.route-heading p { margin: 0; font-size: var(--fs-1); overflow-wrap: anywhere; }
.route-heading button { flex: none; font-size: var(--fs-1); }
.route-name { display: block; color: var(--ink-2); font-size: var(--fs-0); }
.route-stops { list-style: none; padding: 0; margin: var(--sp-3) 0 0; display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.route-stops li { flex: 1 1 80px; min-width: 0; border-top: 2px solid var(--ink-3); padding-top: var(--sp-2); position: relative; }
.route-stops li::before { content: ''; position: absolute; width: 7px; height: 7px; border-radius: 50%; top: -4.5px; left: 0; background: var(--ink-2); }
.route-stops time { display: block; font: 600 var(--fs-2)/1.4 var(--mono); }
.route-stops small { display: block; color: var(--ink-2); font-size: var(--fs-0); }
.route-stops b { display: block; font-size: var(--fs-1); line-height: 1.4; overflow-wrap: anywhere; }
.route-form > label { display: grid; gap: var(--sp-1); }
.route-stop-fields { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-2); margin: var(--sp-3) 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-2); }
.route-stop-fields legend { font-size: var(--fs-1); color: var(--ink-2); padding: 0 var(--sp-1); }
.route-stop-fields label { display: grid; gap: var(--sp-1); min-width: 0; font-size: var(--fs-1); }
.route-stop-fields input, .route-stop-fields select { min-width: 0; width: 100%; }
.route-place, .route-stop-actions { grid-column: 1 / -1; }
.route-stop-actions { display: flex; gap: var(--sp-2); }
.route-stop-actions button { min-width: 44px; }
@media screen and (max-width: 599px) {
  .route-stops { display: block; margin-left: var(--sp-1); }
  .route-stops li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: var(--sp-2); border-top: 0; border-left: 2px solid var(--ink-3); padding: 0 0 var(--sp-3) var(--sp-3); }
  .route-stops li:last-child { padding-bottom: 0; }
  .route-stops li::before { top: 6px; left: -4.5px; }
}
#sm-print .fleet-route { margin: 0 0 4mm; padding: 2mm; color: #111; background: #fff; border: .6pt solid #888; }
#sm-print .route-heading p { font-size: 9pt; }
#sm-print .route-name { display: inline; font-size: 8pt; color: #333; }
#sm-print .route-stops { display: flex; margin-top: 2mm; gap: 3mm; }
#sm-print .route-stops li { border-color: #555; flex-basis: 35mm; }
#sm-print .route-stops li::before { background: #111; }
#sm-print .route-stops time { font-size: 10pt; }
#sm-print .route-stops b { font-size: 9pt; }
#sm-print .route-stops small { font-size: 8pt; color: #333; }

/* LEGS-22NOV: route stretch buttons in the seat editor */
.sm-legs-h { margin: 2px 0 6px; font-size: var(--fs-0); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.sm-legs button[aria-pressed="true"] { font-weight: 700; }

/* STRETCH-23NOV: stretch picker + leg on the seat */
.sm-stretch { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.sm-stretch button { flex: 1 1 140px; min-height: 44px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  padding: 7px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 600 13px/1.2 var(--sans); text-align: left; cursor: pointer; }
.sm-stretch button small { font-weight: 500; font-size: 11.5px; color: var(--ink-2); }
.sm-stretch button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
.sm-stretch button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.sm-seat-leg { font: 800 11px/1 var(--sans); letter-spacing: .01em; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  padding: 2px 4px; border-radius: 5px; background: color-mix(in srgb, var(--accent-ink) 16%, transparent); }
.sm-grid:has(.is-part, .is-away) .sm-seat { height: 64px; }
.sm-seat.is-part .sm-seat-leg, .sm-seat.is-away .sm-seat-leg { position: relative; z-index: 2; margin-bottom: 2px; }
.sm-seat.is-away { border-style: dashed; border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.sm-seat.is-away .sm-seat-leg { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.sm-key.k-part { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 11px; }

/* SHARE-23NOV: two riders in one seat + rider switcher in the editor */
.sm-seat.is-pair .sm-seat-who { display: flex; flex-direction: column; gap: 2px; font-size: 12px; line-height: 1; }
.sm-seat.is-pair .sm-seat-who span { display: flex; align-items: baseline; gap: 3px; justify-content: center; white-space: nowrap; }
.sm-seat.is-pair .sm-seat-who i { font: 700 9.5px/1 var(--sans); font-style: normal; opacity: .85; }
.sm-grid:has(.is-pair) .sm-seat { height: 64px; }
.sm-riders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.sm-riders > span { font-size: 12.5px; color: var(--ink-2); margin-right: 2px; }
.sm-riders button { min-height: 36px; padding: 6px 10px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: 600 13px/1.1 var(--sans); cursor: pointer; }
.sm-riders button i { font-style: normal; font-size: 11px; opacity: .75; }
.sm-riders button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }

/* BOTH-23NOV: add to the other run too */
.sm-both { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); font-size: 14px; line-height: 1.3; cursor: pointer; }
.sm-both input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.sm-both[hidden] { display: none; }

/* COMPACT-23NOV: no square tap flash behind round pills; a calmer, less "zoomed" seat sheet on phones */
.sm button, .sm label, .sm a, .sm-editor button, .sm-editor label { -webkit-tap-highlight-color: transparent; }
.sm-chips button, .sm-riders button, .sm-stretch button { -webkit-appearance: none; appearance: none; background-clip: padding-box; overflow: hidden; outline-offset: 2px; }
.sm-chips button::after { inset: -4px -2px; border-radius: 999px; background: transparent; }
@media (max-width: 1099.98px) {
  .sm-editor { padding-left: 16px; padding-right: 16px; }
  .sm-ed-head { margin-bottom: 8px; }
  .sm-ed-head h3 { font-size: 22px; }
  .sm-editor label { margin-bottom: 8px; font-size: 14px; }
  .sm-editor input:not([type="checkbox"]), .sm-editor select { min-height: 42px; padding-top: 8px; padding-bottom: 8px; font-size: 16px; }
  .sm-legs-h { margin: 4px 0 6px; font-size: 12px; }
  .sm-chips { gap: 6px; margin-bottom: 10px; }
  .sm-chips button { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
  .sm-both { padding: 8px 10px; font-size: 13.5px; margin-bottom: 10px; }
  .sm-both input { width: 20px; height: 20px; }
  .sm-ed-actions [type="submit"], .sm-ed-actions button { min-height: 44px; }
  .sm-stretch button { min-height: 40px; padding: 6px 10px; font-size: 12.5px; }
}

/* Seat requests use the existing amber tokens, with a word and dashed border. */
.sm .sm-seat.is-held,.sm .sm-key.k-held {background:var(--amber-bg);color:var(--amber);border:2px dashed var(--amber)}

/* JOBTITLE-24NOV */
.rows .main small.job-title{font-size:.8em;font-weight:600;opacity:.75;margin-left:.35em}

/* ONREQ-24NOV: on-request riders */
.sm-seat.is-onreq .sm-seat-leg.sm-onreq-tag{border-style:dashed;font-weight:700}
.sm-onreq{display:grid;gap:8px;margin:8px 0;padding:10px 12px;border:1px dashed currentColor;border-radius:12px}
.sm-onreq-toggle{display:flex;gap:10px;align-items:flex-start;font-size:14px}
.sm-onreq-toggle input{width:20px;height:20px;margin-top:2px}
.sm-onreq-add{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.sm-onreq-add button,.sm-onreq-add input{min-height:40px}
.sm-onreq-stats{margin:0;font-size:14px}
.sm-onreq-stats small{opacity:.7}
.sm-onreq-dates{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:13px}
.sm-onreq-dates.is-past{opacity:.8}
.sm-rdate{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:999px;border:1px solid currentColor}
.sm-rdate.is-rode{font-weight:700}
.sm-rdate button{min-height:0;padding:0 4px;border:0;background:none;color:inherit;font-size:16px;line-height:1;cursor:pointer}
.sm-onreq-sum{display:block}
/* P15: Today shows its summary first on a phone. Secondary sections stay optional. */
.owner-fold{min-width:0}
.owner-fold>summary{display:none}
@media(min-width:431px){.owner-fold{display:contents}.owner-fold:not([open])>:not(summary){display:block}}
@media(max-width:430px){
 body:has(.today-compact) .topbar-in{flex-wrap:nowrap;gap:8px;padding:4px 8px;min-height:52px}
 body:has(.today-compact) .brand{flex:0 0 44px;min-width:44px}
 body:has(.today-compact) .brand-text{display:none}
 body:has(.today-compact) .topnav{flex:1;min-width:0;max-width:none;flex-wrap:nowrap;overflow-x:auto;gap:2px}
 body:has(.today-compact) .topnav a{flex:none;min-height:44px}
 .today-compact .mission{padding:14px;margin-bottom:10px}
 .today-compact .mission h1{font-size:24px;margin:4px 0}
 .today-compact .mission .eyebrow,.today-compact .mission .sub{display:none}
 .today-compact .mission-actions{margin:8px 0 0}
 .today-compact .mission-actions a{padding:8px;min-height:44px}
 .today-compact .summary{margin:8px 0;gap:6px}
 .today-compact .summary .chip{padding:8px;min-height:44px}
 .today-compact .chip b{font-size:22px}
 .today-compact .smooth-heading{gap:4px;margin:12px 0 6px}
 .today-compact .smooth-heading h2{font-size:19px;margin:0}
 .today-compact .smooth-heading .eyebrow{margin:0;font-size:11px}
 .today-compact .smooth-heading>a{min-height:44px;display:flex;align-items:center;font-size:12px}
 .today-compact .cockpit-grid{gap:8px}
 .today-compact .cockpit-bus{padding:10px;margin:0}
 .today-compact .cockpit-bus h3{font-size:17px;padding-top:5px;margin:0 0 6px}
 .today-compact .cockpit-run{font-size:13px;padding:4px 0}
 .today-compact .cockpit-run>a{display:flex;min-height:44px;align-items:center}
 .today-compact .cockpit-run p{margin:4px 0;font-size:12px}
 .today-compact .next-run{margin:6px 0;font-size:12px;line-height:1.4}
 .today-compact .cockpit-foot{gap:8px;padding:4px 0;font-size:12px}
 .today-compact .cockpit-foot a{display:flex;align-items:center;min-height:44px}
 .today-compact .owner-fold{border-top:1px solid var(--line);margin:4px 0}
 .today-compact .owner-fold>summary{display:list-item;cursor:pointer;min-height:44px;padding:12px 6px;font-size:13px;font-weight:600}
 .today-compact .owner-fold:not([open])>:not(summary){display:none}
 .today-compact .today-tiles{display:block}
 .today-compact .buses{gap:8px}
 .today-compact .bus{padding:12px}
 .today-compact .band-title{margin:12px 0 6px}
}
