/* ============================================================
   PacketReady — Liquid Glass + Skeuomorphic Light
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
  /* Surface Colors — Light, airy, bright */
  --bg-deep: #f0f2f5;
  --bg-surface: #f6f8fa;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-card-solid: #ffffff;
  --bg-input: #edf0f4;
  --border-subtle: rgba(255, 255, 255, 0.6);
  --border-outer: rgba(0, 0, 0, 0.08);
  --border-focus: #3b82f6;
  
  /* Text */
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  /* Accents */
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.18);
  --accent-hover: #2563eb;
  --success: #16a34a;
  --success-glow: rgba(22, 163, 74, 0.18);
  --danger: #dc2626;
  --warning: #d97706;
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  /* Glass Effect */
  --glass-blur: 20px;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-edge-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  
  /* Skeuomorphic Shadow Depths */
  --shadow-embossed: 0 12px 32px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.9);
  --shadow-recessed: inset 0 2px 4px rgba(0,0,0,0.08), inset 0 1px 2px rgba(0,0,0,0.05), 0 1px 0 rgba(255,255,255,0.9);
  --shadow-raised: 0 2px 6px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8), inset 0 -1px 1px rgba(0,0,0,0.04);
  --shadow-pressed: inset 0 2px 4px rgba(0,0,0,0.12), inset 0 1px 1px rgba(0,0,0,0.08), 0 1px 0 rgba(255,255,255,0.7);
  --shadow-glass: 0 8px 32px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-glow: var(--shadow-embossed); /* Legacy mapping */
  
  --transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Auth Overlay ──────────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Allow scroll if Clerk's multi-step UI (OTP, reset, etc.) grows tall */
  overflow-y: auto;
  padding: 24px 16px;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-backdrop {
  position: fixed; /* fixed so it stays behind scrollable card */
  inset: 0;
  background: var(--bg-deep);
}

.auth-card {
  position: relative;
  z-index: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  /* Let card grow to full content height — overlay scroll handles viewport overflow */
  max-height: none;
  box-shadow: var(--shadow-glass), var(--glass-edge-highlight);
  text-align: center;
  /* Sit above backdrop */
  margin: auto;
}

.auth-logo {
  margin-bottom: 28px;
}

.auth-logo-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
}

.auth-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-logo p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Clerk UserButton mount point in header */
.clerk-user-btn-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}


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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: #f1f3f6;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px;
  padding-top: 32px;
  position: relative;
  overflow-x: hidden;
}



/* --- App Container --- */
#app-shell {
  display: flex;
  width: 100%;
  max-width: 1340px;
  min-height: calc(100vh - 48px);
  gap: 0;
  position: relative;
  z-index: 1;
}
#main-content {
  flex: 1;
  min-width: 0;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 230px;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.88);
  border-right: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 0;
  padding: 20px 0 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  margin-right: 24px;
  box-sizing: border-box;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 12px;
}
.sidebar-logo {
  font-size: 1.6rem;
  line-height: 1;
}
.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.sidebar-brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}
.sidebar-nav {
  flex: 1;
  padding: 0;
}
.sidebar-section {
  padding: 4px 0;
}
.sidebar-section + .sidebar-section {
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  margin-top: 4px;
  padding-top: 8px;
}
.sidebar-section-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 6px 20px 4px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: left;
  border-radius: 0;
  position: relative;
}
.sidebar-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}
.sidebar-item.active {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
  font-weight: 600;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.sidebar-icon {
  font-size: 0.95rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.sidebar-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: auto;
  padding-top: 8px;
}
.sidebar-mode-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
}
.sidebar-mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
/* Splash screen hides sidebar */
body.splash-active .sidebar { display: none; }
body.splash-active #main-content { max-width: 100%; }
body.splash-active #app-shell { max-width: 100%; }
/* Mobile */
@media (max-width: 900px) {
  #app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
    margin-right: 0;
    margin-bottom: 16px;
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    border-radius: var(--radius-md);
  }
  .sidebar-header { width: 100%; padding-bottom: 8px; margin-bottom: 4px; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .sidebar-section { display: flex; flex-wrap: wrap; gap: 2px; border: none !important; margin: 0 !important; padding: 0 !important; }
  .sidebar-section-label { display: none; }
  .sidebar-item { width: auto; padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.75rem; }
  .sidebar-item.active::before { display: none; }
  .sidebar-footer { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; border: none; margin: 0; padding: 4px 0 0; }
  .sidebar-mode-indicator { padding: 6px 12px; }
}

/* --- Nav Bar (replaces old 10-button wizard-header) --- */
.wizard-header {
  margin-bottom: 28px;
}

.nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass), var(--glass-edge-highlight);
  margin-bottom: 16px;
  position: relative;
}

/* Zone 1: Back button */
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-raised);
  flex-shrink: 0;
  font-family: var(--font);
}
.nav-back:hover {
  color: var(--accent);
  border-color: var(--accent-glow);
  transform: translateY(-1px);
}
.nav-back:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(0);
}

/* Zone 2: Breadcrumb + Progress */
.nav-center {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.breadcrumb-item {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.breadcrumb-item:hover {
  color: var(--accent);
  background: var(--accent-glow);
}
.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
  cursor: default;
}
.breadcrumb-item.active:hover {
  background: none;
  color: var(--text-primary);
}
.breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.7rem;
  user-select: none;
}

.nav-progress {
  height: 3px;
  background: var(--bg-input);
  border-radius: 100px;
  margin-top: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-recessed);
}
.nav-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Zone 3: Tools menu + mode badge */
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-tools-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-raised);
  position: relative;
  font-family: var(--font);
}
.nav-tools-btn:hover {
  color: var(--accent);
  border-color: var(--accent-glow);
  transform: translateY(-1px);
}
.nav-tools-btn:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(0);
}
.nav-tools-btn .tools-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card-solid);
}

/* --- Tools Dropdown Menu --- */
.tools-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06), var(--glass-edge-highlight);
  padding: 8px;
  z-index: 100;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.tools-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.tools-group {
  padding: 4px 0;
}
.tools-group + .tools-group {
  border-top: 1px solid var(--border-outer);
  margin-top: 4px;
  padding-top: 8px;
}
.tools-group-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 4px 12px 6px;
}

.tools-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
.tools-item:hover {
  background: var(--accent-glow);
  color: var(--accent);
}
.tools-item .tools-item-icon {
  font-size: 1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.tools-item .tools-item-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(239,68,68,0.1);
  color: var(--danger);
}
.tools-item-cost {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Mode badge in nav */
.nav-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid;
}
.nav-mode-badge.arf {
  background: rgba(99,102,241,0.08);
  color: #6366f1;
  border-color: rgba(99,102,241,0.2);
}
.nav-mode-badge.rcfe {
  background: rgba(16,185,129,0.08);
  color: #10b981;
  border-color: rgba(16,185,129,0.2);
}
.nav-mode-badge:hover {
  transform: translateY(-1px);
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.header-top>div {
  text-align: left;
}

.wizard-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.wizard-header .form-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Form Jump Dropdown --- */
.form-jump-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  min-width: 180px;
  max-width: 280px;
  flex-shrink: 1;
  background: var(--bg-input) 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='M3 5l3 3 3-3' fill='none' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  box-shadow: var(--shadow-recessed);
}

.form-jump-select:hover {
  border-color: #b0ada1;
}

.form-jump-select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-recessed), 0 0 0 3px var(--accent-glow);
}

.form-jump-select option {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 8px;
}

.form-jump-select option:disabled {
  color: var(--text-muted);
  font-style: italic;
}

/* --- AI Prefill Button --- */
.btn-ai {
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #0369a1;
  border-top-color: #7dd3fc;
  box-shadow: var(--shadow-raised);
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-ai:hover {
  background: linear-gradient(180deg, #7dd3fc, #0ea5e9);
  transform: translateY(-1px);
}

.btn-ai:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

.btn-ai:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.ai-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
  line-height: 1.4;
}

/* --- Header Buttons Container --- */
.header-buttons {
  width: 100%;          /* forces buttons to their own row */
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

/* --- Scanner Button --- */
.btn-scanner {
  background: linear-gradient(180deg, #fcd34d, #d97706);
  color: #78350f;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid #b45309;
  border-top-color: #fef3c7;
  box-shadow: var(--shadow-raised);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-scanner:hover {
  background: linear-gradient(180deg, #fde68a, #f59e0b);
  transform: translateY(-1px);
}

.btn-scanner:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

/* --- Scanner Progress --- */
.scanner-progress {
  margin-top: 24px;
}

.scanner-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.scanner-intro {
  text-align: left;
}

/* --- Scanner Results --- */
.scanner-results-summary {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 20px 0;
}

.scanner-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-bottom-color: #fff;
  box-shadow: var(--shadow-embossed);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  text-align: center;
  flex: 1;
}

.scanner-stat-num {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.scanner-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.scanner-form-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scanner-form-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-input);
  box-shadow: var(--shadow-recessed);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.scanner-form-id {
  font-weight: 700;
  color: var(--accent);
  min-width: 80px;
}

.scanner-form-pages {
  color: var(--text-secondary);
  flex: 1;
}

.scanner-form-conf {
  font-weight: 600;
  font-size: 0.75rem;
}

.progress-container {
  margin-bottom: 32px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  box-shadow: var(--shadow-recessed);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: 100px;
  border-top: 1px solid #bfdbfe;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.2);
  width: 0%;
}

/* --- Wizard Card --- */
.wizard-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-glass), var(--glass-edge-highlight);
  transition: var(--transition);
}

/* --- Step Content --- */
.step-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
}

.step-question {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.step-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* --- Input Fields --- */
.field-group {
  margin-bottom: 20px;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-bottom-color: #fff;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  box-shadow: var(--shadow-recessed);
  transition: var(--transition);
  outline: none;
}

.field-input::placeholder {
  color: var(--text-muted);
}

.field-input:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: var(--shadow-recessed), 0 0 0 3px var(--accent-glow);
}

.field-input.computed-field {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
  color: var(--success);
  cursor: default;
  font-weight: 500;
}

textarea.field-input {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* Split textarea (consolidated multi-line PDF fields) */
textarea.split-textarea {
  min-height: 70px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
}

.split-field-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding: 0 2px;
}

.split-char-counter {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  transition: color 0.2s;
}

.split-char-counter.near-limit {
  color: #d97706;
}

.split-char-counter.at-limit {
  color: #ef4444;
  font-weight: 600;
}

.split-line-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Row layout for multi-field steps */
.fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.fields-row .field-group.full-width {
  grid-column: 1 / -1;
}

/* --- Checkbox / Radio Groups --- */
.option-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top-color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.option-item:hover {
  transform: translateY(-1px);
}

.option-item.selected {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: var(--shadow-pressed);
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  box-shadow: var(--shadow-recessed);
  flex-shrink: 0;
  transition: var(--transition);
  cursor: pointer;
}

.option-item input[type="radio"] {
  border-radius: 50%;
}

.option-item input[type="checkbox"] {
  border-radius: 4px;
}

.option-item input[type="radio"]:checked,
.option-item input[type="checkbox"]:checked {
  border-color: var(--border-focus);
  background: var(--border-focus);
  box-shadow: var(--shadow-recessed), 0 0 4px var(--accent-glow) inset;
}

.option-item input[type="radio"]:checked::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  margin: 4px auto;
}

.option-item input[type="checkbox"]:checked::after {
  content: '✓';
  display: block;
  color: white;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 16px;
}

.option-label {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.3;
}

/* Two-column option grid for long lists */
.option-group.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* --- Navigation --- */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-subtle);
  border-top-color: rgba(255,255,255,0.8);
  box-shadow: var(--shadow-raised);
  outline: none;
}

.btn-secondary {
  background: linear-gradient(180deg, #f9f9f9, #ececec);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: linear-gradient(180deg, #ffffff, #f0f0f0);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

.btn-primary {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  color: white;
  border-color: #1d4ed8;
  border-top-color: #93c5fd;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #93c5fd, #3b82f6);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

.btn-success {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  color: white;
  border-color: #15803d;
  border-top-color: #86efac;
}

.btn-success:hover {
  background: linear-gradient(180deg, #86efac, #22c55e);
  transform: translateY(-1px);
}

.btn-success:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

.btn-partb-continue {
  background: linear-gradient(180deg, #a78bfa, #7c3aed);
  color: #fff;
  border-color: #6d28d9;
  border-top-color: #c4b5fd;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 32px;
  letter-spacing: 0.02em;
}

.btn-partb-continue:hover {
  background: linear-gradient(180deg, #c4b5fd, #8b5cf6);
  transform: translateY(-1px);
}

.btn-partb-continue:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
}

.btn .arrow {
  font-size: 1.1em;
}

/* Hidden helper */
.hidden {
  display: none !important;
}

/* --- Modal System --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

.modal-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: 720px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.08), var(--glass-edge-highlight);
  overflow: hidden;
}

.modal-card.audit-modal-card {
  max-width: 780px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-outer);
  background: rgba(255,255,255,0.4);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #2a2a28);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted, #8c8a83);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.modal-close:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text-primary, #2a2a28);
}

.modal-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
  color: var(--text-primary, #2a2a28);
}

.modal-intro {
  font-size: 0.88rem;
  color: var(--text-secondary, #5e5c57);
  margin: 0 0 16px;
  line-height: 1.5;
}

/* --- Intake Review Modal --- */
.intake-review-list {
  max-height: 50vh;
  overflow-y: auto;
  margin: 16px 0;
  border-top: 1px solid var(--border-subtle);
  padding-right: 8px;
}

.intake-review-list::-webkit-scrollbar {
  width: 6px;
}
.intake-review-list::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 10px;
}

.intake-review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(63, 63, 70, 0.15);
  gap: 16px;
}
.intake-review-item:last-child {
  border-bottom: none;
}

.intake-review-content {
  flex: 1;
  min-width: 0;
}

.intake-review-label-col {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.intake-review-value-col {
  font-size: 0.95rem;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
}

/* Custom CSS Toggle Switch */
.intake-review-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.intake-review-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-subtle);
  transition: .3s;
  border-radius: 24px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .switch-slider {
  background-color: var(--success);
}

input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* --- Review Screen --- */
.review-container {
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 8px;
  padding-right: 8px;
}

.review-container::-webkit-scrollbar {
  width: 6px;
}

.review-container::-webkit-scrollbar-track {
  background: transparent;
}

.review-container::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 100px;
}

.review-section {
  margin-bottom: 20px;
}

.review-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.review-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  gap: 16px;
}

.review-item:not(:last-child) {
  border-bottom: 1px solid rgba(63, 63, 70, 0.25);
}

.review-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.review-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  text-align: right;
  word-break: break-word;
}

.review-value.empty {
  color: var(--text-muted);
  font-style: italic;
}

/* --- Multi-Person Panel (LIC215, LIC508D, LIC9163) --- */
.mp-persons-panel {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--bg-surface);
  border-radius: 10px;
  border: 1px solid rgba(63, 63, 70, 0.15);
}

.mp-persons-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.mp-persons-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mp-person-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 8px;
  border: 1px solid rgba(63, 63, 70, 0.12);
  transition: all 0.2s;
}

.mp-person-card.mp-active {
  border-color: var(--blue-deep);
  background: rgba(30, 58, 138, 0.04);
  box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.15);
}

.mp-person-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mp-person-icon {
  font-size: 1.25rem;
}

.mp-person-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.mp-person-role {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.mp-person-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-mp-edit {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--blue-deep);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}
.btn-mp-edit:hover { opacity: 0.85; }

.btn-mp-remove {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(63, 63, 70, 0.2);
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-mp-remove:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border-color: #ef4444;
}

.mp-badge-active {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--blue-deep);
  background: rgba(30, 64, 175, 0.08);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.btn-mp-add {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  background: white;
  color: var(--blue-deep);
  border: 2px dashed rgba(30, 64, 175, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-mp-add:hover {
  background: rgba(30, 64, 175, 0.04);
  border-color: var(--blue-deep);
}

.mp-persons-hint {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Multi-person active banner (shown during wizard steps) */
.mp-active-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  background: rgba(30, 64, 175, 0.06);
  border: 1px solid rgba(30, 64, 175, 0.15);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.mp-banner-icon {
  font-size: 1.1rem;
}

.mp-banner-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-animate {
  animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  body {
    padding: 16px;
  }

  .wizard-card {
    padding: 24px;
  }

  .step-question {
    font-size: 1.1rem;
  }

  .fields-row {
    grid-template-columns: 1fr;
  }

  .option-group.two-col {
    grid-template-columns: 1fr;
  }

  .wizard-nav {
    flex-direction: column-reverse;
  }

  .wizard-nav .btn {
    width: 100%;
  }

  .partb-grid {
    grid-template-columns: 1fr;
  }

  .header-top {
    flex-direction: column;
    text-align: center;
  }

  .header-top>div {
    text-align: center;
  }
}

/* ── Part B — Document Generator ─────────────────────────── */

.partb-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 28px;
}

/* ── Active AI Model Indicator ── */
.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.30);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  cursor: default;
  transition: var(--transition);
}

.model-badge--fallback {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}


.partb-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.partb-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-glass), var(--glass-edge-highlight);
}

.partb-card:hover {
  border-color: rgba(59,130,246,0.3);
  box-shadow: var(--shadow-glass), 0 0 0 3px var(--accent-glow);
  transform: translateY(-2px);
}

.partb-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.partb-card-id {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

.partb-card-ai {
  font-size: 0.65rem;
  font-weight: 600;
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

.partb-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.partb-card-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.partb-card-ref {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}

.partb-card-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.partb-card-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Part B Editor ── */

.partb-editor {
  width: 100%;
  min-height: 400px;
  padding: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: var(--transition);
}

.partb-editor:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.partb-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.partb-empty p {
  margin-bottom: 20px;
  font-size: 1rem;
}

/* ── Upload Zone ── */

.upload-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 16px;
  background: rgba(39, 39, 42, 0.3);
}

.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.05);
}

.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
  box-shadow: 0 0 16px var(--accent-glow);
}

.upload-zone-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.upload-zone-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.upload-zone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upload-file-list {
  margin-top: 12px;
  text-align: left;
}

.upload-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.8rem;
}

.upload-file-name {
  color: var(--text-primary);
}

.upload-file-remove {
  color: var(--danger);
  cursor: pointer;
  font-weight: 600;
  background: none;
  border: none;
  font-size: 0.85rem;
}

.upload-skip-option {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.upload-skip-option input {
  accent-color: var(--accent);
}

/* ── Intake System ──────────────────────────────────────── */

/* Send Intake Button */
.btn-send-intake {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-send-intake:hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

/* Notification Bell */
.btn-bell {
  position: relative;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  animation: bell-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.btn-bell:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.7);
}

@keyframes bell-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.12);
  }
}

.bell-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: #ef4444;
  color: white;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0 5px;
  margin-left: 4px;
}


/* ── Intake System ──────────────────────────────────────── */

/* Send Intake Button */
.btn-send-intake {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: white;
  padding: 6px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-send-intake:hover {
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5);
  transform: translateY(-1px);
}

/* Notification Bell */
.btn-bell {
  position: relative;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  animation: bell-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.btn-bell:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.7);
}

@keyframes bell-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.12);
  }
}

.bell-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: #ef4444;
  color: white;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0 5px;
  margin-left: 4px;
}

/* Modal animations (used by dynamically-created modals) */
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUpModal {
  from { transform: translateY(24px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-intro code {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--accent-hover);
}

/* Intake Link Box */
.intake-link-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.intake-link-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 0.78rem;
  padding: 10px 14px;
  outline: none;
  min-width: 0;
}

.btn-copy {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-copy:hover {
  background: var(--accent-hover);
}

.btn-copy.copied {
  background: var(--success);
}

.modal-divider {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 16px 0;
  position: relative;
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--border-subtle);
}

.modal-divider::before {
  left: 0;
}

.modal-divider::after {
  right: 0;
}

.btn-import-intake {
  width: 100%;
  background: var(--bg-input);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.btn-import-intake:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: rgba(139, 92, 246, 0.05);
}

/* Intake Notification Items */
.intake-notification-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.intake-notification-item:last-child {
  margin-bottom: 0;
}

.intake-notif-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.intake-notif-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.intake-notif-actions {
  display: flex;
  gap: 8px;
}

.btn-load-intake {
  flex: 1;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-load-intake:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-dismiss-intake {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-dismiss-intake:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.intake-notif-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── Audit Engine ────────────────────────────────────────── */

/* Audit Button */
.btn-audit {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-audit:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.6);
}

/* --- Persistent Part B Jump Button --- */
.btn-partb-jump {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #a78bfa;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-partb-jump:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.6);
}

/* --- Usage Dashboard Button --- */
.btn-usage {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-usage:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.6);
}

.btn-usage #usage-cost-ticker {
  font-variant-numeric: tabular-nums;
}

.btn-docs {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: rgb(165, 168, 255);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-docs:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.6);
}

/* --- Back to Dashboard Button (wizard header) --- */
.btn-dashboard-back {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-muted, #a1a1aa);
  font-size: 0.76rem;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: var(--font);
  font-weight: 500;
}
.btn-dashboard-back:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-primary, #f4f4f5);
}

/* --- Resume Application Button (dashboard) --- */
.btn-resume {
  background: rgba(22,163,74,0.12);
  border: 1px solid rgba(22,163,74,0.3);
  color: #4ade80;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-resume:hover {
  background: rgba(22,163,74,0.22);
  border-color: rgba(22,163,74,0.55);
}

/* ─── Document Hub Modal ─────────────────────────────────── */
.doc-hub-modal-card {
  width: 820px;
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface, #18181b);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
}

.doc-hub-intro {
  padding: 12px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.doc-hub-status {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.doc-hub-stat {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.doc-hub-stat-uploaded { color: #4ade80; border-color: rgba(74,222,128,0.25); }
.doc-hub-stat-missing  { color: #fbbf24; border-color: rgba(251,191,36,0.25); }
.doc-hub-stat-total    { color: var(--text-muted, #a1a1aa); }

/* Hub body scroll area */
#doc-hub-body {
  overflow-y: auto;
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.doc-hub-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-hub-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #f4f4f5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.doc-hub-section-hint {
  font-size: 0.75rem;
  color: var(--text-muted, #71717a);
  margin-bottom: 4px;
}

.doc-hub-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

/* Individual slot card */
.doc-hub-slot {
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.doc-hub-slot.doc-slot-uploaded {
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.05);
}

.doc-hub-slot.doc-slot-missing {
  border-color: rgba(251,191,36,0.25);
}

.doc-hub-slot.doc-slot-optional {
  border-color: rgba(255,255,255,0.06);
}

.doc-slot-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-slot-status-icon { font-size: 0.85rem; flex-shrink: 0; }

.doc-slot-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary, #f4f4f5);
  flex: 1;
}

.doc-slot-required-badge {
  font-size: 0.65rem;
  background: rgba(251,191,36,0.15);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.doc-slot-hint {
  font-size: 0.72rem;
  color: var(--text-muted, #71717a);
  line-height: 1.4;
}

.doc-slot-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 6px;
  padding: 6px 10px;
}

.doc-slot-filename {
  font-size: 0.75rem;
  color: #4ade80;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-slot-remove {
  font-size: 0.7rem;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}
.doc-slot-remove:hover {
  background: rgba(239,68,68,0.25);
}

/* Upload zone inside hub slot */
.doc-hub-upload-zone {
  border: 1.5px dashed rgba(255,255,255,0.15);
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.doc-hub-upload-zone:hover {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.06);
}

.doc-hub-upload-zone.drag-over {
  border-color: rgba(99,102,241,0.8);
  background: rgba(99,102,241,0.12);
}

.dh-upload-icon { font-size: 1.1rem; }
.dh-upload-text { font-size: 0.74rem; color: var(--text-secondary, #a1a1aa); }
.dh-upload-hint { font-size: 0.65rem; color: var(--text-muted, #71717a); }

/* --- Usage Dashboard Modal --- */
.usage-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.usage-modal-card {
  background: var(--bg-surface, #1a1a2e);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 12px);
  width: 100%;
  max-width: 780px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.usage-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
}

.usage-modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary, #f0f0f0);
}

.usage-modal-close {
  background: none;
  border: none;
  color: var(--text-muted, #888);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.usage-modal-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary, #f0f0f0);
}

/* Summary Stats Bar */
.usage-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
}

.usage-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}

.usage-stat-primary {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.usage-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary, #f0f0f0);
  font-variant-numeric: tabular-nums;
}

.usage-stat-primary .usage-stat-value {
  color: #fbbf24;
  font-size: 1.5rem;
}

.usage-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* Tables */
.usage-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.usage-section {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
}

.usage-sections .usage-section:first-child {
  border-right: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
}

.usage-section h3 {
  margin: 0 0 10px 0;
  font-size: 0.85rem;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.usage-table th {
  text-align: left;
  color: var(--text-muted, #888);
  font-weight: 600;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.usage-table td {
  padding: 6px 8px;
  color: var(--text-primary, #f0f0f0);
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
}

.usage-table code {
  font-size: 0.75rem;
  color: #a78bfa;
}

.usage-empty {
  text-align: center;
  color: var(--text-muted, #888);
  padding: 16px 8px;
  font-style: italic;
}

/* Recent Calls Log */
.usage-log-section {
  border-bottom: none;
}

.usage-log-scroll {
  max-height: 250px;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

.usage-log-time {
  white-space: nowrap;
  font-size: 0.7rem;
  color: var(--text-muted, #888);
}

#btn-back-to-clients:hover { color: var(--text-primary); }

/* Active client banner shown in wizard header */
.active-client-banner {
  background: var(--bg-card);
  border-bottom: 1.5px solid var(--border-subtle);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}
.active-client-banner strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* ── Intake prefill banner (shown on client-intake.html when token found) ── */
.prefill-banner {
  background: rgba(59, 130, 246, 0.08);
  border: 1.5px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: #1d4ed8;
}
.prefill-banner-icon { font-size: 1.1rem; flex-shrink: 0; }

/* Prefilled field indicator */
.field-prefilled-label {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   Splash Screen â€” Liquid Glass + Skeuomorphic (Approved Design)
   Indigo vignette, brushed aluminum, frosted glass spheres
   ============================================================ */

/* --- Splash Design Tokens --- */
.splash-screen {
  --sp-bg-center: #f4f5f7;
  --sp-bg-edge: #312e81;
  --sp-glass-bg: rgba(255, 255, 255, 0.35);
  --sp-glass-border: rgba(255, 255, 255, 0.55);
  --sp-glass-blur: 24px;
  --sp-accent-blue: #3b82f6;
  --sp-accent-steel: #94a3b8;
  --sp-text-dark: #1e293b;
  --sp-text-slate: #475569;
  --sp-text-muted: #94a3b8;
  --sp-radius: 20px;
  --sp-entrance-dur: 0.9s;
  --sp-entrance-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Full Viewport Overlay --- */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font, 'Inter', -apple-system, sans-serif);
  /* Indigo vignette â€” white center fading to deep indigo edges */
  background: radial-gradient(ellipse at center, var(--sp-bg-center) 0%, #e2e4ea 35%, #a5a8c4 60%, var(--sp-bg-edge) 100%);
  overflow: hidden;
}

/* --- Geometric Mesh Background --- */
.splash-screen .sp-mesh {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.06;
  background-image:
    linear-gradient(rgba(100, 116, 139, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 116, 139, 0.5) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

/* --- Frosted Glass Spheres --- */
.splash-screen .sp-spheres {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.splash-screen .sp-sphere {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    rgba(255, 255, 255, 0.6) 0%,
    rgba(255, 255, 255, 0.2) 40%,
    rgba(200, 210, 230, 0.15) 70%,
    transparent 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    inset 0 0 30px rgba(255, 255, 255, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.08);
  will-change: transform;
}

/* Blue sphere â€” top right */
.splash-screen .sp-sphere--blue-1 {
  width: 180px;
  height: 180px;
  top: 8%;
  right: 12%;
  background: radial-gradient(circle at 35% 35%,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(147, 197, 253, 0.25) 50%,
    rgba(96, 165, 250, 0.1) 80%,
    transparent 100%
  );
  animation: sp-float1 16s ease-in-out infinite;
}

/* Blue sphere â€” bottom left */
.splash-screen .sp-sphere--blue-2 {
  width: 120px;
  height: 120px;
  bottom: 15%;
  left: 8%;
  background: radial-gradient(circle at 35% 35%,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(147, 197, 253, 0.2) 50%,
    rgba(96, 165, 250, 0.08) 80%,
    transparent 100%
  );
  animation: sp-float2 20s ease-in-out infinite;
}

/* Amber sphere â€” mid right */
.splash-screen .sp-sphere--amber {
  width: 100px;
  height: 100px;
  top: 55%;
  right: 18%;
  background: radial-gradient(circle at 35% 35%,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(251, 191, 36, 0.2) 50%,
    rgba(245, 158, 11, 0.08) 80%,
    transparent 100%
  );
  animation: sp-float3 18s ease-in-out infinite;
}

@keyframes sp-float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-20px, 30px) scale(1.05); }
  66%      { transform: translate(15px, -15px) scale(0.97); }
}

@keyframes sp-float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(25px, -20px) scale(1.06); }
}

@keyframes sp-float3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40%      { transform: translate(-15px, -25px) scale(1.04); }
  70%      { transform: translate(10px, 15px) scale(0.96); }
}

/* --- Glass Toolbar Bar (top) --- */
.splash-screen .sp-toolbar-bar {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 2;
  opacity: 0;
  animation: sp-fadeIn var(--sp-entrance-dur) var(--sp-entrance-ease) 0.2s forwards;
}

/* --- Glass Diamond Accent (bottom right) --- */
.splash-screen .sp-diamond {
  position: absolute;
  bottom: 12%;
  right: 10%;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  transform: rotate(45deg);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  z-index: 2;
  opacity: 0;
  animation: sp-fadeIn var(--sp-entrance-dur) var(--sp-entrance-ease) 0.6s forwards;
}

/* --- Center Content Container --- */
.splash-screen .sp-center {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  animation: sp-slideUp var(--sp-entrance-dur) var(--sp-entrance-ease) 0.15s forwards;
}

/* --- Clipboard Icon (Pure CSS Skeuomorphic) --- */
.splash-screen .sp-icon-panel {
  width: 140px;
  height: 160px;
  position: relative;
  margin-bottom: 32px;
  /* Frosted glass backing panel */
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.06),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Blue glow border on icon panel */
.splash-screen .sp-icon-panel::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), transparent 50%, rgba(59, 130, 246, 0.08));
  z-index: -1;
  filter: blur(4px);
}

/* Clipboard clip */
.splash-screen .sp-icon-clip {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 16px;
  background: linear-gradient(180deg, #c0c5ce, #a8adb8, #bcc1ca);
  border-radius: 4px 4px 2px 2px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
  z-index: 5;
}

.splash-screen .sp-icon-clip::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 6px;
  border-radius: 3px;
  background: rgba(100, 116, 139, 0.3);
}

/* Paper area */
.splash-screen .sp-icon-paper {
  width: 80px;
  height: 100px;
  background: linear-gradient(165deg, #e8ecf1, #d5dbe4, #c8cfd9);
  border-radius: 4px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(255, 255, 255, 0.5),
    inset 0 -1px 2px rgba(0, 0, 0, 0.05);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

/* Paper lines */
.splash-screen .sp-icon-line {
  height: 3px;
  background: linear-gradient(90deg, rgba(100, 116, 139, 0.25), rgba(100, 116, 139, 0.1));
  border-radius: 2px;
  width: 100%;
}

.splash-screen .sp-icon-line--short { width: 60%; }
.splash-screen .sp-icon-line--med { width: 80%; }

/* Folded corner */
.splash-screen .sp-icon-corner {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, transparent 50%, #bcc3ce 50%);
  border-radius: 0 0 4px 0;
}

/* --- Typography --- */
.splash-screen .sp-title {
  font-size: 3rem;
  font-weight: 800;
  color: var(--sp-text-dark);
  letter-spacing: -0.04em;
  margin: 0 0 12px;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.splash-screen .sp-divider {
  width: 60px;
  height: 2px;
  background: var(--sp-accent-blue);
  border-radius: 2px;
  margin-bottom: 12px;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.splash-screen .sp-subtitle {
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--sp-text-slate);
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}

.splash-screen .sp-version {
  font-size: 0.75rem;
  color: var(--sp-text-muted);
  margin: 0 0 36px;
  font-weight: 500;
}

/* --- Enter Button (Frosted Glass Pill) --- */
.splash-screen .sp-enter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font, 'Inter', sans-serif);
  color: #fff;
  background: linear-gradient(180deg, #5b9bf5 0%, var(--sp-accent-blue) 40%, #2563eb 100%);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  position: relative;
  letter-spacing: 0.01em;
  /* Skeuomorphic depth */
  box-shadow:
    0 6px 20px rgba(59, 130, 246, 0.3),
    0 2px 6px rgba(59, 130, 246, 0.15),
    inset 0 2px 1px rgba(255, 255, 255, 0.3),
    inset 0 -2px 3px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Specular highlight on button top */
.splash-screen .sp-enter-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  border-radius: 100px 100px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
  pointer-events: none;
}

.splash-screen .sp-enter-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 10px 30px rgba(59, 130, 246, 0.35),
    0 4px 10px rgba(59, 130, 246, 0.2),
    inset 0 2px 1px rgba(255, 255, 255, 0.3),
    inset 0 -2px 3px rgba(0, 0, 0, 0.12);
}

.splash-screen .sp-enter-btn:active {
  transform: translateY(1px);
  box-shadow:
    0 2px 8px rgba(59, 130, 246, 0.2),
    inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.splash-screen .sp-arrow {
  transition: transform 0.2s ease;
}

.splash-screen .sp-enter-btn:hover .sp-arrow {
  transform: translateX(3px);
}

/* Secondary splash button — outline variant */
.splash-screen .sp-enter-btn--secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.85);
  box-shadow: none;
}
.splash-screen .sp-enter-btn--secondary::before {
  display: none;
}
.splash-screen .sp-enter-btn--secondary:hover {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}

/* --- Footer --- */
.splash-screen .sp-footer {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.35);
  z-index: 3;
  opacity: 0;
  animation: sp-fadeIn var(--sp-entrance-dur) var(--sp-entrance-ease) 0.8s forwards;
}

/* --- Entrance Animations --- */
@keyframes sp-slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sp-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Fade Out (JS-triggered) --- */
.splash-screen.sp-fade-out {
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .splash-screen .sp-title { font-size: 2.2rem; }
  .splash-screen .sp-icon-panel { width: 110px; height: 130px; }
  .splash-screen .sp-icon-paper { width: 65px; height: 80px; padding: 12px 10px; }
  .splash-screen .sp-sphere--blue-1 { width: 120px; height: 120px; }
  .splash-screen .sp-sphere--blue-2 { width: 80px; height: 80px; }
  .splash-screen .sp-sphere--amber { width: 70px; height: 70px; }
}

/* ============================================================
   Consultant Dashboard
   ============================================================ */
.dashboard {
  padding: 0;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass), var(--glass-edge-highlight);
}

.dashboard-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dashboard-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.dashboard-logo-icon {
  font-size: 2rem;
  line-height: 1;
}

.dashboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dashboard-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.dashboard-header-right {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-settings {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: var(--shadow-raised);
  transition: var(--transition);
  white-space: nowrap;
}

.btn-settings:hover {
  background: var(--bg-surface);
  transform: translateY(-1px);
}

.btn-settings:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

/* Primary action row — big buttons */
.dashboard-actions-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
/* Secondary action row — smaller, muted tool buttons */
.dashboard-actions-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.btn-sm-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  box-shadow: var(--shadow-raised);
  white-space: nowrap;
}
.btn-sm-tool:hover {
  background: var(--bg-surface);
  transform: translateY(-1px);
  color: var(--text-primary);
}
.btn-sm-tool:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

.dashboard-new-btn {
  font-size: 0.95rem !important;
  padding: 14px 28px !important;
}

.dashboard-import-btn {
  font-size: 0.85rem;
  padding: 14px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.dashboard-card {
  display: flex;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-glass), var(--glass-edge-highlight);
}

.dashboard-card:hover {
  border-color: rgba(59,130,246,0.3);
  box-shadow: var(--shadow-glass), 0 0 0 3px var(--accent-glow);
  transform: translateY(-2px);
}

.dashboard-card:active {
  transform: translateY(0);
  box-shadow: var(--shadow-pressed);
}

.dashboard-card-status-bar {
  width: 5px;
  flex-shrink: 0;
}

.dashboard-card-body {
  flex: 1;
  padding: 16px 20px;
  min-width: 0;
}

.dashboard-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.dashboard-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-card-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}

.dashboard-card-facility {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.dashboard-card-progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 100px;
  overflow: hidden;
  box-shadow: var(--shadow-recessed);
}

.dashboard-card-progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s ease;
}

.dashboard-card-progress-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.dashboard-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-card-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dashboard-card-actions {
  display: flex;
  gap: 4px;
}

.btn-sm {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  color: var(--text-secondary);
}

.btn-sm:hover {
  background: var(--bg-surface);
}

.btn-danger-sm {
  color: var(--danger);
}

.btn-danger-sm:hover {
  background: rgba(220, 38, 38, 0.1);
}

.dashboard-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.dashboard-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.dashboard-empty p {
  font-size: 1rem;
  margin-bottom: 4px;
}

.dashboard-empty-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.dashboard-footer {
  text-align: center;
  padding: 20px 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.dashboard-footer strong {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   Settings Modal
   ============================================================ */
.settings-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  padding: 24px;
}

.settings-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top-color: #fff;
  border-bottom-color: #b8b7b0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-embossed);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}

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

.settings-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-modal-body {
  padding: 24px;
}

.settings-group {
  margin-bottom: 20px;
}

.settings-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.settings-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-recessed);
  outline: none;
  transition: var(--transition);
}

.settings-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-recessed), 0 0 0 3px var(--accent-glow);
}

.settings-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-color-picker {
  width: 44px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 2px;
  background: var(--bg-input);
}

.settings-color-preview {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  font-family: monospace;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.settings-logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-logo-preview {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.settings-logo-placeholder {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

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

/* ============================================================
   Responsive — Dashboard
   ============================================================ */
@media (max-width: 600px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-actions-primary {
    flex-direction: column;
  }

  .dashboard-card-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .settings-modal {
    max-width: 100%;
    margin: 0;
  }
}


/* ============================================================
   RC Config Engine — Dynamic Regional Center Configuration
   All selectors scoped under .rc-config prefix
   ============================================================ */

.rc-config-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg-deep);
  overflow-y: auto;
  animation: rcConfigFadeIn 0.2s ease-out;
}

@keyframes rcConfigFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.rc-config-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
}

.rc-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.rc-config-header h2 {
  font-family: var(--font);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.rc-config-close {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: var(--shadow-raised);
}

.rc-config-close:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.rc-config-body {
  display: flex;
  gap: 24px;
  min-height: calc(100vh - 120px);
}

/* ─── Left Panel ─── */
.rc-config-left {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-embossed);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rc-config-left-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.rc-config-left-header h3 {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.rc-config-rc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.rc-config-rc-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  transition: var(--transition);
  position: relative;
  border: 1px solid transparent;
}

.rc-config-rc-item:hover {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.rc-config-rc-selected {
  background: var(--accent-glow);
  border-color: var(--accent) !important;
}

.rc-config-rc-active .rc-config-rc-name {
  color: var(--accent);
}

.rc-config-rc-name {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rc-config-rc-fullname {
  font-family: var(--font);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.rc-config-active-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--success);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rc-config-rc-meta {
  font-family: var(--font);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.rc-config-left-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ─── Right Panel ─── */
.rc-config-right {
  flex: 1;
  min-width: 0;
}

.rc-config-empty,
.rc-config-empty-detail {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.9rem;
}

.rc-config-empty-detail {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-embossed);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.rc-config-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.rc-config-empty-detail h3 {
  color: var(--text-primary);
  margin: 0 0 8px 0;
  font-size: 1.1rem;
}

.rc-config-empty-detail p {
  color: var(--text-secondary);
  margin: 0;
}

/* ─── Detail Header ─── */
.rc-config-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-embossed);
}

.rc-config-detail-header h3 {
  font-family: var(--font);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.rc-config-meta-text {
  font-family: var(--font);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rc-config-detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.rc-config-active-indicator {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--success-glow);
  color: var(--success);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ─── Tabs ─── */
.rc-config-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  box-shadow: var(--shadow-recessed);
}

.rc-config-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.rc-config-tab:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.5);
}

.rc-config-tab-active {
  background: var(--bg-card) !important;
  color: var(--accent) !important;
  font-weight: 600;
  box-shadow: var(--shadow-raised);
}

.rc-config-tab-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-embossed);
}

.rc-config-tab-hidden {
  display: none;
}

/* ─── Checklist Actions ─── */
.rc-config-checklist-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ─── Section Cards ─── */
.rc-config-section-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rc-config-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.rc-config-section-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.rc-config-section-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
}

.rc-config-section-number {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 700;
}

.rc-config-section-info {
  flex: 1;
  min-width: 0;
}

.rc-config-section-title {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rc-config-section-desc {
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.rc-config-section-tags {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.rc-config-tag {
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.rc-config-status-active {
  background: var(--success-glow);
  color: var(--success);
}

.rc-config-status-deprecated {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.rc-config-section-actions {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  flex-shrink: 0;
  padding-top: 2px;
}

.rc-config-section-reqs {
  padding: 0 16px 14px 60px;
}

.rc-config-reqs-label {
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.rc-config-reqs-list {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}

.rc-config-reqs-list li {
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Buttons ─── */
.rc-config-btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-raised);
}

.rc-config-btn:hover {
  background: var(--bg-surface);
}

.rc-config-btn:active {
  box-shadow: var(--shadow-pressed);
}

.rc-config-btn-sm {
  font-size: 0.78rem;
  padding: 6px 12px;
}

.rc-config-btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.rc-config-btn-accent:hover {
  background: var(--accent-hover);
}

.rc-config-btn-outline {
  background: transparent;
  box-shadow: none;
}

.rc-config-btn-outline:hover {
  background: var(--bg-input);
}

.rc-config-btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
  box-shadow: none;
}

.rc-config-btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.rc-config-btn-icon {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.rc-config-btn-icon:hover {
  background: var(--bg-input);
  border-color: var(--border-subtle);
}

.rc-config-btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.rc-config-btn-icon-danger:hover {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

/* ─── Dialog Overlay ─── */
.rc-config-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: rcConfigFadeIn 0.15s ease-out;
}

.rc-config-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-embossed);
}

.rc-config-dialog-wide {
  max-width: 600px;
}

.rc-config-dialog h3 {
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

.rc-config-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Form Fields ─── */
.rc-config-field {
  margin-bottom: 14px;
}

.rc-config-field label {
  display: block;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.rc-config-input,
.rc-config-select,
.rc-config-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.88rem;
  transition: var(--transition);
  box-sizing: border-box;
  box-shadow: var(--shadow-recessed);
}

.rc-config-input:focus,
.rc-config-select:focus,
.rc-config-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.rc-config-textarea {
  resize: vertical;
}

.rc-config-textarea-tall {
  min-height: 200px;
}

.rc-config-help {
  font-family: var(--font);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 12px 0;
  line-height: 1.5;
}

/* ─── Override List Editor ─── */
.rc-config-list-editor {
  margin-bottom: 8px;
}

.rc-config-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-primary);
}

.rc-config-add-item {
  display: flex;
  gap: 8px;
}

.rc-config-add-item .rc-config-input {
  flex: 1;
}

.rc-config-override-group {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.rc-config-override-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.rc-config-override-group h4 {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

/* ─── Contact Form ─── */
.rc-config-contact-form {
  max-width: 500px;
}

/* ─── Preview Area ─── */
.rc-config-preview {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  max-height: 300px;
  overflow-y: auto;
}

.rc-config-preview:empty {
  display: none;
}

.rc-config-preview-header {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.rc-config-preview-empty {
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px;
}

.rc-config-preview-section {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.rc-config-preview-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.rc-config-preview-section strong {
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text-primary);
}

.rc-config-preview-desc {
  font-family: var(--font);
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.rc-config-preview-reqs {
  margin: 6px 0 0 0;
  padding-left: 20px;
  list-style: disc;
}

.rc-config-preview-reqs li {
  font-family: var(--font);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ─── Hidden Input ─── */
.rc-config-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .rc-config-body {
    flex-direction: column;
  }

  .rc-config-left {
    width: 100%;
  }

  .rc-config-detail-header {
    flex-direction: column;
    gap: 12px;
  }

  .rc-config-detail-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .rc-config-tabs {
    flex-direction: column;
  }

  .rc-config-section-header {
    flex-wrap: wrap;
  }

  .rc-config-section-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 8px;
  }
}
/* ============================================================
   RC Intelligence — Scoped Styles (.rc-intel prefix)
   localStorage key: arf_rc_intelligence
   ============================================================ */

/* --- Main Container --- */
.rc-intel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-deep);
  font-family: var(--font);
}

/* --- Header --- */
.rc-intel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  flex-shrink: 0;
  gap: 16px;
}

.rc-intel-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.rc-intel-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.rc-intel-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.rc-intel-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.rc-intel-search-wrap {
  position: relative;
}

.rc-intel-search {
  width: 280px;
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-recessed);
  transition: var(--transition);
  outline: none;
}

.rc-intel-search:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-recessed), 0 0 0 3px var(--accent-glow);
}

.rc-intel-search::placeholder {
  color: var(--text-muted);
}

.rc-intel-close-btn {
  padding: 8px 18px;
  font-size: 0.82rem;
}

/* --- Body Layout --- */
.rc-intel-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- Sidebar --- */
.rc-intel-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 8px;
}

.rc-intel-sidebar-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  text-align: left;
  gap: 2px;
}

.rc-intel-sidebar-item:hover {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.rc-intel-sidebar-item--active {
  background: var(--bg-surface);
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.rc-intel-sidebar-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.rc-intel-sidebar-abbr {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.rc-intel-sidebar-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.rc-intel-sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.rc-intel-sidebar-analyst-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* --- Right Panel --- */
.rc-intel-panel {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* --- RC Header --- */
.rc-intel-rc-header {
  margin-bottom: 28px;
}

.rc-intel-rc-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.rc-intel-rc-name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rc-intel-rc-abbr-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.rc-intel-rc-meta {
  display: flex;
  gap: 16px;
}

.rc-intel-meta-item {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Sections --- */
.rc-intel-section {
  margin-bottom: 32px;
}

.rc-intel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.rc-intel-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rc-intel-add-btn {
  padding: 6px 16px;
  font-size: 0.78rem;
}

/* --- Empty State --- */
.rc-intel-empty-state {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 16px 0;
  margin: 0;
}

/* --- Analyst Card --- */
.rc-intel-analyst-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: var(--shadow-embossed);
  overflow: hidden;
}

.rc-intel-analyst-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: var(--transition);
}

.rc-intel-analyst-toggle:hover {
  background: var(--bg-surface);
}

.rc-intel-analyst-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rc-intel-analyst-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.rc-intel-analyst-title {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.rc-intel-analyst-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rc-intel-note-count-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--accent-glow);
  color: var(--accent);
}

.rc-intel-analyst-chevron {
  font-size: 1rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.rc-intel-analyst-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border-subtle);
}

.rc-intel-analyst-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 0;
}

.rc-intel-contact-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Preferences --- */
.rc-intel-preferences {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 0 12px;
}

.rc-intel-pref-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.rc-intel-pref-item {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

/* --- Analyst Actions --- */
.rc-intel-analyst-actions {
  display: flex;
  gap: 8px;
  padding: 8px 0 14px;
}

.rc-intel-edit-analyst-btn,
.rc-intel-delete-analyst-btn {
  padding: 5px 12px;
  font-size: 0.75rem;
}

/* --- Note Card --- */
.rc-intel-note-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  position: relative;
  transition: var(--transition);
}

.rc-intel-note-card:hover {
  box-shadow: var(--shadow-raised);
}

/* Category-specific left border colors */
.rc-intel-note-cat--language  { border-left-color: #3b82f6; }
.rc-intel-note-cat--requirement { border-left-color: #8b5cf6; }
.rc-intel-note-cat--preference  { border-left-color: #06b6d4; }
.rc-intel-note-cat--correction  { border-left-color: #f59e0b; }
.rc-intel-note-cat--tip         { border-left-color: #10b981; }
.rc-intel-note-cat--warning     { border-left-color: #ef4444; }

.rc-intel-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rc-intel-note-category-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-input);
}

/* Category badge colors */
.rc-intel-cat--language    { background: rgba(59,130,246,0.12); color: #2563eb; }
.rc-intel-cat--requirement { background: rgba(139,92,246,0.12); color: #7c3aed; }
.rc-intel-cat--preference  { background: rgba(6,182,212,0.12);  color: #0891b2; }
.rc-intel-cat--correction  { background: rgba(245,158,11,0.12); color: #d97706; }
.rc-intel-cat--tip         { background: rgba(16,185,129,0.12); color: #059669; }
.rc-intel-cat--warning     { background: rgba(239,68,68,0.12);  color: #dc2626; }

.rc-intel-note-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.rc-intel-note-text {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
}

.rc-intel-note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.rc-intel-tag {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-deep);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.rc-intel-note-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.rc-intel-note-card:hover .rc-intel-note-actions {
  opacity: 1;
}

.rc-intel-note-action-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: var(--transition);
}

.rc-intel-note-action-btn:hover {
  background: var(--bg-surface);
}

.rc-intel-note-delete-btn:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
}

/* --- Modal --- */
.rc-intel-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9500;
}

.rc-intel-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25), 0 8px 24px rgba(0,0,0,0.15);
  overflow: hidden;
}

.rc-intel-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.rc-intel-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.rc-intel-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

/* --- Form Elements --- */
.rc-intel-form-group {
  margin-bottom: 16px;
}

.rc-intel-form-group--half {
  flex: 1;
  min-width: 0;
}

.rc-intel-form-row {
  display: flex;
  gap: 14px;
}

.rc-intel-form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.rc-intel-form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-recessed);
  transition: var(--transition);
  outline: none;
  box-sizing: border-box;
}

.rc-intel-form-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-recessed), 0 0 0 3px var(--accent-glow);
}

.rc-intel-form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-recessed);
  transition: var(--transition);
  outline: none;
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
}

.rc-intel-form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-recessed), 0 0 0 3px var(--accent-glow);
}

.rc-intel-form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
}

.rc-intel-char-count {
  display: block;
  text-align: right;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Search Results --- */
.rc-intel-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

.rc-intel-search-header {
  margin-bottom: 16px;
}

.rc-intel-search-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.rc-intel-search-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.rc-intel-search-empty p {
  margin: 0 0 8px;
}

.rc-intel-search-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.rc-intel-search-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rc-intel-search-result {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-embossed);
}

.rc-intel-search-result:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.rc-intel-search-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.rc-intel-search-result-source {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.rc-intel-search-result-text {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .rc-intel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }

  .rc-intel-header-right {
    width: 100%;
  }

  .rc-intel-search {
    width: 100%;
    flex: 1;
  }

  .rc-intel-body {
    flex-direction: column;
  }

  .rc-intel-sidebar {
    width: 100%;
    max-height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    overflow-y: auto;
  }

  .rc-intel-sidebar-item {
    padding: 6px 10px;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    width: auto;
  }

  .rc-intel-sidebar-name {
    display: none;
  }

  .rc-intel-sidebar-analyst-count {
    display: none;
  }

  .rc-intel-panel {
    padding: 16px;
  }

  .rc-intel-form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* ============================================================
   Learning Library — Scoped under .learning-lib
   ============================================================ */

/* ─── Overlay ──────────────────────────────────────────────── */
.learning-lib {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background: var(--bg-deep);
  overflow-y: auto;
  font-family: var(--font);
  color: var(--text-primary);
}

.learning-lib .learning-lib-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 100px;
}

/* ─── Header ───────────────────────────────────────────────── */
.learning-lib .learning-lib-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.learning-lib .learning-lib-header-left {
  flex: 1;
}

.learning-lib .learning-lib-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.learning-lib .learning-lib-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.learning-lib .learning-lib-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Buttons ──────────────────────────────────────────────── */
.learning-lib .learning-lib-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  color: var(--text-primary);
}

.learning-lib .learning-lib-btn:hover {
  background: var(--bg-surface);
  box-shadow: var(--shadow-raised);
}

.learning-lib .learning-lib-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.learning-lib .learning-lib-btn-primary:hover {
  background: var(--accent-hover);
}

.learning-lib .learning-lib-btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
}

.learning-lib .learning-lib-btn-close {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.learning-lib .learning-lib-btn-close:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.learning-lib .learning-lib-btn-edit {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.learning-lib .learning-lib-btn-edit:hover {
  background: var(--accent-hover);
}

.learning-lib .learning-lib-btn-delete {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}

.learning-lib .learning-lib-btn-delete:hover {
  background: var(--danger);
  color: #fff;
}

/* ─── Stats Bar ────────────────────────────────────────────── */
.learning-lib .learning-lib-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-embossed);
  margin-bottom: 20px;
}

.learning-lib .learning-lib-stat-total {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 8px;
}

.learning-lib .learning-lib-stat-pill {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--pill-color) 10%, var(--bg-card));
  color: var(--pill-color);
  border: 1px solid color-mix(in srgb, var(--pill-color) 25%, transparent);
}

/* ─── Filters ──────────────────────────────────────────────── */
.learning-lib .learning-lib-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.learning-lib .learning-lib-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.learning-lib .learning-lib-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.learning-lib .learning-lib-search {
  width: 100%;
  padding: 10px 14px 10px 36px;
  font-family: var(--font);
  font-size: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-recessed);
  transition: var(--transition);
  box-sizing: border-box;
}

.learning-lib .learning-lib-search:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.learning-lib .learning-lib-filter-select {
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  min-width: 140px;
}

.learning-lib .learning-lib-filter-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Entry Cards Grid ─────────────────────────────────────── */
.learning-lib .learning-lib-entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.learning-lib .learning-lib-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-embossed);
}

.learning-lib .learning-lib-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-raised), 0 0 0 1px var(--accent-glow);
  transform: translateY(-2px);
}

.learning-lib .learning-lib-card-expanded {
  grid-column: 1 / -1;
  border-color: var(--accent);
}

.learning-lib .learning-lib-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.learning-lib .learning-lib-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.learning-lib .learning-lib-card-meta {
  display: flex;
  gap: 6px;
}

.learning-lib .learning-lib-doc-badge,
.learning-lib .learning-lib-rc-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-secondary);
}

.learning-lib .learning-lib-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
  line-height: 1.3;
}

.learning-lib .learning-lib-card-section {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-style: italic;
}

.learning-lib .learning-lib-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 12px;
}

.learning-lib .learning-lib-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.learning-lib .learning-lib-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.learning-lib .learning-lib-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 500;
}

.learning-lib .learning-lib-level-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #8b5cf620;
  color: #8b5cf6;
  font-weight: 600;
}

.learning-lib .learning-lib-card-date {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Card Detail (Expanded) ───────────────────────────────── */
.learning-lib .learning-lib-card-detail {
  margin-top: 16px;
}

.learning-lib .learning-lib-detail-divider {
  height: 1px;
  background: var(--border-subtle);
  margin-bottom: 16px;
}

.learning-lib .learning-lib-detail-row {
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.learning-lib .learning-lib-detail-row strong {
  color: var(--text-primary);
}

.learning-lib .learning-lib-detail-fulltext {
  margin-top: 4px;
  white-space: pre-wrap;
  padding: 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* ─── Side-by-Side Diff ────────────────────────────────────── */
.learning-lib .learning-lib-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.learning-lib .learning-lib-diff-col {
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid;
}

.learning-lib .learning-lib-diff-original {
  background: #fef2f230;
  border-color: #fca5a530;
}

.learning-lib .learning-lib-diff-corrected {
  background: #f0fdf430;
  border-color: #86efac30;
}

.learning-lib .learning-lib-diff-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.learning-lib .learning-lib-diff-text {
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.learning-lib .learning-lib-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ─── Search Highlight ─────────────────────────────────────── */
.learning-lib .learning-lib-highlight {
  background: #fde68a;
  color: var(--text-primary);
  padding: 0 2px;
  border-radius: 2px;
}

/* ─── Empty State ──────────────────────────────────────────── */
.learning-lib .learning-lib-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
}

.learning-lib .learning-lib-empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.learning-lib .learning-lib-empty h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.learning-lib .learning-lib-empty p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* ─── Floating Action Button ───────────────────────────────── */
.learning-lib .learning-lib-fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-raised), 0 4px 20px var(--accent-glow);
  transition: var(--transition);
  z-index: 9110;
}

.learning-lib .learning-lib-fab:hover {
  background: var(--accent-hover);
  transform: scale(1.08);
  box-shadow: var(--shadow-raised), 0 6px 30px var(--accent-glow);
}

/* ─── Form Modal Overlay ───────────────────────────────────── */
.learning-lib-form-overlay {
  position: fixed;
  inset: 0;
  z-index: 9120;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 24px;
}

.learning-lib-form-overlay .learning-lib-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-embossed);
  width: 100%;
  max-width: 700px;
}

.learning-lib-form-overlay .learning-lib-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.learning-lib-form-overlay .learning-lib-form-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.learning-lib-form-overlay .learning-lib-form-body {
  padding: 24px;
  max-height: 65vh;
  overflow-y: auto;
}

.learning-lib-form-overlay .learning-lib-form-group {
  margin-bottom: 18px;
}

.learning-lib-form-overlay .learning-lib-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.learning-lib-form-overlay .learning-lib-form-input,
.learning-lib-form-overlay .learning-lib-form-textarea,
.learning-lib-form-overlay .learning-lib-form-select {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: var(--transition);
  box-sizing: border-box;
}

.learning-lib-form-overlay .learning-lib-form-input:focus,
.learning-lib-form-overlay .learning-lib-form-textarea:focus,
.learning-lib-form-overlay .learning-lib-form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.learning-lib-form-overlay .learning-lib-form-textarea {
  resize: vertical;
  min-height: 60px;
}

.learning-lib-form-overlay .learning-lib-form-textarea-original {
  border-left: 3px solid #ef4444;
}

.learning-lib-form-overlay .learning-lib-form-textarea-corrected {
  border-left: 3px solid var(--success);
}

.learning-lib-form-overlay .learning-lib-form-row {
  display: flex;
  gap: 14px;
}

.learning-lib-form-overlay .learning-lib-form-half {
  flex: 1;
}

/* ─── Category Radios ──────────────────────────────────────── */
.learning-lib-form-overlay .learning-lib-cat-radios {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.learning-lib-form-overlay .learning-lib-cat-radio {
  cursor: pointer;
}

.learning-lib-form-overlay .learning-lib-cat-radio input[type="radio"] {
  display: none;
}

.learning-lib-form-overlay .learning-lib-cat-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.learning-lib-form-overlay .learning-lib-cat-radio input[type="radio"]:checked + .learning-lib-cat-radio-label {
  border-color: var(--cat-color);
  background: color-mix(in srgb, var(--cat-color) 8%, var(--bg-card));
  color: var(--cat-color);
  font-weight: 600;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--cat-color) 15%, transparent);
}

/* ─── Service Level Checkboxes ─────────────────────────────── */
.learning-lib-form-overlay .learning-lib-levels-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.learning-lib-form-overlay .learning-lib-level-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.learning-lib-form-overlay .learning-lib-level-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ─── Form Actions ─────────────────────────────────────────── */
.learning-lib-form-overlay .learning-lib-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
}

/* ─── Responsive — Learning Library ────────────────────────── */
@media (max-width: 768px) {
  .learning-lib .learning-lib-entries {
    grid-template-columns: 1fr;
  }

  .learning-lib .learning-lib-diff {
    grid-template-columns: 1fr;
  }

  .learning-lib .learning-lib-header {
    flex-direction: column;
  }

  .learning-lib .learning-lib-filters {
    flex-direction: column;
  }

  .learning-lib-form-overlay .learning-lib-form-row {
    flex-direction: column;
    gap: 0;
  }

  .learning-lib-form-overlay .learning-lib-cat-radios {
    flex-direction: column;
  }

  .learning-lib .learning-lib-fab {
    bottom: 20px;
    right: 20px;
  }
}

/* ============================================================
   Document Checklist Dashboard
   All selectors scoped under .doc-cl prefix
   ============================================================ */

.doc-checklist-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg-deep, #e8e7e1);
  overflow-y: auto;
  animation: doc-cl-fadeIn 0.3s ease;
}

@keyframes doc-cl-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.doc-cl-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.doc-cl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.doc-cl-header h2 {
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 1.6rem;
  color: var(--text-primary, #1e293b);
  margin: 0;
}

.doc-cl-header p {
  font-size: 0.9rem;
  color: var(--text-secondary, #64748b);
  margin: 0.25rem 0 0;
}

.doc-cl-close {
  background: var(--bg-card, #faf9f5);
  border: 1px solid var(--border, #d1cfc7);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary, #64748b);
  transition: all 0.2s;
  flex-shrink: 0;
}

.doc-cl-close:hover {
  background: var(--bg-surface, #f0efe9);
  color: var(--text-primary, #1e293b);
  transform: scale(1.05);
}

/* Stats */
.doc-cl-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 1.5rem;
}

.doc-cl-stat-card {
  background: var(--bg-card, #faf9f5);
  border-radius: var(--radius-md, 12px);
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--border, #d1cfc7);
  box-shadow: var(--shadow-raised, 0 2px 4px rgba(0,0,0,0.1));
}

.doc-cl-stat-num {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font, 'Inter', sans-serif);
}

.doc-cl-stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary, #64748b);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.doc-cl-stat-complete .doc-cl-stat-num { color: #16a34a; }
.doc-cl-stat-partial .doc-cl-stat-num { color: #f59e0b; }
.doc-cl-stat-missing .doc-cl-stat-num { color: #ef4444; }
.doc-cl-stat-total .doc-cl-stat-num { color: var(--accent, #3b82f6); }

/* Progress bar */
.doc-cl-progress-bar {
  background: var(--bg-surface, #f0efe9);
  border-radius: 8px;
  height: 10px;
  margin-bottom: 2rem;
  overflow: hidden;
  border: 1px solid var(--border, #d1cfc7);
}

.doc-cl-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #16a34a);
  border-radius: 8px;
  transition: width 0.5s ease;
}

/* Category groups */
.doc-cl-category {
  margin-bottom: 1.5rem;
}

.doc-cl-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border, #d1cfc7);
}

.doc-cl-category-icon {
  font-size: 1.3rem;
}

.doc-cl-category-header h3 {
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 1.05rem;
  color: var(--text-primary, #1e293b);
  margin: 0;
  flex: 1;
}

.doc-cl-category-count {
  font-size: 0.82rem;
  color: var(--text-secondary, #64748b);
  background: var(--bg-surface, #f0efe9);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* Items */
.doc-cl-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-cl-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card, #faf9f5);
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border, #d1cfc7);
  transition: all 0.15s ease;
}

.doc-cl-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.doc-cl-item-complete {
  border-left: 3px solid #16a34a;
}

.doc-cl-item-partial {
  border-left: 3px solid #f59e0b;
}

.doc-cl-item-missing {
  border-left: 3px solid #ef4444;
}

.doc-cl-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.doc-cl-item-content {
  flex: 1;
  min-width: 0;
}

.doc-cl-item-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary, #1e293b);
}

.doc-cl-item-detail {
  font-size: 0.76rem;
  color: var(--text-secondary, #64748b);
  margin-top: 2px;
}

/* Checkbox for offline tasks */
.doc-cl-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.doc-cl-checkbox-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #3b82f6);
}

/* Responsive */
@media (max-width: 600px) {
  .doc-cl-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .doc-cl-container {
    padding: 1rem;
  }
  .doc-cl-item {
    flex-wrap: wrap;
  }
}

/* ─── PD Revision Engine Styles ───────────────────────────────── */
/* All styles scoped with .pd-rev- prefix to prevent collisions  */

.pd-rev-version-badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.25);
  font-family: 'JetBrains Mono', monospace;
}

/* ── Section blocks ── */
.pd-rev-section {
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.pd-rev-section:last-child {
  border-bottom: none;
}
.pd-rev-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 8px;
}

/* ── Context form grid ── */
.pd-rev-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.pd-rev-field label {
  display: block;
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pd-rev-field input,
.pd-rev-field select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}
.pd-rev-field input:focus,
.pd-rev-field select:focus {
  border-color: #8b5cf6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* ── Action buttons ── */
.pd-rev-actions {
  text-align: center;
}
.btn-lg {
  padding: 14px 32px;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

/* ── Checklist status ── */
.pd-rev-checklist-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.pd-rev-checklist-badge {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}
.pd-rev-checklist-badge-bundled {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.pd-rev-checklist-badge-uploaded {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.pd-rev-checklist-badge-missing {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.pd-rev-checklist-actions {
  display: flex;
  gap: 8px;
}

/* ── Corrections summary stats ── */
.pd-rev-corrections-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.pd-rev-stat-card {
  text-align: center;
  padding: 20px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
}
.pd-rev-stat-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}
.pd-rev-stat-label {
  font-size: 0.8rem;
  color: #94a3b8;
}
.pd-rev-stat-total {
  background: rgba(139, 92, 246, 0.08);
}
.pd-rev-stat-total .pd-rev-stat-number { color: #a78bfa; }
.pd-rev-stat-valid {
  background: rgba(34, 197, 94, 0.08);
}
.pd-rev-stat-valid .pd-rev-stat-number { color: #4ade80; }
.pd-rev-stat-wrong {
  background: rgba(245, 158, 11, 0.08);
}
.pd-rev-stat-wrong .pd-rev-stat-number { color: #fbbf24; }
.pd-rev-stat-invalid {
  background: rgba(239, 68, 68, 0.08);
}
.pd-rev-stat-invalid .pd-rev-stat-number { color: #f87171; }

/* ── Correction cards ── */
.pd-rev-corrections-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pd-rev-correction-card {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.4);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.pd-rev-correction-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
}
.pd-rev-correction-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  flex-wrap: wrap;
}
.pd-rev-correction-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}
.pd-rev-correction-page {
  font-size: 0.8rem;
  color: #94a3b8;
}
.pd-rev-correction-section {
  font-size: 0.85rem;
  color: #e2e8f0;
  font-weight: 500;
  flex: 1;
}
.pd-rev-correction-severity {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.pd-rev-sev-required .pd-rev-correction-severity {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.pd-rev-sev-suggested .pd-rev-correction-severity {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.pd-rev-sev-formatting .pd-rev-correction-severity {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}
.pd-rev-correction-body {
  padding: 12px 16px;
}
.pd-rev-correction-comment {
  color: #cbd5e1;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 8px;
}
.pd-rev-correction-comment strong {
  color: #94a3b8;
}
.pd-rev-correction-citation {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Citation badges ── */
.pd-rev-citation-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}
.pd-rev-citation-valid {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.pd-rev-citation-invalid {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.pd-rev-citation-wrong {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.pd-rev-citation-unknown {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.pd-rev-citation-correct {
  font-size: 0.78rem;
  color: #4ade80;
  padding-left: 4px;
}

/* ── Package download cards ── */
.pd-rev-package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.pd-rev-package-card {
  text-align: center;
  padding: 28px 20px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.5);
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.pd-rev-package-card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}
.pd-rev-package-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.pd-rev-package-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 8px;
}
.pd-rev-package-desc {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-bottom: 16px;
  line-height: 1.4;
}

/* ── Upload done state ── */
.upload-zone-done {
  border-color: rgba(34, 197, 94, 0.3) !important;
  background: rgba(34, 197, 94, 0.05) !important;
}

/* ── Dashboard PD Rev button ── */
.dashboard-pd-rev-btn {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}
.dashboard-pd-rev-btn:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(168, 85, 247, 0.2));
  border-color: rgba(139, 92, 246, 0.5);
  color: #e2e8f0;
}

/* ── Dashboard PD link button (opens PD Generator in new tab) ── */
.dashboard-pd-link-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px;
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.dashboard-pd-link-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.2));
  border-color: rgba(99, 102, 241, 0.55);
  color: #e2e8f0;
  text-decoration: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .pd-rev-corrections-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .pd-rev-context-grid {
    grid-template-columns: 1fr;
  }
  .pd-rev-package-grid {
    grid-template-columns: 1fr;
  }
  .pd-rev-schedule-table {
    font-size: 0.65rem;
  }
}

/* ─── PD Revision: Generation Screen (Phase 4) ─────────────── */

.pd-rev-gen-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pd-rev-gen-progress {
  flex: 1;
  min-width: 200px;
}
.pd-rev-gen-progress-label {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-bottom: 4px;
}

/* Generation correction cards */
.pd-rev-gen-card {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.4);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.pd-rev-gen-card.pd-rev-gen-applied {
  border-color: rgba(34, 197, 94, 0.3);
}
.pd-rev-gen-card.pd-rev-gen-skipped {
  opacity: 0.5;
  border-color: rgba(148, 163, 184, 0.1);
}
.pd-rev-gen-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  cursor: pointer;
  flex-wrap: wrap;
}
.pd-rev-gen-card-header:hover {
  background: rgba(15, 23, 42, 0.8);
}
.pd-rev-gen-card-body {
  padding: 16px;
}
.pd-rev-gen-original {
  background: rgba(30, 41, 59, 0.5);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.5;
}
.pd-rev-gen-original-label {
  font-size: 0.72rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.pd-rev-gen-textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
.pd-rev-gen-textarea:focus {
  border-color: #8b5cf6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.pd-rev-gen-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pd-rev-gen-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 4px;
}
.pd-rev-gen-status-pending {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
}
.pd-rev-gen-status-generating {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  animation: pd-rev-pulse 1.5s ease-in-out infinite;
}
.pd-rev-gen-status-done {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
}
.pd-rev-gen-status-skipped {
  background: rgba(148, 163, 184, 0.1);
  color: #64748b;
}

@keyframes pd-rev-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- PD Revision: Assembly Screen (Phase 5) --- */

.pd-rev-assembly-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.pd-rev-assembly-section {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.35);
  padding: 20px;
}
.pd-rev-assembly-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pd-rev-assembly-section-title h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
  margin: 0;
}

/* Schedule tables */
.pd-rev-schedule-container {
  overflow-x: auto;
  margin: 12px 0;
}
.pd-rev-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
}
.pd-rev-schedule-table th {
  padding: 6px 8px;
  text-align: center;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.15);
  white-space: nowrap;
}
.pd-rev-schedule-table td {
  padding: 4px 6px;
  text-align: center;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.1);
  white-space: nowrap;
}
.pd-rev-schedule-table tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.3);
}
.pd-rev-schedule-table td.pd-rev-hour-cell {
  font-weight: 600;
  color: #94a3b8;
  text-align: right;
  padding-right: 10px;
  background: rgba(30, 41, 59, 0.4);
  white-space: nowrap;
}
.pd-rev-schedule-table td.pd-rev-staff-cell {
  color: #a78bfa;
  font-weight: 500;
}
.pd-rev-schedule-table td.pd-rev-admin-cell {
  color: #fbbf24;
  font-weight: 600;
}
.pd-rev-schedule-table td.pd-rev-empty-cell {
  color: #334155;
}

/* Schedule totals */
.pd-rev-schedule-totals {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.pd-rev-schedule-total {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}
.pd-rev-schedule-total-label {
  color: #94a3b8;
}
.pd-rev-schedule-total-value {
  font-weight: 700;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
}

/* Activity calendar */
.pd-rev-activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  table-layout: fixed;
}
.pd-rev-activity-table th {
  padding: 8px 4px;
  text-align: center;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.15);
}
.pd-rev-activity-table td {
  padding: 6px 4px;
  text-align: center;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.1);
  vertical-align: top;
  font-size: 0.68rem;
  line-height: 1.3;
  height: 80px;
}
.pd-rev-activity-table tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.2);
}

/* Assembly progress */
.pd-rev-assembly-progress {
  margin-top: 16px;
}
.pd-rev-assembly-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.85rem;
  color: #94a3b8;
}
.pd-rev-assembly-step-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}
.pd-rev-assembly-step.pd-rev-step-done {
  color: #4ade80;
}
.pd-rev-assembly-step.pd-rev-step-active {
  color: #a78bfa;
}
.pd-rev-assembly-step.pd-rev-step-pending {
  color: #475569;
}

/* ════════════════════════════════════════════════════════════════
   APPLICATION CORRECTION ENGINE (ACE) STYLES
   All classes prefixed with .ace- to prevent scope contamination
   ════════════════════════════════════════════════════════════════ */

/* ── Upload Zone ── */
.ace-upload-zone {
  border: 2px dashed rgba(167, 139, 250, 0.3);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  background: rgba(167, 139, 250, 0.03);
  margin-bottom: 24px;
}
.ace-upload-zone:hover,
.ace-upload-hover {
  border-color: rgba(167, 139, 250, 0.6);
  background: rgba(167, 139, 250, 0.08);
}
.ace-upload-success {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.05);
}
.ace-upload-icon { font-size: 48px; margin-bottom: 12px; }
.ace-upload-title { font-size: 18px; font-weight: 600; color: #e2e8f0; margin-bottom: 8px; }
.ace-upload-subtitle { font-size: 14px; color: #94a3b8; }
.ace-upload-label { color: #a78bfa; cursor: pointer; text-decoration: underline; }
.ace-upload-hint { font-size: 12px; color: #64748b; margin-top: 12px; }
.ace-upload-secondary { padding: 28px 24px; border-style: dotted; }
.ace-session-toggle {
  margin: 8px 0 20px;
  padding: 10px 16px;
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.15);
  border-radius: 10px;
}
.ace-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: #cbd5e1;
}
.ace-toggle-label input[type="checkbox"] {
  accent-color: #a78bfa;
  width: 16px;
  height: 16px;
}

/* ── Metadata Form ── */
.ace-metadata-section { margin-bottom: 24px; }
.ace-section-title { font-size: 16px; font-weight: 600; color: #e2e8f0; margin-bottom: 16px; }
.ace-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ace-form-group label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
  font-weight: 500;
}
.ace-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 14px;
  transition: border-color 0.2s;
}
.ace-input:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.5);
}

/* ── Action Row ── */
.ace-action-row {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

/* ── Status Messages ── */
.ace-status-progress,
.ace-status-success,
.ace-status-error {
  padding: 16px;
  border-radius: 12px;
  margin: 16px 0;
  font-size: 14px;
}
.ace-status-progress {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
.ace-status-success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
  color: #86efac;
}
.ace-status-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}

/* ── Tab Bar ── */
.ace-tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  padding-bottom: 0;
}
.ace-tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ace-tab:hover { color: #e2e8f0; }
.ace-tab-active {
  color: #a78bfa;
  border-bottom-color: #a78bfa;
}
.ace-tab-count {
  background: rgba(167, 139, 250, 0.2);
  color: #a78bfa;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Correction Cards ── */
.ace-correction-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}
.ace-correction-card:hover {
  border-color: rgba(167, 139, 250, 0.3);
}
.ace-card-applied {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.05);
}
.ace-card-skipped {
  opacity: 0.6;
  border-color: rgba(148, 163, 184, 0.1);
}

.ace-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.ace-card-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.ace-badge-part-a {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.ace-badge-part-b {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.3);
}
.ace-badge-other {
  background: rgba(251, 191, 36, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.3);
}
.ace-card-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
}

/* ── Card Body ── */
.ace-card-body { padding-left: 4px; }
.ace-field-ref {
  font-size: 12px;
  color: #a78bfa;
  margin-bottom: 6px;
  font-weight: 500;
}
.ace-parent-topic {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
}
.ace-correction-text {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 8px;
}

/* ── Value Comparison ── */
.ace-value-comparison {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
}
.ace-value-current,
.ace-value-requested {
  flex: 1;
}
.ace-value-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.ace-value-current .ace-value-label { color: #f87171; }
.ace-value-requested .ace-value-label { color: #4ade80; }
.ace-value-text {
  font-size: 13px;
  color: #e2e8f0;
}
.ace-value-arrow {
  color: #64748b;
  font-size: 18px;
}

/* ── Due Date Badge ── */
.ace-due-badge {
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.ace-due-ok { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.ace-due-warning { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.ace-due-urgent { background: rgba(248, 113, 113, 0.15); color: #f87171; }

/* ── Status Icons ── */
.ace-status-icon { font-size: 16px; }

/* ── Empty State ── */
.ace-empty-state {
  text-align: center;
  padding: 40px;
  color: #64748b;
  font-size: 14px;
}

/* ── Resolution Notice (placeholder) ── */
.ace-resolution-notice {
  padding: 24px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px dashed rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.8;
}
.ace-resolution-notice ul {
  margin: 12px 0 0 20px;
  list-style: disc;
}
.ace-resolution-notice li { margin-bottom: 6px; }

/* ============================================================
   Program Design Supplemental Modal
   ============================================================ */
.pd-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pd-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

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

.pd-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.pd-modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pd-modal-body .form-group {
  margin-bottom: 0;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   RCFE / ARF MODE SYSTEM
   Scoped to: .mode-badge, .btn-mode-switch, .mode-selector-*, .mode-card-*,
              .mode-switch-*, .mode-switch-toast, .dashboard-card-mode-badge
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Header mode switch button ────────────────────────────────────────────── */
.btn-mode-switch {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #a78bfa;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-mode-switch:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.6);
  transform: translateY(-1px);
}

/* ── Dashboard session card mode badge ───────────────────────────────────── */
.dashboard-card-mode-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 10px;
  align-self: center;
  flex-shrink: 0;
}
.dashboard-card-mode-badge.mode-badge-arf {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.dashboard-card-mode-badge.mode-badge-rcfe {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

/* ── Mode selector overlay (New Application modal) ───────────────────────── */
.mode-selector-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(8px);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.mode-selector-modal {
  background: linear-gradient(145deg, #18181b, #1c1c22);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 20px;
  padding: 40px;
  max-width: 820px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
  text-align: center;
}

.mode-selector-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #f4f4f5;
  margin: 0 0 8px;
}

.mode-selector-subtitle {
  color: #71717a;
  font-size: 1rem;
  margin: 0 0 32px;
}

.mode-selector-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

/* ── Individual ARF / RCFE choice cards ──────────────────────────────────── */
.mode-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px 24px;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border-color 0.25s, transform 0.2s, box-shadow 0.2s;
}
.mode-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.mode-card-arf:hover {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.07);
}
.mode-card-rcfe:hover {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.06);
}

.mode-card-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.mode-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #f4f4f5;
  margin: 0 0 4px;
}

.mode-card-abbr {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0 0 16px;
}
.mode-card-arf .mode-card-abbr { color: #818cf8; }
.mode-card-rcfe .mode-card-abbr { color: #34d399; }

.mode-card-facts {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mode-card-facts li {
  font-size: 0.82rem;
  color: #a1a1aa;
  padding-left: 14px;
  position: relative;
}
.mode-card-facts li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: #52525b;
}

.mode-card-btn {
  width: 100%;
  font-size: 0.85rem;
  padding: 10px 16px;
}
.mode-card-btn-rcfe {
  background: linear-gradient(135deg, #059669, #10b981);
}
.mode-card-btn-rcfe:hover {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.mode-selector-cancel {
  font-size: 0.85rem;
  padding: 9px 24px;
}

/* ── Mode switch modal (in-session switch) ───────────────────────────────── */
.mode-switch-modal {
  background: linear-gradient(145deg, #18181b, #1c1c22);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 20px;
  padding: 36px 40px;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  text-align: left;
}

.mode-switch-icon {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 12px;
}

.mode-switch-modal h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f4f4f5;
  margin: 0 0 20px;
  text-align: center;
}

.mode-switch-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.mode-switch-section {
  border-radius: 10px;
  padding: 14px 16px;
}
.mode-switch-carries  { background: rgba(16, 185, 129, 0.07); border: 1px solid rgba(16, 185, 129, 0.2); }
.mode-switch-review   { background: rgba(245, 158, 11, 0.07); border: 1px solid rgba(245, 158, 11, 0.2); }
.mode-switch-clears   { background: rgba(239, 68, 68, 0.06); border: 1px solid rgba(239, 68, 68, 0.18); }
.mode-switch-arf-note { background: rgba(99, 102, 241, 0.07); border: 1px solid rgba(99, 102, 241, 0.2); }

.mode-switch-section h4 {
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: #d4d4d8;
}
.mode-switch-section p,
.mode-switch-section li {
  font-size: 0.82rem;
  color: #a1a1aa;
  margin: 0;
  line-height: 1.5;
}
.mode-switch-section ul {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-switch-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ── Mode switch success toast ───────────────────────────────────────────── */
.mode-switch-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, #18181b, #1c1c22);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 12px;
  padding: 14px 20px;
  z-index: 9200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 320px;
}
.mode-switch-toast.toast-visible {
  opacity: 1;
  transform: translateY(0);
}
.mode-switch-toast strong {
  display: block;
  color: #a78bfa;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.mode-switch-toast p {
  color: #71717a;
  font-size: 0.8rem;
  margin: 0;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .mode-selector-cards { grid-template-columns: 1fr; }
  .mode-selector-modal { padding: 24px 20px; }
  .mode-switch-modal { padding: 24px 20px; }
}

/* ─── Login Screen ────────────────────────────────────────────── */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-deep);
  color: var(--text-main);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 16px;
}

.login-header h2 {
  font-size: 24px;
  margin: 0 0 8px 0;
  color: var(--text-bright);
}

.login-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
}

/* ─── Migration Banner ────────────────────────────────────────── */
.migrate-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin: 0 0 20px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  animation: migrateFadeIn 0.4s ease-out;
}
.migrate-banner.migrate-success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.04));
  border-color: rgba(34, 197, 94, 0.3);
}
.migrate-banner-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}
.migrate-banner-text {
  flex: 1;
  min-width: 0;
}
.migrate-banner-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #92400e;
  margin-bottom: 4px;
}
.migrate-success .migrate-banner-title {
  color: #166534;
}
.migrate-banner-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.migrate-banner-btn {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 600;
}
.migrate-banner-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}
@keyframes migrateFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PART B READINESS GATE — Modal Styles
   Scoped under .partb-readiness-* to avoid CSS collisions.
   WHY: Blocks Part B generation when required Part A fields are missing.
   ═══════════════════════════════════════════════════════════════════════════════ */

.partb-readiness-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: partbReadinessFadeIn 0.2s ease-out;
}

@keyframes partbReadinessFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.partb-readiness-modal {
  background: var(--card-bg, #1a1a2e);
  border: 1px solid var(--border-color, rgba(124, 58, 237, 0.3));
  border-radius: 16px;
  width: 90%;
  max-width: 580px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(124, 58, 237, 0.15);
  animation: partbReadinessSlideUp 0.3s ease-out;
  overflow: hidden;
}

@keyframes partbReadinessSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.partb-readiness-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.2);
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.08), rgba(124, 58, 237, 0.06));
}

.partb-readiness-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  letter-spacing: -0.01em;
}

.partb-readiness-close {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary, #94a3b8);
  font-size: 1.1rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.partb-readiness-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.partb-readiness-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.partb-readiness-message {
  color: var(--text-secondary, #94a3b8);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

.partb-readiness-message strong {
  color: #f59e0b;
}

.partb-readiness-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.partb-readiness-group {
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.partb-readiness-form-header {
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  background: rgba(124, 58, 237, 0.1);
  border-bottom: 1px solid rgba(124, 58, 237, 0.12);
  letter-spacing: 0.02em;
}

.partb-readiness-field-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

.partb-readiness-field {
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary, #cbd5e1);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.partb-readiness-field:last-child {
  border-bottom: none;
}

.partb-readiness-risk {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.partb-readiness-risk--critical {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.partb-readiness-risk--high {
  background: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.partb-readiness-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  background: rgba(0, 0, 0, 0.15);
  gap: 12px;
  flex-wrap: wrap;
}

.partb-readiness-export {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Responsive: stack footer buttons on narrow screens */
@media (max-width: 560px) {
  .partb-readiness-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .partb-readiness-export {
    justify-content: stretch;
  }
  .partb-readiness-export .btn {
    flex: 1;
  }
}

/* ─── Style Picker Modal (packet-builder.js) ─────────────────── */
/* Scoped: All selectors prefixed with .sp- to avoid collisions  */

.sp-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spFadeIn 0.2s ease;
}

@keyframes spFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sp-modal {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 16px;
  width: 90vw;
  max-width: 960px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: spSlideUp 0.25s ease;
}

@keyframes spSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
}

.sp-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}

.sp-close {
  background: transparent;
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.sp-close:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text-primary, #1e293b);
}

.sp-body {
  display: flex;
  gap: 24px;
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sp-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sp-right {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 20px;
  align-self: flex-start;
}

.sp-right h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: flex-start;
}

.sp-section h3 {
  margin: 0 0 12px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Layout Grid ─────────────────────────────────── */
.sp-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.sp-layout-card {
  position: relative;
  border: 2px solid var(--border-subtle, #e2e8f0);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-surface, #fafafa);
  text-align: center;
}
.sp-layout-card:hover {
  border-color: var(--accent, #3b82f6);
  background: var(--bg-hover, #f1f5f9);
}
.sp-layout-card.selected {
  border-color: var(--accent, #3b82f6);
  background: rgba(59, 130, 246, 0.06);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.sp-layout-thumb {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.sp-layout-name {
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  line-height: 1.3;
}

.sp-layout-stats-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(9, 9, 11, 0.85);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  z-index: 1;
}

/* ── Archetype Tabs ──────────────────────────────── */
.sp-archetype-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.sp-archetype-tab {
  background: var(--bg-surface, #f1f5f9);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
}
.sp-archetype-tab:hover {
  background: var(--bg-hover, #e2e8f0);
  color: var(--text-primary, #1e293b);
}
.sp-archetype-tab.active {
  background: var(--accent, #3b82f6);
  color: #fff;
  border-color: var(--accent, #3b82f6);
}

/* ── Color Swatches ──────────────────────────────── */
.sp-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
}

.sp-color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  padding: 3px;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}
.sp-color-swatch:hover {
  border-color: var(--accent, #3b82f6);
  transform: scale(1.1);
}
.sp-color-swatch.selected {
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  transform: scale(1.1);
}

.sp-swatch-inner {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sp-swatch-ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid;
}

/* ── Selected Style Details ──────────────────────── */
.sp-selected-details-panel {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(9, 9, 11, 0.04);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  color: var(--text-secondary, #64748b);
  font-size: 0.78rem;
  line-height: 1.5;
}
.sp-selected-details-title {
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  font-size: 0.85rem;
  margin-bottom: 2px;
}

/* ── Preview Canvas ──────────────────────────────── */
#sp-preview-canvas {
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  width: 100%;
  height: auto;
}

/* ── Footer ──────────────────────────────────────── */
.sp-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle, #e2e8f0);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .sp-modal {
    width: 96vw;
    max-height: 94vh;
  }
  .sp-body {
    flex-direction: column;
  }
  .sp-right {
    width: 100%;
  }
}
