/* status.dexterai.dev (site/status.js, public/status.js). Loaded after
   base.css and site.css, on the site's Gold tokens: the ledger look (2px ink
   rules opening each section, tabular figures), dark by default and light
   when the system asks. State colours are reserved for state and always
   come with a word: green = working, gold = degraded, red = down. Chart
   series follow each bot's tone, stepped per theme and checked for
   colour-blind separation (the order support, face, staff, sentry, then
   music in the lead music bot's teal, botRegistry MUSIC_COLOR.clarity). No
   inline styles anywhere (CSP style-src 'self'). */

:root {
    --st-ok: #5fcf9d;
    --st-warn: #e9b931;
    --st-down: #f2765a;
    --st-maint: #c4bca6;
    --st-none: rgba(243, 238, 223, 0.12);
    --st-ok-dim: rgba(95, 207, 157, 0.12);
    --st-warn-dim: rgba(233, 185, 49, 0.13);
    --st-down-dim: rgba(242, 118, 90, 0.14);
    --s-support: #d55181;
    --s-face: #c98500;
    --s-staff: #199e70;
    --s-sentry: #d95926;
    --s-music: #2fa8b5;
    --s-single: #e9b931;
    --s-second: #199e70;
    --grid: rgba(243, 238, 223, 0.08);
}
@media (prefers-color-scheme: light) {
    :root {
        --st-ok: #13774f;
        --st-warn: #8a5b00;
        --st-down: #b23c1c;
        --st-maint: #4a4537;
        --st-none: rgba(40, 32, 12, 0.12);
        --st-ok-dim: rgba(19, 119, 79, 0.1);
        --st-warn-dim: rgba(176, 122, 12, 0.12);
        --st-down-dim: rgba(178, 60, 28, 0.1);
        --s-support: #c2386e;
        --s-face: #a86a00;
        --s-staff: #13774f;
        --s-sentry: #b8461b;
        --s-music: #1b7c86;
        --s-single: #a86a00;
        --s-second: #13774f;
        --grid: rgba(40, 32, 12, 0.09);
    }
}

.st { padding-bottom: 56px; }
.st-top { padding-top: 32px; }
.st-section { margin-top: 48px; }
.st-sec-head { border-top: 2px solid var(--ink); padding-top: 14px; margin: 0 0 20px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 24px; }
.st-sec-head h1, .st-sec-head h2 { margin: 0; font-size: var(--fs-xl); line-height: 1.1; }
.st-sec-sub { color: var(--text-2); margin: 0; font-size: var(--fs-sm); flex-basis: 100%; }
.st-muted { color: var(--text-3); }
.st-empty { color: var(--text-3); margin: 8px 0; }

/* ---- banner ------------------------------------------------------------- */
.st-banner { display: flex; align-items: center; gap: 16px; padding: 22px 22px; border-radius: var(--radius-lg); border: 1px solid var(--border-strong); background: var(--s1); }
.st-banner h1 { margin: 0; font-size: clamp(24px, 3.4vw, 36px); line-height: 1.1; }
.st-banner-icon { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; }
.st-banner-icon svg { width: 26px; height: 26px; }
.st-banner.st-operational .st-banner-icon { background: var(--st-ok-dim); color: var(--st-ok); }
.st-banner.st-degraded .st-banner-icon, .st-banner.st-maintenance .st-banner-icon { background: var(--st-warn-dim); color: var(--st-warn); }
.st-banner.st-down .st-banner-icon { background: var(--st-down-dim); color: var(--st-down); }
.st-banner.st-down { border-color: var(--st-down); }
.st-banner.st-degraded { border-color: var(--accent-border); }
.st-updated { margin: 6px 0 0; color: var(--text-3); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-live { width: 8px; height: 8px; border-radius: 50%; background: var(--st-ok); box-shadow: 0 0 0 0 var(--st-ok-dim); animation: st-pulse 2s infinite; }
@keyframes st-pulse { 0% { box-shadow: 0 0 0 0 var(--st-ok-dim); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.st-stale .st-live { background: var(--st-warn); animation: none; }

/* ---- active incidents ----------------------------------------------------- */
.st-active { margin-top: 16px; display: grid; gap: 12px; }
.st-active[hidden] { display: none; }
.st-alert { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--s1); }
.st-alert.st-imp-major { border-color: var(--st-down); }
.st-alert.st-imp-minor { border-color: var(--accent-border); }
.st-alert h2 { margin: 0 0 6px; font-size: var(--fs-md); }
.st-alert h2 a { color: var(--text); text-decoration: none; }
.st-alert h2 a:hover { text-decoration: underline; }
.st-alert p { margin: 6px 0 0; color: var(--text-2); }
.st-discord { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 16px; border-radius: var(--radius); background: var(--s1); border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); }
.st-discord svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }

/* ---- range control -------------------------------------------------------- */
.st-range { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--s1); border: 1px solid var(--border-strong); }
.st-range a { padding: 6px 12px; border-radius: 7px; color: var(--text-2); text-decoration: none; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-range a:hover { color: var(--text); background: var(--s2); }
.st-range a[aria-current="true"] { background: var(--accent); color: var(--on-accent); }
.st-range-long { display: none; }
@media (min-width: 720px) { .st-range-short { display: none; } .st-range-long { display: inline; } }

/* ---- systems -------------------------------------------------------------- */
.st-comps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.st-comp { padding: 18px 0 16px; border-bottom: 1px solid var(--rule); }
.st-comp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.st-comp-name h3 { margin: 0; font-size: var(--fs-md); }
.st-comp-name p { margin: 2px 0 0; color: var(--text-3); font-size: var(--fs-sm); }
.st-comp-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; align-items: center; }
.st-comp-facts > div { display: flex; flex-direction: column; min-width: 74px; }
.st-comp-facts dt { font-size: 12px; color: var(--text-3); letter-spacing: .01em; }
.st-comp-facts dd { margin: 2px 0 0; font-weight: 650; font-size: var(--fs-sm); color: var(--text); }
.st-comp-note { margin: 8px 0 0; font-size: var(--fs-sm); color: var(--text-2); }
.st-comp-note[hidden] { display: none; }

.st-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 650; line-height: 1.5; white-space: nowrap; background: var(--s2); color: var(--text-2); }
.st-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-pill.st-operational, .st-pill.st-resolved { background: var(--st-ok-dim); color: var(--st-ok); }
.st-pill.st-degraded, .st-pill.st-imp-minor { background: var(--st-warn-dim); color: var(--st-warn); }
.st-pill.st-down, .st-pill.st-imp-major { background: var(--st-down-dim); color: var(--st-down); }
.st-pill.st-maintenance, .st-pill.st-imp-maintenance, .st-pill.st-imp-none { color: var(--st-maint); }

/* bars: 2px gaps between rounded cells; the hit target is the whole column */
.st-bars { display: flex; align-items: stretch; gap: 2px; height: 34px; margin-top: 14px; }
.st-bar { flex: 1 1 0; min-width: 0; border-radius: 3px; background: var(--st-ok); cursor: default; position: relative; }
.st-bars-dense .st-bar { border-radius: 2px; }
.st-bar.b-partial { background: var(--st-warn); }
.st-bar.b-down { background: var(--st-down); }
.st-bar.b-none { background: var(--st-none); }
.st-bar:hover, .st-bar:focus-visible, .st-bar.is-hover { outline: 2px solid var(--text); outline-offset: 1px; z-index: 1; }
.st-bars-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--text-3); }
@media (max-width: 560px) { .st-bars { height: 28px; gap: 1px; } .st-bars-dense .st-bar { border-radius: 1px; } }

.st-legend { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-2); }
.st-legend li { display: inline-flex; align-items: center; gap: 7px; }
.st-legend .st-bar { display: inline-block; flex: none; width: 10px; height: 14px; }

/* the floating tooltip (bars and charts) */
.st-tip { position: fixed; z-index: 40; pointer-events: none; max-width: min(320px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 10px; background: var(--s1); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 13.5px; line-height: 1.45; }
.st-tip[hidden] { display: none; }
.st-tip b { font-weight: 650; }
.st-tip .st-tip-h { color: var(--text-2); font-size: 12.5px; margin-bottom: 4px; }
.st-tip ul { list-style: none; margin: 6px 0 0; padding: 6px 0 0; border-top: 1px solid var(--rule); }
.st-tip li { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.st-tip li .sw { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.st-tip li .v { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; padding-left: 12px; }

/* ---- metrics ------------------------------------------------------------------ */
.st-group { margin-top: 28px; }
.st-group-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 12px; }
.st-group-h h3 { margin: 0; font-size: var(--fs-md); }
.st-group-h p { margin: 0; color: var(--text-3); font-size: var(--fs-sm); }
.st-charts { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.st-chart { margin: 0; padding: 14px 14px 10px; border-radius: var(--radius); background: var(--s1); border: 1px solid var(--border); min-width: 0; }
.st-chart figcaption h4 { margin: 0; font-size: var(--fs-sm); font-family: var(--font); font-weight: 650; }
.st-chart figcaption p { margin: 2px 0 0; font-size: 13px; color: var(--text-3); }
.st-unit { color: var(--text-3); font-weight: 500; }
.st-plot { position: relative; margin-top: 12px; min-height: 60px; }
.st-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.st-plot-msg { margin: 0; padding: 22px 0; text-align: center; color: var(--text-3); font-size: 13px; }
.st-plot .ax text { fill: var(--text-3); font: 500 11px/1 var(--font); font-variant-numeric: tabular-nums; }
.st-plot .ax line.grid { stroke: var(--grid); stroke-width: 1; }
.st-plot .ax line.base { stroke: var(--border-strong); stroke-width: 1; }
.st-plot .ln { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.st-plot .area { stroke: none; opacity: .16; }
.st-plot .bar { stroke: none; opacity: .85; }
.st-plot .clip { stroke: none; }
.st-plot .band { fill: var(--bg-soft, rgba(127,127,127,.04)); stroke: none; }
.st-plot .bname { font: 650 12.5px/1 var(--font); fill: var(--text); }
.st-plot .btyp { font: 500 11.5px/1 var(--font); fill: var(--text-3); font-variant-numeric: tabular-nums; }
.st-plot .ax text.scale { fill: var(--text-3); font: 500 10.5px/1 var(--font); }
.st-clip-note { margin: 6px 0 0; font-size: 12px; color: var(--text-3); }
.st-plot .ln.dash { stroke-dasharray: 5 4; }
.st-plot .pt { stroke: var(--s1); stroke-width: 2; }
.st-plot .xh { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.st-plot .lbl { font: 650 11px/1 var(--font); fill: var(--text-2); }
.s-support { stroke: var(--s-support); fill: var(--s-support); }
.s-face { stroke: var(--s-face); fill: var(--s-face); }
.s-staff { stroke: var(--s-staff); fill: var(--s-staff); }
.s-sentry { stroke: var(--s-sentry); fill: var(--s-sentry); }
.s-music { stroke: var(--s-music); fill: var(--s-music); }
.s-single, .s-web, .s-size, .s-wal, .s-rows, .s-typical { stroke: var(--s-single); fill: var(--s-single); }
.s-worst { stroke: var(--s-second); fill: var(--s-second); }
.st-plot .ln[class*="s-"] { fill: none; }
.st-legend-s { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; padding: 0; font-size: 12.5px; color: var(--text-2); }
.st-legend-s li { display: inline-flex; align-items: center; gap: 6px; }
.st-legend-s .sw { width: 14px; height: 3px; border-radius: 2px; }
.sw.s-support { background: var(--s-support); } .sw.s-face { background: var(--s-face); } .sw.s-staff { background: var(--s-staff); } .sw.s-sentry { background: var(--s-sentry); } .sw.s-music { background: var(--s-music); }
.sw.s-single, .sw.s-web, .sw.s-size, .sw.s-wal, .sw.s-rows, .sw.s-typical { background: var(--s-single); } .sw.s-worst { background: var(--s-second); }
.st-table-toggle { margin-top: 6px; font-size: 12.5px; }
.st-table-toggle summary { cursor: pointer; color: var(--text-3); }
.st-table-toggle .st-table { margin-top: 6px; max-height: 240px; overflow: auto; display: block; }

/* tiles, area rows, backups */
.st-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0 0 16px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); }
@media (min-width: 720px) { .st-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } .st-tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.st-tiles > div { background: var(--s1); padding: 12px 14px; }
.st-tiles dt { font-size: 12px; color: var(--text-3); }
.st-tiles dd { margin: 4px 0 0; font-weight: 650; font-size: var(--fs-md); }
.st-db-more { display: grid; gap: 16px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .st-db-more { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.st-db-more > div { padding: 14px; border-radius: var(--radius); background: var(--s1); border: 1px solid var(--border); min-width: 0; }
.st-db-more h4 { margin: 0 0 10px; font-size: var(--fs-sm); font-family: var(--font); font-weight: 650; }
.st-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.st-cats li { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.st-cats li > span:first-child { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-meter { width: 100%; height: 6px; display: block; }
.st-meter-bg { fill: var(--s3); }
.st-meter-fg { fill: var(--s-single); }
.st-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.st-table th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 12px; padding: 4px 8px 6px 0; border-bottom: 1px solid var(--rule); }
.st-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.st-table .num { text-align: right; white-space: nowrap; }
.st-table td.num .st-meter { width: 64px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.st-table td .st-muted { display: block; font-size: 12px; }

/* ---- incidents ---------------------------------------------------------------- */
.st-day { margin-top: 18px; }
.st-day-h { margin: 0 0 6px; font: 650 var(--fs-sm)/1.3 var(--font); color: var(--text-2); }
.st-incs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.st-inc { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.st-inc h3 { margin: 0; font-size: var(--fs-base); }
.st-inc h3 a { color: var(--text); text-decoration: none; }
.st-inc h3 a:hover { color: var(--accent-text); text-decoration: underline; }
.st-inc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 6px 0 0; font-size: 13.5px; color: var(--text-3); }
.st-inc-last { margin: 6px 0 0; color: var(--text-2); font-size: var(--fs-sm); max-width: 70ch; }
.st-incident header { border-top: 2px solid var(--ink); padding-top: 16px; margin-bottom: 20px; }
.st-incident h1 { margin: 4px 0 8px; font-size: var(--fs-2xl); line-height: 1.05; }
.st-kicker { margin: 0; color: var(--text-3); font-size: var(--fs-sm); font-weight: 600; }
.st-incident h2 { margin: 28px 0 8px; font-size: var(--fs-lg); }
.st-timeline { list-style: none; margin: 0 0 24px; padding: 0 0 0 18px; border-left: 2px solid var(--rule); }
.st-timeline li { position: relative; padding: 2px 0 18px 8px; }
.st-timeline li::before { content: ""; position: absolute; left: -25px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); border: 2px solid var(--canvas); }
.st-timeline li.st-tl-resolved::before { background: var(--st-ok); }
.st-timeline li.st-tl-investigating::before { background: var(--st-down); }
.st-timeline li.st-tl-identified::before, .st-timeline li.st-tl-monitoring::before { background: var(--st-warn); }
.st-tl-h { margin: 0; font-size: var(--fs-sm); color: var(--text-3); }
.st-tl-h b { color: var(--text); margin-right: 8px; }
.st-timeline p + p { margin: 4px 0 0; color: var(--text-2); white-space: pre-line; }
