/* ---- tokens ---- */
:root {
  --graphite: #262B31;
  --ink: #1E2227;
  --muted: #5E656E;
  --steel: #C9CED4;
  --line: #DCDFE3;
  --page: #F1F2F3;
  --surface: #FFFFFF;
  --orange: #FF6B12;
  --white: #FFFFFF;

  --brand-accent: var(--orange);
  --brand-accent-ink: var(--ink);
  --brand-nav: var(--graphite);
  --brand-nav-ink: #E9EBEE;

  --st-neutral-bg: #E8EAED;   --st-neutral-fg: #30363D;
  --st-transit-bg: #E0EAF7;   --st-transit-fg: #214A80;
  --st-next-bg: #FFE3D1;      --st-next-fg: #9A3A00;
  --st-done-bg: #E0F0E4;      --st-done-fg: #1C5E31;
  --st-failed-bg: #FBE1E1;    --st-failed-fg: #9E1F1F;
  --st-requested-bg: #F3EBDD; --st-requested-fg: #6B4C12;

  /* chart series: 1 = GBP and MD→UK, 2 = MDL and UK→MD (#365F96 is 6.5:1 on white) */
  --chart-1: var(--orange);
  --chart-2: #365F96;
  --chart-grid: var(--line);
  --chart-axis: var(--muted);

  --font-body: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fira Sans Extra Condensed", "Fira Sans", system-ui, sans-serif;

  --r-control: 3px;
  --r-card: 6px;
  --tap: 48px;
  --tap-big: 64px;
  --bar-height: 64px;
}

/* ---- fonts ---- */
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/fira-sans-cyrillic-400-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/fira-sans-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/fira-sans-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/fira-sans-cyrillic-500-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/fira-sans-latin-ext-500-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/fira-sans-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/fira-sans-cyrillic-600-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/fira-sans-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/fira-sans-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/fira-sans-cyrillic-700-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/fira-sans-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/fira-sans-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/fira-sans-extra-condensed-cyrillic-700-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/fira-sans-extra-condensed-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/fira-sans-extra-condensed-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 800; font-display: swap;
  src: url(fonts/fira-sans-extra-condensed-cyrillic-800-normal.woff2) format("woff2");
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 800; font-display: swap;
  src: url(fonts/fira-sans-extra-condensed-latin-ext-800-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 800; font-display: swap;
  src: url(fonts/fira-sans-extra-condensed-latin-800-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ---- base ---- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
}

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; line-height: 1.15; }
time, .num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- icons ---- */
.i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- shell ---- */
.logo { display: inline-flex; align-items: center; gap: 8px; --logo-origin: var(--graphite); --logo-arc: var(--graphite); }
.logo-mark { width: 30px; height: 26px; }
.logo-arc { fill: none; stroke: var(--logo-arc); stroke-width: 3.6; stroke-dasharray: 4.5 4.5; stroke-linecap: round; }
.logo-origin { fill: var(--logo-origin); }
.logo-dest { fill: var(--orange); }
.logo-word { font-family: var(--font-body); font-weight: 700; font-size: 1.375rem; letter-spacing: -0.01em; line-height: 1; }
.sidebar .logo, .topbar .logo { --logo-origin: var(--white); --logo-arc: var(--steel); color: var(--white); }

.company-slot { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.company-logo { width: 28px; height: 28px; object-fit: contain; border-radius: var(--r-control); background: var(--white); flex: none; }
.company-initials { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-control); background: var(--orange); color: var(--ink); font: 700 0.8125rem/1 var(--font-body); flex: none; }
.company-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar, .topbar { background: var(--brand-nav); color: var(--brand-nav-ink); }
.sidebar :focus-visible, .topbar :focus-visible { outline-color: var(--white); }
.sidebar a, .topbar a { color: inherit; text-decoration: none; }

.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-control); font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, 0.08); }
.nav a[aria-current] { background: var(--brand-accent); color: var(--brand-accent-ink); font-weight: 600; }

.nav-user { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.nav-user form { margin: 0; }
.nav-user-name { margin: 0; font-weight: 600; }
.nav-logout { display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 0 12px; border: 0; border-radius: var(--r-control); background: none; color: inherit; font: inherit; cursor: pointer; }
.nav-logout:hover { background: rgba(255, 255, 255, 0.08); }

.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; background: var(--surface); }
.segmented > button, .segmented > label { min-height: 40px; min-width: 44px; padding: 0 12px; border: 0; border-left: 1px solid var(--line); background: none; color: var(--ink); font: 600 0.875rem/1 var(--font-body); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.segmented > :first-child { border-left: 0; }
.segmented [aria-pressed="true"], .segmented input:checked + label { background: var(--graphite); color: var(--white); }
.sidebar .segmented, .topbar .segmented { background: transparent; border-color: rgba(255, 255, 255, 0.24); }
.sidebar .segmented > button, .topbar .segmented > button { color: inherit; border-left-color: rgba(255, 255, 255, 0.24); }
.sidebar .segmented [aria-pressed="true"], .topbar .segmented [aria-pressed="true"] { background: var(--white); color: var(--ink); }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 8px 0 16px; }
.topbar-title { flex: 1; min-width: 0; font: 700 1.125rem/1.2 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .company-name { max-width: 40vw; }
.topbar:has(.topbar-title:not(:empty)) .company-name { display: none; }
.nav-sheet > summary { list-style: none; display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: var(--r-control); cursor: pointer; }
.nav-sheet > summary::-webkit-details-marker { display: none; }
.nav-sheet[open] > summary { background: rgba(255, 255, 255, 0.12); }
.nav-sheet-panel { position: fixed; left: 0; right: 0; top: 56px; bottom: 0; overflow-y: auto; display: grid; align-content: start; gap: 16px; padding: 16px; background: var(--brand-nav); }
.topbar--focus { padding: 0 16px; justify-content: space-between; }

.sidebar { display: none; }
.content { min-width: 0; }
.page { padding: 16px 16px calc(var(--bar-height) + 32px + env(safe-area-inset-bottom)); max-width: 1200px; }
.page--narrow { max-width: 720px; }

.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.bottom-bar:not(:has(*)) { display: none; }
.bottom-bar [hidden] { display: none; }

@media (min-width: 960px) {
  .topbar:not(.topbar--focus) { display: none; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; display: flex; flex-direction: column; gap: 20px; padding: 20px 16px; overflow-y: auto; }
  .sidebar .nav { flex: 1; align-content: start; }
  .staff .content { margin-left: 232px; }
  .page { padding: 32px 40px 32px; }
  .bottom-bar { position: sticky; justify-content: flex-end; padding: 12px 40px; max-width: 1200px; }
  .bottom-bar > * { flex: 0 0 auto; }
  .bottom-bar .btn-grow { flex: 0 0 auto; }
}

/* ---- page header ---- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 24px; }
.page-header h1 { margin: 0; font-size: 2rem; font-weight: 800; }
.page-header .page-meta { flex-basis: 100%; margin: 0; color: var(--muted); }

/* ---- buttons ---- */
button, input, select, textarea { font: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 20px; border: 1px solid transparent; border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: 600 1rem/1.2 var(--font-body); text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--brand-accent); color: var(--brand-accent-ink); border-color: var(--brand-accent); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--steel); }
.btn-danger { background: var(--st-failed-fg); color: var(--white); border-color: var(--st-failed-fg); }
.btn-quiet { background: none; border-color: transparent; color: var(--ink); text-decoration: underline; padding: 0 8px; }
.btn-big { min-height: var(--tap-big); font-size: 1.125rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- forms ---- */
.form-section { margin: 0 0 24px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.form-section > h2 { margin: 0 0 12px; font-size: 1.375rem; }
.form-section > .hint:first-of-type { margin: 0 0 16px; }
.field { margin: 0 0 16px; }
.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.form input[type="text"], .form input[type="tel"], .form input[type="number"], .form input[type="password"],
.form input[type="date"], .form input[type="search"], .form select, .form textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--steel); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font-size: 1rem;
}
.form input:focus-visible, .form select:focus-visible, .form textarea:focus-visible { border-color: var(--orange); }
.has-error input, .has-error textarea, .has-error select { border-color: var(--st-failed-fg); }
.form-error { color: var(--st-failed-fg); font-weight: 600; margin: 6px 0 0; }
.hint { color: var(--muted); font-size: 0.875rem; margin: 4px 0 0; }

/* ---- pills, cards, tables, timeline ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-control); font: 600 0.8125rem/1.3 var(--font-body); white-space: nowrap; background: var(--st-neutral-bg); color: var(--st-neutral-fg); }
.pill--transit { background: var(--st-transit-bg); color: var(--st-transit-fg); }
.pill--next { background: var(--st-next-bg); color: var(--st-next-fg); }
.pill--done { background: var(--st-done-bg); color: var(--st-done-fg); }
.pill--failed { background: var(--st-failed-bg); color: var(--st-failed-fg); }
.pill--requested { background: var(--st-requested-bg); color: var(--st-requested-fg); }
.pill--cancelled { text-decoration: line-through; }

.card { margin: 0 0 16px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.card > h2 { margin: 0 0 8px; font: 600 0.9375rem/1.3 var(--font-body); color: var(--muted); }
.card > :last-child { margin-bottom: 0; }
.muted { color: var(--muted); }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.table th { padding: 10px 16px; text-align: left; font-size: 0.8125rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--page); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .row-link { color: inherit; text-decoration: none; }
.table tbody tr:hover { background: var(--page); }
.table .ref { font: 700 1.125rem/1.2 var(--font-display); white-space: nowrap; }
.table .sub { display: block; color: var(--muted); font-size: 0.875rem; }

@media (max-width: 719px) {
  .table, .table tbody { display: block; border: 0; background: none; }
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
  .table td { display: block; padding: 0; border: 0; }
  .table td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .table td.cell-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .table td:nth-child(n+3):not(.cell-status):not(.num) { grid-column: 1; color: var(--muted); font-size: 0.875rem; text-align: left; }
  .table td:nth-child(n+3) .sub { display: inline; margin-left: 6px; }
  .table td.num { grid-column: 2; grid-row: 3; align-self: end; color: var(--ink); font-weight: 600; font-size: 0.9375rem; }
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--steel); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { background: var(--ink); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; color: var(--muted); font-size: 0.875rem; }

/* ---- route motif ---- */
.route { --dot: 14px; }
.route-ends { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; font: 700 1.375rem/1.15 var(--font-display); }
.route-end small { display: block; margin-top: 2px; font: 500 0.875rem/1.3 var(--font-body); color: var(--muted); }
.route-end--dest { text-align: right; }
.route-track { position: relative; height: 28px; margin: 0 calc(var(--dot) / 2); }
.route-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 3px dashed var(--steel); transform: translateY(-50%); }
.route-done { position: absolute; left: 0; top: 50%; width: var(--to); height: 3px; background: var(--graphite); transform: translateY(-50%); transition: width 0.4s; }
.route-dot { position: absolute; top: 50%; left: var(--at); width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--steel); transform: translate(-50%, -50%); }
.route-dot--done { background: var(--graphite); border-color: var(--graphite); }
.route-dot--origin { left: 0; width: var(--dot); height: var(--dot); background: var(--graphite); border: 0; }
.route-dot--dest { left: 100%; width: var(--dot); height: var(--dot); background: var(--orange); border: 0; }
.route-van { position: absolute; top: 50%; left: var(--at); display: grid; place-items: center; width: 34px; height: 28px; border-radius: var(--r-control); background: var(--graphite); color: var(--white); transform: translate(-50%, -50%); transition: left 0.4s; }
.route-van .i { width: 20px; height: 20px; }
.route-me { position: absolute; top: 50%; left: var(--at); width: 22px; height: 22px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px var(--white), 0 0 0 5px var(--steel); transform: translate(-50%, -50%); }

/* ---- public pages ---- */
.public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 48px 16px; }
.public-logo { color: var(--ink); text-decoration: none; }
.public-card { width: 100%; max-width: 400px; padding: 28px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.public-card h1 { margin: 0 0 16px; font-size: 1.75rem; font-weight: 800; }
.public-card .btn-block + .btn-block { margin-top: 12px; }

/* ---- screens ---- */

/* Intake */
.intake fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.intake legend { font: 700 1.375rem/1.2 var(--font-display); padding: 0 0 12px; }
.js .intake legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.js .intake .step { display: none; }
.js .intake .step.active { display: block; }
.step-progress { display: none; list-style: none; margin: 0 0 20px; padding: 0; gap: 4px; counter-reset: step; }
.js .step-progress { display: grid; grid-template-columns: repeat(4, 1fr); }
.step-progress li { counter-increment: step; padding-top: 10px; border-top: 4px solid var(--line); color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.step-progress li::before { content: counter(step) ". "; }
.step-progress li.done { border-top-color: var(--graphite); color: var(--ink); }
.step-progress li[aria-current] { border-top-color: var(--orange); color: var(--ink); }
.form input[type="file"] { width: 100%; padding: 12px 0; }

/* Radio groups render as segmented controls; the radios stay for posting. */
.field div[id^="id_"]:has(input[type="radio"]) { display: flex; flex-wrap: wrap; border: 1px solid var(--steel); border-radius: var(--r-control); background: var(--surface); overflow: hidden; }
.field div[id^="id_"]:has(input[type="radio"]) > div { flex: 1 1 auto; border-left: 1px solid var(--line); }
.field div[id^="id_"]:has(input[type="radio"]) > div:first-child { border-left: 0; }
.field div[id^="id_"]:has(input[type="radio"]) label { display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 8px 14px; font-weight: 600; cursor: pointer; text-align: center; }
.field div[id^="id_"] input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.field div[id^="id_"]:has(input[type="radio"]) label:has(input:checked) { background: var(--graphite); color: var(--white); }
.field div[id^="id_"]:has(input[type="radio"]) label:has(input:focus-visible) { outline: 2px solid var(--orange); outline-offset: -4px; }

.field div[id^="id_"]:has(input[type="checkbox"]) label { display: flex; align-items: center; gap: 12px; min-height: var(--tap); font-weight: 600; }
.field div[id^="id_"] input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--graphite); }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); font-weight: 600; }
.check input { width: 24px; height: 24px; accent-color: var(--graphite); }
.lookup { min-height: 0; margin: -8px 0 12px; }
.contact-prefs { display: flex; gap: 12px; flex-wrap: wrap; }
.contact-prefs > .field { flex: 1 1 12rem; }
.ok { display: inline-flex; align-items: center; gap: 6px; color: var(--st-done-fg); font-weight: 600; }
.price-card { margin-top: 8px; }
.price-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0; font-weight: 600; }
.price-line strong { font: 800 2rem/1.1 var(--font-display); }
.btn-grow { flex: 1; }
.reference { margin: 8px 0; font: 800 clamp(3.5rem, 16vw, 6rem)/1 var(--font-display); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.created { text-align: center; padding: 24px 20px; }
.created-meta { font-size: 1.125rem; color: var(--muted); }
.created .send-button { margin: 12px auto 0; max-width: 28rem; text-align: left; }

/* Share-intent send buttons */
.send-button { display: grid; gap: 4px; }
.send-primary { justify-content: space-between; text-align: left; }
.sent-mark { display: inline-flex; margin-left: auto; }
.sent-label { font-size: 0.875rem; }
.send-others > summary { display: inline-flex; align-items: center; min-height: 40px; cursor: pointer; color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.send-others[open] { display: flex; flex-wrap: wrap; gap: 8px; }
.send-others[open] > summary { flex-basis: 100%; }
:is(.send-button, .demo-pill) + :is(.send-button, .demo-pill) { margin-top: 12px; }
.demo-pill { width: 100%; border-style: dashed; color: var(--muted); cursor: default; }

/* Orders list and detail */
.order-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.order-filters .search-field { position: relative; flex: 1 1 16rem; min-width: 0; }
.order-filters .search-field .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.order-filters .search-field input { padding-left: 42px; }
.order-filters select { flex: 0 1 14rem; width: auto; min-width: 0; }
.table tbody tr { position: relative; }
.table .row-link::after { content: ""; position: absolute; inset: 0; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--steel); border-radius: var(--r-card); }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 16px 0; }
.photos { display: flex; gap: .5rem; flex-wrap: wrap; }
.photos img { object-fit: cover; border-radius: var(--r-card); display: block; }

/* Order detail */
.detail-grid { display: grid; gap: 0 24px; }
.card-pair { display: grid; gap: 0 16px; }
.contact-name { margin: 0 0 12px; font: 700 1.375rem/1.2 var(--font-display); }
.amount { margin: 0 0 8px; font: 800 1.75rem/1.1 var(--font-display); }
.timeline .muted { display: block; font-size: 0.875rem; }
.disclosure, .danger-zone { margin-top: 12px; }
.disclosure > summary, .danger-zone > summary { display: inline-flex; align-items: center; min-height: var(--tap); cursor: pointer; font-weight: 600; }
.disclosure > summary { text-decoration: underline; text-underline-offset: 3px; }
.disclosure[open] > summary { margin-bottom: 8px; }
.danger-zone { margin: 8px 0 24px; padding: 0 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.danger-zone > summary { color: var(--st-failed-fg); }
.danger-zone[open] { padding-bottom: 20px; }
.danger-zone .form { max-width: 28rem; }
@media (min-width: 720px) { .card-pair { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .detail-grid { grid-template-columns: 2fr 1fr; } }

/* Trips */
.route-card { padding: 20px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.facts dd { margin: 2px 0 0; font: 700 1.375rem/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.trip-section { margin-top: 28px; }
.trip-section > h2 { margin: 0 0 12px; font-size: 1.375rem; }
.pick { list-style: none; margin: 0 0 12px; padding: 0; }
.pick li + li { border-top: 1px solid var(--line); }
.pick .ref { margin-right: 6px; font: 700 1.0625rem/1.2 var(--font-display); }
.form > .hint { margin: 0 0 16px; }

/* Runs and run plan */
.bar-form { display: flex; flex: 1; margin: 0; }
.run-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 960px) { .run-cards { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
.run-card { margin: 0; display: grid; gap: 6px; align-content: start; }
.run-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.run-card-date { font: 800 1.5rem/1.15 var(--font-display); color: var(--ink); text-decoration: none; }
.run-card-date:hover { text-decoration: underline; }
.run-card { position: relative; }
.run-card-date::after { content: ""; position: absolute; inset: 0; }
.run-card-meta { margin: 0; font-weight: 600; }
.run-card .muted { margin: 0 0 6px; font-size: 0.875rem; }
.run-card .btn { justify-self: start; position: relative; }

.stop-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.stop-row { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 12px 8px 4px; border-bottom: 1px solid var(--line); background: var(--surface); }
.stop-row:last-child { border-bottom: 0; }
.stop-row.sortable-ghost { opacity: 0.4; }
.stop-row input[type="hidden"] { display: none; }
.drag-handle { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: var(--tap); cursor: grab; touch-action: none; color: var(--muted); }
.stop-seq { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: var(--r-control); background: var(--graphite); color: var(--white); font: 700 0.9375rem/1 var(--font-body); font-variant-numeric: tabular-nums; flex: none; }
.stop-type { display: inline-flex; color: var(--muted); }
.stop-type--collection { color: var(--st-requested-fg); }
.stop-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stop-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-main .muted { font-size: 0.875rem; }
.stop-times { display: grid; justify-items: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stop-eta { color: var(--muted); font-size: 0.8125rem; }
.stop-window { font: 700 1.0625rem/1.2 var(--font-display); }
.move-form { margin: 0; }
.move-form select { max-width: 9rem; min-height: 40px; padding: 0 8px; border: 1px solid var(--steel); border-radius: var(--r-control); background: var(--surface); font-size: 0.875rem; }
.overflow-head { margin: 24px 0 8px; padding: 12px 16px; border-radius: var(--r-card); background: var(--st-next-bg); color: var(--st-next-fg); }
.overflow-head h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 1.25rem; }
.overflow-head p { margin: 0; font-size: 0.9375rem; }
.stop-row.is-overflow .stop-seq { background: var(--st-next-fg); }
.plan-subhead { margin: 28px 0 12px; font-size: 1.25rem; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.plan-actions form { margin: 0; }
@media (max-width: 719px) { .stop-row { flex-wrap: wrap; } .stop-row .move-form { flex-basis: 100%; padding-left: 50px; } }

/* ---- driver screens: big, high-contrast, hard to mis-tap ---- */
.focus-back { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); color: inherit; font-weight: 600; text-decoration: none; }
.focus-back .i { transform: rotate(180deg); }
.focus-title { font: 700 1.125rem/1.2 var(--font-display); }
.focus-progress { padding: 4px 10px; border-radius: var(--r-control); background: rgba(255, 255, 255, 0.12); font-weight: 700; }
@media (min-width: 960px) { .focus .content { max-width: 720px; margin: 0 auto; } }

.drive h1 { font-size: 2rem; font-weight: 800; margin: 8px 0; }
.drive h2 { font-size: 1.375rem; margin: 24px 0 12px; }
.drive-lead { font-size: 1.125rem; margin: 4px 0 16px; }
.drive .hint { margin: 0 0 16px; }
.btn-ok { background: var(--st-done-fg); border-color: var(--st-done-fg); color: var(--white); }
.btn-danger-outline { background: var(--surface); color: var(--st-failed-fg); border: 2px solid var(--st-failed-fg); }
.link-button { min-height: var(--tap); background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0; font-size: 0.9375rem; cursor: pointer; }
.drive-banner { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 12px 16px; border-radius: var(--r-card); font-size: 1.0625rem; font-weight: 700; }
.drive-banner p { flex: 1; margin: 0; }
.drive-banner.is-on_time { background: var(--st-done-bg); color: var(--st-done-fg); }
.drive-banner.is-late { background: var(--st-failed-bg); color: var(--st-failed-fg); }
.drive-banner.is-ahead { background: var(--st-transit-bg); color: var(--st-transit-fg); }
.btn-banner { background: var(--st-transit-fg); border-color: var(--st-transit-fg); color: var(--white); min-width: 96px; }
.drive-alert { margin: 0 0 12px; padding: 12px 16px; border-radius: var(--r-card); background: var(--st-next-bg); color: var(--st-next-fg); font-weight: 600; }
.drive-alert p { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.drive-failed { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.stop-card { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.stop-card-progress { display: flex; justify-content: space-between; align-items: center; margin: 0; color: var(--muted); font-weight: 600; }
.stop-card-type { display: inline-flex; align-items: center; gap: 8px; }
.stop-card-seq { padding: 2px 10px; border-radius: var(--r-control); background: var(--graphite); color: var(--white); font-weight: 700; font-variant-numeric: tabular-nums; }
.stop-card-name { margin: 12px 0 6px; font: 800 2.25rem/1.05 var(--font-display); overflow-wrap: anywhere; }
.stop-card-address { margin: 0 0 16px; font-size: 1.1875rem; }
.stop-card-window { margin: 0 0 8px; font: 800 2rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stop-card-label { display: block; font: 600 0.875rem/1.3 var(--font-body); color: var(--muted); }
.stop-card-eta { font: 500 1rem/1 var(--font-body); color: var(--muted); }
.stop-card-items { margin: 0 0 12px; color: var(--muted); }
.stop-card-collect { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0; padding: 14px; border-radius: var(--r-card); background: var(--orange); color: var(--ink); font: 800 1.75rem/1.1 var(--font-display); }
.stop-card-collect .i { width: 28px; height: 28px; }
/* Call and Navigate sit apart so a thumb cannot hit both. */
.stop-card-actions { display: flex; gap: 24px; margin-top: 16px; }
.stop-card-actions .btn-secondary { flex: 0 0 35%; }
.grow-form { flex: 1; margin: 0; }
.nav-change { margin: 8px 0 0; text-align: right; }
.nav-choice { display: grid; gap: 24px; margin-top: 24px; }
.arrived-actions { display: grid; gap: 24px; margin-top: 16px; }
.arrived-actions form { margin: 0; }
.photo-take { display: block; padding: 16px; border: 2px dashed var(--steel); border-radius: var(--r-card); font-size: 1.0625rem; font-weight: 700; }
.photo-take > span { display: flex; align-items: center; gap: 8px; }
.photo-take input { display: block; width: 100%; margin-top: 8px; }
.check-big { font-size: 1.125rem; padding: 8px 0; }
.check-big input { width: 32px; height: 32px; }
.reasons { border: 0; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.reasons legend { font: 700 1.375rem/1.2 var(--font-display); padding: 0 0 8px; }
.reason { display: flex; align-items: center; gap: 12px; min-height: var(--tap-big); padding: 0 16px; border: 1px solid var(--steel); border-radius: var(--r-card); background: var(--surface); font-size: 1.0625rem; font-weight: 600; cursor: pointer; }
.reason:has(input:checked) { border: 2px solid var(--graphite); }
.reason input { width: 24px; height: 24px; accent-color: var(--graphite); }
.drive textarea { width: 100%; margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--steel); border-radius: var(--r-control); font: inherit; }
.send-windows-actions { display: flex; gap: 8px; margin-top: 16px; }
.send-windows-actions form { margin: 0; }
/* Swipe to arrive: a full-width slider with a big thumb. */
.swipe-form { align-items: center; gap: 12px; }
.swipe { position: relative; flex: 1; --fill: 0%; }
.swipe[hidden] { display: none; }
.swipe-range { -webkit-appearance: none; appearance: none; width: 100%; height: var(--tap-big); margin: 0; border-radius: var(--r-card);
  background: linear-gradient(to right, var(--st-done-fg) var(--fill), var(--graphite) var(--fill)); touch-action: pan-y; }
.swipe-range::-webkit-slider-thumb { -webkit-appearance: none; width: 64px; height: 64px; border-radius: var(--r-card); background: var(--white); border: 4px solid var(--graphite); }
.swipe-range::-moz-range-thumb { width: 56px; height: 56px; border-radius: var(--r-card); background: var(--white); border: 4px solid var(--graphite); }
.swipe-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 1.125rem; font-weight: 700; pointer-events: none; }
/* Staff and settings */
.notice { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--r-card); background: var(--st-done-bg); color: var(--st-done-fg); font-weight: 600; }
.pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.staff-manage { text-align: right; }
.staff-actions { position: relative; z-index: 1; display: inline-block; text-align: left; }
.staff-actions summary { color: var(--ink); display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border: 1px solid var(--steel); border-radius: var(--r-control); cursor: pointer; font-weight: 600; list-style: none; }
.staff-actions summary::-webkit-details-marker { display: none; }
.staff-actions-panel { display: grid; gap: 8px; margin-top: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.staff-actions-panel form { margin: 0; }
@media (min-width: 720px) { .staff-actions[open] .staff-actions-panel { position: absolute; right: 0; min-width: 240px; } }
@media (max-width: 719px) { .table td.staff-manage { grid-column: 1 / -1; text-align: left; } }
.staff-subhead { margin: 28px 0 12px; font-size: 1.375rem; }
.invite-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 12px; }
.invite { display: grid; gap: 12px; margin: 0; }
.invite form { margin: 0; }
.invite-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.invite-head .muted { flex-basis: 100%; font-size: 0.875rem; }
.staff-share { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-copy { display: flex; gap: 8px; }
.invite-url { flex: 1; min-width: 0; min-height: var(--tap); padding: 0 12px; border: 1px solid var(--steel); border-radius: var(--r-control); background: var(--page); color: var(--muted); }
.staff-invite { margin-top: 28px; }
.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 12px; border: 1px dashed var(--steel); border-radius: var(--r-card); }
.logo-row .company-initials { background: var(--graphite); color: var(--white); }
.logo-row .company-logo, .logo-row .company-initials { width: 48px; height: 48px; font-size: 1.125rem; }
.logo-row input[type="file"] { flex: 1 1 14rem; min-width: 0; }
.logo-row .company-name { display: none; }
input[type="file"]::file-selector-button { min-height: 40px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--steel); border-radius: var(--r-control); background: var(--surface); color: var(--ink); font: 600 0.9375rem/1 var(--font-body); cursor: pointer; }
/* Public tracking page */
.trk-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.trk-header .company-initials { background: var(--graphite); color: var(--white); width: 36px; height: 36px; font-size: 0.9375rem; }
.trk-header .company-logo { width: 36px; height: 36px; background: none; }
.trk-header .company-name { font: 700 1.125rem/1.2 var(--font-display); }
.trk-lang > a { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 44px; padding: 0 10px; border-left: 1px solid var(--line); color: var(--ink); font: 600 0.875rem/1 var(--font-body); text-decoration: none; }
.trk-lang > a:first-child { border-left: 0; }
.trk-lang > a[aria-current] { background: var(--graphite); color: var(--white); }
.trk-body { max-width: 640px; margin: 0 auto; padding: 16px; }
.trk-main { margin-bottom: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.trk-status { margin: 0; font-size: 0.9375rem; font-weight: 600; color: var(--muted); }
.trk-headline { margin: 4px 0 12px; font: 800 2rem/1.1 var(--font-display); }
.trk-headline--window { display: grid; gap: 2px; }
.trk-day { font: 700 1.375rem/1.2 var(--font-display); }
.trk-window { font: 800 3rem/1 var(--font-display); letter-spacing: -0.01em; }
.trk-updated { margin: 0 0 12px; }
.trk-queue { margin: 0 0 8px; font-size: 1.0625rem; font-weight: 600; }
.trk-call { margin-top: 20px; }
.trk-progress { margin: 16px 0 4px; }
.trk-progress .route-track { margin: 0 11px; }
.trk-legend { position: relative; height: 20px; margin: 6px 11px 0; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.trk-legend > span { position: absolute; left: var(--at); transform: translateX(-50%); white-space: nowrap; }
.trk-legend > span[style*="--at: 0%"] { transform: none; }
.trk-legend > span[style*="--at: 100%"] { transform: translateX(-100%); }
.trk-legend-me { color: var(--ink); }
.trk-section { margin-bottom: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.trk-section h2 { margin: 0 0 12px; font-size: 1.25rem; }
.trk-summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.trk-summary dt { color: var(--muted); }
.trk-summary dd { margin: 0; font-weight: 600; }
.trk-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trk-photo { display: block; width: 100%; height: auto; border-radius: var(--r-card); }
.trk-timeline time { display: inline; margin-left: 6px; }
.trk-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 20px; padding: 16px 16px 32px; color: var(--muted); font-size: 0.875rem; }
.trk-footer a { color: var(--muted); }
.trk-credit { display: inline-flex; align-items: center; gap: 8px; }
.trk-credit .logo-mark { width: 22px; height: 19px; }
.trk-credit .logo-word { display: none; }
.trk-prose h1 { margin: 0 0 12px; font-size: 1.75rem; }

/* ---- owner statistics ---- */
.period-picker { margin: 0 -16px 12px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.period-picker::-webkit-scrollbar { display: none; }
.period-picker .segmented { display: flex; width: max-content; }
.stats .segmented > a { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-left: 1px solid var(--line); color: var(--ink); font: 600 0.875rem/1 var(--font-body); text-decoration: none; white-space: nowrap; }
.stats .segmented > a:first-child { border-left: 0; }
.stats .segmented > a:hover { background: var(--page); }
.stats .segmented > a[aria-current] { background: var(--graphite); color: var(--white); }
.stats .segmented--small > a { min-height: 36px; padding: 0 12px; }
.period-custom { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; margin: 0 0 12px; }
.period-custom .field { flex: 1 1 10rem; margin: 0; }
.stats-notice { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r-control); background: var(--st-requested-bg); color: var(--st-requested-fg); font-weight: 600; }

.stats-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0 24px; }
.tile { min-width: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.tile__label { margin: 0 0 6px; color: var(--muted); font-size: 0.875rem; font-weight: 500; }
.tile__line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0; }
.tile__line + .tile__line { margin-top: 4px; }
.tile__value { font: 700 1.625rem/1.15 var(--font-display); overflow-wrap: anywhere; }
.tile__line + .tile__line .tile__value { font-size: 1.25rem; }
.delta { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; border-radius: var(--r-control); background: var(--st-neutral-bg); color: var(--st-neutral-fg); font: 600 0.75rem/1.4 var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta .i { width: 0.95em; height: 0.95em; stroke-width: 2.4; }
.delta--up { background: var(--st-done-bg); color: var(--st-done-fg); }
.delta--down { background: var(--st-failed-bg); color: var(--st-failed-fg); }
.delta--none { background: none; color: var(--muted); }

.stats-block { margin: 0 0 16px; }
.stats-block h2 { margin: 0; font-size: 1.375rem; }
.stats-block__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 4px; }
.stats-block__hint { margin: 0 0 12px; color: var(--muted); font-size: 0.875rem; }
.stats-grid { display: grid; gap: 0 16px; }
.stats-table-block > h2 { margin: 24px 0 12px; }
.stats-repeat { margin: 0 0 12px; color: var(--muted); }
.stats-repeat strong { color: var(--ink); font: 700 1.375rem/1 var(--font-display); margin-right: 4px; }
.chart-empty { margin: 8px 0 0; padding: 32px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--steel); border-radius: var(--r-card); }

.chart { --series: var(--chart-1); margin: 12px 0 0; }
.chart + .chart { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.chart--s2 { --series: var(--chart-2); }
.chart__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin: 0 0 8px; }
.chart__title { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.chart__key { width: 14px; height: 2px; border-radius: 1px; background: var(--series); }
.chart__readout { margin: 0; font: 700 1.25rem/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.chart__plot { position: relative; padding-bottom: 20px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg:focus-visible { outline-offset: 4px; }
.chart__grid line { stroke: var(--chart-grid); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.chart__grid .chart__baseline { stroke: var(--steel); }
.chart__line { fill: none; stroke: var(--series); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart__area { fill: var(--series); fill-opacity: 0.1; stroke: none; }
.chart__point { fill: var(--series); }
.chart__bar { stroke: var(--surface); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.chart__bar--s1 { fill: var(--chart-1); }
.chart__bar--s2 { fill: var(--chart-2); }
.chart__overlay { fill: transparent; touch-action: pan-y; cursor: crosshair; }
.chart__guide { stroke: var(--ink); stroke-width: 1px; vector-effect: non-scaling-stroke; visibility: hidden; pointer-events: none; }
.chart__dot { fill: var(--series); stroke: var(--surface); stroke-width: 2px; vector-effect: non-scaling-stroke; visibility: hidden; pointer-events: none; }
.chart.is-scrubbing .chart__guide, .chart.is-scrubbing .chart__dot { visibility: visible; }
.chart:not(.chart--s1):not(.chart--s2) .chart__dot { fill: var(--ink); }
.chart__ticks, .chart__xlabels { position: absolute; inset: 0 0 20px; pointer-events: none; color: var(--chart-axis); font-size: 0.75rem; line-height: 1; font-variant-numeric: tabular-nums; }
.chart__ticks span { position: absolute; left: 0; top: var(--y); width: calc(44 / 600 * 100% - 6px); text-align: right; transform: translateY(-50%); white-space: nowrap; }
.chart__xlabels { inset: auto 0 0; height: 20px; }
.chart__xlabels span { position: absolute; left: var(--x); bottom: 0; white-space: nowrap; }
.chart__xlabels .chart__xlabel--middle { transform: translateX(-50%); }
.chart__xlabels .chart__xlabel--end { transform: translateX(-100%); }
.chart__legend { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.875rem; }
.chart__legend li { display: inline-flex; align-items: center; gap: 8px; }
.chart__swatch { width: 12px; height: 12px; border-radius: 2px; }
.chart__swatch--s1 { background: var(--chart-1); }
.chart__swatch--s2 { background: var(--chart-2); }

.hbars-group { --series: var(--chart-1); margin: 12px 0 0; }
.hbars-group--s2 { --series: var(--chart-2); }
.hbars-group + .hbars-group { margin-top: 20px; }
.hbars__title { margin: 0 0 8px; color: var(--muted); font: 600 0.875rem/1.3 var(--font-body); }
.hbars { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.hbar__label { font-weight: 500; }
.hbar__value { font-weight: 600; white-space: nowrap; }
.hbar__value .muted { font-weight: 400; }
.hbar__track { grid-column: 1 / -1; height: 8px; }
.hbar__fill { display: block; width: var(--w); min-width: 2px; height: 100%; border-radius: 0 4px 4px 0; background: var(--series); }

.stats-table .amounts .line { display: block; }

@media (max-width: 719px) {
  .stats-table tr { grid-template-columns: 1fr; gap: 4px; }
  .stats-table td:nth-child(1) { grid-column: 1; margin-bottom: 4px; }
  .stats-table td.num, .stats-table td:nth-child(2) { display: flex; justify-content: space-between; gap: 12px; grid-column: 1; grid-row: auto; align-self: auto; font-size: 0.9375rem; font-weight: 600; color: var(--ink); text-align: right; }
  .stats-table td.num::before { content: attr(data-label); color: var(--muted); font-weight: 400; text-align: left; }
}

@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid > .card { margin-bottom: 16px; }
}

@media (min-width: 960px) {
  .stats-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .period-picker { margin: 0 0 12px; padding: 0; }
  .tile { padding: 16px 20px; }
  .tile__value { font-size: 1.875rem; }
  /* The 3:1 charts would grow ~370 px tall across a wide card: cap the width (and so the height). */
  .stats .chart { max-width: 46rem; }
}

/* ---- help pages ---- */
.help-tabs { margin: 0 0 16px; }
.help-tabs > a { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border-left: 1px solid var(--line); color: var(--ink); font: 600 0.875rem/1 var(--font-body); text-decoration: none; white-space: nowrap; }
.help-tabs > a:first-child { border-left: 0; }
.help-tabs > a:hover { background: var(--page); }
.help-tabs > a[aria-current] { background: var(--graphite); color: var(--white); }
.help-lead { margin: 0 0 16px; font-size: 1.0625rem; }
.help-toc { margin: 0 0 16px; padding-left: 20px; columns: 2 12rem; }
.help-toc li { margin: 0 0 6px; }
.help .card > h2 { margin: 0 0 12px; font: 700 1.125rem/1.3 var(--font-display); color: var(--ink); }
.help .card h3 { margin: 16px 0 6px; font-size: 1rem; }
.help .card p, .help .card li { line-height: 1.5; }
.help .card ol, .help .card ul { margin: 0 0 12px; padding-left: 20px; }
.help .card li { margin: 0 0 6px; }
.help .card { scroll-margin-top: 72px; }
