/* NSW Planner — Design System */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:        #0d1117;
  --bg-surface:     #161b22;
  --bg-elevated:    #1c2130;
  --bg-hover:       #21262d;
  --border:         #30363d;
  --border-subtle:  #21262d;
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #6e7681;
  --accent:         #0ea5e9;
  --accent-hover:   #38bdf8;
  --accent-dim:     rgba(14,165,233,0.12);
  --success:        #22c55e;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --gold:           #d4af37;
  --danger-dim:     rgba(239,68,68,0.12);
  --radius:         8px;
  --radius-lg:      12px;
  --shadow:         0 4px 24px rgba(0,0,0,0.4);
  --sidebar-w:      240px;
  --sidebar-coll:   60px;
  --topbar-h:       60px;
  --transition:     0.2s ease;
  --teal-accent:    #2bcf9a;
  --teal-accent-dim:rgba(43,207,154,0.12);
  --glass-bg:       rgba(22,27,34,0.72);
  --glass-blur:     20px;
  --orb-accent:     #2657a8;
  --orb-teal:       #1a7a5e;
}

html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}
[x-cloak] { display: none !important; }

/* ── Auth ── */
.auth-stage {
  position: relative; min-height: 100vh; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-base);
}
.auth-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35; pointer-events: none; }
.auth-orb-1 { width: 520px; height: 520px; background: var(--orb-accent); top: -160px; left: -120px; animation: auth-float-1 16s ease-in-out infinite; }
.auth-orb-2 { width: 420px; height: 420px; background: var(--orb-teal); bottom: -140px; right: -80px; animation: auth-float-2 18s ease-in-out infinite; }
@keyframes auth-float-1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(40px,30px); } }
@keyframes auth-float-2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-30px,-40px); } }
.auth-noise {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 3px 3px;
}

.auth-topbar {
  position: absolute; top: 32px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 44px; z-index: 5;
}
.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; color: var(--text-primary); letter-spacing: -0.01em; }
.auth-brand-mark { width: 26px; height: 26px; flex-shrink: 0; object-fit: contain; }
.auth-nav-link {
  font-size: 13px; color: var(--text-muted); text-decoration: none; font-weight: 500;
}
.auth-nav-link:hover { color: var(--text-secondary); text-decoration: underline; }

.auth-content {
  position: relative; z-index: 4; display: flex; align-items: center; gap: 100px;
  max-width: 1100px; width: 100%; padding: 0 40px;
}
.auth-reveal .auth-pitch { animation: auth-fade-up 0.6s ease both; }
.auth-reveal .auth-card  { animation: auth-fade-up 0.6s 0.1s ease both; }
@keyframes auth-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.auth-pitch { flex: 1; min-width: 0; }
.auth-eyebrow { font-size: 12.5px; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 18px; }
.auth-headline { font-size: 40px; font-weight: 600; line-height: 1.18; letter-spacing: -0.025em; color: var(--text-primary); }
.auth-grad { background: linear-gradient(90deg, var(--accent), var(--teal-accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-pitch-text { margin-top: 16px; font-size: 15px; color: var(--text-secondary); line-height: 1.65; max-width: 400px; min-height: 50px; transition: opacity 0.4s; }
.auth-pitch-text.fading { opacity: 0; }

.auth-metrics { display: flex; gap: 0; margin-top: 40px; min-height: 54px; }
.auth-metric { padding-right: 32px; margin-right: 32px; border-right: 1px solid var(--border-subtle); transition: opacity 0.3s; }
.auth-metric:last-child { border-right: none; margin-right: 0; padding-right: 0; }
.auth-metric-n { font-size: 26px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-family: 'JetBrains Mono', monospace; }
.auth-metric-l { font-size: 12px; color: var(--text-muted); margin-top: 3px; transition: opacity 0.3s; }
.auth-metrics.fading .auth-metric-n, .auth-metrics.fading .auth-metric-l { opacity: 0.15; }

.auth-metric-dots { display: flex; gap: 6px; margin-top: 14px; }
.auth-metric-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); transition: background 0.3s, transform 0.3s; }
.auth-metric-dot.active { background: var(--accent); transform: scale(1.3); }

.auth-insight {
  margin-top: 36px; display: flex; align-items: center; gap: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 16px; max-width: 400px; min-height: 58px;
}
.auth-insight-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-insight-icon i { width: 16px; height: 16px; color: var(--accent); }
.auth-insight-text { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; transition: opacity 0.4s; }
.auth-insight-text b { color: var(--text-primary); font-weight: 500; }
.auth-insight-text.fading { opacity: 0; }

.auth-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; max-width: 400px; }
.auth-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 11px;
  font-size: 11.5px; font-weight: 500; color: var(--text-secondary);
}
.auth-badge i { width: 12px; height: 12px; color: var(--text-muted); flex-shrink: 0; }

.auth-footer {
  position: absolute; bottom: 20px; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: center; padding: 0 44px;
}
.auth-footer-text { font-size: 11.5px; color: var(--text-muted); text-align: center; }
.auth-footer-text a { color: var(--text-muted); text-decoration: none; }
.auth-footer-text a:hover { color: var(--text-secondary); text-decoration: underline; }

.auth-card {
  width: 380px; flex-shrink: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 38px 34px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.03);
}
.auth-card-title { font-size: 20px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.auth-card-sub { font-size: 13px; color: var(--text-muted); margin-top: 5px; margin-bottom: 22px; }

.tab-bar { display: flex; background: var(--bg-base); border-radius: var(--radius); padding: 4px; margin-bottom: 1.5rem; }
.tab, .tab-active {
  flex: 1; padding: 8px; border: none; border-radius: 6px; font-size: 0.875rem;
  font-weight: 500; cursor: pointer; transition: var(--transition);
}
.tab { background: transparent; color: var(--text-secondary); }
.tab-active { background: var(--bg-elevated); color: var(--text-primary); }

.auth-error-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--danger-dim); border: 1px solid rgba(239,68,68,0.3);
  color: #f0958f; font-size: 12.5px; border-radius: var(--radius);
  padding: 10px 13px; margin-bottom: 18px;
}
.auth-error-banner i { width: 15px; height: 15px; flex-shrink: 0; }
.auth-success-banner {
  display: flex; align-items: center; gap: 8px;
  background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3);
  color: var(--success); font-size: 12.5px; border-radius: var(--radius);
  padding: 10px 13px; margin-bottom: 18px;
}
.auth-success-banner i { width: 15px; height: 15px; flex-shrink: 0; }

.auth-field { margin-bottom: 14px; }
.auth-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 7px; font-weight: 500; }
.auth-input-wrap { position: relative; }
.auth-input {
  width: 100%; padding: 11px 13px; background: rgba(255,255,255,0.02);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-primary); font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus { border-color: var(--accent); background: rgba(14,165,233,0.04); box-shadow: 0 0 0 3px var(--accent-dim); }
.auth-input-pw { padding-right: 40px; }

.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--text-muted); display: flex; border-radius: 4px;
}
.pw-toggle:hover { color: var(--text-secondary); }
.pw-toggle i { width: 16px; height: 16px; }

.auth-submit-btn {
  width: 100%; padding: 12px; background: var(--text-primary); color: var(--bg-base);
  border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600;
  cursor: pointer; margin-top: 8px; transition: opacity 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px;
}
.auth-submit-btn:hover:not(:disabled) { opacity: 0.88; }
.auth-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-submit-btn i { width: 14px; height: 14px; }
.auth-btn-spinner {
  display: none; width: 15px; height: 15px; border: 2px solid rgba(13,17,23,0.25);
  border-top-color: var(--bg-base); border-radius: 50%; animation: spin 0.7s linear infinite;
}
.auth-submit-btn.is-loading .auth-btn-spinner { display: inline-block; }
.auth-submit-btn.is-loading .auth-btn-label,
.auth-submit-btn.is-loading .auth-btn-arrow { display: none; }

.auth-note { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.75rem; }

@media (prefers-reduced-motion: reduce) {
  .auth-orb { animation: none; }
  .auth-reveal .auth-pitch, .auth-reveal .auth-card { animation: none; }
}

@media (max-width: 860px) {
  .auth-content { flex-direction: column; gap: 32px; padding: 100px 24px 40px; }
  .auth-pitch { text-align: center; display: flex; flex-direction: column; align-items: center; }
  .auth-headline { font-size: 28px; }
  .auth-pitch-text { margin-left: auto; margin-right: auto; }
  .auth-metrics { justify-content: center; }
  .auth-insight { display: none; }
  .auth-badges { display: none; }
  .auth-card { width: 100%; max-width: 380px; }
  .auth-topbar { padding: 0 20px; top: 20px; }
  .auth-footer { padding: 0 20px; bottom: 12px; }
}
@media (max-width: 420px) {
  .auth-metrics { gap: 0; flex-wrap: wrap; row-gap: 16px; }
  .auth-metric { flex: 1 1 40%; border-right: none; margin-right: 0; padding-right: 0; }
}

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%; background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; color: var(--text-primary);
  font-size: 0.875rem; font-family: inherit; transition: border-color var(--transition);
  outline: none;
}
.form-input:focus { border-color: var(--accent); }
.form-input-sm { padding: 6px 10px; font-size: 0.8rem; }
select.form-input { cursor: pointer; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px;
}
.pw-toggle:hover { color: var(--text-primary); }
.pw-toggle i { width: 16px; height: 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius); border: none;
  font-size: 0.875rem; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { width: 15px; height: 15px; flex-shrink: 0; }
.mt-8 { margin-top: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Messages ── */
.error-msg {
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger); border-radius: var(--radius); padding: 10px 12px;
  font-size: 0.8rem; margin-bottom: 1rem;
}
.success-msg {
  background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3);
  color: var(--success); border-radius: var(--radius); padding: 10px 12px;
  font-size: 0.8rem; margin-bottom: 1rem;
}

/* ── Layout ── */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: var(--bg-surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
  transition: width var(--transition);
}
.sidebar-collapsed { width: var(--sidebar-coll); }
.sidebar-header {
  padding: 16px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle); min-height: 65px;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-icon { font-size: 1.5rem; }
.sidebar-logo-title { font-weight: 700; font-size: 0.9rem; }
.sidebar-logo-sub { font-size: 0.7rem; color: var(--text-muted); }
.sidebar-toggle {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 6px; border-radius: 6px; transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-toggle i { width: 18px; height: 18px; display: block; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius); border: none; background: none;
  color: var(--text-secondary); font-size: 0.875rem; font-family: inherit;
  cursor: pointer; width: 100%; text-align: left; transition: var(--transition);
  white-space: nowrap; overflow: hidden;
}
.nav-item i { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-active { background: var(--accent-dim) !important; color: var(--accent) !important; font-weight: 500; }
.sidebar-section { padding: 12px; border-top: 1px solid var(--border-subtle); }
.sidebar-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border-subtle); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-dim);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem; flex-shrink: 0;
}
.user-name { font-size: 0.875rem; font-weight: 500; }
.user-tier { font-size: 0.7rem; color: var(--text-muted); }

.main-content { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.main-with-sidebar { margin-left: var(--sidebar-w); transition: margin-left var(--transition); }
.main-collapsed { margin-left: var(--sidebar-coll); transition: margin-left var(--transition); }

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h); background: var(--bg-surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 1100; gap: 16px;
}
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
.period-select-inline { display: flex; align-items: center; }
.period-select-inline select { min-width: 130px; height: 32px; padding: 4px 8px; }

.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.data-freshness { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-muted); }
.freshness-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--success); }
.dot-yellow { background: var(--warning); }
.dot-red { background: var(--danger); }
.user-chip {
  display: flex; align-items: center; gap: 8px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px;
  font-size: 0.78rem;
}
.tier-badge {
  background: var(--accent); color: white; border-radius: 9999px;
  padding: 1px 8px; font-size: 0.68rem; font-weight: 700;
}
.briefings-left { color: var(--text-muted); }

/* ── Page content ── */
.page-body { padding: 24px; max-width: 1400px; }
.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); font-size: 0.85rem; }

/* ── Stat cards ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 1.75rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.stat-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.val-accent  { color: var(--accent); }
.val-success { color: var(--success); }
.val-warning { color: var(--warning); }
.val-danger  { color: var(--danger); }

/* ── Section headers ── */
.section-header {
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px; margin-bottom: 16px; margin-top: 24px;
}

/* ── Cards ── */
.card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 0.9rem; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Council selector ── */
.council-select-wrap { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; align-items: start; }
@media (max-width: 768px) { .council-select-wrap { grid-template-columns: 1fr; } }
.council-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 600px) { .council-stats { grid-template-columns: repeat(2, 1fr); } }
.council-stat { background: var(--bg-base); border-radius: var(--radius); padding: 12px; text-align: center; }
.council-stat-val { font-size: 1.2rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--accent); }
.council-stat-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* ── Briefing ── */
.briefing-box {
  background: var(--bg-base); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 24px; min-height: 120px;
  line-height: 1.8; color: var(--text-primary);
}
.briefing-box strong { color: var(--accent); }
.briefing-box p { margin-bottom: 12px; }
.briefing-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 120px; color: var(--text-muted); font-size: 0.875rem;
}

/* ── Council project summaries ── */
.council-project-card {
  background: var(--bg-base); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 18px 20px;
}
.council-project-card + .council-project-card { margin-top: 14px; }
.council-project-label { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.council-project-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; color: var(--text-muted);
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: 999px; padding: 4px 10px;
}
.council-project-verify {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem; color: var(--accent); text-decoration: none; font-weight: 500;
}
.council-project-verify:hover { text-decoration: underline; }

/* ── Map ── */
.map-container {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; margin-top: 24px;
  height: 480px; position: relative;
}
.map-placeholder {
  height: 100%; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px; color: var(--text-muted);
}
/* Leaflet dark theme overrides */
.leaflet-container { background: #0d1117 !important; font-family: 'Inter', sans-serif; }
.leaflet-control-attribution { background: rgba(13,17,23,0.8) !important; color: #6e7681 !important; }
.leaflet-control-attribution a { color: #6e7681 !important; }
.leaflet-control-zoom a {
  background: var(--bg-elevated) !important; color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { background: var(--bg-hover) !important; }
.leaflet-tooltip {
  background: var(--bg-elevated) !important; border: 1px solid var(--border) !important;
  color: var(--text-primary) !important; border-radius: 8px !important;
  font-size: 12px !important; padding: 8px 12px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}
.map-toggle-btn {
  position: absolute; top: 12px; right: 12px; z-index: 1000;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: var(--radius);
  padding: 6px 12px; font-size: 0.78rem; cursor: pointer;
  font-family: inherit;
}
.map-toggle-btn:hover { background: var(--bg-hover); }
.leaflet-tooltip-top::before { border-top-color: var(--border) !important; }

/* ── Approval timing ── */
.timing-summary { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.timing-chip {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px; text-align: center; flex: 1; min-width: 120px;
}
.timing-chip-val { font-size: 1.4rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.timing-chip-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.benchmark-bar {
  height: 12px; border-radius: 6px; background: var(--bg-hover);
  overflow: hidden; display: flex; margin-bottom: 20px;
}
.benchmark-bar-labels {
  display: flex; justify-content: space-between;
  font-size: 0.68rem; color: var(--text-muted); margin-top: 4px; margin-bottom: 16px;
}
.timing-table-wrap { max-height: 320px; overflow-y: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }

/* ── Data table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
  background: var(--bg-elevated); padding: 12px 16px; text-align: left;
  font-size: 0.75rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
  cursor: pointer; user-select: none;
}
thead th:hover { color: var(--text-primary); }
tbody tr { border-top: 1px solid var(--border-subtle); }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 11px 16px; color: var(--text-primary); }
.td-num { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; text-align: right; }
.progress-cell { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.fill-green { background: var(--success); }
.fill-yellow { background: var(--warning); }
.fill-red { background: var(--danger); }

/* ── Badges ── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 9999px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-trial      { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-free       { background: rgba(107,114,128,0.15); color: #9ca3af; }
.badge-pro        { background: rgba(14,165,233,0.15); color: var(--accent); }
.badge-enterprise { background: rgba(212,175,55,0.15); color: var(--gold); }
.badge-admin      { background: rgba(239,68,68,0.15); color: var(--danger); }

/* ── Watchlist ── */
.watchlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.watchlist-item {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; transition: border-color var(--transition);
}
.watchlist-item:hover { border-color: var(--accent); }
.watchlist-item-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.watchlist-council { font-weight: 600; font-size: 0.95rem; }
.watchlist-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.watchlist-stat { text-align: center; }
.watchlist-stat-val { font-size: 1rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.watchlist-stat-label { font-size: 0.68rem; color: var(--text-muted); }

/* ── Admin ── */
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.admin-tab {
  padding: 10px 20px; border: none; background: none; color: var(--text-muted);
  font-family: inherit; font-size: 0.875rem; cursor: pointer; border-bottom: 2px solid transparent;
  transition: var(--transition); margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.user-row-actions { display: flex; gap: 6px; }
.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  border-radius: 6px; padding: 5px 8px; cursor: pointer; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn i { width: 14px; height: 14px; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 16px 0; }
.page-btn {
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-primary);
  border-radius: var(--radius); padding: 7px 14px; font-size: 0.8rem; cursor: pointer;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 0.8rem; color: var(--text-muted); }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

/* ── Search ── */
.search-bar { position: relative; }
.search-bar i, .search-bar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.search-input { padding-left: 36px; }

/* ── Loading ── */
.loading-overlay {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 60vh; gap: 16px; color: var(--text-muted);
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text { font-size: 0.875rem; }

/* ── Shimmer ── */
.shimmer {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; font-size: 0.85rem;
  box-shadow: var(--shadow); animation: slideIn 0.2s ease; max-width: 320px;
  display: flex; align-items: center; gap: 10px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Velocity trend badge ── */
.trend-up   { color: var(--success); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }
.trend-flat { color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .sidebar { display: none; }
  .main-with-sidebar, .main-collapsed { margin-left: 0; }
  .page-body { padding: 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   COUNCIL SCORECARDS
═══════════════════════════════════════════════════════════════ */

/* Grade pills */
.grade-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0;
}
.grade-pill.grade-lg { width: 44px; height: 44px; font-size: 1.25rem; border-radius: 10px; }
.grade-A { background: rgba(34,197,94,0.2);  color: #22c55e; }
.grade-B { background: rgba(14,165,233,0.2); color: #0ea5e9; }
.grade-C { background: rgba(245,158,11,0.2); color: #f59e0b; }
.grade-D { background: rgba(239,68,68,0.15); color: #ef4444; }
.grade-F { background: rgba(107,114,128,0.2);color: #9ca3af; }

/* Legend */
.sc-legend {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.75rem; color: var(--text-muted);
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 12px;
}
.sc-legend .grade-pill { width: 20px; height: 20px; font-size: 0.68rem; margin-left: 8px; }

/* Filters bar */
.sc-filters {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.sc-count { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

/* Podium */
.sc-podium-wrap { margin-bottom: 24px; }
.sc-podium { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.podium-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.podium-cards { display: flex; flex-wrap: wrap; gap: 12px; padding-bottom: 4px; }
.podium-card {
  flex: 1; min-width: 160px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; cursor: pointer; transition: var(--transition);
  position: relative; overflow: hidden;
}
.podium-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.podium-rank-1 { border-color: rgba(212,175,55,0.4); background: rgba(212,175,55,0.06); }
.podium-rank-2 { border-color: rgba(148,163,184,0.4); }
.podium-rank-3 { border-color: rgba(180,120,60,0.4); background: rgba(180,120,60,0.04); }
.podium-rank { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.podium-name { font-size: 0.85rem; font-weight: 600; margin-bottom: 10px; line-height: 1.3; }
.podium-score-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.podium-score { font-size: 1.6rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--accent); }
.podium-sub { font-size: 0.72rem; color: var(--text-muted); }

/* Scorecard grid */
.sc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* Scorecard card */
.sc-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; cursor: pointer;
  transition: var(--transition); position: relative; overflow: hidden;
}
.sc-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.sc-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sc-rank { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.sc-card-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 12px; line-height: 1.3; min-height: 36px; }

/* Score ring */
.sc-score-wrap { display: flex; justify-content: center; margin-bottom: 14px; }

/* Component bars */
.sc-bars { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.sc-bar-row { display: flex; align-items: center; gap: 8px; }
.sc-bar-label { font-size: 0.7rem; color: var(--text-muted); width: 48px; flex-shrink: 0; }
.sc-bar-track { flex: 1; height: 5px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.sc-bar-track-lg { height: 8px; }
.sc-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.sc-bar-value { font-size: 0.7rem; color: var(--text-secondary); width: 56px; text-align: right; flex-shrink: 0; }
.sc-card-footer { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); border-top: 1px solid var(--border-subtle); padding-top: 10px; }

/* Modal */
.sc-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.sc-modal {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 620px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.sc-modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 24px 24px 16px; border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}
.sc-modal-rank { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.sc-modal-name { font-size: 1.2rem; font-weight: 700; }
.sc-modal-score-row { display: flex; gap: 24px; padding: 20px 24px; align-items: flex-start; }
.sc-modal-score-main { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.sc-modal-grade-label { font-size: 0.78rem; color: var(--text-muted); }
.sc-modal-components { flex: 1; }
.sc-modal-comp-title { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.sc-modal-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sc-modal-bar-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-secondary); width: 120px; flex-shrink: 0; }
.sc-weight { color: var(--text-muted); font-size: 0.7rem; }
.sc-modal-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; padding: 0 24px 20px; border-top: 1px solid var(--border-subtle); padding-top: 20px;
}
.sc-modal-stat { text-align: center; }
.sc-modal-stat-val { font-size: 1.15rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; margin-bottom: 4px; }
.sc-modal-stat-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sc-investor-note {
  margin: 0 24px 20px; background: rgba(14,165,233,0.07);
  border: 1px solid rgba(14,165,233,0.2); border-radius: var(--radius);
  padding: 14px 16px;
}
.sc-investor-note-title { font-size: 0.78rem; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.sc-investor-note-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; }
.sc-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border-subtle); }

/* ═══════════════════════════════════════════════════════════════
   UI IMPROVEMENTS — Dashboard & General
═══════════════════════════════════════════════════════════════ */

/* Better stat cards */
.stat-card {
  display: flex; gap: 14px; align-items: flex-start;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon i { width: 20px; height: 20px; }
.stat-body { flex: 1; }

/* Improved briefing box headings */
.briefing-box strong {
  display: block; color: var(--accent); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 16px; margin-bottom: 6px;
}
.briefing-box p:first-child strong { margin-top: 0; }
.briefing-box p { margin: 0; color: var(--text-secondary); font-size: 0.875rem; line-height: 1.7; }

/* Cleaner section headers */
.section-header {
  display: flex; align-items: center; gap: 8px;
}

/* Page body max width improvement */
.page-body { padding: 24px 28px; }
@media (max-width: 768px) { .page-body { padding: 16px; } }

/* ═══════════════════════════════════════════════════════════════
   DATA PAGE — TABS & DA SEARCH
═══════════════════════════════════════════════════════════════ */

.data-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.data-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 18px; border: none; background: none;
  color: var(--text-muted); font-family: inherit; font-size: 0.875rem;
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: var(--transition); margin-bottom: -1px;
}
.data-tab i { width: 15px; height: 15px; }
.data-tab:hover { color: var(--text-primary); }
.data-tab-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

/* Filter bar */
.da-filter-bar {
  display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center;
}

/* Results header */
.da-results-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
}

/* Empty state inside table */
.da-empty {
  text-align: center; padding: 48px 24px !important;
  color: var(--text-muted); font-size: 0.875rem;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}

/* DA table rows */
.da-row { cursor: pointer; }
.da-row:hover { background: var(--bg-hover); }
.da-row-expanded { background: var(--bg-hover); }
.da-row-expanded td { border-bottom: none; }

.da-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem; color: var(--text-muted);
  white-space: nowrap;
}
.da-address {
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.85rem;
}
.da-status { font-size: 0.8rem; font-weight: 500; white-space: nowrap; }

.da-type-badge {
  display: inline-block; padding: 2px 8px; border-radius: 9999px;
  font-size: 0.7rem; font-weight: 600; text-transform: capitalize;
}
.da-type-residential { background: rgba(168,85,247,0.15); color: #a855f7; }
.da-type-commercial   { background: rgba(14,165,233,0.15); color: #0ea5e9; }
.da-type-other        { background: rgba(107,114,128,0.15); color: #9ca3af; }

/* Detail expand row */
.da-detail-row td { padding: 0 !important; }
.da-detail {
  padding: 16px 20px 16px 36px;
  background: var(--bg-base); border-bottom: 1px solid var(--border-subtle);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.da-detail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 14px;
}
.da-detail-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.da-detail-val   { font-size: 0.85rem; font-weight: 500; }
.da-mono         { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }

.da-detail-desc { margin-bottom: 14px; }
.da-detail-desc-text {
  font-size: 0.83rem; color: var(--text-secondary); line-height: 1.6;
  background: var(--bg-elevated); border-radius: var(--radius);
  padding: 10px 14px; margin-top: 6px; border: 1px solid var(--border-subtle);
}
.da-detail-actions { display: flex; gap: 8px; }

/* Upgrade hint */
.upgrade-hint {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem; color: var(--text-muted);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 12px;
}

/* ═══════════════════════════════════════════════════════════════
   DA SEARCH — Enhanced UI
═══════════════════════════════════════════════════════════════ */

/* Advanced filter panel */
.da-advanced-panel {
  background: var(--bg-base); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 14px;
  animation: fadeIn 0.15s ease;
}
.da-adv-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 12px;
}
.da-adv-grid .form-group { margin-bottom: 0; }

/* Endpoint source badges */
.da-ep-badge {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
}
.da-ep-da  { background: rgba(14,165,233,0.15); color: #0ea5e9; }
.da-ep-cdc { background: rgba(34,197,94,0.15);  color: #22c55e; }
.da-ep-cc  { background: rgba(245,158,11,0.15); color: #f59e0b; }
.da-ep-oc  { background: rgba(168,85,247,0.15); color: #a855f7; }

/* Dev type in table */
.da-type-sm {
  font-size: 0.75rem; color: var(--text-secondary);
  max-width: 130px; display: inline-block; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
}

/* Status dot */
.da-status-dot { font-size: 0.78rem; font-weight: 500; white-space: nowrap; }

/* Flag chips */
.da-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.da-flag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.da-flag-vpa { background: rgba(212,175,55,0.15); color: var(--gold); }
.da-flag-sub { background: rgba(99,102,241,0.15); color: #6366f1; }
.da-flag-epi { background: rgba(239,68,68,0.15);  color: var(--danger); }

/* Dashboard stat with icon — enhanced */
.stat-card { cursor: default; }
.stat-card:hover { background: var(--bg-elevated); }

/* ═══════════════════════════════════════════════════════════════
   TRENDS PAGE
═══════════════════════════════════════════════════════════════ */

.trends-section-header {
  font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px; margin: 28px 0 16px;
}
.trends-row-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0;
}
@media (max-width: 900px) { .trends-row-2 { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.chart-card-header {
  padding: 14px 18px 0; display: flex; align-items: baseline;
  justify-content: space-between; gap: 8px;
}
.chart-card-title { font-size: 0.875rem; font-weight: 600; }
.chart-card-sub   { font-size: 0.75rem; color: var(--text-muted); }
.chart-wrap       { padding: 12px 16px 16px; height: 220px; position: relative; }

/* Metric toggle buttons */
.metric-btn {
  padding: 5px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-muted);
  font-size: 0.78rem; cursor: pointer; font-family: inherit;
  transition: var(--transition);
}
.metric-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.metric-btn-active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); font-weight: 500; }

/* Heatmap table */
.heatmap-table { border-collapse: collapse; }
.heatmap-table td, .heatmap-table th { border: none; }

/* ═══════════════════════════════════════════════════════════════
   ADMIN — Enhanced
═══════════════════════════════════════════════════════════════ */

.admin-alert {
  display: flex; align-items: center; gap: 10px;
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius); padding: 12px 16px; margin-top: 16px;
  font-size: 0.85rem; color: var(--text-secondary);
}
.admin-alert i { width: 16px; height: 16px; color: var(--danger); flex-shrink: 0; }
.admin-alert span { flex: 1; }
.admin-alert-warning { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.25); }
.admin-alert-warning i { color: var(--warning); }

/* Row selected highlight */
tr.row-selected { background: rgba(14,165,233,0.06) !important; }

/* Scrollable chart card body */
.chart-card-scroll { padding: 12px 16px; max-height: 260px; overflow-y: auto; }

/* ═══════════════════════════════════════════════════════════════
   UPGRADE / PRICING PAGE
═══════════════════════════════════════════════════════════════ */

.billing-toggle {
  display: inline-flex; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 9999px; padding: 4px; gap: 2px; margin-top: 16px;
}
.billing-opt {
  padding: 6px 18px; border-radius: 9999px; font-size: 0.82rem; cursor: pointer;
  transition: var(--transition); color: var(--text-muted);
}
.billing-opt-active { background: var(--accent); color: white; font-weight: 500; }
.billing-save {
  background: rgba(34,197,94,0.2); color: var(--success);
  border-radius: 9999px; padding: 1px 6px; font-size: 0.68rem; font-weight: 600;
  margin-left: 4px;
}

.upgrade-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; max-width: 720px; margin: 0 auto;
}

.upgrade-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; position: relative;
  transition: var(--transition);
}
.upgrade-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.upgrade-card-featured { border-color: var(--accent); background: linear-gradient(135deg, rgba(14,165,233,0.05) 0%, var(--bg-surface) 100%); }

.upgrade-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: white; border-radius: 9999px;
  padding: 3px 14px; font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}

.upgrade-card-header { margin-bottom: 20px; }
.upgrade-plan-name { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.upgrade-price { display: flex; align-items: baseline; gap: 4px; margin-bottom: 4px; }
.upgrade-price-val { font-size: 2.4rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.upgrade-price-per { font-size: 0.85rem; color: var(--text-muted); }
.upgrade-billed { font-size: 0.75rem; color: var(--text-muted); }

.upgrade-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.upgrade-feature { display: flex; gap: 8px; align-items: flex-start; font-size: 0.85rem; color: var(--text-secondary); }

.upgrade-card-footer { margin-top: auto; }

/* Current plan banner */
.current-plan-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 20px;
  max-width: 720px; margin: 0 auto; gap: 12px; flex-wrap: wrap;
}
.current-plan-info { display: flex; align-items: center; gap: 10px; }

/* FAQ */
.upgrade-faq { max-width: 640px; margin: 40px auto 0; }
.faq-item { border-bottom: 1px solid var(--border-subtle); padding: 14px 0; }
.faq-q { font-weight: 600; font-size: 0.875rem; margin-bottom: 6px; }
.faq-a { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }

/* ── Data restriction banner ──────────────────────────────────── */
.restriction-banner {
  display: flex; align-items: center; gap: 8px;
  background: rgba(245,158,11,0.12); border-bottom: 1px solid rgba(245,158,11,0.3);
  padding: 8px 24px; font-size: 0.82rem; color: var(--text-secondary);
}
.restriction-banner strong { color: var(--warning); }

/* ═══════════════════════════════════════════════════════════════
   STATIC CONTENT PAGES — About / Privacy / Security / Legal
═══════════════════════════════════════════════════════════════ */
.legal-page { min-height: 100vh; background: var(--bg-base); }
.legal-topbar {
  display: flex; align-items: center; padding: 20px 44px;
  border-bottom: 1px solid var(--border);
}
.legal-brand {
  display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px;
  color: var(--text-primary); text-decoration: none; letter-spacing: -0.01em;
}
.legal-brand img { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }
.legal-content {
  max-width: 760px; margin: 0 auto; padding: 48px 24px 80px;
  color: var(--text-secondary); font-size: 15px; line-height: 1.7;
}
.legal-content h1 {
  font-size: 28px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 8px; letter-spacing: -0.02em;
}
.legal-updated { font-size: 13px; color: var(--text-muted); margin-bottom: 32px; }
.legal-content h2 {
  font-size: 18px; font-weight: 600; color: var(--text-primary);
  margin-top: 32px; margin-bottom: 12px;
}
.legal-content p { margin-bottom: 14px; }
.legal-content ul { margin: 0 0 14px 22px; }
.legal-content li { margin-bottom: 6px; }
.legal-content strong { color: var(--text-primary); font-weight: 600; }
.legal-content a { color: var(--accent); text-decoration: none; }
.legal-content a:hover { text-decoration: underline; }
@media (max-width: 600px) {
  .legal-topbar { padding: 16px 20px; }
  .legal-content { padding: 32px 20px 60px; }
}

/* Features page — extends the static content page layout above */
.features-hero { text-align: center; padding: 12px 0 40px; }
.features-hero h1 {
  font-size: 34px; font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.02em; margin-bottom: 14px;
}
.features-hero-sub { font-size: 16px; max-width: 620px; margin: 0 auto; }
.features-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
  margin-bottom: 48px;
}
.feature-card {
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 22px;
}
.feature-icon {
  width: 36px; height: 36px; border-radius: 9px; background: rgba(14,165,233,0.12);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.feature-icon i { width: 18px; height: 18px; }
.feature-card h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.feature-card p { font-size: 14px; margin-bottom: 0; }
.features-cta {
  text-align: center; padding: 40px 24px; border-top: 1px solid var(--border-subtle);
}
.features-cta h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.features-cta p { margin-bottom: 20px; }
.features-cta-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px;
  border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none;
}
/* .legal-content a (element+class, 0,1,1) otherwise beats .features-cta-btn's
   .btn-primary color (0,1,0) and renders the label invisible (accent-on-accent).
   Match that specificity so the button's own white text wins. */
a.features-cta-btn, a.features-cta-btn:hover { color: #fff; text-decoration: none; }
.features-cta-btn i { width: 15px; height: 15px; }
@media (max-width: 600px) {
  .features-grid { grid-template-columns: 1fr; }
  .features-hero h1 { font-size: 26px; }
}
[x-cloak] { display: none !important; }
