/* ═══════════════════════════════════════════════
   DYNAMIC CHOIR WELFARE PORTAL — main.css
   Dark Amber / Flame Design System
═══════════════════════════════════════════════ */

/* ── RESET & BOX MODEL ─────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

/* ── CSS CUSTOM PROPERTIES ─────────────────── */
:root {
  /* Backgrounds */
  --bg:          #0D0D0D;
  --surface:     #1A1A1A;
  --surface-2:   #222222;
  --surface-3:   #2A2A2A;
  --border:      #2A2A2A;
  --border-soft: #333333;

  /* Brand */
  --orange:      #F97316;
  --orange-dark: #EA6C0E;
  --amber:       #F59E0B;
  --orange-glow: rgba(249,115,22,0.15);
  --amber-glow:  rgba(245,158,11,0.12);

  /* Text */
  --text:        #FFFFFF;
  --text-muted:  #9CA3AF;
  --text-dim:    #6B7280;

  /* Semantic */
  --green:       #22C55E;
  --green-glow:  rgba(34,197,94,0.12);
  --red:         #EF4444;
  --red-glow:    rgba(239,68,68,0.12);
  --yellow:      #F59E0B;
  --yellow-glow: rgba(245,158,11,0.12);
  --blue:        #3B82F6;
  --navy:        #1E3A5F;

  /* Layout */
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-sm:   6px;

  /* Transitions */
  --transition:  0.18s ease;
  --transition-slow: 0.3s ease;

  /* Shadows */
  --shadow:      0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.6);
  --glow-orange: 0 0 24px rgba(249,115,22,0.25);

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Outfit', 'Segoe UI', system-ui, sans-serif;
}

/* ── LIGHT MODE ─────────────────────────────── */
[data-theme="light"] {
  --bg:          #F3F4F6;
  --surface:     #FFFFFF;
  --surface-2:   #F9FAFB;
  --surface-3:   #F3F4F6;
  --border:      #E5E7EB;
  --border-soft: #D1D5DB;

  --text:        #111827;
  --text-muted:  #4B5563;
  --text-dim:    #9CA3AF;

  --orange-glow: rgba(249,115,22,0.10);
  --amber-glow:  rgba(245,158,11,0.08);
  --green-glow:  rgba(34,197,94,0.08);
  --red-glow:    rgba(239,68,68,0.08);

  --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.12);
  --glow-orange: 0 0 24px rgba(249,115,22,0.12);
}

/* Smooth theme transition on all elements */
*, *::before, *::after {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}
/* But don't slow down interaction transitions */
.btn, .nav-item, input, select, textarea, .stat-card, .panel {
  transition: background-color 0.2s ease, border-color 0.2s ease,
              color 0.15s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

/* ── BASE ───────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--orange); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

h1,h2,h3,h4,h5 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

p { color: var(--text-muted); }

/* ── SCREEN SYSTEM ──────────────────────────── */
.screen { min-height: 100vh; }

/* ── UTILS ──────────────────────────────────── */
.text-orange   { color: var(--orange); }
.text-amber    { color: var(--amber); }
.text-green    { color: var(--green); }
.text-red      { color: var(--red); }
.text-muted    { color: var(--text-muted); }
.text-dim      { color: var(--text-dim); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.font-heading  { font-family: var(--font-heading); }
.fw-600        { font-weight: 600; }
.fw-700        { font-weight: 700; }

.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 32px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.ml-sm { margin-left: 8px; }
.ml-md { margin-left: 12px; }
.p-lg  { padding: 24px; }

.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.gap-sm     { gap: 8px; }
.gap-md     { gap: 16px; }
.gap-lg     { gap: 24px; }
.hidden     { display: none !important; }

/* ══════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════ */
.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* LEFT PANEL */
.login-left {
  position: relative;
  background: radial-gradient(ellipse at 30% 20%, rgba(249,115,22,0.18) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(245,158,11,0.10) 0%, transparent 50%),
              var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 64px;
  text-align: center;
  overflow: hidden;
}

/* Light mode login adjustments */
[data-theme="light"] .login-left {
  background: radial-gradient(ellipse at 30% 20%, rgba(249,115,22,0.12) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(245,158,11,0.08) 0%, transparent 50%),
              #F3F4F6;
}
[data-theme="light"] .login-right  { background: #FFFFFF; }
[data-theme="light"] .login-card   { box-shadow: var(--shadow-lg); }

.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23F97316' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.login-brand { margin-bottom: 40px; }

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-logo svg {
  filter: drop-shadow(0 0 24px rgba(249,115,22,0.4));
}

.login-title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--orange);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.25em;
}

.login-divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  margin: 20px auto 0;
}

.login-tagline { margin-bottom: 48px; }
.login-tagline h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 12px;
}
.login-tagline p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 280px;
  margin: 0 auto;
}

.login-trust-badges {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--text-muted);
}

.trust-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}
.trust-badge svg { color: var(--orange); }
.trust-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

.login-deco {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
}
.deco-notes { width: 100%; height: 200px; }

/* RIGHT PANEL */
.login-right {
  background: #111111;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 64px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg), var(--glow-orange);
  position: relative;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.login-card-header {
  margin-bottom: 28px;
}
.login-icon { font-size: 1.5rem; }
.login-card-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 6px;
}
.login-card-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* OAuth buttons */
.oauth-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.btn-oauth {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-oauth:hover {
  border-color: var(--orange);
  color: var(--text);
  background: var(--orange-glow);
}

.oauth-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: white;
}
.oauth-mtn   { background: #FFCB02; color: #000; }
.oauth-voda  { background: #E2231A; }
.oauth-airtel { background: #D62B2B; }

.login-footer {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 16px;
}
.link-orange { color: var(--orange); font-weight: 500; }
.link-muted  { color: var(--orange); font-size: 0.82rem; }

.login-security-note {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 20px;
}

/* Google OAuth button */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: var(--radius);
  padding: 11px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 4px;
}
.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.btn-google:active { background: #f1f3f4; }

/* OR Divider */
.divider-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-dim);
  font-size: 0.78rem;
}
.divider-or::before,
.divider-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ══════════════════════════════════════════════
   FORM ELEMENTS
══════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }

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

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.form-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px 10px 38px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input::placeholder { color: var(--text-dim); }

.form-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.form-input.no-icon { padding-left: 14px; }

.form-input-plain {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input-plain:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
.form-input-plain::placeholder { color: var(--text-dim); }

select.form-input,
select.form-input-plain {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
select.form-input option,
select.form-input-plain option { background: var(--surface-2); color: var(--text); }

textarea.form-input-plain { resize: vertical; min-height: 80px; }

.input-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  transition: color var(--transition);
}
.input-toggle:hover { color: var(--text); }

.form-row-end {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.form-error {
  font-size: 0.78rem;
  color: var(--red);
  margin-top: 4px;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  user-select: none;
}
.checkbox-label input[type="checkbox"] { display: none; }
.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  transition: all var(--transition);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--orange);
  border-color: var(--orange);
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translate(1px, -1px);
  display: block;
}

/* Form grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ══════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(249,115,22,0.3);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #fb8a35, var(--orange));
  box-shadow: 0 4px 16px rgba(249,115,22,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-outline {
  background: transparent;
  color: var(--orange);
  border: 1px solid var(--orange);
}
.btn-outline:hover:not(:disabled) {
  background: var(--orange-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-soft);
}

.btn-danger {
  background: var(--red);
  color: white;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-success {
  background: var(--green);
  color: #0D0D0D;
  font-weight: 600;
}
.btn-success:hover:not(:disabled) {
  background: #16a34a;
}

.btn-text {
  background: none;
  border: none;
  color: var(--orange);
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 2px 4px;
  transition: opacity var(--transition);
}
.btn-text:hover { opacity: 0.7; }

.btn-full { width: 100%; }
.btn-lg   { padding: 13px 24px; font-size: 1rem; }
.btn-sm   { padding: 5px 12px; font-size: 0.82rem; }

.btn-icon {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

/* ══════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════ */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-error   { background: var(--red-glow); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: var(--green-glow); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert-warning { background: var(--yellow-glow); border: 1px solid rgba(245,158,11,0.3); color: #fde68a; }
.alert-info    { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }

/* ══════════════════════════════════════════════
   CENTER SCREEN (pending, etc.)
══════════════════════════════════════════════ */
.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.pending-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.pending-card .pending-icon { font-size: 3rem; margin-bottom: 20px; }
.pending-card h2 { margin-bottom: 12px; font-size: 1.5rem; }
.pending-card p  { margin-bottom: 8px; font-size: 0.9rem; }

/* ══════════════════════════════════════════════
   ONBOARDING
══════════════════════════════════════════════ */
.onboarding-layout {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 80px;
}

.onboarding-header {
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
  width: 100%;
  max-width: 680px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: all var(--transition);
}

.step-item span {
  font-size: 0.72rem;
  color: var(--text-dim);
  transition: color var(--transition);
  text-align: center;
}

.step-item.active .step-num {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
  box-shadow: 0 0 0 4px var(--orange-glow);
}
.step-item.active span { color: var(--orange); }

.step-item.done .step-num {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.step-item.done span { color: var(--green); }

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-bottom: 20px;
}

.onboarding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow-lg);
}

/* ══════════════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════════════ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--transition-slow);
  z-index: 100;
}

.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--orange), var(--amber));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--orange-glow);
}

.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.brand-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section { margin-bottom: 24px; }
.nav-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 0 10px;
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
  cursor: pointer;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--orange-glow);
  color: var(--orange);
  font-weight: 500;
}
.nav-item.active .nav-icon { color: var(--orange); }

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-dim);
  transition: color var(--transition);
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { color: var(--orange); }

.nav-badge {
  background: var(--orange);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  margin-left: auto;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
  position: sticky;
  bottom: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--amber));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── TOPBAR ─────────────────────────────────── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.breadcrumb {
  font-size: 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text);
  display: none;
}

.sidebar-toggle { display: none; }

.topbar-notif {
  position: relative;
  width: 38px;
  height: 38px;
}
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--orange);
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.notif-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--orange);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 99px;
  min-width: 16px;
  text-align: center;
  line-height: 1.5;
}

.topbar-user { display: flex; align-items: center; gap: 8px; }
.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--amber));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}
.topbar-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

/* Notification Panel */
.notif-panel {
  position: absolute;
  top: var(--topbar-h);
  right: 16px;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: slideDown 0.18s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-panel-header h3 { font-size: 0.95rem; }

.notif-list { max-height: 320px; overflow-y: auto; padding: 8px; }

.notif-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: rgba(249,115,22,0.05); }
.notif-item-msg { font-size: 0.82rem; color: var(--text-muted); }
.notif-item-time { font-size: 0.72rem; color: var(--text-dim); margin-top: 3px; }

/* Pinned announcement banner */
.pinned-banner {
  background: linear-gradient(135deg, rgba(249,115,22,0.12), rgba(245,158,11,0.08));
  border-bottom: 1px solid rgba(249,115,22,0.25);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.25s ease;
  flex-shrink: 0;
}
.pinned-banner-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.pinned-banner-text {
  flex: 1;
  min-width: 0;
}
.pinned-banner-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.pinned-banner-body {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pinned-banner-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 6px;
  flex-shrink: 0;
  transition: color var(--transition);
  border-radius: 4px;
}
.pinned-banner-close:hover { color: var(--text); background: var(--surface-2); }

/* Multiple banners stack */
#pinned-banner .pinned-banner + .pinned-banner {
  border-top: 1px solid rgba(249,115,22,0.15);
}

/* ── PAGES ──────────────────────────────────── */
.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}
.page-container::-webkit-scrollbar { width: 4px; }
.page-container::-webkit-scrollbar-track { background: transparent; }
.page-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.page { animation: fadeIn 0.2s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
}

/* Page headers */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 1.5rem;
  font-family: var(--font-heading);
}
.page-header-actions { display: flex; gap: 8px; align-items: center; }
.page-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 24px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border-soft); }
.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-card-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.stat-card.accent-orange { border-left: 3px solid var(--orange); }
.stat-card.accent-green  { border-left: 3px solid var(--green); }
.stat-card.accent-red    { border-left: 3px solid var(--red); }
.stat-card.accent-amber  { border-left: 3px solid var(--amber); }

/* Loading spinner */
.spinner-ring {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-dim);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3   { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 8px; }
.empty-state p    { font-size: 0.875rem; }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-left   { display: none; }
  .login-right  { min-height: 100vh; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100vh;
    transition: left var(--transition-slow);
    z-index: 300;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }

  /* Overlay behind open sidebar on mobile */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 299;
  }
  .sidebar-backdrop.show { display: block; }

  .sidebar-toggle { display: flex; }
  .topbar { padding: 0 16px; }
  .topbar-name { display: none; }
  .page-container { padding: 16px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }

  /* Stack charts on mobile */
  #page-dashboard [style*="grid-template-columns:2fr 1fr"],
  #page-dashboard [style*="grid-template-columns:1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
  }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; justify-content: center; }

  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px 10px; }

  /* Hide less critical table columns on mobile */
  .data-table .td-hide-mobile { display: none; }

  .modal-box { max-width: 100%; max-height: 95vh; margin: 0 8px; }
  .onboarding-card { padding: 20px; }
  .step-item span { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .oauth-row { grid-template-columns: 1fr; }
  .login-card { padding: 24px 20px; }
  .portal-hero { flex-direction: column; text-align: center; }
  .portal-info-meta { justify-content: center; }
  .tab-bar { overflow-x: auto; }
  .tab-item { padding: 10px 12px; font-size: 0.8rem; }
}