:root {
  color-scheme: light dark;
  --bg: #f3f5fa;
  --surface: #ffffff;
  --text: #141c2e;
  --muted: #5a6882;
  --line: #e1e6f0;
  --accent: #3457d5;
  --on-accent: #ffffff;
  --pos: #0e7a54;
  --neg: #c0312a;
  --warn: #a15c00;
  --pos-bar: #1a9d74;
  --neg-bar: #d1495b;
  --spot: #3457d5;
  --flip: #b7791f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 10px 28px rgba(16, 24, 40, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c111b;
    --surface: #151c29;
    --text: #e7ebf4;
    --muted: #97a4ba;
    --line: #243044;
    --accent: #7f9cff;
    --on-accent: #0b1020;
    --pos: #4ad3a3;
    --neg: #ff7b72;
    --warn: #e3b341;
    --pos-bar: #2bb98b;
    --neg-bar: #e0606f;
    --spot: #7f9cff;
    --flip: #e3b341;
    --shadow: none;
    --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.5);
  }
}

/* The same dark colours, for a person who chose Dark with the theme button while the system is light. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c111b;
  --surface: #151c29;
  --text: #e7ebf4;
  --muted: #97a4ba;
  --line: #243044;
  --accent: #7f9cff;
  --on-accent: #0b1020;
  --pos: #4ad3a3;
  --neg: #ff7b72;
  --warn: #e3b341;
  --pos-bar: #2bb98b;
  --neg-bar: #e0606f;
  --spot: #7f9cff;
  --flip: #e3b341;
  --shadow: none;
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.92em; }
.muted { color: var(--muted); }

.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}

.brand { margin: 0; font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.brand .muted { font-weight: 400; margin-left: 6px; }
.status { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.tabs { display: flex; gap: 4px; }
.tabs button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tabs button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
}
.pill-live { color: var(--pos); border-color: var(--pos); }
.pill-wait { color: var(--warn); border-color: var(--warn); }
.pill-lost { color: var(--neg); border-color: var(--neg); }

main { max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px; }

.empty { text-align: center; padding: 60px 20px; }
.empty h2 { margin: 0 0 8px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .note { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card h2 { font-size: 15px; margin: 0; }
.card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 16px 0 6px; }

.controls { display: flex; gap: 14px; flex-wrap: wrap; }
.controls label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
}

.chart-wrap { position: relative; width: 100%; height: 340px; }
#chart { width: 100%; height: 100%; display: block; }
.tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  z-index: 3;
}
.tip b { font-variant-numeric: tabular-nums; }
.legend { font-size: 12px; margin: 8px 0 0; }

.two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 16px; margin: 0; }
.figures dt { color: var(--muted); font-size: 12px; }
.figures dd { margin: 0; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.none { color: var(--muted); font-style: italic; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.chip b { font-variant-numeric: tabular-nums; }

.alerts { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; }
.alerts li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.alerts .head { display: flex; gap: 8px; align-items: baseline; }
.alerts .when { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.alerts .body { white-space: pre-wrap; color: var(--muted); font-size: 13px; margin-top: 3px; }
.sev { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; text-transform: uppercase; }
.sev-Info { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.sev-Warning { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.sev-Critical { background: color-mix(in srgb, var(--neg) 18%, transparent); color: var(--neg); }

.foot { font-size: 12px; margin-top: 10px; }

svg text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg .grid { stroke: var(--line); stroke-width: 1; }
svg .zero { stroke: var(--muted); stroke-width: 1; }
svg .bar-call { fill: var(--pos-bar); }
svg .bar-put { fill: var(--neg-bar); }
svg .m-spot { stroke: var(--spot); stroke-width: 2; }
svg .m-flip { stroke: var(--flip); stroke-width: 2; stroke-dasharray: 5 4; }
svg .m-wall { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
svg .tag { font-weight: 600; }
svg .tag-spot { fill: var(--spot); }
svg .tag-flip { fill: var(--flip); }
svg .hover { fill: var(--text); opacity: 0.07; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer; }

/* Text for a screen reader that is not drawn: the label of a table column that holds only buttons or links */
.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; }
