:root {
  --bg: #f4f6f9;
  --bg2: #ffffff;
  --ink: #111827;
  --muted: #475569;
  --panel: #ffffff;
  --line: #e2e8ef;
  --navy: #0a1628;
  --navy2: #0f2040;
  --blue: #1a3a8f;
  --steel: #334155;
  --teal: #0d7d74;
  --cyan: #0e7490;
  --amber: #92400e;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --red: #991b1b;
  --red-bg: #fff5f5;
  --red-border: #fecaca;
  --green: #065f46;
  --green-bg: #f0fdf4;
  --green-border: #bbf7d0;
  --violet: #5b21b6;
  --shadow: 0 1px 4px rgba(15,23,42,.07), 0 4px 12px rgba(15,23,42,.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06);
  --radius: 8px;
  --radius-lg: 12px;
  /* Chart palette — overridden in the dark-mode block so charts stay legible. */
  --chart-grad-from: #0a1628; --chart-grad-to: #0d7d74; --chart-area: #0a1628;
  --chart-1: #0a1628; --chart-2: #0d7d74; --chart-3: #1a3a8f; --chart-4: #92400e;
  --chart-5: #991b1b; --chart-6: #0e7490; --chart-7: #065f46; --chart-8: #334155;
}

* { box-sizing: border-box }
html { scroll-behavior: smooth }

body {
  margin: 0;
  background: var(--bg);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ── */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 18px 48px;
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: center;
  border-bottom: 3px solid var(--teal);
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #94a3b8;
  font-weight: 600;
}

.topbar h1 {
  margin: 8px 0 6px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  color: #f8fafc;
}

.topbar p {
  margin: 0;
  color: #94a3b8;
  max-width: 820px;
  line-height: 1.6;
  font-size: 13.5px;
}

.userbox { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; flex: 0 0 auto;
  border-radius: 50%; background: #1a3a8f; color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 13.5px; font-weight: 600; color: #f1f5f9; }
.user-meta a { color: #8fd3fb; font-size: 11.5px; font-weight: 600; text-decoration: none; letter-spacing: .02em; }
.user-meta a:hover { text-decoration: underline; }

/* ── Tab navigation — underline style ── */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 48px;
  background: #ffffff;
  border-bottom: 1px solid #d1d5db;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(15,23,42,.06);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 15px 22px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: #4b5563;
  box-shadow: none;
  white-space: nowrap;
  /* box-shadow transition covers the inset indicator animation */
  transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}

.tab:hover {
  color: #111827;
  background: #f3f4f6;
}

/* Active tab — four simultaneous visual cues:
   1. Inset bottom shadow (clip-proof teal indicator, 4 px)
   2. Very pale teal background wash
   3. Dark navy text (strongest contrast)
   4. Weight 700 vs 600 on inactive                          */
.tab.active {
  color: #0a1628;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: #f0fdf9;
  box-shadow: inset 0 -4px 0 #0d7d74;
}

/* Developer Governance launcher — a right-aligned nav entry that opens a dedicated page.
   Deliberately NOT a .tab (it navigates instead of switching a panel) so it stays out of the
   tab roving-tabindex / keyboard logic. */
.nav-launch {
  align-self: center;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 8px;
  color: #0d7d74;
  background: #f0fdf9;
  border: 1px solid #b6e3dc;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.nav-launch:hover { background: #dcf5ef; border-color: #0d7d74; }
.nav-launch:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.nav-launch svg { width: 16px; height: 16px; flex: 0 0 auto; }
.nav-launch .nl-arrow { width: 14px; height: 14px; opacity: .75; }
[data-theme="dark"] .nav-launch { color: #7fe3cd; background: rgba(46,196,166,.12); border-color: rgba(46,196,166,.35); }
[data-theme="dark"] .nav-launch:hover { background: rgba(46,196,166,.2); border-color: #2ec4a6; }

/* ── Container ── */
.container { padding: 28px 48px 72px; }

/* ── Hero card ── */
.hero-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-right: 8px;
}

.badge-dark {
  background: var(--navy);
  color: #e2e8f0;
  border-color: var(--navy);
}

.hero-card h2 {
  margin: 10px 0 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.hero-card p { margin: 0; color: var(--muted); font-size: 13px; }

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
  color: var(--muted);
}

.toolbar select { display: block; margin-top: 4px; }

/* ── Buttons ── */
button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--steel);
  box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s;
}

button:hover { background: #f8fafc; border-color: #c4cdd8; }

button.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: none;
}

button.primary:hover { background: var(--navy2); }

/* ── Inputs / selects ── */
input, select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: #fff;
  min-width: 160px;
  color: var(--ink);
  font-size: 13px;
}

input:focus, select:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}

/* ── Section headings ── */
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin: 28px 0 14px;
}

.section-heading.compact { margin-top: 18px; }

.section-heading h2 {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  max-width: 680px;
  line-height: 1.55;
  font-size: 13px;
}

.section-kicker {
  font-size: 10.5px !important;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-weight: 700;
  color: var(--teal) !important;
}

/* ── Status strip ── */
.status-strip.refined {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px,1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.status-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--green);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-height: 110px;
}

.status-card.warn { border-top-color: #d97706; }
.status-card.danger { border-top-color: #dc2626; }

.status-card span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .09em;
}

.status-card strong {
  display: block;
  margin-top: 7px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.status-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* ── KPI cards ── */
.kpi-grid { display: grid; gap: 14px; margin-bottom: 20px; }
.kpi-grid.executive { grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); }

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  border-top: 3px solid #e2e8ef;
}

.kpi.warn { border-top-color: #d97706; }
.kpi.danger { border-top-color: #dc2626; }

.kpi .label {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .08em;
}

.kpi .value {
  font-size: 26px;
  font-weight: 700;
  margin: 8px 0 5px;
  color: var(--ink);
  line-height: 1.1;
}

.kpi .note {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Findings grid ── */
.findings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px,1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.finding {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.finding.warn {
  border-left-color: #d97706;
  background: var(--amber-bg);
  border-color: var(--amber-border);
  border-left-color: #d97706;
}

.finding.danger {
  border-left-color: #dc2626;
  background: var(--red-bg);
  border-color: var(--red-border);
  border-left-color: #dc2626;
}

.finding.info { border-left-color: var(--cyan); background: #f0f9ff; }

.finding span {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
}

.finding h3 { margin: 5px 0 4px; font-size: 14px; font-weight: 600; }
.finding p { margin: 0; color: var(--steel); font-size: 13px; line-height: 1.45; }
.finding small { color: var(--muted); line-height: 1.35; font-size: 12px; }

/* ── Grid layouts ── */
.grid { display: grid; gap: 18px; }
.two { grid-template-columns: 1fr 1fr; }
.two-one { grid-template-columns: 2fr 1fr; }
.three { grid-template-columns: repeat(3, 1fr); }

/* ── Panels ── */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
  overflow: hidden;
}

.panel h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.muted { color: var(--muted); line-height: 1.5; }
.panel p.muted { margin-top: 0; font-size: 13px; }

/* ── Lists ── */
.mini-list, .metric-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mini-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
  font-size: 13px;
}

.mini-list li:last-child, .metric-list li:last-child { border-bottom: 0; }
.mini-list strong { color: var(--ink); font-weight: 600; }

.metric-list li { border-bottom: 1px solid var(--line); padding: 11px 0; }

.metric-list span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .07em;
}

.metric-list strong {
  display: block;
  margin: 4px 0 3px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.metric-list strong.warn { color: #92400e; }
.metric-list strong.danger { color: var(--red); }
.metric-list strong.good { color: var(--green); }
.metric-list small { display: block; color: var(--muted); line-height: 1.35; font-size: 12px; }

/* ── Score gauge (replaces score-ring) ── */
.score-gauge { padding: 4px 0 2px; }

.score-gauge-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.score-gauge-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 700;
  color: var(--muted);
}

.score-gauge-value {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
}

.score-gauge-track {
  width: 100%;
  height: 14px;
  background: #e9eef5;
  border-radius: 4px;
  overflow: hidden;
}

.score-gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .6s ease;
}

.score-gauge-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.score-caption { color: var(--muted); line-height: 1.5; font-size: 12.5px; }

/* ── Empty / zero state ── */
.empty {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: var(--muted);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  font-size: 13px;
}

/* ── Filters ── */
.filters .filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filters input { min-width: 300px; flex: 1; }
.table-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }

/* Audit Events toolbar: meta on the left, auto-refresh control on the right */
.events-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.events-toolbar .table-meta { margin: 0 auto 0 0; }   /* push the control group to the right edge */
.auto-refresh { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; color: var(--muted); white-space: nowrap; user-select: none; }
/* Override the global `.filters input { min-width:300px; flex:1 }` so the checkbox is a normal box */
.auto-refresh input[type="checkbox"] { width: 16px; height: 16px; min-width: 0; flex: none; margin: 0; accent-color: #10b981; cursor: pointer; }
.auto-refresh-interval { width: auto; min-width: 64px; flex: none; }

/* Button press + busy feedback (so a click on a slow action clearly registers) */
button:active:not(:disabled) { transform: translateY(1px); filter: brightness(0.92); }
button:disabled, button.busy { opacity: 0.65; cursor: wait; }
button.busy::after {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: vk-spin 0.7s linear infinite;
}
@keyframes vk-spin { to { transform: rotate(360deg); } }

/* Transient toast notifications (success/error confirmation) */
#toastHost { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { padding: 10px 14px; border-radius: 8px; font-size: 13px; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.35);
  opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; max-width: 360px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok { background: #16a34a; }
.toast-err { background: #dc2626; }

/* ── Tables ── */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }

th {
  text-align: left;
  color: #475569;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

td, th {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  vertical-align: top;
}

tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f8fafc; }

/* ── Pills ── */
.pill {
  display: inline-block;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 10.5px;
  font-weight: 700;
  margin: 1px;
  letter-spacing: .03em;
}

.pill.good { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.pill.warn { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.pill.danger { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }

/* ── Misc ── */
.table-action {
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
}

.download {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 9px 14px;
  font-weight: 600;
  font-size: 13px;
}

.download:hover { background: var(--navy2); }
.hidden { display: none !important }

/* ── Chart system ── */
.chart-frame {
  min-height: 275px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
  position: relative;
}

.chart-frame.chart-tall { min-height: 305px; }
.svg-chart { width: 100%; height: 100%; min-height: 245px; display: block; }

.chart-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.chart-chip {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 8px;
}

.chart-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.axis-label, .svg-label {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  fill: #64748b;
  font-size: 11.5px;
}

.svg-value {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  fill: var(--ink);
  font-weight: 700;
  font-size: 11.5px;
}

.grid-line { stroke: #e9eef5; stroke-width: 1; }
.trend-line { fill: none; stroke: var(--navy); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.trend-area { fill: url(#trendFill); opacity: .45; }
.trend-dot { fill: var(--teal); stroke: #fff; stroke-width: 2; }
.bar-bg { fill: #f1f5f9; }
.bar-fill { fill: url(#barFill); }
.donut-center { fill: #fff; }

.donut-total {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  fill: var(--ink);
  font-size: 26px;
  font-weight: 700;
  text-anchor: middle;
}

.donut-sub {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  fill: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-anchor: middle;
  text-transform: uppercase;
}

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 6px 12px;
  margin-top: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--steel);
  font-size: 12px;
  font-weight: 500;
}

.legend-dot { width: 9px; height: 9px; border-radius: 3px; }

/* ── Login page — two-panel enterprise layout ── */
.login-body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.login-shell {
  width: 100%;
  max-width: 940px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(8,15,30,.30);
}
.login-aside {
  position: relative;
  background: linear-gradient(155deg, #0a1628 0%, #0f2040 58%, #103a36 150%);
  color: #e8eef6;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  border-right: 3px solid var(--teal);
}
.login-aside::after {
  content: "";
  position: absolute; right: -50px; top: -50px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(13,125,116,.18);
}
.login-aside > * { position: relative; z-index: 1; }
.brand-logo-lg { width: 56px; height: 56px; border-radius: 14px; }
.brand-logo-lg svg { width: 54px; height: 54px; }
.login-aside-title { margin: 18px 0 4px; font-size: 28px; font-weight: 700; color: #fff; letter-spacing: .01em; }
.login-aside-sub { margin: 0; font-size: 13.5px; color: #aebfd6; line-height: 1.5; }
.login-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.login-points li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: #cdd9ea; line-height: 1.45; }
.login-points svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; color: #5dcaa5; }
.login-aside-foot { margin: 0; font-size: 11px; color: #7e93b2; letter-spacing: .06em; text-transform: uppercase; }
.login-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.login-badge { font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 5px; background: rgba(255,255,255,.08); color: #cdd9ea; border: 1px solid rgba(255,255,255,.16); }
.login-main { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.login-h { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--ink); }
.login-sub { margin: 0 0 20px; font-size: 13.5px; color: var(--muted); }
.login-form label { display: block; margin-bottom: 14px; font-size: 12.5px; font-weight: 600; color: var(--steel); }
.login-form input { width: 100%; margin-top: 6px; min-height: 42px; }
.login-submit { width: 100%; min-height: 44px; margin-top: 6px; font-size: 14px; }
.oidc-btn { display: block; text-align: center; margin-top: 12px; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600; font-size: 13px; color: var(--ink); text-decoration: none; }
.oidc-btn:hover { background: var(--bg); }
.footnote { font-size: 11.5px; color: var(--muted); margin-top: 18px; line-height: 1.5; }
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; max-width: 460px; }
  .login-aside { flex-direction: row; align-items: center; gap: 14px; padding: 20px 24px; border-right: 0; border-bottom: 3px solid var(--teal); }
  .login-aside-sub, .login-values, .login-aside-foot, .login-aside::after { display: none; }
  .login-aside-title { margin: 0; font-size: 20px; }
  .brand-logo-lg { width: 44px; height: 44px; }
  .login-main { padding: 30px 26px; }
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10,22,40,.62);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.modal.hidden { display: none !important }

.modal-card {
  width: min(1040px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 72px rgba(10,22,40,.32);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
}

.modal-card pre {
  background: var(--navy);
  color: #dbeafe;
  padding: 16px;
  border-radius: var(--radius);
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
  max-height: 65vh;
}

.modal-close {
  position: absolute;
  right: 16px;
  top: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  color: var(--steel);
  display: grid;
  place-items: center;
}

/* ── Filters grid ── */
.filters .filter-row {
  display: grid;
  grid-template-columns: minmax(240px,1.5fr) repeat(6, minmax(130px,1fr)) auto;
  gap: 8px;
  align-items: center;
}

.filters input, .filters select { min-height: 38px; }
.table-action { margin: 2px 2px 4px 0; }

/* ── Compliance table link ── */
.compliance-status { font-weight: 700; }

/* ── SecOps ── */
.secops-action { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.evidence-pack-panel { background: #fafcff; }

/* ── Misc ── */
.mt { margin-top: 12px; }

.panel pre {
  white-space: pre-wrap;
  background: var(--navy);
  color: #e5e7eb;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
}

/* ── Insight panel ── */
.insight-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: flex-start;
  padding: 6px;
}

.insight-total {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: var(--radius);
  padding: 14px 16px;
}

.insight-total span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .07em;
}

.insight-total strong {
  display: block;
  margin-top: 6px;
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
}

.zero-state {
  height: 100%;
  display: grid;
  place-items: center;
  line-height: 1.55;
  text-align: center;
  padding: 24px;
}

.zero-state strong { color: var(--ink); }

/* ── Responsive ── */
@media (max-width: 1350px) {
  .kpi-grid.executive { grid-template-columns: repeat(3, 1fr); }
  .findings-grid, .three { grid-template-columns: 1fr 1fr; }
  .status-strip.refined { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1300px) {
  .filters .filter-row { grid-template-columns: 1fr 1fr 1fr; }
  .filters .filter-row button { grid-column: auto; }
}

@media (max-width: 950px) {
  .topbar, .hero-card, .section-heading { flex-direction: column; align-items: flex-start; }
  .two, .two-one, .three, .findings-grid, .status-strip.refined, .kpi-grid.executive { grid-template-columns: 1fr; }
  .container, .topbar, .tabs { padding-left: 16px; padding-right: 16px; }
  .tabs { overflow-x: auto; }
  .filters input, .filters select, .filters button { width: 100%; min-width: 0; }
  .chart-frame { min-height: 240px; }
  .legend { grid-template-columns: 1fr; }
  .filters .filter-row { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   CyberOjas Niyantran brand — topbar + login (v2.6 UI uplift)
   ============================================================ */
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
}
.brand-logo svg { width: 40px; height: 40px; filter: drop-shadow(0 2px 8px rgba(255,157,46,.22)); }
.brand-name { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.1; color: #f8fafc; letter-spacing: .01em; }
.brand-sub { margin: 3px 0 0; font-size: 12.5px; font-weight: 500; color: #9fb3cd; }

/* Topbar right cluster + theme toggle */
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-divider { width: 1px; height: 30px; background: rgba(255,255,255,.14); flex: 0 0 auto; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16);
  color: #cbd5e1; border-radius: var(--radius); padding: 8px 12px;
  font-size: 12px; font-weight: 600; box-shadow: none; cursor: pointer;
}
.theme-toggle:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.28); color: #fff; }
.theme-toggle .theme-ic { display: inline-flex; }
.theme-toggle .theme-ic svg { width: 16px; height: 16px; display: block; }
@media (max-width: 950px) { .topbar-right { width: 100%; justify-content: space-between; margin-top: 12px; } }

/* Login brand mark replaces the old text "UCR" box */
.login-card { text-align: left; }
.login-card .brand-logo { width: 52px; height: 52px; border-radius: 12px; margin-bottom: 14px; }
.login-card .brand-logo svg { width: 50px; height: 50px; }
.login-card h1 { color: var(--ink); }
.alert { border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin: 10px 0 4px; }
.alert.danger { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red); }

/* Visible keyboard focus (WCAG 2.4.7) */
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
.tab:focus-visible { outline: 2px solid #3b82f6; outline-offset: -2px; }

/* Skip link (WCAG 2.4.1) — off-screen until keyboard-focused */
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--navy); color: #fff; padding: 10px 16px;
  border-radius: var(--radius); font-size: 13px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 8px; }
#main:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) { .skip-link { transition: top .15s ease; } }

/* Visually-hidden but exposed to assistive tech (chart data tables, etc.) */
.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ============================================================
   Audit-integrity trust banner — the evidence signal.
   States: verified / partial / tampered / unknown / loading.
   Wired to GET /api/integrity (see loadTrustBanner in dashboard.js).
   Verified copy stays "hash-chain verified" until Phase 2 signing
   populates seal/signature fields, at which point the JS upgrades
   the wording to "cryptographically signed & verified".
   ============================================================ */
.trust-banner {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-left: 4px solid var(--steel);
  border-radius: var(--radius-lg); padding: 13px 16px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.trust-banner .trust-icon { display: flex; flex: 0 0 auto; }
.trust-body { flex: 1; min-width: 0; }
.trust-title { display: block; font-size: 14px; font-weight: 700; line-height: 1.3; }
.trust-detail { display: block; font-size: 12.5px; margin-top: 2px; color: var(--muted); }
.trust-action { flex: 0 0 auto; white-space: nowrap; }
.trust-action[hidden] { display: none; }

.trust-loading { border-left-color: var(--steel); }
.trust-loading .trust-icon, .trust-loading .trust-title { color: var(--steel); }

.trust-verified { background: var(--green-bg); border-color: var(--green-border); border-left-color: #0d7d74; }
.trust-verified .trust-icon, .trust-verified .trust-title { color: var(--green); }
.trust-verified .trust-action { background: var(--green); border-color: var(--green); color: #fff; }

.trust-partial { background: var(--amber-bg); border-color: var(--amber-border); border-left-color: #d97706; }
.trust-partial .trust-icon, .trust-partial .trust-title { color: var(--amber); }
.trust-partial .trust-action { background: #92400e; border-color: #92400e; color: #fff; }

.trust-tampered { background: var(--red-bg); border-color: var(--red-border); border-left-color: #dc2626; }
.trust-tampered .trust-icon, .trust-tampered .trust-title { color: var(--red); }
.trust-tampered .trust-detail { color: #b91c1c; }
.trust-tampered .trust-action { background: #991b1b; border-color: #991b1b; color: #fff; }

.trust-unknown { border-left-color: var(--steel); }
.trust-unknown .trust-icon, .trust-unknown .trust-title { color: var(--steel); }

@media (prefers-reduced-motion: no-preference) {
  .trust-banner { transition: background .2s ease, border-color .2s ease; }
}

/* ============================================================
   Dark theme — token + component overrides, attribute-driven.
   The inline script in <head> sets html[data-theme] from the saved
   preference (or the OS setting when the preference is "system"); the
   in-app toggle (initTheme in dashboard.js) updates it. Chart palettes
   follow via the --chart-* variables.
   ============================================================ */
:root[data-theme="dark"] {
  --bg: #0b1220; --bg2: #111a2b; --ink: #e6edf6; --muted: #93a1b5; --panel: #111a2b; --line: #243044;
  --navy: #0e1a30; --navy2: #13233f; --steel: #c3cedd;
  --amber: #fbbf24; --amber-bg: #2a2110; --amber-border: #4a3a16;
  --red: #fca5a5; --red-bg: #2a1416; --red-border: #4a1f23;
  --green: #6ee7b7; --green-bg: #0f2a20; --green-border: #1c4a39;
  --shadow: 0 1px 4px rgba(0,0,0,.45), 0 6px 16px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --chart-grad-from: #5dcaa5; --chart-grad-to: #378add; --chart-area: #5dcaa5;
  --chart-1: #5dcaa5; --chart-2: #7dd3fc; --chart-3: #93b4ff; --chart-4: #fbbf24;
  --chart-5: #fca5a5; --chart-6: #67e8f9; --chart-7: #6ee7b7; --chart-8: #cbd5e1;
  color-scheme: dark;
}
[data-theme="dark"] .tabs { background: #0f1830; border-bottom-color: #243044; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
[data-theme="dark"] .tab { color: #93a1b5; }
[data-theme="dark"] .tab:hover { color: #e6edf6; background: #182338; }
[data-theme="dark"] .tab.active { color: #e6edf6; background: #10241f; }
[data-theme="dark"] .hero-card, [data-theme="dark"] .panel, [data-theme="dark"] .kpi, [data-theme="dark"] .status-card, [data-theme="dark"] .finding, [data-theme="dark"] .modal-card, [data-theme="dark"] .insight-total { background: #111a2b; }
[data-theme="dark"] .finding.warn { background: var(--amber-bg); } [data-theme="dark"] .finding.danger { background: var(--red-bg); } [data-theme="dark"] .finding.info { background: #10243a; }
[data-theme="dark"] .evidence-pack-panel { background: #0f1d22; }
[data-theme="dark"] button { background: #16213a; color: #c3cedd; border-color: #243044; }
[data-theme="dark"] button:hover { background: #1c2942; border-color: #33415a; }
[data-theme="dark"] button.primary, [data-theme="dark"] .download { background: #13233f; border-color: #13233f; color: #fff; }
[data-theme="dark"] button.primary:hover { background: #1b3358; }
[data-theme="dark"] input, [data-theme="dark"] select { background: #0f1830; color: #e6edf6; border-color: #243044; }
[data-theme="dark"] table { background: #111a2b; }
[data-theme="dark"] th { background: #0f1830; color: #9fb0c4; }
[data-theme="dark"] tr:hover td { background: #16213a; }
[data-theme="dark"] td, [data-theme="dark"] th { border-bottom-color: #243044; }
[data-theme="dark"] .table-wrap, [data-theme="dark"] .chart-frame { border-color: #243044; }
[data-theme="dark"] .chart-frame { background: #111a2b; }
[data-theme="dark"] .chart-chip { background: #16213a; color: #9fb0c4; border-color: #243044; }
[data-theme="dark"] .badge { background: #10243a; color: #9cc3f0; border-color: #1d3a5c; }
[data-theme="dark"] .badge-dark { background: #0e1a30; color: #cbd5e1; border-color: #0e1a30; }
[data-theme="dark"] .empty { background: #0f1830; border-color: #2c3a52; color: #93a1b5; }
[data-theme="dark"] .score-gauge-track { background: #1b2740; }
[data-theme="dark"] .modal { background: rgba(0,0,0,.66); }
[data-theme="dark"] .modal-card pre, [data-theme="dark"] .panel pre { background: #0a1322; color: #cdd9ea; }
[data-theme="dark"] .modal-close { background: #16213a; border-color: #243044; color: #c3cedd; }
/* user cluster is borderless on the navy topbar in both themes */
[data-theme="dark"] .grid-line { stroke: #243044; }
[data-theme="dark"] .trend-line { stroke: #5dcaa5; }
[data-theme="dark"] .trend-dot { fill: #5dcaa5; stroke: #111a2b; }
[data-theme="dark"] .bar-bg { fill: #1b2740; }
[data-theme="dark"] .donut-center { fill: #111a2b; }
[data-theme="dark"] .axis-label, [data-theme="dark"] .svg-label { fill: #93a1b5; }
[data-theme="dark"] .svg-value { fill: #e6edf6; }
[data-theme="dark"] .oidc-btn:hover { background: #16213a; }

/* ============================================================
   Print / report stylesheet — auditors print the active tab.
   Dark mode is screen-only (above), so print is always light.
   Hides interactive chrome, keeps brand + trust banner + data,
   repeats table headers, avoids breaking panels across pages.
   ============================================================ */
@media print {
  .tabs, .toolbar, .skip-link, .trust-action, .modal, .userbox a,
  #refreshBtn, #evidenceBtn, #filterBtn, #siemExportBtn, #webhookTestBtn { display: none !important; }
  body { background: #fff; }
  .topbar { padding: 16px 24px; }
  .container { padding: 12px 24px 0; }
  .panel, .kpi, .status-card, .finding, .hero-card, .trust-banner, .chart-frame, .table-wrap { box-shadow: none; break-inside: avoid; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  a[href]::after { content: ""; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
   Polish — tabular numerals, hit targets, skeletons, tab overflow
   ============================================================ */
.kpi .value, .metric-list strong, .score-gauge-value, .insight-total strong,
.donut-total, .svg-value, td { font-variant-numeric: tabular-nums; }

/* Larger hit target for inline table actions (WCAG 2.5.8) */
.table-action { min-height: 28px; font-size: 12px; }

/* Loading skeletons — seeded on first paint, replaced once data arrives */
.skeleton { position: relative; overflow: hidden; background: var(--line); border-radius: var(--radius-lg); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); }
@media (prefers-reduced-motion: no-preference) { .skeleton::after { animation: skshimmer 1.2s infinite; } }
@keyframes skshimmer { 100% { transform: translateX(100%); } }
.sk-kpi { height: 92px; }
.sk-status { height: 110px; }

/* Tab strip overflow affordance — fade the right edge when more tabs exist */
.tabs.is-scrollable { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.tabs.is-scroll-end { -webkit-mask-image: none; mask-image: none; }
