:root {
    --bg: #f4f7fc;
    --ink: #0f172a;
    --muted: #475569;
    --card: rgba(255, 255, 255, 0.85);
    --card-hover: rgba(255, 255, 255, 0.95);
    --line: rgba(15, 23, 42, 0.08);
    --shadow: 0 20px 40px -12px rgba(15, 23, 42, 0.08);
    --solar: #ff9800;
    --ev: #00c3ff;
    --hp: #ff007a;
    --all: #6366f1;
    --glow-solar: rgba(255, 152, 0, 0.4);
    --glow-ev: rgba(0, 195, 255, 0.4);
    --glow-hp: rgba(255, 0, 122, 0.4);
    --glow-all: rgba(99, 102, 241, 0.4);
    --ej: #10b981;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    color: var(--ink);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.12), transparent 30%),
        radial-gradient(circle at 90% 10%, rgba(255, 152, 0, 0.12), transparent 25%),
        radial-gradient(circle at 80% 80%, rgba(0, 195, 255, 0.12), transparent 30%),
        radial-gradient(circle at 20% 90%, rgba(255, 0, 122, 0.08), transparent 25%);
    background-attachment: fixed;
    line-height: 1.6;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: var(--ev);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0284c7;
}

.page-shell {
    width: min(1440px, calc(100% - 0.75rem));
    margin: 0 auto;
    padding: 0.9rem 0 2.5rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatBubble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.hero,
.metric-card,
.card {
    animation: fadeInUp 0.6s ease-out forwards;
}

.metric-card:nth-child(1) {
    animation-delay: 0.1s;
}

.metric-card:nth-child(2) {
    animation-delay: 0.2s;
}

.metric-card:nth-child(3) {
    animation-delay: 0.3s;
}

.metric-card:nth-child(4) {
    animation-delay: 0.4s;
}

.card {
    animation-delay: 0.5s;
}



.hero,
.card,
.metric-card {
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 16px 48px -12px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 1);
    border-radius: 24px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.65));
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, background 0.4s ease;
}

.metric-card:hover,
.card:hover {
    transform: translateY(-8px);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.8));
    box-shadow: 0 24px 64px -12px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 1);
}

.hero {
    position: relative;
    display: block;
    padding: 3.5rem 3.6rem 3.6rem;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.5) 28%, transparent 48%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.85) 45%, rgba(243, 244, 246, 0.9) 100%);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow:
        0 32px 84px -28px rgba(15, 23, 42, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.hero::before {
    content: '';
    position: absolute;
    inset: auto -10% -18% auto;
    width: 58%;
    height: 82%;
    border-radius: 40px;
    background:
        radial-gradient(circle at 35% 35%, rgba(99, 102, 241, 0.13), transparent 42%),
        radial-gradient(circle at 70% 68%, rgba(14, 165, 233, 0.12), transparent 36%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.08));
    pointer-events: none;
    filter: blur(2px);
}

.hero::after {
    content: '';
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background:
        radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.03) 38%, transparent 65%);
    pointer-events: none;
}

.eyebrow,
.section-kicker {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--all);
}

.hero-copy {
    position: relative;
    z-index: 1;
    max-width: 54rem;
}

.hero h1,
.section-heading h2,
.controls-heading h2 {
    margin: 0;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.controls-heading h2 {
    font-size: 1.4rem;
}

.hero h1 {
    max-width: 13ch;
    font-size: clamp(2.8rem, 5.8vw, 5.15rem);
    background: linear-gradient(120deg, #0d1b2a 0%, #1e40af 35%, #7c3aed 70%, #06b6d4 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.hero-text {
    max-width: 54ch;
    margin: 1.35rem 0 1.8rem;
    color: #71829b;
    font-size: 1.18rem;
    font-weight: 500;
    line-height: 1.7;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.72rem 1.15rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #5f7390;
    font-size: 0.92rem;
    font-weight: 700;
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.hero-bubbles {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: min(40%, 500px);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 0.55rem 0.6rem;
    z-index: 1;
}

.hero-bubble {
    position: relative;
    width: 122px;
    height: 122px;
    padding: 0.85rem 0.8rem 0.8rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 18px 34px -20px rgba(15, 23, 42, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    overflow: hidden;
    animation: fadeInUp 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.275) both, floatBubble 5s ease-in-out infinite alternate;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.hero-bubble:hover {
    animation-play-state: paused;
    transform: translateY(-8px) scale(1.05) !important;
    box-shadow:
        0 24px 48px -15px rgba(15, 23, 42, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    z-index: 10;
}

.hero-bubble:nth-child(1) {
    animation-delay: 0.08s, 0.73s;
}

.hero-bubble:nth-child(2) {
    animation-delay: 0.14s, 0.79s;
}

.hero-bubble:nth-child(3) {
    animation-delay: 0.20s, 0.85s;
}

.hero-bubble:nth-child(4) {
    animation-delay: 0.26s, 0.91s;
}

.hero-bubble:nth-child(5) {
    animation-delay: 0.32s, 0.97s;
}

.hero-bubble:nth-child(6) {
    animation-delay: 0.38s, 1.03s;
}

.hero-bubble:nth-child(7) {
    animation-delay: 0.44s, 1.09s;
}

.hero-bubble:nth-child(8) {
    animation-delay: 0.50s, 1.15s;
}

.hero-bubble::before {
    content: '';
    position: absolute;
    inset: auto -10px -12px auto;
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12), transparent 70%);
    pointer-events: none;
}

.hero-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;
    height: 4px;
    border-radius: 999px;
    background: transparent;
}

.bubble-total {
    width: 158px;
    height: 158px;
    transform: translateY(6px);
}

.bubble-solar {
    width: 140px;
    height: 140px;
}

.bubble-ev {
    width: 114px;
    height: 114px;
    transform: translateY(8px);
}

.bubble-hp {
    width: 134px;
    height: 134px;
}

.bubble-accent {
    width: 112px;
    height: 112px;
}

.bubble-date {
    width: 152px;
    height: 152px;
}

.bubble-label {
    margin: 0 0 0.45rem;
    color: #7386a0;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    text-align: center;
}

.bubble-value {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.25rem, 2vw, 2.1rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
    text-align: center;
}

.bubble-solar .bubble-value {
    color: var(--solar);
    text-shadow: 0 8px 18px var(--glow-solar);
}

.bubble-ev .bubble-value {
    color: var(--ev);
    text-shadow: 0 8px 18px var(--glow-ev);
}

.bubble-hp .bubble-value {
    color: var(--hp);
    text-shadow: 0 8px 18px var(--glow-hp);
}

.bubble-accent .bubble-value {
    color: var(--all);
    text-shadow: 0 8px 18px var(--glow-all);
}

.bubble-ej .bubble-value {
    color: #10b981; /* Emerald green for EJ/Equity */
    text-shadow: 0 8px 18px rgba(16, 185, 129, 0.4);
}

.bubble-date .bubble-value {
    font-size: clamp(0.92rem, 1.2vw, 1.2rem);
    line-height: 1.12;
}



.status-banner {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    background: rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.2);
    color: #be185d;
    font-weight: 500;
}

.hidden {
    display: none;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.metric-card {
    padding: 1.85rem 1.75rem 1.7rem;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82));
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 18px 40px -24px rgba(15, 23, 42, 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--muted);
    opacity: 0.2;
}

.metric-card.metric-solar::before {
    background: var(--solar);
    opacity: 1;
}

.metric-card.metric-ev::before {
    background: var(--ev);
    opacity: 1;
}

.metric-card.metric-hp::before {
    background: var(--hp);
    opacity: 1;
}

.metric-card.metric-accent::before {
    background: var(--all);
    opacity: 0.9;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: -26px;
    right: -24px;
    width: 88px;
    height: 88px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.10), transparent 68%);
    pointer-events: none;
}

.metric-label {
    margin: 0 0 0.75rem;
    color: #72839b;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.metric-value {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
}

.metric-solar .metric-value {
    color: var(--solar);
    text-shadow: 0 2px 10px var(--glow-solar);
}

.metric-ev .metric-value {
    color: var(--ev);
    text-shadow: 0 2px 10px var(--glow-ev);
}

.metric-hp .metric-value {
    color: var(--hp);
    text-shadow: 0 2px 10px var(--glow-hp);
}

.metric-accent .metric-value {
    color: var(--all);
    text-shadow: 0 2px 10px var(--glow-all);
}

.metric-date {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    line-height: 1.2;
}

.secondary-metrics {
    margin-top: 1rem;
}

.card {
    margin-top: 1.5rem;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow:
        0 20px 45px -26px rgba(15, 23, 42, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.controls-card {
    padding: 1.35rem 1.5rem;
    background:
        linear-gradient(135deg, rgba(242, 245, 255, 0.96), rgba(234, 245, 255, 0.9));
}

.controls-card::before {
    background:
        radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(14, 165, 233, 0.12) 34%, rgba(245, 158, 11, 0.08) 58%, transparent 78%);
}

.table-card {
    background:
        linear-gradient(135deg, rgba(247, 243, 255, 0.96), rgba(239, 246, 255, 0.9));
}

.table-card::before {
    background:
        radial-gradient(circle, rgba(236, 72, 153, 0.14) 0%, rgba(99, 102, 241, 0.12) 34%, rgba(14, 165, 233, 0.08) 58%, transparent 78%);
}

.detail-card {
    background:
        linear-gradient(135deg, rgba(243, 247, 255, 0.96), rgba(244, 241, 255, 0.92));
}

.detail-card::before {
    background:
        radial-gradient(circle, rgba(99, 102, 241, 0.16) 0%, rgba(236, 72, 153, 0.08) 42%, transparent 76%);
}

.wide-card {
    background:
        linear-gradient(135deg, rgba(240, 244, 255, 0.96), rgba(236, 250, 255, 0.9));
}

.wide-card::before {
    background:
        radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(14, 165, 233, 0.12) 34%, rgba(245, 158, 11, 0.06) 60%, transparent 78%);
}

.card::before {
    content: '';
    position: absolute;
    inset: auto -8% -22% auto;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background:
        radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(14, 165, 233, 0.09) 38%, rgba(245, 158, 11, 0.08) 58%, transparent 76%);
    pointer-events: none;
    filter: blur(2px);
}

.card>* {
    position: relative;
    z-index: 1;
}

.controls-heading,
.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.action-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.controls-row-secondary {
    display: none !important;
}

/* --- Action Toolbar & Triggers --- */
.action-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.action-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--ink);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.action-trigger.download-trigger {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
    color: var(--all);
}

.action-trigger:active {
    transform: scale(0.9);
    background: var(--all);
    color: #fff;
    box-shadow: 0 8px 20px var(--glow-all);
    border-color: transparent;
}

.action-trigger svg {
    stroke-width: 2.2px;
}

/* Tooltip System */
.action-trigger[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.action-trigger[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.drawer-header, .drawer-hint, .drawer-section-title {
    display: none;
}

/* --- Drawers & Overlays --- */
.search-drawer-overlay,
.filter-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 5500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: flex-end;
}

.search-drawer-overlay.active,
.filter-drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.search-drawer,
.filter-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90%;
    height: 100%;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(243, 247, 255, 0.9));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 2.5rem 1.75rem;
    box-shadow: -15px 0 50px rgba(15, 23, 42, 0.2);
    transform: translateX(100%);
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 6000;
}

.search-drawer-overlay.active .search-drawer,
.filter-drawer-overlay.active .filter-drawer {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--ink);
}

.drawer-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.05);
    border: none;
    border-radius: 8px;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drawer-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.drawer-section:last-child {
    border-bottom: none;
}

.drawer-section-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin: 0;
}

.drawer-hint {
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

.drawer-actions {
    display: flex;
    gap: 1rem;
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(15, 23, 42, 0.05);
}

.drawer-actions .action-button {
    flex: 1;
    justify-content: center;
}

.controls-card .controls-heading {
    margin-bottom: 1rem;
}

.mobile-summary {
    display: none;
    margin: 0.5rem 0 0;
    padding: 0;
    font-size: 0.85rem;
    color: var(--all);
    font-weight: 500;
}

.desktop-summary {
    display: block;
    margin: 0.9rem 0 0;
    padding: 0;
    font-weight: 600;
    color: var(--all);
}

.heading-text {
    margin: 0;
    padding: 0;
}

.heading-search span {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.heading-search input {
    padding: 0.75rem 1rem;
}

.method-note,
.results-summary,
.table-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.table-heading-tools {
    display: flex;
    align-items: end;
    gap: 1rem;
}

.compact-select {
    min-width: 88px;
}

.compact-select span {
    font-size: 0.78rem;
}

.inline-select {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
}

.inline-select span {
    white-space: nowrap;
}

.inline-select select {
    min-width: 84px;
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-bottom: 0.5rem;
}

.controls-row .filter-group {
    flex: 1;
    min-width: 300px;
}

.controls-row .heading-search {
    flex: 0 1 400px;
    width: 100%;
}

.controls-row-secondary {
    margin-top: 0.75rem;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.mobile-category-select,
.mobile-filter-toggle {
    display: none;
}

.search-drawer-overlay,
.filter-drawer-overlay {
    /* Normal display on desktop */
}

.filter-chip {
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-chip:hover,
.filter-chip:focus-visible {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 1);
    color: var(--ink);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.filter-chip.active {
    border-color: transparent;
}

.filter-chip.active[data-category="All"] {
    background: var(--all);
    color: #fff;
    box-shadow: 0 4px 15px var(--glow-all);
}

.filter-chip.active[data-category="Solar"] {
    background: var(--solar);
    color: #fff;
    box-shadow: 0 4px 15px var(--glow-solar);
}

.filter-chip.active[data-category="EV Charger"] {
    background: var(--ev);
    color: #fff;
    box-shadow: 0 4px 15px var(--glow-ev);
}

.filter-chip.active[data-category="Heat Pump"] {
    background: var(--hp);
    color: #fff;
    box-shadow: 0 4px 15px var(--glow-hp);
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.9rem;
}

.search-field input,
.search-field select {
    width: 100%;
    padding: 0.75rem 1.15rem;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    color: var(--ink);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    -webkit-appearance: none;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.02);
}

.search-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 2.75rem;
    cursor: pointer;
}

.search-field input:hover,
.search-field select:hover {
    border-color: #cbd5e1;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.search-field input:focus,
.search-field select:focus {
    outline: none;
    border-color: var(--all);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12), 0 8px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.date-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.workflow-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.75rem;
    align-items: end;
}

.compact-field {
    min-width: 0;
}

.action-button {
    height: 46px;
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--all), #818cf8);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px var(--glow-all);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.action-button:hover,
.action-button:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px var(--glow-all);
}

.action-button.subtle {
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
    border-color: var(--line);
    box-shadow: none;
}

.action-button.compact {
    height: 36px;
    padding: 0 0.85rem;
    font-size: 0.82rem;
    border-radius: 10px;
}

.results-summary {
    margin-top: 0.9rem;
    font-weight: 600;
    color: var(--all);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1.5rem;
}

.insights-grid > article {
    grid-column: span 2;
}

.insights-grid > article.age-article,
.insights-grid > article.wide-article {
    grid-column: span 3;
}

/* Force both second-row charts to an identical height */
#ageBars,
#trendChart {
    height: 260px;
    min-height: 260px;
}

.bar-stack {
    display: grid;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.chart-empty-msg {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    font-style: italic;
    background: rgba(15, 23, 42, 0.02);
    border-radius: 12px;
    border: 1px dashed var(--line);
    width: 100%;
    align-self: center;
}

.bar-row {
    display: grid;
    gap: 0.6rem;
}

.bar-labels {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.bar-fill {
    height: 100%;
    width: var(--bar-percent, 0%);
    border-radius: 999px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1), height 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.solar {
    background: linear-gradient(90deg, #fcd34d, var(--solar));
    box-shadow: 0 0 10px var(--glow-solar);
}

.bar-fill.ev {
    background: linear-gradient(90deg, #7dd3fc, var(--ev));
    box-shadow: 0 0 10px var(--glow-ev);
}

.bar-fill.hp {
    background: linear-gradient(90deg, #f9a8d4, var(--hp));
    box-shadow: 0 0 10px var(--glow-hp);
}

.bar-fill.property-mix-fill {
    background: linear-gradient(90deg, #a78bfa, #7c3aed);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

.bar-fill.age-fill {
    background: linear-gradient(90deg, #22d3ee, #0891b2);
    box-shadow: 0 0 10px rgba(8, 145, 178, 0.3);
}


/* Vertical Bar Colors for Trend Charts */
.trend-bar.solar { background: linear-gradient(180deg, #fcd34d, var(--solar)); box-shadow: 0 4px 12px var(--glow-solar); }
.trend-bar.ev { background: linear-gradient(180deg, #7dd3fc, var(--ev)); box-shadow: 0 4px 12px var(--glow-ev); }
.trend-bar.hp { background: linear-gradient(180deg, #f9a8d4, var(--hp)); box-shadow: 0 4px 12px var(--glow-hp); }
.trend-bar.property-mix-fill { background: linear-gradient(180deg, #a78bfa, #7c3aed); box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3); }
.trend-bar.age-fill { background: linear-gradient(180deg, #22d3ee, #0891b2); box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3); }
.trend-bar.value-fill { background: linear-gradient(180deg, #34d399, #059669); box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3); }
.bar-fill.value-fill {
    background: linear-gradient(90deg, #34d399, #059669);
    box-shadow: 0 0 10px rgba(5, 150, 105, 0.3);
}

.trend-chart {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 0.6rem;
    align-items: end;
    min-height: 200px;
    padding-top: 0.5rem;
}

/* Constrain small-dataset charts so bars don't grow too wide */
.insights-grid .trend-chart {
    min-height: 180px;
}

/* When chart-empty-msg is the only child, switch to flex for centering */
.trend-chart:has(.chart-empty-msg) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.trend-item {
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.trend-item:hover {
    transform: scale(1.05);
}

.trend-item.is-active .trend-bar {
    background: linear-gradient(180deg, #f59e0b, #d97706);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.5), 0 8px 18px rgba(245, 158, 11, 0.2);
    filter: brightness(1.1);
    transform: scaleX(1.15);
}

.trend-item.is-active .trend-label {
    color: #b45309;
    font-weight: 900;
    text-decoration: underline;
}

.trend-item {
    display: grid;
    grid-template-rows: auto minmax(16px, 1fr) auto;
    gap: 0.45rem;
    align-items: end;
    height: 100%;
}

.trend-count {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.trend-bar {
    width: 100%;
    align-self: end;
    border-radius: 14px 14px 6px 6px;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.8), rgba(14, 165, 233, 0.9));
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.18);
    min-height: 2px;
}

.trend-label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    word-break: break-word;
    line-height: 1.25;
    hyphens: auto;
}

.meta-list {
    display: grid;
    gap: 1.25rem;
    margin: 1.5rem 0 0;
}

.meta-list div {
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--line);
}

.meta-list div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.meta-list dt {
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.meta-list dd {
    margin: 0;
    font-weight: 500;
    font-size: 1.05rem;
}

.map-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 999px;
    border: 1px solid var(--line);
}

.legend-dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
}

.legend-solar {
    background: var(--solar);
    box-shadow: 0 0 8px var(--glow-solar);
}

.legend-ev {
    background: var(--ev);
    box-shadow: 0 0 8px var(--glow-ev);
}

.legend-hp {
    background: var(--hp);
    box-shadow: 0 0 8px var(--glow-hp);
}

#permitMap {
    margin-top: 1.5rem;
    min-height: 750px;
    border-radius: 16px;
    border: 1px solid var(--line);
    z-index: 1;
    /* For leaflet stacking context */
}

/* Customizing Leaflet */
.leaflet-container {
    background: #e2e8f0 !important;
    font-family: 'Inter', sans-serif !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--card) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--ink) !important;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow) !important;
}

.leaflet-popup-content {
    margin: 1rem 1.25rem;
}

.leaflet-interactive:focus {
    outline: 2px solid #2b4d66;
    outline-offset: 2px;
}

.map-home-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 34px;
    padding: 0 0.8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    cursor: pointer;
}

.map-home-button:hover,
.map-home-button:focus-visible {
    background: #ffffff;
    border-color: rgba(59, 130, 246, 0.24);
    outline: none;
}

.popup-title {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.popup-copy {
    margin: 0.25rem 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.popup-badge {
    display: inline-flex;
    align-items: center;
    margin-top: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.popup-badge.solar {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.popup-badge.ev {
    background: rgba(14, 165, 233, 0.1);
    color: #0369a1;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.popup-badge.hp {
    background: rgba(236, 72, 153, 0.1);
    color: #be185d;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.table-wrap {
    margin-top: 1.5rem;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    position: sticky;
    top: 0;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(8px);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    z-index: 10;
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background: rgba(241, 245, 249, 0.6);
}

tbody tr.is-selected {
    background: rgba(99, 102, 241, 0.08);
}

tbody tr:last-child td {
    border-bottom: none;
}

td {
    font-size: 0.95rem;
}

.table-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-badge.solar {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.table-badge.ev {
    background: rgba(14, 165, 233, 0.1);
    color: #0369a1;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.table-badge.hp {
    background: rgba(236, 72, 153, 0.1);
    color: #be185d;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.status-text {
    color: var(--muted);
    white-space: nowrap;
    font-weight: 500;
    font-size: 0.9rem;
}

.ej-status-cell {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.ej-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.layer-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    color: var(--ink);
}

.toggle-item:hover {
    background-color: rgba(99, 102, 241, 0.08);
}

.toggle-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #6366f1;
}

.detail-card {
    margin-top: 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.detail-block {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.detail-block-wide {
    grid-column: 1 / -1;
}

.detail-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-value {
    color: var(--ink);
    font-size: 1rem;
    font-weight: 600;
    word-break: break-word;
}



@media (max-width: 1280px) {
    /* removed insights-grid */
}

@media (max-width: 980px) {
    .hero,
    .controls-row {
        grid-template-columns: 1fr;
    }

    .insights-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .insights-grid > article {
        grid-column: span 1;
    }

    .insights-grid > article.age-article,
    .insights-grid > article.wide-article {
        grid-column: 1 / -1;
    }

    .hero {
        padding-bottom: 2rem;
    }

    .hero-bubbles {
        position: static;
        width: 100%;
        margin-top: 2.5rem;
        justify-content: center;
        gap: 0.75rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .controls-heading,
    .section-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .heading-search {
    display: none;
}
    .trend-chart {
        gap: 0.35rem;
    }
}

@media (max-width: 640px) {
    .insights-grid {
        grid-template-columns: 1fr;
    }

    .insights-grid > article,
    .insights-grid > article.age-article,
    .insights-grid > article.wide-article {
        grid-column: 1 / -1;
    }

    .page-shell {
        width: 100%;
        padding: 0;
    }

    .hero {
        border-radius: 0;
        padding: 3rem 1.5rem 4rem;
    }

    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.1;
    }

    .hero-bubbles {
        position: static;
        width: 100%;
        margin-top: 2.5rem;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }

    .hero-bubble {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        padding: 0.5rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .bubble-label {
        font-size: 0.55rem;
        margin-bottom: 0.25rem;
        text-align: center;
    }

    .bubble-value {
        font-size: 1.1rem;
        text-align: center;
    }

    .bar-stack {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        align-items: end;
        min-height: 260px;
        margin-top: 2rem;
    }

    .bar-row {
        display: flex;
        flex-direction: column-reverse;
        align-items: center;
        gap: 0.75rem;
        height: 100%;
    }

    .bar-labels {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }

    .bar-labels span:first-child {
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        text-align: center;
        white-space: nowrap;
    }

    .bar-labels span:last-child {
        font-size: 0.95rem;
        font-weight: 800;
        margin-bottom: 0.5rem;
    }

    .bar-track {
        width: 16px;
        height: 160px;
        position: relative;
        background: rgba(15, 23, 42, 0.04);
        border-radius: 99px;
    }

    .bar-fill {
        width: 100%;
        height: var(--bar-percent, 0%);
        position: absolute;
        bottom: 0;
        left: 0;
    }

    .hero-text {
        display: none;
    }

    /* Hide Description column in table for mobile */
    #permitTable th:nth-child(4),
    #permitTable td:nth-child(4) {
        display: none;
    }

    #permitMap {
        height: 450px;
        border-radius: 0;
    }

    .leaflet-control-layers-expanded {
        padding: 8px !important;
        font-size: 0.75rem !important;
    }

    .leaflet-bar a,
    .map-home-button,
    .map-reset-button {
        width: 40px !important;
        height: 40px !important;
        line-height: 40px !important;
    }

    .controls-heading {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }

    .controls-row-secondary {
        display: none !important;
    }

    .desktop-summary {
        display: none;
    }

    .mobile-summary {
        display: block;
    }

    .drawer-header, .drawer-hint, .drawer-section-title {
        display: flex;
    }

    .drawer-section-title {
        font-size: 0.75rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--muted);
        margin-bottom: 0.75rem;
    }

    .drawer-section {
        border-bottom: 1px solid rgba(15, 23, 42, 0.05);
        padding-bottom: 1.5rem;
    }

    .drawer-section:last-of-type {
        border-bottom: none;
        padding-bottom: 0;
    }

    .drawer-actions {
        display: grid;
        grid-template-columns: 1fr 1.5fr;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .search-drawer-overlay,
    .filter-drawer-overlay {
        display: flex;
    }

    .search-drawer,
    .filter-drawer {
        position: fixed;
        top: 0;
        right: 0;
        width: 85%;
        max-width: 360px;
        height: 100%;
        background: linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(243, 247, 255, 0.9));
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        padding: 2.5rem 1.75rem;
        box-shadow: -15px 0 50px rgba(15, 23, 42, 0.2);
        transform: translateX(100%);
        transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        gap: 1.75rem;
        border-left: 1px solid rgba(255, 255, 255, 0.5);
        overflow: hidden;
        z-index: 6000;
    }

    .filter-drawer-overlay.active .filter-drawer {
        transform: translateX(0);
    }

    .filter-drawer-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 5500;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .filter-drawer-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .search-drawer::before {
        content: '';
        position: absolute;
        top: -10%;
        right: -10%;
        width: 200px;
        height: 200px;
        background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
        pointer-events: none;
    }

    .search-drawer-overlay.active .search-drawer {
        transform: translateX(0);
    }

    .drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
    }

    .drawer-header h3 {
        font-size: 1.35rem;
        font-weight: 800;
        letter-spacing: -0.03em;
        color: var(--ink);
        margin: 0;
    }

    .drawer-close {
        background: rgba(15, 23, 42, 0.05);
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.8rem;
        color: var(--muted);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .drawer-close:active {
        transform: scale(0.9);
        background: rgba(239, 68, 68, 0.1);
        color: #ef4444;
    }

    .drawer-hint {
        font-size: 0.88rem;
        color: var(--muted);
        line-height: 1.6;
        font-weight: 500;
    }

    .controls-row-secondary {
        display: flex;
        flex-direction: column;
    }

    .filter-chip {
        flex: 1;
        justify-content: center;
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    .date-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .workflow-tools {
        flex-direction: column;
    }

    .workflow-tools .action-button {
        width: 100%;
        justify-content: center;
    }

    .table-container {
        margin: 0 -1.5rem;
        width: calc(100% + 3rem);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    th,
    td {
        min-width: 140px;
        padding: 0.8rem 1rem;
    }
}

@media (max-width: 768px) {
    .search-drawer,
    .filter-drawer {
        width: 85%;
        padding: 2rem 1.25rem;
    }

    .drawer-header h3 {
        font-size: 1.15rem;
    }

    .drawer-actions {
        flex-direction: column;
    }
}

.site-footer {
    text-align: center;
    padding: 2rem 1rem 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.site-footer p {
    margin: 0 0 0.5rem;
}

.site-footer p:last-child {
    margin: 0;
}

.site-footer strong {
    color: var(--all);
    font-weight: 700;
}

/* Map Legend */
.map-legend {
    padding: 1rem 1.25rem;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(243, 247, 255, 0.9));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 160px;
    margin: 1.5rem !important;
    z-index: 1000;
}

.map-legend-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.legend-item:hover {
    background: rgba(0, 0, 0, 0.03);
    transform: translateX(4px);
}

.legend-item.is-inactive {
    opacity: 0.4;
    filter: grayscale(0.8);
}

.legend-item.is-inactive .legend-color {
    box-shadow: none;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 2px 5px rgba(0, 0, 0, 0.1);
}

.legend-color.solar { background-color: #f59e0b; }
.legend-color.ev { background-color: #0ea5e9; }
.legend-color.hp { background-color: #ec4899; }
.legend-color.ej-zone { 
    background-color: rgba(0, 255, 136, 0.4); 
    border: 2px solid #00ff88;
    border-radius: 4px;
    width: 14px;
    height: 14px;
}

.legend-color.boundary {
    background-color: rgba(99, 102, 241, 0.1);
    border: 2px dashed #6366f1;
    border-radius: 4px;
    width: 14px;
    height: 14px;
}

.legend-color.parcel {
    background-color: rgba(6, 182, 212, 0.1);
    border: 1.5px solid #06b6d4;
    border-radius: 2px;
    width: 14px;
    height: 14px;
}

.popup-ej-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 99px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.ej-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.15);
    white-space: nowrap;
}

.ej-badge svg {
    flex-shrink: 0;
}

/* Map Control Styling */
.leaflet-control-zoom {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: none !important;
}

.leaflet-control-layers-toggle {
    width: 44px !important;
    height: 44px !important;
    background-size: 24px !important;
}

.leaflet-control-layers {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--line) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.15) !important;
    padding: 6px !important;
}

.leaflet-control-layers-expanded {
    padding: 12px 14px !important;
    color: var(--ink) !important;
    font-family: 'Inter', sans-serif !important;
}

.leaflet-control-layers-base label {
    margin-bottom: 8px !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    padding: 6px 8px;
    border-radius: 8px;
}

.leaflet-control-layers-base label:last-child {
    margin-bottom: 0 !important;
}

.leaflet-control-layers-base label:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--all);
}

.leaflet-control-layers-base input[type="radio"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--all);
    width: 16px;
    height: 16px;
}

/* Unified Map Controls Styling */
.leaflet-left .leaflet-control {
    margin-left: 12px !important;
}

.leaflet-top .leaflet-control {
    margin-top: 12px !important;
}

.leaflet-bar,
.map-home-button,
.map-reset-button {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    margin-bottom: 8px !important;
}

.leaflet-bar a,
.map-home-button,
.map-reset-button {
    width: 42px !important;
    height: 42px !important;
    line-height: 42px !important;
    background: #ffffff !important;
    border: 1.5px solid var(--line) !important;
    border-radius: 14px !important;
    color: var(--all) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 1.35rem !important; 
    font-weight: 600 !important;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12) !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.leaflet-bar a:first-child,
.leaflet-bar a:last-child {
    border-radius: 14px !important;
}

.leaflet-bar a:hover,
.map-home-button:hover,
.map-reset-button:hover {
    background: var(--all) !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--glow-all) !important;
}

.leaflet-bar a:hover svg,
.map-home-button:hover svg,
.map-reset-button:hover svg {
    stroke: #fff !important;
}

.map-home-button svg,
.map-reset-button svg {
    width: 22px;
    height: 22px;
}
/* --- Map Legend & Spatial Controls --- */
.map-legend {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 1.25rem;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 0.82rem;
    color: var(--ink);
    min-width: 180px;
    margin: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.map-legend-title {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
    opacity: 0.8;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 0.25rem 0.4rem;
    border-radius: 8px;
}

.legend-item:hover {
    background: rgba(15, 23, 42, 0.04);
    transform: translateX(3px);
}

.legend-item.is-inactive {
    opacity: 0.4;
    filter: grayscale(0.6);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.legend-color.solar { background-color: var(--solar); box-shadow: 0 0 10px var(--glow-solar); }
.legend-color.ev { background-color: var(--ev); box-shadow: 0 0 10px var(--glow-ev); }
.legend-color.hp { background-color: var(--hp); box-shadow: 0 0 10px var(--glow-hp); }

.legend-color.boundary { 
    background-color: #6366f1; 
    border: 1px dashed rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.legend-color.ej-zone { 
    background-color: #10b981; 
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.legend-color.parcel { 
    background-color: #64748b; 
    opacity: 0.6;
    box-shadow: 0 0 8px rgba(100, 116, 139, 0.2);
}

