:root {
  color-scheme: dark;
  --page: #060a14;
  --surface: #111a2c;
  --glass: rgba(17, 26, 44, 0.78);
  --glass-hi: rgba(24, 36, 60, 0.85);
  --rule: rgba(255, 255, 255, 0.08);
  --rule-2: rgba(255, 255, 255, 0.14);
  --ink: #eef1f7;
  --ink-2: #b7c0d1;
  --muted: #7d889c;
  --grid: #24304a;
  --axis: #36435f;
  --agent: #3987e5;   /* series 1, validated on --surface */
  --rules: #d95926;   /* series 2 */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --info: #8fb4ff;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); }
body { font: 14px/1.5 var(--sans); min-height: 100vh; overflow-x: hidden; }
a { color: var(--info); }
button { font: inherit; color: inherit; }
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
  background: radial-gradient(1200px 700px at 80% -10%, #16254a 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #101c3a 0%, transparent 60%), var(--page); }
.shell { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 18px 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700;
  font-size: 18px; letter-spacing: .01em; }
.brand small { font-weight: 400; color: var(--muted); font-size: 13px; }
.logo { width: 28px; height: 28px; filter: drop-shadow(0 0 8px rgba(160, 185, 255, .45)); }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; }
.links a { color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.links a:hover { color: var(--ink); }
.links .watching { color: var(--info); font-weight: 600; }
.gh { width: 15px; height: 15px; fill: currentColor; flex: none; }
.top .links { order: 3; width: 100%; }
.topnav { margin-left: auto; display: flex; gap: 4px; padding: 4px; border: 1px solid var(--rule); border-radius: 12px;
  background: var(--glass); backdrop-filter: blur(10px); max-width: 100%; }
.topnav a { color: var(--ink-2); text-decoration: none; padding: 7px 14px; border-radius: 9px; white-space: nowrap; }
.topnav a:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.topnav a[aria-current=page] { background: var(--glass-hi); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-2); }
.topnav a:focus-visible, .menu-btn:focus-visible, a.card:focus-visible, .stretch:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.menu-btn { display: none; margin-left: auto; width: 40px; height: 36px; border: 1px solid var(--rule-2); border-radius: 9px;
  background: var(--glass); cursor: pointer; padding: 9px 10px; flex-direction: column; justify-content: space-between; }
.menu-btn span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
.top.open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.top.open .menu-btn span:nth-child(2) { opacity: 0; }
.top.open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.btn:focus-visible, .row-link:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

/* cards & layout */
.card { background: var(--glass); border: 1px solid var(--rule); border-radius: 14px; padding: 16px 18px;
  backdrop-filter: blur(10px); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600;
  margin: 28px 0 10px; }
h1 { font-size: 22px; margin: 10px 0 4px; }
.label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.big { font-size: 26px; font-weight: 650; margin-top: 2px; }
.sub { color: var(--ink-2); font-size: 12.5px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.empty { color: var(--muted); padding: 18px 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn { background: var(--glass-hi); border: 1px solid var(--rule-2); border-radius: 9px; padding: 6px 12px;
  cursor: pointer; color: var(--ink); }
.btn:hover { border-color: var(--info); }
.btn[aria-pressed=true] { border-color: var(--info); color: var(--info); }

/* pills: status colours always paired with a text label */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 9px; border-radius: 999px;
  border: 1px solid var(--rule-2); color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.page::before, .pill.open::before { background: var(--critical); }
.pill.notify::before { background: var(--serious); }
.pill.watch::before { background: var(--info); }
.pill.resolved::before { background: var(--good); }
.pill.plain::before { display: none; }

/* hero status */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; padding: 20px 22px; }
.ring { position: relative; width: 92px; height: 92px; }
.ring svg { position: absolute; inset: 0; }
.sweep { position: absolute; inset: 6px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 300deg, color-mix(in srgb, var(--c) 55%, transparent) 360deg);
  animation: spin 4s linear infinite; mask: radial-gradient(circle, #000 64%, transparent 65%); }
.ring .icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 700;
  color: var(--c); }
.hero h1 { margin: 0; font-size: 24px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--ink-2); font-size: 13px; }
.meta .warn { color: var(--warning); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; justify-items: start; } }

/* sparkline cards */
.spark-card .big { font-size: 22px; }
svg.spark { width: 100%; height: 64px; display: block; margin-top: 6px; overflow: visible; touch-action: none; }
.spark .area { opacity: .16; }
.spark .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .cross { stroke: var(--ink-2); stroke-width: 1; opacity: 0; }
.spark .dot { opacity: 0; stroke: var(--surface); stroke-width: 2; }
.spark.hovering .cross, .spark.hovering .dot { opacity: 1; }
.spark .thr { stroke: var(--axis); stroke-dasharray: 3 4; }

/* decisions & incidents */
.list { display: grid; gap: 10px; }
.row-link { display: block; text-decoration: none; color: inherit; border-radius: 14px; }
.row-link:hover .card { border-color: var(--rule-2); background: var(--glass-hi); }
.decision p { margin: 8px 0 0; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }

/* evaluation charts */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--k); }
.mbar { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; gap: 6px 14px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--rule); }
.mbar:last-child { border-bottom: 0; }
.mbar .tracks { display: grid; gap: 4px; }
.track { display: grid; grid-template-columns: 1fr 52px; gap: 8px; align-items: center; }
.track .bar { height: 10px; background: var(--grid); border-radius: 2px; overflow: hidden; }
.track .bar span { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.track .v { font-variant-numeric: tabular-nums; text-align: right; font-size: 12.5px; color: var(--ink-2); }
@media (max-width: 560px) { .mbar { grid-template-columns: 1fr; } }
svg.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 11px var(--sans); }
.chart .gridline { stroke: var(--grid); }
.chart .base { stroke: var(--axis); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .hl, .chart .hl.on { opacity: 1; }
.chart .hl { fill: rgba(255, 255, 255, .05); opacity: 0; pointer-events: none; }
.silent-tag { fill: var(--warning) !important; font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

/* how it works */
.diagram { width: 100%; min-width: 720px; height: auto; display: block; }
.diagram .node rect { fill: var(--glass-hi); stroke: var(--rule-2); }
.diagram .node.ai rect { stroke: var(--agent); }
.diagram .node.fail rect { stroke: var(--serious); stroke-dasharray: 4 4; }
.diagram .node text { fill: var(--ink); font: 600 13px var(--sans); }
.diagram .node .s { fill: var(--muted); font: 11px var(--sans); }
.diagram .wire { fill: none; stroke: var(--axis); stroke-width: 2; }
.diagram .flow { fill: none; stroke: var(--info); stroke-width: 2; stroke-dasharray: 6 14; animation: flow 1.6s linear infinite; }
.diagram .flow.warn { stroke: var(--serious); }
@keyframes flow { to { stroke-dashoffset: -20; } }
.howsteps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.howsteps li { counter-increment: s; }
.howsteps li .card { height: 100%; }
.howsteps li .card::before { content: counter(s); display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--grid); font-size: 12px; margin-bottom: 6px; }

/* tooltip */
.tip { position: fixed; z-index: 10; pointer-events: none; background: #0b1222; border: 1px solid var(--rule-2);
  border-radius: 8px; padding: 6px 9px; font-size: 12px; color: var(--ink); box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
  max-width: 240px; }
.tip b { font-variant-numeric: tabular-nums; }

footer { color: var(--muted); font-size: 12px; text-align: center; padding: 28px 0 6px; border-top: 1px solid var(--rule);
  margin-top: 32px; }
footer .links { justify-content: center; }
footer p { margin: 10px 0 0; }

/* health checks & usage meters */
.pill.pass::before { background: var(--good); }
.pill.warn::before { background: var(--warning); }
.pill.fail::before { background: var(--critical); }
.overall { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.overall.warn { border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.overall.fail { border-color: color-mix(in srgb, var(--critical) 55%, transparent); }
.checks { gap: 8px; }
.check { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start; padding: 12px 16px; }
.check .pill { justify-self: start; margin-top: 1px; }
.check-body { min-width: 0; overflow-wrap: anywhere; }
.meter { padding: 6px 0 10px; }
.meter + .meter, .card > p + .meter { border-top: 1px solid var(--rule); padding-top: 12px; }
.meter-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.meter-head .mono { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meter-bar { position: relative; height: 12px; background: var(--grid); border-radius: 3px; }
.meter-bar .fill { display: block; height: 100%; max-width: 100%; border-radius: 3px; background: var(--good); }
.meter-bar .fill.warn { background: var(--warning); }
.meter-bar .fill.fail { background: var(--critical); }
.meter-bar .limit { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--ink); }
.meter .sub { margin-top: 6px; }
.card .empty-card { border: 0; padding: 4px 0; background: none; backdrop-filter: none; }
@media (max-width: 420px) { .check { grid-template-columns: 1fr; gap: 6px; } }

/* clickable cards: hover lift + arrow */
a.card { display: block; color: inherit; text-decoration: none; }
.clickable { position: relative; transition: transform .18s ease, border-color .18s, background .18s; }
.clickable:hover { transform: translateY(-2px); border-color: var(--rule-2); background: var(--glass-hi); }
.clickable .arrow { position: absolute; top: 12px; right: 14px; color: var(--muted); transition: transform .18s, color .18s; }
.clickable:hover .arrow { transform: translateX(3px); color: var(--info); }
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: 14px; z-index: 1; }
.clickable .above { position: relative; z-index: 2; color: var(--info); text-decoration: none; }
.clickable .above:hover { text-decoration: underline; }

/* breadcrumbs */
.crumbs { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 2px; font-size: 13px; }
.crumbs ol { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .back { color: var(--info); }
.crumbs [aria-current] { color: var(--ink); }

/* insights hub */
.hub { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 16px; }
.hub-card { padding: 20px 22px; min-height: 170px; }
.hub-card .label { font-size: 13px; color: var(--ink); font-weight: 600; letter-spacing: .04em; }
.hub-card .mini-big { font-size: 30px; margin-top: 8px; min-height: 40px; }
.hub-card p { margin: 10px 0 0; color: var(--muted); }

/* segmented controls, report navigation, bars, compact tables */
.seg { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--rule); border-radius: 11px; background: var(--glass);
  margin: 6px 0 14px; flex-wrap: wrap; }
.seg .btn { border-color: transparent; background: none; }
.seg .btn[aria-pressed=true] { background: var(--glass-hi); border-color: var(--rule-2); color: var(--ink); }
.report-nav { gap: 10px; }
.report-nav .seg { margin: 6px 0; }
.report-nav .spacer { flex: 1; }
#rep-label { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#rep-label .btn { text-decoration: none; padding: 3px 11px; }
#rep-label .btn[aria-disabled=true] { opacity: .35; cursor: default; }
#rep-body, #perf-body { margin-top: 8px; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(80px, 150px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hl-label { color: var(--ink-2); text-transform: capitalize; overflow-wrap: anywhere; }
.hb-track { height: 10px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.hb-fill { display: block; height: 100%; border-radius: 3px; }
.hbar .v { color: var(--ink-2); font-size: 12px; white-space: nowrap; }
table.compact { margin-top: 10px; font-size: 13px; }
table.compact th, table.compact td { padding: 6px 8px; }

/* motion: page enter, skeletons, pulse on new data */
main > section.enter { animation: enter .28s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.skel-grid { margin-top: 10px; }
.skel, .skel-line { position: relative; overflow: hidden; background: rgba(255, 255, 255, .04); }
.skel-line { display: inline-block; height: .8em; width: 60%; border-radius: 6px; vertical-align: middle; }
.skel-line.short { width: 40%; }
.skel::after, .skel-line::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.pulse { animation: pulse 1.2s ease-out; border-radius: 6px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(143, 180, 255, .55); background: rgba(143, 180, 255, .18); }
  100% { box-shadow: 0 0 0 10px rgba(143, 180, 255, 0); background: transparent; } }

/* empty states */
.empty-card { border-style: dashed; color: var(--ink-2); }
.empty-card strong { color: var(--ink); }
.empty-card p { margin: 4px 0 0; font-size: 13px; }
.nodata { margin: 14px 0 6px; }

/* incident detail */
.inc-head h1 { margin: 10px 0 2px; overflow-wrap: anywhere; }
.share { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; min-width: 0; }
.share .mono { overflow-wrap: anywhere; min-width: 0; }
.pill.degraded { border-color: color-mix(in srgb, var(--warning) 60%, transparent); color: var(--warning); }
.pill.degraded::before { background: var(--warning); }
.run-head { margin-bottom: 12px; }
.trace { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--grid); display: grid; gap: 10px; }
.tstep { position: relative; border: 1px solid var(--rule); border-radius: 10px; padding: 9px 12px; background: rgba(6, 10, 20, .45);
  min-width: 0; }
.tstep::before { content: ""; position: absolute; left: -26px; top: 13px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--agent); }
.tstep.signal::before { border-color: var(--warning); }
.tstep.rules::before { border-color: var(--serious); }
.tstep.final { border-color: color-mix(in srgb, var(--agent) 55%, transparent); }
.tstep.final::before { background: var(--agent); }
.thead { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.thead strong { text-transform: capitalize; }
.dur { color: var(--muted); font: 12px var(--mono); white-space: nowrap; }
.targs { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.tres { color: var(--ink-2); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.tstep details { margin-top: 6px; }
.tstep pre { white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; color: var(--ink-2); font: 12px/1.45 var(--mono); }
.verdict { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 8px 0 2px; }
.verdict dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; }
.verdict dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.verdict dd p { margin: 4px 0 0; }
@media (max-width: 560px) {
  .verdict { grid-template-columns: 1fr; gap: 2px; }
  .verdict dd { margin-bottom: 8px; }
  .card { padding: 14px; }
  .menu-btn { display: flex; }
  .top .topnav { display: none; order: 4; width: 100%; margin-left: 0; flex-direction: column; }
  .top.open .topnav { display: flex; }
  .topnav a { padding: 10px 12px; }
  .brand small { display: none; }
}

@media (max-width: 560px) {
  .hbar { grid-template-columns: 1fr auto; }
  .hbar .hb-track { grid-column: 1 / -1; grid-row: 2; }
  .report-nav .spacer { display: none; }
  .hub { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .sweep, .diagram .flow, main > section.enter, .skel::after, .skel-line::after, .pulse { animation: none; }
  .clickable, .clickable .arrow, .menu-btn span { transition: none; }
  .clickable:hover { transform: none; }
}
