:root{
  --bg:#0d1117; --surface:#161b22; --surface2:#1c2330; --border:#30363d;
  --text:#c9d1d9; --muted:#8b949e; --accent:#58a6ff;
  --good:#3fb950; --warn:#d29922; --bad:#f85149; --acc:#bc8cff;
  --radius:10px; --mono:"SFMono-Regular",Consolas,"Liberation Mono",monospace;
}
[data-theme="light"]{
  --bg:#f6f8fa; --surface:#ffffff; --surface2:#f0f3f6; --border:#d0d7de;
  --text:#1f2328; --muted:#656d76; --accent:#0969da;
  --good:#1a7f37; --warn:#9a6700; --bad:#cf222e; --acc:#8250df;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--text);
  font:14px/1.5 "Inter","Segoe UI",system-ui,sans-serif;
  display:flex; flex-direction:column; min-height:100vh;
}
.muted{color:var(--muted)} .small{font-size:12px} .hidden{display:none!important}
a{color:var(--accent); text-decoration:none} a:hover{text-decoration:underline}
code{font-family:var(--mono); background:var(--surface2); padding:1px 5px; border-radius:5px; font-size:.9em}

/* header */
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:10px 16px; background:var(--surface); border-bottom:1px solid var(--border);
  position:sticky; top:0; z-index:5;
}
.brand{font-weight:700; font-size:16px; letter-spacing:.2px}
.brand .logo{color:var(--accent); margin-right:4px}
.brand .sub{font-weight:400; font-size:12px}
@media(max-width:760px){.brand .sub{display:none}}
.controls{display:flex; align-items:center; gap:8px}
.ctl{font-size:12px; color:var(--muted); display:flex; align-items:center; gap:6px}
.ctl select,.modelin{
  background:var(--surface2); color:var(--text); border:1px solid var(--border);
  border-radius:8px; padding:5px 8px; font:inherit; font-size:13px;
}
.modelin{width:150px}
@media(max-width:760px){.modelin{display:none}}
.iconbtn{
  background:var(--surface2); color:var(--text); border:1px solid var(--border);
  border-radius:8px; padding:5px 9px; cursor:pointer; font-size:13px;
}
.iconbtn:hover{border-color:var(--accent)}

/* layout */
.layout{flex:1; display:grid; grid-template-columns:clamp(300px,26%,400px) minmax(0,1fr); min-height:0}
@media(max-width:860px){.layout{grid-template-columns:1fr}}
.sidebar{
  border-right:1px solid var(--border); padding:16px; overflow:auto; background:var(--surface);
}
.sidebar h2{font-size:13px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted); margin:18px 0 6px}
.sidebar h2:first-child{margin-top:0}
.examples{display:flex; flex-direction:column; gap:7px}
.exbtn{
  text-align:left; background:var(--surface2); border:1px solid var(--border); color:var(--text);
  border-radius:9px; padding:9px 11px; cursor:pointer; font:inherit; font-size:13px; line-height:1.35;
}
.exbtn:hover{border-color:var(--accent)}
.exbtn .sk{font-family:var(--mono); font-size:11px; color:var(--accent)}
.exbtn .ex{float:right; font-size:11px; color:var(--muted)}
.fld{display:block; font-size:12px; color:var(--muted); margin:6px 0}
.fld select{width:100%; margin-top:4px; background:var(--surface2); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:6px}
.custom{
  width:100%; min-height:90px; margin-top:6px; resize:vertical; background:var(--surface2);
  color:var(--text); border:1px solid var(--border); border-radius:8px; padding:9px; font:13px/1.45 var(--mono);
}
.run{
  width:100%; margin-top:10px; background:var(--accent); color:#fff; border:0; border-radius:9px;
  padding:10px; font:inherit; font-weight:600; cursor:pointer;
}
.run:hover{filter:brightness(1.08)} .run:disabled{opacity:.55; cursor:default}
.status{margin-top:8px; font-size:12px; color:var(--muted); min-height:16px}

/* stage */
.stage{overflow:auto; padding:22px 26px}
.empty{max-width:640px; margin:8vh auto 0; text-align:center}
.empty h1{font-size:26px; margin:0 0 10px}
.result h3{font-size:13px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted); margin:22px 0 8px}
.reshead{display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.badge{font-weight:700; font-size:13px; padding:4px 12px; border-radius:999px; border:1px solid var(--border)}
.badge.accepted{color:var(--good); border-color:var(--good); background:color-mix(in srgb,var(--good) 12%,transparent)}
.badge.escalate{color:var(--warn); border-color:var(--warn); background:color-mix(in srgb,var(--warn) 12%,transparent)}

/* timeline */
.timeline{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px}
.step{
  display:flex; gap:12px; align-items:flex-start; background:var(--surface); border:1px solid var(--border);
  border-radius:9px; padding:9px 12px; opacity:0; transform:translateY(4px); animation:rise .28s ease forwards;
}
@keyframes rise{to{opacity:1; transform:none}}
.step .node{font-family:var(--mono); font-size:12px; font-weight:700; min-width:78px; color:var(--accent)}
.step.critic .node{color:var(--acc)} .step.decide .node{color:var(--good)}
.step .detail{flex:1; min-width:0}
.step .detail .ln{font-size:13px}
.step .mdl{font-size:11px; color:var(--muted); font-family:var(--mono)}

/* findings */
.findings{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:7px}
.finding{background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--bad); border-radius:9px; padding:9px 12px}
.finding.MAJOR{border-left-color:var(--warn)} .finding.MINOR,.finding.NIT{border-left-color:var(--muted)}
.chip{font-size:10.5px; font-weight:700; padding:2px 7px; border-radius:999px; text-transform:uppercase; letter-spacing:.4px}
.chip.BLOCKER{color:var(--bad); border:1px solid var(--bad)} .chip.MAJOR{color:var(--warn); border:1px solid var(--warn)}
.chip.MINOR,.chip.NIT{color:var(--muted); border:1px solid var(--muted)}
.finding .cat{font-family:var(--mono); font-size:11px; color:var(--muted); margin-left:6px}
.finding .msg{margin:5px 0 0; font-size:13px}
.finding .ev{margin-top:4px; font-size:12px; color:var(--muted); font-family:var(--mono)}

/* artifacts */
#artifacts pre{
  background:var(--surface); border:1px solid var(--border); border-radius:9px; padding:12px;
  overflow:auto; font:12.5px/1.5 var(--mono); white-space:pre-wrap; word-break:break-word; margin:0 0 10px;
}
#artifacts .aname{font-family:var(--mono); font-size:12px; color:var(--accent); margin:0 0 4px}

/* footer */
.foot{
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
  padding:9px 16px; border-top:1px solid var(--border); background:var(--surface); font-size:12px;
}
.foot .mid{flex:1; text-align:center}
@media(max-width:760px){.foot .mid{display:none}}

/* modal */
.modal{position:fixed; inset:0; background:rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center; z-index:20; padding:20px}
.modalcard{background:var(--surface); border:1px solid var(--border); border-radius:14px; max-width:680px; width:100%; max-height:85vh; overflow:auto; padding:22px 24px; position:relative}
.modalcard h2{margin:0 0 12px} .modalcard ul{padding-left:18px} .modalcard li{margin:6px 0}
.modalclose{position:absolute; top:12px; right:12px}

/* GitHub / inputs */
.ghin{width:100%; margin-top:6px; background:var(--surface2); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:8px; font:12.5px var(--mono)}
.ghrow{display:flex; gap:6px; margin-top:6px}
.ghnum{flex:1; min-width:0; background:var(--surface2); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:8px; font:12.5px var(--mono)}
.ghsel{flex:1; min-width:0; background:var(--surface2); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:8px}
