:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c2230; --line: #2a313c;
  --ink: #e6edf3; --muted: #8b97a7; --accent: #2dd4bf; --accent2: #38bdf8;
  --ok: #34d399; --bad: #f87171; --warn: #fbbf24;
  --radius: 10px; font-synthesis: none;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono, pre { font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
     margin: 28px 0 12px; }

/* layout */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; }
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
.brand .logo { font-size: 26px; color: var(--accent); }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.brand.center { flex-direction: column; text-align: center; gap: 6px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { color: var(--muted); padding: 9px 12px; border-radius: 8px; }
nav a:hover { background: var(--panel2); color: var(--ink); text-decoration: none; }
nav a.on { background: var(--panel2); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.sidefoot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.content { display: flex; flex-direction: column; min-width: 0; }
.topbar { padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--panel); }
.page { padding: 24px 28px; max-width: 1000px; }
.lead { color: var(--muted); max-width: 70ch; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; }
.card-h { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.card .big { font-size: 22px; font-weight: 600; margin: 6px 0; }
.card small { color: var(--muted); display: block; word-break: break-all; }
.card.status { border-left: 3px solid var(--line); }
.card.status.ok { border-left-color: var(--ok); } .card.status.ok .big { color: var(--ok); }
.card.status.bad { border-left-color: var(--bad); } .card.status.bad .big { color: var(--bad); }
.card.status.warn { border-left-color: var(--warn); } .card.status.warn .big { color: var(--warn); }

/* tables */
table.grid { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th, table.grid td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.grid th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.grid tr:last-child td { border-bottom: none; }
table.grid .r { text-align: right; }
table.grid.small td { padding: 5px 14px; font-size: 13px; }
.muted { color: var(--muted); }
.err { color: var(--bad); }

/* forms */
.form, .filerow, .optsrow { margin: 14px 0; }
.filerow { display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 12px; }
.filerow label { color: var(--muted); }
.filerow small { grid-column: 2; color: var(--muted); font-size: 11px; }
.optsrow { display: flex; gap: 18px; flex-wrap: wrap; }
label { display: block; }
input, select, textarea, button { font: inherit; }
input[type=text], input:not([type]), input[type=password], select, textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  padding: 8px 10px; border-radius: 8px; }
textarea { resize: vertical; }
.req { color: var(--bad); } .opt { color: var(--muted); font-size: 11px; }
button, .btn { background: var(--accent); color: #06241f; border: none; padding: 9px 18px;
  border-radius: 8px; font-weight: 600; cursor: pointer; display: inline-block; }
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.actions { display: flex; gap: 10px; margin-top: 18px; }

/* progress / log */
.hidden { display: none; }
.phase { color: var(--accent); font-weight: 600; margin: 8px 0; }
#bars .bar { margin: 6px 0; }
#bars .bar .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
#bars .bar .track { height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
#bars .bar .fill { height: 100%; background: var(--accent); width: 0; transition: width .15s; }
.log { background: #0a0d12; border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  max-height: 280px; overflow: auto; white-space: pre-wrap; font-size: 12px; color: var(--muted); }

/* flashes */
.flash { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--accent2);
  padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.flash.warn { border-left-color: var(--warn); }
.flash.err { border-left-color: var(--bad); color: var(--bad); }

/* incidents */
.incident { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 14px 0; }
.incident-h { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.badge { background: var(--accent); color: #06241f; padding: 3px 10px; border-radius: 6px;
  font-weight: 700; font-family: monospace; }
.incident-h .by { color: var(--muted); } .incident-h .win { color: var(--muted); margin-left: auto; font-size: 12px; }
.rootcause { margin: 12px 0; }
.targets { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.targets span em { color: var(--muted); font-style: normal; margin-right: 6px; text-transform: uppercase; font-size: 11px; }

/* checks */
.check { display: flex; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); align-items: baseline; }
.check .mk { font-weight: 700; } .check.pass .mk { color: var(--ok); } .check.fail .mk { color: var(--bad); }
.check .nm { font-family: monospace; min-width: 220px; }

/* misc */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.copyrow { display: flex; gap: 10px; align-items: center; }
.copyrow code { flex: 1; padding: 8px 12px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 30px; width: 320px; display: flex; flex-direction: column; gap: 14px; }
.login-card button { margin-top: 6px; }
.score { font-size: 26px; font-weight: 700; color: var(--accent); }
.inf { font-weight: 600; cursor: help; }
.inf-concludable { color: var(--ok); } .inf-partial { color: var(--warn); } .inf-speculative { color: var(--bad); }
.followups { margin: 8px 0 0; padding-left: 18px; } .followups li { margin: 8px 0; }
.fq-copy { background: var(--panel2); color: var(--accent); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 7px; font-size: 13px; cursor: pointer; margin-left: 8px;
  font-weight: 700; vertical-align: middle; }
.fq-copy:hover { filter: brightness(1.2); }

/* incident trigger hooks */
.hooks { margin: 12px 0 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.hooks-h { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink);
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hooks-h .muted { text-transform: none; letter-spacing: 0; font-size: 11px; }
.btn.sm { padding: 3px 10px; font-size: 12px; margin-left: auto; }
.hook { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; margin: 6px 0; }
.hook-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent);
  font-weight: 700; margin-bottom: 3px; }
.hook-text { font-size: 13px; color: var(--ink); white-space: pre-wrap; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } .split { grid-template-columns: 1fr; } }
