/* ═══════════════════════════════════════════════════════════
   DORA GRC v2 — Modern SaaS Design System
   Aesthetic: Linear / Notion / Vercel inspired
   Fonts: DM Sans · Space Grotesk · JetBrains Mono
   ═══════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Surfaces */
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface2: #f1f3f7;
  --surface-2: #f1f3f7;
  --surface-3: #e8ebf0;
  --elevated: #ffffff;

  /* Borders */
  --border: #e2e5eb;
  --border2: #d1d5dc;
  --border-2: #d1d5dc;
  --border-focus: #818cf8;

  /* Text */
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --muted: #9ca3af;
  --muted2: #6b7280;
  --text-inv: #ffffff;

  /* Accent — Indigo */
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-light: #eef2ff;
  --accent-mute: #c7d2fe;

  /* Semantic */
  --green: #059669;
  --green-bg: #ecfdf5;
  --green-soft: #ecfdf5;
  --green-mute: #a7f3d0;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --amber-soft: #fffbeb;
  --amber-mute: #fde68a;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-soft: #fef2f2;
  --red-mute: #fecaca;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --blue-soft: #eff6ff;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;

  /* Sidebar */
  --sidebar-bg: #0c111d;
  --sidebar-w: 232px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.16);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Typography */
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-head: 'Space Grotesk', var(--font);
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Pillar accent colours */
  --p2: #6d28d9;
  --p2-bg: #f5f3ff;
  --p2-border: #c4b5fd;
  --p4: #b45309;
  --p4-bg: #fffbeb;
  --p4-border: #fcd34d;
  --navy: #1a3a5c;
}

/* ── DARK MODE ── */
body.dark,
[data-theme='dark'] {
  --bg: #0a0d14;
  --surface: #12161f;
  --surface2: #1a1f2b;
  --surface-2: #1a1f2b;
  --surface-3: #242a38;
  --elevated: #1a1f2b;
  --border: #252b38;
  --border2: #333b4d;
  --border-2: #333b4d;
  --text: #f1f3f7;
  --text-2: #9ca3af;
  --text-3: #6b7280;
  --muted: #9ca3af;
  --muted2: #6b7280;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-soft: #1e1b4b;
  --accent-light: #1e1b4b;
  --accent-mute: #312e81;
  --green: #34d399;
  --green-bg: #052e16;
  --green-soft: #052e16;
  --green-mute: #064e3b;
  --amber: #fbbf24;
  --amber-bg: #451a03;
  --amber-soft: #451a03;
  --amber-mute: #78350f;
  --red: #f87171;
  --red-bg: #450a0a;
  --red-soft: #450a0a;
  --red-mute: #7f1d1d;
  --blue: #60a5fa;
  --blue-bg: #172554;
  --blue-soft: #172554;
  --purple: #a78bfa;
  --purple-soft: #1e1b4b;
  --sidebar-bg: #070a10;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
  --navy: #4a90c4;
  --p2: #a78bfa;
  --p2-bg: #1f1a2e;
  --p2-border: #6d5aad;
  --p4: #f59e0b;
  --p4-bg: #2a2000;
  --p4-border: #b45309;
}
body.dark .sidebar {
  background: #070a10;
}
body.dark .sidebar-logo {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
body.dark .modal {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
body.dark input,
body.dark select,
body.dark textarea {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}
body.dark .hm-cell {
  border-color: transparent;
}
body.dark img {
  opacity: 0.9;
}
body.dark .wiz-card-header {
  background: linear-gradient(135deg, #1a3050, #2a5080);
}
body.dark .topbar {
  background: rgba(18, 22, 31, 0.85);
}

/* ── RESET ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

/* ════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: width 0.25s var(--ease);
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo .logo-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  margin-bottom: 6px;
}

.sidebar-logo h1 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.sidebar-logo .pillar-badge {
  margin-top: 8px;
  display: inline-block;
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  padding: 3px 8px;
  border-radius: var(--r-sm);
}

/* Sidebar nav */
.sidebar-nav {
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  padding: 16px 18px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.nav-section-label:hover {
  color: rgba(255, 255, 255, 0.45);
}
.nav-section-label .nav-chevron {
  font-size: 8px;
  transition: transform 0.2s;
  opacity: 0.5;
}
.nav-section-label.collapsed .nav-chevron {
  transform: rotate(-90deg);
}
.nav-section-group {
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.nav-section-group.collapsed {
  max-height: 0 !important;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  margin: 1px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  font-weight: 400;
  position: relative;
  border-left: 2px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
}

.nav-item.active {
  background: rgba(79, 70, 229, 0.15);
  color: #a5b4fc;
  font-weight: 500;
  border-left-color: #818cf8;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #818cf8;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.7;
  text-align: center;
}

.nav-icon svg {
  flex-shrink: 0;
}
.nav-item.active .nav-icon {
  opacity: 1;
}

/* Nav badge counts (v85) */
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  padding: 0 5px;
  flex-shrink: 0;
}
.nav-item.active .nav-badge {
  background: rgba(129, 140, 248, 0.2);
  color: #a5b4fc;
}

/* Sidebar toggle */
.sidebar-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ════════════════════════════════════════════════════════════ */
.main {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  max-width: calc(100vw - var(--sidebar-w));
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  transition: margin-left 0.25s var(--ease), width 0.25s var(--ease), max-width 0.25s var(--ease);
}

/* Topbar */
.topbar {
  height: 52px;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.topbar-left .sep {
  color: var(--border2);
}
.topbar-left .current {
  color: var(--text);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  margin-right: 4px;
}

/* Content area */
.content {
  padding: 28px 32px;
  flex: 1;
  max-width: 1400px;
}

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface2);
  border-color: var(--border2);
}

.btn-ghost {
  background: none;
  color: var(--text-2);
  border: none;
  padding: 8px 12px;
}
.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red-mute);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--r-sm);
}

.btn .btn-icon {
  font-size: 15px;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.btn-export:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ════════════════════════════════════════════════════════════
   PAGE HEADER
   ════════════════════════════════════════════════════════════ */
.page-header {
  margin-bottom: 24px;
}

.page-header .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.page-header h2 {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  max-width: 680px;
  line-height: 1.6;
}

.page-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   STAT CARDS
   ════════════════════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stats-row.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}
.stats-row.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s var(--ease);
  cursor: default;
}

.stat-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.stat-card.blue::before {
  background: var(--accent);
}
.stat-card.green::before {
  background: var(--green);
}
.stat-card.amber::before {
  background: var(--amber);
}
.stat-card.red::before {
  background: var(--red);
}
.stat-card.purple::before {
  background: var(--purple);
}
.stat-card.navy::before {
  background: var(--navy);
}

.stat-card[data-nav] {
  cursor: pointer;
}
.stat-card[data-nav]:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 4px;
}
.stat-value.v-green {
  color: var(--green);
}
.stat-value.v-amber {
  color: var(--amber);
}
.stat-value.v-red {
  color: var(--red);
}
.stat-value.v-blue {
  color: var(--blue);
}
.stat-value.v-purple {
  color: var(--purple);
}

.stat-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: var(--r-full);
}
.stat-trend.up {
  background: var(--green-soft);
  color: var(--green);
}
.stat-trend.down {
  background: var(--red-soft);
  color: var(--red);
}
.stat-trend.flat {
  background: var(--surface2);
  color: var(--text-3);
}

/* QW5: stat-row inline stat bars */
.stat-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat-row .stat-card {
  flex: 1;
  min-width: 100px;
}
.stat-number {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
}

/* ════════════════════════════════════════════════════════════
   COMPLIANCE SCORE RING
   ════════════════════════════════════════════════════════════ */
.score-ring-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.score-ring {
  position: relative;
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}
.score-ring svg {
  transform: rotate(-90deg);
}
.score-ring .score-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.score-details h3 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.score-details p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.article-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.article-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.article-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.article-pill.ok {
  background: var(--green-bg);
  border-color: var(--green-mute);
  color: var(--green);
}
.article-pill.warn {
  background: var(--amber-bg);
  border-color: var(--amber-mute);
  color: var(--amber);
}
.article-pill.gap {
  background: var(--red-bg);
  border-color: var(--red-mute);
  color: var(--red);
}

/* ════════════════════════════════════════════════════════════
   CARDS & TABLES
   ════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 20px;
  transition: box-shadow 0.2s var(--ease);
}

/* QW1: Horizontal scroll for tables inside cards */
.card > table,
.card > div > table {
  min-width: 100%;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  left: 0;
}

.card-header h3 {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-header .article-ref,
.article-ref {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface2);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

/* Table — v85: auto layout with standardised column classes */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

/* Standardised column-width classes */
thead th.col-id      { width: 80px; }
thead th.col-check   { width: 36px; }
thead th.col-xs      { width: 50px; }
thead th.col-sm      { width: 80px; }
thead th.col-md      { width: 120px; }
thead th.col-date    { width: 100px; }
thead th.col-status  { width: 100px; }
thead th.col-actions { width: 70px; }

thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 22px;
}
thead th.no-sort {
  cursor: default;
  padding-right: 12px;
}

/* Resizable column drag handle */
thead th::before {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  cursor: col-resize;
  border-right: 1px solid transparent;
  transition: border-color 0.15s;
}
thead th:hover::before {
  border-right-color: var(--border);
}
thead th:last-child::before { display: none; }

thead th:hover {
  color: var(--text);
  background: var(--border);
}
thead th.no-sort:hover {
  color: var(--muted);
  background: var(--surface2);
}
thead th::after {
  content: '↕';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0.3;
}
thead th.no-sort::after { content: none; }
thead th.sort-asc::after {
  content: '↑';
  opacity: 0.7;
  color: var(--accent);
}
thead th.sort-desc::after {
  content: '↓';
  opacity: 0.7;
  color: var(--accent);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--surface2);
}
tbody td {
  padding: 11px 12px;
  font-size: 13px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}
/* Allow wrapping in cells with explicit class */
tbody td.wrap {
  white-space: normal;
  overflow: visible;
}

/* Compact mode for wide tables */
#risk-table td,
#asset-table td {
  padding: 8px 10px;
  font-size: 11px;
}
#risk-table th,
#asset-table th {
  padding: 8px 10px;
  font-size: 11px;
}
#risk-table th {
  white-space: nowrap;
}
#asset-table th {
  white-space: normal;
  word-break: break-word;
}
#asset-table th:nth-child(1) {
  width: 14%;
}
#asset-table th:nth-child(2) {
  width: 8%;
}
#asset-table th:nth-child(3) {
  width: 7%;
}
#asset-table th:nth-child(4) {
  width: 7%;
}
#asset-table th:nth-child(5) {
  width: 7%;
}
#asset-table th:nth-child(6) {
  width: 8%;
}
#asset-table th:nth-child(7) {
  width: 7%;
}
#asset-table th:nth-child(8) {
  width: 5%;
}
#asset-table th:nth-child(9) {
  width: 5%;
}
#asset-table th:nth-child(10) {
  width: 5%;
}
#asset-table th:nth-child(11) {
  width: 9%;
}
#asset-table th:nth-child(12) {
  width: 8%;
}
#asset-table th:nth-child(13) {
  width: 3%;
}
/* Risk table column widths — match asset table pattern */
#risk-table td:nth-child(2) {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table:has(> tbody#risk-table) {
  table-layout: fixed;
  width: 100%;
}
table:has(> tbody#risk-table) th:nth-child(1)  { width: 8%; }   /* Risk ID */
table:has(> tbody#risk-table) th:nth-child(2)  { width: 18%; }  /* Description */
table:has(> tbody#risk-table) th:nth-child(3)  { width: 8%; }   /* Category */
table:has(> tbody#risk-table) th:nth-child(4)  { width: 3%; }   /* L */
table:has(> tbody#risk-table) th:nth-child(5)  { width: 3%; }   /* I */
table:has(> tbody#risk-table) th:nth-child(6)  { width: 6%; }   /* Inherent */
table:has(> tbody#risk-table) th:nth-child(7)  { width: 6%; }   /* Residual */
table:has(> tbody#risk-table) th:nth-child(8)  { width: 10%; }  /* Owner */
table:has(> tbody#risk-table) th:nth-child(9)  { width: 7%; }   /* Treatment */
table:has(> tbody#risk-table) th:nth-child(10) { width: 10%; }  /* ICT System */
table:has(> tbody#risk-table) th:nth-child(11) { width: 8%; }   /* Next Review */
table:has(> tbody#risk-table) th:nth-child(12) { width: 7%; }   /* Risk Decision */
table:has(> tbody#risk-table) th:nth-child(13) { width: 6%; }   /* Actions */
/* Truncate long-text risk columns */
#risk-table td:nth-child(1),
#risk-table td:nth-child(8),
#risk-table td:nth-child(10) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#asset-table td:nth-child(1) {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Row actions on hover */
.row-actions {
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  gap: 4px;
}
tr:hover .row-actions {
  opacity: 1;
}

.row-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-3);
  transition: all 0.1s;
}
.row-action-btn:hover {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text);
}

/* QW3: Loading skeleton */
.skeleton-row td {
  position: relative;
  overflow: hidden;
}
.skeleton-row td::after {
  content: '';
  position: absolute;
  inset: 10px 16px;
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
.skeleton-stat {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  color: transparent !important;
}

/* QW4: Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state p {
  font-size: 13px;
  margin-bottom: 16px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}
.empty-state .btn {
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-family: var(--font);
  white-space: nowrap;
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
}
.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
}
.badge-red {
  background: var(--red-soft);
  color: var(--red);
}
.badge-blue {
  background: var(--blue-soft);
  color: var(--blue);
}
.badge-purple {
  background: var(--purple-soft);
  color: var(--purple);
}
.badge-grey {
  background: var(--surface2);
  color: var(--text-3);
  border: 1px solid var(--border);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Incident badges */
.badge-major {
  background: var(--red-bg);
  color: #991b1b;
  border: 1px solid var(--red-mute);
}
.badge-minor {
  background: var(--green-bg);
  color: #166534;
  border: 1px solid var(--green-mute);
}
.badge-open {
  background: #fff7ed;
  color: #c2410c;
}
.badge-contained {
  background: var(--blue-bg);
  color: var(--blue);
}
.badge-resolved {
  background: var(--green-bg);
  color: #166534;
}
.badge-closed {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ════════════════════════════════════════════════════════════
   PAGE TAB BAR
   ════════════════════════════════════════════════════════════ */
#page-tab-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: none;
  align-items: center;
  gap: 0;
  height: 42px;
  position: sticky;
  top: 52px;
  z-index: 49;
  overflow-x: auto;
  scrollbar-width: none;
}
#page-tab-bar::-webkit-scrollbar {
  display: none;
}

.page-tab {
  padding: 0 16px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: var(--font);
  flex-shrink: 0;
}
.page-tab:hover {
  color: var(--text);
  background: var(--surface2);
}
.page-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
body.dark .page-tab.active {
  color: #818cf8;
  border-bottom-color: #818cf8;
}

/* ════════════════════════════════════════════════════════════
   USER MENU DROPDOWN
   ════════════════════════════════════════════════════════════ */
.user-menu {
  position: relative;
}
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: background 0.15s;
}
.user-menu-trigger:hover {
  background: var(--surface2);
}
.user-menu-trigger .user-name {
  font-size: 11px;
  color: var(--muted);
}
.user-menu-trigger .user-role {
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}
.user-menu-trigger .user-caret {
  font-size: 8px;
  color: var(--muted2);
  transition: transform 0.15s;
}
.user-menu.open .user-caret {
  transform: rotate(180deg);
}
.user-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
}
.user-menu.open .user-menu-dropdown {
  display: block;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.1s;
  text-align: left;
}
.user-menu-item:hover {
  background: var(--surface2);
}
.user-menu-item.danger {
  color: var(--red);
}
.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

/* ════════════════════════════════════════════════════════════
   TOPBAR ICON BUTTONS
   ════════════════════════════════════════════════════════════ */
.topbar-icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
  transition: all 0.15s;
}
.topbar-icon-btn svg {
  flex-shrink: 0;
}
.topbar-icon-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface-3);
}

.dark-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--r-sm);
  transition: all 0.15s;
}
.dark-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ════════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 620px;
  max-width: 95vw;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: modal-enter 0.25s var(--ease);
}

/* Keep legacy alias: some HTML uses overflow-y:auto directly */
.modal-overlay.open .modal {
  overflow-y: auto;
}

@keyframes modal-enter {
  from {
    transform: translateY(20px) scale(0.97);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
/* Legacy alias */
@keyframes slideUp {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface2);
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-content {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════ */
.form-row {
  margin-bottom: 16px;
}
.form-group {
  margin-bottom: 18px;
}

.form-row label,
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-row label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.form-label .required {
  color: var(--red);
  margin-left: 2px;
}

.form-row input,
.form-row select,
.form-row textarea,
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: all 0.15s var(--ease);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-row textarea,
.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-grid-2,
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════
   ACTION ROW & SEARCH
   ════════════════════════════════════════════════════════════ */
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  max-width: 280px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  background: var(--surface);
  outline: none;
  color: var(--text);
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-bar select,
.filter-bar input {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 11px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  min-width: 110px;
}
.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--accent);
}
.filter-bar .filter-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.filter-bar .filter-reset {
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
}
.filter-bar .filter-reset:hover {
  color: var(--text);
}

/* ════════════════════════════════════════════════════════════
   PAGES
   ════════════════════════════════════════════════════════════ */
.page {
  display: none;
}
.page.active {
  display: block;
  animation: page-in 0.25s var(--ease);
}

.page-section {
  display: none;
}
.page-section.active {
  display: block;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Page tabs (within a page) */
.page-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.dashboard-grid .card {
  margin-bottom: 0;
}

/* ════════════════════════════════════════════════════════════
   PROGRESS BAR
   ════════════════════════════════════════════════════════════ */
.progress-inline {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-inline-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.4s;
}

/* ════════════════════════════════════════════════════════════
   REVIEW TIMELINE
   ════════════════════════════════════════════════════════════ */
.timeline {
  padding: 20px;
}
.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 30px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.timeline-dot.done {
  background: var(--green-bg);
  border-color: var(--green);
}
.timeline-dot.pending {
  background: var(--amber-bg);
  border-color: var(--amber);
}
.timeline-content {
  flex: 1;
  padding-top: 4px;
}
.timeline-content strong {
  font-size: 13px;
  font-weight: 600;
  display: block;
}
.timeline-content span {
  font-size: 11px;
  color: var(--muted);
}

/* ════════════════════════════════════════════════════════════
   FRAMEWORK DOMAIN ACCORDION
   ════════════════════════════════════════════════════════════ */
.domain-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  overflow: hidden;
}

.domain-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  border-bottom: 1px solid transparent;
}
.domain-header:hover {
  background: var(--surface2);
}
.domain-header.open {
  border-bottom-color: var(--border);
}

.domain-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.domain-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
}

.domain-article {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--r-sm);
}

.domain-progress {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

.domain-mini-bar {
  width: 80px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.domain-mini-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.4s;
}

.domain-toggle {
  font-size: 10px;
  color: var(--muted);
}
.domain-body {
  display: none;
}
.domain-body.open {
  display: block;
}

.component-row {
  display: grid;
  grid-template-columns: 28px 1fr 120px 100px 110px 110px 90px;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  transition: background 0.1s;
}
.component-row:last-child {
  border-bottom: none;
}
.component-row:hover {
  background: var(--surface2);
}

.component-row-header {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 8px 20px;
}

.comp-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted2);
  text-align: center;
}
.comp-name {
  font-weight: 500;
}
.comp-type-badge {
  display: inline-block;
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.status-select {
  font-family: var(--font);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  width: 100%;
}
.status-select:focus {
  outline: none;
  border-color: var(--accent);
}
.status-select.approved {
  background: var(--green-bg);
  border-color: var(--green-mute);
  color: var(--green);
}
.status-select.inprogress {
  background: var(--amber-bg);
  border-color: var(--amber-mute);
  color: var(--amber);
}
.status-select.gap {
  background: var(--red-bg);
  border-color: var(--red-mute);
  color: var(--red);
}

.owner-input,
.date-input {
  font-family: var(--font);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.date-input {
  font-family: var(--font-mono);
}
.owner-input:focus,
.date-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ════════════════════════════════════════════════════════════
   RISK SCORE & HEATMAP
   ════════════════════════════════════════════════════════════ */
.risk-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 12px;
  font-family: var(--font-mono);
}
.risk-low {
  background: var(--green-bg);
  color: var(--green);
}
.risk-med {
  background: var(--amber-bg);
  color: var(--amber);
}
.risk-high {
  background: #fff0e0;
  color: #c05600;
}
.risk-crit {
  background: var(--red-bg);
  color: var(--red);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 22px repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr) 22px;
  gap: 3px;
  width: 100%;
}

.hm-cell {
  height: 58px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  cursor: default;
  transition:
    transform 0.12s,
    box-shadow 0.12s;
  position: relative;
  overflow: visible;
  border: 2px solid transparent;
}
.hm-cell[style*='cursor: pointer']:hover {
  transform: scale(1.07);
  z-index: 10;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.hm-label {
  background: none;
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  text-align: center;
  border: none !important;
}
.hm-label.y-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  height: 58px;
}

/* Zone fill colours */
.hm-1 {
  background: #dcfce7;
  color: #166534;
}
.hm-2 {
  background: #bbf7d0;
  color: #166534;
}
.hm-3 {
  background: #fef9c3;
  color: #854d0e;
}
.hm-4 {
  background: #fed7aa;
  color: #9a3412;
}
.hm-5 {
  background: #fecaca;
  color: #991b1b;
}

/* Appetite zone borders */
.hm-app-accept {
  border-color: #16a34a;
}
.hm-app-review {
  border-color: #d97706;
}
.hm-app-escalate {
  border-color: #dc2626;
}

.hm-score-label {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

.hm-count {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: rgba(0, 0, 0, 0.55);
  line-height: 1;
  pointer-events: none;
}

.hm-dot {
  position: absolute;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(26, 58, 92, 0.88);
  color: #fff;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.1s;
  z-index: 2;
}
.hm-dot:hover {
  transform: scale(1.2);
  z-index: 5;
}

.hm-dot-pending {
  position: absolute;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(100, 116, 139, 0.2);
  border: 1.5px dashed #94a3b8;
  color: #64748b;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
}
.hm-dot-pending:hover {
  transform: scale(1.2);
  z-index: 5;
}

/* ════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s var(--ease-spring);
}
.toast.success {
  background: var(--green);
}
.toast.error {
  background: var(--red);
}
.toast.info {
  background: var(--accent);
}

@keyframes toast-in {
  from {
    transform: translateY(16px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ════════════════════════════════════════════════════════════
   NOTIFICATIONS PANEL
   ════════════════════════════════════════════════════════════ */
.notif-wrap {
  position: relative;
}
#notif-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 5px 9px;
  font-size: 15px;
  line-height: 1;
  color: var(--text);
  transition: background 0.15s;
  display: flex;
  align-items: center;
  position: relative;
}
#notif-btn:hover {
  background: var(--surface2);
}
#notif-badge {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  border: 2px solid var(--surface);
}
#notif-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  max-height: 480px;
  overflow-y: auto;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.notif-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
}
.notif-close-btn:hover {
  background: var(--surface2);
  color: var(--text);
}
.notif-group-label {
  padding: 10px 16px 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.notif-item {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.notif-item:hover {
  background: var(--surface2);
}
.notif-item:last-of-type {
  border-bottom: none;
}
.notif-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.notif-item-msg {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.notif-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted2);
  white-space: nowrap;
}
.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.notif-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

/* ════════════════════════════════════════════════════════════
   PILLAR ACCENT STRIP
   ════════════════════════════════════════════════════════════ */
.pillar-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.pillar-strip.p2 {
  background: var(--p2-bg);
  border: 1px solid var(--p2-border);
  color: var(--p2);
}
.pillar-strip.p4 {
  background: var(--p4-bg);
  border: 1px solid var(--p4-border);
  color: var(--p4);
}
.pillar-strip .strip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pillar-strip.p2 .strip-dot {
  background: var(--p2);
}
.pillar-strip.p4 .strip-dot {
  background: var(--p4);
}

/* ════════════════════════════════════════════════════════════
   CLASSIFICATION WIZARD
   ════════════════════════════════════════════════════════════ */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.wizard-step {
  flex: 1;
  padding: 12px 16px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  border-right: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.wizard-step:last-child {
  border-right: none;
}
.wizard-step.active {
  background: var(--p2-bg);
  color: var(--p2);
  font-weight: 600;
}
.wizard-step.done {
  background: var(--green-bg);
  color: var(--green);
}
.wizard-step .step-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 2px;
}

.criterion-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.criterion-card.triggered {
  border-color: var(--red-mute);
  background: #fff8f8;
}
.criterion-card.clear {
  border-color: var(--green-mute);
  background: #f8fff8;
}

.criterion-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}
.criterion-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.criterion-card.triggered .criterion-num {
  background: #fee2e2;
  border-color: var(--red-mute);
  color: var(--red);
}
.criterion-card.clear .criterion-num {
  background: #dcfce7;
  border-color: var(--green-mute);
  color: var(--green);
}

.criterion-name {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}
.criterion-threshold {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  max-width: 200px;
  text-align: right;
}
.criterion-status {
  font-size: 18px;
  flex-shrink: 0;
}
.criterion-body {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  display: none;
}
.criterion-body.open {
  display: block;
}

/* Verdict panel */
.verdict-panel {
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-top: 20px;
  border: 2px solid;
  display: flex;
  align-items: center;
  gap: 16px;
}
.verdict-panel.major {
  background: var(--red-bg);
  border-color: var(--red-mute);
}
.verdict-panel.minor {
  background: var(--green-bg);
  border-color: var(--green-mute);
}
.verdict-panel.pending {
  background: var(--surface2);
  border-color: var(--border);
}
.verdict-icon {
  font-size: 36px;
  flex-shrink: 0;
}
.verdict-text h3 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
}
.verdict-text p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Report timeline (incident stages) */
.report-timeline {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
}
.rt-stage {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-right: none;
  background: var(--surface);
  position: relative;
}
.rt-stage:first-child {
  border-radius: var(--r-lg) 0 0 var(--r-lg);
}
.rt-stage:last-child {
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  border-right: 1px solid var(--border);
}
.rt-stage.active {
  background: var(--p2-bg);
  border-color: var(--p2-border);
  z-index: 1;
}
.rt-stage.done {
  background: var(--green-bg);
  border-color: var(--green-mute);
}
.rt-stage .rt-label {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rt-stage .rt-deadline {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  margin: 4px 0 2px;
}
.rt-stage.active .rt-deadline {
  color: var(--p2);
}
.rt-stage.done .rt-deadline {
  color: var(--green);
}
.rt-stage .rt-sub {
  font-size: 11px;
  color: var(--muted);
}

/* ════════════════════════════════════════════════════════════
   PROVIDER & CONTRACT COMPONENTS
   ════════════════════════════════════════════════════════════ */
.risk-tier {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
}
.tier-cif {
  background: var(--red-bg);
  color: #991b1b;
  border: 1px solid var(--red-mute);
}
.tier-standard {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.tier-ctpp {
  background: #fdf4ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

.clause-meter {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}
.clause-pip {
  width: 14px;
  height: 6px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s;
}
.clause-pip.filled {
  background: var(--green);
}
.clause-pip.warn {
  background: var(--amber);
}
.clause-pip.missing {
  background: var(--red);
}

/* Concentration matrix */
.conc-matrix-wrap {
  overflow-x: auto;
  padding: 20px;
}
.conc-matrix {
  border-collapse: collapse;
  min-width: 500px;
  width: 100%;
}
.conc-matrix th {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--muted);
  padding: 8px 10px;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.conc-matrix th.row-header {
  text-align: left;
  width: 180px;
}
.conc-matrix td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: center;
  font-size: 11px;
  vertical-align: middle;
}
.conc-matrix td.cif-name {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  background: var(--surface2);
}
.conc-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.conc-0 {
  background: none;
  color: var(--muted2);
}
.conc-1 {
  background: #dcfce7;
  color: #166534;
}
.conc-2 {
  background: #fef9c3;
  color: #854d0e;
}
.conc-3 {
  background: #fed7aa;
  color: #9a3412;
}
.conc-4 {
  background: #fecaca;
  color: #991b1b;
}
.conc-5 {
  background: #f3e8ff;
  color: #7e22ce;
}

/* ════════════════════════════════════════════════════════════
   INFO BOX
   ════════════════════════════════════════════════════════════ */
.info-box {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 12px;
  margin-bottom: 20px;
}
.info-box.info {
  background: var(--blue-bg);
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}
.info-box.warn {
  background: var(--amber-bg);
  border: 1px solid var(--amber-mute);
  color: #92400e;
}
.info-box.crit {
  background: var(--red-bg);
  border: 1px solid var(--red-mute);
  color: #991b1b;
}
.info-box-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ════════════════════════════════════════════════════════════
   DETAIL GRID
   ════════════════════════════════════════════════════════════ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ════════════════════════════════════════════════════════════
   WIZARD STEP PILLS (Risk Assessment)
   ════════════════════════════════════════════════════════════ */
.wiz-card-header {
  background: linear-gradient(135deg, var(--accent), #2e75b6);
  padding: 16px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.wiz-card-header .step-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #bfd7ed;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.wiz-card-header h3 {
  color: #fff;
  margin: 0;
}
.wiz-card-header .step-desc {
  font-size: 12px;
  color: #bfd7ed;
  margin-top: 2px;
}
.wiz-card-header .article-ref {
  color: #bfd7ed;
  border-color: rgba(191, 215, 237, 0.25);
}

.wiz-step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.wiz-step-pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.wiz-step-pill.done {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green);
}
.wiz-step-pill.inactive {
  background: var(--surface2);
  color: var(--muted);
  border-color: var(--border);
}
.wiz-step-pill .pill-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
}
.wiz-step-pill.active .pill-num {
  background: #fff;
  color: var(--navy);
}
.wiz-step-pill.done .pill-num {
  background: var(--green);
  color: #fff;
}
.wiz-step-pill.inactive .pill-num {
  background: var(--border);
  color: var(--muted);
}
.wiz-step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 12px;
}
.wiz-imp-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1.5px solid var(--border2);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  transition: all 0.15s;
}
.wiz-imp-btn span {
  font-size: 9px;
  font-weight: 400;
  display: block;
  color: var(--muted);
}
.wiz-imp-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.wiz-imp-btn.selected {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}
.wiz-imp-btn.selected span {
  color: #bfd7ed;
}
.wiz-threat-card {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  background: var(--bg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.wiz-threat-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.wiz-threat-card.selected {
  border-color: var(--navy);
  background: var(--accent-light);
}
.wiz-threat-card .tc-title {
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text);
}
.wiz-threat-card .tc-sub {
  font-size: 10px;
  color: var(--muted);
}
.wiz-threat-card .tc-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--muted);
  margin-top: 1px;
}
.wiz-threat-card.selected .tc-check {
  color: var(--navy);
  font-weight: 700;
}
.wiz-threat-group {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.wiz-threat-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface2);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.wiz-threat-group-header:hover {
  background: var(--border);
}
.wiz-group-chevron {
  font-size: 11px;
  color: var(--muted);
  width: 14px;
  text-align: center;
}
.wiz-threat-group-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 12px;
}
.wiz-vuln-chip {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s;
  background: var(--bg);
  user-select: none;
}
.wiz-vuln-chip:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.wiz-vuln-chip.selected {
  border-color: #c05621;
  background: #fef3c7;
  color: #92400e;
}
.wiz-ctrl-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: var(--r-lg);
}

/* ════════════════════════════════════════════════════════════
   SLIDE-OVER PANEL
   ════════════════════════════════════════════════════════════ */
.slideover-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 200;
  transition: opacity 0.2s;
}
.slideover-overlay.open {
  display: block;
}
.slideover {
  position: fixed;
  top: 0;
  right: -520px;
  bottom: 0;
  width: 520px;
  max-width: 95vw;
  background: var(--surface);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
  z-index: 201;
  transition: right 0.3s var(--ease);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.slideover-overlay.open .slideover {
  right: 0;
}
.slideover-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.slideover-header h3 {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
}
.slideover-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.slideover-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
/* Collapsible field sections */
.field-section {
  margin-bottom: 18px;
}
.field-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.field-section-header h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0;
}
.field-section-header .fs-chevron {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s;
}
.field-section-header.collapsed .fs-chevron {
  transform: rotate(-90deg);
}
.field-section-body {
  transition: max-height 0.25s ease;
  overflow: hidden;
}
.field-section-body.collapsed {
  max-height: 0 !important;
}

/* ════════════════════════════════════════════════════════════
   BATCH OPERATIONS
   ════════════════════════════════════════════════════════════ */
.batch-cb {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}
thead .batch-cb-all {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}
.batch-bar {
  display: none;
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--r-lg);
  margin: 12px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 500;
  animation: batchSlideUp 0.2s ease;
}
.batch-bar.visible {
  display: flex;
}
@keyframes batchSlideUp {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.batch-bar .batch-count {
  font-weight: 700;
  font-family: var(--font-mono);
}
.batch-bar .btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}
.batch-bar .btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.batch-bar .batch-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
}

/* ════════════════════════════════════════════════════════════
   COMBOBOX
   ════════════════════════════════════════════════════════════ */
.combobox-wrap {
  position: relative;
  width: 100%;
}
.combobox-wrap input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}
.combobox-wrap input:focus {
  border-color: var(--accent);
}
.combobox-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  max-height: 200px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.combobox-list.open {
  display: block;
}
.combobox-opt {
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.combobox-opt:hover {
  background: var(--surface2);
}
.combobox-opt.active {
  background: var(--accent-light);
}
.combobox-opt .cb-sub {
  font-size: 10px;
  color: var(--muted);
}
.combobox-empty {
  padding: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ════════════════════════════════════════════════════════════
   TREND CHARTS
   ════════════════════════════════════════════════════════════ */
.trend-chart-wrap {
  padding: 16px 20px;
}
.trend-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.trend-chart-header h4 {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}
.trend-chart-header .trend-label {
  font-size: 10px;
  color: var(--muted);
}
.trend-canvas {
  width: 100%;
  height: 80px;
  display: block;
}

/* ════════════════════════════════════════════════════════════
   COMPLIANCE STAT FILTER CARDS
   ════════════════════════════════════════════════════════════ */
.comp-stat-filter-card {
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.1s,
    box-shadow 0.15s;
}
.comp-stat-filter-card:hover {
  border-color: var(--accent) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.comp-stat-filter-card.active-filter {
  border-color: var(--accent) !important;
  box-shadow:
    0 0 0 3px rgba(79, 70, 229, 0.15),
    var(--shadow-md);
}

/* ════════════════════════════════════════════════════════════
   KEYBOARD ACCESSIBILITY
   ════════════════════════════════════════════════════════════ */
.nav-item:focus-visible,
.btn:focus-visible,
.page-tab:focus-visible,
.domain-header:focus-visible,
.article-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
[role='button'] {
  cursor: pointer;
}

/* ════════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════════ */
@keyframes fade-up {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.animate-in {
  animation: fade-up 0.4s var(--ease) backwards;
}
.delay-1 {
  animation-delay: 0.05s;
}
.delay-2 {
  animation-delay: 0.1s;
}
.delay-3 {
  animation-delay: 0.15s;
}
.delay-4 {
  animation-delay: 0.2s;
}
.delay-5 {
  animation-delay: 0.25s;
}
.delay-6 {
  animation-delay: 0.3s;
}

/* ════════════════════════════════════════════════════════════
   COMMAND PALETTE (Cmd+K)
   ════════════════════════════════════════════════════════════ */
.cmd-palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 500;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20vh;
}
.cmd-palette-overlay.open {
  display: flex;
}
.cmd-palette {
  width: 520px;
  max-width: 95vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modal-enter 0.2s var(--ease);
}
.cmd-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cmd-palette-input-wrap .cmd-icon {
  color: var(--text-3);
  font-size: 18px;
  flex-shrink: 0;
}
.cmd-palette-input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  outline: none;
}
.cmd-palette-input::placeholder {
  color: var(--text-3);
}
.cmd-palette-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.cmd-item:hover,
.cmd-item.active {
  background: var(--surface-2);
}
.cmd-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.cmd-item.active .cmd-item-icon {
  background: var(--accent-soft);
}
.cmd-item-text {
  flex: 1;
}
.cmd-item-title {
  font-size: 13px;
  font-weight: 500;
}
.cmd-item-desc {
  font-size: 11px;
  color: var(--text-3);
}
.cmd-item-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.cmd-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 10px 20px 4px;
}
.cmd-palette-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-3);
}
.cmd-palette-footer kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin-right: 4px;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE / MOBILE
   ════════════════════════════════════════════════════════════ */
.mobile-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: background 0.15s;
}
.mobile-hamburger:hover {
  background: var(--surface2);
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    z-index: 200;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  .mobile-hamburger {
    display: block;
  }
  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
    transition: opacity 0.25s;
  }
  .mobile-overlay.open {
    display: block;
  }
  .nav-item {
    padding: 11px 20px;
  }
  .content {
    padding: 20px 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-row.cols-5 {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-row.cols-3 {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .pillar-progress-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .form-grid,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .stats-row,
  .stats-row.cols-5 {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .pillar-progress-grid {
    grid-template-columns: 1fr !important;
  }
  .score-ring-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
  .form-grid-2,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .topbar-date {
    display: none;
  }
  .modal {
    max-width: 100vw;
    border-radius: 0;
    max-height: 100vh;
  }
  .slideover {
    width: 100vw;
    max-width: 100vw;
  }
  .page-header-top {
    flex-direction: column;
  }
  .page-actions {
    align-self: flex-start;
  }
}

/* Sidebar collapsed: wider screens only */
@media (min-width: 1025px) {
  body.sidebar-collapsed .sidebar {
    width: 56px;
  }
  body.sidebar-collapsed .sidebar-logo h1,
  body.sidebar-collapsed .sidebar-logo .pillar-badge,
  body.sidebar-collapsed .sidebar-logo .logo-tag,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .sidebar-footer {
    display: none !important;
  }
  body.sidebar-collapsed .sidebar-logo {
    padding: 16px 8px;
    text-align: center;
    flex-direction: column;
    align-items: center !important;
    gap: 8px;
  }
  body.sidebar-collapsed .sidebar-logo > div:first-child {
    justify-content: center;
  }
  body.sidebar-collapsed .sidebar-toggle {
    transform: rotate(180deg);
  }
  body.sidebar-collapsed .nav-item {
    padding: 10px 0;
    justify-content: center;
    font-size: 0;
    border-left: none;
    gap: 0;
  }
  body.sidebar-collapsed .nav-item .nav-icon {
    font-size: 17px;
    width: auto;
  }
  body.sidebar-collapsed .nav-section-group {
    max-height: none !important;
  }
  body.sidebar-collapsed .main {
    margin-left: 56px;
    width: calc(100% - 56px);
    max-width: calc(100vw - 56px);
  }
  body.sidebar-collapsed .sidebar-collapse-label {
    display: none;
  }
  body.sidebar-collapsed .nav-badge {
    display: none;
  }
  /* Tooltip on hover in collapsed mode */
  body.sidebar-collapsed .nav-item {
    position: relative;
  }
  body.sidebar-collapsed .nav-item:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;
    background: #1e1e2e;
    color: #e2e8f0;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
}

/* ── Inline form validation (v84) ── */
.form-field-error input,
.form-field-error select,
.form-field-error textarea {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}
.field-error-msg {
  color: var(--red);
  font-size: 0.78rem;
  margin-top: 2px;
  display: block;
}

/* ── Print styles (v84) ── */
@media print {
  .sidebar,
  .topbar,
  .mobile-overlay,
  .toast,
  .modal-overlay,
  .slideover-overlay,
  .batch-bar,
  .dark-toggle {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 16px !important;
  }
  .page.active {
    display: block !important;
  }
  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }
  table {
    font-size: 10pt;
  }
  body {
    background: white !important;
    color: black !important;
  }
}
