/* ═══════════════════════════════════════════════════════════════
   MDOJ Core - Modern Justice Panel
   Deep navy  ·  Court Gold  ·  Shield Purple  ·  Glassmorphism
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Backgrounds ── */
  --bg-page:      #060711;
  --bg-dark:      #060711;
  --bg-card:      #0c0e1a;
  --bg-secondary: #101320;
  --bg-elevated:  #161a2a;
  --bg-input:     #0a0c16;
  --bg-hover:     rgba(124, 92, 191, 0.07);
  --bg-tertiary:  #0d0f19;

  /* ── Gold ── */
  --gold:            #c9a84c;
  --gold-light:      #e2c06e;
  --gold-dim:        rgba(201, 168, 76, 0.10);
  --gold-border:     rgba(201, 168, 76, 0.22);
  --gold-border-hv:  rgba(201, 168, 76, 0.50);

  /* ── Purple ── */
  --purple:        #7c5cbf;
  --purple-light:  #a07ee0;
  --purple-dim:    rgba(124, 92, 191, 0.10);
  --purple-border: rgba(124, 92, 191, 0.22);
  --purple-glow:   rgba(124, 92, 191, 0.14);

  /* ── Mixed accent gradient ── */
  --gradient-brand: linear-gradient(135deg, var(--purple) 0%, var(--gold) 100%);
  --gradient-brand-light: linear-gradient(135deg, var(--purple-light) 0%, var(--gold-light) 100%);

  /* ── Semantic ── */
  --primary:       #5865f2;
  --primary-dark:  #4752c4;
  --secondary:     #57f287;
  --danger:        #ed4245;
  --warning:       #faa61a;

  /* ── Text ── */
  --text-primary:   #e8eaf0;
  --text-secondary: #7e87a0;
  --text-muted:     #6b7280;

  /* ── Borders ── */
  --border:       rgba(124, 92, 191, 0.10);
  --border-color: rgba(124, 92, 191, 0.10);
  --border-gold:  rgba(201, 168, 76, 0.22);

  /* ── Glass ── */
  --glass-bg:     rgba(12, 14, 26, 0.70);
  --glass-border: rgba(124, 92, 191, 0.12);
  --glass-blur:   16px;

  /* ── Radius ── */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Body ── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  background-image:
    radial-gradient(ellipse 1000px 500px at 50% -100px, rgba(124, 92, 191, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 800px 400px at 0% 50%, rgba(124, 92, 191, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse 600px 300px at 100% 80%, rgba(201, 168, 76, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ════════════════════════════════════════
   NAVBAR
════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 999;
  background: rgba(6, 7, 17, 0.88);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow:
    0 1px 0 rgba(201, 168, 76, 0.08),
    0 4px 30px rgba(0, 0, 0, 0.5);
}
.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 12px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(124, 92, 191, 0.3));
}
.nav-brand-text {
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--gradient-brand-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
  margin-left: 12px;
}
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 7px 15px;
  font-size: .84rem;
  font-weight: 500;
  letter-spacing: .02em;
  transition: all .18s ease;
  position: relative;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.nav-link.active {
  color: var(--purple-light);
  background: var(--purple-dim);
  font-weight: 600;
}
.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 22px; height: 2px;
  background: var(--gradient-brand);
  border-radius: 2px 2px 0 0;
}

/* ── User Menu ── */
.user-menu { position: relative; flex-shrink: 0; }
.user-menu-button {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: .86rem;
  font-weight: 500;
  transition: all .18s;
}
.user-menu-button:hover {
  border-color: var(--purple-border);
  background: var(--bg-elevated);
  box-shadow: 0 0 16px rgba(124, 92, 191, 0.08);
}
.user-menu-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  color: var(--purple);
  line-height: 0;
}
.user-menu-caret svg {
  display: block;
  width: 12px;
  height: 12px;
}
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 24px rgba(124, 92, 191, 0.06);
}
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 11px 16px;
  text-decoration: none;
  cursor: pointer;
  font-size: .86rem;
  font-family: inherit;
  transition: background .12s;
}
.user-menu-item:hover { background: var(--bg-hover); }
.user-menu-item-danger { color: #ff9ea1; }

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 28px 48px;
}
.page { display: none; }
.page.active { display: block; }

.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .02em;
  background: var(--gradient-brand-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle { color: var(--text-secondary); font-size: .86rem; margin-top: 4px; }

/* ════════════════════════════════════════
   DASHBOARD STATS
════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.stat-card:hover {
  border-color: var(--purple-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124, 92, 191, 0.08);
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: var(--gradient-brand);
}
.stat-card h3 {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.stat-card p {
  font-size: 1.7rem;
  font-weight: 800;
  background: var(--gradient-brand-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ════════════════════════════════════════
   DASHBOARD PROFILE SECTION
════════════════════════════════════════ */
.dashboard-section {
  margin-top: 32px;
}
.dashboard-section-title {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-secondary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}

.profile-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  min-height: 28px;
}

.profile-status-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 999px;
  line-height: 1.4;
}
.profile-status-badge.status-none {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}
.profile-status-badge.status-draft {
  background: rgba(110, 140, 200, 0.15);
  border: 1px solid rgba(110, 140, 200, 0.35);
  color: #8aa8d8;
}
.profile-status-badge.status-pending {
  background: rgba(230, 180, 80, 0.15);
  border: 1px solid rgba(230, 180, 80, 0.35);
  color: #e6b450;
}
.profile-status-badge.status-approved {
  background: rgba(80, 200, 120, 0.15);
  border: 1px solid rgba(80, 200, 120, 0.35);
  color: #50c878;
}
.profile-status-badge.status-denied {
  background: rgba(230, 70, 70, 0.15);
  border: 1px solid rgba(230, 70, 70, 0.35);
  color: #e64646;
}
.profile-status-badge.status-archived {
  background: rgba(140, 140, 140, 0.12);
  border: 1px solid rgba(140, 140, 140, 0.3);
  color: var(--text-muted);
}

.profile-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-action-btn {
  display: inline-block;
  font-size: .76rem;
  font-weight: 700;
  text-decoration: none;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  color: #fff;
  transition: opacity .2s, transform .2s;
}
.profile-action-btn:hover {
  opacity: .9;
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}
.profile-action-btn-warn {
  background: linear-gradient(135deg, #e6543a, #c0392b);
}

/* ════════════════════════════════════════
   TOOL LAYOUT (sidebar + content)
════════════════════════════════════════ */
.command-tools-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}
.admin-tools-layout {
  display: grid;
  /* minmax(0, 1fr) (not plain 1fr) lets the content column shrink below the
     intrinsic width of wide children (e.g. tables), so .table-wrap can become
     a horizontal scroll container instead of forcing the layout wider. */
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 580px;
}
.admin-tools-sidebar {
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  max-height: calc(100vh - 130px);
  background: rgba(0, 0, 0, 0.2);
}
.admin-tools-sidebar details.admin-sidebar-section {
  margin-bottom: 6px;
}
.admin-tools-sidebar details.admin-sidebar-section > summary {
  padding: 8px 10px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
}
.admin-tools-sidebar details.admin-sidebar-section > summary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.admin-tools-sidebar details.admin-sidebar-section[open] > summary {
  color: var(--purple-light);
  background: transparent;
  border: none;
}
.admin-tools-sidebar .admin-sidebar-section-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 4px 4px;
}
.admin-tools-nav-item {
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
  font-size: .85rem;
  font-family: inherit;
  font-weight: 500;
  transition: all .16s;
  width: 100%;
}
.admin-tools-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.admin-tools-nav-item.active {
  border-left-color: var(--purple);
  color: var(--purple-light);
  background: var(--purple-dim);
  font-weight: 600;
}
.admin-tools-content { padding: 22px; min-width: 0; }

/* ════════════════════════════════════════
   TOOL CARDS
════════════════════════════════════════ */
.tool-card {
  background: rgba(16, 19, 32, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 18px;
  transition: border-color .2s, transform .2s ease, box-shadow .2s ease;
}
.tool-card:hover {
  border-color: var(--purple-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25), 0 0 20px rgba(124, 92, 191, 0.06);
}
.tool-title {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--purple-light);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--purple-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ════════════════════════════════════════
   GRID HELPERS
════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════ */
label {
  display: block;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: .88rem;
  transition: border-color .18s, box-shadow .18s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim), 0 0 16px rgba(124, 92, 191, 0.06);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { min-height: 90px; resize: vertical; }
select option { background: var(--bg-elevated); }

/* Checkboxes & radios should keep native sizing (override the input{width:100%} rule above) */
input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--purple);
  cursor: pointer;
  box-shadow: none;
}
input[type="checkbox"]:focus, input[type="radio"]:focus {
  box-shadow: 0 0 0 2px var(--purple-dim);
}

/* Range sliders should not inherit text-field chrome */
input[type="range"] {
  width: auto;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  min-height: 0;
  -webkit-appearance: none;
  appearance: none;
}
input[type="range"]:focus {
  border-color: transparent;
  box-shadow: none;
}

/* Labels that wrap a checkbox/radio + text should render inline, not as uppercase block labels */
label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-primary);
  text-transform: none;
  margin-bottom: 0;
  cursor: pointer;
}

/* ════════════════════════════════════════
   FORM GROUPS
   Utility classes for consistent form layout
════════════════════════════════════════ */
.form-group {
  margin-top: 12px;
}
.form-group:first-of-type {
  margin-top: 14px;
}
.form-actions {
  margin-top: 18px;
}
.form-actions .btn {
  width: 100%;
  padding: 12px;
}

/* ════════════════════════════════════════
   PROFILE SETUP
════════════════════════════════════════ */
.profile-setup-container {
  max-width: 520px;
  margin: 40px auto;
}
.profile-setup-logo-wrap {
  text-align: center;
  margin-bottom: 20px;
}
.profile-setup-logo {
  border-radius: 14px;
  filter: drop-shadow(0 4px 16px rgba(124,92,191,.3));
}
.profile-setup-logo-sm {
  border-radius: 12px;
  opacity: .8;
}
.profile-setup-title {
  text-align: center;
}
.profile-setup-subtitle {
  margin-bottom: 24px;
  text-align: center;
}
.profile-setup-denied-banner {
  display: none;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(220,53,69,0.12);
  border: 1px solid rgba(220,53,69,0.3);
  border-radius: 6px;
  color: var(--danger);
  font-size: 0.88rem;
}
.profile-draft-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(124, 92, 191, 0.12);
  border: 1px solid rgba(124, 92, 191, 0.3);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}
.profile-draft-banner .btn-link {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  font-size: 0.88rem;
  text-decoration: underline;
  padding: 0;
}
.profile-setup-actions-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.profile-setup-actions-row .btn {
  width: 100%;
}
.onboarding-skip-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
}
.onboarding-skip-btn:hover {
  color: var(--text-primary);
}
.onboarding-profile-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.onboarding-profile-option {
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: border-color 0.15s;
}
.onboarding-profile-option:hover {
  border-color: var(--purple-border);
}
.onboarding-profile-option strong {
  display: block;
  margin-bottom: 4px;
}
.profile-setup-message {
  margin-top: 8px;
  min-height: 20px;
}
.profile-setup-status-view {
  text-align: center;
}
.profile-setup-icon-lg {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.profile-setup-status-text {
  margin-top: 8px;
}
.profile-setup-hint {
  margin-top: 16px;
  font-size: .86rem;
}
.profile-setup-actions {
  margin-top: 24px;
}

/* ════════════════════════════════════════
   PROFILE GATE (layout.njk)
════════════════════════════════════════ */
.gate-status-view {
  text-align: center;
}
.gate-logo-wrap {
  text-align: center;
  margin-bottom: 10px;
}
.gate-logo-wrap img {
  border-radius: 12px;
  opacity: .8;
}
.gate-status-icon {
  text-align: center;
  font-size: 2rem;
}
.gate-status-title {
  text-align: center;
}
.gate-status-text {
  margin-top: 6px;
  text-align: center;
}
.gate-status-hint {
  margin-top: 14px;
  font-size: .84rem;
  text-align: center;
}
.gate-actions {
  margin-top: 20px;
  text-align: center;
}

/* ════════════════════════════════════════
   LICENCE REQUEST CARDS
   Card-style toggle for selectable licences.
   Lit-up (active) when their checkbox is checked.
════════════════════════════════════════ */
.licence-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
/* Single required-licence row - full width banner */
.licence-card-grid-required {
  grid-template-columns: 1fr;
}
.licence-section-divider {
  margin: 14px 0 6px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.licence-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
label.licence-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 12px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s, transform .12s;
  user-select: none;
  overflow: hidden;
  /* override the generic checkbox-label rule above */
  font-size: .86rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-primary);
  text-transform: none;
  align-items: stretch;
  margin-bottom: 0;
  min-width: 0; /* allow children to wrap inside narrow grid columns */
}
label.licence-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(124, 92, 191, 0.18), transparent 60%);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
label.licence-card:hover {
  border-color: var(--purple-border);
  background: rgba(124, 92, 191, 0.04);
}
label.licence-card:active { transform: scale(0.99); }
label.licence-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.licence-card-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: background .2s, color .2s, box-shadow .2s, border-color .2s;
  flex-shrink: 0;
}
.licence-card-icon svg { width: 14px; height: 14px; }
.licence-card-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.licence-card-desc {
  font-size: .72rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.licence-card-status {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.licence-card-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: none;
  transition: background .2s, box-shadow .2s;
  flex-shrink: 0;
}
.licence-card-status .on  { display: none; }
.licence-card-status .off { display: inline; }

/* ── Lit-up (active) state when the inner checkbox is checked ── */
label.licence-card:has(input[type="checkbox"]:checked) {
  border-color: var(--purple);
  background: linear-gradient(135deg, rgba(124, 92, 191, 0.12) 0%, rgba(124, 92, 191, 0.04) 100%);
  box-shadow:
    0 0 0 1px var(--purple-border),
    0 0 28px rgba(124, 92, 191, 0.22),
    inset 0 0 24px rgba(124, 92, 191, 0.06);
}
label.licence-card:has(input[type="checkbox"]:checked)::before { opacity: 1; }
label.licence-card:has(input[type="checkbox"]:checked) .licence-card-icon {
  background: var(--purple-dim);
  color: var(--purple-light);
  border-color: var(--purple-border);
  box-shadow: 0 0 18px rgba(124, 92, 191, 0.35);
}
label.licence-card:has(input[type="checkbox"]:checked) .licence-card-status {
  color: var(--purple-light);
  border-top-color: var(--purple-border);
}
label.licence-card:has(input[type="checkbox"]:checked) .licence-card-status::before {
  background: var(--purple-light);
  box-shadow: 0 0 10px var(--purple-light);
}
label.licence-card:has(input[type="checkbox"]:checked) .licence-card-status .on  { display: inline; }
label.licence-card:has(input[type="checkbox"]:checked) .licence-card-status .off { display: none; }

/* Keyboard focus on the hidden input */
label.licence-card:has(input[type="checkbox"]:focus-visible) {
  outline: 2px solid var(--purple-light);
  outline-offset: 2px;
}

/* ── Banner-style card (used by the required GBL card) ──
   Horizontal layout: icon on the left, body in the middle, status on the right. */
label.licence-card.licence-card-banner {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.licence-card-banner .licence-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.licence-card-banner .licence-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}
.licence-card-banner .licence-card-icon svg { width: 18px; height: 18px; }
.licence-card-banner .licence-card-status {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
  white-space: nowrap;
}

/* Optional cards stack body content directly (no .licence-card-body wrapper). */
label.licence-card:not(.licence-card-banner) > .licence-card-body {
  display: contents;
}

/* ── Required licence (locked, always-on) ── gold accent to distinguish from
   the user-selectable purple "checked" state. */
label.licence-card.licence-card-required {
  cursor: default;
  border-color: var(--gold-border);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.10) 0%, rgba(201, 168, 76, 0.03) 100%);
  box-shadow:
    0 0 0 1px var(--gold-border),
    0 0 26px rgba(201, 168, 76, 0.18),
    inset 0 0 24px rgba(201, 168, 76, 0.05);
}
label.licence-card.licence-card-required::before {
  background: radial-gradient(circle at 100% 0%, rgba(201, 168, 76, 0.20), transparent 60%);
  opacity: 1;
}
label.licence-card.licence-card-required:hover {
  border-color: var(--gold-border-hv);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.12) 0%, rgba(201, 168, 76, 0.04) 100%);
}
label.licence-card.licence-card-required:active { transform: none; }
label.licence-card.licence-card-required .licence-card-icon {
  background: var(--gold-dim);
  color: var(--gold-light);
  border-color: var(--gold-border);
  box-shadow: 0 0 18px rgba(201, 168, 76, 0.30);
}
label.licence-card.licence-card-required .licence-card-status {
  color: var(--gold-light);
  border-top-color: var(--gold-border);
}
label.licence-card.licence-card-required .licence-card-status::before {
  background: var(--gold-light);
  box-shadow: 0 0 10px var(--gold-light);
}
.licence-card-status .required-tag {
  display: inline-block;
  font-weight: 800;
}

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: .84rem;
  letter-spacing: .03em;
  transition: all .18s ease;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
button.btn, a.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  color: #fff;
  background: var(--purple);
  box-shadow: 0 2px 8px rgba(124, 92, 191, 0.2);
}
button.btn:hover, a.btn:hover {
  background: var(--purple-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124, 92, 191, 0.25);
}
button.btn:active, a.btn:active { transform: translateY(0) scale(.97); box-shadow: none; }

/* Gold accent */
button.btn.accent, a.btn.accent {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: #0a0b0f;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(201, 168, 76, 0.25);
}
button.btn.accent:hover, a.btn.accent:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 20px rgba(201, 168, 76, 0.3);
}

/* Secondary (ghost-ish) */
button.btn.secondary, a.btn.secondary {
  background: rgba(124, 92, 191, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: none;
}
button.btn.secondary:hover, a.btn.secondary:hover {
  border-color: var(--purple-border);
  color: var(--purple-light);
  background: var(--purple-dim);
  transform: none;
}

/* Danger */
button.btn.danger, a.btn.danger {
  background: rgba(237, 66, 69, 0.12);
  color: #ff9ea1;
  border: 1px solid rgba(237, 66, 69, 0.2);
  box-shadow: none;
}
button.btn.danger:hover, a.btn.danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 4px 16px rgba(237, 66, 69, 0.25);
}

/* Ghost */
.btn.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  box-shadow: none;
}
.btn.btn-ghost:hover {
  background: var(--purple-dim);
  border-color: var(--purple-border);
  color: var(--purple-light);
}

/* ════════════════════════════════════════
   TABLES
════════════════════════════════════════ */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(10, 12, 22, 0.4);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}
thead { position: sticky; top: 0; z-index: 1; }
th {
  color: var(--purple-light);
  background: rgba(16, 19, 32, 0.9);
  backdrop-filter: blur(8px);
  font-size: .70rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--purple-border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(124, 92, 191, 0.06);
  color: var(--text-primary);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(124, 92, 191, 0.04); }

/* ════════════════════════════════════════
   MISC UTILITY
════════════════════════════════════════ */
.muted { color: var(--text-secondary); font-size: .86rem; }
.message { margin-top: 8px; font-size: .86rem; min-height: 1.2em; }
.success { color: var(--secondary); }
.error { color: #ff9ea1; }
.inline-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.inline-row > * { flex: 1; min-width: 120px; }
.inline-row > .btn { flex: 0 0 auto; margin-bottom: 0; }

/* ════════════════════════════════════════
   CHIPS
════════════════════════════════════════ */
.chip-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 16px;
  background: var(--purple-dim);
  color: var(--purple-light);
  font-size: .76rem;
  font-weight: 600;
  border: 1px solid var(--purple-border);
  letter-spacing: .03em;
}
.chip .chip-x { cursor: pointer; opacity: .7; font-size: .9rem; }
.chip .chip-x:hover { opacity: 1; }

/* ════════════════════════════════════════
   COLLAPSIBLE SECTIONS
════════════════════════════════════════ */
details.collapsible { margin-bottom: 12px; }
details.collapsible > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  letter-spacing: .02em;
  transition: all .18s;
  user-select: none;
}
details.collapsible > summary::before {
  content: "▸";
  color: var(--purple);
  font-size: .8rem;
  transition: transform .2s;
  flex-shrink: 0;
}
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary:hover {
  border-color: var(--purple-border);
  background: var(--bg-secondary);
}
details.collapsible[open] > summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: var(--purple-border);
  color: var(--purple-light);
  background: var(--bg-secondary);
}
details.collapsible[open] > summary::before { transform: rotate(90deg); }
details.collapsible > .tool-card {
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  margin-top: -1px;
  border-color: var(--purple-border);
}

/* ════════════════════════════════════════
   PROFILE GATE OVERLAY
════════════════════════════════════════ */
.profile-gate-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(6, 7, 17, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.profile-gate-card {
  background: var(--bg-secondary);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  max-width: 480px;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 80px rgba(124, 92, 191, 0.08),
    0 24px 80px rgba(0, 0, 0, 0.6);
}
.profile-gate-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-brand);
}
.profile-gate-card h2 {
  margin-bottom: 6px;
  font-size: 1.3rem;
  font-weight: 800;
  background: var(--gradient-brand-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.required { color: var(--danger); font-weight: 600; }
.bar-preview { margin-top: 8px; }
.bar-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--purple-border);
}
.gate-status-icon { font-size: 3rem; margin-bottom: 10px; }
.gate-denied-banner {
  margin-top: 12px; padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(237, 66, 69, 0.08);
  border: 1px solid rgba(237, 66, 69, 0.2);
  color: #ff9ea1;
}
.gate-denied-banner strong { display: block; margin-bottom: 4px; }

/* ════════════════════════════════════════
   BAR APPROVAL / PROFILE CARDS
════════════════════════════════════════ */
.bar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 12px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.bar-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gradient-brand);
}
.bar-card:hover {
  border-color: var(--purple-border);
  box-shadow: 0 4px 20px rgba(124, 92, 191, 0.06);
}
.bar-card-img { flex: 0 0 110px; }
.bar-card-img img {
  width: 110px; height: 110px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--purple-border);
  cursor: pointer;
  transition: all .18s;
}
.bar-card-img img:hover {
  border-color: var(--purple-light);
  box-shadow: 0 4px 20px rgba(124, 92, 191, 0.15);
}
.bar-card-body { flex: 1; min-width: 0; padding-left: 4px; }
.bar-card-body .bar-meta { font-size: .84rem; color: var(--text-secondary); margin-bottom: 5px; }
.bar-card-body .bar-user {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.bar-card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ════════════════════════════════════════
   ACCESS MATRIX
════════════════════════════════════════ */
.feature-group {
  margin-bottom: 16px;
  border: none;
  padding: 0;
  margin-left: 0;
  margin-right: 0;
}
.feature-group-title,
.feature-group legend {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--purple-light);
  margin-bottom: 10px;
  padding: 0 0 6px 0;
  border-bottom: 1px solid var(--purple-border);
}
}
.feature-toggles { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.feature-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text-secondary);
  transition: color .12s;
}
.feature-toggle:hover { color: var(--text-primary); }
.feature-toggle-text { flex-shrink: 0; }
.feature-key-hint {
  font-size: .72rem;
  color: var(--text-tertiary, var(--text-secondary));
  opacity: .75;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.feature-toggle input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--purple);
}

.magistrate-apply-banner {
  max-width: 1200px;
  margin: 0 auto 16px;
  padding: 0 16px;
}
.magistrate-apply-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border: 1px solid var(--purple-border);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(107, 78, 255, 0.12), rgba(124, 92, 191, 0.06));
}

/* ════════════════════════════════════════
   MAGISTRATE APPLICATION FORM (premium)
════════════════════════════════════════ */
.mag-apply-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px 64px;
}
.mag-apply-loading { text-align: center; padding: 60px 0; }

.mag-hero {
  position: relative;
  text-align: center;
  padding: 40px 28px 36px;
  margin-bottom: 28px;
  border-radius: 20px;
  border: 1px solid var(--purple-border);
  background:
    radial-gradient(120% 140% at 50% -20%, rgba(124, 92, 191, 0.28), transparent 60%),
    linear-gradient(180deg, rgba(20, 16, 34, 0.6), rgba(12, 10, 20, 0.4));
  overflow: hidden;
}
.mag-hero-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--purple-light);
  padding: 6px 14px;
  border: 1px solid var(--purple-border);
  border-radius: 999px;
  margin-bottom: 18px;
}
.mag-hero-title {
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -.02em;
  margin: 0 0 8px;
  background: linear-gradient(180deg, #fff, #c9bdf0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.mag-hero-sub { color: var(--text-secondary); font-size: 1rem; margin: 0 auto 18px; max-width: 520px; }
.mag-hero-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.mag-hero-dot { width: 8px; height: 8px; border-radius: 50%; background: #3fb950; box-shadow: 0 0 8px #3fb950; }

.mag-progress { margin-bottom: 20px; }
.mag-progress-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.mag-progress-meta span:first-child { font-weight: 700; font-size: .88rem; }
.mag-progress-track {
  height: 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.mag-progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--purple), var(--purple-light));
  transition: width .3s ease;
}
.mag-progress-dots { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mag-progress-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.mag-progress-dot:hover { transform: scale(1.2); }
.mag-progress-dot.done { background: var(--purple); }
.mag-progress-dot.active { background: var(--purple-light); box-shadow: 0 0 0 4px rgba(124, 92, 191, 0.25); }

.mag-step-nav {
  display: flex; align-items: center; gap: 14px;
  margin-top: 24px;
}
.mag-step-hint { flex: 1; text-align: center; font-size: .8rem; color: var(--text-secondary); margin: 0; }
.mag-nav-btn {
  padding: 12px 28px;
  border: 1px solid var(--purple-border);
  border-radius: 11px;
  font-size: .95rem; font-weight: 700;
  color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  transition: transform .12s, box-shadow .12s;
}
.mag-nav-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(124, 92, 191, 0.3); }
.mag-nav-btn.secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.mag-nav-btn.secondary:hover { color: var(--text-primary); box-shadow: none; }
.mag-step-nav .mag-submit-btn { padding: 12px 32px; }

.mag-form { display: flex; flex-direction: column; gap: 20px; }

.mag-section {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  overflow: hidden;
}
.mag-section-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}
.mag-section-num {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  font-weight: 800;
  font-size: .9rem;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
}
.mag-section-head h2 { font-size: 1.08rem; font-weight: 700; margin: 2px 0 0; }
.mag-section-desc { color: var(--text-secondary); font-size: .84rem; margin: 6px 0 0; }
.mag-section-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 20px; }

.mag-field { display: flex; flex-direction: column; gap: 8px; }
.mag-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: .92rem;
  color: var(--text-primary);
}
.mag-required, .mag-optional {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 2px 7px;
  border-radius: 5px;
}
.mag-required { color: #ff9ea1; background: rgba(237, 66, 69, 0.12); }
.mag-optional { color: var(--text-secondary); background: rgba(255, 255, 255, 0.05); }
.mag-help { font-size: .78rem; color: var(--text-secondary); margin: 0; }

.mag-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input, rgba(0,0,0,0.2));
  color: var(--text-primary);
  font-size: .92rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.mag-input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.25);
}
.mag-textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

.mag-wordcount { font-size: .74rem; color: var(--text-secondary); align-self: flex-end; }
.mag-wordcount.ok { color: #3fb950; }

.mag-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.mag-choice {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: .86rem;
  color: var(--text-secondary);
  transition: border-color .15s, background .15s, color .15s;
}
.mag-choice:hover { border-color: var(--purple-border); color: var(--text-primary); }
.mag-choice input { accent-color: var(--purple); width: 16px; height: 16px; }
.mag-choice:has(input:checked) {
  border-color: var(--purple);
  background: rgba(124, 92, 191, 0.1);
  color: var(--text-primary);
}

.mag-field-declaration { gap: 14px; }
.mag-declaration {
  position: relative;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(212, 175, 55, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(40, 33, 18, 0.5), rgba(20, 17, 10, 0.35));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(212, 175, 55, 0.08);
  overflow: hidden;
}
.mag-declaration::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 5px;
  background: linear-gradient(180deg, #e8c75a, #b8902b);
}
.mag-declaration-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}
.mag-declaration-seal {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 1.4rem;
  color: #1a1505;
  background: linear-gradient(135deg, #f0d674, #c79a30);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.4);
}
.mag-declaration-title { font-weight: 800; font-size: 1.02rem; color: #f3e3ac; letter-spacing: .01em; }
.mag-declaration-kicker { font-size: .76rem; color: rgba(243, 227, 172, 0.7); margin-top: 2px; text-transform: uppercase; letter-spacing: .08em; }
.mag-declaration-body {
  padding: 18px 22px 20px;
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.mag-affirm {
  display: flex; align-items: center; gap: 14px;
  margin: 0 22px;
  padding: 16px 0 20px;
  cursor: pointer;
  border-top: 1px dashed rgba(212, 175, 55, 0.3);
}
.mag-affirm input {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 2px solid rgba(212, 175, 55, 0.55);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.mag-affirm input::after {
  content: "\2713";
  font-size: 1rem; font-weight: 900; line-height: 1;
  color: #1a1505;
  opacity: 0;
  transform: scale(.5);
  transition: opacity .12s, transform .12s;
}
.mag-affirm input:checked {
  background: linear-gradient(135deg, #f0d674, #c79a30);
  border-color: #e8c75a;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}
.mag-affirm input:checked::after { opacity: 1; transform: scale(1); }
.mag-affirm-text { display: flex; flex-direction: column; gap: 2px; }
.mag-affirm-main { font-weight: 800; font-size: .98rem; color: #f3e3ac; }
.mag-affirm-sub { font-size: .78rem; color: rgba(243, 227, 172, 0.65); }

/* ── Justice Magistrate Applications inbox ── */
.ma-inbox {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  overflow: hidden;
}
.ma-inbox-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}
.ma-inbox-heading { display: flex; align-items: center; gap: 12px; }
.ma-inbox-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-size: 1.05rem; color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
}
.ma-inbox-title { font-weight: 700; font-size: 1.02rem; }
.ma-inbox-count { font-size: .8rem; color: var(--text-secondary); margin-top: 1px; }

.ma-inbox-list { display: flex; flex-direction: column; }
.ma-inbox-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text-primary);
  transition: background .12s;
}
.ma-inbox-item:last-child { border-bottom: none; }
.ma-inbox-item:hover { background: rgba(124, 92, 191, 0.08); }
.ma-inbox-item.unread { background: rgba(124, 92, 191, 0.05); }
.ma-inbox-item.unread .ma-inbox-name { font-weight: 700; }
.ma-inbox-item.unread::before {
  content: ""; position: absolute; left: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--purple-light);
}
.ma-inbox-item { position: relative; }
.ma-inbox-avatar {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-weight: 700; font-size: 1rem; color: #fff;
  background: linear-gradient(135deg, #5b4b8a, #7c5cbf);
}
.ma-inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ma-inbox-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ma-inbox-name { font-size: .94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ma-inbox-time { flex: 0 0 auto; font-size: .76rem; color: var(--text-secondary); }
.ma-inbox-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ma-inbox-code { font-size: .78rem; color: var(--text-secondary); font-family: ui-monospace, monospace; }
.ma-inbox-votes { font-size: .78rem; color: var(--text-secondary); }
.ma-inbox-chevron { flex: 0 0 auto; font-size: 1.4rem; color: var(--text-secondary); }

.ma-status-chip {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.06); color: var(--text-secondary);
}
.ma-status-chip.is-new { background: rgba(124, 92, 191, 0.2); color: #c9bdf0; }
.ma-status-chip.is-active { background: rgba(47, 129, 247, 0.18); color: #79c0ff; }
.ma-status-chip.is-review { background: rgba(212, 175, 55, 0.18); color: #f0d674; }
.ma-status-chip.is-pass { background: rgba(63, 185, 80, 0.18); color: #6fdc8c; }
.ma-status-chip.is-fail { background: rgba(237, 66, 69, 0.18); color: #ff9ea1; }
.ma-status-chip.is-hold { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }

.ma-inbox-empty {
  text-align: center;
  padding: 56px 24px;
}
.ma-inbox-empty-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 16px;
  font-size: 1.8rem; color: var(--purple-light);
  background: rgba(124, 92, 191, 0.1);
  border: 1px dashed var(--purple-border);
}
.ma-inbox-empty-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 6px; }
.ma-inbox-empty-text { color: var(--text-secondary); font-size: .88rem; max-width: 360px; margin: 0 auto; }

.ma-inbox-archived { border-top: 1px solid var(--border); }
.ma-inbox-archived-summary {
  list-style: none; cursor: pointer;
  padding: 12px 20px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.015);
}
.ma-inbox-archived-summary::-webkit-details-marker { display: none; }
.ma-inbox-archived-summary::before { content: "\25B8"; margin-right: 8px; display: inline-block; transition: transform .15s ease; }
.ma-inbox-archived[open] > .ma-inbox-archived-summary::before { transform: rotate(90deg); }
.ma-inbox-archived[open] > .ma-inbox-archived-summary { border-bottom: 1px solid var(--border); }
.ma-inbox-archived .ma-inbox-item { opacity: .72; }
.ma-inbox-archived .ma-inbox-item:hover { opacity: 1; }

/* ── Interview scoring page ── */
.ma-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ma-chip {
  display: inline-flex; align-items: center;
  padding: 5px 11px; border-radius: 999px;
  font-size: .82rem;
  background: rgba(124, 92, 191, 0.12);
  border: 1px solid var(--purple-border);
  color: var(--text-primary);
}
.ma-add-justice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.ma-score-cat { margin-top: 14px; }
.ma-score-cat:first-child { margin-top: 4px; }
.ma-score-cat-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-weight: 700; font-size: .95rem;
  padding-bottom: 6px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ma-score-q {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 0;
}
.ma-score-qtext { flex: 1; font-size: .9rem; color: var(--text-secondary); line-height: 1.4; }
.ma-score-input { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.ma-score-input input {
  width: 84px; padding: 9px 10px;
  border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-input, rgba(0,0,0,0.2)); color: var(--text-primary);
  text-align: center; font-size: .95rem;
}
.ma-score-input input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,92,191,0.25); }
.ma-score-max { color: var(--text-secondary); font-size: .85rem; min-width: 34px; }
.ma-score-total {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 1rem;
}
.ma-score-total strong { color: var(--purple-light); font-size: 1.15rem; }

/* admin question editor: per-question max + computed category total */
.qe-catmax { font-size: .78rem; color: var(--text-secondary); white-space: nowrap; padding: 0 6px; }
.qe-q .qe-qmax { text-align: center; }

/* inline confirmation (replaces popup dialogs) */
.ma-inline-confirm {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--purple-border);
  background: rgba(124, 92, 191, 0.07);
}
.ma-inline-confirm-msg { margin: 0 0 10px; font-size: .9rem; color: var(--text-primary); }
.ma-inline-note {
  width: 100%; margin-bottom: 10px;
  padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-input, rgba(0,0,0,0.2)); color: var(--text-primary);
  font-family: inherit; font-size: .88rem; resize: vertical;
}
.ma-inline-note:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,92,191,0.25); }
.ma-inline-confirm-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mag-submit-bar {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 28px 0 8px;
}
.mag-submit-note { font-size: .8rem; color: var(--text-secondary); margin: 0; text-align: center; }
.mag-submit-btn {
  padding: 14px 40px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  box-shadow: 0 8px 24px rgba(124, 92, 191, 0.35);
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.mag-submit-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(124, 92, 191, 0.45); }
.mag-submit-btn:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }

.mag-result {
  text-align: center;
  padding: 56px 32px;
  border-radius: 20px;
  border: 1px solid var(--purple-border);
  background: linear-gradient(180deg, rgba(20, 16, 34, 0.5), rgba(12, 10, 20, 0.3));
}
.mag-result-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 1.8rem; color: #fff;
  background: linear-gradient(135deg, #2ea043, #3fb950);
  box-shadow: 0 8px 24px rgba(63, 185, 80, 0.35);
}
.mag-result-icon-muted { background: linear-gradient(135deg, #6b4eff, #7c5cbf); box-shadow: 0 8px 24px rgba(124, 92, 191, 0.35); }
.mag-result h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 10px; }
.mag-result-ref { font-size: .95rem; color: var(--text-secondary); margin: 0 0 16px; }
.mag-result-text { color: var(--text-secondary); max-width: 440px; margin: 0 auto 10px; line-height: 1.6; }
.mag-result-link {
  display: inline-block; margin-top: 18px;
  color: var(--purple-light); font-weight: 600; text-decoration: none;
}
.mag-result-link:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .mag-hero-title { font-size: 1.6rem; }
  .mag-section-body { padding: 18px 16px; }
  .mag-section-head { padding: 16px; }
}

/* ── Admin question editor ── */
.qe-toggle { display: flex; align-items: center; gap: 10px; font-size: .9rem; cursor: pointer; }
.qe-toggle input { width: 18px; height: 18px; accent-color: var(--purple); }
.qe-wrap { display: flex; flex-direction: column; gap: 14px; }
.qe-section, .qe-cat {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.015);
}
.qe-section-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.qe-section-head .qe-stitle, .qe-section-head .qe-ctitle { font-weight: 700; }
.qe-fields, .qe-qs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.qe-field {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg-card);
}
.qe-field-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qe-field-row .qe-flabel { flex: 1 1 260px; }
.qe-field-row .qe-ftype { flex: 0 0 180px; }
.qe-field-extra:not(:empty) { margin-top: 8px; }
.qe-req { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--text-secondary); white-space: nowrap; }
.qe-req input { accent-color: var(--purple); }
.qe-q { display: flex; gap: 8px; align-items: center; }
.qe-q .qe-qtext { flex: 1; }
.qe-del {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(237, 66, 69, 0.2);
  background: rgba(237, 66, 69, 0.08);
  color: #ff9ea1;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.qe-del:hover { background: rgba(237, 66, 69, 0.18); }

.role-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .18s;
}
.role-row:hover { border-color: var(--purple-border); }
.role-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  transition: background .14s;
}
.role-row-header:hover { background: var(--bg-hover); }
.role-row-header select { max-width: 260px; cursor: default; }
.role-row-remove {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: .6;
  transition: all .14s;
}
.role-row-remove:hover { opacity: 1; background: rgba(237, 66, 69, 0.1); }
.role-row-toggle {
  margin-left: auto;
  font-size: .8rem;
  color: var(--purple);
  transition: transform .2s;
  flex-shrink: 0;
  padding: 2px 4px;
}
.role-row.collapsed .role-row-toggle { transform: rotate(-90deg); }
.role-row-body { padding: 4px 16px 16px; }
.role-row.collapsed .role-row-body { display: none; }
.role-preview-nav-group { margin-bottom: 10px; }
.role-preview-nav-cat {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--purple-light);
  margin-bottom: 6px;
}
.role-preview-nav-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.role-preview-nav-tool {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .8rem;
  color: var(--text-secondary);
}
.role-panel-preview-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 220px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
}
.role-panel-preview-shell[hidden] { display: none !important; }
.role-panel-preview-frame {
  flex: 1;
  width: 100%;
  min-height: 520px;
  border: none;
  background: var(--bg-primary);
}
.role-preview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(124, 92, 191, .22), rgba(201, 168, 76, .18));
  border-bottom: 1px solid var(--purple-border);
  font-size: .88rem;
  flex-shrink: 0;
}
.role-preview-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.role-preview-banner-hint { font-size: .78rem; }
.role-preview-banner .btn { padding: 5px 12px; font-size: .8rem; flex-shrink: 0; }

/* ════════════════════════════════════════
   LIGHTBOX
════════════════════════════════════════ */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(6, 7, 17, 0.92);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox-overlay img {
  max-width: 90vw; max-height: 90vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--purple-border);
  box-shadow: 0 0 60px rgba(124, 92, 191, 0.1);
}

/* ════════════════════════════════════════
   PROSECUTOR CARDS
════════════════════════════════════════ */
.prosecutor-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  margin-bottom: 10px;
  transition: all .18s;
}
.prosecutor-card:hover {
  border-color: var(--purple-border);
  box-shadow: 0 4px 16px rgba(124, 92, 191, 0.05);
}
.prosecutor-card .prosecutor-info { flex: 1; min-width: 0; }
.prosecutor-card .prosecutor-name { font-weight: 700; color: var(--text-primary); }
.prosecutor-card .prosecutor-meta { font-size: .82rem; color: var(--text-secondary); margin-top: 2px; }

/* ════════════════════════════════════════
   HAMBURGER / RESPONSIVE
════════════════════════════════════════ */
.nav-hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
}
.nav-hamburger:hover { border-color: var(--purple-border); background: var(--bg-hover); }

@media (max-width: 920px) {
  .nav-hamburger { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 60px; left: 0; right: 0;
    background: rgba(12, 14, 26, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--purple-border);
    flex-direction: column;
    padding: 10px 14px 14px;
    gap: 2px;
    z-index: 998;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
  .nav-links.open { display: flex; }
  .admin-tools-layout { grid-template-columns: 1fr; min-height: auto; }
  .admin-tools-sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
    padding: 8px;
  }
  .admin-tools-nav-item {
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--radius-sm);
    white-space: nowrap;
  }
  .admin-tools-nav-item.active {
    border-left: none;
    border-bottom-color: var(--purple);
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ════════════════════════════════════════
   USER SELECT
   Disable text highlighting site-wide; keep it in form fields only.
════════════════════════════════════════ */
html {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* ════════════════════════════════════════
   NOTIFICATION BADGES (nav link counts)
════════════════════════════════════════ */
.nav-link .notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  font-size: .58rem;
  font-weight: 800;
  border-radius: 999px;
  background: var(--gradient-brand);
  color: #fff;
  vertical-align: middle;
  margin-left: 6px;
  line-height: 1;
  box-shadow: 0 0 8px rgba(124, 92, 191, 0.30);
}
.nav-link .notif-badge[hidden] { display: none !important; }
.nav-link .category-badge {
  /* Quieter tab aggregates — no pulse, smaller than row badges. */
  animation: none;
}

/* ── Sidebar tool count badges ── */
.admin-tools-nav-item .tool-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-size: .62rem;
  font-weight: 800;
  border-radius: 999px;
  background: var(--gradient-brand);
  color: #fff;
  margin-left: 8px;
  line-height: 1;
  box-shadow: 0 0 8px rgba(124, 92, 191, 0.30);
  flex-shrink: 0;
  animation: tool-badge-pulse 2.4s ease-in-out infinite;
}
.admin-tools-nav-item .tool-badge[hidden] { display: none !important; animation: none; }
@keyframes tool-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.admin-tools-nav-item.active .tool-badge {
  box-shadow: 0 0 10px rgba(124, 92, 191, 0.40);
}

/* ════════════════════════════════════════
   EMPTY STATES
════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 56px 24px;
}
.empty-state-icon {
  font-size: 3.2rem;
  margin-bottom: 14px;
  opacity: .35;
  display: block;
}
.empty-state-title, .empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--purple-light);
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.empty-state-desc, .empty-desc {
  font-size: .86rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ════════════════════════════════════════
   CASE STATUS TIMELINE
════════════════════════════════════════ */
.case-timeline {
  display: flex;
  align-items: flex-start;
  margin: 16px 0 20px;
  padding: 16px 20px;
  background: rgba(16, 19, 32, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  gap: 0;
}
.timeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  position: relative;
}
.timeline-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 16px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.timeline-step.done:not(:last-child)::after {
  background: linear-gradient(90deg, var(--purple), var(--gold));
}
.timeline-step.active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--purple), var(--border));
}
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 800;
  position: relative; z-index: 1;
  transition: all .25s;
  color: var(--text-muted);
}
.timeline-step.done .timeline-dot {
  background: linear-gradient(135deg, var(--purple), var(--gold));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px rgba(124, 92, 191, 0.3);
}
.timeline-step.active .timeline-dot {
  border-color: var(--purple);
  color: var(--purple-light);
  box-shadow: 0 0 0 4px var(--purple-dim), 0 2px 12px rgba(124, 92, 191, 0.15);
  animation: pulse-dot 2s ease-in-out infinite;
}
.timeline-step.denied .timeline-dot {
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: 0 0 0 4px rgba(237, 66, 69, 0.1);
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px var(--purple-dim), 0 2px 12px rgba(124, 92, 191, 0.15); }
  50% { box-shadow: 0 0 0 8px rgba(124, 92, 191, 0.06), 0 2px 16px rgba(124, 92, 191, 0.2); }
}
.timeline-label {
  font-size: .66rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  white-space: nowrap;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.timeline-step.done .timeline-label { color: var(--gold); }
.timeline-step.active .timeline-label { color: var(--purple-light); }
.timeline-step.denied .timeline-label { color: var(--danger); }

/* Immediate Prosecution workflow */
.ip-workflow { display: flex; flex-direction: column; gap: 14px; }
.ip-workflow-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ip-save-indicator { font-size: .85rem; color: var(--text-secondary); }
.ip-save-indicator[data-state="saved"] { color: var(--secondary); }
.ip-save-indicator[data-state="error"] { color: var(--danger); }
.ip-workflow-timeline {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin: 8px 0 12px;
  padding: 12px 10px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
}
.ip-timeline-step {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  flex: 1 1 0;
  min-width: 64px;
  max-width: 110px;
}
.ip-timeline-step:disabled { cursor: default; opacity: .55; }
.ip-timeline-step.upcoming .timeline-dot { opacity: .45; }
.ip-timeline-step .timeline-label {
  font-size: .62rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding: 0 2px;
}
.ip-step-panel-head {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ip-deliberation-add-charge {
  margin: 16px 0;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(124, 92, 191, 0.04);
}
.ip-deliberation-add-hint { font-size: .84rem; margin: 4px 0 10px; }
.ip-court-charge-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 4px;
  background: rgba(124, 92, 191, 0.2);
  color: var(--purple-light, #a78bfa);
  vertical-align: middle;
}
.ip-verdict-auto {
  font-weight: 600;
  color: var(--text-primary);
}
.ip-no-reduction-hint {
  color: var(--text-secondary);
  font-size: .85em;
}
.ip-verdict-remove { margin-left: auto; flex-shrink: 0; }
.ip-verdict-empty { margin: 12px 0; }
.ip-verdict-rows .ip-verdict-row { display: grid; }
.ip-add-charge { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.ip-add-charge-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.ip-add-charge-row input[type="search"] { flex: 1 1 200px; min-width: 0; }
.ip-panel-empty { padding: 12px 4px; color: var(--text-secondary); line-height: 1.5; }
.ip-prompt-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.ip-stage-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin-bottom: 6px; }
.ip-prompt-text { font-size: 1.05rem; line-height: 1.55; white-space: pre-wrap; }
.ip-prompt-note { margin-top: 8px; font-size: .88rem; color: var(--text-secondary); }
.ip-step-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; min-height: 80px; }
.ip-charges-table .ip-charge-row,
.ip-pleas-table .ip-plea-row,
.ip-verdict-table .ip-verdict-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.ip-charges-table .ip-charge-row { grid-template-columns: 1fr auto; }
.ip-pleas-table .ip-plea-row { grid-template-columns: 1fr minmax(160px, 220px); }
.ip-plea-select, .ip-verdict-select { min-height: 44px; font-size: .95rem; }
.ip-verdict-table .ip-verdict-header,
.ip-verdict-table .ip-verdict-row {
  grid-template-columns: 1.4fr .7fr .9fr .7fr .6fr;
}
.ip-sentence-calculator {
  margin-top: 20px;
  margin-bottom: 0;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ip-calc-heading { font-weight: 700; margin-bottom: 4px; }
.ip-calc-sub { font-size: .88rem; margin: 0 0 12px; }
.ip-calc-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-secondary);
  margin: 12px 0 8px;
}
.ip-calc-summary {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-base);
}
.ip-calc-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.ip-calc-summary-row:last-child { border-bottom: none; }
.ip-calc-summary-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
}
.ip-calc-summary-value {
  font-size: 1.1rem;
  font-weight: 800;
  text-align: right;
}
.ip-calc-summary-value.fine { color: var(--gold-light, var(--gold)); }
.ip-calc-summary-value.time { color: var(--purple-light, #a78bfa); }
.ip-calc-summary-muted { color: var(--text-muted); font-weight: 600; font-size: .95rem; }
.ip-calc-summary-unit { font-size: .75rem; font-weight: 600; color: var(--text-muted); }
.ip-calc-reduction {
  margin-bottom: 12px;
  padding: 14px;
  background: rgba(124, 92, 191, 0.06);
  border: 1px solid var(--purple-border, rgba(124, 92, 191, 0.25));
  border-radius: 8px;
}
.ip-calc-reduction-row { display: block; width: 100%; }
.ip-calc-reduction-row input[type="range"] {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  cursor: pointer;
  background: linear-gradient(to right, var(--purple) 0%, var(--purple) var(--pct, 0%), rgba(124, 92, 191, 0.18) var(--pct, 0%), rgba(124, 92, 191, 0.18) 100%);
  outline: none;
}
.ip-calc-reduction-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--purple-light, #a78bfa);
  border: 2px solid var(--bg-base);
  cursor: grab;
}
.ip-calc-reduction-hint { font-size: .82rem; color: var(--text-secondary); margin: 10px 0 0; line-height: 1.5; }
.ip-calc-outcome {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.ip-calc-outcome.mrc { border-color: rgba(255, 158, 161, .35); background: rgba(255, 158, 161, .06); }
.ip-calc-outcome.cs { border-color: rgba(87, 242, 135, .35); background: rgba(87, 242, 135, .06); }
.ip-calc-outcome-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }
.ip-calc-outcome-value { font-size: 1.05rem; font-weight: 700; margin-top: 4px; }
.ip-calc-outcome-note { font-size: .82rem; color: var(--text-secondary); margin-top: 4px; }
.ip-verdict-read-table .ip-verdict-read-header,
.ip-verdict-read-table .ip-verdict-read-row {
  display: grid;
  grid-template-columns: 1.3fr .75fr .75fr .65fr .55fr;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.ip-charge-stat-muted { opacity: .45; }
.ip-charge-fine, .ip-charge-weeks { font-weight: 600; }
.ip-verdict-read-header { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }
.ip-verdict-read-value { font-weight: 700; }
.ip-verdict-read-sentence { color: var(--gold); font-weight: 600; }
.ip-verdict-read-note { font-size: .88rem; margin-top: 12px; }

.ip-court-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ip-court-summary-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.ip-court-summary-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ip-court-summary-meta-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
}
.ip-court-summary-outcome {
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(124, 92, 191, 0.35);
  background: rgba(124, 92, 191, 0.08);
}
.ip-court-summary-outcome-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.ip-court-summary-outcome-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}
.ip-court-summary-outcome-detail {
  margin-top: 6px;
  font-size: .9rem;
  color: var(--text-secondary);
}
.ip-court-summary-section-title {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}
.ip-court-summary-notes p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--text-secondary);
}
.ip-verdict-header { display: grid; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.ip-verdict-name, .ip-plea-name, .ip-charge-name { font-weight: 600; }
.ip-plea-muted { color: var(--text-secondary); font-size: .88rem; }
.ip-final-time { font-weight: 700; color: var(--gold); }
.ip-row-error { outline: 2px solid var(--danger); outline-offset: 2px; border-radius: 4px; }
.ip-warn { color: var(--warning); font-size: .85rem; }
.ip-diff-hint { grid-column: 1 / -1; font-size: .78rem; color: var(--warning); }
.ip-definition-card { margin-top: 10px; padding: 12px; background: var(--bg-elevated); border-radius: 8px; line-height: 1.5; max-width: 720px; }
.ip-argument-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ip-argument-heading h3 { margin: 0; font-size: 1.1rem; }
.ip-side-badge { font-size: .72rem; padding: 3px 8px; border-radius: 999px; background: var(--purple-muted); color: var(--purple-light); text-transform: uppercase; letter-spacing: .04em; }
.ip-witness-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ip-workflow-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0 4px;
  background: linear-gradient(transparent, var(--bg-card) 20%);
  margin-top: 4px;
}
.ip-arg-branch-panel { line-height: 1.55; }
.ip-arg-branch-lead { margin: 0 0 10px; }
.ip-arg-branch-hint { font-size: .88rem; margin: 12px 0 0; }
.ip-footer-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ip-case-details { margin-top: 4px; font-size: .9rem; }
.ip-case-details-charges {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ip-case-details-section-label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}
.ip-case-details-charges-hint {
  font-size: .85rem;
  margin: 0 0 10px;
}
.btn-sm { padding: 4px 10px; font-size: .82rem; }

/* Legislation changelog + Charges Catalog admin */
.leg-changelog { margin-top: 20px; }
.leg-changelog-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.leg-changelog-entry { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.leg-changelog-entry summary { padding: 10px 12px; cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.leg-changelog-select { display: inline-flex; align-items: center; margin: 0; cursor: pointer; }
.leg-changelog-select input { width: auto; margin: 0; }
.leg-changelog-entry .leg-changelog-delete { margin-left: auto; }
.leg-changelog-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.leg-badge { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--bg-elevated); }
.leg-badge.added { color: var(--secondary); }
.leg-badge.modified { color: var(--warning); }
.leg-badge.removed { color: var(--danger); }
.leg-changelog-detail { padding: 0 12px 12px; font-size: .88rem; }

/* Public change-log trigger button + overlay */
.leg-changelog-trigger-wrap { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.leg-changelog-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.leg-changelog-trigger:hover {
  color: var(--text-primary);
  border-color: var(--purple-border);
  background: var(--bg-secondary);
}
.leg-changelog-trigger svg { opacity: .8; }
.leg-changelog-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  color: var(--purple-light);
  background: rgba(124, 92, 255, .16);
  border-radius: 999px;
}
.leg-changelog-modal { width: 480px; max-width: 92vw; }
.leg-changelog-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.leg-changelog-modal-head .modal-title { margin-bottom: 0; }
.leg-changelog-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color .15s;
}
.leg-changelog-close:hover { color: var(--text-primary); }
.leg-changelog-modal-body { max-height: 60vh; overflow-y: auto; }
.leg-changelog-modal-body .leg-changelog-entry:last-child { border-bottom: none !important; }

/* Detailed change log content */
.leg-changelog-modal-body .leg-changelog-entry {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin-bottom: 0;
  padding: 16px 2px 18px;
}
.leg-chg-entry-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.leg-chg-date { font-weight: 700; font-size: .98rem; }
.leg-chg-eff { font-size: .78rem; color: var(--text-secondary); margin-top: 2px; }
.leg-chg-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.leg-chg-pill {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.leg-chg-pill.added, .leg-chg-tag.added { background: rgba(63,185,80,0.16); color: #6fdc8c; }
.leg-chg-pill.modified, .leg-chg-tag.modified { background: rgba(212,175,55,0.16); color: #f0d674; }
.leg-chg-pill.removed, .leg-chg-tag.removed { background: rgba(237,66,69,0.16); color: #ff9ea1; }

.leg-chg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.leg-chg-item {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.015);
}
.leg-chg-tag {
  font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
}
.leg-chg-name { font-weight: 600; font-size: .92rem; }
.leg-chg-cat { font-size: .76rem; color: var(--text-secondary); }
.leg-chg-fields { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.leg-chg-field {
  display: grid;
  grid-template-columns: 120px 1fr auto 1fr;
  align-items: baseline;
  gap: 8px;
  font-size: .82rem;
  padding-left: 4px;
}
.leg-chg-field-label { color: var(--text-secondary); font-weight: 600; }
.leg-chg-from { color: #ff9ea1; text-decoration: line-through; opacity: .85; word-break: break-word; }
.leg-chg-arrow { color: var(--text-secondary); }
.leg-chg-to { color: #6fdc8c; word-break: break-word; }
@media (max-width: 560px) {
  .leg-chg-field { grid-template-columns: 1fr; gap: 2px; }
  .leg-chg-arrow { display: none; }
}

/* Charges Catalog - premium admin panel */
.catalog-admin {
  padding: 0;
  overflow: hidden;
  border-color: rgba(124, 92, 191, 0.22);
  background:
    radial-gradient(ellipse 80% 60% at 100% -10%, rgba(124, 92, 191, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(201, 168, 76, 0.06), transparent 50%),
    rgba(16, 19, 32, 0.85);
}
.catalog-admin .tool-title { display: none; }
.catalog-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 26px 28px 22px;
  border-bottom: 1px solid rgba(124, 92, 191, 0.15);
}
.catalog-eyebrow {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.catalog-headline {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
  background: linear-gradient(135deg, #fff 0%, #c4b5fd 45%, #c9a84c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.catalog-lede {
  margin: 0;
  max-width: 52ch;
  font-size: .92rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.catalog-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.catalog-status-pill.is-ok {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
}
.catalog-status-pill.is-error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
}
.catalog-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}
.catalog-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(124, 92, 191, 0.12);
  border-bottom: 1px solid rgba(124, 92, 191, 0.12);
}
.catalog-stat {
  padding: 20px 24px;
  background: rgba(12, 14, 24, 0.55);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.catalog-stat-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}
.catalog-stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  background: linear-gradient(135deg, #f8fafc, #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.catalog-stat-value-sm {
  font-size: 1.05rem;
  -webkit-text-fill-color: var(--text-primary);
  color: var(--text-primary);
  background: none;
}
.catalog-stat-hint {
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.catalog-upload-panel {
  padding: 24px 28px 28px;
}
.catalog-upload-header { margin-bottom: 18px; }
.catalog-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 28px 0;
}
.catalog-section-title {
  margin: 0 0 4px;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}
.catalog-section-desc {
  margin: 0;
  font-size: .84rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.catalog-upload-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}
.catalog-field-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--purple-light);
  margin-bottom: 8px;
}
.catalog-field-hint {
  margin: 8px 0 0;
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.catalog-drop-zone {
  position: relative;
  min-height: 168px;
  padding: 28px 22px;
  border: 1.5px dashed rgba(124, 92, 191, 0.35);
  border-radius: 14px;
  background: rgba(8, 10, 18, 0.5);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s, transform .2s;
}
.catalog-drop-zone:hover,
.catalog-drop-zone:focus-visible {
  outline: none;
  border-color: rgba(201, 168, 76, 0.55);
  background: rgba(124, 92, 191, 0.06);
  box-shadow: 0 0 0 4px rgba(124, 92, 191, 0.08);
}
.catalog-drop-zone.drag-over {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.08);
  transform: scale(1.005);
}
.catalog-drop-zone.has-file {
  border-style: solid;
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
}
.catalog-drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(124, 92, 191, 0.12);
  color: var(--purple-light);
}
.catalog-drop-zone.has-file .catalog-drop-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
}
.catalog-drop-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  word-break: break-word;
}
.catalog-drop-meta {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.catalog-drop-browse {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(124, 92, 191, 0.35);
  background: rgba(124, 92, 191, 0.1);
  color: var(--purple-light);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.catalog-drop-browse:hover {
  background: rgba(124, 92, 191, 0.18);
  border-color: var(--purple-light);
}
.catalog-date-input {
  font-size: .95rem;
  padding: 12px 14px;
  border-radius: 10px;
}
.catalog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.catalog-actions-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 4px;
}
.catalog-btn-primary {
  min-width: 140px;
  padding: 11px 20px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(124, 92, 191, 0.25);
}
.catalog-btn-secondary { padding: 10px 16px; }
.catalog-btn-ghost { font-size: .84rem; }
.catalog-preview {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: .88rem;
  line-height: 1.45;
}
.catalog-preview.is-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #a7f3d0;
}
.catalog-preview.is-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fecaca;
}
.catalog-preview-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: .75rem;
}
.catalog-preview.is-success .catalog-preview-icon { background: rgba(16, 185, 129, 0.2); }
.catalog-preview.is-error .catalog-preview-icon { background: rgba(239, 68, 68, 0.2); }
.catalog-changelog-card,
.catalog-preview-card {
  padding-bottom: 24px;
}
.catalog-changelog-card .catalog-section-header,
.catalog-preview-card .catalog-section-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.catalog-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 28px 16px;
}
.catalog-filter-input,
.catalog-filter-select {
  max-width: 200px;
  font-size: .84rem;
  padding: 9px 12px;
  border-radius: 8px;
}
.catalog-filter-btn { padding: 9px 14px; font-size: .82rem; }
.catalog-changelog-list {
  padding: 0 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.catalog-log-entry {
  border-radius: 10px;
  border-color: rgba(124, 92, 191, 0.15);
  background: rgba(8, 10, 18, 0.35);
  overflow: hidden;
}
.catalog-log-summary {
  padding: 12px 14px !important;
  gap: 10px 14px !important;
}
.catalog-log-summary::-webkit-details-marker { display: none; }
.catalog-log-date { font-weight: 600; font-size: .86rem; }
.catalog-log-effective {
  margin-left: 6px;
  font-weight: 500;
  color: var(--gold);
  font-size: .8rem;
}
.catalog-log-file { font-size: .78rem; margin-left: auto; }
.catalog-log-detail {
  padding: 0 14px 12px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 10px !important;
  line-height: 1.55;
}
.catalog-table-wrap {
  margin: 0 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.catalog-table thead th {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: rgba(8, 10, 18, 0.6);
  padding: 10px 12px;
}
.catalog-table tbody td {
  padding: 10px 12px;
  font-size: .86rem;
  vertical-align: middle;
}
.catalog-table tbody tr:hover td { background: rgba(124, 92, 191, 0.04); }
.catalog-cat-chip {
  display: inline-block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: .72rem;
  background: rgba(124, 92, 191, 0.12);
  color: var(--purple-light);
}
.catalog-id {
  font-size: .72rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}
.catalog-fine {
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.catalog-table-foot {
  padding: 10px 28px 0;
  font-size: .78rem;
}
@media (max-width: 900px) {
  .catalog-stats { grid-template-columns: 1fr; }
  .catalog-upload-grid { grid-template-columns: 1fr; }
  .catalog-hero { padding: 20px; }
  .catalog-upload-panel,
  .catalog-filter-bar,
  .catalog-changelog-list,
  .catalog-table-wrap { padding-left: 20px; padding-right: 20px; margin-left: 0; margin-right: 0; }
  .catalog-section-header { padding-left: 20px; padding-right: 20px; }
  .catalog-log-file { margin-left: 0; width: 100%; }
}

/* ════════════════════════════════════════
   CASE DETAIL PANEL
════════════════════════════════════════ */
.case-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 6px 0;
  box-shadow: inset 0 1px 0 rgba(124, 92, 191, 0.05);
}
.case-detail-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 20px;
  margin-bottom: 14px;
}
.case-detail-field label {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--purple-light);
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
}
.case-detail-field .val {
  font-size: .88rem;
  color: var(--text-primary);
  word-break: break-word;
}
.case-notes-list { margin: 10px 0; }
.case-note-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 6px;
  font-size: .86rem;
}
.case-note-meta {
  font-size: .72rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ════════════════════════════════════════
   GLOBAL SEARCH
════════════════════════════════════════ */
#global-search-wrap { position: relative; }
#global-search-input {
  width: 200px;
  padding: 7px 14px 7px 14px;
  font-size: .84rem;
  background: rgba(10, 12, 22, 0.6);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  outline: none;
  transition: all .2s ease;
  backdrop-filter: blur(8px);
}
#global-search-input:focus {
  border-color: var(--purple-border);
  width: 260px;
  box-shadow: 0 0 0 3px var(--purple-dim);
  background: var(--bg-input);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  min-width: 280px;
  background: var(--bg-elevated);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 24px rgba(124, 92, 191, 0.06);
  z-index: 9999;
  overflow: hidden;
}
.search-result-item {
  padding: 10px 16px;
  font-size: .84rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
  transition: background .1s;
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover {
  background: var(--purple-dim);
  color: var(--purple-light);
}
.search-dropdown-grouped { max-height: 70vh; overflow-y: auto; }
.search-partial-hint {
  padding: 8px 16px;
  font-size: .78rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 193, 7, 0.08);
}
.search-group-header {
  padding: 8px 16px 4px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--purple-light);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.search-group + .search-group .search-group-header { border-top: 1px solid var(--border); }
.search-result-link {
  display: block;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.search-result-link:hover { text-decoration: none; }
.search-result-label { display: block; }
.search-result-sublabel { display: block; font-size: .75rem; margin-top: 2px; }
.search-see-all {
  display: block;
  padding: 8px 16px;
  font-size: .8rem;
  color: var(--purple-light);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.search-see-all:hover { background: var(--purple-dim); }
.search-empty {
  padding: 12px 16px;
  font-size: .84rem;
  color: var(--text-secondary);
}

/* Notification delivery preferences (M2) */
.notif-pref-group { margin-bottom: 1.25rem; }
.notif-pref-group-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--purple-light);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.notif-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.notif-pref-row:last-child { border-bottom: none; }
.notif-pref-label { flex: 1; font-size: .9rem; }
.notif-pref-channel {
  min-width: 180px;
  padding: 6px 8px;
  font-size: .82rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

/* ════════════════════════════════════════
   EARNINGS BANNER
════════════════════════════════════════ */
.earnings-banner {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.earnings-banner .stat-card {
  flex: 1;
  min-width: 140px;
  text-align: center;
}
.earnings-banner .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-brand-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.earnings-banner .stat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ════════════════════════════════════════
   TAB BAR
════════════════════════════════════════ */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: .84rem;
  font-weight: 600;
  font-family: inherit;
  padding: 9px 18px;
  cursor: pointer;
  letter-spacing: .03em;
  transition: all .16s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--purple-light);
  border-bottom-color: var(--purple);
}

/* ════════════════════════════════════════
   CHARACTER SWITCHER
════════════════════════════════════════ */
.char-switch-btn {
  font-size: .8rem;
  padding: 5px 12px;
}
.char-switch-btn:not(.btn-ghost) {
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  border: none;
}
.char-switch-btn:not(.btn-ghost):hover { background: var(--purple-light); }

/* ════════════════════════════════════════
   SESSION EXPIRED OVERLAY
════════════════════════════════════════ */
.session-expired-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(6, 7, 17, 0.90);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
}
.session-expired-card {
  background: var(--bg-secondary);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-xl);
  padding: 40px 44px;
  text-align: center;
  max-width: 420px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 60px rgba(124, 92, 191, 0.06);
}
.session-expired-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-brand);
}
.session-expired-card h2 {
  background: var(--gradient-brand-light);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  font-size: 1.3rem;
  font-weight: 800;
}
.session-expired-card p { color: var(--text-secondary); margin-bottom: 20px; font-size: .88rem; }

/* ════════════════════════════════════════
   DROP ZONE FILE UPLOAD
════════════════════════════════════════ */
.drop-zone {
  position: relative;
  border: 2px dashed var(--purple-border);
  border-radius: var(--radius-lg, 12px);
  background: var(--bg-input);
  padding: 26px 20px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, box-shadow .18s;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  outline: none;
}
.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--purple-light);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--purple-dim);
}
.drop-zone.drag-over {
  border-color: var(--gold);
  border-style: solid;
  background: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-dim), 0 0 24px rgba(201, 168, 76, .12);
}
.drop-zone.has-file {
  border-color: var(--secondary);
  border-style: solid;
}
.drop-zone-icon {
  font-size: 2rem;
  line-height: 1;
  color: var(--purple-light);
  transition: transform .2s, color .18s;
  pointer-events: none;
}
.drop-zone.drag-over .drop-zone-icon {
  transform: translateY(-5px);
  color: var(--gold);
}
.drop-zone-text {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 4px 0 0;
  pointer-events: none;
}
.drop-zone-hint {
  font-size: .8rem;
  color: var(--text-secondary);
  margin: 2px 0 0;
}
.drop-zone-browse {
  background: none;
  border: none;
  color: var(--purple-light);
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.drop-zone-browse:hover { color: var(--gold-light); }
.drop-zone-preview {
  margin-top: 10px;
  width: 100%;
}
.drop-zone-preview img {
  max-height: 90px;
  max-width: 100%;
  border-radius: var(--radius, 8px);
  border: 1px solid var(--border);
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.drop-zone-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .8rem;
  color: var(--text-primary);
  max-width: 100%;
  overflow: hidden;
}
.drop-zone-file-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drop-zone-clear {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .9rem;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}
.drop-zone-clear:hover { color: var(--danger); }

/* ════════════════════════════════════════
   LIGHT MODE  (F-29)
   Complete overrides for users who prefer light theme
════════════════════════════════════════ */
@media (prefers-color-scheme: light) {
  :root {
    --bg-page:      #f0f2f8;
    --bg-dark:      #f0f2f8;
    --bg-card:      #ffffff;
    --bg-secondary: #eef0f8;
    --bg-elevated:  #e8eaf4;
    --bg-input:     #f5f6fc;
    --bg-tertiary:  #e0e2ee;
    --text-primary: #0d0f1e;
    --text-secondary: #444666;
    --text-muted:   #666888;
    --border:       rgba(0,0,0,.15);
    --border-color: rgba(0,0,0,.15);

    /* Glass: light, airy overlay */
    --glass-bg:     rgba(255,255,255,.75);
    --glass-border: rgba(0,0,0,.10);
    --glass-blur:   16px;

    /* Hover: subtle purple tint on light bg */
    --bg-hover:     rgba(124,92,191,.06);

    /* Gold accents — darker tones for contrast on white */
    --gold:            #8b7030;
    --gold-light:      #a68a40;
    --gold-dim:        rgba(139,112,48,.08);
    --gold-border:     rgba(139,112,48,.25);
    --gold-border-hv:  rgba(139,112,48,.50);
    --gold:            #8b7030;
    --gold-light:      #a68a40;
    --gold-dim:        rgba(139,112,48,.08);

    /* Purple accents */
    --purple:        #5c3fa0;
    --purple-light:  #7a5cc0;
    --purple-dim:    rgba(92,63,160,.08);
    --purple-border: rgba(92,63,160,.25);
    --purple-glow:   rgba(92,63,160,.10);
  }

  /* ── Replace transparent gradient text with solid colors ── */
  .nav-brand-text,
  .page-header h1,
  .stat-card p {
    -webkit-text-fill-color: unset;
    background: none;
    color: var(--purple);
  }
  .page-header h1 {
    background: none;
    -webkit-text-fill-color: unset;
    color: #3a2070;
  }
  .stat-card p { color: var(--purple); }

  /* ── Login page gradient title ── */
  .login-title {
    background: none;
    -webkit-text-fill-color: unset;
    color: #3a2070;
  }

  /* ── Card / glass backgrounds ── */
  .stat-card,
  .glass-bg,
  .skeleton-card,
  .skeleton-table {
    background: var(--bg-card);
    border-color: var(--border);
  }

  /* ── Navbar ── */
  .top-nav {
    background: rgba(255,255,255,.82);
    border-bottom-color: var(--border);
  }
  .nav-links {
    background: rgba(255,255,255,.95);
    border-bottom-color: var(--border);
  }

  /* ── Command tools card ── */
  .command-tools-card {
    background: var(--bg-card);
    border-color: var(--border);
  }
  .admin-tools-sidebar {
    background: var(--bg-secondary);
    border-right-color: var(--border);
  }
  .admin-tools-nav-item {
    color: var(--text-primary);
  }
  .admin-tools-nav-item:hover,
  .admin-tools-nav-item.active {
    background: var(--bg-hover);
  }

  /* ── Button overrides ── */
  .btn.secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border);
  }
  .btn.secondary:hover {
    background: var(--bg-hover);
  }

  /* ── Form elements ── */
  input, textarea, select {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border);
  }
  input:focus, textarea:focus, select:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-dim);
  }

  /* ── Drop zones ── */
  .drop-zone {
    background: var(--bg-input);
    border-color: var(--border);
  }
  .drop-zone:hover, .drop-zone-active {
    border-color: var(--purple);
    background: var(--bg-hover);
  }

  /* ── Breadcrumb ── */
  .breadcrumb { color: var(--text-secondary); }
  .breadcrumb a { color: var(--purple); }
  .breadcrumb a:hover { color: var(--purple-light); }

  /* ── User menu dropdown ── */
  .user-menu-dropdown {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,.10);
  }
  .user-menu-item { color: var(--text-primary); }
  .user-menu-item:hover { background: var(--bg-hover); }
  .user-menu-divider { border-color: var(--border); }

  /* ── Login page card ── */
  .login-card {
    background: rgba(255,255,255,.82);
    border-color: var(--border);
    box-shadow: 0 0 80px rgba(124,92,191,.03), 0 32px 80px rgba(0,0,0,.10);
  }
  .login-page::before {
    background: radial-gradient(circle, rgba(124,92,191,.06) 0%, transparent 60%);
  }

  /* ── Notification / banner ── */
  .message.error { background: rgba(237,66,69,.08); }
  .message.success { background: rgba(87,242,135,.08); }
  .message.warning { background: rgba(250,166,26,.08); }

  /* ── Loading bar ── */
  .global-loading-bar::after {
    background: linear-gradient(90deg, var(--purple), var(--gold), var(--purple));
  }

  /* ── Logo drop shadow for light bg ── */
  .login-logo {
    filter: drop-shadow(0 4px 24px rgba(92,63,160,.15));
  }
}

/* ════════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(124, 92, 191, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(124, 92, 191, 0.35); }

/* ════════════════════════════════════════
   BUSINESS TOOLS - multi-business landing,
   per-business detail, applications.
════════════════════════════════════════ */

/* Section sub-heading inside the registration form. */
.section-heading {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--purple-light);
  margin-top: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--purple-border);
}

/* ── Business cards (multi-business landing grid) ── */
.business-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
button.business-card,
.business-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s, transform .12s;
  min-height: 120px;
  font-family: inherit;
}
button.business-card:hover,
.business-card:hover {
  border-color: var(--purple-border);
  background: rgba(124, 92, 191, 0.06);
  box-shadow: 0 4px 18px rgba(124, 92, 191, 0.12);
}
button.business-card:active { transform: scale(0.99); }
.business-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.business-card-name {
  font-size: .98rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.business-card-meta {
  font-size: .82rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin-top: 2px;
}
.business-card-meta.muted { color: var(--text-secondary); }
.business-card-footer {
  margin-top: auto;
  padding-top: 10px;
  font-size: .72rem;
  color: var(--text-muted);
  letter-spacing: .04em;
}
.business-card-closed {
  opacity: 0.6;
  background: rgba(125, 125, 145, 0.04);
}
.business-card-closed .business-card-name {
  text-decoration: line-through;
  text-decoration-color: rgba(125, 125, 145, 0.4);
}

/* "Register Another Business" CTA card */
button.business-card-add {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: transparent;
  border: 1.5px dashed var(--purple-border);
  color: var(--purple-light);
  min-height: 140px;
  gap: 10px;
}
button.business-card-add:hover {
  background: var(--purple-dim);
  border-color: var(--purple);
  border-style: solid;
}
.business-card-add-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--purple-dim);
  border: 1px solid var(--purple-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.business-card-add-icon svg { width: 20px; height: 20px; }
.business-card-add-label {
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .04em;
}

/* ── Per-business detail header ── */
.business-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.business-detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Status pills ── (also used for business statuses) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill-active {
  color: var(--secondary);
  background: rgba(87, 242, 135, 0.08);
  border-color: rgba(87, 242, 135, 0.25);
}
.status-pill-pending {
  color: var(--gold-light);
  background: var(--gold-dim);
  border-color: rgba(201, 168, 76, 0.3);
}
.status-pill-denied,
.status-pill-revoked,
.status-pill-expired {
  color: #ff9ea1;
  background: rgba(237, 66, 69, 0.08);
  border-color: rgba(237, 66, 69, 0.25);
}
.status-pill-suspended {
  color: var(--gold-light);
  background: rgba(201, 168, 76, 0.10);
  border-color: rgba(201, 168, 76, 0.3);
}
.status-pill-withdrawn,
.status-pill-cancelled,
.status-pill-renewed,
.status-pill-closed,
.status-pill-default {
  color: var(--text-muted);
  background: rgba(125, 125, 145, 0.06);
  border-color: rgba(125, 125, 145, 0.2);
}

/* Inline expiry warning badges. */
.expiry-warn { font-weight: 600; font-size: .82rem; margin-left: 4px; }
.expiry-warn-expired,
.expiry-warn-critical { color: #ff9ea1; }
.expiry-warn-soon { color: var(--orange, #faa61a); }
.expiry-warn-warn { color: #faa61a; }

/* ── Application cards (pending / past) ── */
.application-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.application-card-pending {
  border-left: 3px solid var(--gold);
}
.application-card-past {
  background: rgba(125, 125, 145, 0.04);
  border-left: 3px solid rgba(125, 125, 145, 0.2);
}
.application-card-judge {
  border-left: 3px solid var(--purple);
}
.application-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.application-card-type {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text-primary);
}
.application-card-meta { font-size: .78rem; margin-top: 2px; }
.application-card-data {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 14px;
  font-size: .82rem;
  margin-top: 4px;
  padding: 8px 10px;
  background: rgba(10, 12, 22, 0.4);
  border-radius: var(--radius-sm);
}
.application-card-data-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.application-card-data-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.application-card-data-value {
  color: var(--text-primary);
  word-break: break-word;
}
.application-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.application-card-judge-form:empty { display: none; }

/* ── Pending applications card (Judge view) ── */
.pending-applications-card { border-left: 3px solid var(--accent-gold); }

/* ── Inline licence-application panel (registration form expansion +
   Apply for New Licence + Reapply form) ── */
.licence-application-panel {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(124, 92, 191, 0.04) 0%, transparent 100%);
}
.licence-application-panel[hidden] { display: none; }
.licence-application-panel-header { margin-bottom: 10px; }
.licence-application-panel-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--purple-light);
}

/* ── Field grid used inside renderFieldsHTML ── */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 6px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.field-wide { grid-column: 1 / -1; }
/* Labels get a consistent min-height and bottom alignment so inputs line up
   across a row even when one label wraps to two lines. */
.field label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 1.9em;
  display: flex;
  align-items: flex-end;
  line-height: 1.25;
}
.field input,
.field select,
.field textarea { width: 100%; box-sizing: border-box; }
.field-hint { font-size: .72rem; margin-top: 2px; min-height: 0; }
@media (max-width: 560px) {
  .field-grid { grid-template-columns: 1fr; }
}
.field input.invalid,
.field select.invalid,
.field textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(237, 66, 69, 0.15);
}

.multi-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 12px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.multi-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: .82rem;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  margin-bottom: 0;
}
.multi-option input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--purple);
}

/* ── Button variants used by the new flows ── */
.btn.btn-sm {
  font-size: .78rem;
  padding: 6px 12px;
  letter-spacing: .04em;
}
.btn.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
  box-shadow: 0 4px 16px rgba(237, 66, 69, 0.25);
}
.btn.btn-danger:hover {
  background: #ff5b5e;
  border-color: #ff5b5e;
}
.btn.btn-danger:disabled {
  background: rgba(237, 66, 69, 0.3);
  border-color: rgba(237, 66, 69, 0.3);
  cursor: not-allowed;
  box-shadow: none;
}
.btn.btn-danger-ghost {
  background: transparent;
  color: #ff9ea1;
  border: 1px solid rgba(237, 66, 69, 0.25);
  box-shadow: none;
}
.btn.btn-danger-ghost:hover {
  background: rgba(237, 66, 69, 0.1);
  border-color: var(--danger);
  color: #fff;
}

/* Closed-businesses details summary tweak */
.closed-businesses-details > summary {
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0;
}

/* ── Judge Business Profile: title + actions ── */
.judge-bp-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.judge-bp-title-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Judge Actions row - clearly delineated so the Transfer Business button
   doesn't get lost in the title bar. */
.judge-actions-row {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px dashed var(--purple-border);
  border-radius: var(--radius-md);
  background: rgba(124, 92, 191, 0.04);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.judge-actions-row-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--purple-light);
}
.btn.btn-judge-action {
  display: inline-flex;
  align-items: center;
  background: rgba(212, 168, 83, 0.12);
  color: var(--gold-light);
  border: 1px solid rgba(212, 168, 83, 0.4);
  font-weight: 600;
}
.btn.btn-judge-action:hover {
  background: rgba(212, 168, 83, 0.22);
  border-color: var(--gold);
  color: #fff;
}

/* ── Business ownership transfer cards ── */
.transfer-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg-elevated);
}
.transfer-card:last-child { margin-bottom: 0; }
.transfer-card-pending {
  border-left: 3px solid var(--gold);
  background: linear-gradient(180deg, rgba(212, 168, 83, 0.06) 0%, transparent 100%);
}
.transfer-card-judge {
  border-left: 3px solid var(--purple);
  background: linear-gradient(180deg, rgba(124, 92, 191, 0.05) 0%, transparent 100%);
}
.transfer-card-past {
  opacity: 0.85;
  background: var(--bg-input);
}
.transfer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.transfer-card-title {
  font-weight: 600;
  font-size: .92rem;
  color: var(--text-primary);
}

/* ════════════════════════════════════════
   BUSINESS LICENCE MANAGER - header, badge, price tags
════════════════════════════════════════ */
.bm-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 8px;
  border-radius: 9px;
  background: var(--purple);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
}
.licence-price-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--gold-dim, rgba(201, 168, 76, 0.16));
  color: var(--gold-light, #e0c873);
  border: 1px solid var(--gold-border, rgba(201, 168, 76, 0.4));
  font-size: .72rem;
  font-weight: 700;
  vertical-align: middle;
}

/* ── Running monthly licence cost total (registration) ── */
.licence-total {
  margin-top: 16px;
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-md, 10px);
  background: linear-gradient(135deg, rgba(124, 92, 191, 0.12) 0%, rgba(124, 92, 191, 0.03) 50%, rgba(12, 14, 26, 0.6) 100%);
  backdrop-filter: blur(8px);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, transform .2s ease, box-shadow .2s ease;
}
.licence-total::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(124, 92, 191, 0.15), transparent 55%);
  pointer-events: none;
  transition: opacity .25s;
}
.licence-total:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25), 0 0 20px rgba(124, 92, 191, 0.08);
}
.licence-total-head {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.licence-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: .86rem;
  color: var(--text-primary);
  padding: 4px 0;
}
.licence-total-row span:last-child { font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.licence-total-sum {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--purple-border);
  font-weight: 800;
  font-size: .98rem;
  color: var(--text-primary);
}
.licence-total-sum span:last-child {
  color: var(--purple-light, #b9a3e3);
  font-variant-numeric: tabular-nums;
}
.licence-total-note { font-size: .72rem; margin-top: 8px; }

/* ── Violations card ── */
.violations-card {
  border-color: rgba(237, 66, 69, 0.15) !important;
  background: linear-gradient(135deg, rgba(237, 66, 69, 0.04) 0%, rgba(237, 66, 69, 0.01) 50%, rgba(12, 14, 26, 0.6) 100%) !important;
}
.violations-card .tool-title {
  color: #ff9ea1;
  border-bottom-color: rgba(237, 66, 69, 0.15);
}

/* ════════════════════════════════════════
   BUSINESS MANAGER - modal overlay (Transfer Requests)
════════════════════════════════════════ */
.bm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(6, 7, 17, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 16px;
  overflow-y: auto;
  animation: bmOverlayFade .15s ease;
}
@keyframes bmOverlayFade { from { opacity: 0; } to { opacity: 1; } }
.bm-overlay-card {
  width: 100%;
  max-width: 960px;
  background: var(--bg-secondary);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-xl, 16px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: bmOverlayRise .18s ease;
}
@keyframes bmOverlayRise { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.bm-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.bm-overlay-body { padding: 16px 18px; }

/* Collection View - per-field copy rows */
.collect-field-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-height: min(52vh, 520px);
  overflow-y: auto;
}
.collect-field-section {
  padding: 8px 12px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--purple-light);
  background: var(--purple-dim);
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.collect-field-section:first-child { border-top: none; }
.collect-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.collect-field-row:last-child { border-bottom: none; }
.collect-field-row:nth-child(even) { background: var(--bg-input); }
.collect-field-label {
  flex: 0 0 38%;
  font-size: .8rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.collect-field-value {
  flex: 1 1 auto;
  font-size: .85rem;
  word-break: break-word;
  white-space: pre-wrap;
}
.collect-copy { flex: 0 0 auto; }

.bulk-collect-card .bm-overlay-body { max-height: min(85vh, 900px); overflow-y: auto; }
.bulk-collect-progress {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.bulk-collect-progress-bar {
  height: 100%;
  background: var(--orange);
  transition: width .2s ease;
}
.bulk-collect-step-label { font-size: .82rem; margin-bottom: 10px; }
.bulk-collect-field-list { max-height: min(50vh, 420px); }
.bulk-collect-summary-total {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-input);
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: right;
}

/* ════════════════════════════════════════
   BUSINESS TOOLS CONFIG - pricing + question editor
════════════════════════════════════════ */
.bc-price-input {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: border-color .18s, box-shadow .18s;
}
.bc-price-input:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim), 0 0 16px rgba(124, 92, 191, 0.06);
}
.bc-price-prefix {
  flex: 0 0 auto;
  padding-left: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}
.bc-price-suffix {
  flex: 0 0 auto;
  padding-right: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: .82rem;
  pointer-events: none;
  user-select: none;
}
.bc-price-input input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 10px 8px 10px 4px;
}
.bc-price-input input[type="number"]:focus {
  border: none;
  box-shadow: none;
  outline: none;
}
.bc-price-input:has(.bc-price-suffix) input[type="number"] {
  padding-right: 4px;
}

.bc-type-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
}
.bc-type-tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.bc-type-tab:hover { border-color: var(--purple-border); color: var(--text-primary); }
.bc-type-tab.active {
  border-color: var(--purple);
  background: var(--purple-dim, rgba(124, 92, 191, 0.16));
  color: var(--purple-light, #b9a3e3);
}
.bc-question-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 10px);
  background: var(--bg-input);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.bc-question-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.bc-question-num {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.bc-question-card-actions { display: flex; gap: 4px; }
.bc-q-required-toggle {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
  min-height: 0 !important;
  cursor: pointer;
  padding-top: 6px;
}
.bc-q-required-toggle input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--purple); }

/* ════════════════════════════════════════
   UI MODERNIZATION - Custom checkbox & toggle system
════════════════════════════════════════ */

/* Hide native checkboxes/radios, style their wrapper */
.custom-checkbox,
.custom-toggle,
.custom-radio {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text-primary);
  user-select: none;
  min-height: 24px;
}
.custom-checkbox input,
.custom-toggle input,
.custom-radio input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.custom-checkbox .checkmark,
.custom-radio .checkmark {
  position: relative;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border, #2a2f42);
  border-radius: 5px;
  background: var(--bg-input);
  flex-shrink: 0;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.custom-checkbox:hover .checkmark,
.custom-radio:hover .checkmark { border-color: var(--purple-border); }
.custom-checkbox input:checked + .checkmark,
.custom-radio input:checked + .checkmark {
  border-color: var(--purple);
  background: var(--purple);
  box-shadow: 0 0 0 2px rgba(124,92,191,.3);
}
.custom-checkbox .checkmark::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s ease;
}
.custom-checkbox input:checked + .checkmark::after { transform: rotate(45deg) scale(1); }
.custom-radio .checkmark { border-radius: 50%; }
.custom-radio .checkmark::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform .15s ease;
}
.custom-radio input:checked + .checkmark::after { transform: scale(1); }

/* Toggle switch */
.custom-toggle .toggle-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: border-color .18s, background .18s;
}
.custom-toggle .toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: left .2s ease, background .18s;
}
.custom-toggle input:checked + .toggle-track {
  border-color: var(--purple);
  background: var(--purple);
}
.custom-toggle input:checked + .toggle-track .toggle-thumb {
  left: 20px;
  background: #fff;
}

/* ════════════════════════════════════════
   MODAL DIALOG (confirm / prompt replacement)
════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  animation: overlayFadeIn .15s;
}
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.modal-enter { animation: overlayFadeIn .15s; }
.modal-overlay.modal-exit { animation: overlayFadeOut .15s forwards; }
@keyframes overlayFadeOut { to { opacity: 0; } }

.modal-card {
  background: var(--bg-secondary, #101320);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-lg, 14px);
  padding: 24px;
  min-width: 320px;
  max-width: 480px;
  box-shadow: 0 24px 72px rgba(0,0,0,.6);
  animation: modalCardIn .2s ease;
}
@keyframes modalCardIn { from { transform: translateY(12px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card.modal-card-enter { animation: modalCardIn .2s ease; }
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.modal-body {
  font-size: .92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 18px;
}
.modal-body p { margin: 0 0 8px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body strong { color: var(--text-primary); font-weight: 700; }
.modal-body .modal-list {
  margin: 0 0 8px;
  padding-left: 18px;
  list-style: none;
}
.modal-body .modal-list li {
  position: relative;
  padding-left: 6px;
  margin-bottom: 4px;
}
.modal-body .modal-list li::before {
  content: "\2022";
  position: absolute;
  left: -12px;
  color: var(--purple-light);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-input-wrap { margin-bottom: 14px; }
.modal-input-wrap input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
}

/* ════════════════════════════════════════
   TOAST NOTIFICATION SYSTEM
════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm, 8px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .25s, transform .25s;
}
.toast.toast-enter { opacity: 1; transform: translateX(0); }
.toast.toast-exit { opacity: 0; transform: translateX(40px); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1; }
.toast-text { font-size: .88rem; line-height: 1.4; color: var(--text-primary); }
.toast-success { border-left: 3px solid var(--secondary, #57f287); }
.toast-success .toast-icon { color: var(--secondary, #57f287); }
.toast-error { border-left: 3px solid var(--danger, #ed4245); }
.toast-error .toast-icon { color: var(--danger, #ed4245); }
.toast-warning { border-left: 3px solid var(--warning, #faa61a); }
.toast-warning .toast-icon { color: var(--warning, #faa61a); }
.toast-info { border-left: 3px solid var(--purple); }
.toast-info .toast-icon { color: var(--purple-light); }
.toast-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}
.toast-close:hover {
  opacity: 1;
  color: var(--text-primary);
}
.toast-undo {
  background: transparent;
  border: 1px solid var(--purple-border);
  color: var(--purple-light);
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-left: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}
.toast-undo:hover {
  background: var(--purple-dim);
  color: var(--purple-light);
}

/* ════════════════════════════════════════
   SKELETON LOADERS (shimmer)
════════════════════════════════════════ */
.skeleton-card, .skeleton-table { padding: 16px; }
.skeleton-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-secondary) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  margin-bottom: 10px;
}
.skeleton-line-lg { height: 20px; width: 60%; }
.skeleton-line-sm { height: 10px; width: 40%; }
.skeleton-row { display: flex; gap: 12px; margin-bottom: 8px; }
.skeleton-cell { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-secondary) 50%, var(--bg-elevated) 75%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; flex: 1; }
.skeleton-cell-sm { flex: 0.5; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Section fade-in on entry ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in {
  animation: fadeInUp .45s ease both;
}
.fade-in:nth-child(1) { animation-delay: 0s; }
.fade-in:nth-child(2) { animation-delay: .06s; }
.fade-in:nth-child(3) { animation-delay: .12s; }
.fade-in:nth-child(4) { animation-delay: .18s; }
.fade-in:nth-child(5) { animation-delay: .24s; }

/* Smooth checkbox/toggle transitions */
.toggle-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 24px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
  flex-shrink: 0;
}
.toggle-checkbox::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .2s ease;
}
.toggle-checkbox:checked {
  background: var(--purple);
  border-color: var(--purple-light);
}
.toggle-checkbox:checked::after {
  transform: translateX(20px);
  background: #fff;
}
.toggle-checkbox:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

/* ════════════════════════════════════════
   TABLE UX - sticky headers, sortable, scroll
════════════════════════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { width: 100%; }
.table-wrap thead { position: sticky; top: 0; z-index: 2; }
.table-wrap thead th {
  background: var(--bg-elevated);
  white-space: nowrap;
}
th[data-sort] { user-select: none; position: relative; }
th[data-sort]::after {
  content: " ↕";
  font-size: .75rem;
  color: var(--text-muted);
  margin-left: 4px;
}
th[data-sort][data-dir="asc"]::after  { content: " ↑"; color: var(--purple-light); }
th[data-sort][data-dir="desc"]::after { content: " ↓"; color: var(--purple-light); }

/* Scrollbar styling for table-wrap */
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-track { background: var(--bg-input); border-radius: 3px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ════════════════════════════════════════
   EMPTY STATES
════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 40px 24px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  margin: 12px 0;
}
.empty-state-icon { font-size: 2.6rem; margin-bottom: 12px; opacity: .6; }
.empty-state-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.empty-state-desc { font-size: .88rem; color: var(--text-secondary); max-width: 360px; margin: 0 auto 16px; }
.empty-state-cta {
  margin-top: 16px;
}

/* ════════════════════════════════════════
   BUTTON LOADING STATE
════════════════════════════════════════ */
.btn-loading {
  pointer-events: none !important;
  opacity: .72;
  position: relative;
  color: transparent !important;
}
.btn-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btnSpin .5s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   FORM VALIDATION
════════════════════════════════════════ */
input.field-error, textarea.field-error, select.field-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(237,66,69,.25) !important;
}
.field-error-text {
  display: block;
  font-size: .78rem;
  color: var(--danger);
  margin-top: 4px;
}

/* ════════════════════════════════════════
   PROFILE GATE OVERLAY
════════════════════════════════════════ */
.profile-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6,7,17,.88);
  backdrop-filter: blur(8px);
}
.profile-gate-card {
  background: var(--bg-secondary);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-xl, 16px);
  padding: 32px 28px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 24px 72px rgba(0,0,0,.5);
}
.gate-denied-banner {
  background: rgba(237,66,69,.12);
  border: 1px solid rgba(237,66,69,.3);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 14px;
  font-size: .84rem;
  color: var(--danger);
}
.gate-status-icon { font-size: 2rem; margin-bottom: 12px; opacity: .8; }

/* ════════════════════════════════════════
   SEARCH DROPDOWN
════════════════════════════════════════ */
#global-search-wrap { position: relative; }
#global-search-input {
  width: 180px;
  padding: 6px 12px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: .84rem;
  transition: border-color .15s, width .2s;
}
#global-search-input:focus { border-color: var(--purple-border); width: 240px; outline: none; }
.search-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 100;
  overflow: hidden;
}
.search-result-item {
  padding: 10px 14px;
  font-size: .86rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background .12s;
}
.search-result-item:hover { background: var(--bg-hover); }

/* ════════════════════════════════════════
   LIGHTBOX
════════════════════════════════════════ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.85);
  cursor: pointer;
}
.lightbox-img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius-md, 10px); }

/* ════════════════════════════════════════
   DROP ZONE (file upload)
════════════════════════════════════════ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md, 10px);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--bg-input);
}
.drop-zone:hover, .drop-zone-active { border-color: var(--purple-border); background: var(--bg-hover); }
.drop-zone-icon { font-size: 1.4rem; margin-bottom: 6px; opacity: .6; }
.drop-zone-text { font-size: .9rem; color: var(--text-primary); font-weight: 600; margin-bottom: 4px; }
.drop-zone-hint { font-size: .78rem; color: var(--text-muted); }
.drop-zone-browse { background: none; border: none; color: var(--purple-light); cursor: pointer; font-size: .78rem; text-decoration: underline; padding: 0; font-family: inherit; }
.drop-zone-preview { margin-top: 10px; }
.drop-zone-preview img { max-width: 100%; max-height: 160px; border-radius: var(--radius-sm, 8px); }

/* ════════════════════════════════════════
   BREADCRUMB
════════════════════════════════════════ */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--text-muted);
  letter-spacing: .03em;
  margin-bottom: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(124, 92, 191, 0.04);
  border: 1px solid rgba(124, 92, 191, 0.08);
  backdrop-filter: blur(6px);
}
.breadcrumb a {
  color: var(--purple-light);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.breadcrumb a:hover { color: var(--gold-light); }
.breadcrumb .breadcrumb-current {
  color: var(--text-secondary);
  font-weight: 400;
}
.breadcrumb-sep {
  color: rgba(124, 92, 191, 0.30);
  font-size: .6rem;
  margin: 0 1px;
  user-select: none;
}

/* ════════════════════════════════════════
   SCROLL TO TOP BUTTON
════════════════════════════════════════ */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--purple);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(124,92,191,.4);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.scroll-top-btn.scroll-top-visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.scroll-top-btn:hover { background: var(--purple-light); transform: translateY(-2px); }

/* ════════════════════════════════════════
   CSS FACELIFT - Card / Table / Button / Input / Nav polish
════════════════════════════════════════ */

/* Cards */
.tool-card, .stat-box {
  border: 1px solid var(--border);
  border-top: 3px solid var(--purple);
  border-radius: var(--radius-lg, 14px);
  padding: 20px;
  background: var(--bg-card);
  transition: box-shadow .2s, transform .15s;
}
.tool-card:hover, .stat-box:hover {
  box-shadow: 0 6px 20px rgba(124,92,191,.12);
  transform: translateY(-1px);
}
.stat-box {
  flex: 1;
  min-width: 130px;
}
.stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}
.stat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Tables */
table {
  border-collapse: separate;
  border-spacing: 0;
}
thead th {
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--purple-border);
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  text-align: left;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
  color: var(--text-primary);
}
tbody tr:nth-child(even) td { background: rgba(124,92,191,.03); }
tbody tr:hover td { background: rgba(124,92,191,.06); }

/* Buttons */
.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { border-color: var(--purple-border); background: var(--bg-elevated); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

.btn-primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-light); border-color: var(--purple-light); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #d83c3e; border-color: #d83c3e; }

.btn-accent { background: var(--gold); border-color: var(--gold); color: #0c0e1a; }
.btn-accent:hover { background: var(--gold-light); border-color: var(--gold-light); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: .8rem; border-radius: 14px; }
.btn-lg { padding: 10px 24px; font-size: .95rem; border-radius: 24px; }

/* Form inputs */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
select,
textarea {
  padding: 9px 14px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: .88rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(124,92,191,.25);
  outline: none;
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%237e87a0'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
label .required { color: var(--danger); }

/* ════════════════════════════════════════
   MOBILE RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .table-wrap { overflow-x: auto; }
  .nav-links { flex-wrap: wrap; gap: 6px; }
  .nav-link { font-size: .78rem; padding: 6px 10px; }
  #global-search-input { width: 140px; }
  #global-search-input:focus { width: 180px; }
  .admin-tools-layout { flex-direction: column; }
  .admin-tools-sidebar { flex-direction: row; overflow-x: auto; flex-wrap: nowrap; gap: 4px; margin-bottom: 12px; }
  .admin-tools-nav-item { font-size: .78rem; padding: 6px 12px; white-space: nowrap; }
  .breadcrumb { font-size: .7rem; padding: 3px 10px; }
  .scroll-top-btn { bottom: 16px; right: 16px; width: 40px; height: 40px; font-size: 1.1rem; }
  .toast { max-width: 90vw; }
  .modal-card { min-width: auto; max-width: 92vw; }
}

@media (max-width: 480px) {
  .nav-brand-text { display: none; }
  .nav-hamburger { display: block; }
  .nav-links { display: none; flex-direction: column; width: 100%; position: absolute; top: 100%; left: 0; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 0 0 var(--radius-md,10px) var(--radius-md,10px); z-index: 99; padding: 8px; }
  .nav-links.open { display: flex; }
}

/* Registration gate (BAR ID submission) — keep the card reachable/scrollable on
   small screens and when the on-screen keyboard shrinks the viewport. Without
   this, the centered card overflows and the Submit button can't be reached. */
.profile-gate-card { max-height: calc(100dvh - 40px); overflow-y: auto; }
@media (max-width: 560px) {
  .profile-gate-overlay { align-items: flex-start; justify-content: center; padding: 16px 12px; overflow-y: auto; }
  .profile-gate-card { padding: 24px 18px; width: 100%; max-width: 100%; max-height: none; }
}

/* ════════════════════════════════════════
   ACCESSIBILITY — Skip-to-content link
════════════════════════════════════════ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  z-index: 10000;
  padding: 10px 18px;
  background: var(--purple);
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid var(--purple-light);
  outline-offset: 2px;
}

/* ════════════════════════════════════════
   LEGISLATION — Server-rendered category chips
════════════════════════════════════════ */
.legislation-loading-bar {
  text-align: center;
  padding: 40px 20px;
}
.legislation-loading-bar p {
  color: var(--text-secondary);
  font-size: .9rem;
  margin-bottom: 16px;
}
.legislation-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.legislation-category-chip {
  display: inline-block;
  padding: 5px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--purple-border);
  border-radius: 20px;
  font-size: .8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════
   MOBILE OPTIMIZATION — consolidated audit pass
   Appended last so these rules win the cascade over earlier
   same-specificity declarations. Covers every server-rendered page
   (dashboard, lawyer/police/justice/admin/business tools, legislation,
   judge applications) plus shared chrome (navbar, search, tool sidebar,
   tables, modals, forms, drawers).
   ════════════════════════════════════════════════════════════════ */

/* Media never forces horizontal page scroll. */
img, video, canvas { max-width: 100%; height: auto; }
.main-content { max-width: 100%; }

/* ── Tablet / hamburger breakpoint ── */
@media (max-width: 920px) {
  .nav-container { padding: 0 16px; gap: 8px; }

  /* Single, consistent slide-down menu (supersedes earlier conflicting defs) */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px 14px;
    background: rgba(12, 14, 26, 0.98);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--purple-border);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    z-index: 998;
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
  }
  .nav-links.open { display: flex; }
  /* Comfortable tap targets in the open menu */
  .nav-link { padding: 12px 14px; font-size: .9rem; }
  .nav-link.active::after { display: none; }

  /* Global search flexes into available navbar space instead of overflowing */
  #global-search-wrap { flex: 1 1 90px; min-width: 0; }
  #global-search-input,
  #global-search-input:focus { width: 100%; min-width: 0; }
}

/* ── Phone / portrait tablet ── */
@media (max-width: 768px) {
  .main-content { padding: 18px 16px 56px; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-header h1 { font-size: 1.3rem; }
  .breadcrumb { max-width: 100%; flex-wrap: wrap; }

  /* Tool shell: content fills width, sidebar already becomes a row-scroller */
  .admin-tools-content { padding: 16px; }
  .tool-card { padding: 16px; }

  /* Inputs at 16px stop iOS Safari from auto-zooming on focus */
  input, select, textarea { font-size: 16px; }

  /* Tab bars scroll horizontally rather than wrapping into the content */
  .tab-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 0 0 auto; white-space: nowrap; }

  /* Button / action groups always wrap */
  .page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .page-actions .btn { flex: 0 1 auto; }

  /* Wide tables scroll horizontally instead of crushing their columns.
     Every panel table is wrapped in .table-wrap (legislation uses
     .charges-table-wrap), which can already scroll. But the global
     `table{width:100%}` pins the table to the container width, so columns
     get squashed and the wrapper never overflows. Giving the table a
     min-width forces it to overflow into the scrollable wrapper on narrow
     screens, restoring horizontal scroll with readable columns. */
  .table-wrap,
  .charges-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .table-wrap > table { min-width: 600px; }
  th, td { padding: 9px 10px; }

  /* Licence picker: 3 columns is too tight on phones */
  .licence-card-grid { grid-template-columns: 1fr 1fr; }

  /* Immediate-prosecution verdict grids keep their columns but scroll */
  .ip-charges-table,
  .ip-pleas-table,
  .ip-verdict-table,
  .ip-verdict-read-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ip-verdict-table .ip-verdict-header,
  .ip-verdict-table .ip-verdict-row,
  .ip-verdict-read-table .ip-verdict-read-header,
  .ip-verdict-read-table .ip-verdict-read-row { min-width: 460px; }

  /* User menu label can't push the bar wider than the screen */
  .user-menu-button { max-width: 42vw; }
  #user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Modal fits the viewport with breathing room */
  .modal-card { padding: 20px; width: calc(100vw - 32px); }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }
}

/* ── Small phones ── */
@media (max-width: 560px) {
  .nav-brand-text { display: none; }

  /* Free up the top bar: search lives inside the hamburger flow on tiny screens */
  #global-search-wrap { display: none; }

  .admin-tools-content { padding: 14px; }

  /* Stack everything one-up where two columns no longer fit */
  .licence-card-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .ip-verdict-table .ip-verdict-header,
  .ip-verdict-table .ip-verdict-row,
  .ip-verdict-read-table .ip-verdict-read-header,
  .ip-verdict-read-table .ip-verdict-read-row { min-width: 420px; }

  /* Drawer-style meta grids stack */
  .case-detail-fields { grid-template-columns: 1fr; }

  .modal-card { padding: 18px; }
  /* Toasts span the screen width (minus margins) on small phones */
  #toast-container { left: 12px; right: 12px; top: 12px; max-width: none; }
}

/* ════════════════════════════════════════
   NOTIFICATION CENTRE (in-site bell)
════════════════════════════════════════ */
.notif-wrap { position: relative; flex-shrink: 0; }
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s, box-shadow .18s, transform .18s;
}
.notif-bell:hover,
.notif-bell.is-active {
  color: var(--text-primary);
  border-color: var(--purple-border);
  background: var(--bg-elevated);
  box-shadow: 0 0 20px rgba(124, 92, 191, 0.12);
}
.notif-bell.is-active { transform: scale(0.97); }
.notif-bell.has-unread { color: var(--accent-gold-light); }
.bell-badge,
#notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--danger) 0%, #ff6b6e 100%);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(6, 7, 17, 0.9), 0 2px 8px rgba(237, 66, 69, 0.35);
  animation: notif-badge-pulse 2.4s ease-in-out infinite;
}
.bell-badge[hidden],
#notif-badge[hidden] {
  display: none !important;
  animation: none;
  content-visibility: hidden;
}
@keyframes notif-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.notif-panel[hidden] { display: none !important; }
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: min(520px, 70vh);
  display: flex;
  flex-direction: column;
  background: rgba(12, 14, 26, 0.92);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.06) inset,
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(124, 92, 191, 0.08);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.notif-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.notif-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-brand);
  opacity: 0.85;
  pointer-events: none;
}
.notif-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(124, 92, 191, 0.06) 0%, transparent 100%);
}
.notif-panel-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.notif-panel-title-text {
  font-weight: 700;
  font-size: .92rem;
  letter-spacing: .01em;
  color: var(--text-primary);
}
.notif-panel-sub {
  font-size: .76rem;
  font-weight: 500;
  color: var(--text-muted);
}
.notif-panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.notif-action-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--purple-light);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.notif-panel-actions [title]:hover::after,
.notif-panel-actions [title]:focus::after {
  bottom: auto;
  top: calc(100% + 6px);
  margin-bottom: 0;
  z-index: 10001;
}
.notif-action-btn:hover:not(:disabled) {
  background: var(--purple-dim);
  border-color: var(--purple-border);
  transform: translateY(-1px);
}
.notif-action-btn:active:not(:disabled) { transform: translateY(0); }
.notif-action-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.notif-action-btn-danger { color: var(--text-secondary); }
.notif-action-btn-danger:hover:not(:disabled) {
  color: var(--danger);
  background: rgba(237, 66, 69, 0.08);
  border-color: rgba(237, 66, 69, 0.22);
}
.notif-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.notif-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--purple-border) transparent;
}
.notif-list::-webkit-scrollbar { width: 6px; }
.notif-list::-webkit-scrollbar-thumb {
  background: var(--purple-border);
  border-radius: 3px;
}
.notif-section-label {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 16px 6px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(12, 14, 26, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(124, 92, 191, 0.06);
}
.notif-item {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid rgba(124, 92, 191, 0.06);
  transition: background .15s;
  animation: notif-item-in .22s ease both;
}
@keyframes notif-item-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.notif-item.is-removing {
  animation: notif-item-out .18s ease forwards;
  pointer-events: none;
}
@keyframes notif-item-out {
  to { opacity: 0; transform: translateX(12px); max-height: 0; padding: 0; margin: 0; border: 0; }
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item.is-unread {
  background: linear-gradient(90deg, rgba(201, 168, 76, 0.05) 0%, transparent 42%);
}
.notif-item.is-unread::before {
  content: "";
  width: 3px;
  flex-shrink: 0;
  background: var(--gradient-brand);
  border-radius: 0 2px 2px 0;
}
.notif-item-link {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 12px 8px 12px 14px;
  text-decoration: none;
  color: inherit;
}
.notif-item.is-read .notif-item-link { padding-left: 17px; }
.notif-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-top: 1px;
  border-radius: 10px;
  background: var(--purple-dim);
  color: var(--purple-light);
  border: 1px solid rgba(124, 92, 191, 0.14);
}
.notif-sev-success .notif-icon {
  background: rgba(87, 242, 135, 0.08);
  color: var(--secondary);
  border-color: rgba(87, 242, 135, 0.18);
}
.notif-sev-warning .notif-icon {
  background: rgba(250, 166, 26, 0.08);
  color: var(--warning);
  border-color: rgba(250, 166, 26, 0.18);
}
.notif-sev-danger .notif-icon {
  background: rgba(237, 66, 69, 0.08);
  color: var(--danger);
  border-color: rgba(237, 66, 69, 0.18);
}
.notif-item.is-read .notif-icon {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  border-color: var(--border);
}
.notif-dismiss {
  flex-shrink: 0;
  align-self: center;
  margin-right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.notif-item:hover .notif-dismiss,
.notif-dismiss:focus-visible {
  opacity: 1;
}
.notif-dismiss:hover {
  background: rgba(237, 66, 69, 0.1);
  color: var(--danger);
}
.notif-item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.notif-item-title {
  font-size: .86rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}
.notif-item.is-read .notif-item-title {
  font-weight: 500;
  color: var(--text-secondary);
}
.notif-item-text {
  font-size: .78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.notif-item-time {
  font-size: .7rem;
  color: var(--text-muted);
}
.notif-item-tag {
  font-size: .64rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--warning);
  background: rgba(250, 166, 26, 0.1);
  border: 1px solid rgba(250, 166, 26, 0.16);
}
.notif-item-chevron {
  flex-shrink: 0;
  align-self: center;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity .15s, transform .15s;
}
.notif-item-link:hover .notif-item-chevron {
  opacity: 1;
  transform: translateX(2px);
}
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 36px 24px 40px;
  text-align: center;
}
.notif-empty[hidden] { display: none !important; }
.notif-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border-radius: 16px;
  color: var(--text-muted);
  background: linear-gradient(135deg, rgba(124, 92, 191, 0.08) 0%, rgba(201, 168, 76, 0.06) 100%);
  border: 1px solid var(--border);
}
.notif-empty-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.notif-empty-text {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 240px;
}
.notif-panel-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: rgba(16, 19, 32, 0.85);
}
.notif-panel-footer[hidden] { display: none !important; }
.notif-test {
  width: 100%;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: .78rem;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.notif-test:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--purple-dim);
}
.notif-test:disabled { opacity: .6; cursor: wait; }
.notif-settings-link {
  display: block;
  text-align: center;
  font-size: .78rem;
  color: var(--text-secondary);
  text-decoration: none;
}
.notif-settings-link:hover { color: var(--purple-light); }
.notif-panel-footer-settings { padding-top: 6px; }

@media (max-width: 560px) {
  .notif-panel {
    position: fixed;
    top: 60px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 80px);
    transform-origin: top center;
  }
  .notif-dismiss { opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
  .notif-panel,
  .notif-item,
  .bell-badge,
  #notif-badge,
  .tool-badge,
  .notif-action-btn { transition: none; animation: none; }
  .notif-panel.is-open { transform: none; }
}

/* ════════════════════════════════════════
   LICENCE QUESTION BUILDER (overlay editor)
════════════════════════════════════════ */
.field-editor-modal {
  max-width: 760px;
  width: min(760px, calc(100vw - 32px));
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
}
.ofe-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ofe-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.ofe-close:hover { color: var(--text-primary); }
.ofe-intro { font-size: .82rem; margin: 6px 0 12px; }
.ofe-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ofe-empty { text-align: center; padding: 24px 0; }
.ofe-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg-input, rgba(255, 255, 255, .02));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ofe-row-head { display: flex; align-items: center; justify-content: space-between; }
.ofe-num { font-size: .8rem; font-weight: 700; color: var(--purple-light, #b9a6ff); }
.ofe-row-actions { display: flex; gap: 4px; }
.ofe-row-actions .btn { padding: 2px 8px; }
.ofe-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ofe-full { display: flex; flex-direction: column; }
.ofe-lbl { display: block; font-size: .76rem; color: var(--text-secondary); margin-bottom: 3px; }
.ofe-row input[type="text"],
.ofe-row input:not([type]),
.ofe-row input[type="number"],
.ofe-row select,
.ofe-row textarea { width: 100%; font-size: .82rem; }
.ofe-req-wrap { display: flex; align-items: flex-end; }
.ofe-check { display: flex; align-items: center; gap: 6px; font-size: .82rem; margin: 0; cursor: pointer; }
.ofe-check input { width: auto; }
.ofe-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ofe-foot-right { display: flex; gap: 10px; }
.bc-fcount { opacity: .7; font-size: .78rem; }
@media (max-width: 560px) {
  .ofe-grid2 { grid-template-columns: 1fr; }
  .ofe-foot { flex-direction: column; align-items: stretch; }
  .ofe-foot-right { flex-direction: row; }
  .ofe-foot .btn { flex: 1 1 auto; }
}

/* Quick Action FAB for judges */
.quick-action-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.quick-action-fab .fab-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple) 0%, var(--gold) 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(124, 92, 191, 0.35), 0 2px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.quick-action-fab .fab-main:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(124, 92, 191, 0.45), 0 3px 6px rgba(0,0,0,0.25);
}
.quick-action-fab .fab-main:active {
  transform: scale(0.95);
}
.quick-action-fab .fab-icon {
  transition: transform 0.2s ease;
}
.quick-action-fab.is-open .fab-icon {
  transform: rotate(45deg);
}
.quick-action-fab .fab-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.quick-action-fab.is-open .fab-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.quick-action-fab .fab-action {
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--purple-border);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: background 0.15s ease, transform 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.quick-action-fab .fab-action:hover {
  background: var(--purple-dim);
  transform: translateX(-4px);
}
@media (max-width: 720px) {
  .quick-action-fab {
    bottom: 16px;
    right: 16px;
  }
  .quick-action-fab .fab-main {
    width: 48px;
    height: 48px;
    font-size: 24px;
  }
}

/* Boot error overlay */
#boot-error-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-page);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#boot-error-overlay h2 {
  color: var(--danger);
}

/* Defendant search suggestions */
.defendant-suggestions {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.defendant-suggestions > div {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.defendant-suggestions > div:last-child {
  border-bottom: none;
}
.defendant-suggestions > div:hover {
  background: var(--bg-hover);
}
.charge-history {
  font-size: 0.85rem;
}
.charge-history .btn-sm {
  font-size: 11px;
  padding: 3px 8px;
}

/* Tooltip support for accessibility */
[title]:hover::after,
[title]:focus::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--purple-border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  margin-bottom: 6px;
}

}

/* ----------------------------------------
   SIGNATURE CARD (My Judicial Profile)
---------------------------------------- */
.sig-card-preview-only .sig-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sig-card-preview-wrap {
  min-width: 0;
}
.sig-card-preview-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 10px;
}
.sig-card-canvas-shell {
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 600px 280px at 20% 30%, rgba(255,255,255,.04), transparent 60%),
    linear-gradient(135deg, #120418, #2a0c36);
  padding: 14px;
  overflow: auto;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.sig-card-canvas-shell canvas {
  display: block;
  width: 100%;
  max-width: 820px;
  height: auto;
  border-radius: 14px;
}
.sig-card-canvas-shell--police {
  border-color: rgba(91, 155, 213, 0.35);
  background:
    radial-gradient(ellipse 600px 280px at 20% 30%, rgba(45, 106, 79, 0.12), transparent 60%),
    radial-gradient(ellipse 500px 240px at 80% 70%, rgba(26, 74, 140, 0.18), transparent 55%),
    linear-gradient(135deg, #0a1628, #132844);
}
