/* Shineon design tokens, shared with light-gateway's console (web/src/theme.css
   there): deep ink with the shineon.dev neon (#a6f511) in the dark, the darker
   olive in daylight because the neon fails contrast on white. Status colours
   are reserved for state. */
:root {
  color-scheme: light;
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --neon: #a6f511;
  --page: #f8faf5; --surface: #ffffff;
  --ink: #1a222b; --ink-2: #55616e; --muted: #7b8794;
  --grid: #e4e8dd; --border: rgba(10, 15, 20, 0.10); --track: #e4e8dd;
  --accent: #4d7c0f; --accent-contrast: #ffffff; --accent-soft: rgba(101, 163, 13, 0.10);
  --series-2: #2563eb;
  --warning: #a16207; --critical: #c62f2f;
  --glow: radial-gradient(58% 46% at 50% 0%, rgba(166, 245, 17, 0.13), transparent 72%);
  --shadow: 0 1px 2px rgba(10, 15, 20, 0.04), 0 4px 16px rgba(10, 15, 20, 0.05);
  --shadow-pop: 0 6px 24px rgba(10, 15, 20, 0.16);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%237b8794' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0a0f14; --surface: #101821;
    --ink: #e8edf2; --ink-2: #94a3b8; --muted: #64748b;
    --grid: #1e2a35; --border: rgba(255, 255, 255, 0.10); --track: #1e2a35;
    --accent: #a6f511; --accent-contrast: #0a0f14; --accent-soft: rgba(166, 245, 17, 0.08);
    --series-2: #60a5fa;
    --warning: #facc15; --critical: #f87171;
    --glow: radial-gradient(58% 46% at 50% 0%, rgba(166, 245, 17, 0.11), transparent 72%);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 8px 28px rgba(0, 0, 0, 0.55);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; -webkit-font-smoothing: antialiased; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: 60vh;
  background: var(--glow); pointer-events: none; z-index: 0;
}
body > * { position: relative; z-index: 1; }
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }
a { color: var(--accent); }
code { font-family: var(--mono); }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 24px 72px; }

/* ---- header: flush at rest, a frosted floating capsule once scrolled ---- */
.topbar {
  position: sticky; top: 10px; z-index: 30;
  margin: 10px auto 22px; max-width: 100%; height: 52px; display: flex; align-items: center;
  transition: max-width 0.7s var(--ease);
}
.topbar-inner {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 52px; padding: 0 8px; border-radius: var(--r-pill); border: 1px solid transparent;
  transition: height 0.7s var(--ease), padding 0.7s var(--ease), background 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.topbar.floating { max-width: 832px; }
.topbar.floating .topbar-inner {
  height: 48px; padding: 0 6px 0 16px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-color: var(--border); box-shadow: var(--shadow-pop);
}
@supports not (backdrop-filter: blur(1px)) { .topbar.floating .topbar-inner { background: var(--surface); } }
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; color: var(--ink); text-decoration: none; min-width: 0; }
.brand .mark { width: 26px; height: 26px; flex: none; display: block; transition: transform 0.3s; }
.topbar-inner:hover .brand .mark { transform: scale(1.05); }
.brand .crumb { color: var(--muted); font-weight: 400; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }

/* How old the numbers are: a dot that carries the state and the age beside it. */
.fresh {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface);
  font-size: 12.5px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.topbar.floating .fresh { background: transparent; }
.fresh .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.fresh.ok .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulse 2.4s ease-in-out infinite; }
.fresh.warn { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.fresh.warn .dot { background: var(--warning); }
.fresh.crit { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.fresh.crit .dot { background: var(--critical); }
.fresh.busy .dot { background: var(--accent); animation: blink 0.9s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; } }

/* ---- type ---- */
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; margin: 0;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2);
  padding: 4px 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border);
}
.sub { color: var(--ink-2); margin: 0 0 22px; font-size: 13px; }
.dim { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---- buttons: pills, the solid one is the ghost one filled in ---- */
button {
  font: inherit; font-size: 13px; font-weight: 600; border: 0; border-radius: var(--r-pill); cursor: pointer;
  padding: 7px 16px; line-height: 1.4; background: var(--accent); color: var(--accent-contrast);
  transition: filter 0.15s, background 0.12s, color 0.12s, border-color 0.12s, transform 0.05s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled, button:disabled:hover { background: var(--track); color: var(--muted); cursor: not-allowed; filter: none; transform: none; }
button.ghost { background: transparent; color: var(--ink-2); font-weight: 500; padding: 6px 15px; border: 1px solid var(--border); }
button.ghost:hover { color: var(--accent); border-color: var(--accent); filter: none; }
button.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; padding: 0; background: transparent; color: var(--ink-2); border: 1px solid var(--border);
}
button.icon-btn:hover { color: var(--accent); border-color: var(--accent); filter: none; }
button.icon-btn svg { width: 15px; height: 15px; display: block; }
.icon-btn.turning svg, .sample-btn.turning svg { animation: turn 0.8s linear infinite; }
.sample-btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 16px 0 13px; }
.sample-btn svg { width: 14px; height: 14px; display: block; }

/* page tabs: the segmented pill, holding links (each tab is its own URL) */
.seg a { white-space: nowrap; padding: 5px 15px; border-radius: var(--r-pill); color: var(--ink-2); font-weight: 500; font-size: 13px; text-decoration: none; transition: background 0.12s, color 0.12s; }
.seg a:hover { color: var(--ink); background: var(--accent-soft); }
.seg a[aria-selected="true"], .seg a[aria-selected="true"]:hover { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.topbar.floating .seg.tabs { background: transparent; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { margin: 0; }
.sample-ctl { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.refreshing tbody { opacity: 0.5; transition: opacity 0.2s; }
.empty-row .empty-msg { margin-bottom: 12px; }
.empty-row .primary { padding: 9px 22px; }
@keyframes turn { to { transform: rotate(360deg); } }

/* segmented: one pill, the chosen segment filled */
.seg { display: inline-flex; max-width: 100%; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--page); border: 1px solid var(--grid); }
.seg button { white-space: nowrap; padding: 5px 13px; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 12.5px; }
.seg button:hover { filter: none; color: var(--ink); background: var(--accent-soft); }
.seg button[aria-checked="true"], .seg button[aria-checked="true"]:hover { background: var(--accent); color: var(--accent-contrast); font-weight: 600; }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.card.tight { padding: 0; overflow: clip; }
.card.warn {
  position: relative; overflow: hidden; padding: 12px 16px 12px 22px; margin-bottom: 18px; font-size: 13px;
  border-color: color-mix(in srgb, var(--critical) 26%, var(--border));
  background: color-mix(in srgb, var(--critical) 5%, var(--surface));
}
.card.warn::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--critical); }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 18px 15px; box-shadow: var(--shadow); min-width: 0; transition: border-color 0.2s, box-shadow 0.2s;
}
.tile:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: var(--shadow), 0 0 32px color-mix(in srgb, var(--neon) 9%, transparent); }
.tile .label { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }
.tile .value { font-size: 29px; font-weight: 700; letter-spacing: -0.025em; margin-top: 4px; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile .value small { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.tile .note { color: var(--muted); font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .note code { font-size: 12px; color: var(--ink-2); }
.tile.peak .value { color: var(--accent); }

.section-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; min-height: 38px; }

/* ---- the model table ---- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 12px 12px 9px; border-bottom: 1px solid var(--grid); white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; font-size: 13px; }
td:first-child, th:first-child { padding-left: 18px; }
td:last-child, th:last-child { padding-right: 18px; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.trend { width: 200px; }

tr.grp td {
  padding-top: 14px; padding-bottom: 8px; background: color-mix(in srgb, var(--page) 55%, transparent);
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
}
tr.grp .count { margin-left: 8px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--track); color: var(--ink-2); font-size: 11px; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }

tr.model { cursor: pointer; transition: background 0.08s; }
tr.model:hover { background: var(--accent-soft); }
tr.model.open > td { border-bottom-color: transparent; }
.name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name .chev { width: 12px; height: 12px; flex: none; color: var(--muted); transition: transform 0.15s; }
tr.model.open .chev { transform: rotate(90deg); }
.name code { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.name .dim { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.metric { font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
tr.zero .metric { color: var(--muted); font-weight: 400; }
tr.zero code { color: var(--ink-2); font-weight: 500; }
.err-text { color: var(--critical); font-size: 12px; white-space: normal; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; white-space: nowrap; padding: 2px 10px; border-radius: var(--r-pill); color: var(--muted); border: 1px solid var(--border); }
.badge.active { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge.error { color: var(--critical); background: color-mix(in srgb, var(--critical) 9%, transparent); border-color: transparent; }

.empty-row td { text-align: center; color: var(--muted); padding: 28px 12px; }
.foot { padding: 11px 18px; border-top: 1px solid var(--grid); font-size: 12px; color: var(--muted); }

/* ---- sparkline + the expanded chart ---- */
.spark { display: block; width: 176px; height: 30px; overflow: visible; touch-action: pan-y; }
.spark .area { fill: var(--accent-soft); }
.spark .line, .chart .line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark .peak, .chart .peak { fill: var(--accent); }
.spark .guide, .chart .guide { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.spark .cursor, .chart .cursor { fill: var(--surface); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark.flat .line, .chart.flat .line { stroke: var(--muted); opacity: 0.5; }
.spark.flat .area, .chart.flat .area { fill: none; }
.spark .dot, .chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1.4; }
.chart.rpm .dot { stroke: var(--series-2); }
.spark.flat .dot, .chart.flat .dot { stroke: var(--muted); }
.spark-none { color: var(--muted); font-size: 12px; }

tr.expansion > td { padding: 2px 18px 18px; background: color-mix(in srgb, var(--page) 55%, transparent); cursor: default; }
.detail { display: grid; gap: 14px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-box { background: var(--surface); border: 1px solid var(--grid); border-radius: var(--r-md); padding: 12px 14px 8px; min-width: 0; }
.chart-box .chart-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chart-box .chart-head b { color: var(--ink); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.chart-box .chart-head .spacer { flex: 1; }
.chart-box .chart-head em { font-style: normal; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart { display: block; width: 100%; height: 132px; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .area { fill: var(--accent-soft); }
.chart.rpm .line { stroke: var(--series-2); }
.chart.rpm .area { fill: color-mix(in srgb, var(--series-2) 10%, transparent); }
.chart.rpm .peak { fill: var(--series-2); }
.chart.rpm .cursor { stroke: var(--series-2); }
.sites { width: 100%; background: var(--surface); border: 1px solid var(--grid); border-radius: var(--r-md); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.sites th { padding: 8px 12px 6px; }
.sites td { padding: 7px 12px; font-size: 12.5px; }

.tooltip {
  position: fixed; z-index: 70; pointer-events: none; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 9px 12px; font-size: 12px; box-shadow: var(--shadow-pop);
}
.tooltip b { display: block; margin-bottom: 4px; font-size: 12px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 18px; color: var(--ink-2); line-height: 1.7; }
.tooltip .row em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.tooltip .row i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--accent); }
.tooltip .row i.rpm { background: var(--series-2); }

/* ---- export form ---- */
label { display: block; color: var(--ink-2); font-size: 13px; font-weight: 500; margin: 14px 0 5px; }
label:first-of-type { margin-top: 0; }
label small { color: var(--muted); font-weight: 400; margin-left: 4px; }
input, select {
  width: 100%; padding: 9px 12px; min-height: 40px; border: 1px solid var(--grid); border-radius: var(--r-md);
  background: var(--page); color: var(--ink); font: inherit; transition: border-color 0.12s, box-shadow 0.12s;
}
/* The native arrow differs per browser and sits jammed against the edge; draw our own chevron. */
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 38px; background-image: var(--chev); background-repeat: no-repeat;
  background-position: right 14px center; background-size: 14px 14px;
}
select:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--grid)); }
optgroup { color: var(--muted); font-style: normal; font-weight: 600; }
option { color: var(--ink); background: var(--surface); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.quick { margin-top: 12px; display: flex; }
.quick .seg { width: 100%; }
.quick .seg button { flex: 1; }
.export-card .primary { width: 100%; margin-top: 18px; padding: 10px 16px; font-size: 14px; }
.export-page { max-width: 640px; margin: 0 auto; }
.export-page h1, .export-page > .sub { text-align: center; }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.range label { margin-top: 14px; }
.facts dt.sub-item, .facts dd.sub-item { color: var(--ink-2); font-size: 12.5px; }
.facts dt.sub-item { font-family: var(--mono); padding-left: 10px; }
.progress { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--grid); font-size: 13px; }
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-head .msg { min-width: 0; overflow-wrap: anywhere; }
.progress-head .ghost { flex: none; padding: 4px 14px; font-size: 12.5px; }
.progress-head .ghost:hover { color: var(--critical); border-color: var(--critical); }
.progress .msg.warn { color: var(--critical); }
.progress-bar { height: 3px; border-radius: var(--r-pill); background: var(--track); overflow: hidden; margin: 10px 0 2px; }
.progress-bar > i { display: block; width: 38%; height: 100%; border-radius: var(--r-pill); background: var(--accent); animation: sweep 1.1s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
@keyframes sweep { from { transform: translateX(-110%); } to { transform: translateX(375%); } }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.facts .warn { color: var(--critical); }
a.download {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--accent); color: var(--accent); font-weight: 600; text-decoration: none; font-size: 13px; overflow-wrap: anywhere; text-align: center;
}
a.download:hover { background: var(--accent-soft); }

/* ---- landing page ---- */
.index { max-width: 640px; margin: 0 auto; }
.supplier-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.supplier-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font-weight: 600; transition: border-color 0.2s; }
.supplier-list a:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.supplier-list code { color: var(--muted); font-size: 12px; font-weight: 400; }

/* ---- dialog (models editor) ---- */
dialog.modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
}
dialog.modal[open] { display: flex; flex-direction: column; animation: rise 0.14s cubic-bezier(0.2, 0.8, 0.3, 1); }
dialog.modal::backdrop { background: rgba(10, 15, 20, 0.55); backdrop-filter: blur(2px); }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.modal-head { padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.modal-head p { margin: 6px 0 0; color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.modal-head code { font-size: 12px; padding: 1px 6px; border-radius: var(--r-xs); background: var(--track); color: var(--ink); }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
textarea {
  width: 100%; min-height: 300px; resize: vertical; padding: 12px 14px; border: 1px solid var(--grid); border-radius: var(--r-md);
  background: var(--page); color: var(--ink); font: 13px/1.6 var(--mono); tab-size: 2;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.models-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.models-preview b { font-weight: 600; margin-right: 4px; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 1px 10px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.chip em { font-style: normal; color: var(--muted); margin-left: 3px; font-variant-numeric: tabular-nums; }
.err { color: var(--critical); font-size: 13px; margin-top: 8px; }
.err:empty { display: none; }
.section-head button.ghost { padding: 4px 13px; font-size: 12.5px; }

/* ---- sign-in ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 380px; max-width: 100%; padding: 30px 30px 28px; }
.login-card .brand { margin-bottom: 22px; }
.login-card h1 { font-size: 19px; }
.login-card .sub { margin-bottom: 18px; }
.login-card .primary { width: 100%; margin-top: 18px; padding: 10px; font-size: 14px; }
.session { display: inline-flex; align-items: center; gap: 8px; margin-left: 4px; }
.session .who {
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; color: var(--ink-2); padding: 0 2px 0 8px; border-left: 1px solid var(--grid);
}
.session .logout { height: 32px; padding: 0 13px; font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
  .topbar, .topbar-inner, .brand .mark { transition: none; }
  .fresh.ok .dot, .icon-btn.turning svg { animation: none; }
  .progress-bar > i { animation: none; width: 100%; opacity: 0.55; }
}

input, select, button { font-size: 16px; } /* >=16px stops iOS zoom-on-focus */
@media (hover: hover) and (pointer: fine) { input, select { font-size: 14px; } button { font-size: 13px; } .seg button { font-size: 12.5px; } }

@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) { .charts { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .wrap { padding: 0 14px calc(48px + env(safe-area-inset-bottom)); }
  .topbar { top: calc(6px + env(safe-area-inset-top)); margin-top: 6px; }
  .topbar.floating { max-width: 100%; }
  .topbar.floating .topbar-inner { padding: 0 6px 0 12px; }
  .brand .crumb .full, .brand .word { display: none; }
  .fresh { padding: 0 10px; }
  h1 { font-size: 20px; }
  .sub { margin-bottom: 16px; }
  .tiles { gap: 10px; margin-bottom: 20px; }
  .tile { padding: 12px 14px; }
  .tile .value { font-size: 23px; }
  .section-head .spacer { display: none; }

  /* table -> one card-row per model: name across the top, TPM / RPM / trend below */
  .models thead { display: none; }
  .models, .models tbody { display: block; }
  .models tr.grp, .models tr.empty-row { display: block; }
  .models tr.grp td, .models tr.empty-row td { display: block; padding-left: 14px; }
  .models tr.model {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 6px 12px;
    padding: 11px 14px; border-bottom: 1px solid var(--grid); align-items: end;
  }
  .models tr.model.open { border-bottom-color: transparent; }
  .models tr.model td { display: block; padding: 0; border: 0; min-width: 0; }
  .models tr.model td.c-name { grid-column: 1 / 3; grid-row: 1; }
  .models tr.model td.c-state { grid-column: 3; grid-row: 1; text-align: right; align-self: start; }
  .models tr.model td.c-tpm { grid-column: 1; grid-row: 2; text-align: left; }
  .models tr.model td.c-rpm { grid-column: 2; grid-row: 2; text-align: left; }
  .models tr.model td.c-trend { grid-column: 3; grid-row: 2; }
  .models td.c-tpm::before, .models td.c-rpm::before { display: block; font: 600 10px/1.6 ui-sans-serif, system-ui, sans-serif; letter-spacing: 0.06em; color: var(--muted); }
  .models td.c-tpm::before { content: "TPM"; }
  .models td.c-rpm::before { content: "RPM"; }
  .models .metric { font-size: 15px; }
  .models .name .dim { max-width: none; }
  .models .name code { white-space: normal; overflow-wrap: anywhere; }
  .spark { width: 100%; }
  /* A model with no usage is one line: its zeros and flat trend say nothing the badge does not. */
  .models tr.model.zero { align-items: center; }
  .models tr.model.zero td.c-tpm, .models tr.model.zero td.c-rpm, .models tr.model.zero td.c-trend { display: none; }
  .models tr.model.zero td.c-state { align-self: center; }
  .sites .c-id { display: none; }
  .sites td:first-child { white-space: nowrap; }
  .models tr.expansion { display: block; border-bottom: 1px solid var(--grid); }
  .models tr.expansion > td { display: block; padding: 0 14px 14px; border: 0; }
  .sites th:first-child, .sites td:first-child { padding-left: 10px; }
  .export-card { padding: 16px; }
  .range { grid-template-columns: 1fr; }
  .page-head { margin-bottom: 16px; }
  .sample-ctl { width: 100%; justify-content: space-between; }
  .seg a { padding: 5px 11px; }
  .session .who { display: none; }
}
