:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --brand: #6366f1;
  --brand-2: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.right { text-align: right; }

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; color: var(--text); font-size: 1.05rem; }
.topbar nav { display: flex; align-items: center; gap: 1.25rem; }
main { max-width: 980px; margin: 0 auto; padding: 1.5rem; }
h1 { font-size: 1.5rem; margin: 0.5rem 0 0.25rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; color: var(--muted); }

.row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

/* Cards */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin: 1rem 0;
}
.inline-form { margin-top: 1.5rem; }

/* Forms */
label { display: block; margin: 0.6rem 0; font-size: 0.85rem; color: var(--muted); }
input, textarea, select {
  display: block; width: 100%; margin-top: 0.3rem; padding: 0.55rem 0.7rem;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 0.9rem;
}
textarea { resize: vertical; }
button {
  padding: 0.55rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer;
}
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.danger { background: transparent; border-color: var(--red); color: var(--red); }
button.link { background: none; border: none; color: var(--brand-2); padding: 0; cursor: pointer; }
button:hover { filter: brightness(1.08); }
.inline { display: inline; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }

/* Pills, tags, badges */
.pill {
  display: inline-block; margin: 0.15rem 0.3rem 0.15rem 0; padding: 0.25rem 0.55rem;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; font-size: 0.8rem;
}
.tag {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.72rem;
  font-weight: 600; text-transform: capitalize;
}
.tag.supervised { background: rgba(251,191,36,0.15); color: var(--amber); }
.tag.autonomous { background: rgba(52,211,153,0.15); color: var(--green); }
.tag.paused { background: rgba(248,113,113,0.15); color: var(--red); }
.badge {
  display: inline-block; min-width: 1.2rem; padding: 0 0.35rem; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center;
}
.actor { font-size: 0.78rem; font-weight: 600; }
.actor.worker { color: var(--brand-2); }
.actor.guardrail { color: var(--amber); }
.actor.human { color: var(--green); }
.actor.system { color: var(--muted); }

/* Results / handoffs */
.result { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
blockquote {
  margin: 0.4rem 0; padding: 0.7rem 1rem; background: var(--panel-2);
  border-left: 3px solid var(--brand); border-radius: 0 8px 8px 0; white-space: pre-wrap;
}
pre {
  background: var(--panel-2); padding: 0.7rem; border-radius: 8px; overflow-x: auto;
  font-size: 0.8rem; border: 1px solid var(--border);
}
.handoff .reason {
  margin-left: 0.5rem; padding: 0.1rem 0.45rem; background: var(--panel-2);
  border-radius: 6px; font-size: 0.72rem; color: var(--muted);
}
.handoff .resolve { margin-top: 0.75rem; align-items: center; }
.handoff .resolve input { flex: 1; margin: 0; }
.filters, .filter { display: inline-block; }
.filter { margin-left: 0.5rem; padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.82rem; color: var(--muted); }
.filter.active { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.stat { color: var(--muted); }

/* Login */
body.centered { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login { width: 320px; text-align: center; }
.login h1 { margin-bottom: 0; }
.login label { text-align: left; }
.login button { width: 100%; margin-top: 0.5rem; }
.error { color: var(--red); font-size: 0.85rem; }
