/* ============================================
   NEURAL ARC — INSURANCE DEFENSE AI PLATFORM
   Design System — Dark Mode + Poppins
   ============================================ */

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

/* ── CSS Variables ── */
:root {
  --font: 'Poppins', sans-serif;

  /* Dark palette */
  --bg-base:       #0A0B0F;
  --bg-surface:    #111318;
  --bg-elevated:   #181B23;
  --bg-card:       #1E2130;
  --bg-hover:      #252A3A;
  --border:        rgba(255,255,255,0.07);
  --border-active: rgba(108,99,255,0.5);

  /* Brand */
  --accent:        #6C63FF;
  --accent-light:  #A78BFA;
  --accent-glow:   rgba(108,99,255,0.25);
  --accent-dim:    rgba(108,99,255,0.12);

  /* Status */
  --green:         #22C55E;
  --green-dim:     rgba(34,197,94,0.12);
  --yellow:        #F59E0B;
  --yellow-dim:    rgba(245,158,11,0.12);
  --red:           #EF4444;
  --red-dim:       rgba(239,68,68,0.12);
  --blue:          #3B82F6;
  --blue-dim:      rgba(59,130,246,0.12);

  /* Text */
  --text-primary:  #F0F2F8;
  --text-secondary:#9BA3C0;
  --text-muted:    #5A6080;
  --text-accent:   #A78BFA;

  /* Sidebar */
  --sidebar-w:     260px;
  --header-h:      64px;

  /* Shadows */
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:     0 20px 60px rgba(0,0,0,0.6);
  --shadow-accent: 0 8px 32px rgba(108,99,255,0.3);

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  24px;
}

/* ── Light Mode CSS Variable Overrides ── */
body.light-mode {
  --bg-base:       #F4F5F9;
  --bg-surface:    #FFFFFF;
  --bg-elevated:   #FFFFFF;
  --bg-card:       #FFFFFF;
  --bg-hover:      #EEF0F8;
  --border:        rgba(0,0,0,0.08);
  --border-active: rgba(108,99,255,0.4);

  --text-primary:  #111318;
  --text-secondary:#4A5070;
  --text-muted:    #8A93B0;
  --text-accent:   #6C63FF;

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.12);
  --shadow-lg:     0 20px 60px rgba(0,0,0,0.16);
  --shadow-accent: 0 8px 32px rgba(108,99,255,0.2);

  --accent-glow:   rgba(108,99,255,0.15);
  --accent-dim:    rgba(108,99,255,0.08);
}

/* ── Theme Toggle Button ── */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--border-active);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
body.light-mode .theme-toggle .icon-sun  { display: block; }
body.light-mode .theme-toggle .icon-moon { display: none; }

/* ── Light Mode Overrides ── */
body.light-mode {
  --bg-base:       #F4F5F9;
  --bg-surface:    #ECEEF5;
  --bg-elevated:   #FFFFFF;
  --bg-card:       #FFFFFF;
  --bg-hover:      #E8EAF2;
  --border:        rgba(0,0,0,0.08);
  --border-active: rgba(108,99,255,0.4);

  --text-primary:  #1A1D2E;
  --text-secondary:#4A5070;
  --text-muted:    #8890B0;
  --text-accent:   #6C63FF;

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.12);
  --shadow-lg:     0 20px 60px rgba(0,0,0,0.16);
  --shadow-accent: 0 8px 32px rgba(108,99,255,0.2);
}

/* Light mode sidebar */
body.light-mode .sidebar {
  background: #FFFFFF;
  border-right: 1px solid rgba(0,0,0,0.08);
}
body.light-mode .sidebar-brand-name { color: #1A1D2E; }
body.light-mode .sidebar-brand-sub  { color: #8890B0; }
body.light-mode .nav-section-label  { color: #8890B0; }
body.light-mode .nav-item           { color: #4A5070; }
body.light-mode .nav-item:hover     { background: #F0F1F8; color: #1A1D2E; }
body.light-mode .nav-item.active    { background: rgba(108,99,255,0.1); color: #6C63FF; }
body.light-mode .sidebar-footer     { border-top: 1px solid rgba(0,0,0,0.08); }

/* Light mode topbar */
body.light-mode .topbar {
  background: rgba(255,255,255,0.95);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
body.light-mode .topbar-btn { color: #4A5070; }
body.light-mode .topbar-btn:hover { background: #F0F1F8; }
body.light-mode .topbar-divider { background: rgba(0,0,0,0.1); }

/* Light mode cards */
body.light-mode .card {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .stat-card {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .stat-card:hover {
  box-shadow: 0 0 0 1px rgba(108,99,255,0.2), 0 8px 32px rgba(0,0,0,0.1);
}

/* Light mode tables */
body.light-mode .data-table th {
  background: #F4F5F9;
  color: #8890B0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
body.light-mode .data-table td { border-bottom: 1px solid rgba(0,0,0,0.05); }
body.light-mode .data-table tr:hover td { background: #F8F9FC; }

/* Light mode inputs */
body.light-mode .form-input,
body.light-mode .form-select,
body.light-mode .form-textarea {
  background: #F4F5F9;
  border-color: rgba(0,0,0,0.12);
  color: #1A1D2E;
}
body.light-mode .form-input:focus,
body.light-mode .form-select:focus {
  background: #FFFFFF;
  border-color: var(--accent);
}

/* Light mode AI status bar */
body.light-mode .ai-status-bar {
  background: rgba(108,99,255,0.06);
  border-color: rgba(108,99,255,0.15);
}

/* Light mode billing summary cards */
body.light-mode .billing-summary-card {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.08);
}

/* Light mode generate panel */
body.light-mode .generate-panel {
  background: #F8F9FC;
  border-color: rgba(0,0,0,0.08);
}

/* Light mode opinion cards */
body.light-mode .opinion-card {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .opinion-card:hover {
  border-color: rgba(108,99,255,0.25);
}

/* Light mode matter cards */
body.light-mode .matter-card {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.08);
}

/* Light mode filter chips */
body.light-mode .filter-chip {
  background: #ECEEF5;
  color: #4A5070;
  border-color: rgba(0,0,0,0.08);
}
body.light-mode .filter-chip.active {
  background: rgba(108,99,255,0.12);
  color: #6C63FF;
  border-color: rgba(108,99,255,0.3);
}

/* Light mode billing tabs */
body.light-mode .billing-tab { color: #4A5070; }
body.light-mode .billing-tab.active { color: #6C63FF; border-bottom-color: #6C63FF; }
body.light-mode .billing-tabs { border-bottom-color: rgba(0,0,0,0.1); }

/* Light mode login page */
body.light-mode.login-body {
  background: linear-gradient(135deg, #F0F1F8 0%, #E8EAF5 100%);
}
body.light-mode .login-card {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.08);
}

/* Theme toggle icon visibility */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
body.light-mode .theme-toggle .icon-sun  { display: block; }
body.light-mode .theme-toggle .icon-moon { display: none; }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}
a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, textarea, select { font-family: var(--font); }
ul { list-style: none; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  position: relative;
  overflow: hidden;
}

/* Background effects */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(108,99,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108,99,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.bg-glow {
  position: fixed; border-radius: 50%; filter: blur(120px);
  pointer-events: none; z-index: 0;
}
.bg-glow-1 { width: 600px; height: 600px; background: rgba(108,99,255,0.12); top: -200px; left: -100px; }
.bg-glow-2 { width: 400px; height: 400px; background: rgba(167,139,250,0.08); bottom: -100px; right: 200px; }
.bg-glow-3 { width: 300px; height: 300px; background: rgba(59,130,246,0.06); top: 50%; right: -50px; }

.login-wrapper {
  display: flex; width: 100%; min-height: 100vh; position: relative; z-index: 1;
}

/* Left Panel */
.login-left {
  flex: 1.1;
  background: linear-gradient(135deg, #0D0E16 0%, #111420 50%, #0F1019 100%);
  border-right: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  padding: 60px 56px;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(108,99,255,0.1) 0%, transparent 60%);
}
.login-left-inner {
  position: relative; z-index: 1; max-width: 480px; width: 100%;
}

.brand-logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 64px;
}
.brand-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-accent);
}
.brand-name {
  font-size: 20px; font-weight: 700; color: var(--text-primary); display: block;
}
.brand-sub {
  font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; display: block;
}

.login-hero-text h1 {
  font-size: clamp(36px, 4vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 50%, #60A5FA 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.login-hero-text p {
  font-size: 15px; color: var(--text-secondary); line-height: 1.7; max-width: 380px;
  margin-bottom: 48px;
}

.login-stats {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 28px;
  margin-bottom: 32px;
}
.stat-item { flex: 1; text-align: center; }
.stat-num {
  display: block; font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1;
}
.stat-unit { font-size: 14px; font-weight: 600; color: var(--accent-light); }
.stat-label { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stat-divider { width: 1px; height: 40px; background: var(--border); margin: 0 8px; }

.login-model-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-dim);
  border: 1px solid var(--border-active);
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 12px; color: var(--text-secondary);
}
.login-model-badge a { color: var(--accent-light); font-weight: 600; }
.model-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* Right Panel */
.login-right {
  flex: 0.9;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 48px;
  background: var(--bg-base);
}

.login-card {
  width: 100%; max-width: 420px;
  animation: slideUp 0.5s ease both;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-card-header { margin-bottom: 36px; }
.login-card-header h2 {
  font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px;
}
.login-card-header p { font-size: 14px; color: var(--text-secondary); }

/* Form */
.login-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  display: flex; justify-content: space-between; align-items: center;
}
.forgot-link { font-size: 12px; color: var(--accent-light); font-weight: 500; }
.forgot-link:hover { color: var(--accent); }

.input-wrapper {
  position: relative; display: flex; align-items: center;
}
.input-icon {
  position: absolute; left: 14px; color: var(--text-muted); pointer-events: none;
  transition: color 0.2s;
}
.input-wrapper input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 44px 13px 42px;
  font-size: 14px; font-weight: 400;
  color: var(--text-primary);
  transition: all 0.2s;
  outline: none;
}
.input-wrapper input::placeholder { color: var(--text-muted); }
.input-wrapper input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon { color: var(--accent-light); }
.toggle-password {
  position: absolute; right: 14px;
  background: none; color: var(--text-muted);
  padding: 4px; border-radius: 4px;
  transition: color 0.2s;
}
.toggle-password:hover { color: var(--text-primary); }

.field-error { font-size: 12px; color: var(--red); font-weight: 500; min-height: 16px; }

.form-options { display: flex; align-items: center; }
.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkbox-custom {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.checkbox-label input:checked ~ .checkbox-custom {
  background: var(--accent); border-color: var(--accent);
}
.checkbox-label input:checked ~ .checkbox-custom::after {
  content: '✓'; font-size: 11px; color: white; font-weight: 700;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, #8B5CF6 100%);
  color: white;
  padding: 14px 24px;
  border-radius: var(--r-md);
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.25s;
  box-shadow: var(--shadow-accent);
  position: relative; overflow: hidden;
}
.btn-login::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 12px 40px rgba(108,99,255,0.4); }
.btn-login:hover::before { opacity: 1; }
.btn-login:active { transform: translateY(0); }
.btn-loader { display: none; }
.btn-login.loading .btn-text { display: none; }
.btn-login.loading .btn-loader { display: flex; }
.btn-login.loading .btn-arrow { display: none; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-divider {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-muted);
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.sso-options { display: flex; gap: 12px; }
.btn-sso {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 16px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
}
.btn-sso:hover {
  background: var(--bg-card); border-color: var(--border-active); color: var(--text-primary);
}

.login-footer {
  margin-top: 28px; text-align: center;
}
.login-footer p { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.login-footer a { color: var(--text-muted); }
.login-footer a:hover { color: var(--accent-light); }
.version-tag { font-size: 10px !important; color: var(--text-muted) !important; opacity: 0.5; }

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard-body {
  display: flex; min-height: 100vh;
  background: var(--bg-base);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand { display: flex; flex-direction: column; }
.sidebar-brand-name { font-size: 14px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.sidebar-brand-sub { font-size: 10px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.05em; }

.sidebar-firm {
  margin: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.firm-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #3B82F6, #6C63FF);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white; flex-shrink: 0;
}
.firm-info { flex: 1; min-width: 0; }
.firm-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.firm-role { font-size: 10px; color: var(--text-muted); }
.firm-chevron { color: var(--text-muted); flex-shrink: 0; }

.sidebar-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 12px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s;
  text-decoration: none;
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent-light);
  border: 1px solid var(--border-active);
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 100px;
  min-width: 20px; text-align: center;
}
.nav-badge.red { background: var(--red); }
.nav-badge.yellow { background: var(--yellow); color: #1a1a1a; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer; transition: background 0.15s;
}
.sidebar-user:hover { background: var(--bg-hover); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.user-email { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ── Header ── */
.topbar {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.topbar-title p { font-size: 12px; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-btn {
  width: 36px; height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.15s; position: relative;
}
.topbar-btn:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-active); }
.notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 1.5px solid var(--bg-surface);
}
.topbar-divider { width: 1px; height: 24px; background: var(--border); }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  cursor: pointer; transition: background 0.15s;
}
.topbar-user:hover { background: var(--bg-elevated); }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.topbar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* ── Page Content ── */
.page-content {
  padding: 28px;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: border-color 0.2s;
}
.card:hover { border-color: rgba(108,99,255,0.2); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  position: relative; overflow: hidden;
  transition: all 0.2s;
}
.stat-card:hover { border-color: rgba(108,99,255,0.25); transform: translateY(-1px); }
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
}
.stat-card.purple::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--green), #4ADE80); }
.stat-card.yellow::before { background: linear-gradient(90deg, var(--yellow), #FCD34D); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--blue), #60A5FA); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--red), #F87171); }

.stat-card-icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-card.purple .stat-card-icon { background: var(--accent-dim); color: var(--accent-light); }
.stat-card.green  .stat-card-icon { background: var(--green-dim);  color: var(--green); }
.stat-card.yellow .stat-card-icon { background: var(--yellow-dim); color: var(--yellow); }
.stat-card.blue   .stat-card-icon { background: var(--blue-dim);   color: var(--blue); }
.stat-card.red    .stat-card-icon { background: var(--red-dim);    color: var(--red); }

.stat-card-value {
  font-size: 28px; font-weight: 800; color: var(--text-primary);
  line-height: 1; margin-bottom: 4px;
}
.stat-card-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-card-change {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  margin-top: 8px; padding: 3px 8px; border-radius: 100px;
}
.stat-card-change.up   { background: var(--green-dim);  color: var(--green); }
.stat-card-change.down { background: var(--red-dim);    color: var(--red); }
.stat-card-change.neutral { background: var(--yellow-dim); color: var(--yellow); }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 16px; text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td {
  padding: 13px 16px; font-size: 13px; color: var(--text-secondary);
  vertical-align: middle;
}
.td-primary { color: var(--text-primary) !important; font-weight: 600; }
.td-mono { font-family: 'Courier New', monospace; font-size: 12px; }

/* ── Badges / Pills ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-blue   { background: var(--blue-dim);   color: var(--blue); }
.badge-purple { background: var(--accent-dim); color: var(--accent-light); }
.badge-gray   { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600;
  transition: all 0.2s; cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8B5CF6);
  color: white; border: none;
  box-shadow: 0 4px 16px rgba(108,99,255,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(108,99,255,0.4); }
.btn-secondary {
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-active); }
.btn-ghost {
  background: none; color: var(--text-secondary); border: none; padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elevated); border-radius: var(--r-md); }
.btn-danger {
  background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* ── Progress Bar ── */
.progress-bar {
  height: 6px; background: var(--bg-elevated); border-radius: 100px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 0.6s ease;
}
.progress-fill.green  { background: linear-gradient(90deg, var(--green), #4ADE80); }
.progress-fill.yellow { background: linear-gradient(90deg, var(--yellow), #FCD34D); }
.progress-fill.red    { background: linear-gradient(90deg, var(--red), #F87171); }

/* ── Grid Layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-main-side { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

/* ── Section Header ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.section-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── AI Status ── */
.ai-status-bar {
  background: linear-gradient(135deg, rgba(108,99,255,0.1), rgba(167,139,250,0.05));
  border: 1px solid var(--border-active);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px;
}
.ai-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse-dot 1.5s infinite;
  flex-shrink: 0;
}
.ai-status-text { flex: 1; font-size: 13px; color: var(--text-secondary); }
.ai-status-text strong { color: var(--accent-light); }
.ai-progress-mini {
  width: 120px; height: 4px;
  background: var(--bg-elevated); border-radius: 100px; overflow: hidden;
}
.ai-progress-fill {
  height: 100%; border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  animation: ai-progress 3s ease-in-out infinite;
}
@keyframes ai-progress {
  0% { width: 0%; } 70% { width: 85%; } 100% { width: 85%; }
}

/* ── Privilege Badge ── */
.privilege-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 10px; font-weight: 700; color: var(--yellow);
  letter-spacing: 0.05em; text-transform: uppercase;
}

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-elevated);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-icon { color: var(--text-muted); margin-bottom: 12px; }
.upload-zone:hover .upload-icon { color: var(--accent-light); }
.upload-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.upload-sub { font-size: 12px; color: var(--text-muted); }

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; gap: 14px; padding-bottom: 20px;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 5px;
  box-shadow: 0 0 8px var(--accent);
}
.timeline-dot.green  { background: var(--green); box-shadow: 0 0 8px var(--green); }
.timeline-dot.yellow { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.timeline-dot.gray   { background: var(--text-muted); box-shadow: none; }
.timeline-line {
  position: absolute; left: 4px; top: 14px; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item:last-child .timeline-line { display: none; }
.timeline-content { flex: 1; }
.timeline-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.timeline-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-light); border-bottom-color: var(--accent); }

/* ── Search ── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 9px 14px;
  transition: all 0.2s;
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-bar input {
  background: none; border: none; outline: none;
  font-size: 13px; color: var(--text-primary); flex: 1;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Animations ── */
.fade-in { animation: fadeIn 0.4s ease both; }
.slide-up { animation: slideUp 0.4s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Responsive ── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .login-left { display: none; }
  .login-right { flex: 1; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ── Tooltip ── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card); color: var(--text-primary);
  font-size: 11px; font-weight: 500;
  padding: 5px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border);
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
  z-index: 999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 48px 24px;
}
.empty-state-icon { color: var(--text-muted); margin-bottom: 12px; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state-sub { font-size: 13px; color: var(--text-muted); }

/* ── LEDES Validation Colors ── */
.ledes-valid   { background: var(--green-dim);  border-left: 3px solid var(--green); }
.ledes-warning { background: var(--yellow-dim); border-left: 3px solid var(--yellow); }
.ledes-error   { background: var(--red-dim);    border-left: 3px solid var(--red); }

/* ── Chart Container ── */
.chart-container { position: relative; width: 100%; }
.chart-bar-group { display: flex; flex-direction: column; gap: 10px; }
.chart-bar-item { display: flex; align-items: center; gap: 12px; }
.chart-bar-label { font-size: 12px; color: var(--text-muted); width: 80px; flex-shrink: 0; text-align: right; }
.chart-bar-track { flex: 1; height: 8px; background: var(--bg-elevated); border-radius: 100px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 100px; transition: width 1s ease; }
.chart-bar-value { font-size: 12px; font-weight: 600; color: var(--text-primary); width: 40px; }

/* ── Notification Toast ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease;
  min-width: 280px; max-width: 360px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-icon { flex-shrink: 0; }
.toast-text { flex: 1; font-size: 13px; color: var(--text-primary); }
.toast-close { color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.info    { border-left: 3px solid var(--accent); }

/* ── Polish & Micro-interactions ── */

/* Page entry animation for all dashboard pages */
.page-content { animation: pageFadeIn 0.35s ease both; }
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Staggered card entrance */
.stats-grid .stat-card:nth-child(1) { animation: cardSlideUp 0.4s ease 0.05s both; }
.stats-grid .stat-card:nth-child(2) { animation: cardSlideUp 0.4s ease 0.10s both; }
.stats-grid .stat-card:nth-child(3) { animation: cardSlideUp 0.4s ease 0.15s both; }
.stats-grid .stat-card:nth-child(4) { animation: cardSlideUp 0.4s ease 0.20s both; }
@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sidebar nav item hover — left accent line */
.nav-item { border: 1px solid transparent; }
.nav-item:hover::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 2px; border-radius: 2px;
  background: var(--accent-light);
  opacity: 0.5;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 15%; bottom: 15%;
  width: 3px; border-radius: 2px;
  background: var(--accent);
  opacity: 1;
}

/* Button ripple effect */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0; border-radius: inherit;
  transition: opacity 0.15s;
}
.btn:active::after { opacity: 1; }

/* Card hover glow */
.stat-card:hover {
  box-shadow: 0 0 0 1px rgba(108,99,255,0.15), 0 8px 32px rgba(0,0,0,0.4);
}

/* Topbar entrance */
.topbar { animation: topbarSlide 0.3s ease both; }
@keyframes topbarSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sidebar entrance */
.sidebar { animation: sidebarSlide 0.35s ease both; }
@keyframes sidebarSlide {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Progress bar pulse for in-progress items */
@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* Billing summary card hover */
.billing-summary-card {
  transition: all 0.2s;
}
.billing-summary-card:hover {
  border-color: var(--border-active);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Opinion card entrance stagger */
.opinion-card:nth-child(1) { animation: cardSlideUp 0.4s ease 0.05s both; }
.opinion-card:nth-child(2) { animation: cardSlideUp 0.4s ease 0.12s both; }
.opinion-card:nth-child(3) { animation: cardSlideUp 0.4s ease 0.19s both; }

/* Matter card entrance stagger */
.matter-card:nth-child(1) { animation: cardSlideUp 0.4s ease 0.04s both; }
.matter-card:nth-child(2) { animation: cardSlideUp 0.4s ease 0.08s both; }
.matter-card:nth-child(3) { animation: cardSlideUp 0.4s ease 0.12s both; }
.matter-card:nth-child(4) { animation: cardSlideUp 0.4s ease 0.16s both; }
.matter-card:nth-child(5) { animation: cardSlideUp 0.4s ease 0.20s both; }
.matter-card:nth-child(6) { animation: cardSlideUp 0.4s ease 0.24s both; }

/* Focus ring for accessibility */
.btn:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth color transitions on interactive elements */
.badge, .nav-badge, .filter-chip {
  transition: all 0.15s ease;
}

/* Generate panel glow on hover */
.generate-panel {
  transition: border-color 0.2s, box-shadow 0.2s;
}
.generate-panel:hover {
  border-color: rgba(108,99,255,0.2);
  box-shadow: 0 0 0 1px rgba(108,99,255,0.08), var(--shadow-md);
}

/* Thinking animation for AI states */
@keyframes aiThink {
  0%   { box-shadow: 0 0 6px var(--accent); }
  50%  { box-shadow: 0 0 18px var(--accent), 0 0 32px rgba(108,99,255,0.3); }
  100% { box-shadow: 0 0 6px var(--accent); }
}
.ai-pulse { animation: pulse-dot 1.5s infinite, aiThink 2s ease-in-out infinite; }

/* Table row entrance */
tbody tr { animation: rowFade 0.3s ease both; }
tbody tr:nth-child(1) { animation-delay: 0.02s; }
tbody tr:nth-child(2) { animation-delay: 0.05s; }
tbody tr:nth-child(3) { animation-delay: 0.08s; }
tbody tr:nth-child(4) { animation-delay: 0.11s; }
@keyframes rowFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Smooth scrolling for the whole app */
html { scroll-behavior: smooth; }

/* Selection color */
::selection {
  background: var(--accent-dim);
  color: var(--accent-light);
}

/* Input autofill dark mode fix */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-elevated) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  caret-color: var(--text-primary);
}

/* Responsive: opinions two-column collapses */
@media (max-width: 1100px) {
  .opinions-layout { grid-template-columns: 1fr !important; }
}
@media (max-width: 768px) {
  .billing-summary-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .form-row { grid-template-columns: 1fr !important; }
}

/* ── Back to Home link (login page) ── */
.back-to-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.2s ease;
  letter-spacing: 0.02em;
}
.back-to-home:hover {
  color: rgba(255,255,255,0.85);
}
.back-to-home svg {
  transition: transform 0.2s ease;
}
.back-to-home:hover svg {
  transform: translateX(-3px);
}