        :root {
            /* Light Theme Variables */
            --costco-blue: #005DAA;
            --costco-red: #E31837;
            --bg-main: #f8fafc;
            --bg-sidebar: #ffffff;
            --bg-card: #ffffff;
            --bg-input: #ffffff;
            --text-main: #1e293b;
            --text-muted: #64748b;
            --border-color: #e2e8f0;
            --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            --tag-bg: #f1f5f9;
            --tag-highlight-bg: #ecfdf5;
            --tag-highlight-border: #a7f3d0;
            --price-color: #059669;
        }

        body.dark-mode {
            /* Dark Theme Variables */
            --bg-main: #0f172a;
            --bg-sidebar: #1e293b;
            --bg-card: #0f172a;
            --bg-input: #334155;
            --text-main: #f8fafc;
            --text-muted: #94a3b8;
            --border-color: #334155;
            --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
            --tag-bg: #1e293b;
            --tag-highlight-bg: #064e3b;
            --tag-highlight-border: #047857;
            --price-color: #34d399;
        }

        body, html {
            margin: 0; padding: 0;
            font-family: 'Inter', sans-serif;
            height: 100vh;
            display: flex;
            flex-direction: column;
            background-color: var(--bg-main);
            color: var(--text-main);
            transition: background-color 0.3s, color 0.3s;
        }

        /* --- HEADER --- */
        header {
            background-color: var(--costco-blue);
            background-image: linear-gradient(135deg, #005DAA 0%, #004785 100%);
            color: white;
            padding: 16px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 4px 12px rgba(0,0,0,0.2);
            z-index: 1000;
            border-bottom: 4px solid var(--costco-red);
        }
        .header-title h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
        .last-updated {
            display: inline-block; background: rgba(255,255,255,0.2);
            padding: 4px 12px; border-radius: 20px; font-size: 13px;
            margin-top: 6px; font-weight: 500;
        }

        .header-controls { display: flex; gap: 12px; align-items: center; }

        /* Search + Autocomplete */
        .search-wrapper { position: relative; width: 220px; }
        .search-box {
            padding: 10px 16px; border-radius: 24px; border: 1px solid transparent;
            outline: none; width: 100%; font-size: 14px; font-family: 'Inter', sans-serif;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); transition: all 0.2s;
            background: white; color: #1e293b; box-sizing: border-box;
        }
        .search-box:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3); }

        .autocomplete-dropdown {
            display: none;
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            right: 0;
            background: var(--bg-sidebar);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            box-shadow: var(--card-shadow);
            max-height: 340px;
            overflow-y: auto;
            z-index: 1500;
            text-align: left;
        }
        .autocomplete-dropdown.active { display: block; }
        .autocomplete-section-label {
            font-size: 11px; font-weight: 700; text-transform: uppercase;
            color: var(--text-muted); padding: 10px 14px 4px; letter-spacing: 0.5px;
        }
        .autocomplete-item {
            display: flex; align-items: center; gap: 10px; padding: 9px 14px;
            cursor: pointer; transition: background-color 0.15s;
        }
        .autocomplete-item:hover, .autocomplete-item.active { background: var(--tag-bg); }
        .ac-icon { font-size: 16px; flex-shrink: 0; }
        .ac-text { min-width: 0; flex: 1; }
        .ac-title {
            font-size: 13px; font-weight: 600; color: var(--text-main);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .ac-subtitle {
            font-size: 11px; color: var(--text-muted);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .autocomplete-empty, .autocomplete-loading {
            padding: 14px; text-align: center; font-size: 13px; color: var(--text-muted);
        }

        .btn-action {
            background-color: var(--costco-red); color: white; border: none;
            padding: 10px 16px; border-radius: 24px; cursor: pointer;
            font-weight: 600; font-size: 14px; transition: all 0.2s;
            box-shadow: 0 2px 4px rgba(227, 24, 55, 0.3);
            display: flex; align-items: center; gap: 6px; justify-content: center;
        }
        .btn-action:hover { background-color: #c4122d; transform: translateY(-1px); }

        .btn-icon {
            background: rgba(255,255,255,0.2); border: none; color: white;
            width: 40px; height: 40px; border-radius: 50%; font-size: 18px;
            cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center;
        }
        .btn-icon:hover { background: rgba(255,255,255,0.3); }

        /* Gas Preference Toggle */
        .gas-toggle {
            display: flex; background: rgba(255,255,255,0.2); border-radius: 24px;
            padding: 4px; gap: 4px;
        }
        .gas-toggle-btn {
            background: transparent; border: none; color: white; font-weight: 600;
            padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 13px;
            transition: 0.2s;
        }
        .gas-toggle-btn.active { background: white; color: var(--costco-blue); }

        /* --- MAIN LAYOUT --- */
        .app-container { display: flex; flex: 1; overflow: hidden; }

        /* --- SIDEBAR --- */
        .sidebar {
            width: 390px; background: var(--bg-sidebar); display: flex; flex-direction: column;
            border-right: 1px solid var(--border-color); z-index: 500;
            box-shadow: 2px 0 8px rgba(0,0,0,0.05); transition: background-color 0.3s;
        }
        .tabs { display: flex; border-bottom: 1px solid var(--border-color); background: var(--bg-main); transition: 0.3s;}
        .tab {
            flex: 1; text-align: center; padding: 14px 10px; cursor: pointer;
            font-weight: 600; color: var(--text-muted); transition: 0.2s;
            font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;
        }
        .tab.active { color: var(--costco-blue); background: var(--bg-sidebar); border-bottom: 3px solid var(--costco-blue); }
        .tab:hover:not(.active) { background: var(--bg-card); color: var(--text-main); }

        .sidebar-content { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg-main); transition: 0.3s;}
        .sidebar-content::-webkit-scrollbar { width: 8px; }
        .sidebar-content::-webkit-scrollbar-track { background: transparent; }
        .sidebar-content::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 10px; }

        /* Store Cards */
        .store-card {
            background: var(--bg-card); border: 1px solid var(--border-color);
            border-radius: 12px; padding: 16px; margin-bottom: 14px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.03); cursor: pointer;
            transition: all 0.2s; position: relative; overflow: hidden;
        }
        .store-card::before {
            content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
            background: transparent; transition: 0.2s;
        }
        .store-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow); border-color: #cbd5e1; }
        .store-card:hover::before { background: var(--costco-blue); }

        .store-card h3 { margin: 0 0 6px 0; font-size: 16px; color: var(--text-main); font-weight: 700; display: flex; justify-content: space-between; align-items: center;}
        .medal { font-size: 18px; }
        .distance-badge { background: var(--bg-main); color: var(--text-main); font-size: 11px; padding: 4px 8px; border-radius: 12px; font-weight: 700; letter-spacing: 0.5px; border: 1px solid var(--border-color);}

        .store-card .address { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.4; }
        .prices { display: flex; gap: 10px; margin-bottom: 10px;}
        .price-tag {
            flex: 1; background: var(--tag-bg); padding: 8px 12px; border-radius: 8px;
            font-size: 12px; font-weight: 600; color: var(--text-muted);
            display: flex; flex-direction: column; align-items: flex-start; transition: 0.3s;
        }
        .price-tag .val { font-size: 18px; color: var(--price-color); font-weight: 700; margin-top: 2px; }
        .price-tag.highlight { background: var(--tag-highlight-bg); border: 1px solid var(--tag-highlight-border); }

        /* State Dropdown */
        .state-selector-box {
            background: var(--bg-card); padding: 12px; border-radius: 12px;
            border: 1px solid var(--border-color); margin-bottom: 20px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.03);
        }
        .state-selector-box label {
            font-size: 12px; font-weight: 700; color: var(--text-muted);
            text-transform: uppercase; margin-bottom: 6px; display: block;
        }
        .state-selector-box select {
            width: 100%; padding: 8px 12px; border-radius: 8px; color: var(--text-main);
            border: 1px solid var(--border-color); font-family: 'Inter', sans-serif;
            font-size: 14px; outline: none; cursor: pointer; background: var(--bg-input);
        }

        .leaderboard-header {
            font-size: 13px; font-weight: 700; text-transform: uppercase;
            color: var(--text-muted); margin: 20px 0 12px 0; letter-spacing: 0.5px;
            display: flex; align-items: center; gap: 8px;
        }
        .leaderboard-header::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }

        /* --- MAP & POPUPS --- */
        #map { flex: 1; background-color: #e5e7eb; transition: 0.3s; }
        .leaflet-popup-content-wrapper, .leaflet-popup-tip {
            background-color: var(--bg-sidebar); color: var(--text-main);
            border-radius: 12px; box-shadow: var(--card-shadow); border: 1px solid var(--border-color);
        }
        .leaflet-popup-content { margin: 16px; width: 220px !important; }
        .popup-store-name { font-size: 16px; font-weight: 700; color: var(--costco-blue); margin-bottom: 4px; font-family: 'Inter', sans-serif;}
        .popup-address { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.4; font-family: 'Inter', sans-serif;}
        .popup-prices-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
        .popup-price-box { background: var(--tag-bg); padding: 6px; border-radius: 6px; text-align: center; }
        .popup-price-box span { display: block; font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase;}
        .popup-price-box strong { font-size: 15px; color: var(--price-color); font-family: 'Inter', sans-serif;}
        .popup-btn {
            display: block; text-align: center; background: var(--costco-blue); color: white !important;
            padding: 10px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 13px;
            transition: 0.2s; font-family: 'Inter', sans-serif; border:none; width: 100%; cursor: pointer;
            box-sizing: border-box;
        }
        .popup-btn:hover { background: #004785; }
        .popup-btn-outline { background: transparent; border: 2px solid var(--costco-blue); color: var(--costco-blue) !important; margin-top: 6px;}
        .popup-btn-outline:hover { background: var(--tag-bg); }
        .costco-custom-icon { background: none; border: none; }

        /* --- DYNAMIC MAP PRICE BADGES --- */
        .pin-price-badge {
            display: none; /* Hidden by default when zoomed out */
            position: absolute;
            top: 34px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-card);
            border: 2px solid;
            border-radius: 12px;
            padding: 2px 6px;
            font-size: 11px;
            font-weight: 800;
            box-shadow: 0 2px 6px rgba(0,0,0,0.3);
            white-space: nowrap;
            font-family: 'Inter', sans-serif;
            z-index: 500;
        }

        /* Class applied to the map via JS when Zoom >= 11 */
        .map-show-prices .pin-price-badge {
            display: block;
            animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
        }

        @keyframes popIn {
            0% { opacity: 0; transform: translateX(-50%) scale(0.5); }
            100% { opacity: 1; transform: translateX(-50%) scale(1); }
        }

        /* --- CHART MODAL OVERLAY --- */
        .modal-overlay {
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.6); z-index: 2000;
            display: none; align-items: center; justify-content: center;
            backdrop-filter: blur(4px);
        }
        .modal-overlay.active { display: flex; }
        .modal-content {
            background: var(--bg-card); padding: 24px; border-radius: 16px;
            width: 90%; max-width: 700px; position: relative;
            box-shadow: 0 10px 25px rgba(0,0,0,0.2); border: 1px solid var(--border-color);
        }
        .modal-close {
            position: absolute; top: 16px; right: 20px;
            cursor: pointer; font-size: 24px; border: none; background: none;
            color: var(--text-muted); transition: 0.2s;
        }
        .modal-close:hover { color: var(--costco-red); }
        .modal-title { font-size: 20px; font-weight: 700; color: var(--costco-blue); margin: 0 0 20px 0; }

        .chart-container { position: relative; height: 350px; width: 100%; }

        @media (max-width: 768px) {
            .app-container { flex-direction: column; }
            .sidebar { width: 100%; height: 45vh; order: 2; box-shadow: 0 -4px 12px rgba(0,0,0,0.1); }
            header { flex-wrap: wrap; gap: 12px; justify-content: center; }
            .search-wrapper { width: 100%; order: 3; }
        }
