:root{
  --bg:#EEF1F4; --surface:#FFFFFF; --border:#D7DCE2;
  --ink:#12181F; --muted:#5B6672; --muted2:#9AA3AF;
  --teal:#1B6B63; --teal-bg:#E4F1EF;
  --amber:#B5790A; --amber-bg:#FBF1DE;
  --coral:#B0392A; --coral-bg:#FBE9E6;
  --slate:#5B6672; --slate-bg:#ECEFF2;
}
*{box-sizing:border-box;}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:'IBM Plex Sans',sans-serif; font-size:15px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
.mono{font-family:'IBM Plex Mono',monospace;}
.hidden{display:none !important;}

header{
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 32px; border-bottom:1px solid var(--border); background:var(--surface);
}
.brand{display:flex; align-items:baseline; gap:10px;}
.brand .mark{font-weight:600; font-size:16px;}
.brand .sub{color:var(--muted); font-size:13px;}
.tabs{display:flex; gap:4px;}
.tab{padding:8px 14px; border-radius:6px; font-size:13px; color:var(--muted); cursor:pointer; user-select:none;}
.tab:hover{color:var(--ink);}
.tab.active{background:var(--ink); color:#fff;}

.context-strip{
  padding:10px 32px; font-size:13px; color:var(--muted);
  border-bottom:1px solid var(--border); background:var(--surface);
  display:flex; gap:28px; flex-wrap:wrap;
}
.context-strip b{color:var(--ink); font-weight:600;}

main{max-width:1080px; margin:0 auto; padding:28px 32px 60px;}

.queue-toolbar{margin-bottom:16px;}
.filter-group{display:flex; gap:8px; flex-wrap:wrap;}
.filter-chip{
  padding:6px 14px; border-radius:20px; font-size:13px; font-weight:500;
  border:1px solid var(--border); background:var(--surface); cursor:pointer; color:var(--muted);
}
.filter-chip.active{border-color:transparent; color:#fff;}
.filter-chip[data-action="all"].active{background:var(--ink);}
.filter-chip[data-action="auto_close"].active{background:var(--teal);}
.filter-chip[data-action="review"].active{background:var(--amber);}
.filter-chip[data-action="escalate"].active{background:var(--coral);}
.filter-chip[data-action="abstain"].active{background:var(--slate);}

.queue-list{display:flex; flex-direction:column; gap:8px;}
.queue-row{
  display:flex; align-items:center; justify-content:space-between;
  background:var(--surface); border:1px solid var(--border); border-radius:8px;
  padding:12px 16px; cursor:pointer;
}
.queue-row:hover{border-color:var(--muted2);}
.queue-row .id{font-size:13px; color:var(--muted); min-width:110px;}
.queue-row .cat{font-size:13px; flex:1; font-family:'IBM Plex Mono',monospace;}
.queue-row .amt{font-size:13px; font-family:'IBM Plex Mono',monospace; min-width:110px; text-align:right;}

.pill{
  display:inline-flex; align-items:center; gap:6px; padding:6px 12px;
  border-radius:20px; font-size:13px; font-weight:600; white-space:nowrap;
}
.pill.auto_close{background:var(--teal-bg); color:var(--teal);}
.pill.review{background:var(--amber-bg); color:var(--amber);}
.pill.escalate{background:var(--coral-bg); color:var(--coral);}
.pill.abstain{background:var(--slate-bg); color:var(--slate);}
.pill::before{content:''; width:6px; height:6px; border-radius:50%; background:currentColor;}

.card{background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:22px;}
.back-link{font-size:13px; color:var(--muted); cursor:pointer; margin-bottom:16px; display:inline-block;}
.back-link:hover{color:var(--ink);}

.case-head{display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:18px;}
.case-head .ids{font-size:13px; color:var(--muted);}
.case-head .customer{font-size:19px; font-weight:600; margin-top:2px;}

.ledger{display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:20px;}
.ledger .col{border:1px solid var(--border); border-radius:8px; overflow:hidden;}
.ledger .col h4{margin:0; padding:10px 14px; font-size:12px; font-weight:600; color:var(--muted); background:var(--bg); border-bottom:1px solid var(--border);}
.row{display:flex; justify-content:space-between; padding:9px 14px; font-size:13px; border-bottom:1px solid var(--border);}
.row:last-child{border-bottom:none;}
.row .k{color:var(--muted);}
.row .v{font-weight:500;}

.verdict{border-top:1px solid var(--border); padding-top:16px; margin-top:2px;}
.verdict-top{display:flex; align-items:center; gap:12px; margin-bottom:8px;}
.verdict-cat{font-size:16px; font-weight:600;}
.confidence-track{flex:1; height:6px; border-radius:3px; background:var(--bg); overflow:hidden;}
.confidence-fill{height:100%; border-radius:3px;}
.confidence-label{font-size:12px; color:var(--muted); min-width:70px; text-align:right;}
.reason{font-size:14px; color:var(--ink); line-height:1.6;}

.trace-title{font-size:14px; font-weight:600; margin:0 0 4px;}
.trace-sub{font-size:12px; color:var(--muted); margin:0 0 16px;}
.rule{display:flex; gap:10px; padding:10px 0; border-bottom:1px solid var(--border);}
.rule:last-child{border-bottom:none;}
.rule .num{font-size:11px; color:var(--muted2); min-width:16px; padding-top:2px;}
.rule .name{font-size:13px; color:var(--muted2); font-family:'IBM Plex Mono',monospace;}
.rule.fired .name{color:var(--ink); font-weight:600;}
.rule.fired{margin:0 -8px; padding:10px 8px; border-radius:6px; border-bottom:none;}
.rule.fired .note{font-size:12px; color:var(--muted); margin-top:3px; line-height:1.5;}

.bench-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:20px;}
.bench-stat{border:1px solid var(--border); border-radius:8px; padding:16px;}
.bench-stat .num{font-size:26px; font-weight:600; font-family:'IBM Plex Mono',monospace;}
.bench-stat .label{font-size:12px; color:var(--muted); margin-top:4px;}
.bench-cat-row{display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--border); font-size:13px;}
.bench-cat-row:last-child{border-bottom:none;}
.bar-track{flex:1; height:6px; background:var(--bg); border-radius:3px; margin:0 12px; overflow:hidden;}
.bar-fill{height:100%; background:var(--teal); border-radius:3px;}

@media (max-width:820px){
  #detail-view{grid-template-columns:1fr !important;}
  .ledger{grid-template-columns:1fr;}
}
