/* Audit Portal 0.5 — dark sidebar, light workspace, Inter with tabular figures */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #5b6474;
  --line: #e4e7ec;
  --line-soft: #f2f4f7;
  --field: #d0d5dd;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-soft: #eef2ff;
  --side: #0f172a;
  --side-2: #1e293b;
  --side-ink: #cbd5e1;
  --side-muted: #94a3b8;
  --ok: #067647; --ok-bg: #ecfdf3; --ok-dot: #12b76a;
  --bad: #b42318; --bad-bg: #fef3f2;
  --warn: #b54708; --warn-bg: #fffaeb; --warn-dot: #f79009;
  --low: #475467; --low-bg: #f2f4f7;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--ink); }
/* Tabular figures only where numbers line up: Inter's tnum also widens hyphens and slashes. */
.num, .kpi .v, .card .v, .bar-value, .nav-count { font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
a:hover { color: #1e3a8a; }
h1 { font-size: 22px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 26px 0 10px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.88em; background: var(--line-soft); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.muted, .hint { color: var(--muted); font-size: 13px; }
.hint { display: block; margin-top: 4px; font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- App shell ---------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 0 0 248px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; gap: 22px; padding: 20px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.brand-name { font-weight: 700; font-size: 15px; color: #fff; display: block; }
.brand-sub { font-size: 11.5px; color: var(--side-muted); display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--side-muted); padding: 0 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: 14px; }
.nav-link:hover { background: var(--side-2); color: #fff; }
.nav-link[aria-current="page"] { background: var(--side-2); color: #fff; font-weight: 600; }
.nav-link svg { flex: 0 0 auto; }
.nav-count { margin-left: auto; background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 4px; border-top: 1px solid var(--side-2); }
.avatar { width: 32px; height: 32px; border-radius: 999px; background: #334155; color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.side-user .who-name { font-size: 13px; color: #fff; font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who-meta { font-size: 11.5px; color: var(--side-muted); }
.side-user a { color: var(--side-muted); }
.side-user a:hover { color: #fff; }

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 32px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-title { margin-right: auto; display: flex; flex-direction: column; min-width: 0; }
.topbar-title .h { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-title .sub { font-size: 13px; color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; width: 340px; max-width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; color: var(--muted); background: #fff; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; font: inherit; background: transparent; padding: 0; color: var(--ink); }
.content { padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 1320px; }
.page { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 0 32px; }

.menu-btn, .rail-only { display: none; }

/* Wide screens: give the workspace more room. */
@media (min-width: 1800px) { .content { max-width: none; padding-left: 40px; padding-right: 40px; } .topbar, .subhead { padding-left: 40px; padding-right: 40px; } }

/* Desktop: the sidebar stays put while the page scrolls. */
@media (min-width: 821px) {
  .shell { flex-wrap: nowrap; }
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .side-menu { display: flex; flex-direction: column; gap: 22px; flex: 1; }
}

/* Laptops and tablets in landscape: the sidebar shrinks to icons. */
@media (min-width: 821px) and (max-width: 1199px) {
  .sidebar { flex-basis: 68px; padding: 16px 10px; align-items: center; }
  .sidebar .lbl, .sidebar .nav-label { display: none; }
  .brand { padding: 4px 0; }
  .nav-link { justify-content: center; padding: 10px; position: relative; }
  .nav-count { position: absolute; top: 2px; right: 0; margin: 0; padding: 0 5px; font-size: 10.5px; line-height: 16px; }
  .side-menu .nav + .nav { border-top: 1px solid var(--side-2); padding-top: 12px; }
  .side-user { flex-direction: column; padding: 12px 0 4px; border-top: 1px solid var(--side-2); }
  .rail-only { display: inline-flex; color: var(--side-muted); padding: 6px; border-radius: 6px; }
  .rail-only:hover { color: #fff; background: var(--side-2); }
  .topbar, .content { padding-left: 24px; padding-right: 24px; }
  .subhead { padding-left: 24px; padding-right: 24px; }
}

/* Phones and narrow tablets: a top bar with a menu button. */
@media (max-width: 820px) {
  .shell { flex-direction: column; flex-wrap: nowrap; }
  .sidebar { position: sticky; top: 0; z-index: 20; flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0; padding: 10px 14px; }
  .brand { margin-right: auto; }
  .menu-btn { display: inline-flex; position: relative; background: transparent; border: 1px solid var(--side-2); color: #fff; min-height: 38px; padding: 0 10px; }
  .menu-btn:hover { background: var(--side-2); border-color: var(--side-2); }
  .menu-count { position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 16px; padding: 0 5px; border-radius: 999px; }
  .side-menu { display: none; flex-basis: 100%; flex-direction: column; gap: 14px; padding: 14px 0 6px; max-height: calc(100vh - 60px); overflow-y: auto; }
  .sidebar.open .side-menu { display: flex; }
  .side-user { margin-top: 0; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .topbar { padding-top: 14px; padding-bottom: 14px; }
  .topbar-title { flex-basis: 100%; }
  .topbar .search { flex: 1 1 200px; width: auto; }
  .content { padding-top: 16px; gap: 16px; }
  .panel, .card-box { padding: 18px 16px; }
  .panel.flush { padding: 0; }
  .panel-head { padding: 14px 16px; }
  .panel.flush .grid th:first-child, .panel.flush .grid td:first-child { padding-left: 16px; }
  .panel.flush .grid th:last-child, .panel.flush .grid td:last-child { padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 24px; }
  .kpi.small .v { font-size: 20px; }
  h1 { font-size: 20px; }
  .toolbar .end { margin-left: 0; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .actions { grid-column: 1 / -1; }
  dl.kv { grid-template-columns: 96px minmax(0, 1fr); }
  .inline-form input { max-width: none; flex: 1 1 200px; }
}

/* ---------- Cards and panels ---------- */
.panel, .card-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.panel > h1:first-child, .panel > h2:first-child { margin-top: 0; }
.panel.narrow { max-width: 520px; margin: 48px auto; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #eef0f3; }
.panel-head h2 { margin: 0; }
.panel-head a { font-size: 13.5px; font-weight: 500; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.kpi .k { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 30px; font-weight: 700; line-height: 1.1; }
.kpi .v small { font-size: 18px; color: var(--muted); font-weight: 500; }
.kpi .s { font-size: 13px; color: var(--muted); }
.kpi.small .v { font-size: 22px; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpis-4 .kpi { padding: 14px 16px; }
@media (max-width: 560px) { .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card .k { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.card .v { font-size: 15px; margin-top: 4px; }

.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 3 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.facts { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.fact { display: flex; justify-content: space-between; gap: 12px; }
.fact > span:first-child { color: var(--muted); }
.fact > span:last-child { text-align: right; }

/* ---------- Status, severity, chips ---------- */
.sev { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.sev-high { background: var(--bad-bg); color: var(--bad); }
.sev-medium { background: var(--warn-bg); color: var(--warn); }
.sev-low { background: var(--low-bg); color: var(--low); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.pill.low { color: var(--low); background: var(--low-bg); }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--ok-dot); } .dot.warn { background: var(--warn-dot); } .dot.bad { background: var(--bad); } .dot.low { background: #98a2b3; }
.act { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--low-bg); color: var(--low); white-space: nowrap; }
.act-downloaded { background: #eff8ff; color: #175cd3; }
.act-edited { background: #f4f3ff; color: #5925dc; }
.act-shared { background: var(--warn-bg); color: var(--warn); }
.act-uploaded { background: var(--ok-bg); color: var(--ok); }
.act-deleted-moved { background: var(--bad-bg); color: var(--bad); }
.status { font-weight: 600; white-space: nowrap; }
.status.ok { color: var(--ok); } .status.bad { color: var(--bad); } .status.warn { color: var(--warn); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--low-bg); color: var(--low); }
.badge.guest { background: var(--warn-bg); color: var(--warn); }
.badge.app, .badge.system { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--field); background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 24px; overflow-x: auto; }
.tab { padding: 10px 0 12px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.seg { display: inline-flex; gap: 4px; background: var(--line-soft); padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.seg a { border-radius: 7px; padding: 6px 14px; font-size: 13.5px; color: #475467; text-decoration: none; }
.seg a[aria-current="page"] { background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.08); color: var(--ink); font-weight: 600; }
.subhead { background: var(--panel); border-bottom: 1px solid var(--line); padding: 18px 32px 0; display: flex; flex-direction: column; gap: 12px; }
.subhead .crumb { font-size: 13px; color: #475467; text-decoration: none; }
.subhead-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.subhead-row .title { margin-right: auto; display: flex; flex-direction: column; min-width: 0; }
.subhead-row h1 { margin: 0; }
.monogram { width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
@media (max-width: 820px) { .subhead { padding-left: 16px; padding-right: 16px; } }

/* ---------- Lists (findings) ---------- */
.list-item { display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); border-left: 3px solid transparent; text-decoration: none; color: var(--ink); }
.list-item:hover { background: #fafbfc; }
.list-item[aria-current="true"] { background: #f5f8ff; border-left-color: var(--accent); }
.list-item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.list-item .t { font-size: 14px; font-weight: 600; line-height: 1.35; }
.list-item .m { font-size: 12.5px; color: var(--muted); }
.list-item .r { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12.5px; color: var(--muted); text-align: right; }
.list-item:last-child { border-bottom: 0; }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .list { flex: 3 1 460px; min-width: 0; }
.split > .detail { flex: 2 1 380px; min-width: 0; position: sticky; top: 16px; }
@media (max-width: 900px) {
  .split > .detail { position: static; }
  /* With a finding open, show it first; the list follows. */
  .split.has-sel > .detail { order: -1; }
}
.back-to-list { display: none; }
@media (max-width: 900px) { .back-to-list { display: inline-block; font-size: 13.5px; font-weight: 500; } }
dl.kv { margin: 0; display: grid; grid-template-columns: 120px minmax(0, 1fr); row-gap: 9px; column-gap: 12px; font-size: 13.5px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12.5px; background: var(--line-soft); border-radius: 6px; padding: 3px 8px; color: var(--ink-2); overflow-wrap: anywhere; }

/* ---------- Forms and buttons ---------- */
.form { display: grid; gap: 14px; max-width: 640px; }
.form label { display: grid; gap: 5px; font-weight: 600; font-size: 13.5px; }
.form .row, .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form .row label.small { max-width: 140px; }
input, select, textarea { font: inherit; font-size: 14px; padding: 8px 11px; border: 1px solid var(--field); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; min-height: 40px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type="color"] { padding: 3px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; font-size: 14px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; font: inherit; font-size: 14px; font-weight: 600; padding: 0 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .button:hover { background: #1e40af; border-color: #1e40af; color: #fff; }
button.secondary, .button.secondary { background: #fff; color: var(--ink-2); border-color: var(--field); font-weight: 500; }
button.secondary:hover, .button.secondary:hover { background: #f9fafb; color: var(--ink); border-color: #98a2b3; }
button.small, .button.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }
.danger { border-color: var(--bad) !important; color: var(--bad) !important; background: #fff !important; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; align-items: center; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.inline-form input { max-width: 380px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: end; margin: 8px 0 12px; }
.filters label { min-width: 0; display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: #475467; }
.filters .check { align-self: center; }
.filters .actions { grid-column: span 2; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid #eef0f3; }
.toolbar .search { width: auto; flex: 1 1 220px; height: 36px; }
.toolbar .end { margin-left: auto; display: flex; gap: 12px; align-items: center; }
fieldset.checks { border: 0; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
fieldset.checks legend { font-weight: 600; font-size: 13px; margin-bottom: 4px; padding: 0; }
fieldset.section-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px 8px; margin: 0 0 14px; background: #fcfcfd; }
fieldset.section-box legend { font-weight: 700; padding: 0 6px; }
.builder .row { margin-bottom: 8px; }
.builder .row label, .builder > .form label { display: grid; gap: 4px; font-weight: 600; font-size: 13.5px; }
.copybox { display: flex; gap: 8px; align-items: stretch; }
.copybox input { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: #fecdca; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #fedf89; }
.alert a { color: inherit; font-weight: 600; }

/* ---------- Tables ---------- */
.grid { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 13.5px; }
.grid th, .grid td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid thead th { color: var(--muted); font-weight: 600; font-size: 12.5px; border-bottom-color: var(--line); }
.grid tbody tr:hover { background: #fafbfc; }
.grid.kv th { width: 200px; color: var(--muted); font-weight: 500; }
.grid.events td { font-size: 13px; }
.grid.events td.file { max-width: 360px; overflow-wrap: anywhere; }
.grid th.num, .grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.panel.flush .grid { margin: 0; }
.panel.flush .grid th:first-child, .panel.flush .grid td:first-child { padding-left: 20px; }
.panel.flush .grid th:last-child, .panel.flush .grid td:last-child { padding-right: 20px; }
.table-wrap { overflow-x: auto; }
.empty { padding: 28px 20px; color: var(--muted); text-align: center; }

/* ---------- Charts ---------- */
.bars { margin: 6px 0 14px; display: grid; gap: 4px; max-width: 760px; }
.bar-row { display: grid; grid-template-columns: 200px 1fr 70px; gap: 8px; align-items: center; font-size: 12.5px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--line-soft); border-radius: 3px; height: 12px; }
.bar { display: block; height: 12px; border-radius: 3px; background: var(--accent); }
.bar-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.vbars span { flex: 1; background: #c7d2fe; border-radius: 3px 3px 0 0; min-height: 2px; }
.vbars span.today { background: var(--accent); }
.vbars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.progress { height: 8px; background: #eef0f3; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 8px; border-radius: 999px; background: var(--accent); }
.progress.indeterminate > span { width: 35%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .progress.indeterminate > span { animation: none; width: 100%; opacity: .5; } }

/* ---------- Disclosure ---------- */
details.box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-top: 16px; background: var(--panel); }
details.box summary { cursor: pointer; font-weight: 600; }
details.local-login { margin-top: 20px; }
details.local-login summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }

/* ---------- Setup wizard ---------- */
.wizard { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .wizard { grid-template-columns: 1fr; } }
.steps { background: var(--side); color: var(--side-ink); border-radius: var(--radius); padding: 16px; position: sticky; top: 16px; }
.steps-title { font-weight: 700; margin-bottom: 8px; color: #fff; }
.steps ol { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: flex; justify-content: space-between; padding: 7px 8px; border-radius: 6px; }
.steps li::before { content: counter(step); width: 20px; color: var(--side-muted); }
.steps li a, .steps li span:not(.tick) { flex: 1; text-decoration: none; color: var(--side-ink); }
.steps li.current { background: var(--side-2); }
.steps li.current a { color: #fff; font-weight: 600; }
.steps li.locked span { color: #64748b; }
.steps ol.nonum li::before { content: none; }
.tick { color: #4ade80; font-weight: 700; }
.steps-list li { margin-bottom: 6px; }
.setup-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 32px 0 0; font-weight: 700; font-size: 16px; }
h2.page-h { font-size: 19px; font-weight: 700; margin: 0 0 12px; }

/* ---------- Phones: tables become stacked cards ---------- */
@media (max-width: 720px) {
  table.grid.stack, table.grid.stack tbody, table.grid.stack tr, table.grid.stack td { display: block; width: 100%; min-width: 0 !important; }
  table.grid.stack { min-width: 0 !important; table-layout: auto !important; }
  table.grid.stack colgroup, table.grid.stack thead { display: none; }
  table.grid.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
  table.grid.stack tr:last-child { border-bottom: 0; }
  table.grid.stack td { border: 0; padding: 3px 0 3px 114px !important; text-align: left !important; position: relative; overflow-wrap: anywhere; }
  table.grid.stack td::before { content: attr(data-label); position: absolute; left: 0; top: 4px; width: 104px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
  table.grid.stack td.nolabel { padding-left: 0 !important; }
  table.grid.stack td.nolabel::before { content: none; }
  table.grid.stack td:empty { display: none; }
  table.grid.stack td form { display: inline-block; margin-top: 6px; }
  .table-wrap:has(table.stack) { overflow: visible; }
}

/* Less important columns step aside on mid-size screens (phones show them in the card view). */
@media (min-width: 721px) and (max-width: 1299px) { .hide-md { display: none; } }
.filters input, .filters select { min-width: 0; max-width: 100%; }

/* ---------- Firewalls ---------- */
.grade { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 700; font-size: 14px; }
.grade.ok { background: var(--ok-bg); color: var(--ok); } .grade.low { background: #eff8ff; color: #175cd3; }
.grade.warn { background: var(--warn-bg); color: var(--warn); } .grade.bad { background: var(--bad-bg); color: var(--bad); }
.grade-big { width: 72px; height: 72px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 0 0 auto; }
.grade-big span { font-size: 30px; font-weight: 700; line-height: 1; }
.grade-big small { font-size: 12px; font-weight: 600; }
.grade-big.ok { background: var(--ok-bg); color: var(--ok); } .grade-big.low { background: #eff8ff; color: #175cd3; }
.grade-big.warn { background: var(--warn-bg); color: var(--warn); } .grade-big.bad { background: var(--bad-bg); color: var(--bad); }
details.fwcheck { border-bottom: 1px solid var(--line-soft); }
details.fwcheck:last-child { border-bottom: 0; }
details.fwcheck > summary { list-style: none; display: flex; align-items: flex-start; gap: 12px; padding: 13px 20px; cursor: pointer; }
details.fwcheck > summary::-webkit-details-marker { display: none; }
details.fwcheck > summary:hover { background: #fafbfc; }
details.fwcheck[open] > summary { background: #fafbfc; }
details.fwcheck .st { flex: 0 0 78px; text-align: center; font-size: 12px; font-weight: 600; padding: 3px 0; border-radius: 999px; }
.st-ok { background: var(--ok-bg); color: var(--ok); } .st-warn { background: var(--warn-bg); color: var(--warn); }
.st-bad { background: var(--bad-bg); color: var(--bad); } .st-low { background: var(--low-bg); color: var(--low); }
details.fwcheck .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
details.fwcheck .t { font-size: 14px; font-weight: 500; }
details.fwcheck .m { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
details.fwcheck .r { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.check-body { padding: 4px 20px 16px 110px; font-size: 13.5px; }
pre.evidence { margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: #f9fafb; border: 1px solid #eef0f3; border-radius: 6px; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  details.fwcheck > summary { padding: 12px 16px; flex-wrap: wrap; }
  details.fwcheck .r { display: none; }
  .check-body { padding: 4px 16px 16px; }
}
.row > label { display: grid; gap: 6px; font-weight: 600; font-size: 13.5px; align-content: start; }

/* ---------- Grouped menu ---------- */
.nav-group { border-top: 1px solid var(--side-2); padding-top: 10px; }
.sidebar .group-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 0; padding: 7px 10px; background: none; border: 0; border-radius: 8px; color: var(--side-muted); font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; justify-content: flex-start; cursor: pointer; text-align: left; white-space: nowrap; }
.sidebar .group-head:hover { background: none; color: #fff; }
.nav-group.active .group-head { color: #fff; }
.group-mark { width: 22px; height: 22px; border-radius: 6px; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.group-name { flex: 1; }
.chev { transition: transform .15s; }
.nav-group.collapsed .chev { transform: rotate(-90deg); }
.group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-group.collapsed .group-items { display: none; }
.nav-link.sub { padding-left: 42px; }
.nav-link .lock { margin-left: auto; color: #64748b; flex: 0 0 auto; }
.fly-title { display: none; }
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }

/* Laptops and tablets: each group is a colored square that opens a pop-out */
@media (min-width: 821px) and (max-width: 1199px) {
  .nav-group { border-top: 0; padding-top: 0; }
  .side-menu > .nav:first-child { border-bottom: 1px solid var(--side-2); padding-bottom: 10px; }
  .side-menu .nav-group + .nav-group, .side-menu .nav + .nav-group { border-top: 0; padding-top: 0; }
  .side-menu { gap: 8px; }
  .side-menu .side-user { margin-top: auto; }
  .sidebar .group-head { justify-content: center; padding: 8px; }
  .group-mark { width: 26px; height: 26px; font-size: 10.5px; }
  .nav-group.active .group-head, .nav-group.fly .group-head { background: var(--side-2); }
  .nav-group .group-items, .nav-group.collapsed .group-items { display: none; }
  .nav-group.fly .group-items { display: flex; position: fixed; left: 76px; z-index: 40; width: 220px; padding: 10px; background: var(--side); border: 1px solid var(--side-2); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, .35); }
  .nav-group.fly .fly-title { display: block; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff; padding: 6px 10px; }
  .nav-group .group-items .nav-link.sub { justify-content: flex-start; padding: 8px 10px; }
}

/* Phones: every group open */
@media (max-width: 820px) {
  .nav-group.collapsed .group-items { display: flex; }
  .sidebar .group-head { cursor: default; }
  .chev { display: none; }
}
