/* ==========================================================================
   Audit & Compliance Portal — Design System
   Palette: deep slate-navy + teal accent (trust / precision / security)
   Type: Inter (UI) + JetBrains Mono (certificate numbers, codes, data)
   ========================================================================== */

:root {
  --navy-900: #14213A;
  --navy-800: #1C2E4A;
  --navy-700: #29406A;
  --teal-500: #0EA5A0;
  --teal-600: #0C8B87;
  --teal-050: #E6F7F6;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --border: #E4E7EC;
  --text: #1F2430;
  --text-muted: #6B7280;
  --success: #16A34A;
  --success-bg: #E9F8EF;
  --warning: #D97706;
  --warning-bg: #FDF3E3;
  --danger: #DC2626;
  --danger-bg: #FCE9E8;
  --info: #2563AA;
  --info-bg: #E9F1FB;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 33, 58, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 33, 58, 0.08);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
}

a { color: var(--teal-600); text-decoration: none; }
a:hover { color: var(--navy-800); }

h1, h2, h3, h4, h5 {
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

.mono { font-family: var(--font-mono); }

/* ---------------- App shell (staff) ---------------- */

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 19px; margin: 0; }
.topbar .subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.content { padding: 26px 28px 60px; }

/* ---------------- Client portal topbar shell ---------------- */

.client-topbar {
  background: var(--navy-900);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.client-topbar .brand { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.client-topbar .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal-500); }
.client-topbar nav a { color: #C9D3E3; font-size: 13.6px; font-weight: 500; margin-left: 22px; }
.client-topbar nav a:hover, .client-topbar nav a.active { color: #fff; }
.client-wrap { max-width: 980px; margin: 0 auto; padding: 30px 20px 60px; }

/* ---------------- Staff portal topbar shell (mirrors client-topbar) ---------------- */

.staff-topbar {
  background: var(--navy-900);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 80;
}
.staff-topbar .brand { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.staff-topbar .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal-500); }
.staff-nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.staff-nav > a, .topnav-dropdown > button {
  padding: 9px 12px;
  border-radius: 7px;
  color: #C9D3E3;
  font-size: 13.6px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  white-space: nowrap;
}
.staff-nav > a:hover, .topnav-dropdown > button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.staff-nav > a.active { background: rgba(14,165,160,0.16); color: #fff; }
.topnav-dropdown { position: relative; }
.topnav-dropdown.has-active > button { background: rgba(14,165,160,0.16); color: #fff; }
.topnav-dropdown > button .chev { font-size: 9px; transition: transform 0.15s ease; }
.topnav-dropdown.open > button .chev { transform: rotate(180deg); }
.topnav-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: var(--navy-800);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 9px;
  min-width: 210px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  padding: 6px;
  z-index: 200;
}
.topnav-dropdown.open .topnav-dropdown-panel { display: block; }
.topnav-dropdown-panel a { display: block; padding: 9px 12px; border-radius: 6px; color: #C9D3E3; font-size: 13.4px; margin-left: 0; }
.topnav-dropdown-panel a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.topnav-dropdown-panel a.active { background: rgba(14,165,160,0.16); color: #fff; }
.staff-topbar .staff-utils { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.staff-topbar .staff-utils .role-pill {
  display: inline-block;
  background: rgba(14,165,160,0.18);
  color: var(--teal-500);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 20px;
}
.staff-topbar .staff-utils a { color: #C9D3E3; font-size: 13.4px; }
.staff-topbar .staff-utils a:hover { color: #fff; }

.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #C9D3E3;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.mobile-nav-toggle:hover { background: rgba(255,255,255,0.08); color: #fff; }
.topbar-search { width: 180px; }
.topbar-search .form-control { width: 100%; }

/* Hamburger <-> X, driven by .mobile-nav-open on the ancestor topbar. */
.ham-line { transition: transform 0.22s ease, opacity 0.16s ease; transform-origin: 12px 12px; }
.staff-topbar.mobile-nav-open .ham-line-1, .client-topbar.mobile-nav-open .ham-line-1 { transform: translateY(6px) rotate(45deg); }
.staff-topbar.mobile-nav-open .ham-line-2, .client-topbar.mobile-nav-open .ham-line-2 { opacity: 0; }
.staff-topbar.mobile-nav-open .ham-line-3, .client-topbar.mobile-nav-open .ham-line-3 { transform: translateY(-6px) rotate(-45deg); }

/* Small leading icons for the mobile stacked menu only — desktop's
   horizontal bar stays exactly as it was, icons are hidden there. */
.nav-icon { display: none; flex-shrink: 0; opacity: 0.75; }
.mobile-only-label { display: none; }

/* Same icon markup (nav_icon()) reused as a plain heading accent
   outside the nav — e.g. "License" / "Two-Factor Authentication" card
   titles — where it should always show, not just on mobile. */
.icon-heading .nav-icon { display: inline-flex; opacity: 1; width: 17px; height: 17px; }

/* ---------------- Cards / surfaces ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.card-header-row h3 { font-size: 15.5px; margin: 0; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
}
.stat-card .stat-label { color: var(--text-muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--navy-900); margin-top: 6px; font-family: var(--font-mono); }
.stat-card .stat-value.accent { color: var(--teal-600); }
.stat-card .stat-value.warn { color: var(--warning); }

/* Clickable variant — a <a> styled as a stat-card, with a colored left
   accent per category and a hover lift so it visibly reads as
   interactive rather than a plain number tile. */
a.stat-card {
  display: block;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
a.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20,33,58,0.1); }
a.stat-card::after {
  content: '\2192';
  position: absolute;
  top: 16px; right: 16px;
  color: var(--border);
  font-size: 15px;
  transition: color 0.12s ease, transform 0.12s ease;
}
a.stat-card:hover::after { color: var(--teal-500); transform: translateX(2px); }
.stat-card.c-teal   { border-left-color: var(--teal-500); }
.stat-card.c-blue   { border-left-color: #3B82F6; }
.stat-card.c-amber  { border-left-color: var(--warning); }
.stat-card.c-red    { border-left-color: var(--danger); }
.stat-card.c-purple { border-left-color: #8B5CF6; }
.stat-card.c-green  { border-left-color: #22C55E; }

/* ---------------- Badges ---------------- */

.badge-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-muted   { background: #EEF0F3; color: #566072; }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }

/* ---------------- Tables ---------------- */

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.6px; }
table.data-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
}
table.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #FBFCFD; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 13.6px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--teal-500); color: #fff; }
.btn-primary:hover { background: var(--teal-600); color: #fff; }
.btn-navy { background: var(--navy-800); color: #fff; }
.btn-navy:hover { background: var(--navy-900); color: #fff; }
.btn-outline { background: #fff; color: var(--navy-800); border-color: var(--border); }
.btn-outline:hover { border-color: var(--navy-700); }
.btn-danger { background: #fff; color: var(--danger); border-color: #F3C9C6; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------- Forms ---------------- */

.form-group { margin-bottom: 16px; }
label.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--navy-900); margin-bottom: 6px; }
.form-control, select.form-control, textarea.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13.8px;
  font-family: var(--font-ui);
  background: #fff;
  color: var(--text);
}
.form-control:focus, select.form-control:focus, textarea.form-control:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(14,165,160,0.14);
}
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 8px; padding: 6px 0; }

/* ---------------- Alerts / flashes ---------------- */

.alert { padding: 12px 16px; border-radius: 8px; font-size: 13.6px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: #146334; border-color: #BEE7CD; }
.alert-danger  { background: var(--danger-bg); color: #8F2A26; border-color: #F3C9C6; }
.alert-info    { background: var(--info-bg); color: #1D4E8C; border-color: #C7DBF4; }
.alert-warning { background: var(--warning-bg); color: #93590A; border-color: #F3DDA8; }

/* ---------------- Auth pages ---------------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 55%, var(--teal-600) 150%);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 14px;
  padding: 34px 32px;
  box-shadow: var(--shadow-md);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal-500); display: inline-block; margin-inline-end: 8px; }
.auth-brand span { font-weight: 700; font-size: 17px; color: var(--navy-900); }

/* ---------------- Misc ---------------- */

.text-muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state h3 { color: var(--navy-800); font-size: 16px; margin-bottom: 6px; }

.sig-pad-wrap { border: 1.5px dashed var(--border); border-radius: 10px; background: #FCFCFD; }
canvas#sigPad { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }

.timeline { border-left: 2px solid var(--border); margin-left: 6px; padding-left: 20px; }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -25.5px;
  top: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal-500);
}
.timeline-item .t-action { font-size: 13.4px; font-weight: 600; color: var(--navy-900); }
.timeline-item .t-meta { font-size: 12px; color: var(--text-muted); }

@media (max-width: 1130px) {
  html, body { max-width: 100vw; overflow-x: hidden; }

  /* ---- Topbar: collapse into a hamburger-triggered stacked panel ----
     Using flex-wrap so the two sections (nav, then utils) stack in
     normal document order — avoids the overlap that two independently
     absolutely-positioned siblings would cause. */
  .staff-topbar, .client-topbar { flex-wrap: wrap; padding: 0 14px; gap: 10px; height: auto; min-height: 60px; }
  .mobile-nav-toggle { display: block; }
  .staff-topbar nav.staff-nav,
  .staff-topbar .staff-utils,
  .client-topbar nav {
    display: none;
  }
  .staff-topbar.mobile-nav-open nav.staff-nav,
  .staff-topbar.mobile-nav-open .staff-utils,
  .client-topbar.mobile-nav-open nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    flex-basis: 100%;
    width: 100%;
    order: 2;
    padding-bottom: 4px;
  }
  .staff-topbar.mobile-nav-open .staff-utils {
    order: 3;
    padding-top: 10px;
    margin-top: 2px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .topbar-search { width: 100%; order: -1; margin-bottom: 6px; }
  .staff-nav > a, .client-topbar nav > a,
  .staff-nav > .topnav-dropdown, .client-topbar nav > .topnav-dropdown { width: 100%; margin-left: 0; }
  .staff-nav > a, .client-topbar nav > a { padding: 9px 12px; display: flex; align-items: center; gap: 10px; }
  .staff-nav .topnav-dropdown > button, .client-topbar .topnav-dropdown > button {
    width: 100%; justify-content: flex-start; gap: 10px;
  }
  .staff-nav .topnav-dropdown-panel, .client-topbar nav .topnav-dropdown-panel { position: static; box-shadow: none; margin-top: 0; width: 100%; }
  .staff-nav .topnav-dropdown-panel a, .client-topbar nav .topnav-dropdown-panel a { padding-left: 38px; }
  .nav-icon { display: inline-flex; }
  .lang-switch {
    align-self: stretch; margin-top: 6px; padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .staff-utils .notif-bell, .client-topbar nav > a.notif-bell {
    width: 100%; height: auto; justify-content: flex-start; padding: 9px 12px; border-radius: 7px;
  }
  .mobile-only-label { display: inline; margin-left: 10px; }
  .staff-utils .notif-bell .badge-count, .client-topbar nav > a.notif-bell .badge-count {
    position: static; margin-left: 8px;
  }

  .content { padding: 18px; }

  /* ---- Tables: scroll within their own card instead of blowing out page width ---- */
  .card { overflow-x: auto; }
  .data-table { min-width: 480px; }

  /* ---- Any inline grid-template-columns (e.g. 320px 1fr detail layouts) stacks too ---- */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }

  /* ---- Modals: full-width with margin instead of a fixed desktop width ---- */
  .modal-box { width: calc(100vw - 32px); max-width: 440px; max-height: calc(100vh - 48px); overflow-y: auto; }

  /* ---- Stat cards / page-actions wrap cleanly ---- */
  .page-actions { flex-wrap: wrap; }
}

@media (max-width: 520px) {
  .auth-card { width: calc(100vw - 32px); padding: 24px 20px; }
  .card-header-row { flex-wrap: wrap; gap: 8px; }
}

/* ---------------- Small layout utilities ---------------- */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 26px 0 10px; }
.section-title:first-child { margin-top: 0; }

/* ---------------- Tabs ---------------- */

.tabs-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13.6px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font-ui);
}
.tab-btn:hover { color: var(--navy-800); }
.tab-btn.active { color: var(--teal-600); border-bottom-color: var(--teal-500); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Grouped dropdown tabs — reuses .topnav-dropdown/.topnav-dropdown-panel
   (same JS from initTopNavDropdowns) but light-themed for a white
   .tabs-bar instead of the navy staff topbar. The group button toggles
   the panel only; the .tab-btn elements inside it drive the actual tab
   switch via the normal initTabs() wiring, then the panel closes. */
.tabs-bar { flex-wrap: wrap; align-items: center; }
.tabs-bar .topnav-dropdown > button {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13.6px;
  padding: 10px 12px;
  border-radius: 0;
}
.tabs-bar .topnav-dropdown > button:hover { background: none; color: var(--navy-800); }
.tabs-bar .topnav-dropdown.has-active > button { color: var(--teal-600); }
.tabs-bar .topnav-dropdown-panel {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.tabs-bar .topnav-dropdown-panel .tab-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 6px;
  border-bottom: none;
  margin-bottom: 0;
  font-weight: 500;
}
.tabs-bar .topnav-dropdown-panel .tab-btn:hover { background: var(--bg); }
.tabs-bar .topnav-dropdown-panel .tab-btn.active { background: var(--teal-050); color: var(--teal-600); }

/* ---------------- Multi-select dropdown (compliance types etc.) ---------------- */

.msdd { position: relative; }
.msdd-toggle {
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  font-size: 13.8px;
  font-family: var(--font-ui);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.msdd-toggle:focus, .msdd.open .msdd-toggle { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(14,165,160,0.14); }
.msdd-toggle .chev { color: var(--text-muted); font-size: 11px; }
.msdd-toggle .placeholder { color: #9CA3AF; }
.msdd-panel {
  display: none;
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
}
.msdd.open .msdd-panel { display: block; }
.msdd-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.6px;
  cursor: pointer;
}
.msdd-option:hover { background: #F5F7FA; }
.msdd-option input { pointer-events: none; }

/* ---------------- Notification bell ---------------- */

.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: inherit;
}
.notif-bell:hover { background: rgba(255,255,255,0.08); }
.notif-bell .badge-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 20px;
  min-width: 15px;
  text-align: center;
}
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--teal-050); }
.notif-item .n-title { font-weight: 600; font-size: 13.6px; color: var(--navy-900); }
.notif-item .n-msg { font-size: 12.8px; color: var(--text-muted); margin-top: 2px; }
.notif-item .n-meta { font-size: 11.5px; color: #9CA3AF; margin-top: 4px; }

/* ---------------- Page action bar (buttons live at the top, not scattered) ---------------- */

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 16px;
}

/* ---------------- Modal (Add/Create forms open here instead of eating page space) ---------------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 33, 58, 0.55);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  animation: modalIn 0.15s ease-out;
}
.modal-box.modal-wide { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: 12px 12px 0 0;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close {
  cursor: pointer;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg); color: var(--navy-900); }
.modal-body { padding: 22px; }
