/* ROKKA Screener UI: shared design tokens and components.
   Every page links this first; page-specific styles stay inline per page
   and use only the tokens defined here.

   Look: an instrument panel, not a marketing site. Flat panels with a
   title strip, solid 1px rules, 4px corners, no drop shadows. Colour is
   reserved for meaning: one ink-blue for interaction, red/amber/green
   for verdicts only. Numbers, ids and timestamps are set in mono. */

/* Space Grotesk: wordmark only */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk-latin-ext.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: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/space-grotesk-latin.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;
}

/* IBM Plex Sans (variable) + Plex Mono: UI faces (OFL, see /fonts/IBM-PLEX-LICENSE.txt) */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin-ext.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: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-latin.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;
}
/* IBM Plex Mono, locally modified (allowed by its SIL OFL licence): in the
   ibm-plex-mono-latin-400/500 files the dot inside the zero (zero,
   zero.numr, zero.dnom) was removed — every other glyph and all spacing
   are the original. Re-apply this if those files are ever replaced. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-ext-400.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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-400.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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-ext-500.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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-500.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;
}

/* ================= design tokens =================
   Components use these, never raw values. Colour tokens are redefined
   for dark mode below; everything else is theme-independent. */
:root {
  /* neutrals (solid values, no alpha: borders read the same on every surface) */
  --page: #eceef0;
  --surface: #ffffff;
  --surface-2: #f6f7f8;          /* panel title strips, table heads, row hover */
  --field: #f6f7f8;
  --input-bg: #ffffff;
  --ink: #16181b;
  --ink-2: #3a3e44;
  --muted: #5b6168;
  --border: #d3d7db;
  --border-strong: #aeb4ba;
  --border-input: #868d95;        /* form field outlines: 3:1 on white */
  --hairline: #e5e7ea;           /* row dividers inside panels */
  --track: #e3e6e9;

  /* the one accent: interaction, focus, charts */
  --accent: #1f4f8f;
  --accent-hover: #173d70;
  --accent-ink: #ffffff;
  --accent-soft: #e9eff8;

  /* status: verdicts only, never decoration */
  --good: #1d6b38;
  --warning: #8a5300;
  --warning-fill: #d9930d;
  --critical: #b42318;
  --good-soft: #eaf4ed;
  --warning-soft: #fbf2df;
  --critical-soft: #fcebe9;
  --good-line: #9ccaa9;
  --warning-line: #e5c27f;
  --critical-line: #eeaca5;

  --tooltip-bg: #16181b;
  --tooltip-ink: #c9cdd2;
  --tooltip-strong: #ffffff;
  --shadow-pop: 0 6px 20px rgba(22, 24, 27, 0.18);   /* floating layers only */
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%235b6168'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
  --date-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%235b6168'%3E%3Cpath d='M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z'/%3E%3C/svg%3E");
  --backdrop: rgba(22, 24, 27, 0.42);

  /* typography */
  --font-ui: 'IBM Plex Sans', system-ui, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --font-brand: 'Space Grotesk', var(--font-ui);
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 26px;
  --text-display: 32px;          /* login wordmark */
  --leading-tight: 1.25;
  --leading: 1.5;
  --leading-relaxed: 1.6;

  /* spacing (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  /* one radius system: 4px for panels and controls, 2px for tags and bars */
  --r-sm: 2px;
  --r: 4px;

  /* motion: colour changes only, fast */
  --dur: 100ms;

  /* control heights: anything that can sit in one toolbar row shares these */
  --ctl-h: 36px;
  --ctl-h-sm: 32px;

  /* icons (Phosphor regular, MIT; see /assets/PHOSPHOR-ICONS-LICENSE.txt),
     used as CSS masks so markup stays unchanged */
  --i-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='black'%3E%3Cpath d='M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z'/%3E%3C/svg%3E");
  --i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='black'%3E%3Cpath d='M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z'/%3E%3C/svg%3E");
  --i-trash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='black'%3E%3Cpath d='M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z'/%3E%3C/svg%3E");
  --i-warning: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='black'%3E%3Cpath d='M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z'/%3E%3C/svg%3E");
  --i-upload: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='black'%3E%3Cpath d='M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0ZM93.66,77.66,120,51.31V144a8,8,0,0,0,16,0V51.31l26.34,26.35a8,8,0,0,0,11.32-11.32l-40-40a8,8,0,0,0-11.32,0l-40,40A8,8,0,0,0,93.66,77.66Z'/%3E%3C/svg%3E");
  --i-download: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='black'%3E%3Cpath d='M224,144v64a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V144a8,8,0,0,1,16,0v56H208V144a8,8,0,0,1,16,0Zm-101.66,5.66a8,8,0,0,0,11.32,0l40-40a8,8,0,0,0-11.32-11.32L136,124.69V32a8,8,0,0,0-16,0v92.69L93.66,98.34a8,8,0,0,0-11.32,11.32Z'/%3E%3C/svg%3E");
  --i-caret-left: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='black'%3E%3Cpath d='M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z'/%3E%3C/svg%3E");

  /* layout: FROZEN, these reproduce the original geometry */
  --layout-sidebar-w: 236px;
  --layout-main-max: 980px;
  --layout-gap: 18px;            /* between stacked panels/sections */

  color-scheme: light;
}

:root[data-theme="dark"] {
  --page: #101113;
  --surface: #17181b;
  --surface-2: #1c1e21;
  --field: #1c1e21;
  --input-bg: #121315;
  --ink: #e7e8ea;
  --ink-2: #b9bdc3;
  --muted: #8d9299;
  --border: #2d3035;
  --border-strong: #464a51;
  --border-input: #666b73;
  --hairline: #232529;
  --track: #2a2d31;

  --accent: #8fb1e8;
  --accent-hover: #abc5ef;
  --accent-ink: #101113;
  --accent-soft: #1d2634;

  --good: #52b574;
  --warning: #e2a73c;
  --warning-fill: #e2a73c;
  --critical: #f0705f;
  --good-soft: #17251c;
  --warning-soft: #2a2215;
  --critical-soft: #2d1916;
  --good-line: #2f5a3c;
  --warning-line: #5c4620;
  --critical-line: #6a3029;

  --tooltip-bg: #e7e8ea;
  --tooltip-ink: #3a3e44;
  --tooltip-strong: #16181b;
  --shadow-pop: 0 6px 20px rgba(0, 0, 0, 0.55);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%238d9299'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
  --date-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%238d9299'%3E%3Cpath d='M208,32H184V24a8,8,0,0,0-16,0v8H88V24a8,8,0,0,0-16,0v8H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM72,48v8a8,8,0,0,0,16,0V48h80v8a8,8,0,0,0,16,0V48h24V80H48V48ZM208,208H48V96H208V208Z'/%3E%3C/svg%3E");
  --backdrop: rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

/* async data can grow a page past the viewport after first paint; reserve
   the scrollbar gutter so the centered layout never shifts when it appears */
html { scrollbar-gutter: stable; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--ink); }

body.with-sidebar {
  display: grid;
  grid-template-columns: var(--layout-sidebar-w) minmax(0, 1fr);
  /* the sidebar is injected by rokka.js; paint its column from the first
     frame and pin main to column 2 so nothing moves when it arrives */
  background: linear-gradient(90deg,
    var(--surface) 0 calc(var(--layout-sidebar-w) - 1px),
    var(--border) calc(var(--layout-sidebar-w) - 1px) var(--layout-sidebar-w),
    var(--page) var(--layout-sidebar-w));
}
body.with-sidebar > aside.sidebar { grid-column: 1; grid-row: 1; }
body.with-sidebar > main { grid-column: 2; grid-row: 1; }
/* page strings are filled by rokka.js; hold main back until that has run so
   headings and panel titles never appear empty and then push content down.
   The delayed animation is a fallback in case the script never runs. */
html:not(.rk-ready) body.with-sidebar > main { visibility: hidden; animation: rk-show 0s 1.5s forwards; }
@keyframes rk-show { to { visibility: visible; } }

/* language switch: fade out, reload, reveal once the new language is applied */
body { transition: opacity 160ms ease-out; }
html.rk-fade body, html.rk-leaving body { opacity: 0; }
html.rk-leaving body { transition-duration: 120ms; }

/* ---- focus: one crisp outline for every interactive element ---- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- sidebar ---- */
aside.sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 16px 18px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.wordmark {
  font-family: var(--font-brand);
  font-size: var(--text-xl); font-weight: 700; letter-spacing: 0.24em; line-height: 1.1;
  color: var(--ink); padding-left: 2px;
}
.wordmark::after { content: '.'; color: var(--critical); letter-spacing: 0; }
/* product line under the wordmark: same brand face, small caps, tracked to
   about the wordmark's width */
.wordmark-sub {
  font-family: var(--font-brand);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.5em; line-height: 1;
  text-transform: uppercase; color: var(--muted);
  margin-top: 5px; padding-left: 3px;
}
.wordmark-sub + .tagline { margin-top: 9px; }
.tagline { color: var(--muted); font-size: var(--text-xs); margin-top: 6px; padding-left: 2px; }

nav.side-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-base); font-weight: 500; color: var(--ink-2);
  text-decoration: none; border-radius: var(--r);
  padding: 7px 12px;
  transition: background var(--dur), color var(--dur);
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active {
  background: var(--accent-soft); color: var(--ink); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-count {
  margin-left: auto; font-size: var(--text-2xs); font-weight: 500;
  color: var(--warning); background: var(--warning-soft);
  border: 1px solid var(--warning-line); border-radius: var(--r-sm);
  padding: 0 5px; line-height: 17px;
}

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-3); }
.side-pills { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-left: 2px; }
.pill { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.pill.live { color: var(--ink-2); font-weight: 500; }
.pill.live::before {
  content: ''; display: inline-block; width: 7px; height: 7px;
  border-radius: 1px; background: var(--muted); margin-right: 6px;
  vertical-align: 1px;
}
.pill.live.ok::before { background: var(--good); }
.pill.live.err::before { background: var(--critical); }

.side-actions { display: flex; gap: 6px; }
.icon-btn {
  font: inherit; font-size: var(--text-xs); font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 30px; padding: 0 8px;
  color: var(--ink-2); background: var(--surface); text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer; flex: 1;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }

a.side-link {
  font-size: var(--text-sm); color: var(--ink-2); text-decoration: none;
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: var(--r); text-align: center;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
a.side-link:hover { color: var(--ink); background: var(--surface-2); border-color: var(--border-strong); }

/* ---- operator kill-switch (owner only) ---- */
.owner-ctl {
  margin-top: 6px; padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 9px;
}
.owner-status {
  font-size: var(--text-xs); font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 7px; min-height: 18px;
}
.owner-status::before {
  content: ""; width: 7px; height: 7px; border-radius: 1px;
  background: var(--muted);
}
.owner-status.running { color: var(--good); }
.owner-status.running::before { background: var(--good); }
.owner-status.stopped { color: var(--critical); }
.owner-status.stopped::before { background: var(--critical); }
.owner-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.owner-btn {
  font: inherit; font-size: var(--text-xs); font-weight: 600; line-height: 1.3;
  padding: 6px 6px; border-radius: var(--r); min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
}
.owner-btn:hover:not(:disabled) { border-color: var(--border-strong); }
.owner-btn.stop:not(:disabled) { color: var(--critical); }
.owner-btn.stop:hover:not(:disabled) { background: var(--critical-soft); border-color: var(--critical-line); }
.owner-btn.start:not(:disabled) { color: var(--good); }
.owner-btn.start:hover:not(:disabled) { background: var(--good-soft); border-color: var(--good-line); }
.owner-btn:disabled { color: var(--muted); background: var(--surface-2); cursor: not-allowed; }

/* ---- main column ---- */
main {
  padding: 34px clamp(20px, 4vw, 48px) 48px;
  max-width: var(--layout-main-max); width: 100%; margin-inline: auto;
}
.page-head { margin-bottom: 22px; }
.page-head h1 {
  font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.01em;
  line-height: var(--leading-tight); color: var(--ink);
}
.page-head p { color: var(--muted); font-size: var(--text-base); margin-top: 4px; }

.banner {
  border: 1px solid var(--critical-line);
  border-left: 3px solid var(--critical);
  background: var(--critical-soft);
  color: var(--ink-2); border-radius: var(--r);
  padding: 10px 14px; font-size: var(--text-base); margin-bottom: var(--layout-gap);
}
.banner strong { color: var(--critical); font-weight: 600; }

/* live password-rule checklist (filled by rokka.js) */
/* collapsed until the field is focused or non-empty; the 0fr→1fr row
   animates the height, so closing glides shut and leaves no gap */
.pw-rules-box {
  display: grid; grid-template-rows: 0fr; opacity: 0; visibility: hidden;
  transition: grid-template-rows 220ms ease, opacity 180ms ease, margin 220ms ease,
    visibility 0s linear 220ms;
}
.pw-rules-box.open {
  grid-template-rows: 1fr; opacity: 1; visibility: visible;
  transition: grid-template-rows 220ms ease, opacity 180ms ease, margin 220ms ease;
}
.pw-rules-box > div { overflow: hidden; min-height: 0; }
.pw-rules {
  list-style: none; margin: 0; padding: 8px 0 0;
  display: grid; gap: 3px; font-size: var(--text-xs);
}
.pw-rules li { display: flex; align-items: center; gap: 6px; color: var(--critical); }
.pw-rules li.ok { color: var(--good); }
.pw-rules .pw-mark { width: 1em; text-align: center; font-weight: 700; }

/* "new password again": match signal, and red after a mismatched submit */
.pw-match { font-size: var(--text-xs); margin-top: 5px; color: var(--critical); }
.pw-match.ok { color: var(--good); }
.pw-match[hidden] { display: none; }
input.pw-invalid, input.pw-invalid:hover, input.pw-invalid:focus {
  border-color: var(--critical);
}
input.pw-invalid:focus { box-shadow: 0 0 0 1px var(--critical); }
/* show/hide eye inside password fields (wrapped by rokka.js) */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { display: block; padding-right: 38px; }
.pw-eye {
  position: absolute; top: 0; right: 0; bottom: 0; width: 36px;
  display: grid; place-items: center; padding: 0;
  background: none; border: 0; border-radius: var(--r);
  color: var(--muted); cursor: pointer;
}
.pw-eye:hover { color: var(--ink); }
.pw-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: -5px; }
.pw-eye svg { width: 17px; height: 17px; }
/* ---- verification code field (wrapped by rokka.js) ------------------
   To make the digits bigger or smaller, change --code-font-size below;
   the underlines, spacing and box width all follow it. */
:root {
  --code-font-size: 28px;
}
.code-box {
  --digits: 8;  /* set per field by rokka.js (older setups use 6) */
  --cell: calc(var(--code-font-size) * 1.3);  /* one digit + its gap */
  --code-line: var(--border-strong);
  position: relative;
  /* half a slot of spare room: the caret after the last digit stays inside,
     so the browser never scrolls the digits off their underlines */
  width: calc(var(--cell) * (var(--digits) + 0.5)); overflow: hidden;
}
.code-box::after {
  /* one underline per digit, with a small gap between them */
  content: ''; position: absolute; left: 0; bottom: 0;
  width: calc(var(--cell) * var(--digits)); height: 2px; pointer-events: none;
  background-image: linear-gradient(to right,
    transparent 0 5px, var(--code-line) 5px calc(var(--cell) - 5px), transparent 0);
  background-size: var(--cell) 2px; background-repeat: repeat-x;
}
.code-box:focus-within { --code-line: var(--accent); }
.code-box:has(.pw-invalid) { --code-line: var(--critical); }
.code-box input.code-input,
.code-box input.code-input:hover,
.code-box input.code-input:focus {
  display: block; margin: 0;
  /* wider than the box, so the space after the last digit never scrolls it */
  width: calc(var(--cell) * (var(--digits) + 1));
  border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none;
  font-family: var(--font-mono); font-size: var(--code-font-size); line-height: 1.3;
  /* monospace digits are 0.6em wide: centre each one in its cell */
  letter-spacing: calc(var(--cell) - 0.6em);
  padding: 2px 0 6px calc((var(--cell) - 0.6em) / 2);
  color: var(--ink); caret-color: var(--accent);
}
input.pw-locked:disabled { cursor: not-allowed; background: var(--surface-2); }

/* panels: a flat box; a leading section title becomes its title strip */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--space-5);
  margin-bottom: var(--layout-gap);
}
.section-label {
  display: block; font-size: var(--text-sm); font-weight: 600;
  line-height: var(--leading-tight); color: var(--ink); margin-bottom: 12px;
}
.card > .section-label:first-child,
.card > .list-head:first-child {
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-4);
  padding: 10px var(--space-5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: var(--r) var(--r) 0 0;
}
.card > .list-head:first-child { padding-block: 7px; min-height: 39px; }

/* ---- stat tiles: the verdict colour runs along the top edge ---- */
.tiles {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: var(--layout-gap);
}
@media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px 13px;
  box-shadow: inset 0 3px 0 var(--ink);
}
.tile:has(.dot.critical) { box-shadow: inset 0 3px 0 var(--critical); }
.tile:has(.dot.warning) { box-shadow: inset 0 3px 0 var(--warning-fill); }
.tile:has(.dot.good) { box-shadow: inset 0 3px 0 var(--good); }
.tile .dot { display: none; }
.tile-value {
  font-family: var(--font-mono); font-size: var(--text-2xl); font-weight: 500;
  line-height: 1.15; letter-spacing: -0.02em;
}
.tile-label {
  display: flex; align-items: center; gap: 7px;
  font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); margin-top: 6px;
}
.tile-sub { color: var(--muted); font-size: var(--text-xs); margin-top: 1px; }

/* legend keys: small squares, not dots */
.dot { width: 9px; height: 9px; border-radius: 1px; flex: none; }
.dot.critical { background: var(--critical); }
.dot.warning { background: var(--warning-fill); }
.dot.good { background: var(--good); }
.dot.muted { background: var(--muted); }

/* ---- charts ---- */
.split-bar { display: flex; gap: 2px; height: 12px; margin-top: 4px; }
.split-seg { min-width: 3px; transition: opacity var(--dur); }
.split-seg:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.split-seg:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.split-seg:hover { opacity: 0.85; }
.split-seg.critical { background: var(--critical); }
.split-seg.warning { background: var(--warning-fill); }
.split-seg.good { background: var(--good); }

.legend { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 12px; }
.legend-item {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--ink-2);
}
.legend-item b { color: var(--ink); font-weight: 500; }

.barchart { margin-top: 4px; display: grid; row-gap: 8px; }
.bar-row {
  display: grid; grid-template-columns: 210px 1fr; gap: 12px;
  align-items: center; font-size: var(--text-sm);
}
@media (max-width: 700px) { .bar-row { grid-template-columns: 120px 1fr; } }
.bar-name {
  color: var(--ink-2); text-align: right;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.bar-area {
  display: flex; align-items: center; gap: 8px;
  border-left: 1px solid var(--border-strong); min-height: 18px;
}
.bar-fill {
  height: 12px; background: var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; min-width: 2px;
  transition: opacity var(--dur);
}
.bar-fill:hover { opacity: 0.85; }
.bar-count { color: var(--ink-2); font-size: var(--text-xs); }
.chart-empty { color: var(--muted); font-size: var(--text-sm); margin-top: 10px; }

/* ---- form controls ---- */
input, select, textarea {
  background: var(--input-bg); color: var(--ink);
  border: 1px solid var(--border-input); border-radius: var(--r);
  padding: 7px 10px; font: inherit; font-size: var(--text-base);
  transition: border-color var(--dur);
}
input:hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus) { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
select {
  cursor: pointer; appearance: none; -webkit-appearance: none;
  padding-right: 30px;
  background-image: var(--select-arrow); background-repeat: no-repeat;
  background-position: right 9px center; background-size: 13px;
}
select option { background: var(--surface); color: var(--ink); }
input[type=checkbox] {
  accent-color: var(--accent); cursor: pointer;
  width: 14px; height: 14px; padding: 0;
}
input[type=checkbox]:focus { box-shadow: none; }

textarea { width: 100%; resize: vertical; font-size: var(--text-md); line-height: var(--leading); padding: 10px 12px; }
textarea:disabled { cursor: not-allowed; background: var(--field); color: var(--muted); }

button.primary {
  font: inherit; font-weight: 600; font-size: var(--text-base);
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: var(--r); padding: 8px 18px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  white-space: nowrap;
  transition: background var(--dur), border-color var(--dur);
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.primary:disabled {
  background: var(--surface-2); border-color: var(--border); color: var(--muted); cursor: not-allowed;
}
button.primary.loading:disabled {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); opacity: 0.8; cursor: wait;
}

.spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.8s linear infinite; display: none;
}
button.primary.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .spinner { animation-duration: 2s; }
}

button.ghost {
  font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 5px 12px; cursor: pointer; white-space: nowrap;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
button.ghost:hover:not(:disabled) { color: var(--ink); background: var(--surface-2); border-color: var(--border-strong); }
button.ghost:disabled { color: var(--muted); background: var(--surface-2); cursor: not-allowed; }
button.danger { color: var(--critical); }
button.danger:hover:not(:disabled) {
  color: var(--critical); background: var(--critical-soft); border-color: var(--critical-line);
}
button.danger:disabled { color: var(--muted); }

/* ---- verdict badge: a flag with a coloured leading edge ---- */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-weight: 600; font-size: var(--text-md);
  padding: 5px 12px 5px 10px; border-radius: var(--r);
  border: 1px solid; border-left-width: 3px;
}
.badge svg { width: 18px; height: 18px; flex: none; }
.badge.small { font-size: var(--text-sm); padding: 2px 9px 2px 8px; }
.badge.critical { color: var(--critical); background: var(--critical-soft); border-color: var(--critical-line) var(--critical-line) var(--critical-line) var(--critical); }
.badge.warning { color: var(--warning); background: var(--warning-soft); border-color: var(--warning-line) var(--warning-line) var(--warning-line) var(--warning-fill); }
.badge.good { color: var(--good); background: var(--good-soft); border-color: var(--good-line) var(--good-line) var(--good-line) var(--good); }

/* ---- categories + analysis ---- */
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.cat {
  font-size: var(--text-xs); color: var(--ink-2);
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: var(--r-sm); padding: 2px 8px; cursor: help;
}
.cat:hover { border-color: var(--border-strong); color: var(--ink); }
.cats-empty { color: var(--muted); font-size: var(--text-sm); margin-top: 14px; }

.analysis-label {
  font-size: var(--text-xs); font-weight: 600; color: var(--muted);
  margin: var(--space-4) 0 4px;
}
.analysis { color: var(--ink-2); font-size: var(--text-base); line-height: var(--leading-relaxed); max-width: 72ch; }

.meta {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  margin-top: var(--space-4); padding-top: 12px;
  border-top: 1px solid var(--hairline);
  color: var(--muted); font-size: var(--text-xs);
}

/* ---- expandable row lists ---- */
ul.rows { list-style: none; padding: 0; }
.rows li { border-top: 1px solid var(--hairline); }
.rows li:first-child { border-top: 0; }
.row-head {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px; cursor: pointer; font-size: var(--text-base);
  transition: background var(--dur);
}
.row-head:hover { background: var(--surface-2); }
/* the verdict word is already coloured: no extra dot in rows */
.row-head > .dot { display: none; }
.row-verdict { flex: none; font-weight: 600; font-size: var(--text-xs); width: 118px; }
.row-verdict.critical { color: var(--critical); }
.row-verdict.warning { color: var(--warning); }
.row-verdict.good { color: var(--good); }
.row-verdict.muted { color: var(--muted); }
.row-text {
  color: var(--ink-2); overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; flex: 1; min-width: 60px;
}
.row-conf { flex: none; color: var(--muted); font-size: var(--text-xs); }
/* chevron: the ▶ glyph stays in the DOM and is drawn as an icon */
.chev {
  flex: none; display: inline-block; width: 12px; height: 12px;
  font-size: 0; color: var(--muted); background: currentColor;
  -webkit-mask: var(--i-caret) center / contain no-repeat;
  mask: var(--i-caret) center / contain no-repeat;
  transition: transform var(--dur);
}
li.open .chev { transform: rotate(90deg); color: var(--ink); }
li.open > .row-head { background: var(--surface-2); }

.row-detail { padding: 6px 6px 18px 28px; background: var(--surface-2); border-top: 1px solid var(--hairline); }
.row-fulltext {
  color: var(--ink); font-size: var(--text-base); line-height: 1.6;
  border-left: 2px solid var(--border-strong); padding: 2px 0 2px 12px;
  margin: 8px 0 4px; white-space: pre-wrap; max-width: 80ch;
}
.row-detail .cats { margin-top: 12px; }
.row-detail .analysis { font-size: var(--text-base); }
.row-detail .analysis-label { margin-top: 14px; }
.empty { color: var(--muted); font-size: var(--text-base); padding: 12px 4px; }

/* ---- segmented button groups (range, verdict filter, theme, language) ---- */
.vchips {
  display: inline-flex; height: var(--ctl-h-sm); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
}
.vchip {
  font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--ink-2);
  background: none; border: 0; border-radius: 0;
  padding: 0 12px; cursor: pointer; line-height: 1;
  transition: background var(--dur), color var(--dur);
}
.vchip + .vchip { border-left: 1px solid var(--border); }
.vchip:hover { background: var(--surface-2); color: var(--ink); }
.vchip.active, .vchip.active:hover { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.vchip:focus-visible { outline-offset: -2px; }

/* text tabs (batch list filter) */
.filter {
  font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--muted);
  background: none; border: 0; border-radius: 0;
  padding: 4px 2px; margin: 0 4px; cursor: pointer;
  transition: color var(--dur), box-shadow var(--dur);
}
.filter:hover { color: var(--ink); }
.filter.active { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

.list-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.list-head .section-label { margin: 0 auto 0 0; }
.result-count { color: var(--muted); font-size: var(--text-xs); }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

/* ---- tooltip ---- */
#tooltip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--tooltip-bg); border-radius: var(--r); padding: 6px 10px;
  font-size: var(--text-xs); line-height: 1.45; color: var(--tooltip-ink); max-width: 340px;
  box-shadow: var(--shadow-pop);
}
#tooltip b { color: var(--tooltip-strong); font-weight: 600; }

/* ---- range selector (dashboard) ---- */
.range-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px; min-height: var(--ctl-h-sm);
}
.range-row .date-input { height: var(--ctl-h-sm); }
.range-row .datewrap {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: var(--text-xs);
}

footer {
  display: flex; align-items: center; gap: 14px; margin-top: 6px;
  color: var(--muted); font-size: var(--text-xs); flex-wrap: wrap;
}

/* ---- in-app dialog (replaces confirm/prompt/alert) ----
   Same language as the stat tiles: a flat box with a 3px tone edge on top,
   a tinted icon tile, and the decision buttons in a footer strip. */
dialog.rk-dialog {
  margin: auto;            /* the global reset zeroes the native centring */
  padding: 0; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink);
  width: min(460px, calc(100vw - 32px));
  box-shadow: inset 0 3px 0 var(--tone), var(--shadow-pop);
  --tone: var(--accent); --tone-soft: var(--accent-soft);
}
dialog.rk-dialog.tone-danger { --tone: var(--critical); --tone-soft: var(--critical-soft); }
dialog.rk-dialog.tone-warning { --tone: var(--warning-fill); --tone-soft: var(--warning-soft); }
dialog.rk-dialog::backdrop { background: var(--backdrop); }
dialog.rk-dialog[open] { animation: rk-dialog-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog.rk-dialog[open]::backdrop { animation: rk-fade-in 160ms ease-out; }
dialog.rk-dialog.closing { animation: rk-dialog-out 110ms ease-in forwards; }
dialog.rk-dialog.closing::backdrop { animation: rk-fade-out 110ms ease-in forwards; }
@keyframes rk-dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
@keyframes rk-dialog-out { to { opacity: 0; transform: translateY(4px) scale(0.99); } }
@keyframes rk-fade-in { from { opacity: 0; } }
@keyframes rk-fade-out { to { opacity: 0; } }

.rk-dialog-main {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 22px var(--space-5) var(--space-5);
}
.rk-dialog-icon {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: var(--r); background: var(--tone-soft); color: var(--tone);
  border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
}
.rk-dialog-icon svg { width: 20px; height: 20px; }
.rk-dialog-content { min-width: 0; flex: 1; }
.rk-dialog-content h2 {
  font-size: var(--text-lg); font-weight: 600; line-height: var(--leading-tight);
  letter-spacing: -0.01em; color: var(--ink); margin-top: 2px;
}
.rk-dialog-body { margin-top: 8px; color: var(--ink-2); font-size: var(--text-base); line-height: var(--leading); }
.rk-dialog-body p + p { margin-top: 8px; }
.rk-dialog-body strong { color: var(--ink); font-weight: 600; }
.rk-dialog-facts {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px;
  margin-top: 14px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  font-size: var(--text-sm);
}
.rk-dialog-facts dt { color: var(--muted); }
.rk-dialog-facts dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.rk-dialog-field { margin-top: 14px; }
.rk-dialog-field label { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.rk-dialog-field input { width: 100%; }
.rk-dialog-hint { color: var(--muted); font-size: var(--text-xs); margin-top: 6px; }
.rk-dialog-err { color: var(--critical); font-size: var(--text-sm); margin-top: 6px; }
.rk-dialog-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px var(--space-5);
  background: var(--surface-2); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r) var(--r);
}
.rk-dialog-foot button { min-width: 88px; justify-content: center; }
.rk-dialog-foot button.ghost { padding: 8px 14px; font-size: var(--text-base); }
button.primary.danger-solid { background: var(--critical); border-color: var(--critical); color: var(--accent-ink); }
button.primary.danger-solid:hover:not(:disabled) { background: var(--critical); border-color: var(--critical); filter: brightness(0.92); }
@media (prefers-reduced-motion: reduce) {
  dialog.rk-dialog[open], dialog.rk-dialog[open]::backdrop,
  dialog.rk-dialog.closing, dialog.rk-dialog.closing::backdrop { animation: none; }
}

/* ---- service stopped: explanation at the top of every page ---- */
.svc-banner {
  display: flex; align-items: flex-start; gap: 12px;
  border: 1px solid var(--warning-line); border-left: 3px solid var(--warning-fill);
  background: var(--warning-soft); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: var(--layout-gap);
}
.svc-banner-icon {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: var(--r); background: var(--surface); color: var(--warning);
  border: 1px solid var(--warning-line);
}
.svc-banner-icon svg { width: 18px; height: 18px; }
.svc-banner-text { flex: 1; min-width: 0; font-size: var(--text-sm); color: var(--ink-2); }
.svc-banner-head strong { color: var(--ink); font-weight: 600; font-size: var(--text-base); }
.svc-banner-reason { margin-top: 4px; color: var(--ink); }
.svc-banner-reason b { font-weight: 600; }
.svc-banner-effect { margin-top: 4px; color: var(--muted); }
.svc-banner button.ghost { flex: none; align-self: center; }

/* ---- theme switch: organic reveal (see switchTheme in rokka.js) ---- */
@property --vt-r { syntax: '<length>'; inherits: true; initial-value: 0px; }
/* no colour tweens while the theme flips: the revealed view is live, so
   100ms transitions would briefly show old colours inside the new theme */
html.rk-theme-vt *, html.rk-theme-vt *::before, html.rk-theme-vt *::after { transition: none !important; }
html.rk-theme-vt::view-transition-old(root),
html.rk-theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.rk-theme-vt::view-transition-new(root) {
  --vt-edge: 1px;    /* edge of the reveal: 1px = firm line (0 looks jagged), larger = softer */
  -webkit-mask-image:
    radial-gradient(circle at var(--vt-x) var(--vt-y), #000 calc(var(--vt-r) * 0.8 - var(--vt-edge)), transparent calc(var(--vt-r) * 0.8)),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b1x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b1y)), #000 calc(var(--vt-r) * var(--vt-b1s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b1s))),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b2x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b2y)), #000 calc(var(--vt-r) * var(--vt-b2s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b2s))),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b3x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b3y)), #000 calc(var(--vt-r) * var(--vt-b3s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b3s))),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b4x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b4y)), #000 calc(var(--vt-r) * var(--vt-b4s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b4s))),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b5x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b5y)), #000 calc(var(--vt-r) * var(--vt-b5s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b5s)));
  mask-image:
    radial-gradient(circle at var(--vt-x) var(--vt-y), #000 calc(var(--vt-r) * 0.8 - var(--vt-edge)), transparent calc(var(--vt-r) * 0.8)),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b1x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b1y)), #000 calc(var(--vt-r) * var(--vt-b1s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b1s))),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b2x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b2y)), #000 calc(var(--vt-r) * var(--vt-b2s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b2s))),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b3x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b3y)), #000 calc(var(--vt-r) * var(--vt-b3s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b3s))),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b4x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b4y)), #000 calc(var(--vt-r) * var(--vt-b4s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b4s))),
    radial-gradient(circle at calc(var(--vt-x) + var(--vt-r) * var(--vt-b5x)) calc(var(--vt-y) + var(--vt-r) * var(--vt-b5y)), #000 calc(var(--vt-r) * var(--vt-b5s) - var(--vt-edge)), transparent calc(var(--vt-r) * var(--vt-b5s)));
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}

/* ---- date field + calendar popover (replaces the native date picker) ---- */
input.date-input {
  width: 132px; cursor: pointer; caret-color: transparent;
  padding-right: 32px;
  background-image: var(--date-icon); background-repeat: no-repeat;
  background-position: right 9px center; background-size: 15px;
}
input.date-input[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.rk-cal {
  position: absolute; z-index: 20; width: 252px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--shadow-pop); color: var(--ink);
}
.rk-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  border-radius: var(--r) var(--r) 0 0;
}
.rk-cal-title { font-size: var(--text-sm); font-weight: 600; text-transform: capitalize; }
.rk-cal-nav {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-sm); background: none;
  color: var(--ink-2); cursor: pointer;
}
.rk-cal-nav::before {
  content: ''; width: 13px; height: 13px; background: currentColor;
  -webkit-mask: var(--i-caret) center / contain no-repeat; mask: var(--i-caret) center / contain no-repeat;
}
.rk-cal-nav.prev::before {
  -webkit-mask-image: var(--i-caret-left); mask-image: var(--i-caret-left);
}
.rk-cal-nav:hover { background: var(--surface); border-color: var(--border); color: var(--ink); }
.rk-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 8px;
}
.rk-cal-dow {
  font-size: var(--text-2xs); font-weight: 600; color: var(--muted);
  text-align: center; padding: 2px 0 4px; text-transform: capitalize;
}
.rk-cal-day {
  font: inherit; font-size: var(--text-sm); height: 30px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; color: var(--ink); cursor: pointer;
}
.rk-cal-day:hover { background: var(--surface-2); border-color: var(--border); }
.rk-cal-day.out { color: var(--muted); }
.rk-cal-day.today { border-color: var(--border-strong); font-weight: 600; }
.rk-cal-day[aria-pressed="true"], .rk-cal-day[aria-pressed="true"]:hover {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.rk-cal-day:focus-visible { outline-offset: 0; }
.rk-cal-foot {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px; border-top: 1px solid var(--border);
}
.rk-cal-foot button.ghost { font-size: var(--text-xs); padding: 4px 10px; }

/* ---- mobile: sidebar collapses to a top bar ---- */
@media (max-width: 900px) {
  /* minmax(0, ...) lets the column shrink to the screen; the top bar wraps */
  body.with-sidebar { grid-template-columns: minmax(0, 1fr); background: var(--page); }
  body.with-sidebar > main { grid-column: 1; grid-row: 2; }
  aside.sidebar {
    position: static; height: auto;
    border-right: 0; border-bottom: 1px solid var(--border);
    flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 12px; padding: 14px 20px;
  }
  aside.sidebar .tagline { display: none; }
  nav.side-nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .side-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .side-pills { display: none; }
  main { padding-top: 22px; }
}
