/* PULSE design system: tokens first, components below. No gradient text, no glass,
   no decoration that carries no information. Motion is functional (150–300 ms) and
   honours prefers-reduced-motion. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations"), url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* Display faces for headings only. Body text, tables and forms stay on Inter,
   which has the better figures for dense numbers. */
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/newsreader-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/newsreader-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --display-weight: 600;
  --display-tracking: -.005em;
  --accent: #0891B2;
  --accent-ink: #0E7490;
  --accent-soft: #E6F6FA;
  --teal: #0D9488;
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #EEF2F7;
  --line: #E3E8EF;
  --line-strong: #CCD5E1;
  --ink: #0B1F3A;
  --ink-2: #34465F;
  /* Text tokens meet WCAG AA 4.5:1 on --bg, --surface, --surface-2 and --surface-3. */
  --muted: #56657A;
  --faint: #94A3B8; /* marks, borders and icons only — never text */
  --good: #067A3E; --good-mark: #0CA30C; --good-soft: #E8F6EE;
  --warn: #9A5B00; --warn-mark: #F59E0B; --warn-soft: #FFF6E5;
  --bad: #B42318;  --bad-mark: #D03B3B; --bad-soft: #FDEDEC;
  --info: #1D5FA8; --info-soft: #EAF2FC;
  --s1: #0891B2; --s2: #EB6834; --s3: #4A3AA7; --s4: #EDA100;
  --radius: 12px; --radius-sm: 8px; --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(11,31,58,.04), 0 1px 1px rgba(11,31,58,.03);
  --shadow-lg: 0 18px 50px rgba(11,31,58,.14), 0 2px 6px rgba(11,31,58,.06);
  --sidebar: 240px;
  --topbar: 60px;
  /* Main column (2.10): one centered axis for the content and the top bar, measured in the
     space right of the sidebar (.main-col), never the full viewport. */
  --content-max: 1680px;
  --content-pad-x: 24px;
  --ease: cubic-bezier(.2,.7,.2,1);
  --t: 180ms;
  /* Semantic tokens (redefined by the dark theme below). */
  --on-accent: #FFFFFF;
  --inverse-bg: #0B1F3A; --inverse-fg: #FFFFFF; --inverse-muted: #B8C4D6; --inverse-soft: #CBD5E1;
  --btn-primary-bg: #0B1F3A; --btn-primary-hover: #13305A; --btn-primary-fg: #FFFFFF;
  --topbar-bg: rgba(255,255,255,.97);
  --scrim: rgba(11,31,58,.35); --backdrop: rgba(11,31,58,.38);
  --focus-ring: rgba(8,145,178,.16);
  --danger-border: #F1C1BC;
  --info-border: #CFE0F5; --info-text: #173E6B;
  --warn-border: #F6DDAA; --warn-text: #6A3F00;
  --bad-border: #F3C9C4; --bad-text: #7A1A12;
  --good-border: #C5E7D1; --good-text: #0B4F2B;
  --sample-bg: #F1EEFB; --sample-fg: #4A3AA7;
  --badge-warn-bg: #FEF3C7; --badge-warn-fg: #92400E; --badge-warn-border: #FCD34D;
  --grid-line: #EEF1F5; --series-prev: #9AA7B8; --series-bad: #E34948;
  --toast-error: #7A1A12; --toast-success: #0B4F2B;
  color-scheme: light;
}

/* Dark theme: the user's choice (Settings → Appearance, or the theme button), or the
   system setting when the user chose "System". Every text token keeps 4.5:1 or more. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-ink: #5CD3EA; --accent-soft: rgba(34,184,214,.14);
    --bg: #0B1220; --surface: #121B2C; --surface-2: #0F1727; --surface-3: #1B2639;
    --line: #243049; --line-strong: #33415C;
    --ink: #E6EDF7; --ink-2: #C3CEDD; --muted: #9AA9BF; --faint: #6B7A90;
    --good: #5DD39E; --good-mark: #22C55E; --good-soft: #12302A;
    --warn: #F2B84B; --warn-mark: #F59E0B; --warn-soft: #35290F;
    --bad: #F58B84; --bad-mark: #EF4444; --bad-soft: #3A1C1E;
    --info: #8DB8F2; --info-soft: #172A45;
    --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 18px 50px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
    --on-accent: #06121C;
    --inverse-bg: #E6EDF7; --inverse-fg: #0B1220; --inverse-muted: #3A4A63; --inverse-soft: #2A3950;
    --btn-primary-bg: #22B8D6; --btn-primary-hover: #4CC8E1; --btn-primary-fg: #06121C;
    --topbar-bg: rgba(18,27,44,.97);
    --scrim: rgba(0,0,0,.55); --backdrop: rgba(0,0,0,.6);
    --focus-ring: rgba(34,184,214,.3);
    --danger-border: #6B2A27;
    --info-border: #2A4468; --info-text: #C9DDF8;
    --warn-border: #5C4412; --warn-text: #F8DDA4;
    --bad-border: #5E2A2A; --bad-text: #F9C4BF;
    --good-border: #1F4D3C; --good-text: #BDEFD5;
    --sample-bg: #2A2450; --sample-fg: #C9C0F5;
    --badge-warn-bg: #3A2C0C; --badge-warn-fg: #F8D48A; --badge-warn-border: #6B5214;
    --grid-line: #1E2A3F; --series-prev: #6F7F97; --series-bad: #F87171;
    --toast-error: #7A1A12; --toast-success: #0B4F2B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent-ink: #5CD3EA; --accent-soft: rgba(34,184,214,.14);
  --bg: #0B1220; --surface: #121B2C; --surface-2: #0F1727; --surface-3: #1B2639;
  --line: #243049; --line-strong: #33415C;
  --ink: #E6EDF7; --ink-2: #C3CEDD; --muted: #9AA9BF; --faint: #6B7A90;
  --good: #5DD39E; --good-mark: #22C55E; --good-soft: #12302A;
  --warn: #F2B84B; --warn-mark: #F59E0B; --warn-soft: #35290F;
  --bad: #F58B84; --bad-mark: #EF4444; --bad-soft: #3A1C1E;
  --info: #8DB8F2; --info-soft: #172A45;
  --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 18px 50px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
  --on-accent: #06121C;
  --inverse-bg: #E6EDF7; --inverse-fg: #0B1220; --inverse-muted: #3A4A63; --inverse-soft: #2A3950;
  --btn-primary-bg: #22B8D6; --btn-primary-hover: #4CC8E1; --btn-primary-fg: #06121C;
  --topbar-bg: rgba(18,27,44,.97);
  --scrim: rgba(0,0,0,.55); --backdrop: rgba(0,0,0,.6);
  --focus-ring: rgba(34,184,214,.3);
  --danger-border: #6B2A27;
  --info-border: #2A4468; --info-text: #C9DDF8;
  --warn-border: #5C4412; --warn-text: #F8DDA4;
  --bad-border: #5E2A2A; --bad-text: #F9C4BF;
  --good-border: #1F4D3C; --good-text: #BDEFD5;
  --sample-bg: #2A2450; --sample-fg: #C9C0F5;
  --badge-warn-bg: #3A2C0C; --badge-warn-fg: #F8D48A; --badge-warn-border: #6B5214;
  --grid-line: #1E2A3F; --series-prev: #6F7F97; --series-bad: #F87171;
  --toast-error: #7A1A12; --toast-success: #0B4F2B;
  color-scheme: dark;
}
@media (prefers-reduced-motion: reduce) { :root { --t: 0ms; } *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 13.5px/1.5 var(--font-body); font-feature-settings: "cv05","cv11"; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; color: var(--ink); }
p { margin: 0; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.num, .data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--inverse-bg); color: var(--inverse-fg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
[hidden] { display: none !important; }
svg.icon, .btn svg, .nav-icon, .chip-icon, .inline-icon, .notice-icon, .flash-icon, .delta-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- layout */
/* App shell: the document does not scroll. The content column and the sidebar
   list each scroll on their own, so a swipe that starts on the sidebar can never
   drag the whole page (iPad/iOS), and neither scroll position moves the other. */
html:has(> body.app) { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.app { height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none; }
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; transition: transform var(--t) var(--ease); }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; flex: none; object-fit: cover; }
.brand-mark { width: 32px; height: 32px; flex: none; object-fit: contain; }
.brand-wordmark { display: block; height: 28px; width: auto; max-width: 100%; margin: 2px 0 3px; }
.brand.has-wordmark .brand-text small { padding-left: 1px; }
.brand-wordmark-dark { display: none !important; }
:root[data-theme="dark"] .brand-wordmark-light { display: none !important; }
:root[data-theme="dark"] .brand-wordmark-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-wordmark-light { display: none !important; }
  :root:not([data-theme="light"]) .brand-wordmark-dark { display: block !important; }
}
.brand-text b { display: block; font-size: 15px; font-weight: 750; letter-spacing: .06em; }
.brand-text small { display: block; color: var(--muted); font-size: 11.5px; }
.sidebar .nav-close { margin-left: auto; display: none; }
.nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: 4px 10px 12px; scrollbar-width: thin; }
.sidebar .brand, .sidebar-foot { touch-action: none; }
.nav-group { margin-top: 12px; }
.nav-group-label { display: block; padding: 0 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 520; transition: background var(--t), color var(--t); }
.nav-link:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.nav-link.active .nav-icon { stroke: var(--accent); }
.nav-icon { width: 17px; height: 17px; stroke: var(--muted); }
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; height: 18px; border-radius: 9px; background: var(--bad-soft); color: var(--bad); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.nav-count.warn { background: var(--warn-soft); color: var(--warn); }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.me b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { display: block; color: var(--muted); font-size: 11.5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--inverse-bg); color: var(--inverse-fg); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex: none; }
/* The main column starts where the sidebar ends; everything below centers inside it, so the
   content sits in the middle of the viewport left over after the sidebar. A stable scrollbar
   gutter keeps that center from shifting between short and long pages. */
.main-col { flex: 1; min-width: 0; margin-left: var(--sidebar); display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scroll-padding-top: 76px; scrollbar-gutter: stable; }
body.nav-is-open .main-col { overflow: hidden; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; flex-direction: column; gap: 8px; padding: 10px var(--content-pad-x); background: var(--topbar-bg); border-bottom: 1px solid var(--line); }
/* The bar's background spans the column; its rows line up with the centered content below. */
.topbar > * { width: 100%; max-width: calc(var(--content-max) - 2 * var(--content-pad-x)); margin-inline: auto; }
.topbar-row { display: flex; align-items: center; gap: 12px; min-height: 34px; }
.topbar-title { font-weight: 650; font-size: 14px; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar .nav-open { display: none; }
/* Centered in the main column; what is inside keeps its own alignment and is never stretched to fill. */
.content { padding: 20px var(--content-pad-x) 40px; max-width: var(--content-max); width: 100%; margin-inline: auto; }
.content:focus { outline: none; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 35; touch-action: none; }

/* ------------------------------------------------------------ filter bar */
.filterbar { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.fb-field { display: flex; flex-direction: column; gap: 2px; }
.fb-field > span { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.fb-field select, .fb-field input { height: 32px; min-width: 0; max-width: 190px; padding: 0 28px 0 10px; font-size: 13px; }
.fb-field input[type=date] { padding-right: 8px; max-width: 150px; }
.fb-account select { max-width: 210px; }
.fb-custom { display: contents; }
.fb-check { display: inline-flex; align-items: center; gap: 6px; height: 32px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.filter-summary { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; justify-content: flex-end; }
.freshness { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 550; white-space: nowrap; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.freshness .fresh-dot { flex: none; }
.freshness:hover { text-decoration: none; border-color: var(--line-strong); }
.fresh-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 3px rgba(148,163,184,.18); }
.fresh-good .fresh-dot { background: var(--good-mark); box-shadow: 0 0 0 3px rgba(12,163,12,.14); }
.fresh-warn .fresh-dot { background: var(--warn-mark); box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.fresh-bad .fresh-dot { background: var(--bad-mark); box-shadow: 0 0 0 3px rgba(208,59,59,.14); }
.fresh-bad { color: var(--bad); }

/* ------------------------------------------------------------- controls */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], input[type=search], input:not([type]), select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color var(--t), box-shadow var(--t); }
textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; padding-right: 28px; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--bad-mark); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
label { display: block; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span, .field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field small, .help { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t); text-decoration: none !important; }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.btn-primary:hover { background: var(--btn-primary-hover); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-ink); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--faint); background: var(--surface-2); }
.btn-danger { background: var(--surface); border-color: var(--danger-border); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled], .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link { font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.inline-form { display: inline-flex; margin: 0; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-sm); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background var(--t), color var(--t); }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Toggle switch (PULSE source toggle) */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch button { position: relative; width: 38px; height: 22px; border-radius: 11px; border: 0; background: var(--line-strong); cursor: pointer; transition: background var(--t); padding: 0; }
.switch button::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform var(--t) var(--ease); }
.switch button[aria-checked=true] { background: var(--accent); }
.switch button[aria-checked=true]::after { transform: translateX(16px); }
.switch-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }

/* ------------------------------------------------------------ page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 720; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 760px; }
.eyebrow { display: block; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-head { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }

/* --------------------------------------------------------------- grids */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.grid-side { grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; flex-wrap: wrap; }
.card-head h2 { font-size: 14px; font-weight: 680; }
.card-head p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 0 16px 16px; min-width: 0; flex: 1; }
.card-body.flush { padding: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }

/* ----------------------------------------------------------------- KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (min-width: 1680px) { .kpi-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 10px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 560; }
.kpi-value { font-size: 23px; font-weight: 720; letter-spacing: -.02em; margin: 4px 0 2px; line-height: 1.15; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 20px; }
.kpi-foot small { color: var(--muted); }
.kpi-spark { height: 28px; margin-top: 8px; min-height: 0; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 650; padding: 1px 6px 1px 4px; border-radius: 10px; background: var(--surface-3); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.delta.good { background: var(--good-soft); color: var(--good); }
.delta.bad { background: var(--bad-soft); color: var(--bad); }
.delta-icon { width: 13px; height: 13px; stroke-width: 2.4; }

/* --------------------------------------------------------- chips/badges */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.chip-icon { width: 12px; height: 12px; stroke-width: 2.4; }
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info { background: var(--info-soft); color: var(--info); }
.badge { display: inline-flex; align-items: center; white-space: nowrap; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 650; background: var(--surface-3); color: var(--ink-2); letter-spacing: .01em; }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge-sample { background: var(--sample-bg); color: var(--sample-fg); }
.badge-live { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
.badge-neutral { background: var(--surface-3); color: var(--ink-2); }
.pdot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 7px; background: var(--faint); flex: none; }
.pdot-meta_ads { background: var(--s1); } .pdot-google_ads { background: var(--s2); } .pdot-shopify { background: var(--s3); } .pdot-tiktok_ads { background: var(--s4); } .pdot-amazon { background: var(--s4); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }

/* --------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; margin: 0 -16px; }
.card-body.flush .table-wrap { margin: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th:first-child, .data-table td:first-child { padding-left: 16px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 16px; }
.data-table tbody tr { transition: background var(--t); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .cell-title { display: flex; align-items: center; font-weight: 600; min-width: 0; }
.data-table small { display: block; }
.data-table.compact td { padding-top: 6px; padding-bottom: 6px; }
.data-table tr.row-off td { color: var(--muted); }
.mini-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.mini-table td { padding: 6px 0; border-top: 1px solid var(--line); }
.table-scroll { max-height: 560px; overflow: auto; }
.table-tools { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.table-tools .field { min-width: 150px; }

/* ----------------------------------------------------------------- tabs */
.tabbar { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabbar button { border: 0; background: none; padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--t), border-color var(--t); }
.tabbar button:hover { color: var(--ink); }
.tabbar button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel:focus { outline: none; }
.tabpanel { animation: fade var(--t) var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------ notices & flash */
.notice, .flash { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); margin-bottom: 12px; font-size: 13px; }
.notice-icon, .flash-icon { margin-top: 1px; }
.notice-info, .flash-info { background: var(--info-soft); border-color: var(--info-border); color: var(--info-text); }
.notice-warn, .flash-warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn-text); }
.notice-bad, .flash-bad { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad-text); }
.notice-good, .flash-good { background: var(--good-soft); border-color: var(--good-border); color: var(--good-text); }
.notice a, .flash a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.flash { box-shadow: var(--shadow); animation: fade 240ms var(--ease); }
.flash span { flex: 1; }
.flash .icon-btn { width: 24px; height: 24px; margin: -3px -6px -3px 0; }
.caveat { margin-top: 12px; color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: flex-start; }
.inline-icon { width: 14px; height: 14px; margin-top: 2px; }

.empty-state { text-align: center; padding: 34px 20px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.card .empty-state { border: 0; background: transparent; padding: 24px 12px; }
.empty-state b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.empty-state .btn { margin-top: 14px; }

/* ------------------------------------------------------------ AI summary */
.ai-summary { display: grid; gap: 12px; }
.ai-block h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-ink); margin-bottom: 4px; }
.ai-block ul { margin: 0; padding-left: 18px; }
.ai-block li { margin: 3px 0; color: var(--ink-2); }
.ai-block li::marker { color: var(--faint); }
.evidence-list { display: grid; gap: 6px; margin-top: 12px; }
.evidence-chips { display: inline-flex; gap: 3px; flex-wrap: wrap; vertical-align: 1px; }
.evidence-chip { display: inline-block; font: 600 10.5px/1 var(--font-mono, ui-monospace, monospace); color: var(--accent-ink); background: var(--accent-soft, rgba(8,145,178,.08)); border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px; cursor: help; transition: background-color .15s ease, border-color .15s ease; }
.evidence-chip:hover, .evidence-chip:focus-visible { background: var(--surface-2); border-color: var(--accent); outline: none; }
.evidence-item { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 8px 10px; border-radius: var(--radius-xs); background: var(--surface-2); border: 1px solid var(--line); }
.evidence-item code { font-size: 11px; color: var(--muted); background: none; padding: 0; }

/* ------------------------------------------------------------- alerts */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.alert-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.alert-row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-list p { color: var(--ink-2); font-size: 12.5px; margin: 4px 0; }
.alert-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.alert-card:last-child { border-bottom: 0; }
.alert-card h3 { font-size: 14px; margin: 4px 0; }
.alert-card p { color: var(--ink-2); }
.kv { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; }
.kv span { color: var(--muted); }
.kv b { color: var(--ink); font-weight: 600; margin-left: 4px; }
.alert-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }

.target-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.target-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 2px 10px; align-items: center; }
.target-list li small { grid-column: 1; }
.target-list li .chip { grid-column: 3; grid-row: 1 / span 2; }

/* --------------------------------------------------------------- charts */
.chart { position: relative; width: 100%; min-height: 60px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* Line charts size themselves (height attribute); the legend follows below them. */
.chart[data-chart="line"] > svg { height: auto; }
.chart-trend { min-height: 286px; } /* 260px plot + 26px legend (pulse-charts.js LEGEND_H): no shift when it draws */
.chart-donut { min-height: 200px; }
.chart-hbar { min-height: 40px; }
.chart-waterfall { height: 300px; }
.chart-funnel { min-height: 40px; }
.chart-bars { height: 260px; }
.chart text { font-family: inherit; font-size: 11px; fill: var(--muted); }
.chart text.axis-slant { font-size: 10.5px; }
.chart .axis-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .grid-line { stroke: var(--grid-line); stroke-width: 1; }
.chart .value-label { fill: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .center-value { font-size: 24px; font-weight: 720; fill: var(--ink); }
.chart .center-label { font-size: 11.5px; fill: var(--muted); }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; }
.chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.prev { stroke: var(--series-prev); stroke-width: 1.6; }
.chart .partial { stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; }
/* Sparklines with a day-by-day readout (hover, touch, keyboard): the focus ring sits on the box, not the SVG rect. */
.chart-spark .hit { cursor: crosshair; outline: none; }
.chart-spark:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key i { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.chart-legend .key i.box { width: 10px; height: 10px; border-radius: 3px; }
.chart-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--inverse-bg); color: var(--inverse-fg); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow-lg); min-width: 140px; max-width: 280px; }
.chart-tip .tip-title { color: var(--inverse-muted); font-size: 11px; margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chart-tip .tip-row i { display: inline-block; width: 10px; height: 2px; }
.chart-tip .tip-row b { font-variant-numeric: tabular-nums; }
.chart-tip .tip-row span { color: var(--inverse-soft); flex: 1; }
.hbar-row { display: grid; grid-template-columns: minmax(80px, 140px) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.hbar-label { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-label small { display: block; color: var(--muted); font-weight: 500; font-size: 11.5px; }
.hbar-track { height: 10px; background: var(--surface-3); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 0 4px 4px 0; width: 0; transition: width 600ms var(--ease); }
.hbar-value { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 12.5px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 120px; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); }
.funnel-row:first-child { border-top: 0; }
.funnel-bar { height: 22px; border-radius: 0 4px 4px 0; background: var(--s1); opacity: .9; width: 0; transition: width 600ms var(--ease); }
.funnel-meta { text-align: right; font-size: 12px; }
.funnel-meta b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.chart-table-toggle { margin-top: 8px; }

/* ---------------------------------------------------------- calendar */
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal th { font-size: 11px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 4px; }
.cal td { vertical-align: top; height: 96px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.cal td.blank { background: transparent; border-color: transparent; }
.cal td.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .day { font-size: 11.5px; font-weight: 650; color: var(--ink-2); }
.cal .ev { display: block; margin-top: 4px; padding: 3px 6px; border-radius: 5px; font-size: 11.5px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.detected { border-left: 3px solid var(--s1); }
.cal .ev.logged { border-left: 3px solid var(--s3); }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.impact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 10px; }
.impact-cell { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.impact-cell span { font-size: 11.5px; color: var(--muted); display: block; }
.impact-cell b { font-size: 14px; font-variant-numeric: tabular-nums; }
.impact-cell small { display: block; color: var(--muted); }

/* ------------------------------------------------------------ kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 320px; }
.kanban-col header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 650; }
.kanban-col header b { font-size: 12px; color: var(--muted); }
.kanban-col header small { color: var(--muted); font-weight: 500; }
.kanban-drop { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; transition: background var(--t); }
.kanban-drop.drag-over { background: var(--accent-soft); }
.lead-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; box-shadow: var(--shadow); cursor: grab; }
.lead-card.dragging { opacity: .5; }
.lead-card.is-saving { opacity: .6; }
.lead-card b { display: block; }
.lead-card small { color: var(--muted); }
.lead-card .lead-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; }
.lead-card select { height: 28px; font-size: 12px; width: auto; }

/* --------------------------------------------------------------- modal */
dialog.modal { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); color: var(--ink); }
dialog.modal.wide { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: var(--backdrop); }
dialog.modal[open] { animation: pop 200ms var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-body { padding: 20px 22px; }
.modal-body h2 { font-size: 17px; margin-bottom: 6px; }
.modal-body > p { color: var(--ink-2); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast-stack { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 70; }
.toast { background: var(--inverse-bg); color: var(--inverse-fg); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 360px; transition: opacity var(--t), transform var(--t); }
.toast.error { background: var(--toast-error); color: #FFFFFF; }
.toast.success { background: var(--toast-success); color: #FFFFFF; }

/* --------------------------------------------------------------- misc */
.source-row .src-name { display: flex; align-items: center; gap: 8px; }
.src-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.progress { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; width: 90px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.secret-mask { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ink-2); background: var(--surface-3); padding: 2px 6px; border-radius: 4px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.copy-field { display: flex; gap: 6px; }
.copy-field input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.def-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.def-list dt { color: var(--muted); }
.def-list dd { margin: 0; }
.step-list { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.step-list li { position: relative; padding-left: 30px; color: var(--ink-2); }
.step-list li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.rec-list { display: grid; gap: 10px; }
.rec { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.rec h3 { font-size: 13.5px; margin: 4px 0; }
.rec p { color: var(--ink-2); font-size: 12.5px; }
.rec ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.creative-name { font-weight: 600; }
.creative-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.stage-strip { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 6px; margin-bottom: 16px; }
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; }
.stage span { display: block; font-size: 11.5px; color: var(--muted); }
.stage b { font-size: 18px; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
details.disclosure { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
details.disclosure > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > div { padding: 0 14px 14px; }
.impl-status { font-style: normal; }

/* ------------------------------------------------------------ hierarchy */
/* One main question per page: a primary block, section headings that carry the
   question, quieter secondary cards, and deep dives collapsed below. */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 28px 0 12px; flex-wrap: wrap; }
.section-head:first-child { margin-top: 4px; }
.section-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.section-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; max-width: 720px; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-primary { border-color: var(--line-strong); }
.card-primary > .card-head { padding: 16px 18px 8px; }
.card-primary > .card-head h2 { font-size: 16px; font-weight: 720; }
.card-primary > .card-body { padding: 0 18px 16px; }
.card-quiet { box-shadow: none; background: var(--surface-2); }
.card-quiet .table-wrap .data-table th { background: var(--surface-3); }
.kpi-grid.kpi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1680px) { .kpi-grid.kpi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Signal → Impact → Action */
.insight-list { display: flex; flex-direction: column; }
.insight { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.insight:first-child { padding-top: 4px; }
.insight:last-child { border-bottom: 0; padding-bottom: 0; }
.insight-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.insight-mark svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.insight.tone-bad .insight-mark { background: var(--bad-soft); color: var(--bad); }
.insight.tone-warn .insight-mark { background: var(--warn-soft); color: var(--warn); }
.insight.tone-good .insight-mark { background: var(--good-soft); color: var(--good); }
.insight.tone-info .insight-mark { background: var(--info-soft); color: var(--info); }
.insight-main { min-width: 0; }
.insight-signal { font-weight: 650; color: var(--ink); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.insight-signal .badge { vertical-align: 1px; margin-left: 4px; }
.insight-detail { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
/* Impact (and, in the Alerts inbox, the next step) side by side; a single part takes the full width. */
.insight-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; margin: 8px 0 0; }
.insight-parts > div:only-child { grid-column: 1 / -1; max-width: 780px; }
.insight-parts dt { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.insight-parts dd { margin: 1px 0 0; font-size: 12.5px; color: var(--ink-2); }
.insight-meta { display: block; color: var(--muted); margin-top: 6px; }
.insight-cta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12.5px; white-space: nowrap; padding-top: 4px; }
.insight-cta .inline-icon { width: 14px; height: 14px; }

/* Methodology, one click away */
.how { margin-top: 10px; font-size: 12px; color: var(--muted); }
.how > summary { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; list-style: none; font-weight: 600; color: var(--muted); border-radius: 4px; }
.how > summary::-webkit-details-marker { display: none; }
.how > summary:hover { color: var(--ink-2); }
.how[open] > summary { color: var(--ink-2); }
.how .inline-icon { width: 14px; height: 14px; }
.how-body { margin-top: 6px; padding: 8px 12px; border-left: 2px solid var(--line-strong); color: var(--ink-2); max-width: 780px; }
.how-body ul { margin: 0; padding-left: 16px; display: grid; gap: 3px; }
.card-head .how { margin-top: 4px; }

/* Collapsed deep dives */
details.disclose > summary { list-style: none; cursor: pointer; align-items: center; border-radius: var(--radius); }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary:hover h2 { color: var(--accent-ink); }
details.disclose:not([open]) > summary { padding-bottom: 14px; }
.disclose-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t) var(--ease); }
details.disclose[open] .disclose-icon { transform: rotate(180deg); }
.disclose + .disclose, .card + .disclose, .disclose + .card { margin-top: 12px; }

/* Breadcrumb in the top bar for pages reached from Admin or a parent page */
.crumb { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 14px; min-width: 0; }
.crumb a { color: var(--muted); font-weight: 560; }
.crumb-sep { color: var(--faint); }

/* Admin hub */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.admin-tile { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); transition: border-color var(--t), background var(--t); }
.admin-tile:hover { border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; }
.admin-tile svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; grid-row: span 2; margin-top: 1px; }
.admin-tile b { font-size: 13.5px; font-weight: 650; }
.admin-tile small { color: var(--muted); font-size: 12px; }
.admin-tile .chip { justify-self: start; margin-top: 6px; grid-column: 2; }

/* Overview: needs attention today + your queue */
.today-grid > .card + .card { margin-top: 0; }
.page-overview .grid-main { align-items: start; }
.today-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 20px; align-items: start; }
.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.queue-list li:last-child { border-bottom: 0; }
.queue-list a { color: var(--ink); font-weight: 560; min-width: 0; }
.queue-list .queue-n { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.queue-list .queue-n.bad { color: var(--bad); }
.queue-list small { display: block; color: var(--muted); font-weight: 400; }
.attention-more { margin-top: 12px; font-size: 12.5px; }

/* Phone filter toggle (hidden on wider screens) */
.fb-toggle { display: none; }
.fb-toggle small { color: var(--muted); font-weight: 500; font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fb-toggle .fb-toggle-icon { width: 14px; height: 14px; margin-left: auto; transition: transform var(--t) var(--ease); }
.topbar.fb-open .fb-toggle-icon { transform: rotate(180deg); }
@media (max-width: 720px) {
  .has-js .fb-toggle { display: flex; width: 100%; justify-content: flex-start; }
  .has-js .topbar:not(.fb-open) .filterbar { display: none; }
  .topbar-title { display: none; }
}

/* --------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .grid-main, .grid-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-is-open .sidebar { transform: none; }
  .topbar .nav-open, .sidebar .nav-close { display: inline-grid; }
  .main-col { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .stage-strip { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  :root { --content-pad-x: 14px; }
  .content { padding-top: 14px; padding-bottom: 32px; }
  .topbar { padding-top: 8px; padding-bottom: 8px; }
  .filterbar { gap: 6px; }
  .fb-field { flex: 1 1 140px; }
  .topbar-row .filter-summary { display: none; }
  .fb-field select, .fb-field input { max-width: none; width: 100%; }
  .form-grid, .form-grid-3 { grid-template-columns: minmax(0,1fr); }
  .kpi-grid, .kpi-grid.kpi-4 { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .insight { grid-template-columns: 28px minmax(0, 1fr); }
  .insight-cta { grid-column: 2; padding-top: 0; }
  .insight-parts { grid-template-columns: minmax(0, 1fr); }
  .section-head { margin-top: 22px; }
  .kpi { min-height: 92px; padding: 10px 12px 8px; }
  .kpi-value { font-size: 19px; }
  .page-head h1 { font-size: 19px; }
  .chart-trend { min-height: 236px; }
  .funnel-row { grid-template-columns: 100px 1fr 90px; }
  .stage-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .alert-card { grid-template-columns: minmax(0,1fr); }
  .alert-actions { justify-content: flex-start; }
  .cal td { height: 64px; padding: 4px; }
  .cal .ev { font-size: 10.5px; padding: 2px 4px; }
}
@media print {
  .sidebar, .topbar, .page-actions, .card-actions form, .flash { display: none !important; }
  .main-col { margin: 0; height: auto; overflow: visible; }
  html:has(> body.app), body.app { height: auto; overflow: visible; }
  body { background: #fff; color: #0B1F3A; }
  .card { box-shadow: none; break-inside: avoid; }
}

.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* ---------------------------------------------------- definitions, lists */
.data-table tr.group-row th { background: var(--surface-2); color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; text-align: left; padding: 8px 12px; }
.rule-list { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.rule-list li::marker { color: var(--accent-ink); font-weight: 700; }
.rule-list p, .arch-list p { margin: 2px 0 0; font-size: 13px; }
.arch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.arch-list li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.arch-list li:first-child { border-top: 0; padding-top: 0; }
.arch-step { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.issue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.issue-list li { display: flex; gap: 10px; align-items: center; }
.state-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cap { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--surface); display: grid; gap: 6px; align-content: start; }
.cap h3 { font-size: 14px; margin: 0; }
.cap p { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.member-cell { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 12px; display: grid; place-items: center; flex: none; }
.link-box { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 8px; margin-bottom: 16px; }
.brand-preview { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.brand-preview .bp-top { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--surface-3); font-size: 11.5px; color: var(--muted); }
.brand-preview .bp-top i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong, #CBD5E1); }
.brand-preview .bp-body { display: grid; grid-template-columns: 150px 1fr; min-height: 220px; }
.brand-preview .bp-nav { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px; display: grid; gap: 8px; align-content: start; font-size: 12px; color: var(--muted); }
.brand-preview .bp-logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; margin-bottom: 6px; }
.brand-preview .bp-logo img { max-height: 24px; max-width: 90px; }
.brand-preview .bp-mark-img { width: 24px; height: 24px; object-fit: contain; }
.brand-preview .bp-mark { width: 24px; height: 24px; border-radius: 6px; background: var(--bp-accent, var(--accent)); color: #fff; display: grid; place-items: center; font-size: 12px; }
/* The accent marks the active item; its text stays ink so any brand colour keeps 4.5:1. */
.brand-preview .bp-active { color: var(--ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--bp-accent, var(--accent)); padding-left: 6px; }
.brand-preview .bp-main { padding: 16px; display: grid; gap: 10px; align-content: start; }
.brand-preview .bp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.brand-preview .bp-kpis div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 11px; color: var(--muted); }
.brand-preview .bp-kpis b { display: block; font-size: 16px; color: var(--ink); }
.brand-preview .bp-bar { height: 6px; border-radius: 3px; background: var(--bp-accent, var(--accent)); width: 62%; }
@media (max-width: 640px) { .brand-preview .bp-body { grid-template-columns: 1fr; } .brand-preview .bp-nav { border-right: 0; border-bottom: 1px solid var(--line); } }
.data-table.matrix td.num, .data-table.matrix th.num { text-align: center; }
.tick { color: var(--good, #15803D); display: inline-flex; }
.tick .icon { width: 16px; height: 16px; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field > legend { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
[hidden] { display: none !important; }
.input-sm { height: 32px; padding: 4px 8px; font-size: 13px; max-width: 140px; }
.form-grid.narrow { max-width: 560px; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="color"] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-xs); background: var(--surface); }
.warn-text { color: var(--warn); }
/* Scroll containers own their absolutely positioned descendants (e.g. .sr-only labels),
   so those cannot extend the page width outside the scroller. */
.kanban, .table-wrap, .table-scroll, .tabbar, .lead-card { position: relative; }

/* ------------------------------------------------ standalone pages */
body.auth { min-height: 100vh; background: var(--bg); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-wrap.has-aside { grid-template-columns: minmax(0, 440px) minmax(0, 460px); justify-content: center; align-items: center; gap: 48px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 28px; }
.auth-card .brand { padding: 0 0 20px; }
.auth-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-lead { color: var(--ink-2); margin: 0 0 18px; }
.auth-form { display: grid; gap: 14px; margin-top: 4px; }
.auth-foot { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
.btn-block { width: 100%; justify-content: center; height: 40px; }
.auth-aside-inner h2 { font-size: 26px; line-height: 1.25; letter-spacing: -.015em; margin: 4px 0 16px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: var(--ink-2); }
.auth-points li { position: relative; padding-left: 22px; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: 7px; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.auth-meta { margin: 0 0 16px; }
@media (max-width: 900px) { .auth-wrap.has-aside { grid-template-columns: minmax(0, 440px); gap: 24px; } .auth-aside { order: 2; } .auth-aside-inner h2 { font-size: 20px; } }

/* ------------------------------------------------ client portal */
body.portal { background: var(--bg); }
.portal-top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.portal-top-row { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.portal-top .brand { padding: 0; }
.portal-top .spacer { flex: 1; }
.portal-top .who { font-size: 12.5px; color: var(--muted); }
.portal-main { max-width: 1320px; margin: 0 auto; padding: 20px 20px 48px; }
.portal-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.portal-foot { max-width: 1320px; margin: 0 auto; padding: 16px 20px 32px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .portal-top-row { padding: 10px 14px; flex-wrap: wrap; } .portal-main { padding: 14px 14px 40px; } .portal-top .who { display: none; } }

/* ------------------------------------------------ report snapshot */
body.report-page { background: var(--bg); }
.rp-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.rp-sheet { width: min(980px, calc(100% - 24px)); margin: 24px auto 48px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 44px 48px; }
.rp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.rp-head .brand { padding: 0; }
.rp-period { text-align: right; display: grid; gap: 2px; }
.rp-period b { font-size: 17px; }
.rp-period small { color: var(--muted); }
.rp-hero { margin: 44px 0 20px; }
.rp-hero h1 { font-size: 34px; letter-spacing: -.02em; margin: 2px 0 2px; }
.rp-section { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 26px; break-inside: avoid; }
.rp-section h2 { font-size: 17px; margin: 0 0 12px; }
.rp-section h3 { font-size: 13px; margin: 0 0 8px; color: var(--ink-2); }
.rp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.rp-cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rp-col ul, .rp-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--ink-2); }
.rp-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rp-kpi { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 2px; }
.rp-kpi span { font-size: 11.5px; color: var(--muted); }
.rp-kpi b { font-size: 20px; letter-spacing: -.01em; }
.rp-kpi small { font-size: 11.5px; color: var(--muted); }
.rp-fine { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; }
.rp-chart .chart { min-height: 200px; }
.rp-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 40px; padding-top: 14px; font-size: 11.5px; color: var(--muted); }
@media (max-width: 760px) { .rp-sheet { padding: 24px 18px; } .rp-head { flex-direction: column; } .rp-period { text-align: left; } .rp-cols, .rp-cols.two { grid-template-columns: minmax(0, 1fr); } .rp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rp-hero h1 { font-size: 26px; } }
@media print {
  body.report-page { background: #fff; }
  .rp-toolbar { display: none !important; }
  .rp-sheet { width: auto; margin: 0; border: 0; box-shadow: none; padding: 0; }
  .rp-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rp-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); } .rp-cols.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  @page { size: A4; margin: 14mm; }
}

/* ------------------------------------------------ guided review (reviewer accounts) */
.review-path { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 16px; font-size: 12px; }
.review-path-label { color: var(--muted); font-weight: 600; white-space: nowrap; }
.review-path-label b { color: var(--ink); }
.review-path ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: thin; }
.review-step a { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; color: var(--ink-2); white-space: nowrap; }
.review-step a b { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 10.5px; }
.review-step.done a b { background: var(--good-soft); color: var(--good); }
.review-step.current a { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.review-step.current a b { background: var(--accent); color: var(--on-accent); }
.review-next { white-space: nowrap; font-weight: 600; }
.review-next.done { color: var(--good); }
@media (max-width: 760px) { .review-path-label { display: none; } }
.card + .grid, .grid + .card, .notice + .grid, .card + .kpi-grid { margin-top: 16px; }
.grid + .card { margin-top: 0; }
.form-stack { display: grid; gap: 12px; }
.inline-fields { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.inline-fields .field { flex: 1 1 240px; margin: 0; }
.onboard { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.onboard li::marker { font-weight: 700; color: var(--accent-ink); }
.onboard li p { margin: 2px 0 8px; font-size: 13px; }
.onboard li.done b { color: var(--muted); }
.rp-flash { width: min(980px, calc(100% - 24px)); margin: 16px auto -8px; }
@media print { .rp-flash { display: none !important; } }
.data-table td.metric-cell { min-width: 170px; max-width: 280px; }
small.clamp { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack { display: grid; gap: 16px; margin-bottom: 16px; }
.stack > .card + .card { margin-top: 0; }

/* Step-up password confirmation inside sensitive forms */
.stepup-field { display: inline-flex; flex-direction: column; gap: 4px; margin: 6px 8px 6px 0; }
.stepup-field span { font-size: 11.5px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.stepup-field input { min-width: 200px; }
.kpi-note { color: var(--muted); font-size: 11px; }

/* Sample-data flag in the top bar: generated data is never shown as live */
.sample-flag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--badge-warn-fg); background: var(--badge-warn-bg); border: 1px solid var(--badge-warn-border); white-space: nowrap; margin-right: 8px; }

/* ------------------------------------------ top bar, Overview queue */
.topbar-row > * { min-width: 0; }
.topbar-row > .sample-flag, .topbar-row > .theme-form, .topbar-row > .nav-open { flex: none; }
.topbar-title span { display: block; overflow: hidden; text-overflow: ellipsis; }
.theme-form { display: inline-flex; margin: 0; }
@media (max-width: 720px) {
  /* On a phone the pill keeps its dot and a short state ("Synced", "Stale", "Failed"); the time is in its title. */
  .freshness { max-width: 44vw; }
  .freshness .fresh-when { display: none; }
}
.page-overview .page-head .eyebrow { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.text-bad { color: var(--bad); }
.work-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.work-list li { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.work-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.work-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.work-row b { font-size: 13px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.work-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.work-stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.work-stats dt { font-size: 12px; color: var(--muted); }
.work-stats dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.table-wrap[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------- filter bar navigation */
/* No-JS fallback controls (the filter bar's Apply button) are hidden before the first
   paint when scripts run: html.has-js is set by the synchronous pulse-head.js in <head>. */
.has-js [data-autosubmit-fallback] { display: none !important; }

/* Filter changes and Refresh load the page again; they read as an update in place:
   a slim progress bar, the content dims only if loading takes a moment, the new page
   cross-fades in at the same scroll position and charts do not replay their entrance. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; animation-timing-function: var(--ease); }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left center; opacity: 0; pointer-events: none; }
.topbar.is-navigating::after { opacity: 1; animation: pulse-progress 2.4s var(--ease) forwards; }
@keyframes pulse-progress { 0% { transform: scaleX(.04); } 25% { transform: scaleX(.4); } 60% { transform: scaleX(.72); } 100% { transform: scaleX(.92); } }
.content[aria-busy="true"] { opacity: .62; transition: opacity 200ms var(--ease) 180ms; }
.fb-refresh.is-spinning { color: var(--accent-ink); pointer-events: none; }
.fb-refresh.is-spinning svg { animation: pulse-spin 800ms linear infinite; }
@keyframes pulse-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .topbar.is-navigating::after { transform: scaleX(.6); }
  .content[aria-busy="true"] { transition: none; }
}
.is-filter-nav .hbar-fill, .is-filter-nav .funnel-bar { transition: none; }

/* Theme: one button that shows the theme on screen and switches to the other one.
   With "Follow system" both are rendered and the system setting picks the visible one. */
.theme-toggle.theme-to-light { display: none; }
:root[data-theme="dark"] .theme-toggle.theme-to-dark { display: none; }
:root[data-theme="dark"] .theme-toggle.theme-to-light { display: inline-grid; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle.theme-to-dark { display: none; }
  :root:not([data-theme="light"]) .theme-toggle.theme-to-light { display: inline-grid; }
}
.theme-options { display: grid; gap: 8px; }
.theme-option { align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.theme-option input { margin-top: 2px; }
.theme-option span { display: flex; flex-direction: column; }
.theme-option small { color: var(--ink-2); }

/* Include in reporting (Ui::sourceSwitch) */
.src-switch { display: inline-flex; align-items: center; gap: 10px; margin: 0; }
.src-switch-track { position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; border: 0; padding: 0; background: var(--muted); cursor: pointer; transition: background var(--t); }
.src-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--t) var(--ease); }
.src-switch.is-on .src-switch-track { background: var(--accent); }
.src-switch.is-on .src-switch-track::after { transform: translateX(16px); }
.src-switch.is-readonly .src-switch-track { cursor: default; }
.src-switch-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.src-switch-label { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.src-switch-state { font-size: 13px; font-weight: 650; color: var(--ink); }
.src-switch:not(.is-on) .src-switch-state { color: var(--ink-2); }
.src-explain { max-width: 980px; }
.hint-link { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* Heading typeface (White Label → Heading font). Newsreader is the PULSE
   default; "grotesk" is a sturdier sans, "inter" keeps one family everywhere. */
html[data-heading="grotesk"] { --font-display: "Schibsted Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; --display-weight: 700; --display-tracking: -.015em; }
html[data-heading="inter"] { --font-display: var(--font-body); --display-weight: 720; --display-tracking: -.02em; }
.page-head h1,
.section-head h2,
.card-primary > .card-head h2,
.auth-card h1,
.auth-aside-inner h2,
.rp-hero h1,
.modal h2,
.brand-text b,
.brand-preview .bp-main > b,
.brand-preview .bp-logo span {
  font-family: var(--font-display);
}
.page-head h1,
.section-head h2,
.card-primary > .card-head h2,
.auth-card h1,
.auth-aside-inner h2,
.rp-hero h1 {
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
}
/* A serif reads smaller than a sans at the same size. */
html:not([data-heading="grotesk"]):not([data-heading="inter"]) .page-head h1 { font-size: 25px; }
html:not([data-heading="grotesk"]):not([data-heading="inter"]) .section-head h2,
html:not([data-heading="grotesk"]):not([data-heading="inter"]) .card-primary > .card-head h2 { font-size: 17.5px; }
@media (max-width: 720px) {
  html:not([data-heading="grotesk"]):not([data-heading="inter"]) .page-head h1 { font-size: 21px; }
}

/* iOS/iPadOS Safari zooms in when the focused control's font is under 16px.
   Phones and tablets (iPad Pro in landscape is a coarse pointer wider than
   1024px) get 16px controls; desktop density is unchanged. Keep this rule last
   so no component size overrides it. */
@media (max-width: 1024px), (pointer: coarse) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  input[type="month"],
  input[type="week"],
  input:not([type]),
  select,
  textarea {
    font-size: 16px !important;
  }
}
