:root {
  --bg: #0f172a; --panel: #ffffff; --ink: #1e293b; --muted: #64748b;
  --line: #e2e8f0; --brand: #2563eb; --brand-2: #1d4ed8; --good: #16a34a; --warn: #d97706;
  --bad: #dc2626; --sidebar: #111827; --sidebar-ink: #cbd5e1;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; color: var(--ink);
  background: #f1f5f9; font-size: 14px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h3 { font-size: 15px; margin: 0 0 12px; }

.app-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar { width: 238px; background: var(--sidebar); color: var(--sidebar-ink);
  flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex;
  flex-direction: column; border-right: 1px solid #0b1220; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px;
  padding: 16px 18px; color: #fff; letter-spacing: .2px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center;
  font-size: 16px; line-height: 1; box-shadow: 0 4px 12px -4px var(--brand); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-sub { font-weight: 500; font-size: 10.5px; color: rgba(255,255,255,.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; flex: 1; overflow-y: auto;
  padding: 8px 10px 18px; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav-head { color: #64748b; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; padding: 14px 10px 5px; user-select: none; }
.nav-head:first-child { padding-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; color: var(--sidebar-ink);
  padding: 8px 10px; font-size: 13.5px; border-radius: 7px; margin: 1px 0; line-height: 1.2;
  transition: background .12s ease, color .12s ease; }
.nav-item:hover { background: #1f2937; text-decoration: none; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 1px 5px rgba(37,99,235,.4); }
.nav-ic { flex-shrink: 0; opacity: .82; }
.nav-item:hover .nav-ic, .nav-item.active .nav-ic { opacity: 1; }
.nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 6px;
  padding: 9px 18px; background: #fff; border-bottom: 1px solid var(--line); }
.who { color: var(--muted); }
.role-chip { background: #eef2ff; color: var(--brand); padding: 2px 8px; border-radius: 10px;
  font-size: 12px; margin-left: 6px; }

.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: 9px; color: var(--muted); transition: background .12s, color .12s; }
.icon-btn:hover { background: #f1f5f9; color: var(--ink); }
.badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px #fff; }
.user-btn { display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px; border-radius: 10px; }
.user-btn:hover { background: #f1f5f9; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.user-meta b { font-size: 13px; color: var(--ink); }
.user-meta small { font-size: 11px; color: var(--muted); }
.chev { color: var(--muted); }

.page { padding: 24px; flex: 1; }
.footer { padding: 12px 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.btn-primary { background: var(--brand); color: #fff; border: none; padding: 8px 16px;
  border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-primary:hover { background: #1d4ed8; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer;
  padding: 8px 10px; font-size: 14px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .sidebar { width: 60px; }
  .brand { justify-content: center; padding: 16px 0; }
  .brand-text { display: none; }
  .nav { padding: 8px 6px; }
  .nav-head { display: none; }
  .nav-item { justify-content: center; gap: 0; padding: 9px 0; }
  .nav-item span { display: none; }
}

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.kpi-num { font-size: 28px; font-weight: 700; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi.good .kpi-num { color: var(--good); }
.kpi.bad .kpi-num { color: var(--bad); }
.kpi.warn .kpi-num { color: var(--warn); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line);
  color: var(--muted); font-weight: 600; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.row-bad { background: #fef2f2; }
.row-muted { opacity: 0.55; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--good); font-weight: 600; }
.no { color: var(--bad); font-weight: 600; }

.state { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.state-compliant { background: #dcfce7; color: #166534; }
.state-needsattention { background: #fef9c3; color: #854d0e; }
.state-atrisk { background: #ffedd5; color: #9a3412; }
.state-noncompliant { background: #fee2e2; color: #991b1b; }
.state-offline { background: #e2e8f0; color: #475569; }
.state-pendingreview { background: #e0e7ff; color: #3730a3; }

.sev { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.sev-critical { background: #fee2e2; color: #991b1b; }
.sev-high { background: #ffedd5; color: #9a3412; }
.sev-medium { background: #fef9c3; color: #854d0e; }
.sev-low { background: #e0f2fe; color: #075985; }
.sev-info { background: #e2e8f0; color: #475569; }

.pill { display: inline-block; font-size: 12.5px; background: #eef2ff; color: var(--brand);
  border-radius: 999px; padding: 3px 11px; }

.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select, .action-row input, .action-row select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.action-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.bulk-bar { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.row-check, .select-all { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.pager { display: flex; gap: 6px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager .cur { padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px;
  font-variant-numeric: tabular-nums; }
.pager a { color: var(--brand); }
.pager a:hover { background: #f1f5f9; text-decoration: none; }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }

.detail-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.score-badge { text-align: center; padding: 12px 20px; border-radius: 10px; min-width: 110px; }
.score-num { font-size: 30px; font-weight: 700; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.notice { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; padding: 12px 16px;
  border-radius: 8px; margin-bottom: 16px; display: flex; justify-content: space-between; gap: 12px; }
.ok-notice { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 10px 14px;
  border-radius: 8px; margin-bottom: 12px; }

.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; background: #f1f5f9;
  padding: 4px 8px; border-radius: 4px; word-break: break-all; }

.form-grid { display: grid; grid-template-columns: 200px 1fr; gap: 12px 16px; align-items: center; margin-bottom: 14px; }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; width: 100%; font-family: inherit; }
.checks { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.checks legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.checks label { display: block; padding: 4px 0; }
.section { margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: .5px; }
.cat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cat-cards .card { margin-bottom: 0; }

/* Toggle switch (read-only look for prototype) */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---- Prototype banner ---- */
.proto-ribbon { background: #fffbeb; border-bottom: 1px solid #fde68a; color: #92400e;
  padding: 7px 18px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.proto-ribbon b { color: #78350f; }
.proto-tag { background: #f59e0b; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 4px; letter-spacing: .5px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--sidebar), var(--brand)); }
.login-card { background: #fff; padding: 36px; border-radius: 14px; width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.brand-lg { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.login-card label { display: block; margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.login-card input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.login-card .btn-primary { width: 100%; margin-top: 18px; padding: 11px; }
.dev-hint { background: #fffbeb; border: 1px dashed #f59e0b; color: #92400e; padding: 10px 12px;
  border-radius: 8px; margin: 10px 0 4px; font-size: 13px; }
.dev-hint code { background: #fff7ed; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
