:root {
  --brand: #1BAA6E;
  --brand-dim: #16955f;
  --brand-soft: rgba(27,170,110,0.10);
  --brand-edge: rgba(27,170,110,0.32);
  --brand-glow: rgba(27,170,110,0.42);
  --bg: #080d0b;
  --bg-2: #0c1311;
  --surface: #101816;
  --surface-2: #16201d;
  --line: rgba(255,255,255,0.07);
  --line-strong: rgba(255,255,255,0.12);
  --text: #eaf2ee;
  --text-dim: rgba(234,242,238,0.7);
  --text-mute: rgba(234,242,238,0.45);
  --warn: #FBBF24;
  --danger: #F97171;
  --info: #60A5FA;
  --code: #0a100e;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: 'Inter', 'InterVariable', ui-sans-serif, -apple-system, system-ui, sans-serif;
  line-height: 1.55; -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11','ss01','ss03'; font-size: 14.5px; letter-spacing: -0.005em;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(70% 55% at 85% -5%, rgba(27,170,110,0.10) 0%, transparent 60%),
    radial-gradient(50% 40% at -5% 50%, rgba(27,170,110,0.05) 0%, transparent 60%),
    linear-gradient(180deg, #090f0d 0%, #060a08 100%);
}

a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--text); }
button, .btn {
  font-family: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; transition: all .15s;
}
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--brand-edge); }
.btn-primary { background: var(--brand); color: #001209; border-color: var(--brand); }
.btn-primary:hover { background: #22cc83; color: #001209; }
.btn-danger { color: var(--danger); border-color: rgba(249,113,113,0.3); }
.btn-danger:hover { background: rgba(249,113,113,0.1); border-color: var(--danger); }
.btn-link { background: transparent; border-color: transparent; padding: 6px 8px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

#root { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 0 24px 96px; min-height: 100vh; display: flex; flex-direction: column; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0; border-bottom: 1px solid var(--line); margin-bottom: 24px;
  position: sticky; top: 0; backdrop-filter: saturate(180%) blur(12px);
  background: rgba(8,13,11,0.78); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 600; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: #001209; font-weight: 800; box-shadow: 0 0 28px var(--brand-glow); font-size: 14px; }
.brand-name .dot { color: var(--text-mute); margin: 0 6px 0 4px; }
.brand-name .sub { color: var(--text-dim); font-weight: 500; font-size: 14px; }
.topnav { display: flex; gap: 18px; align-items: center; font-size: 13px; }
.topnav a { color: var(--text-dim); font-weight: 500; padding: 6px 4px; border-bottom: 1.5px solid transparent; }
.topnav a.active { color: var(--brand); border-bottom-color: var(--brand); }
.topnav a:hover { color: var(--text); }
.topnav .sep { width: 1px; height: 18px; background: var(--line); }
.who { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--text-mute); }
.kill-switch { font-size: 11.5px; color: var(--text-mute); padding: 5px 10px; border-radius: 999px; background: var(--brand-soft); border: 1px solid var(--brand-edge); cursor: pointer; }
.kill-switch.paused { color: var(--warn); background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.4); }
.badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 6px;
  background: var(--warn); color: #1a1300; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; vertical-align: middle;
}
.badge:empty { display: none; }

/* Main + view */
main { flex: 1; }

/* Section heads */
.section-head { margin: 8px 0 18px; }
.section-eyebrow { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--brand); text-transform: uppercase; margin-bottom: 6px; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.02em; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -0.01em; font-weight: 600; }
h3 { font-size: 14.5px; margin: 0 0 8px; font-weight: 600; }
.muted { color: var(--text-mute); font-size: 12.5px; }

/* Cards / grids */
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-9 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 800px) { .grid.cols-9 { grid-template-columns: repeat(9, 1fr); } }
@media (max-width: 760px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: border-color .15s; }
.card:hover { border-color: var(--brand-edge); }

.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.stat .num .unit { color: var(--brand); font-size: 0.55em; font-weight: 700; margin-left: 4px; }
.stat .label { margin-top: 6px; font-size: 11.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .06em; }
.stat .detail { margin-top: 10px; font-size: 11px; color: var(--text-mute); border-top: 1px solid var(--line); padding-top: 8px; display: flex; justify-content: space-between; }

/* Agent compact card */
.agent-card { padding: 14px; }
.agent-card .head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.agent-card .icon { width: 28px; height: 28px; border-radius: 7px; background: var(--brand-soft); border: 1px solid var(--brand-edge); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 11px; font-family: ui-monospace, monospace; }
.agent-card .name { font-weight: 600; font-size: 13.5px; }
.agent-card .last { color: var(--text-mute); font-size: 11.5px; font-family: ui-monospace, monospace; }
.agent-card .stats-line { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }
.agent-card .pill { padding: 2px 8px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); font-family: ui-monospace, monospace; }
.agent-card .pill.warn { color: var(--warn); border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.06); }
.agent-card .pill.brand { color: var(--brand); border-color: var(--brand-edge); background: var(--brand-soft); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; padding: 10px 12px; color: var(--text-mute); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: var(--surface-2); }
.cell-truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); font-family: ui-monospace, monospace; font-size: 11px; }
.tag.brand { color: var(--brand); border-color: var(--brand-edge); background: var(--brand-soft); }
.tag.warn { color: var(--warn); border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.06); }
.tag.danger { color: var(--danger); border-color: rgba(249,113,113,0.3); background: rgba(249,113,113,0.06); }
.tag.info { color: var(--info); border-color: rgba(96,165,250,0.3); background: rgba(96,165,250,0.06); }

/* Login */
.login-wrap { max-width: 420px; margin: 80px auto; }
.login-wrap .card { padding: 28px; }
.login-wrap input { width: 100%; padding: 11px 14px; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); font-family: inherit; font-size: 14px; margin: 12px 0; }
.login-wrap input:focus { outline: none; border-color: var(--brand); }
.login-wrap .btn { width: 100%; padding: 12px; }
.login-msg { margin-top: 14px; padding: 11px 14px; border-radius: 10px; font-size: 12.5px; }
.login-msg.success { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-edge); }
.login-msg.error { background: rgba(249,113,113,0.06); color: var(--danger); border: 1px solid rgba(249,113,113,0.3); }
.login-wrap .hint { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-mute); }

/* HITL */
.hitl-item { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); margin-bottom: 8px; }
.hitl-item .meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--text-mute); margin-bottom: 6px; }
.hitl-item .hook { font-size: 13.5px; color: var(--text); }
.hitl-item.priority-urgent { border-color: var(--danger); background: rgba(249,113,113,0.04); }
.hitl-item.priority-high { border-color: rgba(251,191,36,0.4); }
.hitl-actions { display: flex; gap: 6px; align-items: flex-start; }

/* Code blocks */
pre { margin: 0; padding: 14px 16px; background: var(--code); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow-x: auto; font-size: 12px; line-height: 1.6; color: #cfe9da; font-family: ui-monospace, monospace; }
.mono { font-family: ui-monospace, monospace; }

/* Footer */
.foot { margin-top: 32px; padding: 18px 0; border-top: 1px solid var(--line); color: var(--text-mute); font-size: 11.5px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-dim); }

/* Charts container */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.chart-card canvas { max-height: 320px; }

/* Variant detail */
.variant-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 10px; }
.variant-block .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.variant-block .body { font-size: 13.5px; line-height: 1.6; color: var(--text-dim); white-space: pre-wrap; }

/* Misc */
.empty { padding: 40px; text-align: center; color: var(--text-mute); font-size: 13px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.6s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
