/* ProTrack Control — "Race Grid" design system.
   Carbon masthead with navigation lanes, light work surface, lime brand accent, color-coded signature pipeline.
   Themes: system by default; html[data-theme=light|dark] forces one. */
:root {
  --carbon: #16181d;
  --carbon-2: #20232a;
  --carbon-3: #2b2f37;
  --lime: #b8f23a;
  --lime-hover: #a6e02a;
  --on-lime: #16181d;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #6b7280;
  --link: #2459c4;
  --focus: #8fcf1f;

  /* status: waiting / signing / complete / drive / danger */
  --wait: #9aa3ad;   --wait-tint: #f1f3f5;  --wait-ink: #4b5563;
  --sign: #f5a524;   --sign-tint: #fff4dc;  --sign-ink: #8a5300;
  --done: #6cb21a;   --done-tint: #eaf7d9;  --done-ink: #2f6b0a;
  --drive: #2f6bd8;  --drive-tint: #e6f0ff; --drive-ink: #1f4fae;
  --danger: #dc2626; --danger-tint: #fdecec; --danger-ink: #a61b1b;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --top-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f12; --surface: #16191e; --surface-2: #1c2026; --line: #272c34; --line-strong: #353b45;
    --text: #eceff2; --text-2: #b6bdc5; --muted: #8b949e; --link: #8db4ff;
    --wait-tint: #1f242b; --wait-ink: #b6bdc5;
    --sign-tint: #33270f; --sign-ink: #f7c46a;
    --done-tint: #1f2e10; --done-ink: #b5e36a;
    --drive-tint: #172440; --drive-ink: #9dbcff;
    --danger-tint: #3a1515; --danger-ink: #ff9b9b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f12; --surface: #16191e; --surface-2: #1c2026; --line: #272c34; --line-strong: #353b45;
  --text: #eceff2; --text-2: #b6bdc5; --muted: #8b949e; --link: #8db4ff;
  --wait-tint: #1f242b; --wait-ink: #b6bdc5;
  --sign-tint: #33270f; --sign-ink: #f7c46a;
  --done-tint: #1f2e10; --done-ink: #b5e36a;
  --drive-tint: #172440; --drive-ink: #9dbcff;
  --danger-tint: #3a1515; --danger-ink: #ff9b9b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
small { font-size: 12px; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 18px; height: 18px; flex: none; stroke-width: 2; vertical-align: -4px; }
.i.sm { width: 15px; height: 15px; vertical-align: -3px; }
.i.lg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- shell: carbon masthead with the navigation "lanes" under the brand ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.masthead { position: sticky; top: 0; z-index: 30; background: var(--carbon); color: #c9ced4; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.mast-top, .lanes { max-width: 1360px; margin: 0 auto; padding: 0 28px; }
.mast-top { height: 58px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; flex: none; display: block; }
.logo.big { width: 56px; height: 56px; }
.wordmark { font-weight: 700; letter-spacing: -.02em; font-size: 17px; white-space: nowrap; }
.wordmark b { color: var(--lime); font-weight: 700; }
.mast-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; color: #fff; border-radius: 999px; border: 1px solid var(--carbon-3); cursor: pointer; list-style: none; }
.me::-webkit-details-marker { display: none; }
.me:hover { background: var(--carbon-2); text-decoration: none; }
.me strong { display: block; font-size: 13px; line-height: 1.2; }
.me small { display: block; color: #8b949e; font-size: 11.5px; line-height: 1.2; }
.me .caret { color: #8b949e; }
.me-menu .only-phone { display: none; }

/* The lanes: horizontal tabs; the active one sits on a lime "racing line". */
.lanes { display: flex; align-items: stretch; gap: 4px; height: 46px; overflow-x: auto; scrollbar-width: none; }
.lanes::-webkit-scrollbar { display: none; }
.lanes a {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; color: #aeb5bd; font-weight: 500; font-size: 14px;
  position: relative; white-space: nowrap; border-radius: 8px 8px 0 0; transition: color .15s, background .15s;
}
.lanes a .i { width: 17px; height: 17px; }
.lanes a:hover { color: #fff; background: var(--carbon-2); text-decoration: none; }
.lanes a.active { color: #fff; background: var(--carbon-2); }
.lanes a.active .i { color: var(--lime); }
.lanes a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--lime); transform: scaleX(0); transition: transform .2s; }
.lanes a.active::after { transform: scaleX(1); }
.lanes a:hover::after { transform: scaleX(.35); }
.lanes a.active:hover::after { transform: scaleX(1); }
.lanes .badge { background: var(--lime); color: var(--on-lime); font-weight: 700; font-size: 11px; border-radius: 10px; padding: 0 7px; line-height: 18px; }
.lane-sep {
  align-self: center; margin: 0 6px 0 10px; padding-left: 14px; border-left: 1px solid var(--carbon-3);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #6f7780;
}
/* Finish-line flag under the header. */
.checker {
  height: 6px;
  background: repeating-conic-gradient(var(--lime) 0 25%, var(--carbon) 0 50%) 0 0 / 6px 6px;
  opacity: .9;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--carbon-3); background: transparent; color: #c9ced4; cursor: pointer; font: inherit;
}
.icon-btn:hover { background: var(--carbon-2); color: #fff; text-decoration: none; }
[data-theme-toggle] .i { display: none; }
:root:not([data-theme]) [data-theme-toggle] .theme-system,
:root[data-theme="light"] [data-theme-toggle] .theme-light,
:root[data-theme="dark"] [data-theme-toggle] .theme-dark { display: inline-block; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 2px solid var(--surface);
}
.avatar.brand { background: var(--lime); color: var(--on-lime); border-color: var(--carbon); }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }

.crumbs { display: flex; list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.crumbs li + li::before { content: "/"; margin: 0 8px; color: var(--line-strong); }
.crumbs a { color: var(--text-2); }
.content { padding: 22px 28px 40px; width: 100%; max-width: 1360px; margin: 0 auto; }
.shell > .site-foot { margin-top: auto; padding: 8px 16px 24px; }
.site-foot { text-align: center; font-size: 12px; color: var(--muted); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 20px 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid2 > .card { margin-bottom: 0; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; color: var(--text); position: relative; overflow: hidden; }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--k, var(--wait)); }
.kpi span { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi b { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi.wait { --k: var(--wait); } .kpi.sign { --k: var(--sign); } .kpi.done { --k: var(--done); } .kpi.drive { --k: var(--drive); } .kpi.brand { --k: var(--lime); }

/* ---------- pills / status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; line-height: 20px; padding: 0 9px; border-radius: 999px; background: var(--wait-tint); color: var(--wait-ink); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok, .pill.done { background: var(--done-tint); color: var(--done-ink); }
.pill.warn, .pill.sign { background: var(--sign-tint); color: var(--sign-ink); }
.pill.drive { background: var(--drive-tint); color: var(--drive-ink); }
.pill.danger { background: var(--danger-tint); color: var(--danger-ink); }
.pill.cat { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); font-weight: 500; }
.pill.muted { background: var(--surface-2); color: var(--muted); }
a.pill:hover { text-decoration: none; filter: brightness(.97); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-2); font-size: 13px; font-weight: 500; background: var(--surface); }
.chip:hover { text-decoration: none; border-color: var(--line-strong); color: var(--text); }
.chip.on { background: var(--carbon); border-color: var(--carbon); color: #fff; }
:root[data-theme="dark"] .chip.on { background: var(--lime); border-color: var(--lime); color: var(--on-lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on { background: var(--lime); border-color: var(--lime); color: var(--on-lime); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px;
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--lime); border-color: var(--lime-hover); color: var(--on-lime); }
.btn.primary:hover { background: var(--lime-hover); }
.btn.dark { background: var(--carbon); border-color: var(--carbon); color: #fff; }
.btn.dark:hover { background: var(--carbon-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-tint); border-color: var(--danger-tint); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
form.inline { display: inline; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .form label > span.lbl { font-weight: 600; font-size: 13px; color: var(--text); }
.field small, .help { color: var(--muted); font-size: 12px; }
.row2, .row3 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row3 { grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 0 12px; height: 40px; width: 100%; transition: border-color .12s, box-shadow .12s;
}
textarea { padding: 10px 12px; height: auto; min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lime) 35%, transparent); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--carbon); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { font-weight: 600; padding: 0 6px; font-size: 13px; }
.actions-row { display: flex; justify-content: flex-end; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions-row .grow { margin-right: auto; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { margin-top: 1px; }

.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); padding: 22px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; color: var(--text-2); transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--done); background: var(--done-tint); }
.dropzone .i { width: 28px; height: 28px; color: var(--muted); }
.dropzone input { display: none; }
.dropzone .file { font-weight: 600; color: var(--text); }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; display: none; }
.progress.on { display: block; }
.progress div { height: 100%; width: 0; background: var(--done); transition: width .15s; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .push { margin-left: auto; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search .i { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search input { padding-left: 36px; }
.toolbar select { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg a { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 34px; color: var(--text-2); font-weight: 500; }
.seg a + a { border-left: 1px solid var(--line-strong); }
.seg a.on { background: var(--carbon); color: #fff; }
:root[data-theme="dark"] .seg a.on { background: var(--lime); color: var(--on-lime); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg a.on { background: var(--lime); color: var(--on-lime); } }
.seg a:hover { text-decoration: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line);
}
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td .sub { display: block; color: var(--muted); font-size: 12px; }
tr.unread td { font-weight: 600; }
tr.unread td:first-child { box-shadow: inset 3px 0 var(--lime); }
th a { color: inherit; }

/* row menu (⋯) */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
/* Positioned with JS as position:fixed so it is never clipped by a scrolling table. */
.menu-list {
  position: fixed; min-width: 200px; z-index: 60; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column;
}
.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0;
  font: inherit; text-align: left; cursor: pointer; width: 100%;
}
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.menu-list .danger { color: var(--danger); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu-list form { margin: 0; }

/* ---------- signature pipeline board ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; font-weight: 600; font-size: 13px; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.col-head .count { margin-left: auto; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.col.wait { --c: var(--wait); } .col.sign { --c: var(--sign); } .col.done { --c: var(--done); } .col.drive { --c: var(--drive); }
.doc {
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 8px; padding: 10px 12px;
  margin-bottom: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
}
.doc:last-child { margin-bottom: 0; }
.doc-top { display: flex; gap: 8px; align-items: flex-start; }
.doc-no { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 26px; }
.doc-title { font-weight: 600; line-height: 1.35; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.doc-title a { color: var(--text); }
.doc-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.sigbar { display: flex; gap: 3px; }
.sigbar span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.sigbar span.on { background: var(--c); }
.doc-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.faces { display: flex; }
.faces .avatar { margin-left: -6px; }
.faces .avatar:first-child { margin-left: 0; }
.faces .avatar.signed { background: var(--done-tint); color: var(--done-ink); }
.col-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 6px; }

/* officials */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.person div { flex: 1; min-width: 0; }
.person strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { color: var(--muted); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow a { font-weight: 600; color: var(--text); }
.list small { color: var(--muted); display: block; }

/* empty states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 16px; color: var(--muted); }
.empty .ring { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.empty .ring .i { width: 26px; height: 26px; color: var(--text-2); }
.empty strong { color: var(--text); font-size: 15px; }
.empty p { margin: 0; max-width: 380px; }

/* ---------- modal ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
}
dialog.modal.wide { width: min(980px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 12, 16, .55); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; align-items: center; }
.modal-foot .grow { margin-right: auto; }
/* officials picker */
.picker { display: flex; flex-direction: column; gap: 8px; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.picks:empty { display: none; }
.pick { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 999px; background: var(--done-tint); color: var(--done-ink); font-size: 13px; font-weight: 600; }
.pick small { font-weight: 400; opacity: .8; }
.pick button { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font-size: 11px; line-height: 1; }
.pick button:hover { background: rgba(0,0,0,.08); }
dialog.modal.confirm { width: min(420px, calc(100vw - 32px)); }
.modal.confirm .modal-body { display: flex; gap: 14px; align-items: flex-start; padding: 22px 22px 18px; }
.modal.confirm .modal-body p { margin: 2px 0 0; line-height: 1.5; }
.modal.confirm .ring { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--danger-tint); color: var(--danger); }
.modal.confirm .btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.modal.confirm .btn.danger:hover { background: var(--danger-ink); border-color: var(--danger-ink); }
.preview { width: 100%; height: min(62vh, 640px); border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.receipt { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 10px 0; }
.receipt .ring { width: 64px; height: 64px; border-radius: 50%; background: var(--done-tint); color: var(--done-ink); display: flex; align-items: center; justify-content: center; animation: pop .35s ease-out; }
.receipt .ring .i { width: 32px; height: 32px; }
.receipt code { font-size: 14px; padding: 4px 10px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px;
  background: var(--carbon); color: #fff; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500;
  animation: toast-in .25s ease-out;
}
.toast .i { color: var(--lime); }
.toast.error .i { color: #ff8a8a; }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert.error { background: var(--danger-tint); color: var(--danger-ink); }
.alert.info { background: var(--drive-tint); color: var(--drive-ink); }

/* ---------- message ---------- */
.message .body { padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 14px 0 16px; line-height: 1.65; }

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; background: var(--surface); }
.login-art {
  position: relative; overflow: hidden; background: var(--carbon); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art::before {
  content: ""; position: absolute; inset: -20% -40% -20% 48%; transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent 0 30%, var(--lime) 30% 33%, transparent 33% 38%, var(--carbon-2) 38% 100%);
}
.login-art::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 46%;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 64px), repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 1px, transparent 1px 64px);
  mask-image: linear-gradient(to top, #000, transparent);
}
.login-art > * { position: relative; z-index: 1; }
.login-art .wordmark { font-size: 20px; }
.login-art h2 { font-size: 34px; line-height: 1.15; font-weight: 700; max-width: 440px; letter-spacing: -.03em; }
.login-art h2 em { font-style: normal; color: var(--lime); }
.login-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-direction: column; gap: 10px; color: #c9ced4; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-art li .i { color: var(--lime); }
.login-art footer { color: #7d858f; font-size: 12px; }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; background: var(--bg); }
.login-panel .site-foot { margin-top: 18px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-card > p { color: var(--muted); margin: 0 0 24px; }

/* ---------- bottom nav (mobile) ---------- */
.bottom-nav { display: none; }
.cat-select { display: none; }

@media (max-width: 1100px) {
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .mast-top { height: 54px; padding: 0 12px 0 16px; }
  .lanes { display: none; }
  .mast-tools [data-theme-label], .me > span:not(.avatar), .me .caret { display: none; }
  .mast-tools .icon-btn { padding: 0; width: 36px; }
  .me { padding: 2px; }
  .me-menu .only-phone { display: flex; }
  .crumbs { display: none; }
  .content { padding: 16px 16px 8px; }
  .shell > .site-foot { padding-bottom: 92px; }
  .page-head h1 { font-size: 19px; }
  .grid2, .row2, .row3, .board { grid-template-columns: minmax(0, 1fr); }
  .kpis { gap: 10px; }
  .kpi b { font-size: 22px; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); padding: 4px 0; position: relative; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a.active { color: var(--text); }
  .bottom-nav a.active .i { color: var(--done); }
  .bottom-nav .i { width: 22px; height: 22px; }
  .bottom-nav .badge { position: absolute; top: -2px; left: calc(50% + 9px); background: var(--lime); color: var(--on-lime); border-radius: 9px; font-size: 10px; font-weight: 700; padding: 0 5px; }
  .doc .btn.primary { height: 40px; }
  .toasts { left: 16px; right: 16px; bottom: 84px; }
  .toast { min-width: 0; max-width: none; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { padding: 28px 22px; min-height: 230px; }
  .login-art h2 { font-size: 24px; }
  .login-art ul, .login-art footer { display: none; }

  /* Everything fits the width: no sideways scrolling anywhere. */
  html, body { overflow-x: hidden; }
  .page-head { margin-bottom: 14px; gap: 10px; }
  .page-head p { font-size: 13px; }
  .page-head .actions { width: 100%; }
  .page-head .actions > *, .page-head .actions form, .page-head .actions form .btn { flex: 1; }
  .card { padding: 14px; margin-bottom: 14px; }
  .card-head { gap: 10px; }
  .search { max-width: none; min-width: 0; width: 100%; }

  /* Tables turn into one card per row, each value labelled with its column name. */
  .table-wrap { overflow: visible; }
  .card.flush { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .card.flush > .card-head { padding: 0 0 12px !important; border: 0 !important; flex-direction: column; align-items: stretch; }
  .card.flush > .card-head .chips { justify-content: flex-start; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
  table.stack tbody tr:hover { background: var(--surface); }
  table.stack tr.unread td:first-child { box-shadow: none; }
  table.stack tr.unread { border-left: 3px solid var(--lime); }
  table.stack td { border: 0; padding: 3px 0; display: flex; justify-content: flex-end; align-items: baseline; flex-wrap: wrap; column-gap: 6px; text-align: right; min-height: 24px; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; margin-right: auto; }
  table.stack td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  table.stack td:first-child::before, table.stack td:last-child::before, table.stack td:not([data-label])::before { display: none; }
  table.stack td:last-child { justify-content: flex-end; padding-top: 8px; }
  table.stack td .sub { display: inline; margin-left: 4px; }
  table.stack td:first-child .sub { display: block; margin: 0; }

  /* Event page: the four stage tiles are tabs; only the chosen board column is shown. */
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 7px 4px 7px 8px; border-radius: 8px; }
  .kpi span { font-size: 10px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: clip; display: block; }
  .kpi span .i { display: none; }
  .kpi b { font-size: 20px; }
  .kpi[data-stage] { cursor: pointer; }
  .kpi[data-stage].on { border-color: var(--k); box-shadow: 0 0 0 1px var(--k); }
  .board[data-show] .col { display: none; }
  .board[data-show="wait"] .col.wait, .board[data-show="sign"] .col.sign,
  .board[data-show="done"] .col.done, .board[data-show="drive"] .col.drive { display: block; }
  .board[data-show] .col-head { display: none; }
  .col { padding: 8px; }
  .chips.cats { display: none; }
  .cat-select { display: block; flex: 1; min-width: 0; height: 36px; }
  .toolbar { flex-wrap: nowrap; margin-bottom: 12px; }
  .toolbar .seg.push { margin-left: 0; flex: none; }
  .seg a { padding: 0 10px; }
  .seg a span { display: none; }
  .people { grid-template-columns: minmax(0, 1fr); }
  .list li { gap: 10px; }
  .list li .btn { flex: none; }
}
