/* Rate dashboard: soft "glass" command center look, dark and light.
   Colors are tokens on :root. Light first; the dark values are written twice: once for the OS setting and once
   for the theme toggle (theme.js sets data-theme), so the toggle wins both ways. */

:root {
    color-scheme: light;
    --bg: #f1f4fb;
    --panel: rgba(255, 255, 255, 0.78);
    --panel-solid: #fcfdfe;          /* sticky table heads */
    --raised: #ffffff;               /* dialog, chart tooltips */
    --inset: rgba(241, 244, 251, 0.75);   /* boxes inside a card */
    --line: rgba(30, 41, 80, 0.12);
    --track: rgba(30, 41, 80, 0.10);      /* empty part of bars */
    --grid: rgba(30, 41, 80, 0.07);
    --ink: #141b33;
    --ink-2: #3a4566;
    --muted: #5d6988;
    --ac: #e8730c;
    --ac2: #d9461f;
    --bl: #2563eb;
    --gr: #059669;
    --rd: #dc2626;
    --vi: #7c3aed;
    --am: #b7791f;
    --g1: rgba(37, 99, 235, 0.12);
    --g2: rgba(232, 115, 12, 0.12);
    --g3: rgba(124, 58, 237, 0.08);
    --shadow: 0 10px 40px -24px rgba(20, 27, 51, 0.35);
    --console-bg: #0b1020;
    --console-ink: #cfd8e8;
    --console-line: #1e2740;

    /* supplier lines, fixed order (app.js SUPPLIER_ORDER), checked for color blindness on both themes */
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --series-5: #e87ba4;
    --series-6: #008300;
    --series-7: #6250d6;
    --series-8: #e34948;
    --series-other: #898781;

    /* run / date status, always shown with its label too */
    --st-done: var(--gr);
    --st-running: var(--bl);
    --st-partial: var(--am);
    --st-stopped: var(--ac);
    --st-failed: var(--rd);

    --font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) {
        color-scheme: dark;
        --bg: #070b16;
        --panel: rgba(18, 26, 46, 0.62);
        --panel-solid: #0f1526;
        --raised: #141c31;
        --inset: rgba(7, 11, 22, 0.45);
        --line: rgba(148, 163, 200, 0.14);
        --track: rgba(148, 163, 200, 0.16);
        --grid: rgba(148, 163, 200, 0.07);
        --ink: #e8edf8;
        --ink-2: #c3cbe0;
        --muted: #8a96b4;
        --ac: #ffa94d;
        --ac2: #ff6b3d;
        --bl: #4d9fff;
        --gr: #34d399;
        --rd: #f87171;
        --vi: #a78bfa;
        --am: #fbbf24;
        --g1: rgba(77, 159, 255, 0.16);
        --g2: rgba(255, 107, 61, 0.13);
        --g3: rgba(167, 139, 250, 0.12);
        --shadow: 0 10px 40px -20px rgba(0, 0, 0, 0.5);
        --series-1: #3987e5;
        --series-2: #d95926;
        --series-3: #199e70;
        --series-4: #c98500;
        --series-5: #d55181;
        --series-6: #008300;
        --series-7: #9085e9;
        --series-8: #e66767;
        --series-other: #898781;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #070b16;
    --panel: rgba(18, 26, 46, 0.62);
    --panel-solid: #0f1526;
    --raised: #141c31;
    --inset: rgba(7, 11, 22, 0.45);
    --line: rgba(148, 163, 200, 0.14);
    --track: rgba(148, 163, 200, 0.16);
    --grid: rgba(148, 163, 200, 0.07);
    --ink: #e8edf8;
    --ink-2: #c3cbe0;
    --muted: #8a96b4;
    --ac: #ffa94d;
    --ac2: #ff6b3d;
    --bl: #4d9fff;
    --gr: #34d399;
    --rd: #f87171;
    --vi: #a78bfa;
    --am: #fbbf24;
    --g1: rgba(77, 159, 255, 0.16);
    --g2: rgba(255, 107, 61, 0.13);
    --g3: rgba(167, 139, 250, 0.12);
    --shadow: 0 10px 40px -20px rgba(0, 0, 0, 0.5);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --series-other: #898781;
}

/* ---------- base ---------- */

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

/* Wide screens show the whole page smaller, as browser zoom 80% would, so more of it fits on one screen.
   Laptops step down less, tablets and phones keep the normal size. app.js reads the zoom (pageZoom) for the charts
   (mouse position, sharp canvas) and the supplier network height. */
:root { --zoom: 1; }
@media (min-width: 1200px) { :root { --zoom: 0.9; } }
@media (min-width: 1600px) { :root { --zoom: 0.8; } }
html { zoom: var(--zoom); }

body {
    margin: 0;
    min-height: calc(100vh / var(--zoom));   /* vh is not zoomed: the full screen height at any --zoom */
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.45 var(--font);
    font-variant-numeric: tabular-nums;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* soft colored light behind everything */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(900px 520px at 8% -8%, var(--g1), transparent 70%),
        radial-gradient(800px 520px at 100% 0%, var(--g2), transparent 70%),
        radial-gradient(900px 600px at 50% 105%, var(--g3), transparent 70%);
}

h1, h2, h3 { margin: 0; }
button, select, input { font: inherit; color: inherit; }
code { font: 12px/1.4 var(--font-mono); }
a { color: inherit; }
.muted { color: var(--muted); }
.secondary { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 12px 0; margin: 0; }
.spacer { flex: 1; }

button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible {
    outline: 2px solid var(--ac);
    outline-offset: 2px;
}
.btn {
    padding: 6px 12px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: var(--panel);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--ac); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { border-color: var(--line); }
.btn.primary {
    background: linear-gradient(135deg, #e0661a, #c93d17);
    border-color: transparent;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 8px 22px -8px var(--ac2);
}
.btn.primary:hover { border-color: transparent; box-shadow: 0 8px 26px -6px var(--ac2); }
.btn.danger {
    color: color-mix(in srgb, var(--rd) 80%, var(--ink));
    border-color: color-mix(in srgb, var(--rd) 60%, transparent);
    background: color-mix(in srgb, var(--rd) 12%, transparent);
    font-weight: 700;
}
.btn.danger:hover { border-color: var(--rd); }
.btn:disabled, select:disabled, input:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn.small { padding: 3px 10px; font-size: 12px; }

select, input {
    color: var(--ink);
    background: color-mix(in srgb, var(--bg) 60%, transparent);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 7px 10px;
    font-size: 13px;
}
select { cursor: pointer; }
select:hover, input:hover { border-color: color-mix(in srgb, var(--ac) 60%, var(--line)); }

/* ---------- top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding-top: env(safe-area-inset-top, 0px);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: color-mix(in srgb, var(--bg) 70%, transparent);
    border-bottom: 1px solid var(--line);
}
/* Full width of the window, the same side space as the page below */
.topbar-inner { padding: 12px var(--side); display: flex; align-items: center; gap: 14px; }
/* R3C logo (static/logo.png, transparent): its height sets the size, the width follows */
.logo { display: block; flex: none; height: 40px; width: auto; }
.login .logo { height: 48px; }
.brand { min-width: 0; }
.brand b { display: block; font-size: 15px; letter-spacing: 0.2px; white-space: nowrap; }
.brand span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 99px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.pill b { color: var(--ac); }
.dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--muted); }
.live.on .dot { background: var(--gr); animation: pulse 2s infinite; }
.live.off { border-color: color-mix(in srgb, var(--rd) 50%, transparent); color: color-mix(in srgb, var(--rd) 80%, var(--ink)); }
.live.off .dot { background: var(--rd); }
.clock { color: var(--muted); font-weight: 600; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gr) 70%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.home { display: flex; align-items: center; gap: 14px; min-width: 0; color: inherit; text-decoration: none; border-radius: 12px; }

/* user menu: the name opens Users (admins) and Log out */
.user-menu { position: relative; }
.user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px 3px 3px;
    border: 1px solid transparent;
    border-radius: 99px;
    background: transparent;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s;
}
.user:hover, .user[aria-expanded="true"] { border-color: var(--line); background: var(--panel); }
.caret { width: 12px; height: 12px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.user[aria-expanded="true"] .caret { transform: rotate(180deg); }
.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 40;
    min-width: 220px;
    padding: 6px;
    display: grid;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--raised);
    box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.45);
    animation: drop 0.14s ease-out;
}
@keyframes drop { from { transform: translateY(-4px); opacity: 0; } }
.menu-head { display: grid; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-head b { font-size: 14px; overflow-wrap: anywhere; }
.menu-head small { color: var(--muted); font-size: 12px; }
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
}
.menu-item svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: color-mix(in srgb, var(--ac) 12%, transparent); outline: none; }
.menu-item:hover svg, .menu-item:focus-visible svg { color: var(--ac); }
.menu-item[aria-current="page"] { background: color-mix(in srgb, var(--ac) 8%, transparent); }
.menu-item[aria-current="page"]::after { content: "✓"; margin-left: auto; color: var(--ac); }
.menu-item.logout { color: color-mix(in srgb, var(--rd) 80%, var(--ink)); }
.menu-item.logout svg { color: currentColor; }
.menu-item.logout:hover, .menu-item.logout:focus-visible { background: color-mix(in srgb, var(--rd) 12%, transparent); }
.menu-item.logout:hover svg, .menu-item.logout:focus-visible svg { color: currentColor; }
.avatar {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 50%;
    background: var(--panel);
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    font-weight: 700;
    text-transform: uppercase;
}

/* ---------- page ---------- */

:root { --side: clamp(16px, 2vw, 32px); }   /* space left and right of the full-width page */
.page { padding: 0 var(--side) 40px; display: grid; gap: 16px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 30px 0 4px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.1; font-weight: 800; letter-spacing: -0.8px; }
.hero h1 em {
    font-style: normal;
    background: linear-gradient(90deg, var(--ac), var(--ac2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.sub { color: var(--muted); margin: 8px 0 0; }
.back { display: inline-block; margin-bottom: 10px; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.back:hover { color: var(--ac); }
.meta { display: flex; gap: 8px; flex-wrap: wrap; }

.banner {
    margin: 0;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--rd);
    color: var(--ink);
    background: color-mix(in srgb, var(--rd) 12%, var(--panel-solid));
}
.banner.ok { border-color: var(--gr); background: color-mix(in srgb, var(--gr) 12%, var(--panel-solid)); }

/* answer of a run control: a toast in the corner */
#notice {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 30;
    width: min(460px, calc(100vw - 32px));
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
    animation: rise 0.25s ease-out;
}
#notice:not([hidden]) { display: flex; gap: 12px; align-items: flex-start; }
#notice > span { flex: 1; white-space: pre-line; overflow-wrap: anywhere; }
#notice > button { padding: 0 8px; font-size: 16px; line-height: 1.4; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gw { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    min-width: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head > div:first-child { min-width: 0; flex: 1 1 180px; }
.card h3 { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.hs { color: var(--muted); font-size: 12px; margin-top: 2px; }
.head-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- KPI tiles ---------- */

.kpi { position: relative; overflow: hidden; }
.kpi::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -30px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--c);
    opacity: 0.14;
    filter: blur(8px);
    pointer-events: none;
}
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -1px; margin: 6px 0 2px; white-space: nowrap; }
.kpi-value small { font-size: 16px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi-note b { color: var(--ink-2); }
.kpi-note .good { color: color-mix(in srgb, var(--gr) 80%, var(--ink)); font-weight: 700; }
.kpi-note .bad { color: color-mix(in srgb, var(--rd) 80%, var(--ink)); font-weight: 700; }

/* ---------- charts ---------- */

.chart-box { position: relative; height: 260px; }
.chart-box.small { height: 230px; }
.chart-box.tiny { height: 150px; margin-top: 6px; }
.chart-caption { margin-top: 18px; }
.chart-box.loading { opacity: 0.5; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 600; }

/* ---------- supplier network ---------- */

/* the first 5 rows show (app.js sets max-height), the rest scroll; padding keeps the rows' -8px sides inside */
.network { display: grid; align-content: start; margin: 0 -8px; padding: 0 8px; overflow-x: hidden; }
.network.scrolls {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--track) transparent;
}
.network:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: 10px; }
.net-more {
    display: block;
    margin: 8px auto 0;
    padding: 3px 12px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}
.net-more:hover { color: var(--ac); border-color: var(--ac); }
.net-row {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr) 44px;
    gap: 12px;
    align-items: center;
    width: calc(100% + 16px);
    margin: 0 -8px;
    padding: 10px 8px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    text-align: left;
}
.net-row:last-child { border-bottom: 0; }
.net-row:hover { background: color-mix(in srgb, var(--c) 7%, transparent); }
.net-row.selected { background: color-mix(in srgb, var(--c) 12%, transparent); border-radius: 10px; }
.net-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; font-weight: 700; text-transform: capitalize; }
.net-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net-state { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.net-pct { text-align: right; font-weight: 700; font-size: 13px; }
.bar { height: 7px; border-radius: 9px; background: var(--track); overflow: hidden; }
.bar > i, .bar > span { display: block; height: 100%; border-radius: 9px; background: var(--c, var(--ac)); }
.notes .bar { margin-top: 2px; }

/* ---------- countries live ---------- */

.cty-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 12px; font-size: 12px; color: var(--ink-2); }
.cty-legend:empty { display: none; }
.cty-key { display: inline-flex; align-items: center; gap: 6px; }
.cty-key i { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--c); }
.cty-key b { text-transform: capitalize; }
.cty-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.cty {
    position: relative;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--inset);
    color: var(--muted);
    font: 700 12px/1 var(--font-mono);
    letter-spacing: 0.5px;
    transition: background 0.3s, border-color 0.3s, color 0.3s, box-shadow 0.3s;
}
/* collected now: the supplier's color (--c), a ring that beeps out and a blinking dot */
.cty.on {
    z-index: 1;
    border-color: var(--c);
    background: color-mix(in srgb, var(--c) 22%, var(--panel-solid));
    color: color-mix(in srgb, var(--c) 72%, var(--ink));
    box-shadow: 0 0 16px -4px var(--c);
}
.cty.on::before {
    content: "";
    position: absolute;
    inset: -1px;
    border: 2px solid var(--c);
    border-radius: inherit;
    pointer-events: none;
    animation: beep 1.4s ease-out infinite;
}
.cty.on::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--c);
    animation: blink 1.4s ease-in-out infinite;
}
@keyframes beep { from { transform: scale(1); opacity: 0.9; } to { transform: scale(1.35, 1.6); opacity: 0; } }
.cty-dots { position: absolute; bottom: 2px; left: 0; right: 0; display: flex; justify-content: center; gap: 2px; }
.cty-dots i { width: 4px; height: 4px; border-radius: 50%; }
#cty-empty { padding-bottom: 0; font-size: 12px; }

/* ---------- status pills ---------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    background: color-mix(in srgb, var(--st) 16%, transparent);
    color: color-mix(in srgb, var(--st) 78%, var(--ink));
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--st); flex: none; }
.status.st-running::before { animation: blink 1.4s ease-in-out infinite; }
.status.st-pending::before { background: transparent; border: 1px solid var(--muted); }
@keyframes blink { 50% { opacity: 0.3; } }
.st-done { --st: var(--st-done); }
.st-running { --st: var(--st-running); }
.st-partial { --st: var(--st-partial); }
.st-stopped { --st: var(--st-stopped); }
.st-failed, .st-died, .st-credential_error { --st: var(--st-failed); }
.st-pending { --st: var(--muted); }
.mark { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--st); margin-right: 5px; vertical-align: 1px; }
.mark.st-pending { background: transparent; border: 1px solid var(--muted); }
.tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 6px;
    border: 1px solid var(--line);
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    text-transform: none;
}

/* ---------- start a run (admins) ---------- */

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.launch-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.launch-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; flex: 1 1 auto; }
.launch-form label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.launch-form select, .launch-form input { min-width: 150px; padding: 8px 10px; font-size: 14px; }
.launch-form .btn, .launch-more .btn { padding: 9px 16px; }
.launch-form .workers-field input { min-width: 0; width: 96px; }
.launch-more { display: flex; gap: 8px; flex-wrap: wrap; }
fieldset:disabled .btn { cursor: progress; }

/* Workers meter: one cell per worker of the limit, colored by the supplier that uses it */
.workers { flex: 0 1 340px; min-width: 240px; display: grid; gap: 7px; }
.workers-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.workers-head b { color: var(--ink); font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.workers-free { margin-left: auto; color: color-mix(in srgb, var(--gr) 80%, var(--ink)); }
.workers.full .workers-free { color: color-mix(in srgb, var(--rd) 80%, var(--ink)); }
.workers-bar { display: grid; grid-template-columns: repeat(var(--cells, 40), minmax(0, 1fr)); gap: 2px; height: 14px; }
.workers-bar i { border-radius: 2px; background: var(--inset); border: 1px solid var(--line); transition: background-color 0.3s; }
.workers-bar i.on { background: var(--c); border-color: transparent; box-shadow: 0 0 6px color-mix(in srgb, var(--c) 45%, transparent); }
.workers-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.workers-legend:empty { display: none; }
.workers-key { display: inline-flex; align-items: center; gap: 6px; }
.workers-key i { width: 8px; height: 8px; flex: none; border-radius: 2px; background: var(--c); }
.workers-key b { text-transform: capitalize; }
.note {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- users (admins) ---------- */

.user-form-foot { display: flex; gap: 6px 16px; align-items: center; flex-wrap: wrap; margin: 10px 0 14px; font-size: 12px; }
td .tag.role { margin-left: 0; }
.tag.role-admin { color: color-mix(in srgb, var(--ac) 80%, var(--ink)); border-color: color-mix(in srgb, var(--ac) 50%, transparent); }
.note code { overflow-wrap: anywhere; }
.row-actions { display: inline-flex; gap: 6px; }
#users tr.off b { color: var(--muted); }

/* ---------- supplier run cards ---------- */

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 4px 0 12px; }
.section-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.runs { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); }
.run-card {
    border-top: 3px solid var(--card-color);
    display: grid;
    gap: 12px;
    align-content: start;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.run-card.selected {
    border-color: color-mix(in srgb, var(--card-color) 55%, var(--line));
    border-top-color: var(--card-color);
    box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--card-color) 45%, transparent);
}
.run-top { display: flex; align-items: center; gap: 8px; }
.run-top h3 { flex: 1; min-width: 0; text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-top h3 a { text-decoration: none; }
.run-top h3 a:hover { color: var(--ac); }
.mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini > div { background: var(--inset); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.mini small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; }
.mini b { display: block; font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 6px; }
.progress-row span { color: var(--muted); }
.kv { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 3px 10px; font-size: 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* check-in dates: one chip per date */
.dates { display: flex; flex-wrap: wrap; gap: 4px; }
.day {
    min-width: 28px;
    height: 24px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    border: 1px solid color-mix(in srgb, var(--st) 55%, transparent);
    background: color-mix(in srgb, var(--st) 16%, transparent);
    color: color-mix(in srgb, var(--st) 75%, var(--ink));
    font-size: 11px;
    font-weight: 700;
    transition: transform 0.15s;
}
.day:hover { transform: translateY(-1px); border-color: var(--st); }
.day.st-pending { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.day.st-running { animation: chip 1.6s ease-in-out infinite; }
.day.selected { outline: 2px solid var(--ink); outline-offset: 1px; }
@keyframes chip { 50% { background: color-mix(in srgb, var(--st) 34%, transparent); } }

.problem { color: var(--ink-2); font-size: 12px; overflow-wrap: anywhere; }
.problem strong { color: color-mix(in srgb, var(--rd) 80%, var(--ink)); }
.resume { display: flex; gap: 6px; align-items: center; min-width: 0; }
.resume code {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    padding: 5px 8px;
    border-radius: 8px;
    background: var(--console-bg);
    color: var(--console-ink);
    border: 1px solid var(--console-line);
}
.run-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- log ---------- */

.check { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); font-size: 12px; }
.log {
    margin: 0;
    max-height: 460px;
    overflow: auto;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--console-line);
    background: var(--console-bg);
    color: var(--console-ink);
    font: 12px/1.5 var(--font-mono);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ---------- event feed ---------- */

.feed { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow: auto; }
.feed li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed li.fresh { animation: slide 0.35s ease-out; }
@keyframes slide { from { transform: translateX(-8px); opacity: 0; } }
.feed .ic {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--st) 16%, transparent);
    color: var(--st);
    font-size: 13px;
}
.feed .text { min-width: 0; overflow-wrap: anywhere; color: var(--ink-2); }
.feed .text b { color: var(--ink); }
.feed time { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; padding-left: 8px; }
.ev-good { --st: var(--st-done); }
.ev-info { --st: var(--st-running); }
.ev-warn { --st: var(--st-partial); }
.ev-bad { --st: var(--st-failed); }
.ev-act { --st: var(--ac); }

/* ---------- date pipeline ---------- */

.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.stage { text-align: center; padding: 10px 4px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.stage.active { border-color: var(--st); background: color-mix(in srgb, var(--st) 7%, transparent); }
.stage b { display: block; font-size: 22px; font-weight: 800; }
.stage small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.notes { margin-top: 16px; display: grid; gap: 10px; font-size: 13px; }
.notes > div:not(.bar) { display: flex; justify-content: space-between; gap: 10px; }
.notes span { color: var(--muted); }
.notes b { white-space: nowrap; }
.notes b.good { color: color-mix(in srgb, var(--gr) 80%, var(--ink)); }
.notes b.bad { color: color-mix(in srgb, var(--rd) 80%, var(--ink)); }

/* ---------- tables ---------- */

.table-wrap { max-height: 440px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    padding: 8px 7px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-solid);
    white-space: nowrap;
}
td { padding: 10px 7px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--ac) 6%, transparent); }
tbody tr.clickable { cursor: pointer; }
tbody tr.selected { background: color-mix(in srgb, var(--ac) 11%, transparent); box-shadow: inset 3px 0 0 var(--ac); }
td.right, th.right { text-align: right; }
td.wrap { white-space: normal; min-width: 320px; overflow-wrap: anywhere; color: var(--muted); }
td .tag { margin-left: 6px; }
td .under { display: block; color: var(--muted); font-size: 11px; }
#countries .bar { min-width: 80px; }

/* ---------- confirm dialog ---------- */

dialog.confirm {
    width: min(520px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--raised);
    color: var(--ink);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}
dialog.confirm.danger { border-color: color-mix(in srgb, var(--rd) 60%, transparent); }
dialog.confirm[open] { animation: pop 0.18s ease-out; }
dialog.confirm::backdrop { background: rgba(7, 11, 22, 0.55); backdrop-filter: blur(4px); }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
.confirm-body { padding: 20px 22px 6px; display: grid; gap: 10px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ac); }
.confirm.danger .eyebrow { color: var(--rd); }
.confirm-body h2 { font-size: 18px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.confirm-body p { margin: 0; white-space: pre-line; color: var(--ink-2); overflow-wrap: anywhere; }
.confirm-body code {
    display: block;
    padding: 9px 11px;
    border-radius: 9px;
    background: var(--console-bg);
    color: var(--console-ink);
    border: 1px solid var(--console-line);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.confirm-field { display: grid; gap: 10px; margin-top: 4px; }
.confirm-field > label:first-child { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.confirm-field #confirm-input, .confirm-field #confirm-number { padding: 10px 11px; font-size: 14px; }
.confirm-field #confirm-number { width: 120px; }
.confirm-field small { font-size: 12px; margin-top: -4px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px 20px; }
.confirm-actions .btn { min-width: 96px; padding: 8px 16px; }

/* ---------- footer ---------- */

.footer { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; padding-top: 8px; }

/* ---------- login ---------- */

.login-page { min-height: calc(100vh / var(--zoom)); display: grid; place-items: center; padding: 16px; }
.login-page > .theme-btn { position: fixed; top: 16px; right: 16px; }
.login { width: 100%; max-width: 380px; display: grid; gap: 14px; padding: 28px 26px; }
.login .login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.login h1 em {
    font-style: normal;
    background: linear-gradient(90deg, var(--ac), var(--ac2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.login label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.login input { padding: 10px 11px; font-size: 14px; }
.login button[type="submit"] { padding: 10px; font-size: 14px; }
.login .error { color: color-mix(in srgb, var(--rd) 80%, var(--ink)); min-height: 1.4em; margin: 0; font-size: 13px; }

/* ---------- small screens, less motion ---------- */

@media (max-width: 1000px) {
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-main, .g3, .g2, .gw { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .topbar-inner { padding: 10px var(--side); gap: 6px; flex-wrap: wrap; }
    .page { padding: 0 var(--side) 32px; }
    .brand span, .user-label, .clock, .theme-label { display: none; }
    .home { gap: 10px; }
    .logo { height: 32px; }
    .user { padding-right: 6px; gap: 4px; }
    .hero { padding-top: 20px; }
    .launch-form select, .launch-form input, .launch-form .workers-field input { min-width: 0; width: 100%; }
    .launch-form label { flex: 1 1 140px; }
    .workers { flex: 1 1 100%; min-width: 0; }
    .net-row { grid-template-columns: 104px minmax(0, 1fr) 40px; gap: 8px; }
    .cty-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
    .cty { height: 28px; font-size: 11px; letter-spacing: 0; }
}
@media (max-width: 560px) {
    .g4 { grid-template-columns: minmax(0, 1fr); }
    .card { padding: 15px; }
    .kpi-value { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
