/* Design tokens. Chart roles (--series-*, --grid, --axis) follow the validated
   data-viz palette; --accent is the brand magenta and is used for chrome only,
   never for a data series. */
:root {
  color-scheme: light;
  --plane: #f9f9f7; --surface: #fcfcfb; --raised: #ffffff;
  --text: #0b0b0b; --text-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6; --series-2: #eb6834;
  --accent: #d02593; --accent-ink: #ffffff; --accent-wash: rgba(208, 37, 147, 0.10);
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-text: #006300; --critical-text: #b02a2a;
  --code: #111110; --code-text: #e9e8e3;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px rgba(11, 11, 11, 0.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --plane: #0d0d0d; --surface: #1a1a19; --raised: #222221;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5; --series-2: #d95926;
    --accent: #e0389f; --accent-wash: rgba(224, 56, 159, 0.14);
    --good-text: #0ca30c; --critical-text: #e66767;
    --code: #0a0a0a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--plane); color: var(--text); font: 14px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
h1 { font-size: 24px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
p { margin: 0 0 12px; }
code, pre { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
code { font-size: 0.92em; }
pre { background: var(--code); color: var(--code-text); padding: 16px 18px; border-radius: 10px; overflow-x: auto; font-size: 13px; line-height: 1.55; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }
.stack { display: grid; gap: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.two-up { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

/* ---- controls */
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--raised); color: var(--text); padding: 7px 13px; border-radius: 8px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--axis); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.danger { color: var(--critical-text); }
button.sm { padding: 4px 9px; font-size: 12.5px; }
button:disabled { opacity: 0.5; cursor: default; }
input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--raised); color: var(--text); }
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
td input, td select { min-width: 86px; padding: 5px 8px; }
input[type="checkbox"] { width: auto; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; padding: 2px; background: var(--raised); }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; color: var(--text-2); }
.segmented button[aria-pressed="true"] { background: var(--accent-wash); color: var(--text); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters select { width: auto; }

/* ---- cards and tiles */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card > .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.card > .head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.tile .label { color: var(--text-2); font-size: 12.5px; }
.tile .value { font-size: 24px; font-weight: 600; line-height: 1.25; margin-top: 4px; letter-spacing: -0.01em; }
.tile .delta { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 18px; }
.tile .delta.good { color: var(--good-text); }
.tile .delta.bad { color: var(--critical-text); }
.hero { font-size: 52px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; }
/* The track is a faint step of the fill's own hue, so an empty meter reads as empty. */
.meter { height: 10px; border-radius: 99px; background: color-mix(in srgb, var(--series-1) 16%, var(--surface)); overflow: hidden; margin: 10px 0 8px; }
.meter > span { display: block; height: 100%; background: var(--series-1); border-radius: 99px; }
.meter.warning > span { background: var(--warning); }
.meter.critical > span { background: var(--critical); }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px; font-size: 12px; border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.tag.ok::before { background: var(--good); }
.tag.warn::before { background: var(--warning); }
.tag.bad::before { background: var(--critical); }
.notice { border: 1px solid var(--accent); background: var(--accent-wash); border-radius: 10px; padding: 12px 14px; overflow-wrap: anywhere; }
.notice.bad { border-color: var(--critical); background: transparent; color: var(--critical-text); }
.empty { color: var(--muted); padding: 22px 0; text-align: center; }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- charts */
.viz-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.viz-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.viz-plot { position: relative; }
.viz-plot svg { display: block; overflow: visible; }
.viz-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-grid { stroke: var(--grid); stroke-width: 1; }
.viz-axis { stroke: var(--axis); stroke-width: 1; }
.viz-col.is-hover path { filter: brightness(1.18); }
.viz-band { fill: transparent; }
.viz-col.is-hover .viz-band { fill: var(--text); fill-opacity: 0.05; }
.viz-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-area { fill: var(--series-1); fill-opacity: 0.10; }
.viz-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.viz-cross { stroke: var(--axis); stroke-width: 1; }
.viz-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--raised); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font-size: 12.5px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22); min-width: 130px; }
.viz-tip .t { color: var(--muted); margin-bottom: 5px; }
.viz-tip .r { display: flex; align-items: center; gap: 8px; }
.viz-tip .r i { width: 12px; height: 2px; border-radius: 2px; flex: none; }
.viz-tip .r b { font-variant-numeric: tabular-nums; }
.viz-tip .r span { color: var(--text-2); }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.hbar .bar { height: 12px; }
.hbar .bar > span { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar:hover .bar > span { filter: brightness(1.18); }
.hbar .val { font-variant-numeric: tabular-nums; }

/* ---- app shell (panel + admin) */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: #000; color: #fff; padding: 22px 14px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; text-decoration: none; }
.side .logo small { color: #9a9993; font-size: 12px; border: 1px solid #333; border-radius: 99px; padding: 0 8px; }
.side nav { display: grid; gap: 2px; }
.side nav button { justify-content: space-between; width: 100%; background: transparent; border: 0; color: #b9b8b2; padding: 9px 12px; border-radius: 8px; }
.side nav button:hover { color: #fff; background: #161616; }
.side nav button[aria-current="page"] { background: #1c1c1b; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side nav .count { background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 600; }
.side .foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #222; font-size: 12.5px; color: #9a9993; display: grid; gap: 8px; }
.side .foot strong { color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.side .foot button { background: transparent; color: #d6d5cf; border-color: #333; justify-content: center; }
.side .foot a { color: #d6d5cf; }
.main { padding: 28px 32px 72px; min-width: 0; }
.main section > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.main section > header p { margin: 4px 0 0; color: var(--muted); }
.card.wide { grid-column: span 2; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 12px; }
  .side .logo { padding-bottom: 8px; }
  .side nav { grid-auto-flow: column; overflow-x: auto; }
  .side nav button { white-space: nowrap; }
  .side .foot { margin-top: 8px; grid-auto-flow: column; align-items: center; justify-content: space-between; }
  .main { padding: 18px 16px 56px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card.wide { grid-column: auto; }
  .hero { font-size: 40px; }
}

/* ---- sign-in */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #000 radial-gradient(60% 50% at 50% 0%, rgba(208, 37, 147, 0.30), transparent 70%); }
.gate .card { width: min(420px, 100%); background: #151514; border-color: #2a2a29; color: #f0efec; box-shadow: none; }
.gate .card p { color: #a9a8a2; }
.gate input { background: #0d0d0d; border-color: #333; color: #fff; }
.gate img { display: block; margin-bottom: 18px; }

/* ---- marketing pages */
.band { background: #000; color: #fff; }
.band.glow { background: #000 radial-gradient(55% 60% at 70% 0%, rgba(208, 37, 147, 0.34), transparent 70%); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.topnav { display: flex; align-items: center; gap: 22px; height: 64px; }
.topnav .logo { margin-right: auto; display: flex; }
.topnav a { color: #d6d5cf; text-decoration: none; }
.topnav a:hover { color: #fff; }
.topnav a.btn { color: #fff; }
.lead-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 40px; align-items: center; padding: 56px 0 72px; }
.lead-hero h1 { font-size: 44px; line-height: 1.1; letter-spacing: -0.025em; margin-bottom: 16px; }
.lead-hero p { font-size: 17px; color: #c3c2b7; max-width: 560px; margin-bottom: 24px; }
.lead-hero pre { border: 1px solid #2a2a29; background: #0d0d0d; }
.lead-hero .btn { background: transparent; border-color: #444; color: #fff; }
.lead-hero .btn.primary { background: var(--accent); border-color: var(--accent); }
.live { display: inline-flex; align-items: center; gap: 8px; color: #c3c2b7; font-size: 13px; margin-top: 18px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(12, 163, 12, 0.2); }
.section { padding: 56px 0 0; }
.section:last-of-type { padding-bottom: 72px; }
.section > h2 { font-size: 24px; letter-spacing: -0.01em; margin-bottom: 6px; }
.section > p.sub { color: var(--text-2); margin-bottom: 22px; max-width: 640px; }
.features { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.feature h3 { font-size: 15px; margin: 0 0 6px; }
.feature p { color: var(--text-2); margin: 0; }
.plan .name { font-weight: 600; }
.plan .price { font-size: 26px; font-weight: 600; margin: 6px 0 12px; letter-spacing: -0.01em; }
.plan ul { list-style: none; padding: 0; margin: 0; color: var(--text-2); display: grid; gap: 6px; }
.plan ul li::before { content: "✓"; color: var(--accent); margin-right: 8px; font-weight: 700; }
.doc { max-width: 860px; }
.doc h2 { font-size: 18px; margin: 36px 0 12px; }
@media (max-width: 860px) {
  .lead-hero { grid-template-columns: 1fr; padding: 32px 0 48px; }
  .lead-hero h1 { font-size: 34px; }
  .topnav { gap: 14px; }
}
