:root {
  color-scheme: light dark;
  --bg: #fbfbfc;
  --panel: #ffffff;
  --line: #e6e8ec;
  --text: #16181d;
  --muted: #6b7280;
  --accent: #3b6ef6;
  --danger: #d93a3a;
  --warn: #c47e0a;
  --ok: #1f9254;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --panel: #14171c;
    --line: #242932;
    --text: #e6e8ec;
    --muted: #8b929e;
    --accent: #6b93ff;
  }
}

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

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 10;
}
.identity { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }
.identity h1 { font-size: 1rem; margin: 0; font-weight: 650; white-space: nowrap; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); align-self: center; }
.dot.ready { background: var(--ok); }
.dot.error { background: var(--danger); }
.stack {
  color: var(--muted); font-size: .8rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.tier {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  padding: .15rem .45rem; border: 1px solid var(--line); border-radius: 5px; color: var(--muted);
}
.btn {
  font: inherit; font-size: .8rem; padding: .3rem .7rem; border-radius: 6px;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

main { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; }
.stat .value { font-size: 1.5rem; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: .75rem; margin-top: .15rem; }
.stat.bad .value { color: var(--danger); }
.stat.warn .value { color: var(--warn); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem .95rem; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: .82rem; margin: 0; font-weight: 620; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.count { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.graph-panel { position: relative; }
#graph { display: block; width: 100%; height: 440px; cursor: grab; }
#graph:active { cursor: grabbing; }
.legend { display: flex; gap: .8rem; align-items: center; font-size: .75rem; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: .3rem; }
.swatch { width: 1rem; height: 2px; display: inline-block; }
.swatch.two-way { background: var(--warn); }
.swatch.cycle { background: var(--danger); }
.hint { opacity: .7; }

.inspector {
  position: absolute; right: .8rem; top: 3.4rem; width: 19rem; max-height: 370px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: .8rem .9rem; box-shadow: 0 8px 28px rgba(0,0,0,.14); font-size: .8rem;
}
.inspector h3 { margin: 0 0 .5rem; font-size: .9rem; }
.inspector .row { display: flex; justify-content: space-between; gap: 1rem; padding: .12rem 0; color: var(--muted); }
.inspector .row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.inspector h4 { margin: .8rem 0 .3rem; font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.inspector ul { margin: 0; padding-left: 1rem; }
.inspector li { margin: .1rem 0; word-break: break-all; }
.inspector .close { position: absolute; top: .45rem; right: .55rem; cursor: pointer; color: var(--muted); border: 0; background: none; font-size: 1rem; }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.columns .panel { margin: 0; }

.list { list-style: none; margin: 0; padding: .35rem 0; max-height: 300px; overflow: auto; }
.list li { padding: .4rem .95rem; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .where { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; color: var(--muted); word-break: break-all; }
.list .what { margin-top: .15rem; }
.sev { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; padding: .05rem .35rem; border-radius: 4px; margin-right: .4rem; }
.sev.error { background: rgba(217,58,58,.13); color: var(--danger); }
.sev.warning { background: rgba(196,126,10,.14); color: var(--warn); }
.tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .35rem; margin-right: .4rem; }
.empty { padding: 1.1rem .95rem; color: var(--muted); font-size: .85rem; }

.bars li { display: grid; grid-template-columns: 5.5rem 1fr 3rem; align-items: center; gap: .6rem; }
.bars .track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--accent); border-radius: 3px; }
.bars .num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; }

/* The banner is scoped to its id, not a bare .error class: severity badges
 * (span.sev.error) and the status dot (.dot.error) also carry an "error" class,
 * and a generic .error rule would pin each of them to the bottom of the
 * viewport as a full-width box. */
#error {
  position: fixed; inset: auto 1rem 1rem 1rem; max-width: 44rem; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--danger); border-radius: var(--radius);
  padding: .9rem 1.1rem; font-size: .85rem; white-space: pre-wrap; z-index: 40;
}

/* Demo banner (added for the hosted marketing demo) */
.demo-banner { display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap;
  padding:.7rem 1.5rem; background: linear-gradient(90deg, rgba(59,110,246,.20), rgba(59,110,246,.05));
  border-bottom:1px solid var(--line); font-size:.85rem; }
.demo-banner-text { color: var(--muted); max-width:60rem; }
.demo-banner-text strong { color: var(--text); }
.demo-banner-text a { color: var(--accent); }
.demo-cta { background: var(--accent); color:#fff; padding:.45rem 1rem; border-radius:8px; font-weight:600;
  text-decoration:none; white-space:nowrap; transition:opacity .15s; }
.demo-cta:hover { opacity:.9; }
