:root {
  --maroon: #1A2332;
  --maroon-dark: #111B27;
  --maroon-light: #243344;
  --orange: #C9A84C;
  --orange-light: #D4B96A;
  --red-dark: #1A2D45;
  --cream: #F5F4F0;
  --off-white: #EDEAE2;
  --gray-light: #E0DCD2;
  --gray-mid: #9A9590;
  --gray-text: #5A5550;
  --black: #0F1923;
  --risk-low: #1E8449;
  --risk-med: #B7950B;
  --risk-orange: #D4521A;
  --risk-high: #D4521A;
  --risk-crit: #922B21;
  --shadow: 0 2px 16px rgba(107,29,59,0.10);
  --shadow-lg: 0 8px 40px rgba(107,29,59,0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--black);
  min-height: 100vh;
}

/* ── TOP NAV ── */
.topnav {
  background: var(--maroon);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}
.topnav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
}
.topnav-logo {
  height: 38px;
  display: block;
}
.topnav-title {
  font-family: 'EB Garamond', serif;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  opacity: 0.92;
}
.topnav-badge {
  background: var(--orange);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* ── LAYOUT ── */
.shell {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* ── SIDEBAR ── */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--maroon-dark);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
}
.sidebar-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  padding: 1rem 1.5rem 0.5rem;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  color: rgba(255,255,255,0.65);
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}
.sidebar-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-item.active {
  background: rgba(212,82,26,0.18);
  color: #fff;
  border-left-color: var(--orange);
  font-weight: 600;
}
.sidebar-item .doc-num {
  width: 22px; height: 22px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-item.active .doc-num { background: var(--orange); }
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 0.75rem 1.5rem; }
.sidebar-ontic {
  margin-top: auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.ontic-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}
.ontic-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #F39C12;
  flex-shrink: 0;
}
.ontic-dot.connected { background: #27AE60; }

/* ── MAIN CONTENT ── */
.main {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 960px;
}

/* ── DASHBOARD ── */
.dashboard-hero {
  background: linear-gradient(135deg, var(--maroon) 0%, var(--maroon-dark) 60%, #2A0D1C 100%);
  border-radius: 12px;
  padding: 2.5rem;
  color: #fff;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.dashboard-hero::before {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(212,82,26,0.15);
}
.dashboard-hero::after {
  content: '';
  position: absolute;
  right: 40px; bottom: -60px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(212,82,26,0.08);
}
.hero-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--orange-light);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.hero-title {
  font-family: 'EB Garamond', serif;
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}
.hero-sub {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.6);
  max-width: 480px;
  line-height: 1.5;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ── CARDS ── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.doc-card {
  background: #fff;
  border: 1px solid var(--gray-light);
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: var(--shadow);
}
.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--maroon-light);
}
.doc-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.doc-badge {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.doc-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--black);
  line-height: 1.3;
}
.doc-card-sub {
  font-size: 0.75rem;
  color: var(--gray-text);
  line-height: 1.4;
  margin-bottom: 1rem;
}
.doc-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.doc-code {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gray-mid);
  text-transform: uppercase;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--maroon); color: #fff; }
.btn-primary:hover { background: var(--maroon-light); }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-light); }
.btn-outline {
  background: transparent;
  color: var(--maroon);
  border: 1.5px solid var(--maroon);
}
.btn-outline:hover { background: var(--maroon); color: #fff; }
.btn-ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.22); }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.75rem; }
.btn-danger { background: var(--risk-high); color: #fff; }

/* ── FORM PAGES ── */
.form-page { display: none; }
.form-page.active { display: block; }

.form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-light);
}
.form-header-left {}
.form-doc-code {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--orange);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.form-title {
  font-family: 'EB Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--maroon);
}
.form-subtitle {
  font-size: 0.8rem;
  color: var(--gray-text);
  margin-top: 0.2rem;
}
.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

/* ── FORM SECTIONS ── */
.form-section {
  background: #fff;
  border: 1px solid var(--gray-light);
  border-radius: 10px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.section-heading {
  background: var(--maroon);
  color: #fff;
  padding: 0.6rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-heading.alert {
  background: #7B1D1D;
  border-left: 4px solid #E53E3E;
}
.section-body { padding: 1.25rem; }

/* ── FORM FIELDS ── */
.field-grid {
  display: grid;
  gap: 0.85rem;
}
.field-grid-2 { grid-template-columns: 1fr 1fr; }
.field-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.field-grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.field-group { display: flex; flex-direction: column; gap: 0.3rem; }
.field-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--maroon);
  text-transform: uppercase;
}
.field-input {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--black);
  background: var(--off-white);
  border: 1.5px solid var(--gray-light);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  width: 100%;
  transition: border-color 0.15s, background 0.15s;
}
.field-input:focus {
  outline: none;
  border-color: var(--maroon);
  background: #fff;
}
.field-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B1D3B' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}

/* ── RISK SELECTOR ── */
.risk-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.risk-option { display: none; }
.risk-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  border-radius: 7px;
  border: 2px solid var(--gray-light);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-text);
  text-align: center;
  gap: 0.25rem;
}
.risk-label .risk-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-bottom: 0.15rem;
}
.risk-option:checked + .risk-label {
  border-width: 2.5px;
  background: #fff;
}
#risk_low:checked + .risk-label { border-color: var(--risk-low); color: var(--risk-low); background: #F0FFF4; }
#risk_med:checked + .risk-label { border-color: var(--risk-med); color: var(--risk-med); background: #FFFBF0; }
#risk_high:checked + .risk-label { border-color: var(--risk-high); color: var(--risk-high); background: #FFF5F5; }
#risk_crit:checked + .risk-label { border-color: var(--risk-crit); color: var(--risk-crit); background: #FFF0F0; }

/* ── DYNAMIC TABLE ── */
.dynamic-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.dynamic-table th {
  background: var(--maroon);
  color: #fff;
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dynamic-table td {
  padding: 0.3rem 0.4rem;
  border-bottom: 1px solid var(--gray-light);
  background: var(--off-white);
}
.dynamic-table tr:nth-child(even) td { background: #fff; }
.dynamic-table td input, .dynamic-table td select {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  border: none;
  background: transparent;
  width: 100%;
  padding: 0.2rem 0.3rem;
  color: var(--black);
}
.dynamic-table td input:focus, .dynamic-table td select:focus {
  outline: 1px solid var(--maroon);
  border-radius: 3px;
  background: #fff;
}
.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--maroon);
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  border: 1px dashed var(--maroon);
  background: transparent;
  transition: all 0.15s;
}
.add-row-btn:hover { background: var(--maroon); color: #fff; }

/* ── CHECKBOXES ── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--black);
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  transition: background 0.12s;
}
.checkbox-item:hover { background: var(--off-white); }
.checkbox-item input[type=checkbox] {
  width: 14px; height: 14px;
  accent-color: var(--maroon);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── ONTIC PANEL ── */
.ontic-panel {
  background: linear-gradient(135deg, #0D1B2A 0%, #1B3A5C 100%);
  border-radius: 10px;
  padding: 1.5rem;
  color: #fff;
  margin-bottom: 1.5rem;
}
.ontic-panel-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #C8A96E;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.ontic-panel-desc {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.ontic-config { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.ontic-field label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.ontic-field input {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  padding: 0.45rem 0.75rem;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
}
.ontic-field input::placeholder { color: rgba(255,255,255,0.3); }
.ontic-field input:focus { outline: none; border-color: #C8A96E; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  background: var(--maroon-dark);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(120%);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-left: 4px solid var(--orange);
  max-width: 340px;
}
.toast.show { transform: translateY(0); }
.toast.success { border-left-color: var(--risk-low); }
.toast.error { border-left-color: var(--risk-high); }
.toast.info { border-left-color: var(--gray-text); }

/* ── Inactivity session warning ─────────────────────────────── */
#session-warning {
  display: none;
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1a0a12;
  border: 1px solid var(--orange);
  color: #fff;
  padding: 0.8rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  display: none;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
}
#session-warning.visible {
  display: flex;
}
#session-warning button {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
#session-warning button:hover { opacity: 0.88; }

/* ── Onboarding overlay panel ───────────────────────────────── */
.onboarding-panel {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  padding: 2.5rem 2.25rem 2rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  margin: 2rem 1rem;
}
.onboarding-logo {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--maroon);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.onboarding-rule {
  height: 2px;
  background: var(--orange);
  width: 2.5rem;
  border-radius: 2px;
  margin-bottom: 1.4rem;
}
.onboarding-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--maroon-dark, #3d0f21);
  margin: 0 0 0.3rem;
}
.onboarding-sub {
  font-size: 0.84rem;
  color: var(--gray-text);
  margin: 0 0 1.75rem;
}
.onboarding-field {
  margin-bottom: 1.1rem;
}
.onboarding-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-text);
  margin-bottom: 0.38rem;
}
.onboarding-field input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  background: #faf9f7;
  transition: border-color 0.15s;
}
.onboarding-field input:focus {
  outline: none;
  border-color: var(--maroon);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(107,29,59,0.1);
}
.onboarding-req { color: var(--risk-high); margin-left: 0.15rem; }
.onboarding-opt {
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gray-text);
  margin-left: 0.3rem;
}
.onboarding-err {
  color: var(--risk-high);
  font-size: 0.8rem;
  min-height: 1.1em;
  margin-bottom: 0.75rem;
}
.onboarding-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--maroon);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s;
}
.onboarding-btn:hover:not(:disabled) { background: var(--maroon-light); }
.onboarding-btn:disabled { opacity: 0.55; cursor: default; }
.onboarding-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
}
.onboarding-footer span { color: rgba(255,255,255,0.45); }
.onboarding-footer button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 0.73rem;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  margin-top: 0.35rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* ── Admin modal ────────────────────────────────────────────── */
#admin-user-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,14,20,0.72);
  backdrop-filter: blur(3px);
  z-index: 1200;
  align-items: center;
  justify-content: center;
}
#admin-user-modal.open { display: flex; }
.admin-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 440px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.admin-modal-box h3 {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}
.admin-modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--gray-text);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
}
.admin-modal-close:hover { color: var(--text); }
.admin-form-group {
  margin-bottom: 1.1rem;
}
.admin-form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-text);
  margin-bottom: 0.4rem;
}
.admin-form-group input,
.admin-form-group select {
  width: 100%;
  box-sizing: border-box;
  background: var(--input-bg, #f7f5f2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text);
}
.admin-form-group input:focus,
.admin-form-group select:focus {
  outline: none;
  border-color: var(--maroon);
  box-shadow: 0 0 0 2px rgba(107,29,59,0.12);
}
.admin-form-check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.admin-form-check input[type=checkbox] { width: auto; margin: 0; cursor: pointer; }
.admin-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.75rem;
}
.admin-modal-err {
  color: var(--risk-high);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  min-height: 1.1em;
}
/* deactivate button in user table */
.btn-deactivate {
  background: transparent;
  border: 1px solid var(--risk-high);
  color: var(--risk-high);
  border-radius: 5px;
  padding: 0.25rem 0.65rem;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.btn-deactivate:hover { background: var(--risk-high); color: #fff; }
.btn-deactivate:disabled { opacity: 0.45; cursor: default; }

/* ── Account / password settings ────────────────────────────── */
.account-section {
  max-width: 520px;
}
.account-section + .account-section {
  margin-top: 0;   /* form-section handles spacing */
}
.pw-strength {
  height: 3px;
  border-radius: 2px;
  margin-top: 0.4rem;
  background: #e0ddd8;
  overflow: hidden;
}
.pw-strength-bar {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width 0.25s, background 0.25s;
}
.pw-strength-label {
  font-size: 0.7rem;
  color: var(--gray-text);
  margin-top: 0.25rem;
}


/* ── AUTH OVERLAY ── */
#auth-overlay {
  position:fixed;inset:0;background:rgba(10,14,20,0.92);
  z-index:9999;display:flex;align-items:center;justify-content:center;
}
#auth-overlay.hidden { display:none; }
.auth-spinner {
  width:40px;height:40px;border:3px solid rgba(201,168,76,0.2);
  border-top-color:var(--orange);border-radius:50%;
  animation:spin 0.7s linear infinite;
}

/* ── SESSION BAR (replaces topnav-badge) ── */
.session-bar {
  display:flex;align-items:center;gap:0.75rem;
}
.session-user {
  font-size:0.75rem;color:rgba(255,255,255,0.65);
}
.session-role-badge {
  font-size:0.62rem;font-weight:700;letter-spacing:0.1em;
  padding:2px 9px;border-radius:12px;text-transform:uppercase;
}
.role-agent { background:rgba(30,132,73,0.3);color:#6FCF97; }
.role-ep_manager { background:rgba(201,168,76,0.25);color:var(--orange-light); }
.role-director { background:rgba(212,82,26,0.3);color:#F2994A; }
.role-admin { background:rgba(107,29,59,0.4);color:#EB5757; }
.btn-signout {
  font-size:0.72rem;color:rgba(255,255,255,0.45);
  background:transparent;border:none;cursor:pointer;padding:0.2rem 0.4rem;
  border-radius:4px;transition:color 0.15s;
}
.btn-signout:hover { color:#fff; }

/* ── RBAC GUARDS ── */
.rbac-hidden { display:none !important; }

/* ── SAVE STATUS ── */
.save-status {
  position:fixed;bottom:1rem;left:50%;transform:translateX(-50%);
  background:var(--maroon-dark);color:#fff;
  padding:0.4rem 1rem;border-radius:20px;
  font-size:0.75rem;font-weight:500;
  border:1px solid rgba(201,168,76,0.3);
  opacity:0;transition:opacity 0.25s;
  z-index:998;pointer-events:none;
}
.save-status.show { opacity:1; }

/* ── OPERATIONS DRAWER ── */
#ops-drawer {
  display:none;position:fixed;top:64px;left:260px;right:0;bottom:0;
  background:rgba(10,14,20,0.6);z-index:500;
}
#ops-drawer.open { display:block; }
.ops-panel {
  position:absolute;top:0;left:0;width:420px;height:100%;
  background:var(--cream);box-shadow:4px 0 24px rgba(0,0,0,0.3);
  display:flex;flex-direction:column;overflow:hidden;
}
.ops-panel-header {
  background:var(--maroon);color:#fff;padding:1rem 1.25rem;
  display:flex;align-items:center;justify-content:space-between;
}
.ops-panel-header h3 {
  font-family:'EB Garamond',serif;font-size:1.1rem;font-weight:400;
}
.ops-list { flex:1;overflow-y:auto;padding:0.75rem; }
.ops-item {
  background:#fff;border:1px solid var(--gray-light);border-radius:8px;
  padding:0.85rem 1rem;margin-bottom:0.5rem;cursor:pointer;
  transition:all 0.15s;
}
.ops-item:hover { border-color:var(--maroon);box-shadow:0 2px 8px rgba(0,0,0,0.1); }
.ops-item-name { font-weight:600;font-size:0.88rem;color:var(--black); }
.ops-item-meta { font-size:0.75rem;color:var(--gray-text);margin-top:0.2rem; }
.ops-empty { text-align:center;padding:2rem;color:var(--gray-text);font-style:italic;font-size:0.85rem; }

/* ── PRINT ── */
@media print {
  /* Hide chrome */
  .topnav, .sidebar, .form-actions, .add-row-btn, .btn { display: none !important; }
  /* Hide footer nav entirely — not just its buttons */
  .form-footer-nav { display: none !important; }
  /* Explicitly hide inactive form pages — don't rely on screen stylesheet carrying through */
  .form-page { display: none !important; }
  .form-page.active { display: block !important; }
  .main { padding: 0; max-width: 100%; }
  .shell { display: block; }
  .form-section { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* ── SITE ASSESSMENT ITEMS ── */
.sa-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.4rem;
  background: var(--off-white);
  border: 1px solid var(--gray-light);
  transition: all 0.15s;
}
.sa-item.hidden { display: none; }
.sa-item.status-flagged { background: #FFF5F5; border-color: #CB4335; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sa-item.status-monitor { background: #FFFBF0; border-color: #D68910; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sa-item.status-ok      { background: #F0FFF4; border-color: #1E8449; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sa-item.status-na { background: var(--off-white); border-color: var(--gray-light); opacity: 0.5; }
.sa-item-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sa-item-text {
  flex: 1;
  font-size: 0.85rem;
  color: var(--black);
  line-height: 1.4;
}
.sa-item-tags {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.sa-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  background: var(--gray-light);
  color: var(--gray-text);
}
.sa-status-btns {
  display: flex;
  gap: 0.25rem;
}
.sa-btn {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1.5px solid var(--gray-light);
  background: #fff;
  cursor: pointer;
  transition: all 0.12s;
  color: var(--gray-text);
  letter-spacing: 0.04em;
}
.sa-btn:hover { border-color: var(--maroon); color: var(--maroon); }
.sa-btn.active-flagged { background: #CB4335; border-color: #CB4335; color: #fff; }
.sa-btn.active-monitor { background: #D68910; border-color: #D68910; color: #fff; }
.sa-btn.active-ok { background: #1E8449; border-color: #1E8449; color: #fff; }
.sa-btn.active-na { background: var(--gray-text); border-color: var(--gray-text); color: #fff; }
.sa-note {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--black);
  background: #fff;
  border: 1px solid var(--gray-light);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  width: 100%;
  margin-top: 0.2rem;
  display: none;
}
.sa-note.visible { display: block; }
.sa-note:focus { outline: none; border-color: var(--maroon); }

/* ── AI REPORT GENERATOR ── */
.ai-panel {
  background: linear-gradient(135deg, #1A0A10 0%, #2E0D20 60%, #1A1210 100%);
  border-radius: 12px;
  padding: 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(212,82,26,0.3);
  position: relative;
  overflow: hidden;
}
.ai-panel::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(212,82,26,0.08);
}
.ai-panel-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--orange-light);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.ai-panel-heading {
  font-family: 'EB Garamond', serif;
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}
.ai-panel-desc {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
  max-width: 520px;
}
.report-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.report-type-card {
  background: #0F1923;
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.report-type-card:hover, .report-type-card.selected {
  border-color: var(--orange);
  background: rgba(212,82,26,0.18);
}
.report-type-card .rt-icon { font-size: 1.5rem; margin-bottom: 0.3rem; display: flex; justify-content: center; color: rgba(255,255,255,0.8); }
.report-type-card .rt-name { font-size: 0.8rem; font-weight: 700; color: rgba(255,255,255,0.92); }
.report-type-card .rt-sub { font-size: 0.68rem; color: rgba(255,255,255,0.65); margin-top: 0.15rem; }

.ai-output-box {
  background: #fff;
  border: 1px solid var(--gray-light);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ai-output-header {
  background: var(--maroon);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ai-output-body {
  padding: 1.5rem;
  min-height: 200px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--black);
  white-space: pre-wrap;
}
.ai-output-body.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-text);
  font-style: italic;
  min-height: 160px;
}
.ai-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.4rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-generating { opacity: 0.6; font-style: italic; }

/* ── THREAT INTEL MODULE ── */
.threat-hero {
  background: linear-gradient(135deg, #0A1A1A 0%, #0D2B2B 60%, #0A1510 100%);
  border-radius: 12px;
  padding: 2rem;
  color: #fff;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(30,132,132,0.25);
  position: relative;
  overflow: hidden;
}
.threat-hero::before {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(30,132,132,0.1);
}
.threat-hero-title {
  font-family: 'EB Garamond', serif;
  font-size: 1.6rem;
  margin-bottom: 0.3rem;
}
.threat-hero-sub {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  max-width: 480px;
}
.threat-search-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.threat-search-row input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
}
.threat-search-row input::placeholder { color: rgba(255,255,255,0.35); }
.threat-search-row input:focus { outline: none; border-color: #3BADA0; }

.threat-score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.threat-score-card {
  background: #fff;
  border: 1px solid var(--gray-light);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.threat-score-card .ts-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-text);
  margin-bottom: 0.5rem;
}
.threat-score-card .ts-score {
  font-family: 'EB Garamond', serif;
  font-size: 2.8rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.threat-score-card .ts-sublabel {
  font-size: 0.72rem;
  color: var(--gray-text);
}
.ts-low { color: var(--risk-low); }
.ts-med { color: var(--risk-med); }
.ts-high { color: var(--risk-high); }
.ts-crit { color: var(--risk-crit); }
.ts-neutral { color: var(--gray-text); }

.threat-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.threat-matrix-table th {
  background: #0D2B2B;
  color: #fff;
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.threat-matrix-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--gray-light);
  background: var(--off-white);
  vertical-align: middle;
}
.threat-matrix-table tr:nth-child(even) td { background: #fff; }
.risk-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 20px;
  color: #fff;
}
.pill-low { background: var(--risk-low); }
.pill-med { background: var(--risk-med); }
.pill-high { background: var(--risk-high); }
.pill-crit { background: var(--risk-crit); }
.pill-unk { background: var(--gray-mid); }

.threat-narrative {
  background: #fff;
  border: 1px solid var(--gray-light);
  border-radius: 10px;
  padding: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--black);
  box-shadow: var(--shadow);
  white-space: pre-wrap;
}
.threat-disclaimer {
  font-size: 0.7rem;
  color: var(--gray-text);
  font-style: italic;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--off-white);
  border-radius: 5px;
  border-left: 3px solid var(--gray-mid);
}
.threat-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-text);
  font-style: italic;
}
.threat-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-light);
  margin-bottom: 1.25rem;
}
.threat-tab {
  padding: 0.5rem 1.1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-text);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.threat-tab:hover { color: var(--maroon); }
.threat-tab.active { color: var(--maroon); border-bottom-color: var(--maroon); }


/* ── FORM FOOTER NAV ── */
.form-footer-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1.5rem 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--gray-light);
  background: var(--off-white);
  border-radius: 0 0 12px 12px;
}
.form-footer-nav .btn { min-width: 140px; justify-content: center; }
.form-footer-nav .btn-ghost { 
  margin-right: auto; 
  color: var(--maroon);
  border-color: var(--maroon);
  font-weight: 600;
}

/* ══════════════════════════════════════
   EP REPORT RENDERER STYLES
══════════════════════════════════════ */
.ep-report {
  font-family: 'DM Sans', sans-serif;
  background: #fff;
  color: #1A1612;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 32px rgba(0,0,0,0.12);
}

/* Cover */
.epr-cover {
  background: linear-gradient(135deg, #111B27 0%, #1A2D45 100%);
  color: #fff;
  padding: 2.5rem 2.5rem 2rem;
  border-bottom: 4px solid #C9A84C;
}
.epr-logo { height: 42px; margin-bottom: 1.5rem; object-fit: contain; }
.epr-cover-title {
  font-family: 'EB Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #C9A84C;
  margin-bottom: 0.4rem;
}
.epr-cover-op {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}
.epr-cover-meta { display: grid; gap: 0.4rem; margin-bottom: 1.25rem; }
.epr-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 0.35rem;
}
.epr-meta-row span:first-child {
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.55);
  font-size: 0.68rem;
}
.epr-risk-summary {
  background: rgba(255,255,255,0.07);
  border-left: 3px solid #C9A84C;
  padding: 0.75rem 1rem;
  font-size: 0.83rem;
  line-height: 1.65;
  border-radius: 0 4px 4px 0;
  color: rgba(255,255,255,0.88);
}

/* Annexes */
.epr-annex { border-bottom: 1px solid #E0DCD2; }
.epr-annex:last-of-type { border-bottom: none; }
.epr-annex-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #1A2332;
  color: #fff;
  padding: 0.75rem 1.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.epr-annex-letter {
  background: #C9A84C;
  color: #111B27;
  font-weight: 800;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.epr-annex-body { padding: 1.25rem 1.5rem; }

/* Tables */
.epr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}
.epr-table thead tr { background: #F5F4F0; }
.epr-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #5A5550;
  border-bottom: 2px solid #E0DCD2;
}
.epr-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #EDEAE2;
  vertical-align: top;
  line-height: 1.5;
}
.epr-table tr:last-child td { border-bottom: none; }
.epr-table tr:hover td { background: #FAFAF8; }

/* KV grids */
.epr-kv-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.5rem; margin-bottom: 0.75rem; }
.epr-kv {
  background: #F5F4F0;
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  font-size: 0.78rem;
}
.epr-kv span:first-child {
  display: block;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #9A9590;
  margin-bottom: 0.2rem;
}
.epr-kv span:last-child { font-weight: 500; color: #1A1612; }

/* Narrative text */
.epr-narrative {
  font-size: 0.83rem;
  line-height: 1.75;
  color: #2A2520;
  margin: 0.5rem 0;
}
.intel-narrative {
  background: #F5F8FF;
  border-left: 3px solid #1A2332;
  padding: 0.85rem 1rem;
  border-radius: 0 6px 6px 0;
}

/* Subheadings */
.epr-subhead {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #9A9590;
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #E0DCD2;
}

/* Risk Pills */
.rp {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.rp-low { background: #D4EDDA; color: #155724; }
.rp-mod { background: #FFF9C4; color: #7B6000; }
.rp-high { background: #FFE4CC; color: #8B3A00; }
.rp-crit { background: #F8D7DA; color: #721C24; }
.rp-unknown { background: #E0DCD2; color: #5A5550; }

/* Tier badges */
.tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.tier-tier-1 { background: #C9A84C; color: #111B27; }
.tier-tier-2 { background: #243344; color: #fff; }
.tier-tier-3 { background: #9A9590; color: #fff; }

/* Session badges */
.session-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
}
.session-closed { background: #F8D7DA; color: #721C24; }
.session-open { background: #D4EDDA; color: #155724; }
.session-restricted { background: #FFE4CC; color: #8B3A00; }

/* Armed badges */
.armed-yes { background: #F8D7DA; color: #721C24; padding: 2px 8px; border-radius: 4px; font-size: 0.68rem; font-weight: 700; }
.armed-no { background: #E0DCD2; color: #5A5550; padding: 2px 8px; border-radius: 4px; font-size: 0.68rem; font-weight: 600; }

/* Nearby type */
.nearby-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.nearby-hospital { background: #F8D7DA; color: #721C24; }
.nearby-police { background: #CCE5FF; color: #004085; }
.nearby-fire { background: #FFE4CC; color: #8B3A00; }
.nearby-landmark { background: #E0DCD2; color: #3A3530; }

/* Overall risk block */
.epr-overall-risk {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #F5F4F0;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #5A5550;
  margin-top: 1rem;
}

/* Placeholder text */
.epr-placeholder { color: #9A9590; font-style: italic; font-size: 0.82rem; }

/* Footer */
.epr-footer {
  background: #111B27;
  color: rgba(255,255,255,0.4);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  padding: 0.75rem 1.5rem;
  text-align: center;
}

/* Print overrides for report */
@media print {
  .ep-report { box-shadow: none; }
  .epr-annex { break-inside: avoid; }
}

/* ══════════════════════════════════════
   MOBILE RESPONSIVE STYLES
   Desktop layout untouched above 768px
══════════════════════════════════════ */

.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger-btn.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 64px 0 0 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.mobile-overlay.visible { display: block; }

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .topnav { padding: 0 1rem; }
  .topnav-title { display: none; }
  .session-user { display: none; }
  .sidebar {
    position: fixed;
    top: 64px;
    left: -260px;
    height: calc(100vh - 64px);
    z-index: 100;
    transition: left 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.mobile-open { left: 0; }
  .shell { display: block; }
  .main { padding: 1rem; max-width: 100%; }
  .field-grid-2, .field-grid-3, .field-grid-4 { grid-template-columns: 1fr !important; }
  .doc-grid { grid-template-columns: 1fr; }
  .dashboard-hero { padding: 1.5rem; }
  .hero-title { font-size: 1.5rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .form-header { flex-direction: column; gap: 0.75rem; }
  .form-actions { flex-wrap: wrap; width: 100%; }
  .form-actions .btn { flex: 1; min-width: 120px; justify-content: center; }
  .dynamic-table, .threat-matrix-table, .epr-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .risk-selector { grid-template-columns: 1fr 1fr; }
  .checkbox-grid { grid-template-columns: 1fr 1fr !important; }
  .report-type-grid { grid-template-columns: 1fr 1fr !important; }
  .threat-score-grid { grid-template-columns: 1fr 1fr; }
  .ai-panel { padding: 1.25rem; }
  .ai-panel-heading { font-size: 1.25rem; }
  .threat-search-row { flex-direction: column; }
  .threat-search-row input, .threat-search-row select, .threat-search-row button { width: 100%; }
  .ontic-config { grid-template-columns: 1fr !important; }
  .epr-kv-grid { grid-template-columns: 1fr 1fr !important; }
  .epr-cover { padding: 1.5rem 1.25rem; }
  .epr-cover-title { font-size: 1.2rem; }
  .form-footer-nav { flex-wrap: wrap; gap: 0.5rem; }
  .form-footer-nav .btn { min-width: auto; flex: 1; }
  .sa-status-btns { flex-wrap: wrap; }
  .toast { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
  #ops-drawer { left: 0; }
  .ops-panel { width: 100%; }
  .session-bar { flex-shrink: 0; gap: 0.5rem; }
}

@media (max-width: 480px) {
  .topnav { height: 56px; }
  .sidebar { top: 56px; height: calc(100vh - 56px); }
  .mobile-overlay { top: 56px; }
  .main { padding: 0.75rem; }
  .section-body { padding: 0.75rem; }
  .form-title { font-size: 1.25rem; }
  .report-type-grid { grid-template-columns: 1fr !important; }
  .epr-kv-grid { grid-template-columns: 1fr !important; }
  .session-bar a[href^="mailto"] { display: none; }
}
