:root{
  --bg0:#0b1220;
  --bg1:#0e1728;
  --panel:#111c2f;
  --panel2:#0f1a2b;
  --stroke:rgba(255,255,255,.08);
  --stroke2:rgba(255,255,255,.12);
  --text:#d9e2f2;
  --muted:rgba(217,226,242,.65);
  --muted2:rgba(217,226,242,.45);
  --blue:#2b6cff;
  --blue2:#3b82f6;
  --ok:#22c55e;
  --amber:#f59e0b;
  --warn:#fbbf24;
  --risk:#ef4444;
  --pill:#1f2a44;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --r12:12px;
  --r16:16px;
  --r20:20px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--sans);
  background: radial-gradient(1100px 700px at 35% 0%, rgba(59,130,246,.12), transparent 60%),
              radial-gradient(900px 500px at 80% 25%, rgba(245,158,11,.07), transparent 55%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
  color:var(--text);
}

/* Top bar */
.topbar{
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  border-bottom:1px solid var(--stroke);
  background:linear-gradient(180deg, rgba(17,28,47,.88), rgba(13,20,34,.72));
  backdrop-filter: blur(10px);
  position:sticky;
  top:0;
  z-index:10;
}

.brand{display:flex; gap:12px; align-items:center;}
.logoMark{
  width:34px;height:34px;border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(180deg, rgba(43,108,255,.22), rgba(43,108,255,.05));
  border:1px solid rgba(43,108,255,.25);
  color:#a9c4ff;
}
.brandTitle{font-weight:700; letter-spacing:.2px;}
.brandSub{font-size:12px;color:var(--muted); margin-top:2px;}

.topActions{display:flex; gap:10px; align-items:center;}
.iconBtn{
  height:38px; width:38px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:rgba(17,28,47,.55);
  color:var(--text);
  cursor:pointer;
}
.iconBtn:hover{border-color:var(--stroke2); background:rgba(17,28,47,.75);}

.viewToggle{
  display:flex;
  background:rgba(17,28,47,.55);
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:4px;
  gap:4px;
}
.segBtn{
  border:0;
  background:transparent;
  color:var(--muted);
  padding:8px 12px;
  border-radius:10px;
  cursor:pointer;
  font-weight:600;
}
.segBtn.active{
  background:linear-gradient(180deg, rgba(43,108,255,.35), rgba(43,108,255,.12));
  border:1px solid rgba(43,108,255,.35);
  color:var(--text);
}

/* Shell */
.shell{
  display:grid;
  grid-template-columns: 270px 1fr;
  min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar{
  border-right:1px solid var(--stroke);
  padding:14px 12px;
  background:linear-gradient(180deg, rgba(17,28,47,.65), rgba(15,26,43,.50));
}

.searchBox{
  display:flex; align-items:center; gap:10px;
  background:rgba(8,12,20,.35);
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:10px 12px;
}
.searchIcon{color:var(--muted2); font-weight:700;}
.searchBox input{
  width:100%;
  background:transparent;
  border:0;
  outline:none;
  color:var(--text);
}

.nav{margin-top:14px; display:flex; flex-direction:column; gap:8px;}
.navItem{
  display:flex; align-items:center; gap:10px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  padding:10px 10px;
  border-radius:14px;
  cursor:pointer;
  text-align:left;
}
.navItem:hover{background:rgba(255,255,255,.04); color:var(--text);}
.navItem.active{
  background:linear-gradient(180deg, rgba(43,108,255,.22), rgba(43,108,255,.06));
  border:1px solid rgba(43,108,255,.25);
  color:var(--text);
}
.navDot{width:10px;height:10px;border-radius:50%;}
.dotAll{background:rgba(59,130,246,.85);}
.dotWarn{background:rgba(251,191,36,.9);}
.dotAmber{background:rgba(245,158,11,.9);}
.dotRisk{background:rgba(239,68,68,.9);}
.dotGood{background:rgba(34,197,94,.9);}
.navCount{
  margin-left:auto;
  font-size:12px;
  color:var(--muted);
  background:rgba(255,255,255,.06);
  border:1px solid var(--stroke);
  padding:2px 8px;
  border-radius:999px;
}

.sidebarBottom{
  margin-top:16px;
  padding-top:12px;
  border-top:1px solid var(--stroke);
  display:flex;
  flex-direction:column;
  gap:10px;
}
.ghostBtn{
  border:1px solid var(--stroke);
  background:rgba(17,28,47,.45);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  text-align:left;
}
.ghostBtn:hover{border-color:var(--stroke2); background:rgba(17,28,47,.65);}
.footerTag{font-size:11px; color:var(--muted2);}

/* Content */
.content{
  padding:16px;
}
.hidden{display:none;}

.listHeader{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:12px;
}
.chipRow{display:flex; gap:8px; flex-wrap:wrap;}
.chip{
  border:1px solid var(--stroke);
  background:rgba(17,28,47,.40);
  color:var(--muted);
  padding:8px 10px;
  border-radius:999px;
  cursor:pointer;
  font-weight:600;
  font-size:13px;
}
.chip.active{
  color:var(--text);
  border-color:rgba(43,108,255,.35);
  background:rgba(43,108,255,.18);
}
.primaryBtn{
  border:1px solid rgba(43,108,255,.35);
  background:linear-gradient(180deg, rgba(43,108,255,.40), rgba(43,108,255,.16));
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  font-weight:700;
}

.listAndDetail{
  display:grid;
  grid-template-columns: 520px 1fr;
  gap:14px;
  align-items:start;
}

/* Load list pane */
.loadListPane{
  border-radius:var(--r20);
  border:1px solid var(--stroke);
  background:rgba(17,28,47,.42);
  overflow:hidden;
  box-shadow: var(--shadow);
}

.loadList{
  max-height: calc(100vh - 160px);
  overflow:auto;
}

.loadRow{
  padding:14px 14px;
  border-bottom:1px solid var(--stroke);
  display:flex;
  gap:12px;
  cursor:pointer;
  background:transparent;
}
.loadRow:hover{background:rgba(255,255,255,.04);}
.loadRow.selected{
  background:linear-gradient(180deg, rgba(43,108,255,.22), rgba(43,108,255,.08));
  outline:1px solid rgba(43,108,255,.30);
}

.rowLeft{flex:1; min-width:0;}
.rowTop{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
}
.rowTitle{
  font-weight:800;
  letter-spacing:.2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.rowLane{font-size:13px;color:var(--muted); margin-top:6px;}
.rowMeta{font-size:12px;color:var(--muted2); margin-top:6px; display:flex; gap:10px; flex-wrap:wrap;}
.kv{display:inline-flex; gap:6px; align-items:center;}
.k{color:var(--muted2);}
.v{color:var(--muted); font-family:var(--mono); font-size:12px;}

.rowRight{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:10px;
}
.pill{
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.4px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.05);
  color:var(--text);
}
.pill.pending{border-color:rgba(245,158,11,.35); background:rgba(245,158,11,.12);}
.pill.ready{border-color:rgba(251,191,36,.35); background:rgba(251,191,36,.10);}
.pill.compliant{border-color:rgba(34,197,94,.35); background:rgba(34,197,94,.10);}
.pill.blocked{border-color:rgba(239,68,68,.35); background:rgba(239,68,68,.10);}

.miniBars{display:flex; gap:4px;}
.bar{width:16px;height:8px;border-radius:4px;border:1px solid var(--stroke); background:rgba(255,255,255,.05);}
.bar.on{background:rgba(43,108,255,.35); border-color:rgba(43,108,255,.35);}

/* Detail panel */
.detailPane{
  border-radius:var(--r20);
  border:1px solid var(--stroke);
  background:rgba(17,28,47,.42);
  overflow:hidden;
  box-shadow: var(--shadow);
}
.detailPanel{
  max-height: calc(100vh - 160px);
  overflow:auto;
}

.detailHeader{
  padding:16px;
  border-bottom:1px solid var(--stroke);
  background:linear-gradient(180deg, rgba(255,255,255,.03), transparent);
}
.detailTitleRow{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}
.detailTitle{
  font-size:24px;
  font-weight:900;
  letter-spacing:.3px;
}
.detailLane{
  margin-top:10px;
  font-size:18px;
  font-weight:800;
}
.detailSub{
  margin-top:6px;
  color:var(--muted);
  display:flex; gap:10px; flex-wrap:wrap;
}
.detailSub .mono{font-family:var(--mono); font-size:12px; color:var(--muted);}

.section{
  padding:14px 16px;
  border-bottom:1px solid var(--stroke);
}
.sectionTitle{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  font-weight:900;
  letter-spacing:.2px;
  margin-bottom:10px;
}
.smallActions{display:flex; gap:8px; align-items:center;}
.smallBtn{
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.05);
  color:var(--text);
  padding:8px 10px;
  border-radius:12px;
  cursor:pointer;
  font-weight:700;
  font-size:12px;
}
.smallBtn:hover{border-color:var(--stroke2);}

.kvGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}
.card{
  border:1px solid var(--stroke);
  background:rgba(8,12,20,.25);
  border-radius:14px;
  padding:10px 12px;
}
.cardLabel{font-size:11px; color:var(--muted2); text-transform:uppercase; letter-spacing:.8px;}
.cardValue{margin-top:6px; font-weight:800;}
.cardValue.mono{font-family:var(--mono); font-size:12px; color:var(--muted); font-weight:700;}

.checklist{
  display:flex; flex-direction:column; gap:10px;
}
.checkRow{
  display:flex; align-items:center; gap:10px;
  padding:10px 10px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:rgba(8,12,20,.20);
}
.checkRow:hover{border-color:var(--stroke2);}
.checkBox{
  width:18px;height:18px;border-radius:6px;
  border:1px solid var(--stroke2);
  background:rgba(255,255,255,.05);
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer;
  flex:0 0 auto;
}
.checkBox.on{
  border-color:rgba(34,197,94,.45);
  background:rgba(34,197,94,.16);
}
.checkMain{flex:1; min-width:0;}
.checkName{font-weight:800;}
.checkMeta{margin-top:4px; font-size:12px; color:var(--muted2);}

.thread{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.msg{
  display:flex;
  gap:10px;
  padding:12px;
  border:1px solid var(--stroke);
  border-radius:16px;
  background:rgba(8,12,20,.20);
}
.avatar{
  width:34px;height:34px;border-radius:12px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
  display:flex; align-items:center; justify-content:center;
  color:var(--muted);
  font-weight:900;
}
.msgBody{flex:1; min-width:0;}
.msgTop{display:flex; justify-content:space-between; gap:10px; align-items:center;}
.msgFrom{font-weight:900;}
.msgTime{font-size:12px;color:var(--muted2); font-family:var(--mono);}
.msgText{margin-top:6px;color:var(--muted); line-height:1.25;}

.replyBar{
  margin-top:10px;
  display:flex;
  gap:10px;
  align-items:center;
  border:1px solid var(--stroke);
  border-radius:16px;
  padding:10px;
  background:rgba(8,12,20,.22);
}
.replyBar input{
  flex:1;
  background:transparent;
  border:0;
  outline:none;
  color:var(--text);
}
.sendBtn{
  width:44px;height:38px;border-radius:14px;
  border:1px solid rgba(43,108,255,.35);
  background:rgba(43,108,255,.18);
  cursor:pointer;
  color:var(--text);
  font-weight:900;
}
.sendBtn:hover{background:rgba(43,108,255,.26);}

/* Deck view */
.deckHeader{
  display:flex; justify-content:space-between; align-items:flex-end;
  margin-bottom:12px;
}
.deckTitle{font-size:18px;font-weight:900;}
.deckHint{font-size:12px;color:var(--muted2); margin-top:4px;}
.deckScroller{
  border:1px solid var(--stroke);
  border-radius:var(--r20);
  background:rgba(17,28,47,.38);
  box-shadow: var(--shadow);
  overflow:auto;
  padding:12px;
  display:flex;
  gap:12px;
  max-height: calc(100vh - 160px);
}
.column{
  flex:0 0 340px;
  border:1px solid var(--stroke);
  border-radius:18px;
  background:rgba(8,12,20,.20);
  overflow:hidden;
}
.colHeader{
  padding:12px;
  border-bottom:1px solid var(--stroke);
  background:linear-gradient(180deg, rgba(255,255,255,.03), transparent);
}
.colHeaderTop{
  display:flex; justify-content:space-between; align-items:flex-start; gap:10px;
}
.colTitle{font-weight:900;}
.colLane{margin-top:8px;font-weight:800;}
.colMeta{margin-top:6px;color:var(--muted2); font-size:12px; display:flex; gap:8px; flex-wrap:wrap;}
.colBody{padding:12px; display:flex; flex-direction:column; gap:10px;}
.miniSectionTitle{font-weight:900; color:var(--muted); font-size:12px; letter-spacing:.6px; text-transform:uppercase;}

.inlineRow{
  display:flex; justify-content:space-between; gap:10px; align-items:center;
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:10px 10px;
  background:rgba(255,255,255,.03);
}
.inlineRow .left{min-width:0;}
.inlineRow .right{color:var(--muted2); font-family:var(--mono); font-size:12px;}
.inlineRow .big{font-weight:900;}
.inlineRow .sub{margin-top:4px;color:var(--muted2); font-size:12px;}

/* Toast */
.toast{
  position:fixed;
  bottom:18px;
  left:50%;
  transform:translateX(-50%);
  background:rgba(8,12,20,.88);
  border:1px solid var(--stroke);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  box-shadow: var(--shadow);
  z-index:999;
  max-width: 92vw;
}
