/* ═══════════════════════════════════════════════════════════════════════════
   DESRI Financials — design system
   Deep-navy chrome · one confident blue accent · quiet borders · layered
   shadows · 8px spacing grid · type scale 13/14/16/20/28.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* brand + chrome */
  --navy-950: #0a1226;
  --navy-900: #101f3c;
  --navy-800: #16294d;
  --navy-700: #1d3461;

  /* accent */
  --accent: #0b41cd;
  --accent-hover: #0935a8;
  --accent-active: #082e91;
  --accent-bright: #2e6bff;
  --accent-600: #1d4fd7;
  --accent-soft: #e8eefc;
  --accent-faint: #f3f6fd;

  /* text */
  --ink: #1c2536;
  --ink-2: #3a4356;
  --muted: #5b6577;
  --faint: #8a93a5;

  /* surfaces */
  --line: #e2e7ee;
  --line-strong: #cdd5e1;
  --bg: #f5f6f9;
  --surface: #ffffff;

  /* semantic status */
  --critical: #b42318;
  --high: #c4541b;
  --medium: #976400;
  --low: #3d7a33;
  --info: #3552a5;
  --success: #2e8540;

  /* geometry */
  --radius-sm: 8px;
  --radius: 12px;

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(16, 31, 60, .05);
  --shadow: 0 1px 2px rgba(16, 31, 60, .05), 0 4px 16px -4px rgba(16, 31, 60, .08);
  --shadow-lg: 0 4px 12px rgba(10, 18, 38, .12), 0 24px 60px -12px rgba(10, 18, 38, .28);

  /* focus */
  --ring: 0 0 0 3px rgba(11, 65, 205, .16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.014em; margin: 0 0 6px; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.008em; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 650; margin: 0 0 8px; }
p  { margin: 0 0 10px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 12.5px; background: var(--accent-faint); border: 1px solid var(--line);
       border-radius: 5px; padding: 1px 5px; }

/* focus is visible everywhere, only for keyboard users */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* the hidden attribute always wins, even over display:flex/grid classes */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 0 1px 0 rgba(10, 18, 38, .4), 0 2px 12px rgba(10, 18, 38, .18);
  position: relative;
  z-index: 50;
}
.brand a {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .005em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand a:hover { text-decoration: none; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 1px 3px rgba(10, 18, 38, .4);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; letter-spacing: .02em;
}
.topnav { display: flex; gap: 2px; align-items: center; margin-left: 20px; flex: 1; min-width: 0; }
.topnav a {
  color: #b9c6e0;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px; padding: 0 13px; border-radius: var(--radius-sm);
  font-weight: 550; font-size: 13.5px; text-decoration: none;
  transition: color .15s ease, background-color .15s ease;
}
.topnav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.topnav a.active { color: #fff; background: rgba(255, 255, 255, .14); }
.topnav a:focus-visible, .topbar a:focus-visible, .topbar button:focus-visible {
  outline-color: #9db9ff;
}
.topnav a[aria-label="Home"] { width: 36px; padding: 0; flex: none; }

/* admin-only nav items read as a distinct, keyed-access tier */
.admin-nav {
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .05);
  border-radius: var(--radius-sm);
}
.topnav a.admin-nav:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .34); }
.topnav a.admin-nav.active { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); }
.nav-sep {
  display: inline-block; width: 1px; height: 22px;
  background: rgba(255, 255, 255, .18); margin: 0 10px; vertical-align: middle; flex: none;
}

.logout-form { margin: 0; display: flex; align-items: center; gap: 2px; }
.admin-settings {
  margin-right: 14px; padding: 0 13px; min-height: 34px;
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 550; color: #dbe4f5; text-decoration: none;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.admin-settings:hover { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.admin-settings.active { background: rgba(255, 255, 255, .16); color: #fff; }

.user-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #3f7bf0, #2456d4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
  color: #fff; font-weight: 700; font-size: 12px;
  margin-right: 8px;
}
a.user-chip { text-decoration: none; transition: box-shadow .15s ease; }
a.user-chip:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 3px rgba(255, 255, 255, .18); }
.logout-form a.link-btn { transition: color .15s ease; }
.logout-form .link-btn { color: #b9c6e0; font-size: 13px; padding: 6px 10px; border-radius: var(--radius-sm); }
.logout-form .link-btn:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .08); }
.logout-form button.link-btn:hover { text-decoration: none; }

.container { max-width: 1180px; margin: 28px auto 72px; padding: 0 24px; }

/* ── surfaces ────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin-bottom: 24px;
}
.card > h1:first-child { margin-top: 2px; }
.subtle { color: var(--muted); font-size: 13px; }
.faint  { color: var(--faint); font-size: 12.5px; }

.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.grow { flex: 1; }

/* subdued companion card (e.g. recent reviews on Home) */
.card.quiet { background: #fbfcfe; box-shadow: var(--shadow-sm); }
.card.quiet h2 { font-size: 14px; color: var(--muted); }
.card.quiet .files-table td, .card.quiet .files-table th { font-size: 12.5px; padding: 8px 10px; }

/* ── forms ───────────────────────────────────────────────────────────────── */

label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
/* inline (checkbox / radio) labels lay out horizontally */
label.row { flex-direction: row; align-items: center; gap: 8px; margin: 0; font-weight: 550; }

input[type="text"], input[type="password"], input[type="email"], select, textarea {
  font: inherit;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 0; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input:hover:not(:focus):not([type="checkbox"]):not([type="file"]),
select:hover:not(:focus), textarea:hover:not(:focus) { border-color: #b4bfd0; }

/* crisp custom chevron on single selects */
select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235b6577' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

input[type="checkbox"], input[type="radio"] {
  accent-color: var(--accent);
  width: 15px; height: 15px; margin: 0;
  cursor: pointer;
}

input[type="file"] { border: none; padding: 0; min-height: 0; font-size: 13px; color: var(--muted); }
input[type="file"]::file-selector-button {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 7px 13px; margin-right: 10px; cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
input[type="file"]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

/* ── buttons: primary / secondary / ghost(link) / danger ─────────────────── */

button.primary, a.primary {
  font: inherit; font-size: 13.5px; font-weight: 650; letter-spacing: .002em;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 8px 18px;
  background: linear-gradient(180deg, #1149dc, var(--accent));
  color: #fff; text-decoration: none;
  border: none; border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(11, 65, 205, .28);
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
button.primary:hover, a.primary:hover {
  background: linear-gradient(180deg, #0e3fc4, var(--accent-hover));
  text-decoration: none; color: #fff;
}
button.primary:active, a.primary:active { background: var(--accent-active); transform: translateY(1px); }
button.primary:disabled {
  background: #9db1dd; box-shadow: none; cursor: default; transform: none;
}
button.primary.big, a.primary.big { padding: 12px 26px; font-size: 14.5px; border-radius: 10px; }

button.secondary, a.secondary {
  font: inherit; font-size: 13.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 7px 14px;
  background: #fff; color: var(--ink-2); text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease, transform .15s ease;
}
button.secondary:hover, a.secondary:hover {
  border-color: var(--accent); color: var(--accent); background: var(--accent-faint);
  text-decoration: none;
}
button.secondary:active, a.secondary:active { transform: translateY(1px); }
button.secondary:disabled {
  color: var(--faint); border-color: var(--line); background: #fafbfd;
  box-shadow: none; cursor: default; transform: none;
}

.link-btn {
  background: none; border: none; padding: 4px 2px;
  color: var(--accent); cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 550;
  border-radius: 4px;
}
.link-btn:hover { text-decoration: underline; }
.danger { color: var(--critical) !important; }

/* outlined danger (e.g. bulk delete) */
.danger-btn { color: var(--critical); border-color: #e5c1bc; }
.danger-btn:not(:disabled):hover { background: #fbe9e7; border-color: var(--critical); color: var(--critical); }
/* solid danger (confirm bars) — also wins over .primary's gradient */
.danger-solid, button.primary.danger-solid, a.primary.danger-solid {
  background: var(--critical); border-color: var(--critical);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(180, 35, 24, .3);
}
.danger-solid:hover, button.primary.danger-solid:hover { background: #9a1d13; }

/* small inline icons inside buttons/links */
.btn-ic { flex: none; display: inline-block; vertical-align: -2px; }

/* ── segmented review-level control ──────────────────────────────────────── */

.level-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px 0 4px; }
.level-card {
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; background: #fff;
  display: block; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
  font-weight: normal;
  position: relative;
}
.level-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.level-card input { position: absolute; opacity: 0; }
.level-card .lvl-name { font-weight: 700; font-size: 13.5px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.level-card .lvl-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.level-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.level-card .dot-radio {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #b9c3d4; display: inline-block; flex: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.level-card.selected .dot-radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2.5px #fff; }

/* ── dropzone ────────────────────────────────────────────────────────────── */

.dropzone {
  border: 1.5px dashed #c2cbdb;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfcfe, #f8fafd);
  padding: 36px 20px;
  text-align: center;
  margin: 16px 0;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
  cursor: pointer;
}
.dropzone:hover { border-color: #9fb4e0; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dz-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(180deg, var(--accent-soft), #dbe6fb);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 1px 3px rgba(16, 31, 60, .08);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  transition: transform .15s ease;
}
.dropzone:hover .dz-icon, .dropzone.dragover .dz-icon { transform: translateY(-2px); }

/* ── tables ──────────────────────────────────────────────────────────────── */

.files-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.files-table th {
  text-align: left; padding: 9px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line-strong); background: #fff;
  position: sticky; top: 0; z-index: 2;
  white-space: nowrap;
}
.files-table td {
  padding: 10px 12px; border-bottom: 1px solid #edf0f5;
  vertical-align: middle; font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.files-table tbody tr { transition: background-color .15s ease; }
.files-table tr:hover td { background: #f8fafd; }
.files-table input[type="text"], .files-table select { width: 100%; padding: 6px 9px; font-size: 13px; min-height: 32px; }
.files-table td[style*="text-align:right"], .files-table th[style*="text-align:right"] { font-variant-numeric: tabular-nums; }

/* ── status pills ────────────────────────────────────────────────────────── */

.status {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; text-transform: capitalize;
  letter-spacing: .01em; white-space: nowrap;
  background: #eef1f6; color: var(--ink-2);
  box-shadow: inset 0 0 0 1px rgba(16, 31, 60, .06);
}
.status-running, .status-uploading, .status-queued { background: #e7efff; color: var(--accent-600); box-shadow: inset 0 0 0 1px rgba(29, 79, 215, .14); }
.status-completed, .status-uploaded, .status-parsed, .status-ready { background: #e4f3e6; color: #256b2c; box-shadow: inset 0 0 0 1px rgba(46, 133, 64, .16); }
.status-error, .status-cancelled { background: #fbe9e7; color: var(--critical); box-shadow: inset 0 0 0 1px rgba(180, 35, 24, .15); }
.status-pending { background: #f1f3f7; color: var(--muted); }
.status-amber { background: #fff3df; color: #94660c; box-shadow: inset 0 0 0 1px rgba(151, 100, 0, .16); }
.status-na { background: #eef0f4; color: #67708a; box-shadow: inset 0 0 0 1px rgba(16, 31, 60, .05); }

/* ── severity ────────────────────────────────────────────────────────────── */

.sev-pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}
.sev-pill.critical { background: var(--critical); }
.sev-pill.high     { background: var(--high); }
.sev-pill.medium   { background: var(--medium); }
.sev-pill.low      { background: var(--low); }
.sev-pill.info     { background: var(--info); }

.counts { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 4px; }
.count-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px;
  min-height: 30px; padding: 3px 13px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  background: #fff; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.count-chip:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.count-chip.active { border-color: var(--accent); background: var(--accent-soft); }
.count-chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.count-chip.critical .dot { background: var(--critical); }
.count-chip.high .dot     { background: var(--high); }
.count-chip.medium .dot   { background: var(--medium); }
.count-chip.low .dot      { background: var(--low); }
.count-chip.info .dot     { background: var(--info); }

/* ── mini charts ─────────────────────────────────────────────────────────── */

.charts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px; margin: 18px 0 6px;
}
.chart-box {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; background: #fff; box-shadow: var(--shadow-sm);
}
.chart-box h3 {
  margin: 0 0 12px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; cursor: pointer; }
.bar-row:hover .bar-label { color: var(--accent); }
.bar-label { width: 96px; flex: none; font-size: 12.5px; color: var(--ink-2); text-transform: capitalize;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: block; flex: 1; height: 16px; background: #f0f3f8; border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--accent);
            min-width: 2px; transition: width .25s ease; }
.bar-count { width: 30px; flex: none; text-align: right; font-size: 12.5px; font-weight: 650;
             color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar-row.active .bar-label { color: var(--accent); font-weight: 700; }
.chart-empty { color: var(--faint); font-size: 12.5px; padding: 8px 0; }

/* ── progress ────────────────────────────────────────────────────────────── */

.progress-bar {
  flex: 1; height: 8px; border-radius: 999px;
  background: #e8ecf3; overflow: hidden; min-width: 220px;
  box-shadow: inset 0 1px 2px rgba(16, 31, 60, .06);
}
#progressFill {
  height: 100%; border-radius: 999px; transition: width .4s ease;
  background: linear-gradient(90deg, var(--accent-bright), var(--accent));
  background-size: 200% 100%;
  animation: progressSheen 1.8s linear infinite;
}
@keyframes progressSheen { from { background-position: 0 0; } to { background-position: -200% 0; } }

/* discreet inline spinner for loading copy */
.spinner {
  display: inline-block; width: 14px; height: 14px; flex: none;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; vertical-align: -2px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── findings ────────────────────────────────────────────────────────────── */

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { padding: 6px 10px; font-size: 13px; border-radius: var(--radius-sm); min-height: 34px; }
.filters select { padding-right: 28px; }
.findings-list { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.finding {
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px;
  padding: 14px 18px; background: #fff; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, opacity .15s ease;
}
.finding:hover { box-shadow: var(--shadow); }
.finding.critical { border-left-color: var(--critical); }
.finding.high     { border-left-color: var(--high); }
.finding.medium   { border-left-color: var(--medium); }
.finding.low      { border-left-color: var(--low); }
.finding.info     { border-left-color: var(--info); }
.finding.is-addressed, .finding.is-ignored { opacity: .55; }
.finding.is-addressed:hover, .finding.is-ignored:hover { opacity: .85; }
.finding-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.finding-title { font-weight: 650; font-size: 14px; color: var(--ink); flex: 1; min-width: 220px; }
.finding-meta { font-size: 12.5px; color: var(--faint); margin-top: 3px; }
.finding-detail { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }
.finding-fix { margin-top: 8px; font-size: 13px; color: var(--ink-2); background: var(--accent-faint);
               border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.finding-quote {
  margin-top: 8px; font-size: 13px; color: var(--ink-2);
  border-left: 3px solid #d7deea; padding: 4px 12px; font-style: italic; background: #fafbfd;
  border-radius: 0 6px 6px 0;
}
.finding-files, .finding-numbers { margin-top: 6px; font-size: 12.5px; color: var(--muted);
                                   font-variant-numeric: tabular-nums; }

.status-toggle {
  display: inline-flex; gap: 0; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); overflow: hidden; flex: none;
  box-shadow: var(--shadow-sm);
}
.status-toggle button {
  font: inherit; font-size: 11.5px; font-weight: 650; padding: 6px 12px; min-height: 30px;
  background: #fff; border: none; cursor: pointer; color: var(--muted);
  transition: background-color .15s ease, color .15s ease;
}
.status-toggle button:hover { background: #f4f6fa; color: var(--ink-2); }
.status-toggle button + button { border-left: 1px solid var(--line); }
.status-toggle button.on.open       { background: var(--accent-soft); color: var(--accent); }
.status-toggle button.on.addressed  { background: #e4f3e6; color: #256b2c; }
.status-toggle button.on.ignored    { background: #eef1f6; color: var(--ink-2); }

.version-badge {
  display: inline-block; padding: 1px 8px; border-radius: 6px;
  background: var(--navy-800); color: #fff; font-size: 11px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── summary / narrative ─────────────────────────────────────────────────── */

.narrative {
  background: linear-gradient(180deg, var(--accent-faint), #fff);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; margin: 14px 0 4px; font-size: 14px; color: var(--ink-2);
}
.narrative strong { color: var(--ink); }

/* ── empty states ────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center; color: var(--muted); padding: 36px 20px; font-size: 13.5px;
  border: 1px dashed #d3dae5; border-radius: var(--radius); background: #fafbfd;
}
.empty-state::before {
  content: ""; display: block; width: 44px; height: 44px;
  margin: 0 auto 12px; border-radius: 14px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .9), transparent 55%),
    linear-gradient(160deg, var(--accent-soft), #dbe4f7);
  box-shadow: inset 0 0 0 1px rgba(11, 65, 205, .1);
}

/* ── modal ───────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 18, 38, .5);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 60;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: 14px; max-width: 720px; width: 92%;
  max-height: 84vh; overflow: auto; padding: 24px 28px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal h2 { margin-top: 0; }

/* ── multi-select dropdown (controllers) ─────────────────────────────────── */

.msel { position: relative; }
.msel-btn {
  font: inherit; font-size: 12.5px; background: #fff; color: var(--ink-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 6px 10px;
  min-height: 32px; cursor: pointer; width: 100%; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: border-color .15s ease;
}
.msel-btn:hover { border-color: var(--accent); }
.msel-pop {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 200px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 8px; max-height: 220px; overflow: auto;
  animation: popIn .12s ease;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-3px); } }
.msel-pop label {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  font-weight: 500; font-size: 13px; color: var(--ink); padding: 6px 8px;
  border-radius: 6px; cursor: pointer;
}
.msel-pop label:hover { background: #f4f6fa; }

/* ── login: the front door ───────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(46, 107, 255, .28), transparent 60%),
    radial-gradient(760px 420px at 105% 12%, rgba(29, 79, 215, .22), transparent 55%),
    radial-gradient(600px 500px at 50% 115%, rgba(46, 107, 255, .12), transparent 60%),
    linear-gradient(165deg, var(--navy-800) 0%, var(--navy-900) 55%, var(--navy-950) 100%);
  padding: 32px 16px;
}
.login-wrap { width: 100%; max-width: 404px; margin: 0 auto; }
.login-brand {
  display: flex; align-items: center; justify-content: center; gap: 11px;
  color: #fff; font-size: 17px; font-weight: 700; letter-spacing: .005em;
  margin-bottom: 24px;
}
.login-brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 14px rgba(8, 17, 40, .5);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13.5px; font-weight: 800; color: #fff;
}
.login-wrap .card {
  padding: 32px 32px 28px; margin-bottom: 0;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}
.login-wrap .card h1 { font-size: 20px; margin-bottom: 2px; }
.login-wrap .card .login-lede { margin-bottom: 20px; }
.login-field { margin-top: 14px; display: flex; }
.login-error {
  background: #fbe9e7; border: 1px solid #f0c8c3; color: var(--critical);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 4px;
}
.login-reset summary {
  cursor: pointer; font-size: 13px; color: var(--accent); font-weight: 550;
  border-radius: 4px; width: fit-content;
}
.login-reset summary:hover { text-decoration: underline; }
.login-foot {
  text-align: center; color: #93a3c4; font-size: 12.5px;
  margin: 18px auto 0; max-width: 340px; line-height: 1.5;
}
.login-foot strong { color: #c3cfe8; font-weight: 600; }

/* legacy fallback (kept for any old markup) */
.login-wrap.legacy { max-width: 400px; margin: 9vh auto; }

/* ── toast ───────────────────────────────────────────────────────────────── */

#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--navy-900); color: #fff; padding: 10px 22px;
  border-radius: 999px; font-size: 13.5px; font-weight: 550;
  box-shadow: var(--shadow-lg); z-index: 80; opacity: 0; visibility: hidden;
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  pointer-events: none;
}
#toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .level-options { grid-template-columns: 1fr; }
  .container { padding: 0 14px; }
}

/* ── home: hero + dashboard grid ─────────────────────────────────────────── */

.home-hero {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  position: relative; overflow: hidden;
  background:
    radial-gradient(640px 320px at 88% -40%, rgba(88, 141, 255, .5), transparent 62%),
    radial-gradient(520px 300px at -6% 130%, rgba(46, 107, 255, .32), transparent 60%),
    linear-gradient(115deg, var(--navy-900) 8%, #14346b 55%, var(--accent-600) 125%);
  color: #fff; border-radius: 16px; padding: 30px 34px; margin-bottom: 24px;
  box-shadow: 0 2px 6px rgba(10, 18, 38, .18), 0 16px 44px -14px rgba(13, 31, 60, .5);
}
.home-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), transparent 34%);
}
.home-hero > * { position: relative; z-index: 1; }
.home-hero h1 { margin: 0 0 4px; color: #fff; font-size: 26px; letter-spacing: -0.02em; }
.home-hero .subtle { color: #c2d1f0; margin: 0; font-size: 14px; }

/* the one unmistakable call to action */
.home-hero .primary {
  background: #fff; color: #14346b; border: none; font-weight: 700;
  box-shadow: 0 2px 6px rgba(8, 17, 40, .3), 0 10px 28px -6px rgba(8, 17, 40, .45);
}
.home-hero .primary:hover { background: var(--accent-soft); color: #0f2a5c; transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(8, 17, 40, .3), 0 16px 34px -6px rgba(8, 17, 40, .5); }
.home-hero .primary:active { transform: translateY(0); }
.home-hero .primary.big { font-size: 15.5px; padding: 14px 28px; white-space: nowrap; }

.home-grid {
  display: grid; gap: 20px;
  grid-template-areas: "mine comments" "recent news";
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
@media (max-width: 900px) {
  /* minmax(0,…) so wide tables scroll inside their card instead of
     stretching the single column past the viewport */
  .home-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "recent" "mine" "comments" "news"; }
  .home-hero { flex-direction: column; gap: 16px; align-items: flex-start; }
}
.home-cell { margin: 0; }

.role-block { margin-bottom: 14px; }
.role-head { font-weight: 650; font-size: 13px; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.mini-finding {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px;
  text-decoration: none; color: var(--ink); font-size: 13px;
  transition: border-color .15s ease, background-color .15s ease;
}
.mini-finding:hover { background: #f8fafd; border-color: var(--line-strong); text-decoration: none; }
.mini-finding .mini-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* What's new auto-scroll — track duplicated in JS for a seamless loop;
   pauses on hover; disabled under prefers-reduced-motion */
.news-viewport {
  overflow: hidden; max-height: 320px; position: relative;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}
.news-track { animation: newsScroll linear infinite; }
.news-viewport:hover .news-track { animation-play-state: paused; }
@keyframes newsScroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@media (prefers-reduced-motion: reduce) { .news-track { animation: none; } }
.news-item { padding: 10px 4px 12px; border-bottom: 1px solid var(--line); }
.news-title { font-weight: 650; font-size: 13.5px; }
.news-detail { color: var(--muted); font-size: 12.8px; margin: 3px 0 5px; }
.news-item .link-btn { font-size: 13px; padding-left: 0; }

/* ── reporting matrix ────────────────────────────────────────────────────── */

.legend-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 2px 0 16px; }
.legend-row .status { flex: none; }
.matrix .ment { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrix th.mq { width: 170px; }
.matrix .mcell { white-space: nowrap; }
.matrix .mcell-dim { opacity: .28; }
.matrix .mcell-link { text-decoration: none; }
.matrix .mcell-link:hover .status { box-shadow: inset 0 0 0 1px rgba(16, 31, 60, .28); }
.matrix .mprep { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-bar { row-gap: 10px; }
.filter-bar label { font-size: 12.5px; color: var(--muted); }
.filter-bar select[multiple] { font-size: 12.5px; }
.filter-bar label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }

/* ── folder-tree intake ──────────────────────────────────────────────────── */

.folder-tree { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 14px; }
.tree-folder { margin-bottom: 4px; }
.tree-folder summary { cursor: pointer; padding: 6px 6px; border-radius: 6px; transition: background-color .15s ease; }
.tree-folder summary:hover { background: #f6f8fb; }
.tree-folder summary label { cursor: pointer; }
.tree-file { display: block; padding: 4px 6px 4px 30px; font-size: 13px; cursor: pointer;
             border-radius: 6px; transition: background-color .15s ease; }
.tree-file:hover { background: #f6f8fb; }
.tree-file input, .tree-folder input { width: auto; margin-right: 7px; }

/* ── responsive nav + tables ─────────────────────────────────────────────── */

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; row-gap: 6px; }
  .topbar .brand a { font-size: 14px; }
  .topnav { order: 3; width: 100%; display: flex; gap: 2px; overflow-x: auto;
            -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .topnav a { white-space: nowrap; }
  .logout-form { margin-left: auto; }
  .files-table { display: block; overflow-x: auto; max-width: 100%; }
  .home-hero { padding: 22px; }
  .container { padding: 14px; }
}

.pw-field { display: flex; margin-top: 12px; }

/* ── admin: grouped tab rail ─────────────────────────────────────────────── */

.tab-group-label {
  width: 100%; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); margin: 14px 0 2px;
}
#adminTabs { margin: 0 0 18px; }
#adminTabs .row { gap: 6px; margin: 6px 0 0; }
#adminTabs button {
  box-shadow: none; background: transparent; border-color: transparent;
  color: var(--muted); font-weight: 600; min-height: 34px; padding: 6px 13px;
}
#adminTabs button:hover { background: #eceff5; color: var(--ink); border-color: transparent; }
#adminTabs button.on {
  background: #fff; color: var(--accent); border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.hier-chip { color: var(--muted); font-size: 12px; }

/* ── autocomplete combobox ───────────────────────────────────────────────── */

.ac-cell { position: relative; }
.ac-pop {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% - 6px);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 260px; overflow-y: auto;
}
.ac-item { padding: 7px 11px; font-size: 13px; cursor: pointer; }
.ac-item:hover, .ac-item.on { background: var(--accent-soft); }

/* ── per-entity review progress ──────────────────────────────────────────── */

.prog-row { display: flex; align-items: center; gap: 12px; padding: 7px 2px; }
.prog-name { flex: 0 0 320px; font-size: 13.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.prog-track { flex: 1; height: 7px; background: #edf0f6; border-radius: 5px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 5px; transition: width .8s ease;
  background: var(--accent-600); }
.prog-fill.status-completed { background: var(--success); }
.prog-fill.status-error { background: var(--critical); }
.prog-fill.status-pending { background: #c3cbdb; }
@media (max-width: 760px) { .prog-name { flex-basis: 45%; } }

/* ── bulk-selection action bar ───────────────────────────────────────────── */

.sel-bar {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--navy-950); color: #fff; border-radius: 12px; padding: 10px 18px;
  display: flex; gap: 14px; align-items: center; z-index: 90;
  box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: selBarIn .18s ease;
}
@keyframes selBarIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
.sel-bar .link-btn { color: #b9c7e6; }

/* ── searchable filter dropdowns ─────────────────────────────────────────── */

.fdd { position: relative; }
.fdd-btn {
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  min-height: 36px; padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 550;
  cursor: pointer; color: var(--ink);
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
  box-shadow: var(--shadow-sm);
}
.fdd-btn:hover { border-color: var(--accent); }
.fdd-btn.on { border-color: var(--accent-600); color: var(--accent-600); background: var(--accent-faint); }
.fdd-caret { font-size: 9px; color: var(--muted); margin-left: 5px; }
.fdd-panel {
  position: absolute; z-index: 70; top: calc(100% + 4px); left: 0;
  width: 290px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px;
  animation: popIn .12s ease;
}
.fdd-search { width: 100%; padding: 7px 10px; font-size: 13px; margin-bottom: 4px; }
.fdd-actions { display: flex; gap: 12px; padding: 2px 4px 6px; }
.fdd-list { max-height: 260px; overflow-y: auto; }
.fdd-item { display: flex; flex-direction: row; gap: 8px; align-items: center; padding: 6px 6px;
  border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }
.fdd-item:hover { background: #f4f7fd; }
.fdd-item input { width: auto; }

/* v7: policy manual cards */
.policy-card {
  flex: 1 1 340px; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; background: #fbfcfe;
}
.policy-card h3 { margin: 0 0 4px; font-size: 14px; }
.pol-status { margin: 10px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
