/* ZIG — Zoning Intelligence Guide | Megabot Industries Design System */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;300;400;500;600;700;800;900&family=IBM+Plex+Mono:wght@300;400;500;600&display=swap');

:root {
    --bg: #0a0b0f;
    --surface: #111218;
    --surface2: #16171f;
    --border: #1e1f2e;
    --border-hover: #2a2b3d;
    --text: #e2e2ea;
    --dim: #5a5b70;
    --dim2: #3d3e50;
    --emerald: #00e87b;
    --emerald-dim: #00c066;
    --emerald-glow: rgba(0, 232, 123, 0.15);
    --emerald-subtle: rgba(0, 232, 123, 0.06);
    --graphite: #2a2c38;
    --graphite-light: #3a3c4a;
    --red: #ff3b5c;

    /* Legacy variables used by JS inline styles */
    --sidebar-bg: var(--surface);
    --sidebar-w: 0px;
    --accent: var(--emerald);
    --green: var(--emerald);
    --amber: #f59e0b;
    --teal: var(--emerald);
    --text-secondary: var(--dim);
    --card-bg: var(--surface);
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --muted: var(--dim);
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface2: #f0f1f3;
    --border: #e2e3e8;
    --border-hover: #d0d1d8;
    --text: #1a1b2e;
    --dim: #6b6d80;
    --dim2: #9496a8;
    --emerald: #00b85e;
    --emerald-dim: #009e50;
    --emerald-glow: rgba(0, 184, 94, 0.12);
    --emerald-subtle: rgba(0, 184, 94, 0.06);
    --graphite: #d8dae0;
    --graphite-light: #c8cad2;
    --red: #e03050;
    --amber: #d97706;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Light: grid background */
[data-theme="light"] body::after {
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
}

/* Light: header glass */
[data-theme="light"] header {
    background: rgba(244, 245, 247, 0.85);
}

/* Light: bottom nav glass */
[data-theme="light"] .bottom-nav {
    background: rgba(244, 245, 247, 0.95);
}

/* Light: brand name — dark instead of white */
[data-theme="light"] .brand-name {
    color: #1a1b2e;
}

/* Light: all #fff text → dark */
[data-theme="light"] .page-header h1,
[data-theme="light"] .stat-value,
[data-theme="light"] .data-card-title,
[data-theme="light"] .advice-headline,
[data-theme="light"] .member-name,
[data-theme="light"] .modal-header h2,
[data-theme="light"] .pattern-header,
[data-theme="light"] .explainer-header h3,
[data-theme="light"] .devlog-title,
[data-theme="light"] .fleet-name {
    color: #1a1b2e;
}

/* Light: selection */
[data-theme="light"] ::selection {
    background: rgba(0, 184, 94, 0.25);
    color: #1a1b2e;
}

/* Light: cards — subtle shadow instead of glow */
[data-theme="light"] .stat-card:hover,
[data-theme="light"] .card:hover,
[data-theme="light"] .member-card:hover,
[data-theme="light"] .data-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Light: fleet panel images — no brightness filter */
[data-theme="light"] .fleet-visual img {
    filter: none;
}
[data-theme="light"] .fleet-unit:hover .fleet-visual img {
    filter: brightness(1.05);
}

/* Light: seam glow — subtler */
[data-theme="light"] .seam,
[data-theme="light"] .seam-dot,
[data-theme="light"] .status-core,
[data-theme="light"] .fleet-seam-core {
    box-shadow: none;
}
[data-theme="light"] .fleet-header .seam {
    box-shadow: none;
}
[data-theme="light"] .fleet-panel::before {
    box-shadow: none;
}
[data-theme="light"] .fleet-status .seam-dot {
    box-shadow: none;
}

/* Light: badges — stronger backgrounds for contrast */
[data-theme="light"] .devlog-badge.feature {
    background: rgba(0, 184, 94, 0.1);
    border-color: rgba(0, 184, 94, 0.2);
}
[data-theme="light"] .devlog-badge.fix {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.2);
}
[data-theme="light"] .devlog-badge.data {
    background: rgba(0, 180, 216, 0.1);
    border-color: rgba(0, 180, 216, 0.2);
}

/* Light: modal backdrop */
[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .explainer-overlay {
    background: rgba(0, 0, 0, 0.4);
}

/* Light: tables */
[data-theme="light"] .data-table th,
[data-theme="light"] .result-data th {
    background: var(--surface2);
}

/* Light: scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track { background: var(--surface2); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--graphite); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: var(--graphite-light); }

/* Light: nav hover */
[data-theme="light"] .header-nav .nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Light: body-tab active — emerald text, no override needed for underline style */

/* Light: bar-fill text — keep dark for readability on colored bars */
[data-theme="light"] .bar-fill {
    color: #fff;
}

/* Light: JS inline style overrides — dark bg → light surface */
[data-theme="light"] [style*="background: #111218"],
[data-theme="light"] [style*="background-color: #111218"],
[data-theme="light"] [style*="background: #0a0b0f"],
[data-theme="light"] [style*="background-color: #0a0b0f"] {
    background: var(--surface) !important;
}

[data-theme="light"] [style*="color: #e2e2ea"],
[data-theme="light"] [style*="color: #e0e0e8"] {
    color: var(--text) !important;
}

/* Light: transcript badge purple */
[data-theme="light"] [style*="color:#8b5cf6"] {
    color: #7c3aed !important;
}

/* Light: X logo in header */
[data-theme="light"] .x-mark svg path {
    stroke: #b0b2c0;
}

/* Light: filter-bar select arrow — darker for visibility */
[data-theme="light"] .filter-bar select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6d80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-weight: 300;
    line-height: 1.5;
    padding-bottom: 70px;
    position: relative;
    min-height: 100vh;
}

body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        linear-gradient(rgba(30, 31, 46, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 31, 46, 0.12) 1px, transparent 1px);
    background-size: 80px 80px;
    pointer-events: none;
    z-index: 0;
}

a { color: var(--emerald); text-decoration: none; }
a:hover { color: var(--emerald-dim); }

/* ===== ANIMATIONS ===== */
@keyframes core-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--emerald); }
    50% { opacity: 0.5; box-shadow: 0 0 16px var(--emerald), 0 0 30px var(--emerald-glow); }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== HEADER ===== */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 11, 15, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.brand img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.brand-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #fff;
}

.brand-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--dim);
    display: none;
}

/* City picker dropdown */
.city-picker {
    position: relative;
    margin-left: 4px;
}
.city-picker-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text);
    transition: border-color 0.2s, background 0.2s;
}
.city-picker-btn:hover {
    border-color: var(--border);
    background: rgba(255,255,255,0.04);
}
.city-picker-arrow {
    font-size: 10px;
    color: var(--dim);
    transition: transform 0.2s;
}
.city-picker-dropdown.open .city-picker-arrow,
.city-picker.open .city-picker-arrow {
    transform: rotate(180deg);
}
.city-picker-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 140px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 200;
    overflow: hidden;
}
.city-picker-dropdown.open {
    display: block;
}
.city-picker-item {
    display: block;
    padding: 10px 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--dim);
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
}
.city-picker-item:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}
.city-picker-item.active {
    color: var(--emerald);
}
[data-theme="light"] .city-picker-btn:hover {
    background: rgba(0,0,0,0.04);
}
[data-theme="light"] .city-picker-dropdown {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
[data-theme="light"] .city-picker-item:hover {
    background: rgba(0,0,0,0.04);
}

/* Sub-tab bar (dash, apps, city groups) */
.sub-tab-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 56px;
    z-index: 99;
}
.sub-tab-bar .container {
    display: flex;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.sub-tab {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--dim);
    text-decoration: none;
    padding: 10px 16px;
    white-space: nowrap;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    outline: none;
    box-shadow: none;
    border-radius: 0;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.sub-tab:hover {
    color: var(--text);
}
.sub-tab.active {
    color: var(--emerald);
    border-bottom-color: var(--emerald);
}

/* What's New banner */
.whats-new-banner {
    background: var(--surface);
    border: 1px solid var(--emerald-subtle);
    border-left: 3px solid var(--emerald);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.whats-new-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.whats-new-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--emerald);
}
.whats-new-dismiss {
    background: none;
    border: none;
    color: var(--dim);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}
.whats-new-dismiss:hover {
    color: var(--text);
}
.whats-new-entry {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.5;
}
.whats-new-entry strong {
    color: var(--text);
}
.whats-new-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--dim);
}
.whats-new-entry ul {
    margin: 4px 0 0 16px;
    padding: 0;
}
.whats-new-entry li {
    font-size: 12px;
    color: var(--dim);
    margin-bottom: 2px;
}

/* Desktop header nav */
.header-nav {
    display: none;
    align-items: center;
    gap: 4px;
}

.header-nav .nav-item {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--dim);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.header-nav .nav-item:hover {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}

.header-nav .nav-item.active {
    color: var(--emerald);
}

.nav-icon { display: none; }

.status-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.seam-pulse {
    display: inline-block;
    width: 2px;
    height: 16px;
    background: var(--emerald);
    border-radius: 1px;
    animation: core-pulse 3s ease-in-out infinite;
}

.status-indicator span:last-child {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--emerald);
}

/* ===== HEADER CONTROLS (version + theme toggle) ===== */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.version-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--emerald);
    background: var(--emerald-subtle);
    border: 1px solid rgba(0, 232, 123, 0.12);
    padding: 4px 10px;
    border-radius: 6px;
}

.theme-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--dim);
    transition: all 0.3s;
    padding: 0;
}

.theme-toggle:hover {
    border-color: var(--emerald);
    color: var(--emerald);
}

/* Show sun icon in dark mode, moon icon in light mode */
.theme-icon-light { display: none; }
.theme-icon-dark { display: block; }

[data-theme="light"] .theme-icon-light { display: block; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* Hide old sidebar structure — header-nav replaces it */
.sidebar {
    display: none !important;
}
.sidebar-brand,
.sidebar-nav,
.sidebar-footer {
    display: none !important;
}

/* ===== BOTTOM NAV (mobile) ===== */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(10, 11, 15, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100;
    height: 60px;
    border-top: 1px solid var(--border);
}

.bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--dim);
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    gap: 4px;
    min-height: 44px;
    transition: color 0.2s;
    position: relative;
}

.bnav-item.active {
    color: var(--emerald);
}

.bnav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--emerald);
    border-radius: 0 0 2px 2px;
}

.bnav-icon { display: none; }
.bnav-label { font-weight: 500; }

/* ===== MAIN CONTENT ===== */
.main-content {
    padding: 20px 16px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ===== GIS FULL-BLEED ===== */
.main-content.gis-active {
    padding: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    overflow: hidden !important;
}

/* Hide mobile bottom nav when GIS active */
body.gis-active .bottom-nav {
    display: none !important;
}

/* ===== SEAM DIVIDER ===== */
.seam-divider {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 32px 0;
}

.seam-divider .line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.seam-divider .core {
    width: 2px;
    height: 16px;
    background: var(--emerald);
    border-radius: 1px;
    animation: core-pulse 3s ease-in-out infinite;
    margin: 0 16px;
}

/* ===== SECTION LABEL ===== */
.section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--dim);
    margin-bottom: 16px;
}

.section-label .seam {
    width: 2px;
    height: 12px;
    background: var(--emerald);
    border-radius: 1px;
    flex-shrink: 0;
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
    line-height: 1.2;
}

.page-header p {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--dim);
    margin-top: 6px;
}

/* ===== STAT CARDS ===== */
.stat-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0;
    background: var(--emerald);
    transition: height 0.3s;
    z-index: 1;
}

.stat-card:hover {
    border-color: var(--emerald-dim);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 232, 123, 0.08);
}

.stat-card:hover::before {
    height: 30px;
}

.stat-card.green,
.stat-card.red,
.stat-card.amber {
    border-left-color: transparent;
}

.stat-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--dim2);
    font-weight: 500;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    margin: 8px 0;
    line-height: 1.2;
    color: #fff;
    letter-spacing: -1px;
}

.stat-detail {
    font-size: 12px;
    color: var(--dim);
    font-weight: 300;
}

.stat-detail-muted {
    font-size: 11px;
    color: var(--dim2);
    margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
    transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0;
    background: var(--emerald);
    transition: height 0.3s;
    z-index: 2;
}

.card:hover {
    border-color: var(--border-hover);
}

.card:hover::before {
    height: 20px;
}

.card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 16px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-approved {
    background: rgba(0, 232, 123, 0.1);
    color: var(--emerald);
    border-color: rgba(0, 232, 123, 0.2);
}

.badge-denial {
    background: rgba(255, 59, 92, 0.1);
    color: var(--red);
    border-color: rgba(255, 59, 92, 0.2);
}

.badge-conditions {
    background: rgba(0, 232, 123, 0.08);
    color: var(--emerald-dim);
    border-color: rgba(0, 232, 123, 0.15);
}

.badge-deferral,
.badge-continuance {
    background: rgba(245, 158, 11, 0.1);
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.2);
}

.badge-withdrawal {
    background: rgba(90, 91, 112, 0.15);
    color: var(--dim);
    border-color: var(--border);
}

.badge-type {
    background: rgba(0, 232, 123, 0.06);
    color: var(--emerald);
    border-color: rgba(0, 232, 123, 0.12);
}

.badge-aye {
    background: rgba(0, 232, 123, 0.1);
    color: var(--emerald);
    border-color: rgba(0, 232, 123, 0.2);
}

.badge-nay {
    background: rgba(255, 59, 92, 0.1);
    color: var(--red);
    border-color: rgba(255, 59, 92, 0.2);
}

.badge-former {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--surface2);
    color: var(--dim);
    border: 1px solid var(--border);
    vertical-align: middle;
    margin-left: 4px;
}

/* ===== TABLES ===== */
.data-table {
    display: none;
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th {
    background: var(--surface2);
    padding: 10px 12px;
    text-align: left;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--dim2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-weight: 300;
    color: var(--text);
}

.data-table tr:hover { background: var(--surface2); }
.data-table tr { cursor: pointer; }

.sortable { cursor: pointer; user-select: none; transition: color 0.2s; }
.sortable:hover { color: var(--emerald); }
.sort-asc::after { content: " \25B2"; font-size: 10px; }
.sort-desc::after { content: " \25BC"; font-size: 10px; }

/* ===== DATA CARDS (mobile) ===== */
.data-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    border-left: 2px solid var(--emerald);
    transition: border-color 0.2s, transform 0.2s;
}

.data-card:hover {
    border-color: var(--emerald-dim);
    transform: translateY(-2px);
}

.data-card:active { background: var(--surface2); }

.data-card-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

.data-card-row {
    font-size: 13px;
    color: var(--dim);
    margin-top: 4px;
    font-weight: 300;
}

/* ===== BAR CHART ===== */
.bar-chart { margin: 8px 0; }

.bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.bar-label {
    width: 60px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    text-align: right;
    flex-shrink: 0;
    color: var(--dim);
}

.bar-track {
    flex: 1;
    height: 24px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--bg);
    transition: width 0.5s ease;
}

.bar-fill.green { background: var(--emerald); }
.bar-fill.amber { background: var(--amber); }
.bar-fill.red { background: var(--red); }
.bar-fill.teal { background: var(--emerald); }

/* ===== FINDINGS ===== */
.finding {
    padding: 12px 14px;
    background: var(--surface2);
    border-left: 2px solid var(--emerald);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 300;
    color: var(--text);
}

.finding.alert {
    background: rgba(255, 59, 92, 0.06);
    border-left-color: var(--red);
}

/* ===== ADVICE CARDS ===== */
.advice-card {
    padding: 14px 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 10px;
    border-left: 2px solid var(--emerald);
    background: var(--surface2);
}

.advice-green {
    border-left-color: var(--emerald);
    background: rgba(0, 232, 123, 0.04);
}

.advice-yellow {
    border-left-color: var(--amber);
    background: rgba(245, 158, 11, 0.04);
}

.advice-red {
    border-left-color: var(--red);
    background: rgba(255, 59, 92, 0.04);
}

.advice-headline {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
    color: #fff;
}

.advice-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    font-weight: 300;
}

/* ===== IQM2 LINKS ===== */
.iqm2-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.iqm2-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dim);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.iqm2-btn:hover {
    background: var(--graphite);
    border-color: var(--emerald-dim);
    color: var(--emerald);
}

.iqm2-icon {
    text-decoration: none;
    font-size: 14px;
    vertical-align: middle;
    margin-left: 4px;
}

.iqm2-icon:hover { opacity: 0.7; }

/* ===== ASK PAGE ===== */
.query-input-wrap {
    position: relative;
    margin-bottom: 16px;
}

.query-input {
    width: 100%;
    padding: 14px 100px 14px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 300;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.query-input:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 2px var(--emerald-subtle);
}

.query-input::placeholder { color: var(--dim2); }

.query-submit {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 20px;
    background: transparent;
    color: var(--emerald);
    border: 1px solid var(--emerald);
    border-radius: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    min-height: 44px;
    transition: background 0.2s, box-shadow 0.2s;
}

.query-submit:hover {
    background: var(--emerald-subtle);
    box-shadow: 0 0 12px var(--emerald-glow);
}
.query-submit:disabled { background: transparent; border-color: var(--dim2); cursor: wait; color: var(--dim); }

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.quick-btn {
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 300;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: border-color 0.2s, color 0.2s;
}

.quick-btn:hover {
    border-color: var(--emerald-dim);
    color: var(--emerald);
}

.quick-btn.transcript-btn {
    border-style: dashed;
    border-color: var(--border);
}

.quick-btn.transcript-btn:hover {
    border-color: var(--emerald-dim);
    color: var(--emerald);
}

.quick-separator {
    width: 100%;
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    color: var(--dim);
    margin: 10px 0 6px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.result-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.result-answer {
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    font-weight: 300;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.result-meta {
    padding: 10px 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--dim);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}

.result-sql {
    padding: 12px 16px;
    background: var(--bg);
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    overflow-x: auto;
    display: none;
    border-bottom: 1px solid var(--border);
}

.sql-toggle {
    cursor: pointer;
    color: var(--emerald);
    font-weight: 600;
}

.sql-toggle:hover { text-decoration: underline; }

.result-data { padding: 0; overflow-x: auto; }

.result-data table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--surface);
}

.result-data th {
    background: var(--surface2);
    padding: 8px 10px;
    text-align: left;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--dim2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.result-data td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text);
    font-weight: 300;
}

/* ===== LOADING ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--dim);
}

.spinner {
    display: inline-block;
    width: 28px; height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--emerald);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== FILTERS ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 300;
    background: var(--bg);
    min-height: 44px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.filter-bar select {
    min-width: 120px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a5b70' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.filter-bar input { flex: 1; min-width: 180px; }

.filter-bar select:focus,
.filter-bar input:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 2px var(--emerald-subtle);
}

.btn-reset {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 44px;
    color: var(--dim);
    transition: border-color 0.2s, color 0.2s;
}

.btn-reset:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

/* ===== BODY TOGGLE (CC / PZ tabs) ===== */
.body-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.body-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--dim);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.body-tab:hover {
    color: var(--text);
}

.body-tab.active {
    color: var(--emerald);
    border-bottom-color: var(--emerald);
}

/* ===== MEMBER CARDS ===== */
.member-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.member-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    transition: border-color 0.3s, transform 0.3s;
}

.member-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0;
    background: var(--emerald);
    transition: height 0.3s;
}

.member-card:hover {
    border-color: var(--border-hover);
}

.member-card:hover::before {
    height: 20px;
}

.member-card.outlier {
    border-color: rgba(255, 59, 92, 0.3);
}

.member-card.former {
    opacity: 0.55;
    border-left: 2px solid var(--dim2);
}

.member-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.member-tenure {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--dim);
    margin-top: 2px;
    letter-spacing: 0.5px;
}

.member-stats {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.member-stat {
    text-align: center;
}

.member-stat-val {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.member-stat-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    color: var(--dim2);
    letter-spacing: 2px;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-content {
    background: var(--surface);
    width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-bottom: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.modal-back {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    background: var(--surface2);
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--emerald);
    transition: background 0.15s, border-color 0.15s;
}

.modal-back:hover {
    background: var(--graphite);
    border-color: var(--border-hover);
}

.modal-close {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    background: var(--surface2);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dim);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.modal-close:hover {
    background: var(--graphite);
    color: var(--text);
    border-color: var(--border-hover);
}

.modal-body { padding: 16px; }

.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.detail-label {
    width: 120px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--dim);
    flex-shrink: 0;
    padding-top: 2px;
}

.detail-value {
    flex: 1;
    font-weight: 300;
    color: var(--text);
}

.vote-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.vote-chip {
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.vote-chip.aye {
    background: rgba(0, 232, 123, 0.1);
    color: var(--emerald);
    border-color: rgba(0, 232, 123, 0.2);
}

.vote-chip.nay {
    background: rgba(255, 59, 92, 0.1);
    color: var(--red);
    border-color: rgba(255, 59, 92, 0.2);
}

.vote-chip.absent {
    background: var(--surface2);
    color: var(--dim);
    border-color: var(--border);
}

/* ===== REASONING CARDS ===== */
.reasoning-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-left: 2px solid var(--emerald);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.reasoning-header {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--dim);
    margin-bottom: 6px;
}

.reasoning-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    font-weight: 300;
}

/* ===== ISSUE CHIPS ===== */
.issue-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.issue-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
    cursor: default;
    border: 1px solid transparent;
}

.issue-chip.infra {
    background: rgba(255, 59, 92, 0.08);
    color: var(--red);
    border-color: rgba(255, 59, 92, 0.15);
}

.issue-chip.financial {
    background: rgba(245, 158, 11, 0.08);
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.15);
}

.issue-chip.landuse {
    background: rgba(0, 232, 123, 0.06);
    color: var(--emerald);
    border-color: rgba(0, 232, 123, 0.12);
}

.issue-chip.process {
    background: rgba(90, 91, 112, 0.12);
    color: var(--dim);
    border-color: var(--border);
}

/* ===== SIGNALS BAR ===== */
.signals-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.signal-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.signal-pill.on {
    background: rgba(0, 232, 123, 0.08);
    color: var(--emerald);
    border-color: rgba(0, 232, 123, 0.15);
}

.signal-pill.off {
    background: var(--surface2);
    color: var(--dim2);
    border-color: var(--border);
}

.signal-pill.attorney-on {
    background: rgba(255, 193, 7, 0.1);
    color: var(--amber);
    border-color: rgba(255, 193, 7, 0.25);
}

/* ===== SOURCE BADGE ===== */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 3px 10px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dim);
    background: var(--surface2);
    border: 1px solid var(--border);
}

/* ===== TRANSCRIPT RELATED APPS ===== */
.related-apps {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 300;
}

.related-apps a {
    color: var(--emerald);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.related-apps a:hover { text-decoration: underline; }

/* ===== CITIZENPORTAL ENRICHMENT ===== */
.cp-topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 4px;
}

.cp-topic-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 232, 123, 0.06);
    color: var(--emerald);
    border: 1.5px solid rgba(0, 232, 123, 0.25);
}

.cp-analysis-section {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cp-analysis-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--emerald);
    background: var(--surface);
    user-select: none;
}

.cp-analysis-toggle:hover {
    background: var(--surface2);
}

.cp-toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.cp-analysis-section.open .cp-toggle-icon {
    transform: rotate(90deg);
}

.cp-analysis-body {
    display: none;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 300;
    line-height: 1.6;
    color: var(--dim);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.cp-analysis-section.open .cp-analysis-body {
    display: block;
}

.cp-summary-text {
    margin-bottom: 10px;
}

.cp-disc-list {
    margin: 0;
    padding-left: 18px;
}

.cp-disc-list li {
    margin-bottom: 6px;
}

.cp-speakers-section {
    margin-top: 14px;
    font-size: 12px;
    font-weight: 300;
}

.cp-speaker-group {
    margin-bottom: 4px;
    line-height: 1.6;
}

.cp-speaker-label {
    font-weight: 600;
    color: var(--dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cp-speaker {
    color: var(--text);
}

/* ===== PATTERN CARDS ===== */
.pattern-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
}

.pattern-header {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.pattern-detail {
    font-size: 12px;
    color: var(--dim);
    font-weight: 300;
}

.pattern-apps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.pattern-app-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--emerald);
    cursor: pointer;
    padding: 2px 6px;
    background: rgba(0, 232, 123, 0.06);
    border-radius: 4px;
    border: 1px solid rgba(0, 232, 123, 0.12);
    transition: background 0.15s;
}

.pattern-app-link:hover {
    background: rgba(0, 232, 123, 0.12);
}

/* ===== ROSTER ALERT BANNER ===== */
.roster-alert {
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-left: 2px solid var(--amber);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--amber);
    font-weight: 400;
}

/* ===== EXPANDABLE EXPLANATIONS ===== */
.card-explainer-toggle {
    margin-top: 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--emerald);
    cursor: pointer;
    user-select: none;
    letter-spacing: 0.5px;
}

.card-explainer-toggle:hover { text-decoration: underline; }

.card-explainer {
    margin-top: 8px;
    padding: 12px 14px;
    background: var(--surface2);
    border-left: 2px solid var(--emerald);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: var(--dim);
    white-space: pre-wrap;
}

/* ===== EXPLAINER MODAL ===== */
.explainer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 200ms ease;
}

.explainer-overlay.visible { opacity: 1; }

.explainer-box {
    background: var(--surface);
    width: 100%;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-bottom: none;
}

.explainer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.explainer-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: #fff;
}

.explainer-header .modal-close {
    background: var(--graphite);
    color: var(--dim);
    border-color: var(--border);
}

.explainer-header .modal-close:hover {
    background: var(--graphite-light);
    color: var(--text);
}

.explainer-body {
    padding: 20px 18px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
}

/* ===== FILTER CONTEXT BANNER ===== */
.filter-context-banner {
    padding: 8px 14px;
    margin-bottom: 16px;
    background: rgba(0, 232, 123, 0.04);
    border: 1px solid rgba(0, 232, 123, 0.12);
    border-radius: var(--radius);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--emerald);
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0.5px;
}

.filter-context-banner a {
    color: var(--emerald);
    font-weight: 600;
    text-decoration: none;
    margin-left: 16px;
}

.filter-context-banner a:hover { text-decoration: underline; }

/* ===== TWO COL GRID ===== */
.two-col { display: block; }

/* ===== JS INLINE STYLE OVERRIDES (dark theme compatibility) ===== */
/* Override hardcoded light backgrounds from JS-generated HTML */
.card-body div[style*="background:#f8f9fa"],
.card-body div[style*="background: #f8f9fa"] {
    background: var(--surface2) !important;
    color: var(--text) !important;
    border-radius: var(--radius);
}

.card-body div[style*="background:#fef3c7"] {
    background: rgba(245, 158, 11, 0.08) !important;
    border-color: rgba(245, 158, 11, 0.2) !important;
}

.card-body div[style*="color:#92400e"],
.card-body div[style*="color: #92400e"] {
    color: var(--amber) !important;
}

.card-body div[style*="color:#78350f"],
.card-body div[style*="color: #78350f"] {
    color: var(--amber) !important;
}

/* Override light description boxes in staff pages */
div[style*="background:#f8f9fa"],
div[style*="background: #f8f9fa"] {
    background: var(--surface2) !important;
    color: var(--text) !important;
}

/* Override hardcoded light blue info banners */
div[style*="background:#EBF8FF"],
div[style*="background: #EBF8FF"] {
    background: rgba(0, 232, 123, 0.04) !important;
    border-color: rgba(0, 232, 123, 0.12) !important;
    color: var(--emerald) !important;
}

/* Override light gray backgrounds used for reviews */
div[style*="background:#f3f4f6"],
div[style*="background: #f3f4f6"] {
    background: var(--surface2) !important;
}

/* Override status dot hardcoded Tailwind colors to match design system */
span[style*="color:#22c55e"] { color: var(--emerald) !important; }
span[style*="color:#ef4444"] { color: var(--red) !important; }
span[style*="color:#eab308"] { color: var(--amber) !important; }
span[style*="color:#9ca3af"] { color: var(--dim) !important; }

/* ===== TABLET (768px+) ===== */
@media (min-width: 768px) {
    .stat-cards { flex-direction: row; flex-wrap: wrap; }
    .stat-cards > .stat-card { flex: 1 1 30%; }
    .data-table { display: table; }
    .data-cards { display: none; }
    .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    .member-grid { flex-direction: row; flex-wrap: wrap; }
    .member-grid > .member-card { flex: 1 1 45%; }

    .modal-content {
        max-width: 700px;
        border-radius: 16px;
        margin: 40px auto;
        max-height: 80vh;
        border: 1px solid var(--border);
    }
    .modal-overlay { align-items: center; }

    .explainer-overlay { align-items: center; }
    .explainer-box {
        max-width: 600px;
        border-radius: 16px;
        margin: 40px auto;
        max-height: 80vh;
        border: 1px solid var(--border);
    }
    .explainer-header { border-radius: 16px 16px 0 0; }

    .brand-sub { display: inline; }
}

/* ===== DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
    body { padding-bottom: 0; }
    .bottom-nav { display: none; }
    .header-nav { display: flex; }
    .main-content { padding: 28px 32px; }
    .stat-cards > .stat-card { flex: 1 1 30%; }
    .member-grid > .member-card { flex: 1 1 30%; }
}

/* ===== FLEET STATUS PANEL ===== */
.fleet-panel {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 24px;
    position: relative;
}

.fleet-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0;
    background: var(--emerald);
    box-shadow: 0 0 10px var(--emerald);
    transition: height 0.4s ease;
}

.fleet-panel:hover::before { height: 30px; }

.fleet-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.fleet-header .seam {
    width: 2px;
    height: 12px;
    background: var(--emerald);
    box-shadow: 0 0 4px var(--emerald);
}

.fleet-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--dim2);
}

.fleet-grid {
    display: flex;
    align-items: center;
    gap: 0;
}

.fleet-unit {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
    border-radius: 6px;
}

.fleet-visual {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fleet-visual img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0.9);
    transition: all 0.3s;
}

.fleet-unit:hover .fleet-visual img {
    filter: brightness(1.1);
}

.fleet-designation {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    color: var(--emerald);
    letter-spacing: 2px;
    background: var(--emerald-subtle);
    border: 1px solid rgba(0, 232, 123, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 6px;
}

.fleet-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.fleet-desc {
    font-size: 12px;
    color: var(--dim);
    font-weight: 300;
    margin-bottom: 8px;
}

.fleet-status {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--emerald);
}

.fleet-status .seam-dot {
    width: 2px;
    height: 10px;
    background: var(--emerald);
    box-shadow: 0 0 6px var(--emerald);
    animation: core-pulse 3s ease-in-out infinite;
}

.fleet-seam {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 12px;
    height: 64px;
}

.fleet-seam-line {
    flex: 1;
    width: 1px;
    background: var(--border);
}

.fleet-seam-core {
    width: 2px;
    height: 16px;
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
    animation: core-pulse 3s ease-in-out infinite;
    margin: 4px 0;
}

/* Fleet offline state */
.fleet-status.offline {
    color: var(--red);
}

.fleet-status.offline .seam-dot {
    background: var(--red);
    box-shadow: 0 0 6px var(--red);
    animation: offline-pulse 1.5s ease-in-out infinite;
}

@keyframes offline-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--red); }
    50% { opacity: 0.3; box-shadow: 0 0 12px var(--red); }
}

@media (max-width: 640px) {
    .fleet-panel { display: none; }
    .version-badge { display: none; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--graphite);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--graphite-light);
}

/* ===== DEVLOG ===== */
.devlog-entry {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.devlog-entry:last-child { border-bottom: none; }

.devlog-entry-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.devlog-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--dim);
    letter-spacing: 0.5px;
}

.devlog-phase {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--emerald);
    letter-spacing: 0.5px;
}

.devlog-title {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    margin-bottom: 4px;
}

.devlog-items {
    margin: 4px 0 0 16px;
    padding: 0;
    font-size: 13px;
    color: var(--text);
    font-weight: 300;
    line-height: 1.6;
}

.devlog-items li { margin-bottom: 2px; }

/* ===== DEVELOPER GROUP BADGE ===== */
/* PT Phase badges */
.badge-pt-pp {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.25);
}
.badge-pt-sa {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}
.badge-pt-con {
    background: rgba(249, 115, 22, 0.12);
    color: #fb923c;
    border-color: rgba(249, 115, 22, 0.25);
}
.badge-pt-fp {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.25);
}
.badge-pt-ab {
    background: rgba(0, 232, 123, 0.12);
    color: var(--emerald);
    border-color: rgba(0, 232, 123, 0.25);
}
.badge-pt-cds {
    background: rgba(20, 184, 166, 0.12);
    color: #2dd4bf;
    border-color: rgba(20, 184, 166, 0.25);
}

.badge-dev-group {
    background: var(--emerald-glow);
    color: var(--emerald);
    border: 1px solid rgba(0, 232, 123, 0.3);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-dev-group:hover {
    background: rgba(0, 232, 123, 0.25);
    border-color: var(--emerald);
}

/* ===== ASK MODE TOGGLE ===== */
.ask-mode-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.ask-mode-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-body);
}
.ask-mode-btn.active {
    background: var(--emerald-glow);
    border-color: var(--emerald);
    color: var(--emerald);
}
.ask-mode-btn:hover:not(.active) {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* ===== RAG SOURCE TAGS ===== */
.rag-sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 2;
}
.rag-source-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    margin: 2px 2px;
    border: 1px solid var(--border);
    background: var(--card-bg);
}
.rag-source-tag.tier-cbh-domain {
    border-color: rgba(0, 232, 123, 0.4);
    color: var(--emerald);
}
.rag-source-tag.tier-municipal-code {
    border-color: rgba(99, 102, 241, 0.4);
    color: #818cf8;
}
.rag-source-tag.tier-textbook {
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}
.rag-source-tag.tier-zig-data {
    border-color: rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}
a.rag-source-tag {
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
a.rag-source-tag:hover {
    border-color: var(--emerald);
    background: var(--emerald-subtle);
}

/* ===== CODE LINKS IN RAG ANSWERS ===== */
.code-link {
    color: var(--emerald);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.code-link:hover {
    border-bottom-color: var(--emerald);
}
.code-link::after {
    content: '\2197';
    font-size: 0.75em;
    margin-left: 2px;
    opacity: 0.5;
}
[data-theme="light"] .code-link {
    color: #00855a;
}
[data-theme="light"] .code-link:hover {
    border-bottom-color: #00855a;
}

/* ===== RAG MODEL BADGE ===== */
.rag-model-badge {
    background: var(--emerald-glow);
    color: var(--emerald);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* ===== STRUCTURED TABLE (RAG) ===== */
.rag-table-wrap {
    margin: 0;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.rag-table-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.rag-table-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--emerald);
}
.rag-table-section {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--dim);
}
.rag-table-section a {
    color: var(--dim);
    border-bottom: 1px dashed var(--dim);
}
.rag-table-section a:hover {
    color: var(--emerald);
    border-bottom-color: var(--emerald);
}
.rag-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: 'IBM Plex Mono', monospace;
    background: var(--surface);
}
.rag-table th {
    text-align: left;
    padding: 6px 12px;
    color: var(--dim);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.rag-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.rag-table tr:last-child td {
    border-bottom: none;
}
.rag-table tr.zone-highlight td {
    background: var(--emerald-subtle);
    color: var(--emerald);
    font-weight: 500;
}
.rag-table-toggle {
    margin-top: 8px;
    font-size: 11px;
    color: var(--dim);
    cursor: pointer;
    display: inline-block;
}
.rag-table-toggle:hover {
    color: var(--emerald);
}

/* RAG table mobile responsiveness */
@media (max-width: 640px) {
    .rag-table-wrap {
        padding: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .rag-table {
        font-size: 12px;
        min-width: 320px;
    }
    .rag-table th {
        padding: 5px 8px;
        font-size: 10px;
        white-space: nowrap;
    }
    .rag-table td {
        padding: 5px 8px;
    }
    .rag-table-title {
        font-size: 12px;
    }
    .rag-table-toggle {
        padding: 6px 0;
        font-size: 12px;
    }
}

/* RAG permission badges */
.rag-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    min-width: 24px;
}
.rag-badge-p { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.rag-badge-c { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.rag-badge-a { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }

/* ===== DEVELOPER PAGES — MOBILE RESPONSIVE ===== */

/* Scrollable table wrapper: forces data-table visible on mobile with horizontal scroll */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}
.table-scroll .data-table {
    display: table;
    min-width: 480px;
}

/* Stat grid: stack on narrow screens */
@media (max-width: 640px) {
    .dev-stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .dev-stat-grid .stat-card {
        padding: 12px !important;
    }
    .dev-stat-grid .stat-value {
        font-size: 20px;
    }
    .dev-stat-grid .stat-label {
        font-size: 9px;
    }

    /* Commissioner voting cards: 2-col or stack */
    .dev-comm-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .dev-comm-grid .stat-card {
        padding: 10px !important;
    }

    /* Tables inside scroll wrappers */
    .table-scroll .data-table {
        font-size: 12px;
    }
    .table-scroll .data-table th {
        padding: 8px 8px;
        font-size: 8px;
        letter-spacing: 1px;
    }
    .table-scroll .data-table td {
        padding: 8px 8px;
        font-size: 12px;
    }

    /* City summary cards in cross-city view */
    .dev-city-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* Risk signals and issues: full width, tighter padding */
    .dev-risk .finding {
        padding: 8px 10px !important;
    }
    .dev-risk .finding div[style*="font-size:13px"] {
        font-size: 12px !important;
    }

    /* Issue chips: wrap and smaller */
    .dev-issues .issue-chip {
        font-size: 11px;
        padding: 2px 6px;
    }

    /* Phase badges in PT dashboard */
    .badge-pt-pp, .badge-pt-sa, .badge-pt-con,
    .badge-pt-fp, .badge-pt-ab, .badge-pt-cds {
        font-size: 10px;
    }

    /* PT filter bar */
    .dev-filter-bar select {
        width: 100%;
        font-size: 13px;
    }

    /* Page header adjustments */
    .dev-page-header h1 {
        font-size: 20px !important;
    }
    .dev-page-header p {
        font-size: 12px;
        line-height: 1.4;
    }
    .dev-page-header a {
        font-size: 12px !important;
    }
}

@media (max-width: 380px) {
    .dev-stat-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== SELECTION ===== */
::selection {
    background: rgba(0, 232, 123, 0.25);
    color: #fff;
}

/* ===== AUTHENTICATION ===== */
#authScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    width: 100%;
    max-width: 400px;
    padding: 24px;
}
.auth-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 32px 32px;
}
.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}
.auth-logo img {
    margin-bottom: 12px;
}
.auth-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 4px;
    color: var(--text);
}
.auth-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--dim);
    margin-top: 4px;
}
.auth-field {
    margin-bottom: 16px;
}
.auth-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--dim);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.auth-field input,
.auth-field select {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
.auth-field input:focus,
.auth-field select:focus {
    border-color: var(--emerald);
}
.auth-field input::placeholder {
    color: var(--dim2);
}
.auth-error {
    color: var(--red);
    font-size: 13px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(255, 59, 92, 0.08);
    border-radius: 6px;
}
.auth-btn {
    width: 100%;
    padding: 12px;
    background: var(--emerald);
    color: #0a0b0f;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: opacity 0.2s;
}
.auth-btn:hover {
    opacity: 0.9;
}
.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--dim);
}
.auth-switch a {
    color: var(--emerald);
    text-decoration: none;
    font-weight: 500;
}
.auth-switch a:hover {
    text-decoration: underline;
}
.auth-footer {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--dim2);
}

/* ===== USER MENU (Header) ===== */
.user-menu {
    position: relative;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--emerald);
    color: #0a0b0f;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
}
.user-avatar:hover {
    opacity: 0.85;
}
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 0;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.user-menu.open .user-dropdown {
    display: block;
}
.user-dropdown-name {
    padding: 4px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.user-dropdown-email {
    padding: 2px 16px 8px;
    font-size: 12px;
    color: var(--dim);
}
.user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.user-menu-admin,
.user-dropdown-logout {
    display: block;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}
.user-menu-admin:hover,
.user-dropdown-logout:hover {
    background: var(--surface2);
}
.user-dropdown-logout {
    color: var(--red);
}

/* Admin nav styling */
.nav-admin {
    color: var(--amber) !important;
}
.nav-admin.active {
    color: var(--amber) !important;
    border-bottom-color: var(--amber) !important;
}
.bnav-admin {
    color: var(--amber) !important;
}

/* ===== ADMIN PANEL ===== */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}
.admin-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--emerald);
}
.admin-stat-label {
    font-size: 12px;
    color: var(--dim);
    margin-top: 4px;
    letter-spacing: 0.5px;
}
.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
}
.btn-sm:hover {
    border-color: var(--emerald);
}
.btn-danger {
    color: var(--red);
    border-color: rgba(255, 59, 92, 0.3);
}
.btn-danger:hover {
    border-color: var(--red);
    background: rgba(255, 59, 92, 0.08);
}

/* Admin user table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.admin-table th {
    background: var(--surface2);
    padding: 10px 12px;
    text-align: left;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--dim2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-weight: 300;
    color: var(--text);
}
.admin-table tr:hover td {
    background: var(--surface2);
}
.admin-table tr:last-child td {
    border-bottom: none;
}

/* ===== PATTERNS PAGE — MOBILE RESPONSIVE ===== */
@media (max-width: 640px) {
    /* Ensure all pattern sections are visible and not clipped */
    #patDiv, #patClust, #patThemes, #patPlanners, #patAreas {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Divergence + denial cluster tables: horizontal scroll */
    #patDiv .data-table,
    #patPlanners .data-table {
        display: table;
        min-width: 600px;
    }
    #patDiv .data-table th,
    #patDiv .data-table td,
    #patPlanners .data-table th,
    #patPlanners .data-table td {
        white-space: nowrap;
    }

    /* Two-col → single col on mobile (already handled, reinforce) */
    .two-col {
        display: block !important;
    }
    .two-col > .card {
        margin-bottom: 16px;
    }

    /* Risk check form: stack vertically */
    #riskAppType { width: 100% !important; }
    #riskZone { width: 100% !important; }
    #riskAcreage { width: 100% !important; }
}

@media (max-width: 640px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .auth-card {
        padding: 32px 20px 24px;
    }
    .admin-table {
        font-size: 12px;
    }
    .admin-table th,
    .admin-table td {
        padding: 8px 8px;
    }
}
