/* ============================================================================
   Fresh-IOT — tokens.css
   Part 1: Design tokens. ALL colors and typography live here as CSS variables.
           No other file may declare a color value (HTML, JS and SVG consume
           var(--…) only; echarts reads these vars at runtime).
   Part 2: Shared component styles (consume tokens only, no raw values).
   Craft rules applied per the Sprint 1.5 brief (docs/DESIGN.md is absent from
   this repo — see DEVIATIONS.md): surface tiers, 1px borders instead of
   shadows, 8px data density vs 16/24px reading padding, label-caps overlines,
   JetBrains Mono ONLY for data values (IDs, temps, coords, timestamps),
   Inter for everything else.
   Status color semantics follow docs/platform-boundary.md §4
   (EXPECTED_OFFLINE is slate-blue, never red).
   ========================================================================== */

:root {
  /* ---- Brand & surface tiers ----
     Tier 1: page background (--color-bg)
     Tier 2: white cards, 1px --color-border, radius --radius, no shadow
     Tier 3: inset wells inside cards (--color-surface-2) */
  --color-brand-ink: #0b1c30;        /* sidebar / dark chrome */
  --color-brand-ink-2: #13253d;
  /* Tenant demo (§7B, Tina 拍板 2026-07-23): brand name / mark / accent are
     the ONLY things that re-theme per tenant (html[data-tenant] block below).
     Alert, severity, status and chart colors NEVER follow the tenant —
     alert semantics are not reshaped. Primary accent is dark teal #006a61
     (拍板 2026-07-23); this file is the single source of truth for colors. */
  --tenant-fresh-accent: #006a61;
  --tenant-sam-accent: #0070a0;      /* SAM (OEM) = Biotempak brand blue */
  --tenant-sam-green: #2e9e50;       /* Biotempak green — decorative use
                                        only, NEVER a semantic color */
  --color-accent: var(--tenant-fresh-accent);
  --color-accent-strong: #00584f;
  --color-accent-soft: #d9f2ee;
  /* 1.9 canvas/card contrast flip: canvas one step deeper grey, cards pure
     white + hairline — sections separate by contrast, still zero shadows.
     In-card k/v tiles use the canvas grey (one system, site-wide). */
  --color-bg: #f1f4f8;
  --color-surface: #ffffff;
  --color-surface-2: #f1f4f8;
  --color-surface-3: #e4eaf1;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-text-faint: #64748b;
  --color-on-dark: #e8edf2;
  --color-on-dark-muted: #94a7ba;
  --color-on-accent: #ffffff;
  --color-focus-ring: rgba(0, 106, 97, 0.25);
  --color-scrim: rgba(11, 28, 48, 0.45);
  --color-shadow: rgba(11, 28, 48, 0.10);

  /* ---- Shipment ops_status (platform-boundary.md §4) ---- */
  --color-status-normal: #1b7f4d;
  --color-status-normal-bg: #e4f4eb;
  --color-status-expected-offline: #5b7590;   /* slate blue — never red */
  --color-status-expected-offline-bg: #e9eef4;
  --color-status-arriving-soon: #2158b7;
  --color-status-arriving-soon-bg: #e3ecfa;
  --color-status-needs-review: #c25e00;
  --color-status-needs-review-bg: #fdeede;

  /* ---- Alert severity ---- */
  --color-severity-critical: #ba1a1a;
  --color-severity-critical-bg: #fdeae7;
  --color-severity-warning: #c25e00;
  --color-severity-warning-bg: #fdeede;
  --color-severity-info: #2158b7;
  --color-severity-info-bg: #e3ecfa;

  /* ---- semantic tints (1.9: 8% → 12% — chips/KPI read as color again,
          not grey haze; four families red/amber/green/slate-blue) ---- */
  --tint-normal: rgba(27, 127, 77, 0.12);
  --tint-expected-offline: rgba(91, 117, 144, 0.12);
  --tint-arriving-soon: rgba(33, 88, 183, 0.12);
  --tint-needs-review: rgba(194, 94, 0, 0.12);
  --tint-critical: rgba(186, 26, 26, 0.12);
  --tint-warning: rgba(194, 94, 0, 0.12);
  --tint-info: rgba(33, 88, 183, 0.12);
  --tint-recovered: rgba(109, 90, 163, 0.12);
  --tint-accent: rgba(0, 106, 97, 0.12);

  /* ---- Semantic metric colors (alert semantics only) ---- */
  --color-metric-out: #ea580c;   /* out-of-range metric values */
  --color-batt-warn: #b45309;    /* battery below 30% */

  /* ---- Evidence status ---- */
  --color-evidence-strong: #1b7f4d;
  --color-evidence-partial: #c78a00;
  --color-evidence-limited: #ba1a1a;

  /* ---- Position three-state (map legend) ---- */
  --color-pos-confirmed: #006a61;   /* solid line / filled dot */
  --color-pos-estimated: #4f9e94;   /* dashed line / hollow dot */
  --color-pos-gap: #9aa3ad;         /* gray broken segment */

  /* ---- Recovered (buffered / retroactive) data accent ---- */
  --color-recovered: #6d5aa3;
  --color-recovered-bg: #efeaf8;

  /* ---- Report paper (Reports page document-feel surface) ---- */
  --color-paper: #fdfcf7;
  --color-paper-border: #ece8dd;

  /* ---- Map placeholder ---- */
  --color-map-water: #eef3f7;
  --color-map-land: #dde5ea;
  --color-map-land-line: #c9d4dc;
  --color-map-label: #5b6b7a;

  /* ---- Charts — categorical series palette (DESIGN.md §Charts; echarts
          reads these at runtime). Red/orange never appear here: those hues
          are reserved for alert semantics. ---- */
  /* Chart color rule v3 (Tina 拍板 2026-07-24):
     「饱和色只做小面积,大面积一律软色」 — the old-five-pages formula
     extended to charts. SATURATED tones (#006a61, alert orange, …) are
     allowed ONLY at small area: thin strokes, line series, dots, legend
     markers, center numerals, hover emphasis. LARGE-AREA FILLS (bar
     bodies, donut segments, area fills) take mid-tone SOFT colors derived
     from the existing semantic families (saturation halved, lightness
     raised). Violet/indigo stay permanently banned; large saturated
     blocks (v2 single-hue ramp) were judged "太重" and are equally out.
     --chart-1..6 = saturated line/dot series (thin marks only). */
  --chart-1: #006a61;   /* anchor — deep teal (lines/dots/legend only) */
  --chart-2: #2f8d82;
  --chart-3: #5fab9f;
  --chart-4: #8fc7bd;
  --chart-5: #b9d8d2;
  --chart-6: #9aa3ad;   /* neutral grey tail */
  /* soft fills — the ONLY colors allowed on large chart areas */
  --chart-soft-1: #79b4ac;      /* soft deep-teal (from #006a61) */
  --chart-soft-2: #83a3cd;      /* soft blue (arriving family) */
  --chart-soft-3: #8ba3ba;      /* soft slate (expected-offline family) */
  --chart-soft-alert: #d9a473;  /* soft warning-orange ("with alerts" fills;
                                   deep #c25e00 only as the legend dot) */
  /* Quantity-class chart ramp (Historical 定稿轮 2026-07-25, Tina 拍板):
     QUANTITY charts (share/count distributions — donuts, flow widths,
     volume bars) use this blue-grey ramp; the tenant accent (dark teal)
     is reserved for SEMANTIC emphasis only, and Rust stays alert-only. */
  --chart-qty-1: #436d9f;   /* steel — leader slice */
  --chart-qty-2: #5e86b5;
  --chart-qty-3: #84a4c7;
  --chart-qty-4: #a9bfd9;
  --chart-qty-5: #cfdbe9;   /* pale tail */
  /* Device identity palette (2026-08-07, Tina 拍板 — overrides the
     "violet/indigo permanently banned" line above for THIS use only).
     Rationale: --chart-1..6 is a single-hue teal ramp, so two devices
     plotted together were indistinguishable at 2 px stroke. A device's
     color is its identity across the whole product — chart series,
     summary card, event markers — so that "the purple one" is a thing a
     user can say out loud. Red/orange stay out: they mean excursion. */
  --device-1: #006a61;   /* deep teal — brand anchor */
  --device-2: #6d4aa3;   /* violet */
  --device-3: #1d6fb8;   /* blue */
  --device-4: #a3348a;   /* magenta */
  --device-5: #5a6b8c;   /* slate */
  --device-6: #4f6f2a;   /* olive */
  /* Sensor-event glyphs pinned onto the transit timeline. Light borrows
     the warning hue (a lit sensor is not an alert, but the semantic is
     "something opened"); shock takes ink so it never reads as an
     excursion — those stay --color-severity-critical. */
  --event-light: #c25e00;
  --event-shock: #0b1c30;
  --color-chart-band: rgba(27, 127, 77, 0.08);
  --color-chart-threshold: #1b7f4d;
  --color-chart-axis: #64748b;
  --color-chart-grid: #e2e8f0;

  /* ---- Typography ---- */
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  /* display face for page titles / hero numerals (Historical 定稿轮 —
     loaded per-page; falls back to Inter wherever the font isn't linked) */
  --font-display: 'Schibsted Grotesk', 'Inter', system-ui, sans-serif;
  --fs-11: 11px;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-22: 22px;
  --fs-28: 28px;
  --fs-32: 32px;
  --lh-tight: 1.25;
  --lh-body: 1.5;
  --ls-caps: 0.05em;

  /* ---- Shape & elevation (borders carry structure; shadows are for
          floating overlays only — modal, drawer, toast, map note) ---- */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px var(--color-shadow);
  --shadow-pop: 0 8px 28px var(--color-shadow);

  /* ---- Density scale: 8px data-dense / 16px default / 24px reading ---- */
  --pad-dense: 8px;
  --pad: 16px;
  --pad-read: 24px;
}

/* Tenant demo (§7B): SAM (OEM) — accent family only, derived from the
   Biotempak brand blue #0070A0 (strong = one step darker, tint = one step
   lighter); semantic colors, charts and status hues stay exactly as
   declared above. */
:root[data-tenant="sam"] {
  --color-accent: var(--tenant-sam-accent);
  --color-accent-strong: #005a81;
  --color-accent-soft: #d9ecf5;
  --color-focus-ring: rgba(0, 112, 160, 0.25);
  --tint-accent: rgba(0, 112, 160, 0.12);
}

/* ============================================================================
   Part 2 — Shared component styles (tokens only)
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--fs-14);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* Quiet links (accent budget, DESIGN.md §Color): ink at rest, accent
   only on hover. The accent is rationed to ≤ ~6 deliberate spots/screen. */
a { color: var(--color-text); text-decoration: none; }
a:hover { color: var(--color-accent); text-decoration: underline; }
input[type="checkbox"] { accent-color: var(--color-accent); }

/* Mono is for DATA VALUES ONLY: ids, temps, coords, timestamps, refs. */
.mono { font-family: var(--font-mono); font-size: var(--fs-13); }

/* Label-caps overline — section headers, field labels, table headers. */
.overline {
  font-size: var(--fs-11); font-weight: 600;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--color-text-faint);
}

/* Inline SVG icons (16 / 20 px, stroke = currentColor) */
.icon { flex: 0 0 auto; vertical-align: -3px; }
.icon-tile {
  width: 36px; height: 36px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 36px;
}
.glyph-tile {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--color-surface-2); color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 28px;
}

/* ---- App shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--color-brand-ink);
  color: var(--color-on-dark);
  display: flex; flex-direction: column;
  padding: 20px 12px;
  position: sticky; top: 0; height: 100vh;
}
/* Default (Fresh-IOT) brand row — plain text, byte-identical to
   v0.5-pre-skin. No invented graphic mark: logos are brand assets and are
   never fabricated; any standing UI addition goes to Tina first. */
.sidebar .brand { padding: 0 10px 18px; }
.sidebar .brand .name { font-size: var(--fs-18); font-weight: 700; color: var(--color-on-dark); letter-spacing: 0.01em; }
.sidebar .brand .tagline { font-size: var(--fs-11); text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--color-on-dark-muted); margin-top: 2px; }
/* BTP 360° tenant brand row (Biotempak's platform brand) — white-outline
   logo art (transparent bg) sits directly on the dark sidebar, no tile.
   Only rendered in this tenant state; Fresh-IOT state above is untouched. */
.sidebar .brand.brand-sam .logo-tile { max-width: 168px; }
.sidebar .brand.brand-sam .logo-tile img { display: block; width: 100%; height: auto; }
.sidebar .brand.brand-sam .tagline { margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 2px 0; border-radius: var(--radius-sm);
  color: var(--color-on-dark-muted); font-size: var(--fs-13); font-weight: 500;
}
.nav-item .icon { opacity: 0.9; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.nav-item.active { background: var(--color-accent); color: var(--color-on-accent); transition: background-color 0.25s ease; }
.nav-item.disabled { opacity: 0.45; cursor: not-allowed; }
.nav-item .nav-note { margin-left: auto; font-size: var(--fs-11); opacity: 0.8; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: var(--fs-11); color: var(--color-on-dark-muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: var(--fs-16); font-weight: 600; white-space: nowrap; }
.topbar .search { flex: 1; max-width: 460px; }
.topbar .search input {
  width: 100%; padding: 7px 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-bg);
  font: inherit; font-size: var(--fs-13); color: var(--color-text);
}
.topbar .search input:focus { outline: 2px solid var(--color-focus-ring); border-color: var(--color-accent); }
.topbar .spacer { flex: 1; }
.topbar .user-chip {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--color-surface-3); color: var(--color-text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-11); font-weight: 700;
}
.content { padding: var(--pad-read); max-width: 1440px; width: 100%; margin: 0 auto; }

/* ---- Cards (Tier 2): white, 1px border, 8px radius, NO shadow ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.card .card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px var(--pad); border-bottom: 1px solid var(--color-border);
}
.card .card-head h3 {
  margin: 0; font-size: var(--fs-11); font-weight: 600;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--color-text-faint);
  display: inline-flex; align-items: center; gap: 8px;
}
/* 1.9: optional semantic dot on section titles (Design-ref NEEDS ACTION
   pattern) — color assigned per section via token vars */
.card .card-head h3 .hdot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; display: inline-block; }
.card .card-head .head-aux { margin-left: auto; font-size: var(--fs-12); color: var(--color-text-faint); text-align: right; }
.card .card-body { padding: var(--pad); }
.card .card-body.dense { padding: var(--pad-dense) var(--pad); }
.card .card-body.read { padding: var(--pad-read); }

/* Tier 3: inset well inside a card */
.well {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

/* ---- Page bootstrap states (shared by FreshAPI.boot on every page) ---- */
.content[data-boot-pending] > :not(.boot-state) { display: none; }
.boot-state { display: flex; flex-direction: column; gap: 20px; }
.boot-skeleton-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex; flex-direction: column; gap: 12px;
}
.boot-skeleton-line {
  height: 12px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-2) 25%, var(--color-border) 37%, var(--color-surface-2) 63%);
  background-size: 400% 100%;
  animation: boot-skeleton-shimmer 1.4s ease infinite;
}
@keyframes boot-skeleton-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) { .boot-skeleton-line { animation: none; } }
.boot-error {
  align-items: flex-start; gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--pad);
}
.boot-error-title { font-size: var(--fs-16); font-weight: 600; }
.boot-error-message { margin: 0; font-size: var(--fs-13); color: var(--color-text-muted); }

/* ---- Badges & chips (status chips: pill, tinted bg + colored dot) ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  font-size: var(--fs-12); font-weight: 600; white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 7px; }
.badge-normal { background: var(--tint-normal); color: var(--color-status-normal); }
.badge-expected-offline { background: var(--tint-expected-offline); color: var(--color-status-expected-offline); }
.badge-arriving-soon { background: var(--tint-arriving-soon); color: var(--color-status-arriving-soon); }
.badge-needs-review { background: var(--tint-needs-review); color: var(--color-status-needs-review); }
.badge-critical { background: var(--tint-critical); color: var(--color-severity-critical); }
.badge-warning { background: var(--tint-warning); color: var(--color-severity-warning); }
.badge-info { background: var(--tint-info); color: var(--color-severity-info); }
.badge-neutral { background: var(--color-surface-2); color: var(--color-text-muted); }
.badge-recovered { background: var(--tint-recovered); color: var(--color-recovered); }
/* role/utility chip — neutral: the accent budget excludes decorative chips */
.badge-accent { background: var(--color-surface-2); color: var(--color-text-muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--color-border); border-radius: 999px;
  background: var(--color-surface); color: var(--color-text-muted);
  padding: 3px 12px; font-size: var(--fs-12); font-weight: 500;
}
.tag-src {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  background: var(--color-surface-2); color: var(--color-text-muted);
  font-size: var(--fs-11); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ls-caps);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--fs-13); font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--color-surface-2); }
.btn-primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); transition: background-color 0.25s ease, border-color 0.25s ease; }
.btn-primary:hover { background: var(--color-accent-strong); }
.btn-danger { background: var(--color-severity-critical); border-color: var(--color-severity-critical); color: var(--color-on-accent); }
.btn-sm { padding: 4px 10px; font-size: var(--fs-12); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-link { border: none; background: none; color: var(--color-accent); padding: 0; cursor: pointer; font: inherit; font-size: var(--fs-13); font-weight: 600; }

/* ---- Tables (data-dense: 8px vertical rhythm, 48px rows, hover) ---- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: var(--fs-13);
  background: var(--color-surface);
}
table.data th {
  text-align: left; font-size: var(--fs-11); font-weight: 600;
  text-transform: uppercase; letter-spacing: var(--ls-caps);
  color: var(--color-text-faint);
  padding: var(--pad-dense) 10px; border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-2); white-space: nowrap;
}
table.data td {
  padding: 6px 10px; height: 48px;
  border-bottom: 1px solid var(--color-border); vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tr.row-link { cursor: pointer; }
table.data tr.row-link:hover td { background: var(--color-surface-2); }
.cell-main { font-weight: 500; line-height: 1.35; }
.cell-sub { font-size: var(--fs-11); color: var(--color-text-faint); margin-top: 1px; line-height: 1.35; }
.temp-out { color: var(--color-metric-out); font-weight: 700; }
.cell-commodity { display: flex; align-items: center; gap: 10px; }

/* ---- Forms ---- */
select, input[type="text"] {
  padding: 7px 10px; border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm); background: var(--color-surface);
  font: inherit; font-size: var(--fs-13); color: var(--color-text);
}
select:focus, input[type="text"]:focus { outline: 2px solid var(--color-focus-ring); border-color: var(--color-accent); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-11); text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--color-text-faint); font-weight: 600; }

/* ---- KPI counters (Operations Brief) — contained metric tiles:
        tinted bg + colored icon carry the status; label stays grey caps,
        value large ink. No colored borders (border-as-hierarchy killed). */
.brief-bar { }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi {
  position: relative; display: block; padding: 12px 14px;
  border-radius: var(--radius); border: 1px solid var(--color-border);
  background: var(--color-surface);
  text-decoration: none; color: var(--color-text);
}
.kpi:hover { text-decoration: none; border-color: var(--color-border-strong); }
.kpi .kpi-ic { position: absolute; top: 12px; right: 12px; }
/* 1.9: value bigger + darker (hero numerals carry the tile) */
.kpi .kpi-num { display: block; font-size: var(--fs-32); font-weight: 700; line-height: var(--lh-tight); font-variant-numeric: tabular-nums; color: var(--color-text); }
.kpi .kpi-label { font-size: var(--fs-11); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--color-text-faint); }
.kpi-needs-review { background: var(--tint-needs-review); }
.kpi-needs-review .kpi-ic { color: var(--color-status-needs-review); }
.kpi-expected-offline { background: var(--tint-expected-offline); }
.kpi-expected-offline .kpi-ic { color: var(--color-status-expected-offline); }
.kpi-arriving-soon { background: var(--tint-arriving-soon); }
.kpi-arriving-soon .kpi-ic { color: var(--color-status-arriving-soon); }
.kpi-normal { background: var(--tint-normal); }
.kpi-normal .kpi-ic { color: var(--color-status-normal); }

/* ---- Map & legend ---- */
.map-box { position: relative; background: var(--color-map-water); overflow: hidden; }
.map-box svg { display: block; width: 100%; height: auto; }
.map-note {
  position: absolute; left: 12px; bottom: 12px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 8px 12px; max-width: 320px;
  box-shadow: var(--shadow-card); font-size: var(--fs-12);
}
.legend { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; font-size: var(--fs-12); color: var(--color-text-muted); }
.legend .li { display: inline-flex; align-items: center; gap: 7px; }
.legend svg { display: block; }
.track-map-legend { flex-wrap: nowrap; gap: 10px; min-width: 0; font-size: var(--fs-11); }
.track-map-legend .li { white-space: nowrap; min-width: 0; }
.map-port-label {
  max-width: 180px; padding: 2px 5px; border-radius: 3px;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  color: var(--color-brand-ink); font: 600 var(--fs-10)/1.2 var(--font-ui);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(0,0,0,.12); pointer-events: auto;
}
.fleet-current-marker { position: relative; box-sizing: content-box; }
.fleet-current-arrow {
  position: absolute; left: 4px; top: -9px; width: 8px; height: 11px;
  transform-origin: 4px 17px;
  clip-path: polygon(50% 0, 100% 100%, 50% 76%, 0 100%);
  background: inherit; filter: drop-shadow(0 0 1px var(--color-surface));
  pointer-events: none;
}

/* ---- Real (MapLibre) route map ---- */
.map-box.maplibre-box { height: 360px; }
.map-box.maplibre-box.is-basemap-unavailable,
.map-box.maplibre-box.is-map-fallback { height: 240px; }
.map-basemap-note {
  position: absolute; right: 10px; bottom: 10px; z-index: 3;
  max-width: calc(100% - 20px); padding: 5px 8px;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  box-shadow: var(--shadow-card); color: var(--color-text-muted);
  font-size: var(--fs-11); line-height: 1.35;
}
.map-fallback {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  background: var(--color-map-water); color: var(--color-text-muted);
  font-size: var(--fs-13); text-align: center; padding: 0 24px;
}
.map-popup { font-size: var(--fs-12); line-height: 1.5; }
.map-popup strong { font-weight: 600; }
.maplibregl-popup-content { padding: 8px 10px; border-radius: var(--radius-sm); box-shadow: var(--shadow-card); }

/* ---- Priority action cards ---- */
.pa-card {
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; background: var(--color-surface);
}
.pa-card.sev-CRITICAL { border-left: 3px solid var(--color-severity-critical); }
.pa-card.sev-WARNING { border-left: 3px solid var(--color-severity-warning); }
.pa-card.sev-INFO { border-left: 3px solid var(--color-severity-info); }
.pa-card.sev-GAP { border-left: 3px solid var(--color-status-expected-offline); }
.pa-card .pa-title { font-weight: 600; font-size: var(--fs-13); margin: 6px 0 2px; }
.pa-card .pa-body { font-size: var(--fs-12); color: var(--color-text-muted); }
.pa-card .pa-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.is-pending { opacity: 0.75; }
.pending-note { font-size: var(--fs-12); color: var(--color-text-faint); font-style: italic; }

/* ---- Milestones / timeline ---- */
.mile { display: flex; gap: 12px; padding: var(--pad-dense) 0; border-bottom: 1px solid var(--color-border); align-items: center; }
.mile:first-child { padding-top: 0; }
.mile:last-child { border-bottom: none; padding-bottom: 0; }
.date-badge {
  flex: 0 0 44px; text-align: center; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); padding: 3px 0; background: var(--color-surface-2);
}
.date-badge .d { font-size: var(--fs-16); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.date-badge .m { font-size: var(--fs-11); text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--color-text-faint); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px 32px; }
.timeline li .tl-ic {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
}
.timeline li.tl-alert .tl-ic { background: var(--tint-warning); border-color: var(--color-severity-warning); color: var(--color-severity-warning); }
.timeline li.tl-gap .tl-ic { background: var(--tint-expected-offline); border-color: var(--color-status-expected-offline); color: var(--color-status-expected-offline); }
.timeline li::after {
  content: ""; position: absolute; left: 11px; top: 24px; bottom: -2px;
  width: 1px; background: var(--color-border);
}
.timeline li:last-child::after { display: none; }
.tl-when { font-size: var(--fs-11); color: var(--color-text-faint); font-family: var(--font-mono); }
.tl-what { font-size: var(--fs-13); font-weight: 500; margin: 1px 0; }
.tl-detail { font-size: var(--fs-12); color: var(--color-text-muted); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; overflow-x: auto; }
.tabs button {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; background: none; cursor: pointer; white-space: nowrap;
  padding: 11px 14px; font: inherit; font-size: var(--fs-13); font-weight: 600;
  color: var(--color-text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--color-text); }
.tabs button.active { color: var(--color-accent-strong); border-bottom-color: var(--color-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Shared page-shell pieces (hoisted 2026-07-13, skin batch 1 —
        formerly duplicated per page; zero visual change) ---- */
/* Page list header: h1 + count note + right-side actions */
.list-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.list-head h1 { margin: 0; font-size: var(--fs-22); font-weight: 600; }
/* Quick-filter chip group (status / lifecycle) */
.status-chips { display: inline-flex; gap: 2px; padding: 3px; background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: 999px; flex-wrap: wrap; }
.status-chips button { display: inline-flex; align-items: center; gap: 6px; border: none; background: none; cursor: pointer; padding: 4px 12px; border-radius: 999px; font: inherit; font-size: var(--fs-12); font-weight: 600; color: var(--color-text-muted); }
.status-chips button:hover { color: var(--color-text); }
.status-chips button .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.status-chips button .n { font-variant-numeric: tabular-nums; color: var(--color-text-faint); }
.status-chips button.on { background: var(--color-brand-ink); color: var(--color-on-dark); }
.status-chips button.on .n { color: inherit; opacity: 0.75; }
/* Map legend strip: three-state legend left, honesty note right */
.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 16px; border-top: 1px solid var(--color-border); }

/* Pill sub-tabs (sensor dimensions) */
.subtabs {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.subtabs button {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; cursor: pointer;
  padding: 5px 12px; border-radius: var(--radius-sm);
  font: inherit; font-size: var(--fs-12); font-weight: 600;
  color: var(--color-text-muted);
}
.subtabs button:hover { color: var(--color-text); }
.subtabs button.active { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); padding: 4px 11px; }

/* ---- Sensor device summary strip ---- */
.device-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: var(--pad); }
.device-stat-card { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); padding: 12px 14px; cursor: pointer; }
.device-stat-card:hover { border-color: var(--color-border-strong); }
.device-stat-card.selected { border-color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.device-stat-card .dsc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.device-stat-card .dsc-head .sn { font-family: var(--font-mono); font-size: var(--fs-13); font-weight: 600; }
.device-stat-card .dsc-temp { font-family: var(--font-mono); font-size: var(--fs-28); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.device-stat-card .dsc-temp.out { color: var(--color-metric-out); }
.device-stat-card .dsc-temp .unit { font-size: var(--fs-14); color: var(--color-text-faint); font-weight: 400; }
.device-stat-card .dsc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; margin-top: 10px; }
/* Contained metric tile: label caps + value, on a Tier-3 tint */
.stat { min-width: 0; background: var(--color-surface-2); border-radius: var(--radius-sm); padding: 6px 10px; }
.stat .s-k { font-size: var(--fs-11); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--color-text-faint); }
.stat .s-v { font-size: var(--fs-13); display: flex; align-items: center; gap: 5px; color: var(--color-text); font-weight: 500; margin-top: 2px; }
.stat .s-v .mono { font-size: var(--fs-13); color: var(--color-text); font-weight: 600; }
/* kv grid rendered as contained tiles (device cards) */
.kv.tiles > div { background: var(--color-surface-2); border-radius: var(--radius-sm); padding: var(--pad-dense) 10px; }
.kv.tiles { gap: 6px; }

/* Chart title + caption */
.chart-title { font-size: var(--fs-13); font-weight: 600; margin: 2px 0 10px; display: flex; align-items: center; gap: 8px; }
/* Contained empty state (Tier-3 tint + hairline, never bare floating text) */
.chart-empty { padding: 24px 16px; text-align: center; color: var(--color-text-faint); font-size: var(--fs-13); background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }

/* ---- Alerts list ---- */
.alert-card { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px var(--pad); margin-bottom: 12px; background: var(--color-surface); }
.alert-card .a-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-card .a-title { font-weight: 600; font-size: var(--fs-14); }
.alert-card .a-meta { font-size: var(--fs-12); color: var(--color-text-faint); font-family: var(--font-mono); }
.recovered-note {
  margin: 10px 0; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--color-recovered-bg); color: var(--color-recovered);
  font-size: var(--fs-13); border-left: 3px solid var(--color-recovered);
}

/* Evidence grid — contained metric tiles (tint carries the containment;
   no border — border-as-hierarchy killed), values in mono */
.evidence-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.evidence-grid .ev {
  background: var(--color-surface-2);
  border-radius: var(--radius-sm); padding: var(--pad-dense) 12px;
  font-size: var(--fs-11); font-weight: 600; text-transform: uppercase;
  letter-spacing: var(--ls-caps); color: var(--color-text-faint);
}
.evidence-grid .ev b {
  display: block; margin-top: 2px;
  font-family: var(--font-mono); font-size: var(--fs-13); font-weight: 600;
  text-transform: none; letter-spacing: 0; color: var(--color-text);
}

/* ---- Structured alert hero (workspace status head) ---- */
.alert-hero {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: var(--pad); margin-bottom: 20px;
}
/* severity is carried by the tinted icon tile — no colored border
   (border-as-hierarchy killed, DESIGN.md §Type) */
.alert-hero .ah-row { display: flex; align-items: flex-start; gap: 12px; }
.alert-hero .ah-title { font-size: var(--fs-16); font-weight: 700; line-height: 1.3; }
.alert-hero.sev-CRITICAL .ah-title { color: var(--color-severity-critical); }
.alert-hero.sev-CRITICAL .icon-tile { background: var(--color-severity-critical-bg); color: var(--color-severity-critical); }
.alert-hero.sev-WARNING .ah-title { color: var(--color-severity-warning); }
.alert-hero.sev-WARNING .icon-tile { background: var(--color-severity-warning-bg); color: var(--color-severity-warning); }
.alert-hero .ah-meta { font-size: var(--fs-12); color: var(--color-text-faint); margin-top: 2px; }
.alert-hero .ah-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }

/* ---- Rows: tasks / collaborators / parties (data-dense) ---- */
.task-row { display: flex; gap: 10px; align-items: flex-start; padding: var(--pad-dense) 0; border-bottom: 1px solid var(--color-border); }
.task-row:first-child { padding-top: 0; }
.task-row:last-child { border-bottom: none; padding-bottom: 0; }
.collab-row { display: flex; gap: 10px; align-items: center; padding: var(--pad-dense) 0; border-bottom: 1px solid var(--color-border); }
.collab-row:first-child { padding-top: 0; }
.collab-row:last-child { border-bottom: none; padding-bottom: 0; }
.row-meta { font-size: var(--fs-11); color: var(--color-text-faint); margin-top: 1px; line-height: 1.4; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-surface-3); color: var(--color-text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-11); flex: 0 0 28px;
}
.avatar.av-neutral { background: var(--color-surface-3); color: var(--color-text-muted); }

/* ---- Banner (legacy class kept for compatibility) ---- */
.status-banner { border-radius: var(--radius); padding: var(--pad) 20px; margin-bottom: 20px; border: 1px solid var(--color-border); }
.status-banner.sev-CRITICAL { background: var(--color-severity-critical-bg); border-color: var(--color-severity-critical); }
.status-banner h2 { margin: 0 0 6px; font-size: var(--fs-16); }
.status-banner.sev-CRITICAL h2 { color: var(--color-severity-critical); }

/* ---- Modal & toast (floating overlays keep shadows) ---- */
.modal-scrim { position: fixed; inset: 0; background: var(--color-scrim); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); width: min(480px, 92vw); }
.modal .m-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.modal .m-head h3 { margin: 0; font-size: var(--fs-16); }
.modal .m-head .x { margin-left: auto; }
.modal .m-body { padding: 18px 20px; }
.modal .m-foot { padding: 14px 20px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 10px; }
.share-url {
  font-family: var(--font-mono); font-size: var(--fs-13);
  background: var(--color-surface-2); border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all;
}
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--color-brand-ink); color: var(--color-on-dark);
  padding: 10px 18px; border-radius: 999px; font-size: var(--fs-13);
  box-shadow: var(--shadow-pop); z-index: 200;
}

/* ---- Misc ---- */
.muted { color: var(--color-text-faint); font-size: var(--fs-12); }
.fineprint { font-size: var(--fs-11); color: var(--color-text-faint); line-height: 1.45; }
.grid { display: grid; gap: 20px; }
.hr { border: none; border-top: 1px solid var(--color-border); margin: 14px 0; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--pad-dense) 20px; }
.kv .k { font-size: var(--fs-11); text-transform: uppercase; letter-spacing: var(--ls-caps); color: var(--color-text-faint); font-weight: 600; margin-bottom: 1px; }
/* 1.9 parameter hierarchy: small quiet label, value bigger + darker */
.kv .v { font-size: var(--fs-14); font-weight: 500; color: var(--color-text); }
.kv .v .mono, .kv .v.mono { font-weight: 600; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw);
  background: var(--color-surface); border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-pop); z-index: 60; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.25s ease;
}
.drawer.open { transform: translateX(0); }
.drawer .d-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--color-border); }
.drawer .d-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer .d-foot { padding: 14px 18px; border-top: 1px solid var(--color-border); }
/* ---- Tenant demo control (§7B) — floating chrome, demo-only. The panel
        and button are overlays, so shadows are allowed per the craft rules. */
.tenant-demo {
  position: fixed; right: 24px; bottom: 24px; z-index: 50;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.tenant-demo .td-fab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--fs-13); font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-pop);
}
.tenant-demo .td-fab:hover { border-color: var(--color-accent); color: var(--color-accent-strong); }
.tenant-demo .td-fab .swatch {
  width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px;
  background: var(--color-accent); transition: background-color 0.25s ease;
}
.tenant-demo .td-panel {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  padding: 10px; width: 250px;
}
.tenant-demo .td-title {
  font-size: var(--fs-11); font-weight: 600; text-transform: uppercase;
  letter-spacing: var(--ls-caps); color: var(--color-text-faint);
  padding: 2px 8px 8px;
}
.tenant-demo .td-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: none; cursor: pointer; text-align: left;
  padding: 8px; border-radius: var(--radius-sm);
  font: inherit; font-size: var(--fs-13); font-weight: 600; color: var(--color-text);
}
.tenant-demo .td-opt:hover { background: var(--color-surface-2); }
.tenant-demo .td-opt .swatch {
  width: 20px; height: 20px; border-radius: 6px; flex: 0 0 20px;
  color: var(--color-on-accent); font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.tenant-demo .td-opt[data-tenant="fresh"] .swatch { background: var(--tenant-fresh-accent); }
.tenant-demo .td-opt[data-tenant="sam"] .swatch { background: var(--tenant-sam-accent); }
.tenant-demo .td-opt .sub { display: block; font-size: var(--fs-11); font-weight: 400; color: var(--color-text-faint); }
.tenant-demo .td-opt .tick { margin-left: auto; color: var(--color-accent); visibility: hidden; }
.tenant-demo .td-opt.on .tick { visibility: visible; }

.battery { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: var(--fs-12); color: var(--color-text-muted); }
.battery svg { display: block; }
.battery.batt-warn { color: var(--color-batt-warn); }
.battery.batt-crit { color: var(--color-severity-critical); }
.signal { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--color-text-muted); }
.signal svg { display: block; }
.signal.sig-strong { color: var(--color-status-normal); }
.signal.sig-weak { color: var(--color-batt-warn); }

/* ---- Authentication pages ---- */
body.auth-page { margin: 0; min-width: 0; min-height: 100vh; background: var(--color-bg); }
.auth-page *, .auth-page *::before, .auth-page *::after { box-sizing: border-box; }
.auth-page [hidden] { display: none !important; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 44%) minmax(0, 1fr); }
.auth-brand {
  position: relative; overflow: hidden; min-width: 0;
  padding: clamp(36px, 5vw, 64px); background: var(--color-brand-ink); color: var(--color-on-dark);
  display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
}
.auth-brand::after {
  content: ''; position: absolute; right: -18%; bottom: -16%; width: 72%; height: 46%;
  background: radial-gradient(ellipse at center, var(--color-accent) 0%, transparent 72%);
  opacity: .16; pointer-events: none;
}
.auth-brand-top, .auth-brand-copy, .auth-brand-meta { position: relative; z-index: 1; }
.auth-brand-top { display: grid; gap: 10px; }
.auth-brand-name { color: var(--color-on-dark); font-size: 30px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; text-decoration: none; }
.auth-brand-name:hover { color: var(--color-on-dark); text-decoration: none; }
.auth-eyebrow {
  color: var(--color-accent); font-size: var(--fs-11); font-weight: 700;
  letter-spacing: var(--ls-caps); text-transform: uppercase; margin: 0;
  padding-bottom: 10px; border-bottom: 2px solid var(--color-accent); width: max-content;
}
.auth-brand-copy { max-width: 520px; }
.auth-brand-copy h1 {
  color: var(--color-on-dark); font-size: clamp(28px, 3.1vw, 40px);
  line-height: 1.18; letter-spacing: -0.035em; margin: 0 0 28px;
}
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.auth-points li {
  display: flex; align-items: center; gap: 12px;
  color: var(--color-on-dark); font-size: var(--fs-14); line-height: 22px;
}
.auth-point-icon {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-accent); color: var(--color-on-accent);
  display: grid; place-items: center;
}
.auth-point-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-brand-foot { color: var(--color-on-dark-muted); font-size: var(--fs-11); margin: 0; }
.auth-brand-meta { display: grid; gap: 16px; max-width: 420px; }
.auth-shared-note { margin: 0; color: var(--color-on-dark-muted); font-size: var(--fs-12); line-height: 1.5; }
.auth-brand-contacts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 0; }
.auth-brand-contacts a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--color-on-dark); font-size: var(--fs-13); font-weight: 600; text-decoration: none;
}
.auth-brand-contacts a + a { margin-left: 16px; padding-left: 16px; border-left: 1px solid var(--color-on-dark-muted); }
.auth-brand-contacts a:hover { text-decoration: underline; }
.auth-brand-contacts svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-fresheye { display: inline-flex; align-items: center; gap: 14px; color: var(--color-on-dark); text-decoration: none; }
.auth-fresheye img { display: block; width: 92px; height: 92px; background: var(--color-surface); border-radius: 8px; padding: 6px; }
.auth-fresheye-label {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--color-on-dark); font-size: var(--fs-13); font-weight: 600; line-height: 1.35;
}
.auth-fresheye-label svg { flex: 0 0 16px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-panel { position: relative; min-width: 0; background: var(--color-surface); display: flex; align-items: center; justify-content: center; padding: 88px clamp(28px, 7vw, 104px) 52px; }
.auth-panel-scroll { align-items: flex-start; overflow-y: auto; }
.auth-locale { position: absolute; top: 28px; right: 32px; display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface-2); }
.auth-locale button { border: 0; border-radius: 4px; background: transparent; color: var(--color-text-faint); font: inherit; font-size: var(--fs-11); font-weight: 600; padding: 5px 8px; cursor: pointer; }
.auth-locale button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-accent-strong); }
.auth-locale button:focus-visible { outline: 2px solid var(--color-focus-ring); }
.auth-form-wrap { width: min(100%, 440px); margin: auto; }
.auth-form-wrap-wide { width: min(100%, 560px); padding: 18px 0; }
.auth-heading { margin-bottom: 28px; }
.auth-heading h2 { margin: 0 0 9px; color: var(--color-text); font-size: clamp(28px, 3vw, 36px); line-height: 1.15; letter-spacing: -0.035em; }
.auth-heading p { margin: 0; color: var(--color-text-muted); font-size: var(--fs-14); line-height: 1.55; }
.auth-form { display: grid; gap: 17px; }
.auth-field { display: grid; gap: 7px; min-width: 0; color: var(--color-text); font-size: var(--fs-12); font-weight: 600; }
.auth-field input, .auth-field select {
  width: 100%; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); font: inherit; font-size: var(--fs-14);
}
.auth-field input[readonly] { background: var(--color-surface-2); color: var(--color-text-muted); }
.auth-field input:focus, .auth-field select:focus { outline: 2px solid var(--color-focus-ring); border-color: var(--color-accent); }
.auth-field input::placeholder { color: var(--color-text-faint); }
.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 44px; }
.auth-password-toggle {
  position: absolute; top: 0; right: 0; width: 44px; height: 44px;
  border: 0; background: transparent; color: var(--color-text-faint);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.auth-password-toggle:hover, .auth-password-toggle[aria-pressed="true"] { color: var(--color-accent-strong); }
.auth-password-toggle:focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: -4px; border-radius: var(--radius-sm); }
.auth-password-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.auth-form-row { display: flex; align-items: center; gap: 12px; }
.auth-form-row-end { justify-content: flex-end; margin-top: -3px; }
.auth-form-row-split { justify-content: space-between; margin-top: -2px; }
.auth-remember { margin: 0; color: var(--color-text-muted); font-size: var(--fs-12); font-weight: 500; }
.auth-form a, .auth-switch a, .auth-state a { color: var(--color-accent-strong); font-weight: 600; }
.auth-check { display: flex; align-items: flex-start; gap: 9px; color: var(--color-text-muted); font-size: var(--fs-12); line-height: 1.5; }
.auth-check input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--color-accent); }
.auth-hint { color: var(--color-text-faint); font-size: var(--fs-11); line-height: 1.5; margin: -8px 0 0; }
.auth-submit { width: 100%; min-height: 44px; justify-content: center; margin-top: 2px; }
.auth-submit:disabled { opacity: .62; cursor: wait; }
.auth-switch { color: var(--color-text-muted); font-size: var(--fs-13); text-align: center; margin: 24px 0 0; }
.auth-alert { border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: var(--fs-12); line-height: 1.5; margin-bottom: 18px; }
.auth-alert[hidden] { display: none; }
.auth-alert-error { color: var(--color-severity-critical); border-color: var(--color-severity-critical); background: var(--color-severity-critical-bg); margin: 0; }
.auth-alert-success { color: var(--color-evidence-strong); border-color: var(--color-evidence-strong); background: var(--color-status-normal-bg); }
.auth-alert-info { color: var(--color-status-arriving-soon); border-color: var(--color-status-arriving-soon); background: var(--color-status-arriving-soon-bg); }
.auth-state { text-align: center; }
.auth-state[hidden] { display: none; }
.auth-state-icon { width: 42px; height: 42px; margin: 0 auto 16px; border-radius: 50%; background: var(--color-status-normal-bg); color: var(--color-evidence-strong); display: grid; place-items: center; font-weight: 700; }
.auth-state h3 { font-size: 24px; margin: 0 0 10px; }
.auth-state p { color: var(--color-text-muted); line-height: 1.55; margin: 0 0 12px; }
.auth-state .auth-submit { margin-top: 14px; }

@media (max-width: 720px) {
  .auth-shell { display: block; min-height: 100vh; }
  .auth-brand { min-height: 176px; padding: 25px 24px 27px; gap: 28px; }
  .auth-brand-name { font-size: 24px; }
  .auth-brand-copy h1 { font-size: 22px; line-height: 1.2; margin: 0; }
  .auth-points { display: none; }
  .auth-brand-meta { max-width: none; grid-template-columns: 1fr auto; gap: 12px 16px; align-items: center; }
  .auth-shared-note { grid-column: 1 / -1; }
  .auth-fresheye img { width: 64px; height: 64px; }
  .auth-panel, .auth-panel-scroll { min-height: calc(100vh - 176px); overflow: visible; align-items: flex-start; padding: 82px 20px 40px; }
  .auth-locale { top: 22px; right: 20px; }
  .auth-form-wrap, .auth-form-wrap-wide { width: 100%; max-width: 500px; padding: 0; margin: 0 auto; }
  .auth-grid-2 { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pagination .pg-info { margin-right: 8px; color: var(--color-text-muted); font-size: var(--fs-12); font-family: var(--font-mono); }
.pagination .pg-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text-muted);
  font: 600 var(--fs-12) var(--font-ui); cursor: pointer; transition: border-color .12s, color .12s, background .12s;
}
.pagination .pg-btn:hover:not(:disabled):not(.on) { border-color: var(--color-accent); color: var(--color-accent-strong); }
.pagination .pg-btn.on { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.pagination .pg-btn:disabled { opacity: .4; cursor: not-allowed; }
