/* Seonis — interface stylesheet.
 *
 * Hand-written, one file, no build step: the server has no node, and a
 * pipeline is a poor trade for this much CSS.
 *
 * The design decision that matters most here is restraint. Every competitor in
 * this category paints its interface in a saturated brand colour — Outrank in
 * violet, BabyLoveGrowth in orange — and colouring the chrome is exactly what
 * makes a product look like it was assembled from a template. So the interface
 * is near-monochrome: white surfaces, a cool near-white ground, hairline
 * borders, near-black primary buttons. Colour is spent only where it carries
 * meaning — a status, a delta, one brand mark.
 *
 * Typeface is IBM Plex Sans throughout, and that is a constraint rather than a
 * preference: the interface has to render ą č ę ė į š ų ū ž, ā ē ī ū ķ ļ ņ ģ,
 * õ ä ö ü and ą ć ę ł ń ó ś ź ż. Most display faces stop at Latin-1 and fall
 * back mid-word, which looks broken to precisely the customers we sell to.
 */

/* ══════════════════════════════════════════════════════════════ tokens ══ */

:root {
    color-scheme: light;

    /* Surfaces. A cool near-white ground with white cards on top reads
       cleaner than grey-on-grey and photographs better in a screenshot. */
    --ground:        #f6f7f9;
    --surface:       #ffffff;
    --surface-2:     #fbfcfd;
    --surface-sunk:  #f1f3f6;
    --overlay:       rgb(15 17 21 / 0.45);

    --line:          #e8eaee;
    --line-2:        #dde0e6;
    --line-strong:   #c9cdd6;

    --ink:           #0f1115;
    --ink-2:         #3d4351;
    --muted:         #626a7a;
    --faint:         #8d95a3;
    --disabled:      #b3b9c4;

    /* The brand mark and the one highlight. Amber, because every competitor
       is violet and because it is the one material every Baltic customer
       recognises on sight. */
    --brand:         #b4690e;
    --brand-2:       #955508;
    --brand-soft:    #fdf5e9;
    --brand-line:    #f0dcb8;

    /* Primary actions are near-black, not brand-coloured. A dashboard where
       every button is the brand colour has no hierarchy left for the one
       button that matters. */
    --action:        #14171d;
    --action-2:      #262b35;
    --on-action:     #ffffff;

    --ok:            #0f7a4e;
    --ok-soft:       #e8f6ee;
    --ok-line:       #b6e3ca;
    --warn:          #9a6206;
    --warn-soft:     #fdf3e2;
    --warn-line:     #f0d9ab;
    --bad:           #b3261e;
    --bad-soft:      #fdecea;
    --bad-line:      #f5c4c0;
    --info:          #14548f;
    --info-soft:     #e9f1fa;
    --info-line:     #bcd7f0;

    /* One elevation, used sparingly. Shadows on everything flatten hierarchy
       exactly as thoroughly as shadows on nothing. */
    --shadow-sm:  0 1px 2px rgb(15 17 21 / 0.05);
    --shadow:     0 1px 3px rgb(15 17 21 / 0.07), 0 8px 24px -12px rgb(15 17 21 / 0.12);
    --shadow-lg:  0 2px 8px rgb(15 17 21 / 0.08), 0 24px 48px -20px rgb(15 17 21 / 0.22);
    --ring:       0 0 0 3px rgb(180 105 14 / 0.16);

    --r-xs: 5px;
    --r-sm: 7px;
    --r:    10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --r-full: 999px;

    --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --sidebar: 244px;
    --topbar: 56px;
    --content-max: 1280px;

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --fast: 120ms var(--ease);
    --slow: 260ms var(--ease);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --shadow-lg: 0 2px 8px rgb(0 0 0 / 0.5), 0 24px 48px -20px rgb(0 0 0 / 0.7); }
}

/* Dark is a genuine second design, not an inversion: surfaces lift rather than
   darken, borders lighten, and the accent brightens so it survives the ground. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --ground: #0c0e12;  --surface: #14171c;  --surface-2: #171b21;
        --surface-sunk: #1b1f26; --overlay: rgb(0 0 0 / 0.6);
        --line: #232830;   --line-2: #2c323c;   --line-strong: #3d4551;
        --ink: #f2f4f7;    --ink-2: #cbd1db;    --muted: #98a1b0;
        --faint: #6d7686;  --disabled: #4b5361;
        --brand: #e9a94b;  --brand-2: #f2bd6d;  --brand-soft: #241a0d; --brand-line: #4a3719;
        --action: #f2f4f7; --action-2: #dfe4ea; --on-action: #0f1115;
        --ok: #4ec38a;   --ok-soft: #10241a;   --ok-line: #1f4633;
        --warn: #e0a44a; --warn-soft: #241c0f; --warn-line: #4a3a1c;
        --bad: #f08279;  --bad-soft: #2a1615;  --bad-line: #552723;
        --info: #6fb0e8; --info-soft: #101f2c; --info-line: #1e3d57;
        --ring: 0 0 0 3px rgb(233 169 75 / 0.22);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --ground: #0c0e12;  --surface: #14171c;  --surface-2: #171b21;
    --surface-sunk: #1b1f26; --overlay: rgb(0 0 0 / 0.6);
    --line: #232830;   --line-2: #2c323c;   --line-strong: #3d4551;
    --ink: #f2f4f7;    --ink-2: #cbd1db;    --muted: #98a1b0;
    --faint: #6d7686;  --disabled: #4b5361;
    --brand: #e9a94b;  --brand-2: #f2bd6d;  --brand-soft: #241a0d; --brand-line: #4a3719;
    --action: #f2f4f7; --action-2: #dfe4ea; --on-action: #0f1115;
    --ok: #4ec38a;   --ok-soft: #10241a;   --ok-line: #1f4633;
    --warn: #e0a44a; --warn-soft: #241c0f; --warn-line: #4a3a1c;
    --bad: #f08279;  --bad-soft: #2a1615;  --bad-line: #552723;
    --info: #6fb0e8; --info-soft: #101f2c; --info-line: #1e3d57;
    --shadow-lg: 0 2px 8px rgb(0 0 0 / 0.5), 0 24px 48px -20px rgb(0 0 0 / 0.7);
    --ring: 0 0 0 3px rgb(233 169 75 / 0.22);
}

/* ════════════════════════════════════════════════════════════════ base ══ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.55;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; letter-spacing: -0.021em; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
a:not([class]) { color: var(--brand); text-underline-offset: 2px; }
a:not([class]):hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
svg.icon { display: block; flex: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* Digits that sit in columns must line up. Everywhere, not selectively. */
body { font-variant-numeric: tabular-nums; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

::selection { background: var(--brand-soft); color: var(--brand-2); }

.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.tnum { font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════ shell ══ */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.brand {
    display: flex; align-items: center; gap: 9px;
    padding: 16px 16px 12px;
    font-size: 15px; font-weight: 600; letter-spacing: -0.02em;
    color: var(--ink);
}
.brand-mark {
    width: 26px; height: 26px; flex: none;
    border-radius: 7px;
    background: linear-gradient(145deg, #e0a martial, var(--brand));
    background: linear-gradient(145deg, #e9a94b, #a85e08);
    display: grid; place-items: center;
    color: #2a1a05; font-size: 13px; font-weight: 700;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.28);
}

/* Site switcher. Every competitor puts this first because an agency with a
   dozen clients lives in it. */
.switcher { padding: 0 12px 10px; position: relative; }
.switcher > details > summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    transition: border-color var(--fast), background var(--fast);
}
.switcher > details > summary::-webkit-details-marker { display: none; }
.switcher > details > summary:hover { border-color: var(--line-strong); background: var(--surface-sunk); }
.switcher-flag { font-size: 14px; line-height: 1; }
.switcher-text { min-width: 0; flex: 1; }
.switcher-name { display: block; font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher-domain { display: block; font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher-menu {
    position: absolute; left: 12px; right: 12px; z-index: 60;
    margin-top: 5px; padding: 5px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: var(--shadow-lg);
    max-height: 320px; overflow-y: auto;
}
.switcher-item {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 9px; border-radius: var(--r-sm);
    font-size: 13px;
}
.switcher-item:hover { background: var(--surface-sunk); }
.switcher-item[aria-current="true"] { background: var(--brand-soft); color: var(--brand-2); font-weight: 550; }
.switcher-add { display: flex; align-items: center; gap: 7px; padding: 8px 9px; margin-top: 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.switcher-add:hover { color: var(--ink); }

.nav { padding: 0 12px 16px; flex: 1; }
.nav-section {
    padding: 15px 10px 5px;
    color: var(--faint);
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.07em;
}
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 10px; margin-bottom: 1px;
    border-radius: var(--r-sm);
    color: var(--muted);
    font-size: 13.5px; font-weight: 500;
    position: relative;
    transition: background var(--fast), color var(--fast);
}
.nav-link:hover { background: var(--surface-sunk); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--surface-sunk); color: var(--ink); font-weight: 550; }
/* The active marker is the one place the brand colour appears in the chrome. */
.nav-link[aria-current="page"]::before {
    content: ""; position: absolute; left: -12px; top: 50%;
    width: 3px; height: 18px; margin-top: -9px;
    background: var(--brand); border-radius: 0 3px 3px 0;
}
.nav-link .icon { opacity: 0.75; }
.nav-link[aria-current="page"] .icon { opacity: 1; color: var(--brand); }
.nav-badge {
    margin-left: auto; min-width: 19px; padding: 1px 6px;
    background: var(--brand); color: #fff;
    border-radius: var(--r-full);
    font-size: 10.5px; font-weight: 600; text-align: center;
}
:root[data-theme="dark"] .nav-badge { color: #241a0d; }
.nav-badge.quiet { background: var(--surface-sunk); color: var(--muted); border: 1px solid var(--line-2); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }

.meter-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; font-size: 11.5px; color: var(--muted); }
.meter { height: 5px; background: var(--surface-sunk); border-radius: var(--r-full); overflow: hidden; }
.meter-fill { height: 100%; background: var(--ink); border-radius: var(--r-full); transition: width var(--slow); }
.meter-fill.brand { background: var(--brand); }
.meter-fill.ok { background: var(--ok); }
.meter-fill.warn { background: var(--warn); }
.meter-fill.bad { background: var(--bad); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 12px;
    height: var(--topbar); padding: 0 24px;
    background: rgb(255 255 255 / 0.82);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 40;
}
:root[data-theme="dark"] .topbar { background: rgb(20 23 28 / 0.82); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar { background: rgb(20 23 28 / 0.82); } }

.topbar-title { font-size: 13.5px; font-weight: 600; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.content { padding: 24px; max-width: var(--content-max); width: 100%; }
.content.wide { max-width: none; }

/* ═══════════════════════════════════════════════════════════ headings ══ */

.page-head { margin-bottom: 20px; }
.page-title { font-size: 24px; font-weight: 640; letter-spacing: -0.025em; }
.page-sub { margin-top: 5px; color: var(--muted); max-width: 70ch; }
.eyebrow { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }

/* ══════════════════════════════════════════════════════════════ layout ══ */

.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.tight { gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.tight { gap: 6px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.spacer { flex: 1; }

/* ═══════════════════════════════════════════════════════════════ cards ══ */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 18px;
}
.card.raised { box-shadow: var(--shadow); border-color: var(--line-2); }
.card.sunk { background: var(--surface-sunk); border-color: transparent; }
.card.flush { padding: 0; overflow: hidden; }
.card.pad-sm { padding: 14px; }
.card.interactive { transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast); }
.card.interactive:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head.bordered { margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-title { font-size: 13px; font-weight: 600; }
.card-note { font-size: 12px; color: var(--faint); }
.card-action { margin-left: auto; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.card-action:hover { color: var(--ink); }
.card-foot { margin: 14px -18px -18px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ═════════════════════════════════════════════════════════════════ kpi ══ */

.kpi { display: flex; flex-direction: column; gap: 3px; }
.kpi-label { font-size: 11px; font-weight: 550; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.kpi-value { font-size: 28px; font-weight: 620; letter-spacing: -0.03em; line-height: 1.15; }
.kpi-value.sm { font-size: 20px; }
.kpi-value.lg { font-size: 36px; }
.kpi-unit { font-size: 0.55em; font-weight: 500; color: var(--faint); margin-left: 1px; }
.kpi-foot { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 550; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--faint); }

/* ════════════════════════════════════════════════════════════════ pills ══ */

.pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px;
    border-radius: var(--r-full);
    font-size: 11.5px; font-weight: 550;
    white-space: nowrap;
    border: 1px solid transparent;
}
.pill.ok    { background: var(--ok-soft);   color: var(--ok);   border-color: var(--ok-line); }
.pill.warn  { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.pill.bad   { background: var(--bad-soft);  color: var(--bad);  border-color: var(--bad-line); }
.pill.info  { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.pill.brand { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand-line); }
.pill.mute  { background: var(--surface-sunk); color: var(--muted); border-color: var(--line-2); }
.pill.solid { background: var(--action); color: var(--on-action); border-color: var(--action); }
.pill-dot { width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; flex: none; }
.pill-dot.pulse { animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ═══════════════════════════════════════════════════════════════ buttons ══ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 14px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: 13px; font-weight: 550;
    cursor: pointer; white-space: nowrap;
    transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast);
}
.btn:hover { background: var(--surface-sunk); border-color: var(--line-strong); }
.btn:active { transform: translateY(0.5px); }
.btn[disabled], .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn.primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.btn.primary:hover { background: var(--action-2); border-color: var(--action-2); }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .btn.brand { color: #241a0d; }
.btn.brand:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-sunk); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad-line); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn.lg { padding: 11px 20px; font-size: 14.5px; border-radius: var(--r); }
.btn.block { width: 100%; }

.icon-btn {
    display: grid; place-items: center;
    width: 32px; height: 32px;
    border: 1px solid transparent; border-radius: var(--r-sm);
    background: transparent; color: var(--muted);
    cursor: pointer;
    transition: background var(--fast), color var(--fast);
}
.icon-btn:hover { background: var(--surface-sunk); color: var(--ink); }

.btn-group { display: inline-flex; background: var(--surface-sunk); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.btn-group > * {
    padding: 5px 11px; border-radius: var(--r-xs);
    font-size: 12.5px; font-weight: 550; color: var(--muted);
    border: 0; background: transparent; cursor: pointer;
    transition: background var(--fast), color var(--fast);
}
.btn-group > *:hover { color: var(--ink); }
.btn-group > *[aria-current="true"], .btn-group > *.on {
    background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════════════ tables ══ */

.table-wrap { overflow-x: auto; }
table th {
    padding: 9px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    color: var(--faint);
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    text-align: left; white-space: nowrap;
    position: sticky; top: 0; z-index: 2;
}
table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--fast); }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; }
.cell-strong { font-weight: 550; }
.cell-sub { color: var(--faint); font-size: 12px; }
.cell-trunc { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ══════════════════════════════════════════════════════ empty + loading ══ */

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-icon {
    width: 40px; height: 40px; margin: 0 auto 12px;
    display: grid; place-items: center;
    border-radius: var(--r);
    background: var(--surface-sunk); color: var(--faint);
}
.empty-title { color: var(--ink); font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.empty p { max-width: 46ch; margin: 0 auto; font-size: 13px; }
.empty .btn { margin-top: 14px; }

.skeleton {
    background: linear-gradient(90deg, var(--surface-sunk) 25%, var(--line) 37%, var(--surface-sunk) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: var(--r-xs);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton.line { height: 12px; margin-bottom: 8px; }
.skeleton.line.short { width: 40%; }

.spinner {
    width: 15px; height: 15px; flex: none;
    border: 2px solid var(--line-2); border-top-color: var(--ink);
    border-radius: var(--r-full);
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═════════════════════════════════════════════════════════════════ forms ══ */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.label { font-size: 12.5px; font-weight: 550; }
.hint { font-size: 12px; color: var(--muted); }
.error { font-size: 12px; color: var(--bad); }

.input, .select, .textarea {
    width: 100%; padding: 9px 12px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    font-size: 13.5px;
    transition: border-color var(--fast), box-shadow var(--fast);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--disabled); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-sunk); color: var(--disabled); cursor: not-allowed; }
.textarea { min-height: 100px; resize: vertical; line-height: 1.6; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23626a7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 32px;
}

.input-group { display: flex; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .addon {
    display: grid; place-items: center; padding: 0 12px;
    background: var(--surface-sunk); border: 1px solid var(--line-2); border-left: 0;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: var(--muted); font-size: 13px; white-space: nowrap;
}

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
    width: 36px; height: 21px; flex: none;
    background: var(--line-strong); border-radius: var(--r-full);
    position: relative; transition: background var(--fast);
}
.switch-track::after {
    content: ""; position: absolute; top: 2px; left: 2px;
    width: 17px; height: 17px; border-radius: var(--r-full);
    background: #fff; box-shadow: var(--shadow-sm);
    transition: transform var(--fast);
}
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(15px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }
.switch input[disabled] + .switch-track { opacity: 0.5; }

/* Radio cards: the right control when a choice has consequences worth
   explaining, which is most of onboarding. */
.choice { display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
    display: flex; gap: 12px; padding: 14px;
    border: 1px solid var(--line-2); border-radius: var(--r);
    background: var(--surface);
    transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
}
.choice:hover .choice-body { border-color: var(--line-strong); }
.choice input:checked + .choice-body {
    border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--ring);
}
.choice input:focus-visible + .choice-body { box-shadow: var(--ring); }
.choice-title { font-size: 13.5px; font-weight: 600; }
.choice-note { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.choice-mark {
    width: 18px; height: 18px; flex: none; margin-top: 1px;
    border: 1.5px solid var(--line-strong); border-radius: var(--r-full);
    display: grid; place-items: center;
    transition: border-color var(--fast), background var(--fast);
}
.choice input:checked + .choice-body .choice-mark { border-color: var(--brand); background: var(--brand); color: #fff; }
.choice input:checked + .choice-body .choice-mark::after { content: ""; width: 6px; height: 6px; border-radius: var(--r-full); background: #fff; }

/* ══════════════════════════════════════════════════════════════ notices ══ */

.alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; margin-bottom: 16px;
    border: 1px solid var(--line-2); border-radius: var(--r);
    background: var(--surface-2);
    font-size: 13px;
}
.alert .icon { margin-top: 1px; color: var(--muted); }
.alert.ok   { background: var(--ok-soft);   border-color: var(--ok-line); }
.alert.ok .icon { color: var(--ok); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.alert.warn .icon { color: var(--warn); }
.alert.bad  { background: var(--bad-soft);  border-color: var(--bad-line); }
.alert.bad .icon { color: var(--bad); }
.alert.info { background: var(--info-soft); border-color: var(--info-line); }
.alert.info .icon { color: var(--info); }
.alert-title { font-weight: 600; margin-bottom: 2px; }

.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; min-width: 260px;
    background: var(--surface); border: 1px solid var(--line-2);
    border-radius: var(--r); box-shadow: var(--shadow-lg);
    font-size: 13px;
    animation: toast-in 260ms var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ═════════════════════════════════════════════════════════════════ tabs ══ */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
    padding: 9px 13px; color: var(--muted);
    font-size: 13px; font-weight: 550;
    border-bottom: 2px solid transparent; white-space: nowrap;
    transition: color var(--fast), border-color var(--fast);
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ═════════════════════════════════════════════════════════════ stepper ══ */

.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 28px; }
.step { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.step:last-child { flex: 0; }
.step-dot {
    width: 26px; height: 26px; flex: none;
    display: grid; place-items: center;
    border-radius: var(--r-full);
    border: 1.5px solid var(--line-strong);
    background: var(--surface); color: var(--faint);
    font-size: 12px; font-weight: 600;
    transition: all var(--fast);
}
.step-label { font-size: 12.5px; font-weight: 550; color: var(--faint); white-space: nowrap; }
.step-line { flex: 1; height: 1.5px; background: var(--line-2); margin: 0 12px; min-width: 16px; }
.step.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done .step-label { color: var(--muted); }
.step.done .step-line { background: var(--ok); }
.step.now .step-dot { border-color: var(--brand); color: var(--brand); box-shadow: var(--ring); }
.step.now .step-label { color: var(--ink); }

/* ════════════════════════════════════════════════════════════════ rings ══ */

.ring { position: relative; display: grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring-track { fill: none; stroke: var(--surface-sunk); }
.ring-value { fill: none; stroke: var(--ink); stroke-linecap: round; transition: stroke-dashoffset var(--slow); }
.ring-value.ok { stroke: var(--ok); }
.ring-value.warn { stroke: var(--warn); }
.ring-value.bad { stroke: var(--bad); }
.ring-value.brand { stroke: var(--brand); }
.ring-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 620; letter-spacing: -0.02em; }
.ring-text small { display: block; font-size: 10px; font-weight: 500; color: var(--faint); letter-spacing: 0; }

/* ═══════════════════════════════════════════════════════════════ charts ══ */

.spark { display: block; width: 100%; height: 44px; overflow: visible; }
.spark-line { fill: none; stroke: var(--ink); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: url(#spark-grad); opacity: 0.1; }
.spark-dot { fill: var(--ink); }

.chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--faint); font-family: var(--sans); font-size: 10px; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.a { stroke: var(--ink); }
.chart-line.b { stroke: var(--brand); }
.chart-area { opacity: 0.07; }
.chart-bar { fill: var(--ink); }
.chart-bar.brand { fill: var(--brand); }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.chart-key { display: inline-flex; align-items: center; gap: 6px; }
.chart-key::before { content: ""; width: 10px; height: 2px; border-radius: 2px; background: currentColor; }
.chart-key.a { color: var(--ink); }
.chart-key.b { color: var(--brand); }

/* ═════════════════════════════════════════════════════════════ calendar ══ */

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-dow { padding: 8px 10px; background: var(--surface-2); color: var(--faint); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.cal-day { min-height: 104px; padding: 8px; background: var(--surface); display: flex; flex-direction: column; gap: 5px; }
.cal-day.outside { background: var(--surface-2); }
.cal-day.today { background: var(--brand-soft); }
.cal-date { font-size: 11.5px; font-weight: 600; color: var(--faint); }
.cal-day.today .cal-date { color: var(--brand-2); }
.cal-item {
    display: block; padding: 6px 8px;
    border: 1px solid var(--line); border-left: 2.5px solid var(--faint);
    border-radius: var(--r-xs); background: var(--surface);
    font-size: 11.5px; line-height: 1.35;
    transition: border-color var(--fast), box-shadow var(--fast);
}
.cal-item:hover { box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.cal-item.published { border-left-color: var(--ok); }
.cal-item.generating { border-left-color: var(--brand); }
.cal-item.queued { border-left-color: var(--info); }
.cal-item.failed { border-left-color: var(--bad); }
.cal-kw { display: block; margin-top: 3px; color: var(--faint); font-size: 10.5px; }

/* ═══════════════════════════════════════════════════════════════ rules ══ */

.rule { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rule:last-child { border-bottom: 0; }
.rule-mark { width: 17px; height: 17px; flex: none; margin-top: 1px; display: grid; place-items: center; border-radius: var(--r-full); }
.rule-mark.pass { background: var(--ok-soft); color: var(--ok); }
.rule-mark.fail { background: var(--bad-soft); color: var(--bad); }
.rule-body { min-width: 0; flex: 1; }
.rule-name { font-size: 12.5px; font-weight: 550; }
.rule-why { font-size: 12px; color: var(--muted); }
.rule-code { font-family: var(--mono); font-size: 10.5px; color: var(--disabled); }

.verdict { display: flex; gap: 11px; padding: 14px 16px; border: 1px solid var(--line-2); border-left: 3px solid var(--muted); border-radius: var(--r); background: var(--surface-2); }
.verdict.ok { border-left-color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.verdict.bad { border-left-color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); }
.verdict.warn { border-left-color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.verdict.info { border-left-color: var(--info); background: var(--info-soft); border-color: var(--info-line); }
.verdict-title { font-size: 13px; font-weight: 600; }
.verdict-text { font-size: 12.5px; color: var(--ink-2); }

/* ═══════════════════════════════════════════════════════════════ feed ══ */

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.feed-item:first-child { padding-top: 0; }
.feed-item:last-child { border-bottom: 0; padding-bottom: 0; }
.feed-mark { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: var(--r-full); background: var(--surface-sunk); color: var(--muted); }
.feed-mark.ok { background: var(--ok-soft); color: var(--ok); }
.feed-mark.brand { background: var(--brand-soft); color: var(--brand); }
.feed-mark.info { background: var(--info-soft); color: var(--info); }
.feed-body { min-width: 0; flex: 1; }
.feed-text { font-size: 13px; }
.feed-time { font-size: 11.5px; color: var(--faint); }

/* ══════════════════════════════════════════════════════════════ dialog ══ */

dialog {
    padding: 0; border: 0; border-radius: var(--r-lg);
    background: var(--surface); color: var(--ink);
    box-shadow: var(--shadow-lg); max-width: 480px; width: calc(100% - 32px);
}
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.dialog-head { padding: 18px 20px 0; }
.dialog-body { padding: 12px 20px 20px; color: var(--ink-2); font-size: 13.5px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ══════════════════════════════════════════════════════════════ tooltip ══ */

[data-tip] { position: relative; }
[data-tip]::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
    padding: 5px 9px; border-radius: var(--r-xs);
    background: var(--action); color: var(--on-action);
    font-size: 11.5px; font-weight: 500; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity var(--fast);
    z-index: 70;
}
[data-tip]:hover::after { opacity: 1; }

/* ═══════════════════════════════════════════════════════════ responsive ══ */

@media (max-width: 1180px) {
    .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split, .split-even { grid-template-columns: minmax(0, 1fr); }
    .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
    .nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nav-section { grid-column: 1 / -1; }
    .nav-link[aria-current="page"]::before { display: none; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
    .cal { font-size: 11px; }
    .cal-day { min-height: 70px; }
    .stepper .step-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}

@media print {
    .sidebar, .topbar, .toast-stack { display: none !important; }
    .card { break-inside: avoid; border-color: #ccc; }
}

/* ════════════════════════════════════════════════ compatibility layer ══
 *
 * The token names changed when this stylesheet was rewritten, and a dozen
 * views still reference the old ones. Without these aliases the rename is a
 * silent visual regression: undefined custom properties do not error, they
 * simply produce no colour, so text renders black-on-black and the login page
 * loses its layout entirely.
 *
 * These stay until every view has been migrated, and no new markup should use
 * them. They are cheap to keep and expensive to have skipped.
 */

:root {
    --ink-soft: var(--ink-2);
    --accent: var(--brand);
    --accent-hover: var(--brand-2);
    --accent-soft: var(--brand-soft);
    --accent-line: var(--brand-line);
    --deep: var(--action);
    --deep-soft: var(--surface-sunk);
    --deep-line: var(--line-2);
    --deep-text: var(--ink);
    --deep-faint: var(--muted);
    --serif: var(--sans);
    --radius: var(--r);
    --radius-sm: var(--r-sm);
    --radius-lg: var(--r-lg);
    --shadow: 0 1px 3px rgb(15 17 21 / 0.07), 0 8px 24px -12px rgb(15 17 21 / 0.12);
}

/* Older elevation name. */
.card.lifted { box-shadow: var(--shadow); border-color: var(--line-2); }

/* Sidebar icons before the icon component existed. */
.nav-icon { width: 16px; flex: none; opacity: 0.75; text-align: center; }

/* The sign-in screen. Its own layout rather than the app shell, because it is
   the first impression a paying customer gets of the product. */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-pane {
    background: var(--action); color: var(--on-action);
    padding: 44px; display: flex; flex-direction: column;
}
.auth-pane .brand { padding: 0 0 40px; color: var(--on-action); }
.auth-claim { font-size: 30px; font-weight: 640; line-height: 1.2; letter-spacing: -0.03em; max-width: 18ch; }
.auth-sub { margin-top: 14px; max-width: 44ch; color: rgb(255 255 255 / 0.62); }
:root[data-theme="dark"] .auth-sub { color: rgb(15 17 21 / 0.66); }
.auth-points { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.auth-point { display: flex; gap: 10px; font-size: 13.5px; align-items: flex-start; }
.auth-point-mark { color: var(--brand); flex: none; }
.auth-form { display: grid; place-items: center; padding: 44px; }
.auth-box { width: 100%; max-width: 352px; }

@media (max-width: 880px) {
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-pane { display: none; }
}

/* Older pill name, from before the accent token was renamed to brand. */
.pill.accent { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand-line); }

/* Visually hidden but still read aloud. Used for table headers that carry no
   visible label — a column with no heading is fine to look at and confusing to
   listen to. */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
