
:root{
  --bg: #0b0c0f;
  --fg: #e9ecf1;
  --panel: #11131a;
  --card: #151826;
  --border: #2b2f3c;
  --muted: #9aa2b2;
  --accent: #6ea8fe;
}

[data-theme="light"]{
  --bg: #f7f8fb;
  --fg: #11131a;
  --panel: #ffffff;
  --card: #ffffff;
  --border: #e6e8ee;
  --muted: #6b7280;
  --accent: #2563eb;
}
tr.needs-writeoff {
  background: var(--err-bg); 
}
tr.needs-writeoff td { 
  color: var(--err-fg); 
}

*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--fg);font:14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial}

.layout{display:grid;grid-template-columns:260px 1fr;min-height:100vh}
.sidebar{position:sticky;top:0;height:100vh;border-right:1px solid var(--border);padding:18px;background:var(--panel);display:flex;flex-direction:column;gap:12px}
.brand{font-weight:800;margin-bottom:4px}
.nav{display:flex;flex-direction:column;gap:8px}
.nav-item{display:block;padding:10px 12px;border-radius:12px;border:1px solid var(--border);color:var(--fg);text-decoration:none;background:var(--card)}
.nav-item:hover{filter:brightness(0.98)}

.theme-switch{margin-top:auto;display:flex;align-items:center;gap:10px;color:var(--muted)}
.switch{position:relative;display:inline-block;width:42px;height:24px}
.switch input{opacity:0;width:0;height:0}
.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#9aa2b2;border-radius:20px;transition:.2s}
.slider:before{position:absolute;content:"";height:18px;width:18px;left:3px;top:3px;background:white;border-radius:50%;transition:.2s}
.switch input:checked + .slider{background:var(--accent)}
.switch input:checked + .slider:before{transform:translateX(18px)}

.content{padding:22px}
h1{margin:0 0 14px 0}

.filters{border:1px solid var(--border);background:var(--card);border-radius:14px;padding:12px;margin-bottom:14px}
.filters .row{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-bottom:8px}
label{font-weight:600}
label.chk{display:flex;align-items:center;gap:8px}
input[type="text"],input[type="date"],input[type="time"],select{
  background:var(--panel);border:1px solid var(--border);color:var(--fg);
  padding:8px 10px;border-radius:10px;outline:none
}
.btn{
  border:1px solid var(--border);background:var(--panel);color:var(--fg);
  padding:8px 12px;border-radius:12px;cursor:pointer
}
.btn:hover{filter:brightness(1.05)}

.muted{color:var(--muted)}

.kpi{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:12px 0}
.kpi-item{border:1px solid var(--border);background:var(--card);border-radius:14px;padding:12px}
.kpi-label{color:var(--muted);font-weight:600}
.kpi-value{font-size:22px;font-weight:800}
.kpi-sub{color:var(--muted);margin-top:4px}

.shell{border:1px solid var(--border);background:var(--card);border-radius:14px;padding:12px;margin-top:12px}

.table{width:100%;border-collapse:collapse}
.table thead th{font-weight:700;text-align:left;border-bottom:1px solid var(--border);padding:8px 6px}
.table td{padding:8px 6px;border-bottom:1px solid var(--border)}

.pillbox{display:flex;flex-wrap:wrap;gap:8px}
.pill{border:1px solid var(--border);background:var(--panel);padding:6px 10px;border-radius:999px}

.ids-summary{display:flex;gap:8px;align-items:center;margin:4px 0 10px;color:var(--fg)}
.ids-summary b{font-weight:800}

.ids-actions{display:flex;gap:8px;justify-content:flex-end;margin-bottom:8px}
.ids-groups details{border:1px solid var(--border); border-radius:10px; background:var(--card); margin-bottom:8px; padding:8px 12px}
.ids-groups summary{cursor:pointer; font-weight:600; color:var(--fg)}
.ids-groups pre{margin:8px 0 0 0}

@media (max-width: 920px){
  .layout{grid-template-columns:1fr}
  .sidebar{position:static;height:auto}
}
