/* Threecore console. Lifted from design/01, 04 and 05 (their <style> blocks plus the
   repeated inline styles), merged and deduplicated. Tokens from brief §3. */

:root {
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;

  --ink: #0f1720;
  --ink-68: rgba(15, 23, 32, 0.68);
  --ink-46: rgba(15, 23, 32, 0.46);
  --line: rgba(15, 23, 32, 0.10);
  --line-strong: rgba(15, 23, 32, 0.20);
  --bg: #f6f6f4;
  --bg-active: #f0f0ee;
  --topbar-bg: rgba(246, 248, 249, 0.88);
  --card: #ffffff;

  --green: #0f8a5f;
  --green-dark: #0b6b4a;
  --red: #c2452f;
  --red-soft: rgba(194, 69, 47, 0.08);
  --amber: #b8791a;
  --amber-ink: #8a5a10;
  --amber-soft: rgba(184, 121, 26, 0.14);
  --blue: #2f63c9;

  --radius-card: 10px;
  --radius-control: 8px;
  --sidebar-width: 216px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }

/* Brand mark */
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 600; font-size: 16px; letter-spacing: -0.01em;
  color: var(--ink);
}
.brand svg .sq { fill: var(--ink); }
.brand svg .sq-open { fill: none; stroke: var(--line-strong); stroke-width: 1; }

.muted { color: var(--ink-46); }
.small { font-size: 12.5px; }

/* App shell: sidebar + main */
.shell { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar {
  width: var(--sidebar-width); flex: 0 0 var(--sidebar-width);
  border-right: 1px solid var(--line); padding: 18px 16px;
  display: flex; flex-direction: column; gap: 28px; background: var(--card);
  /* The window's height and still while the page scrolls; scrolls inside if ever taller. */
  position: sticky; top: 0; height: 100vh; overflow-y: auto; align-self: flex-start;
}
.sidebar .brand { padding: 2px 8px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: 12px; color: var(--ink-46); padding: 0 8px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; padding: 8px;
  border-radius: var(--radius-control); border: 1px solid transparent; color: var(--ink-68);
}
.nav-item:hover { color: var(--ink); }
.nav-item .icon { display: flex; color: var(--ink-46); }
.nav-item.active { background: var(--bg-active); border-color: var(--line); color: var(--ink); }
.nav-item.active .icon { color: var(--green); }
.icon svg, svg.icon { width: 14px; height: 14px; flex: 0 0 auto; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 8px; }
.role { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-68); }
.role .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.account-name { font-size: 12.5px; color: var(--ink); }
.account-email { font-size: 12px; color: var(--ink-46); overflow-wrap: anywhere; }
.signout { margin: 4px 0 0; }
.signout .btn { margin-left: -8px; color: var(--ink-46); }
.signout .btn:hover { color: var(--ink); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 32px; border-bottom: 1px solid var(--line); background: var(--topbar-bg);
}
.topbar-title {
  font-family: var(--font-head); font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar-controls { display: flex; align-items: center; gap: 16px; }
.content { padding: 28px 32px 44px; display: flex; flex-direction: column; gap: 20px; }

.badge-admin {
  font-family: var(--font-body); font-size: 11.5px; font-weight: 500; color: var(--amber-ink);
  background: var(--amber-soft); padding: 3px 8px; border-radius: 6px;
  vertical-align: middle; margin-left: 8px;
}

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); }

/* Controls. The one set of control styles every page uses: no browser-default controls.
   Buttons   .btn + .btn-primary | .btn-secondary | .btn-ghost; sizes .btn-sm (28px),
             default (32px), .btn-md (36px), .btn-lg (44px); .btn-icon (square), .btn-block.
             .active / aria-current / aria-expanded="true" mark the selected secondary button.
   Groups    .segmented: a row of .btn, joined into one segmented control at phone width.
   Inputs    .input (text, password, date); .input-lg for sign-in.
   Selects   .select; .select-labelled wraps a <label> and a .select in one box.
   Choice    .checkbox; .toggle (a switch: .toggle-track + .toggle-knob, aria-checked).
   Focus     one ring for everything, :focus-visible, green at reduced opacity.
   Override the --control-* variables on a container to resize a group (see .switcher). */
:root {
  --control-h-sm: 28px;
  --control-h: 32px;
  --control-h-md: 36px;
  --control-h-lg: 44px;
  --control-pad-x: 12px;
  --control-radius: var(--radius-control);
  --control-font-size: 13px;
  --control-bg: var(--card);
  --control-bg-hover: var(--bg-active);
  --control-border: var(--line);
  --control-border-hover: var(--line-strong);
  --control-ink: var(--ink);
  --control-ink-soft: var(--ink-68);
  --focus-ring-color: rgba(15, 138, 95, 0.5);
  --focus-ring: 0 0 0 3px rgba(15, 138, 95, 0.22);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%230f1720' stroke-opacity='0.46' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5 6 7.5l3-3'/%3E%3C/svg%3E");
  --calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%230f1720' stroke-opacity='0.46' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='3.5' width='11' height='10' rx='1.5'/%3E%3Cpath d='M2.5 6.5h11M5.5 2v3M10.5 2v3'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5'/%3E%3C/svg%3E");
}

/* Focus: the browser outline is replaced, never just removed. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus { outline: none; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring-color); outline-offset: 2px;
}
:where(.input, .select, .checkbox):focus-visible { outline-offset: 1px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 var(--control-pad-x); margin: 0;
  font: inherit; font-size: var(--control-font-size); font-weight: 500; line-height: 1;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--control-radius);
  -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #ffffff; }
.btn-primary:hover { background: #1c2733; color: #ffffff; }
.btn-secondary {
  background: var(--control-bg); color: var(--control-ink-soft); border-color: var(--control-border);
  font-weight: 400;
}
.btn-secondary:hover { color: var(--control-ink); border-color: var(--control-border-hover); }
.btn-secondary.active, .btn-secondary[aria-current="true"], .btn-secondary[aria-expanded="true"] {
  color: var(--control-ink); border-color: var(--control-border-hover);
}
.btn-ghost { background: none; color: var(--control-ink-soft); padding: 0 8px; }
.btn-ghost:hover { color: var(--control-ink); background: var(--control-bg-hover); }
.btn-sm { height: var(--control-h-sm); font-size: 12.5px; padding: 0 8px; gap: 6px; }
.btn-md { height: var(--control-h-md); font-size: 13.5px; padding: 0 14px; }
.btn-lg { height: var(--control-h-lg); font-size: 13.5px; padding: 0 16px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: var(--control-h-md); height: var(--control-h-md); padding: 0; color: var(--control-ink); }
.btn-icon svg { width: 18px; height: 18px; }
.segmented { display: flex; flex: 0 0 auto; gap: 8px; }

/* Text, password and date inputs */
.input {
  font: inherit; font-size: var(--control-font-size); color: var(--control-ink); background: var(--control-bg);
  border: 1px solid var(--control-border); border-radius: var(--control-radius);
  height: var(--control-h); padding: 0 10px; margin: 0; min-width: 0;
  -webkit-appearance: none; appearance: none;
}
.input:hover { border-color: var(--control-border-hover); }
.input:focus { border-color: var(--green); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }
.input::placeholder { color: var(--ink-46); }
.input-lg { height: var(--control-h-lg); font-size: 14px; padding: 0 12px; width: 100%; }
.input[type="date"] { display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }
.input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.input[type="date"]::-webkit-datetime-edit { padding: 0; }
.input[type="date"]::-webkit-calendar-picker-indicator {
  width: 14px; height: 14px; margin-left: 6px; padding: 0; opacity: 1; cursor: pointer;
  color: transparent; background: var(--calendar) center / 14px 14px no-repeat;
}

/* Selects */
.select {
  font: inherit; font-size: var(--control-font-size); font-weight: 500; color: var(--control-ink);
  height: var(--control-h); padding: 0 30px 0 10px; margin: 0; min-width: 0; cursor: pointer;
  background: var(--control-bg) var(--chevron) right 10px center / 12px 12px no-repeat;
  border: 1px solid var(--control-border); border-radius: var(--control-radius);
  -webkit-appearance: none; appearance: none; text-overflow: ellipsis;
}
.select:hover { border-color: var(--control-border-hover); }
.select:disabled { opacity: 0.5; cursor: not-allowed; }
.select-labelled {
  display: inline-flex; align-items: center; margin: 0; padding: 0 0 0 10px; height: var(--control-h);
  background: var(--control-bg); border: 1px solid var(--control-border); border-radius: var(--control-radius);
}
.select-labelled:hover { border-color: var(--control-border-hover); }
.select-labelled.dd-box, .select-labelled.dd-box label { cursor: pointer; }
.select-labelled:focus-within { border-color: var(--green); box-shadow: var(--focus-ring); }
.select-labelled > label { font-size: 12px; color: var(--ink-46); white-space: nowrap; }
.select-labelled .select {
  height: calc(var(--control-h) - 2px); border: 0; background-color: transparent; padding-left: 8px;
}
/* The box carries the ring (focus-within above), so the inner select needs none. */
.select-labelled .select:focus-visible { outline: none; }

/* Dropdown (#20): ui.js turns every select.select into a .select trigger button and our own
   list panel; the native <select> stays in the form as the source of truth, hidden.
   On phones the panel opens as a bottom sheet with taller rows. */
.dd-native {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none;
}
button.select {
  display: inline-flex; align-items: center; text-align: left; white-space: nowrap; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button.select .dd-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dd-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(15, 23, 32, 0.28); }
.dd-panel {
  position: fixed; z-index: 60; display: flex; flex-direction: column; min-width: 180px; max-width: 360px;
  max-height: 340px; background: var(--card); color: var(--ink); font-family: var(--font-body);
  border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: 0 12px 32px rgba(15, 23, 32, 0.14), 0 2px 6px rgba(15, 23, 32, 0.06);
}
.dd-search { margin: 8px 8px 4px; flex: 0 0 auto; }
.dd-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; outline: none; }
.dd-group {
  padding: 8px 10px 4px; font-size: 11.5px; font-weight: 500; color: var(--ink-46);
  text-transform: none; letter-spacing: 0.01em;
}
.dd-option {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 10px;
  font-size: 13px; line-height: 1.3; border-radius: 6px; cursor: pointer; overflow-wrap: anywhere;
}
.dd-option:hover, .dd-option.dd-active { background: var(--bg-active); }
.dd-option[aria-selected="true"] { font-weight: 500; }
.dd-check { flex: 0 0 14px; width: 14px; height: 14px; color: var(--green); visibility: hidden; margin-left: auto; }
.dd-option[aria-selected="true"] .dd-check { visibility: visible; }
.dd-empty { padding: 10px; font-size: 12.5px; color: var(--ink-46); }
.dd-sheet {
  left: 0; right: 0; bottom: 0; top: auto; max-width: none; max-height: 72vh;
  border-radius: 14px 14px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom);
}
.dd-sheet .dd-title { padding: 14px 16px 6px; font-size: 13px; font-weight: 600; flex: 0 0 auto; }
.dd-sheet .dd-search { margin: 6px 12px; height: 40px; font-size: 16px; } /* 16px: no iOS zoom */
.dd-sheet .dd-list { padding: 4px 8px 12px; }
.dd-sheet .dd-option { min-height: 46px; font-size: 15px; padding: 10px 12px; }
.dd-sheet .dd-group { padding: 12px 12px 4px; font-size: 12.5px; }

/* Date range picker (#23): ui.js puts a .dp-trigger in front of the range form's date
   inputs (hidden, still the source of truth) and opens a .dd-panel.dp-panel calendar: two
   months on desktop, one month in the bottom sheet on phones with 44px day cells. */
.dp-enhanced .range-to, .dp-enhanced > button[type="submit"] { display: none; }
.dp-trigger { font-variant-numeric: tabular-nums; color: var(--control-ink); }
.dp-trigger .dp-icon { width: 14px; height: 14px; flex: 0 0 14px; color: var(--ink-46); }
.dp-panel { max-width: none; max-height: none; padding: 12px 12px 0; --dp-cell: 34px; }
.dp-body { position: relative; }
/* Ready-made ranges: a column left of the months; a scrolling row above them on phones. */
.dp-main { display: flex; gap: 12px; }
.dp-presets {
  display: flex; flex-direction: column; gap: 2px; min-width: 128px;
  margin: -12px 0 0 -12px; padding: 10px 8px; border-right: 1px solid var(--line);
}
.dp-preset {
  margin: 0; padding: 0 10px; height: 30px; border: 0; border-radius: var(--control-radius); background: none;
  color: var(--ink); font: inherit; font-size: 13px; text-align: left; white-space: nowrap; cursor: pointer;
}
.dp-preset:hover { background: var(--bg-active); }
.dp-preset.active { background: var(--ink); color: #ffffff; font-weight: 500; }
.dp-preset:disabled { color: var(--ink-46); opacity: 0.45; cursor: default; background: none; }
.dp-panel.dd-sheet .dp-main { flex-direction: column; gap: 10px; }
.dp-panel.dd-sheet .dp-presets {
  flex-direction: row; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; border-right: 0; gap: 6px;
  scrollbar-width: none;
}
.dp-panel.dd-sheet .dp-preset { flex: 0 0 auto; height: 36px; border: 1px solid var(--control-border); font-size: 14px; }
.dp-head {
  position: absolute; top: -4px; left: 0; right: 0; display: flex; justify-content: space-between;
  pointer-events: none;
}
.dp-head .btn { pointer-events: auto; width: 30px; height: 30px; }
.dp-head .btn:disabled { opacity: 0.3; }
.dp-head .btn svg { width: 16px; height: 16px; }
.dp-months { display: flex; gap: 20px; }
.dp-caption { height: 22px; margin-bottom: 6px; text-align: center; font-size: 13px; font-weight: 600; line-height: 22px; }
.dp-grid { display: flex; flex-direction: column; }
.dp-row { display: grid; grid-template-columns: repeat(7, var(--dp-cell)); }
.dp-weekday { height: 24px; text-align: center; font-size: 11.5px; line-height: 24px; color: var(--ink-46); }
.dp-cell { height: calc(var(--dp-cell) + 2px); padding: 1px 0; }
.dp-cell.dp-in { background: var(--bg-active); }
.dp-cell.dp-start { border-radius: var(--control-radius) 0 0 var(--control-radius); }
.dp-cell.dp-end { border-radius: 0 var(--control-radius) var(--control-radius) 0; }
.dp-cell.dp-start.dp-end { border-radius: var(--control-radius); }
.dp-cell.dp-preview:not(.dp-start):not(.dp-end) { background: rgba(15, 23, 32, 0.04); }
.dp-day {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 1px solid transparent; border-radius: var(--control-radius);
  background: none; color: var(--ink); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.dp-day:hover { border-color: var(--line-strong); }
.dp-day.dp-today { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--green); }
.dp-start .dp-day, .dp-end .dp-day { background: var(--ink); border-color: var(--ink); color: #ffffff; }
.dp-day[aria-disabled="true"] { color: var(--ink-46); opacity: 0.45; cursor: default; border-color: transparent; }
.dp-day.dp-over { color: var(--ink-46); cursor: not-allowed; }
.dp-day:focus-visible { outline-offset: 0; }
.dp-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 10px -12px 0; padding: 10px 12px; border-top: 1px solid var(--line);
}
.dp-status { font-size: 12.5px; color: var(--ink-68); font-variant-numeric: tabular-nums; min-width: 0; }
.dp-status.dp-warn { color: var(--red); }
.dp-actions { display: flex; gap: 8px; margin-left: auto; }
.dp-panel.dd-sheet { padding: 0 16px; --dp-cell: 44px; }
.dp-panel.dd-sheet .dd-title { padding: 14px 0 10px; }
.dp-panel.dd-sheet .dp-months { justify-content: center; }
.dp-panel.dd-sheet .dp-row { grid-template-columns: repeat(7, minmax(0, var(--dp-cell))); justify-content: center; }
.dp-panel.dd-sheet .dp-day { font-size: 15px; }
.dp-panel.dd-sheet .dp-head { top: -8px; }
.dp-panel.dd-sheet .dp-head .btn { width: 40px; height: 40px; }
.dp-panel.dd-sheet .dp-foot { margin: 12px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.dp-panel.dd-sheet .dp-actions .btn { height: var(--control-h-lg); padding: 0 18px; font-size: 14px; }

/* The selected segment is filled: ink with white text. Exactly one per group. */
.segmented > .btn.btn-secondary.active, .segmented > .btn.btn-secondary[aria-current="true"] {
  background: var(--ink); border-color: var(--ink); color: #ffffff; font-weight: 500;
}

/* Breakdown's Group by: several can be on at once; the last one on cannot be switched off. */
.group-by { display: flex; align-items: center; gap: 6px; }
.group-by-label { font-size: 12.5px; color: var(--ink-46); margin-right: 2px; }
.group-by > .btn.btn-secondary.active { background: var(--ink); border-color: var(--ink); color: #ffffff; font-weight: 500; }
.group-by > .btn[aria-disabled="true"] { cursor: default; }

/* Checkbox */
.checkbox {
  width: 16px; height: 16px; margin: 0; flex: 0 0 auto; cursor: pointer; vertical-align: middle;
  -webkit-appearance: none; appearance: none; background: var(--control-bg);
  border: 1px solid var(--control-border-hover); border-radius: 4px;
}
.checkbox:checked { background: var(--green) var(--check) center / 12px 12px no-repeat; border-color: var(--green); }
.checkbox:disabled { opacity: 0.5; cursor: not-allowed; }

.flash {
  font-size: 13px; padding: 10px 12px; border-radius: var(--radius-control);
  border: 1px solid var(--line); background: var(--card);
}
.flash.error { color: var(--red); background: var(--red-soft); border-color: rgba(194, 69, 47, 0.20); }
.flash.ok { background: rgba(15, 138, 95, 0.08); border-color: rgba(15, 138, 95, 0.25); }

/* Sign in and other pages shown before a session exists */
.auth { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.auth-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 32px; border-bottom: 1px solid var(--line);
}
.auth-host { font-size: 11px; color: var(--ink-46); }
.auth-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-panel { width: 400px; max-width: 100%; display: flex; flex-direction: column; gap: 28px; }
.auth-intro { display: flex; flex-direction: column; gap: 8px; }
.eyebrow { font-size: 11px; color: var(--ink-46); }
.auth-title {
  margin: 0; font-family: var(--font-head); font-size: 28px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.2;
}
.auth-lede { margin: 0; font-size: 14px; color: var(--ink-68); text-wrap: pretty; }
.auth-form { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.auth-note { font-size: 12.5px; color: var(--ink-46); text-align: center; margin: 0; }
.auth-sent { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; line-height: 1.5; }
.auth-sent svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; color: var(--green); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--ink-46); }
.auth-form .btn-primary { margin-top: 4px; }

/* Dashboard (design/04) */
.status-line { font-size: 12.5px; color: var(--ink-46); white-space: nowrap; }
.range-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.range-to { font-size: 13px; }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.tile {
  padding: 18px 20px 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-card); min-width: 0;
}
.tile-label { font-size: 12.5px; color: var(--ink-46); }
.tile-value {
  font-family: var(--font-head); font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
  margin-top: 8px; line-height: 1.1; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden;  /* ui.js shrinks a figure that is wider than its tile */
}
.tile.lead .tile-value { font-size: 40px; }
.tile-delta { font-size: 12.5px; margin-top: 8px; color: var(--ink-46); }
.delta { font-weight: 500; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.na { color: var(--ink-46); font-weight: 400; }
.spark { height: 26px; margin-top: 14px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px 0; flex-wrap: wrap;
}
.card-head.ruled { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head-left, .card-head-right { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.card-head-right { gap: 12px; }
.card-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.card-note { font-size: 12px; color: var(--ink-46); white-space: nowrap; }
.card-head.ruled .card-note { font-size: 12.5px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font: inherit;
  font-size: 12.5px; padding: 5px 10px; border: 1px solid transparent; border-radius: var(--radius-control);
  color: var(--ink-46); background: none; cursor: pointer;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.chip.active { color: var(--ink); background: var(--bg-active); border-color: var(--line); }
/* chart.js colours each active chip's dot by its place in the selection. */
.chart-body { padding: 12px 20px 20px; }
.chart-main { aspect-ratio: 1120 / 260; }

/* Charts (chart.js). Inline SVG; series colours are set per element. */
svg.ch { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
svg.ch-spark { height: 26px; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-base { stroke: var(--line-strong); stroke-width: 1; }
.ch-label { font-size: 11px; fill: var(--ink-46); }
.ch-end { font-size: 12.5px; fill: var(--ink); }
.ch-line { stroke-width: 1.5; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.ch-area { opacity: 0.08; }
.ch-partial { opacity: 0.38; stroke-dasharray: 3 3; }
.ch-dot { stroke: #ffffff; stroke-width: 2; }
.ch-partial-dot { opacity: 0.45; }
.ch-spark-line {
  stroke: rgba(15, 23, 32, 0.28); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke;
}
.ch-spark-line.ch-partial { opacity: 0.45; }
.ch-spark-line.ch-lone { fill: rgba(15, 23, 32, 0.28); }
.ch-hit { fill: transparent; pointer-events: all; cursor: crosshair; }
.ch-hover { pointer-events: none; }
.ch-cross { stroke: rgba(15, 23, 32, 0.35); stroke-width: 1; stroke-dasharray: 2 3; }
.ch-tip { fill: var(--ink); }
.ch-tip-title { font-size: 12px; fill: rgba(255, 255, 255, 0.6); }
.ch-tip-value { font-size: 11px; fill: #ffffff; }
.ch-tip-label { fill: rgba(255, 255, 255, 0.6); }
/* Touch: sideways drags move the crosshair, vertical drags still scroll the page. */
svg.ch-main { touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
/* Phone width (#19). chart.js draws the main chart in real pixels here (same query
   as its COMPACT_QUERY), 200px tall, so the box takes the SVG's height. */
@media (max-width: 720px), (max-width: 1023px) and (max-height: 500px) {
  .chart-card .chart-body { padding: 10px 12px 14px; }
  .chart-main { aspect-ratio: auto; min-height: 200px; }
  /* Metric chips: one row that scrolls sideways inside the card. */
  .chart-card .card-head { padding: 14px 12px 0; gap: 8px; }
  .chart-card .card-head-left { width: 100%; min-width: 0; gap: 8px; }
  .chart-card .chips {
    flex-wrap: nowrap; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .chart-card .chips::-webkit-scrollbar { display: none; }
  .chart-card .chip { flex: 0 0 auto; }
}
.chart-card, .table-card { background: var(--card); min-width: 0; }

/* Download CSV: the design's stronger secondary button. */
.card-head .btn-secondary { color: var(--ink); font-weight: 500; border-color: var(--line-strong); }
.card-head .btn-secondary:hover { background: var(--bg-active); }

.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th {
  font-size: 12px; color: var(--ink-46); font-weight: 500; text-align: right; padding: 12px 16px;
  border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
table.data th:first-child { text-align: left; }
table.data th.sorted { color: var(--green); }
table.data td {
  font-size: 12px; color: var(--ink-68); text-align: right; padding: 11px 16px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td:first-child { font-size: 13px; color: var(--ink); text-align: left; }
table.data td.soft { color: var(--ink-46); }
table.data td.site { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
table.data tr.partial td { opacity: 0.62; }
table.data tr.partial td:first-child { opacity: 1; }
.tag-partial {
  font-size: 11.5px; color: var(--amber-ink); background: var(--amber-soft);
  padding: 1px 6px; border-radius: 6px; margin-left: 6px;
}
table.data tfoot td {
  font-weight: 500; color: var(--ink); padding: 12px 16px; border-top: 1px solid var(--line-strong);
  border-bottom: 0; background: var(--bg-active);
}
table.data tfoot td.soft { color: var(--ink-68); }
.empty { margin: 0; padding: 20px; font-size: 13px; color: var(--ink-46); }
.table-more { margin: 0; padding: 12px 20px; font-size: 12.5px; color: var(--ink-46); border-top: 1px solid var(--line); }
.footnote { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--ink-46); padding: 4px 2px 0; }

/* Admin lens (design/05) */
.tiles.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tiles.six .tile.lead .tile-value { font-size: clamp(26px, 2.1vw, 34px); } /* six tiles: a $4,717.62 must fit */
.tile-delta .ink { color: var(--ink); font-weight: 500; }
.switcher { --control-h: 34px; padding-left: 12px; border-color: var(--line-strong); }
.switcher .select { max-width: 240px; font-size: 13.5px; }
.site-filter .select { max-width: 220px; }
.toggle {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-68);
  white-space: nowrap; text-decoration: none;
}
.toggle.disabled { opacity: 0.5; cursor: not-allowed; }
.toggle-track {
  width: 30px; height: 18px; border-radius: 9px; background: rgba(15, 23, 32, 0.18);
  position: relative; display: inline-block; flex: 0 0 auto;
}
.toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 7px; background: #ffffff;
}
a.toggle:hover { color: var(--ink); }
a.toggle:hover .toggle-track { background: rgba(15, 23, 32, 0.26); }
.toggle { border-radius: var(--control-radius); }
.toggle[aria-checked="true"] .toggle-track, a.toggle[aria-checked="true"]:hover .toggle-track { background: var(--green); }
.toggle[aria-checked="true"] .toggle-knob { left: 14px; }
.toggle-track { transition: background-color 180ms ease; }
.toggle-knob { transition: left 180ms ease; box-shadow: 0 1px 2px rgba(15, 23, 32, 0.25); }
@media (prefers-reduced-motion: reduce) { .toggle-track, .toggle-knob { transition: none; } }
.status-line.failed { color: var(--amber-ink); font-weight: 500; }
.status-line.failed::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber); margin-right: 6px; vertical-align: middle;
}
.view-as-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 13px; padding: 10px 14px; border-radius: var(--radius-control);
  color: var(--amber-ink); background: var(--amber-soft); border: 1px solid rgba(184, 121, 26, 0.24);
}
.view-as-banner strong { font-weight: 600; }
.view-as-banner a { color: var(--amber-ink); font-weight: 500; }
.view-as-banner .btn-ghost:hover { color: var(--amber-ink); background: rgba(184, 121, 26, 0.14); }
table.data th.left, table.data td.left { text-align: left; }
.tag-active, .tag-inactive { font-size: 12px; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.tag-active { color: var(--green-dark); background: rgba(15, 138, 95, 0.10); }
.tag-inactive { color: var(--ink-68); background: var(--bg-active); }
.topbar-controls { flex-wrap: wrap; justify-content: flex-end; row-gap: 10px; }
.view-as-banner { flex-wrap: nowrap; }
.view-as-banner > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-as-banner a { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 1100px) { .tiles.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Accounts panel (#21): the list, one account's form and its logins. */
.accounts-table td.site a { color: var(--ink); font-weight: 500; }
.accounts-table td.site a:hover { color: var(--green-dark); }
.accounts-table td.left { max-width: 320px; white-space: normal; }
.form-card { max-width: 880px; }
.panel-form { display: flex; flex-direction: column; gap: 16px; padding: 20px; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field .soft, legend .soft { color: var(--ink-46); font-weight: 400; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend { font-size: 12px; color: var(--ink-46); padding: 0; margin-bottom: 6px; }
.picker {
  display: flex; flex-direction: column; max-height: 320px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius-control); margin-top: 8px;
}
.pick {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 12px; cursor: pointer;
  border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.pick:last-of-type { border-bottom: 0; }
.pick:hover { background: var(--bg-active); }
.pick[hidden] { display: none; }
.pick-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pick-note { flex: 0 1 auto; font-size: 12px; color: var(--ink-46); text-align: right; overflow-wrap: anywhere; }
.form-note { margin: 0; font-size: 12.5px; color: var(--ink-46); }
.form-actions { display: flex; gap: 8px; }
.card-title.small { font-size: 14px; }
.login-list { list-style: none; margin: 0; padding: 0; }
.login-row {
  display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.login-who { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; font-size: 12px; }
.login-email { font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.inline-form { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; }
.inline-form .input { width: 240px; }
.btn-ghost.btn-danger { color: var(--red); }
.btn-ghost.btn-danger:hover { color: var(--red); background: var(--red-soft); }
.btn-primary.btn-danger { background: var(--red); color: #ffffff; }
.btn-primary.btn-danger:hover { background: #a63a27; color: #ffffff; }
/* Confirm steps (Remove login, unticking every publisher): ours, never a browser dialog. */
.confirm-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.confirm-wrap [hidden], .confirm[hidden] { display: none; }
.confirm .inline-form { flex: 0 0 auto; } /* Confirm and Cancel stay side by side on phones */
.confirm-text { flex: 1 1 100%; }
.confirm-text { font-size: 13px; font-weight: 500; color: var(--red); overflow-wrap: anywhere; }
.add-login { border-top: 1px solid var(--line); }
#logins > .login-list + .add-login, #logins > .empty + .add-login { border-top: 0; }
#logins > .empty { border-bottom: 1px solid var(--line); }
/* API keys (#22) on an account's page, and the /api/docs page. */
#keys > .login-list + .add-login, #keys > .empty + .add-login { border-top: 0; }
#keys > .empty { border-bottom: 1px solid var(--line); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
.key-prefix { color: var(--ink-46); }
.new-key { display: flex; flex-direction: column; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--bg-active); }
.new-key-text { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink); }
.key-reveal {
  display: block; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--card); font-size: 13px; overflow-wrap: anywhere; user-select: all;
}
.doc-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; color: var(--ink-68); }
.doc-body p { margin: 0; text-wrap: pretty; }
.doc-code-label { font-size: 12px; color: var(--ink-46); }
.doc-code {
  margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--bg); font-size: 12.5px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere;
}
.doc-list { margin: 0; }
.doc-list > div { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 4px 16px; padding: 10px 20px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.doc-list > div:last-child { border-bottom: 0; }
.doc-list dt { color: var(--ink); }
.doc-list dd { margin: 0; color: var(--ink-68); }
.doc-list + .doc-body { border-top: 1px solid var(--line); }
/* Supply path (#25): seller state tags, the file cells with the line found, recent events. */
.state { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.state-present { color: var(--green-dark); background: rgba(15, 138, 95, 0.10); }
.state-absent { color: var(--red); background: var(--red-soft); }
.state-unknown { color: var(--amber-ink); background: var(--amber-soft); }
.state-na { color: var(--ink-68); background: var(--bg-active); }
.seller-state + .seller-state { margin-left: 4px; }
.file-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 180px; max-width: 320px; white-space: normal; }
.file-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.since, .line-note { font-size: 11.5px; color: var(--ink-46); }
.found-line { font-size: 11.5px; color: var(--ink); overflow-wrap: anywhere; }
table.data td .line-note + .found-line { margin-top: -3px; }
.supply-table td { vertical-align: top; }
.supply-table td.site a { color: var(--ink); font-weight: 500; }
.supply-table td.site a:hover { color: var(--green-dark); }
.supply-table td.url { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.run-form { margin: 0; }
.seller-search { width: 220px; height: var(--control-h-sm); font-size: 12.5px; }
table.data tbody tr[hidden] { display: none; }
.seller-domain { display: none; }  /* phones only: the Domain column is off screen there */
.event-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.event-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline;
  padding: 10px 20px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.event-row:last-child { border-bottom: 0; }
.event-kind { font-weight: 500; color: var(--ink); }
.event-added { color: var(--green-dark); }
.event-removed { color: var(--red); }
.event-stuck { color: var(--amber-ink); }
.event-what { min-width: 0; overflow-wrap: anywhere; }
.event-what a { color: var(--ink); font-weight: 500; }
.event-what .soft { color: var(--ink-46); }
.event-when { font-size: 12px; color: var(--ink-46); white-space: nowrap; }
.seller-facts dd .file-cell { max-width: none; }

/* Phone layout (#19) lives in the one block at the end of this file. */

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { flex-wrap: wrap; }
  .topbar-controls { flex-wrap: wrap; }
}

/* Phone (#19): portrait up to 720px wide (360 to 430px in mind) and landscape phones
   (under 1024px wide and at most 500px tall). The same query as chart.js COMPACT_QUERY and
   ui.js PHONE_QUERY; keep the three in step. Everything else is the desktop layout. */

/* Parts that exist only for the phone layout; hidden at every wider width. */
.mobilebar, .custom-toggle, .label-short { display: none; }
/* Custom is a segment at every width (it lights when the range matches no preset); on
   desktop the date inputs are always shown and Custom just moves focus to them. */
.js .custom-toggle { display: inline-flex; }
.bar-row { display: contents; }

@media (max-width: 720px), (max-width: 1023px) and (max-height: 500px) {
  /* Shell: a slim sticky bar (logo, hamburger). With JavaScript the sidebar is the menu
     panel ui.js opens; without it the sidebar simply stacks above the page. */
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line);
             position: static; height: auto; overflow-y: visible; align-self: auto; }
  .sidebar-foot { margin-top: 0; }
  .js .mobilebar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 30; height: 48px; padding: 0 6px 0 16px;
    background: var(--card); border-bottom: 1px solid var(--line);
  }
  .menu-btn .menu-x, .menu-btn[aria-expanded="true"] .menu-bars { display: none; }
  .menu-btn[aria-expanded="true"] .menu-x { display: inline; }
  .js .sidebar {
    display: none; position: fixed; top: 48px; left: 0; right: 0; z-index: 29;
    max-height: calc(100vh - 48px); overflow-y: auto; gap: 14px; padding: 12px 12px 16px;
    box-shadow: 0 16px 32px rgba(15, 23, 32, 0.14);
  }
  .js .menu-open .sidebar { display: flex; }
  .js .sidebar > .brand { display: none; }
  .js .nav-item { padding: 10px 8px; }
  .js .sidebar-foot { gap: 6px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
  .signout .btn { height: var(--control-h-md); }

  /* Top bar rows: title with the small "Updated" beside it; the scope row (admin selects
     and View as); the range row (7d / 30d / All segmented, Custom); the date inputs. */
  .topbar { flex-wrap: wrap; justify-content: flex-start; gap: 8px 10px; padding: 10px 16px; }
  .topbar-controls { display: contents; }
  .topbar-title { order: 1; font-size: 17px; }
  .badge-admin { margin-left: 6px; padding: 2px 6px; font-size: 11px; }
  .topbar .status-line { order: 2; flex: 1 1 auto; font-size: 11.5px; }
  .bar-row { display: flex; align-items: center; gap: 8px 12px; flex: 1 1 100%; min-width: 0; flex-wrap: wrap; }
  .bar-scope { order: 3; }
  .bar-range { order: 4; flex-wrap: nowrap; }
  .range-form { order: 5; flex: 1 1 100%; min-width: 0; }
  .js .range-form:not(.open) { display: none; }
  .range-form .date-input { flex: 1 1 0; }
  .range-form .dp-trigger { flex: 1 1 100%; justify-content: flex-start; height: var(--control-h-md); }
  /* 260px: on a 414px phone the switcher takes its own row rather than squeezing a long
     publisher name ("HOLDEN F...") beside the site select; tablets still fit both. */
  .switcher { --control-h: 32px; flex: 1 1 260px; min-width: 0; padding-left: 10px; }
  .switcher .select { flex: 1 1 auto; max-width: none; font-size: 13px; }
  .site-filter { flex: 1 1 180px; min-width: 0; }
  .site-filter .select { flex: 1 1 auto; max-width: none; }
  .toggle { font-size: 12.5px; }
  .presets { gap: 0; }
  .segmented > .btn { border-radius: 0; margin-left: -1px; padding: 0 14px; }
  .segmented > .btn:first-child { margin-left: 0; border-radius: var(--control-radius) 0 0 var(--control-radius); }
  .segmented > .btn:last-child { border-radius: 0 var(--control-radius) var(--control-radius) 0; }
  .segmented > .btn:hover, .segmented > .btn:focus-visible { position: relative; z-index: 1; }
  .segmented > .btn.active { position: relative; z-index: 2; background: var(--bg-active); }
  .js .custom-toggle { display: inline-flex; }
  .custom-toggle.active, .custom-toggle[aria-expanded="true"] { background: var(--bg-active); }
  .label-long { display: none; }
  .label-short { display: inline; }

  /* Page body: tighter gaps and padding. */
  .content { padding: 10px 12px 16px; gap: 10px; }
  .view-as-banner { font-size: 12px; padding: 8px 10px; }
  .view-as-hint { display: none; }

  /* KPI tiles: two columns, the lead tile across both (and a last tile left alone too). */
  .tiles, .tiles.six { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tile, .tiles.six .tile { padding: 9px 12px 9px; }
  .tile.lead, .tile:last-child:nth-child(even) { grid-column: 1 / -1; }
  .tile-label { font-size: 12px; }
  .tile-value, .tiles.six .tile-value { font-size: 19px; margin-top: 2px; }
  .tile.lead .tile-value, .tiles.six .tile.lead .tile-value { font-size: 28px; }
  /* The delta and the sparkline share the tile's last line; small tiles drop "vs prior period". */
  .tile { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: end; }
  .tile-label, .tile-value { grid-column: 1 / -1; }
  .tile-delta { font-size: 11.5px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .delta-vs { display: none; }
  .tile.lead .delta-vs { display: inline; }
  .spark { height: 18px; margin-top: 0; }
  .spark svg.ch-spark { height: 18px; }

  /* Card heads and tables. The first column stays put while the rest scroll sideways inside
     the card; ui.js moves the money columns next to it. */
  /* Ruled card heads: title and Download CSV on one line, the notes small beneath. */
  .card-head.ruled { padding: 8px 12px; gap: 2px 10px; justify-content: flex-start; }
  .card-head.ruled .card-head-left, .card-head.ruled .card-head-right { display: contents; }
  .card-head.ruled .card-title { order: 1; flex: 1 1 auto; }
  .card-head.ruled .btn-secondary { order: 2; }
  .card-head.ruled .card-note { order: 3; flex: 0 1 auto; white-space: normal; }
  .card-head.ruled .same-as-chart { display: none; } /* the chart card above states the range */
  .card-title { font-size: 14px; }
  .card-note, .card-head.ruled .card-note { font-size: 11.5px; }
  .card-head .btn-md { height: var(--control-h-sm); padding: 0 10px; font-size: 12.5px; gap: 6px; }
  table.data th { padding: 7px 10px; }
  table.data td { padding: 6px 10px; }
  table.data tfoot td { padding: 8px 10px; }
  table.data td:first-child { font-size: 12.5px; }
  table.data th:first-child, table.data td:first-child {
    position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: inset -1px 0 0 var(--line);
  }
  table.data tfoot td:first-child { background: var(--bg-active); }
  table.data td.site { max-width: 130px; }
  table.data tfoot td:first-child { white-space: normal; min-width: 96px; }
  .tag-partial { font-size: 11px; padding: 0 5px; margin-left: 4px; }
  .empty { padding: 14px 12px; font-size: 12.5px; }
  .footnote { font-size: 11px; line-height: 1.5; padding: 0 2px; }

  /* Sign in */
  .auth-header { height: 52px; padding: 0 16px; }
  .auth-body { align-items: flex-start; padding: 28px 16px; }
  .auth-panel { gap: 18px; }
  .auth-title { font-size: 24px; }
  .auth-form { padding: 18px 16px; gap: 14px; }

  /* Accounts panel (#21): one column, full-width controls, roomy tap targets. The top
     bar's page buttons follow the title on its row. */
  .topbar-controls > .btn { order: 2; height: var(--control-h); font-size: 13px; padding: 0 12px; }
  .topbar-controls > .btn:first-child { margin-left: auto; }
  .panel-form { padding: 14px 12px; gap: 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .picker { max-height: 52vh; }
  .pick { min-height: 44px; padding: 6px 10px; font-size: 13px; }
  .login-row { padding: 10px 12px; }
  .inline-form { flex: 1 1 100%; }
  .inline-form .input { flex: 1 1 auto; width: auto; }
  .form-actions .btn { flex: 1 1 auto; }
  .accounts-table td.left { max-width: 200px; }
  /* API keys and docs (#22) */
  .new-key { padding: 12px; }
  .doc-body { padding: 12px; font-size: 13px; }
  .doc-list > div { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; font-size: 13px; }
  /* Supply path (#25): the Run now form follows the title; filters take their own row. */
  .run-form { order: 2; margin-left: auto; }
  .run-form .btn { height: var(--control-h); font-size: 13px; padding: 0 12px; }
  .topbar .status-line.run-status { order: 3; flex: 1 1 100%; }
  .card-head.ruled .state-filter, .card-head.ruled .group-by { order: 4; flex: 1 1 100%; }
  .group-by > .btn { flex: 1 1 0; padding: 0 6px; }
  .seller-search { order: 5; flex: 1 1 100%; width: auto; height: 40px; font-size: 16px; } /* 16px: no iOS zoom */
  .state-filter { gap: 0; }
  .state-filter > .btn { flex: 1 1 0; padding: 0 6px; }
  .seller-domain { display: block; font-size: 11.5px; color: var(--ink-46); overflow: hidden; text-overflow: ellipsis; }
  .supply-table td.site { max-width: 140px; }
  .seller-facts > div { grid-template-columns: 96px minmax(0, 1fr); padding: 8px 12px; }
  .file-cell { min-width: 150px; max-width: 200px; }
  .state { font-size: 11.5px; padding: 1px 6px; }
  .event-row { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 12px; font-size: 12.5px; }
  .event-what { grid-column: 1 / -1; grid-row: 2; }
}

/* Sellers (sellers.json editor) and Activity */
.seller-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.seller-forms .card { margin: 0; }
.field-error { font-size: 12.5px; color: var(--red); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-68); cursor: pointer; }
.textarea { height: auto; min-height: 120px; padding: 8px 10px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; line-height: 1.5; resize: vertical; width: 100%; }
/* File upload: our button over the native input, which stays in the label for focus and
   the keyboard; ui.js writes the picked file's name beside it. */
.file-pick { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-btn, .field label.file-btn { position: relative; cursor: pointer; color: var(--control-ink); font-size: 13px; }
.file-btn:focus-within { box-shadow: 0 0 0 3px rgba(15, 138, 95, 0.25); border-color: var(--green); }
.file-btn svg { width: 14px; height: 14px; flex: 0 0 14px; }
.file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 0; pointer-events: none; } /* clicks land on the label, so no "No file chosen" tooltip */
.file-name { font-size: 12.5px; color: var(--ink-46); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name.picked { color: var(--ink); }
.mono { font-family: var(--font-mono, ui-monospace, monospace); font-variant-numeric: tabular-nums; }
.tag-shared { font-size: 11.5px; padding: 1px 6px; margin-left: 4px; border-radius: 6px; color: var(--ink-68); background: var(--bg-active); white-space: nowrap; font-family: inherit; }
.row-links { white-space: nowrap; text-align: right; }
.row-links .btn + .btn { margin-left: 6px; }
.sellers-table tr.fresh td { background: rgba(15, 138, 95, 0.07); }
.remove-seller { border-top: 1px solid var(--line); padding-top: 14px; }
.activity-detail { white-space: normal; min-width: 280px; }
@media (max-width: 1100px) {
  .seller-forms { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .activity-detail { min-width: 220px; }
}
/* Form selects match the large inputs beside them. */
.panel-form .field > .select:not(.dd-native) { height: var(--control-h-lg); width: 100%; font-size: 14px; }
