/* ═══════════════════════════════════════════════════════════════
   NAPE Demo — Shared Design System
   Dark stone/amber theme, tablet-optimized
   ═══════════════════════════════════════════════════════════════ */

/* ─── TOKENS ─── */
:root {
    --stone-50: #faf9f7;
    --stone-100: #f5f3f0;
    --stone-200: #e8e5e0;
    --stone-300: #d6d2cc;
    --stone-400: #a8a29e;
    --stone-500: #78716c;
    --stone-600: #57534e;
    --stone-700: #44403c;
    --stone-800: #292524;
    --stone-900: #1c1917;

    --bg: #1a1816;
    --bg-alt: #141210;
    --surface: #2a2724;
    --surface-hover: #363330;
    --surface-tint: #333028;
    --surface-elevated: #3a3734;
    --text: #f5f3f0;
    --text-secondary: #c8c4be;
    --text-muted: #78716c;
    --border: #4a4644;
    --border-hover: #5a5654;
    --selected-bg: #4a3010;
    --selected-border: #f59e0b;
    --accent: #C74634;
    --accent-light: #e05545;
    --accent-glow: rgba(199,70,52,0.15);
    --amber: #f59e0b;
    --amber-glow: rgba(245,158,11,0.15);
    --green: #22c55e;
    --green-muted: #16a34a;
    --blue: #3b82f6;
    --purple: #a855f7;
    --cyan: #06b6d4;

    --font: "Inter", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
    --base-font-size: 14px;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.1);
    --shadow-glow: 0 0 30px var(--accent-glow);
}

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

html { font-size: var(--base-font-size); }

body {
    font-family: var(--font);
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }

/* ─── HEADER ─── */
.demo-header {
    height: 60px;
    background: linear-gradient(135deg, var(--surface) 0%, #302a24 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    z-index: 100;
    position: relative;
}

.demo-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.demo-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    box-shadow: 0 0 12px var(--accent-glow);
}

.demo-logo-text {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.3px;
}

.demo-logo-sub {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: -4px;
}

.demo-nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.demo-nav-link {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.demo-nav-link:hover {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}

.demo-nav-link.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    font-weight: 600;
}

.demo-nav-link i { font-size: 13px; }

.demo-brand {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    opacity: 0.5;
    text-decoration: none;
    transition: opacity 0.2s;
}
.demo-brand:hover { opacity: 1; color: var(--accent); }

/* ─── STATS RIBBON ─── */
.stats-ribbon {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 24px;
    height: 44px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    border-right: 1px solid var(--border);
    white-space: nowrap;
    cursor: default;
    transition: background 0.15s;
}
.stat-chip:last-child { border-right: none; }
.stat-chip:hover { background: rgba(255,255,255,0.03); }

.stat-chip .stat-val {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.stat-chip .stat-label { font-weight: 500; }
.stat-chip i { font-size: 13px; color: var(--accent); }

/* ─── KPI CARDS ─── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px 24px;
}

.kpi-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-tint) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--accent-glow);
    opacity: 0.3;
}

.kpi-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.kpi-icon {
    font-size: 20px;
    color: var(--accent);
    margin-bottom: 8px;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--text) 0%, var(--stone-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.kpi-delta {
    font-size: 10px;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.kpi-delta.up { background: rgba(34,197,94,0.15); color: var(--green); }
.kpi-delta.down { background: rgba(239,68,68,0.15); color: #ef4444; }

/* ─── CONTENT CARDS ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s;
}

.card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.card-header i { color: var(--accent); font-size: 14px; }

.card-body { padding: 16px 18px; }

/* ─── TABLE ─── */
.demo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.demo-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.demo-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-secondary);
    vertical-align: middle;
}

.demo-table tbody tr { transition: background 0.1s; cursor: pointer; }
.demo-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.demo-table .mono {
    font-family: var(--font-mono);
    font-size: 11px;
}

/* ─── PILLS / BADGES ─── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.pill.ogml { background: #7c2d12; color: #fdba74; }
.pill.deed { background: #164e63; color: #67e8f9; }
.pill.prob { background: #4a1d6e; color: #c4b5fd; }
.pill.dot { background: #1e3a2f; color: #6ee7b7; }
.pill.lien { background: #3f3f46; color: #a1a1aa; }
.pill.active { background: rgba(34,197,94,0.15); color: var(--green); }
.pill.pending { background: rgba(245,158,11,0.15); color: var(--amber); }
.pill.idle { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.green { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.status-dot.amber { background: var(--amber); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.status-dot.red { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.5); }

/* ─── BUTTONS ─── */
.btn {
    height: 36px;
    padding: 0 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-hover); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-light); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── SEARCH ─── */
.search-box {
    height: 38px;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
    border-color: var(--selected-border);
    box-shadow: 0 0 0 2px var(--amber-glow);
}
.search-box i { color: var(--text-muted); margin-right: 10px; font-size: 13px; }
.search-box input {
    flex: 1; border: none; background: none;
    font: inherit; color: var(--text); outline: none;
    font-size: 13px;
}
.search-box input::placeholder { color: var(--text-muted); }

/* ─── FILTER PILLS ─── */
.filter-bar {
    padding: 8px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.filter-label {
    font-size: 10px; text-transform: uppercase;
    color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px;
}
.filter-pills { display: flex; gap: 4px; }
.filter-pill {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.filter-pill:hover { background: rgba(255,255,255,0.1); color: var(--text-secondary); }
.filter-pill.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ─── EMPTY STATE ─── */
.empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 60px 20px; color: var(--text-muted); gap: 12px;
}
.empty-state i { font-size: 48px; opacity: 0.3; }
.empty-state .msg { font-size: 15px; font-weight: 500; }
.empty-state .hint { font-size: 12px; opacity: 0.6; }

/* ─── LAYOUT UTILITIES ─── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; min-width: 0; min-height: 0; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.w-full { width: 100%; }
.h-full { height: 100%; }

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── GRID LAYOUTS ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ─── MAP CONTAINER ─── */
.map-container {
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.map-container .leaflet-tile-pane { filter: brightness(0.7) saturate(0.8); }

/* ─── TABS ─── */
.tab-bar {
    display: flex;
    gap: 2px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius-md);
}

.tab {
    padding: 7px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.04); }
.tab.active { background: var(--accent); color: white; font-weight: 600; }

/* ─── ANIMATIONS ─── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px var(--accent-glow); }
    50% { box-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(199,70,52,0.08); }
}

.fade-in { animation: fadeIn 0.3s ease-out; }
.fade-in-up { animation: fadeInUp 0.5s ease-out; }
.slide-in-right { animation: slideInRight 0.4s ease-out; }

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.10s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.20s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.30s; }

/* ─── TOUCH OPTIMIZATIONS ─── */
@media (pointer: coarse) {
    .btn { min-height: 44px; min-width: 44px; }
    .demo-nav-link { min-height: 44px; padding: 8px 16px; }
    .filter-pill { min-height: 44px; padding: 10px 16px; }
    .tab { min-height: 44px; }
    .demo-table tbody td { padding: 14px 12px; }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow: auto;
        overflow-x: hidden;
    }

    .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }

    /* Header — compact */
    .demo-header {
        padding: 0 12px;
        height: 52px;
        gap: 8px;
    }
    .demo-logo-icon { width: 28px; height: 28px; font-size: 13px; }
    .demo-logo-text { font-size: 15px; }
    .demo-logo-sub { display: none; }
    .demo-brand { display: none; }

    /* Nav — icon-only on mobile */
    .demo-nav { gap: 2px; }
    .demo-nav-link {
        padding: 8px 10px;
        font-size: 0; /* hide text */
    }
    .demo-nav-link i {
        font-size: 16px;
    }

    /* Stats ribbon — horizontal scroll */
    .stats-ribbon {
        padding: 0 10px;
        height: auto;
        min-height: 40px;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .stats-ribbon::-webkit-scrollbar { display: none; }
    .stat-chip {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 0;
    }
    .stat-chip .stat-val { font-size: 12px; }
    .stat-chip .stat-label { font-size: 9px; }

    /* Filter bars */
    .filter-bar {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 6px;
    }
    .filter-pills {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
        flex-wrap: nowrap;
        max-width: 100%;
    }
    .filter-pills::-webkit-scrollbar { display: none; }
    .filter-pill { white-space: nowrap; font-size: 11px; padding: 6px 10px; }
    .search-box { max-width: 100% !important; min-width: 0; }

    .content-area { padding: 12px 10px; }

    /* Ticker — slimmer on mobile */
    .ticker-wrap { height: 34px; }
    .ticker-label { font-size: 9px; padding: 0 10px; letter-spacing: 0.5px; }
    .ticker-item { font-size: 11px; gap: 6px; }

    /* Chat panel — full width on mobile */
    .chat-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
    }
    .chat-fab {
        position: fixed;
        bottom: 44px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    .chat-suggest-btn { font-size: 11px; padding: 8px 12px; }

    /* Tables — horizontally scrollable */
    .demo-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .demo-table thead, .demo-table tbody, .demo-table tr { min-width: 500px; }
}

/* ─── LIVE TICKER ─── */
.ticker-wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(26, 24, 22, 0.9);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.ticker-label {
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 2;
    box-shadow: 4px 0 12px rgba(0,0,0,0.3);
}

.ticker {
    display: flex;
    gap: 40px;
    padding-left: 20px;
    animation: ticker 60s linear infinite;
    white-space: nowrap;
}

.ticker-item {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-item strong { color: var(--text); }
.ticker-item .tag {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}
.tag.lease { background: rgba(34,197,94,0.15); color: var(--green); }
.tag.permit { background: rgba(59,130,246,0.15); color: var(--blue); }
.tag.rig { background: rgba(245,158,11,0.15); color: var(--amber); }

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); } /* Ensure content is duplicated for seamless loop */
}

/* ─── LIGHT MODE OVERRIDES — Solarized Light ─── */
[data-theme="light"] {
    /* Solarized Light Backgrounds */
    --bg: #fdf6e3;         /* Solarized base3 */
    --bg-alt: #fefbf1;
    --surface: #eee8d5;    /* Solarized base2 */
    --surface-hover: #e6dfc8;
    --surface-tint: #f5eedb;
    --surface-elevated: #fdf6e3;

    /* Solarized Text */
    --text: #073642;       /* Solarized base02 */
    --text-secondary: #586e75; /* Solarized base01 */
    --text-muted: #93a1a1;  /* Solarized base1 */

    /* Solarized Borders */
    --border: #d3cbb8;
    --border-hover: #c4bba6;

    /* Solarized Accents */
    --accent: #cb4b16;     /* Solarized orange */
    --accent-light: #dc423f;
    --accent-glow: rgba(203, 75, 22, 0.12);

    /* Selections — solarized yellow tint */
    --selected-bg: #fdf4dc;
    --selected-border: #b58900; /* Solarized yellow */

    /* Extended Solarized palette */
    --amber: #b58900;      /* Solarized yellow */
    --amber-glow: rgba(181, 137, 0, 0.15);
    --green: #859900;      /* Solarized green */
    --green-muted: #6d8000;
    --blue: #268bd2;       /* Solarized blue */
    --purple: #6c71c4;     /* Solarized violet */
    --cyan: #2aa198;       /* Solarized cyan */

    --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.05), 0 4px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.04), 0 10px 15px rgba(0,0,0,0.06);
}

/* Light Mode Specific Tweaks */
[data-theme="light"] .demo-header {
    background: linear-gradient(135deg, #eee8d5 0%, #fdf6e3 100%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-bottom-color: #d3cbb8;
}

[data-theme="light"] .kpi-card,
[data-theme="light"] .card,
[data-theme="light"] .demo-card {
    background: #fdf6e3;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 6px rgba(0,0,0,0.02);
}

[data-theme="light"] .kpi-card:hover,
[data-theme="light"] .demo-card:hover {
    box-shadow: 0 10px 15px rgba(0,0,0,0.06);
}

[data-theme="light"] .kpi-value {
    background: linear-gradient(135deg, #073642 0%, #586e75 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .stats-ribbon {
    background: #eee8d5;
}

[data-theme="light"] .filter-bar {
    background: #eee8d5;
}

[data-theme="light"] .filter-pill {
    background: rgba(7, 54, 66, 0.06);
    color: var(--text-muted);
}
[data-theme="light"] .filter-pill:hover {
    background: rgba(7, 54, 66, 0.12);
    color: var(--text-secondary);
}
[data-theme="light"] .filter-pill.active {
    background: var(--accent);
    color: #fdf6e3;
}

[data-theme="light"] .pill.ogml { background: #fff0e0; color: #cb4b16; }
[data-theme="light"] .pill.deed { background: #e0f4f9; color: #2aa198; }
[data-theme="light"] .pill.prob { background: #ede8f9; color: #6c71c4; }
[data-theme="light"] .pill.dot { background: #edf5e0; color: #859900; }
[data-theme="light"] .pill.lien { background: #e8e5df; color: #657b83; }
[data-theme="light"] .pill.active { background: rgba(133,153,0,0.12); color: #859900; }
[data-theme="light"] .pill.pending { background: rgba(181,137,0,0.12); color: #b58900; }
[data-theme="light"] .pill.idle { background: rgba(7,54,66,0.06); color: var(--text-muted); }

[data-theme="light"] .ticker-wrap {
    background: rgba(253, 246, 227, 0.92);
    border-top: 1px solid var(--border);
    color: var(--text);
}

[data-theme="light"] .ticker-item strong { color: var(--text); }

/* Light mode map — use natural tiles, remove dark filter */
[data-theme="light"] .map-container .leaflet-tile-pane { filter: none; }
[data-theme="light"] .leaflet-tile-pane { filter: none; }

/* Light mode search box */
[data-theme="light"] .search-box { background: #fdf6e3; }
[data-theme="light"] .search-box:focus-within {
    border-color: #b58900;
    box-shadow: 0 0 0 2px rgba(181,137,0,0.15);
}

/* Light mode info cards */
[data-theme="light"] .info-card { background: #fdf6e3; }
[data-theme="light"] .info-row { border-bottom-color: rgba(7,54,66,0.06); }

/* Light mode right tab */
[data-theme="light"] .right-tab:hover { background: rgba(7,54,66,0.06); }
[data-theme="light"] .right-tab.active { background: var(--accent); color: #fdf6e3; }

/* Light mode record cards */
[data-theme="light"] .rec-card { background: #fdf6e3; }
[data-theme="light"] .rec-card:hover { border-color: #c4bba6; }
[data-theme="light"] .rec-card.selected { background: #fdf4dc; border-color: #b58900; }

/* Light mode grid footer */
[data-theme="light"] .grid-footer { background: #eee8d5; }

/* ─── ASK AI CHAT WIDGET ─── */
.chat-fab {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(245,158,11,0.4), 0 0 40px rgba(245,158,11,0.15);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: fabPulse 3s ease-in-out infinite;
}
.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(245,158,11,0.5), 0 0 60px rgba(245,158,11,0.2);
}
.chat-fab.open {
    animation: none;
    transform: rotate(45deg);
    background: var(--stone-600);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
@keyframes fabPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(245,158,11,0.4), 0 0 40px rgba(245,158,11,0.15); }
    50% { box-shadow: 0 4px 30px rgba(245,158,11,0.6), 0 0 60px rgba(245,158,11,0.25); }
}

.chat-panel {
    position: absolute;
    bottom: 90px;
    right: 24px;
    width: 380px;
    max-height: 480px;
    background: rgba(42, 39, 36, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    z-index: 49;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 1px rgba(255,255,255,0.1);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chat-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 10px;
}
.chat-header-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--amber) 0%, #d97706 100%);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: white;
}
.chat-header-text { font-size: 14px; font-weight: 700; }
.chat-header-sub { font-size: 10px; color: var(--text-muted); }
.chat-header .status-dot { margin-left: auto; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 200px;
    max-height: 300px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-msg {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    animation: chatFadeIn 0.3s ease-out;
}
.chat-msg.ai {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.06);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--text-secondary);
}
.chat-msg.user {
    background: linear-gradient(135deg, var(--accent) 0%, #b83d2d 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-msg .cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: var(--amber);
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 0.6s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-suggestions {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chat-suggest-btn {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}
.chat-suggest-btn:hover {
    background: rgba(245,158,11,0.15);
    border-color: rgba(245,158,11,0.3);
    color: var(--amber);
}

/* ─── PIPELINE ANIMATION ─── */
.pipe-connector {
    position: relative;
    width: 80px;
    height: 4px;
    background: var(--border);
    display: flex;
    align-items: center;
    overflow: visible;
}

.pipe-packet {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: -2px;
    left: -10px;
    animation: pipeFlow 2s linear infinite;
}
.pipe-packet.bronze { background: #cd7f32; box-shadow: 0 0 10px rgba(205,127,50,0.6); }
.pipe-packet.silver { background: #c0c0c0; box-shadow: 0 0 10px rgba(192,192,192,0.6); }

@keyframes pipeFlow {
    0% { left: -10px; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: calc(100% + 2px); opacity: 0; }
}

.live-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.2);
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--green);
    font-weight: 600;
}
.live-counter .pulse-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ─── NEW TICKER TAGS ─── */
.tag.completion { background: rgba(168,85,247,0.15); color: var(--purple); }
.tag.transfer { background: rgba(6,182,212,0.15); color: var(--cyan); }
.tag.filing { background: rgba(245,158,11,0.15); color: var(--amber); }
