:root {
            --bg: #f6f7f9;
            --surface: #ffffff;
            --surface-raised: #ffffff;
            --surface-muted: #f3f4f6;
            --surface-hover: #f9fafb;
            --page-surface-top: #f6f7f9;
            --page-surface-mid: #f6f7f9;
            --page-surface-bottom: #f3f4f6;
            --text: #1d1d1f;
            --muted: #6b7280;
            --border: #e5e7eb;
            --border-strong: #d1d5db;
            --accent: #0070f3;
            --accent-hover: #0060df;
            --accent-light: #f0f7ff;
            --accent-ring: rgba(0, 112, 243, 0.2);
            --ford-navy: #00095b;
            --header-bg: #ffffff;
            --header-fg: #1d1d1f;
            --header-muted: #6b7280;
            --header-border: #e5e7eb;
            --header-row-min-height: 52px;
            --header-center-min-height: 36px;
            --header-control-height: 38px;
            --header-ca-slot-width: 48px;
            --radius-sm: 6px;
            --radius-md: 8px;
            --radius-lg: 8px;
            --radius-xl: 8px;
            --shadow-xs: none;
            --shadow-sm: none;
            --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.04);
            --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
            --ease-snappy: cubic-bezier(0.22, 1, 0.36, 1);
            --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
            --duration-fast: 0.12s;
            --duration-normal: 0.18s;
            --panel-header-bg: #fafafa;
        }
        * { box-sizing: border-box; }
        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: Inter, system-ui, -apple-system, sans-serif;
            background: var(--page-surface-top);
            color: var(--text);
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }
        body { display: flex; }
        .page {
            min-height: 100vh;
            width: 100%;
            display: flex;
            flex-direction: column;
            background: var(--bg);
        }
        .header {
            padding: 0;
            display: flex;
            flex-direction: column;
            gap: 0;
            background: var(--header-bg);
            position: relative;
            z-index: 1100;
            border-bottom: 1px solid var(--header-border);
            box-shadow: none;
        }
        /* Use a 3-column grid so the search/toggle are truly centered on the viewport */
        .header-row {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            background: var(--header-bg);
            padding: 10px 20px;
            column-gap: 16px;
            min-height: var(--header-row-min-height);
            box-sizing: border-box;
        }
        .header-lead {
            display: flex;
            flex-direction: column;
            gap: 0;
            min-width: 0;
            justify-self: start;
            align-self: center;
            position: relative;
        }
        .header-brand-row {
            display: grid;
            grid-template-columns: var(--header-ca-slot-width) auto;
            align-items: center;
            column-gap: 6px;
            height: var(--header-control-height);
            min-height: var(--header-control-height);
        }
        .header-ca-button {
            display: inline-flex;
            grid-column: 1;
            justify-self: start;
            align-items: center;
            justify-content: center;
            gap: 4px;
            height: calc(var(--header-control-height) - 6px);
            padding: 0 8px 0 6px;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--surface);
            color: var(--header-muted);
            font: inherit;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            cursor: pointer;
            transition: color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy), border-color var(--duration-fast) var(--ease-snappy), opacity var(--duration-fast) var(--ease-snappy);
            line-height: 1;
            white-space: nowrap;
            align-self: center;
        }
        .header-ca-button:not(.is-visible) {
            visibility: hidden;
            pointer-events: none;
            opacity: 0;
        }
        .header-ca-button:hover,
        .header-ca-button:focus-visible {
            color: var(--text);
            background: var(--surface-hover);
            border-color: var(--border-strong);
        }
        .header-ca-button:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }
        .header-ca-button svg {
            width: 12px;
            height: 12px;
            stroke: currentColor;
            fill: none;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
            flex: 0 0 auto;
        }
        .header-lead.is-store-context { gap: 0; }
        .home-button {
            grid-column: 2;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            height: var(--header-control-height);
            font-size: 15px;
            font-weight: 600;
            color: var(--header-fg);
            text-decoration: none;
            cursor: pointer;
            transition: color var(--duration-fast) var(--ease-snappy);
            line-height: 1.2;
            user-select: none;
            letter-spacing: -0.02em;
            align-self: center;
        }
        .home-button:hover { color: var(--accent); }
        .home-button:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 3px;
            border-radius: var(--radius-sm);
        }
        .home-button .home-logo {
            height: 20px;
            width: auto;
            display: block;
            flex: 0 0 auto;
        }
        .home-button .home-text {
            display: inline-block;
            letter-spacing: -0.02em;
        }
        .home-counts {
            display: inline-flex;
            align-items: center;
        }
        .home-counts .filter-option-count {
            margin-left: 0;
            font-size: 12px;
            font-weight: 500;
            color: var(--header-muted);
        }
        .header-subtitle {
            position: absolute;
            left: 0;
            top: calc(100% + 6px);
            font-size: 12px;
            color: var(--muted);
            margin: 0;
            padding: 6px 10px;
            background: rgba(255,255,255,0.96);
            border: 1px solid var(--border);
            border-radius: 10px;
            box-shadow: 0 10px 26px rgba(0,0,0,0.10);
            opacity: 0;
            transform: translateY(-2px);
            pointer-events: none;
            transition: opacity 0.15s ease-out, transform 0.15s ease-out;
            white-space: nowrap;
            z-index: 20;
        }
        .home-button:hover + .header-subtitle,
        .home-button:focus-visible + .header-subtitle {
            opacity: 1;
            transform: translateY(0);
        }
        .header-center { display: flex; justify-content: center; justify-self: center; align-self: center; position: relative; z-index: 2; }
        .header-right { display: flex; align-items: center; gap: 16px; justify-self: end; justify-content: flex-end; align-self: center; }
        .stock-search-hint {
            width: 100%;
            max-width: 620px;
            text-align: center;
            font-size: 12px;
            color: var(--header-muted);
            margin: 0;
            min-height: 0;
        }
        .stock-search-hint:empty { display: none; }
        .stock-search {
            display: flex;
            align-items: stretch;
            flex: 1 1 auto;
            width: auto;
            min-width: 0;
            max-width: none;
            height: var(--header-control-height);
            min-height: var(--header-control-height);
            max-height: var(--header-control-height);
            position: relative;
            background: var(--surface-muted);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            box-shadow: none;
            overflow: visible;
            box-sizing: border-box;
            transition: border-color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy);
        }
        .stock-search:focus-within {
            border-color: var(--accent);
            background: var(--surface);
            box-shadow: 0 0 0 3px var(--accent-ring);
        }
        .stock-search input {
            flex: 1;
            width: 100%;
            min-width: 0;
            padding: 0 14px;
            border: none;
            border-radius: 6px 0 0 6px;
            font: inherit;
            font-size: 15px;
            background: transparent;
            color: var(--text);
        }
        .stock-search input::placeholder { color: #6b7280; }
        .stock-search input:focus { outline: none; box-shadow: none; }
        .stock-search-submit {
            flex: 0 0 auto;
            width: 44px;
            border: none;
            border-left: 1px solid var(--border);
            border-radius: 0 var(--radius-md) var(--radius-md) 0;
            background: var(--accent);
            color: #fff;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: background var(--duration-fast) var(--ease-snappy);
        }
        .stock-search-submit:hover { background: var(--accent-hover); }
        .stock-search-submit:active { transform: scale(0.97); }
        .stock-search-submit svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; }
        @media (min-width: 901px) {
            .stock-search-submit { border-radius: 0 6px 6px 0; }
        }
        @media (max-width: 900px) {
            .stock-search-submit { border-radius: 0; }
            .qr-scan-button { border-radius: 0 6px 6px 0; }
        }

        .qr-scan-button {
            flex: 0 0 auto;
            width: 44px;
            border: none;
            border-left: 1px solid #d5d9e0;
            border-radius: 0;
            background: #fff;
            color: var(--accent);
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
        }
        .qr-scan-button svg {
            width: 20px;
            height: 20px;
            stroke: currentColor;
            fill: none;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
        .qr-scan-button:hover { background: var(--accent-light); color: var(--accent-hover); }
        .qr-scan-button:active { transform: scale(0.98); }
        .stock-search-dropdown {
            position: absolute;
            top: calc(100% + 6px);
            left: 0;
            right: 0;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-lg);
            z-index: 1200;
            max-height: 320px;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 4px;
        }
        .stock-search-dropdown[hidden] { display: none; }
        .stock-search-result {
            width: 100%;
            display: grid;
            grid-template-columns: 52px minmax(0, 1fr);
            gap: 8px;
            align-items: center;
            border: 0;
            background: transparent;
            border-radius: 6px;
            padding: 5px 6px;
            text-align: left;
            cursor: pointer;
        }
        .stock-search-result:hover,
        .stock-search-result:focus-visible {
            background: var(--accent-light);
            outline: none;
        }
        .stock-search-result-photo {
            width: 52px;
            height: 38px;
            border-radius: 5px;
            object-fit: cover;
            border: 1px solid var(--border);
            background: #f3f4f6;
        }
        .stock-search-result-main {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 1px;
        }
        .stock-search-result-title {
            font-size: 13px;
            font-weight: 600;
            color: var(--text);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            line-height: 1.25;
        }
        .stock-search-result-meta {
            font-size: 11px;
            color: var(--muted);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            line-height: 1.25;
        }
        .stock-search-empty {
            font-size: 12px;
            color: var(--muted);
            padding: 6px 8px;
        }
        .stock-search-doc-actions {
            display: flex;
            gap: 6px;
            padding: 4px 4px 2px;
        }
        .stock-search-doc-btn {
            flex: 1;
            padding: 6px 8px;
            font-size: 12px;
            font-weight: 500;
            border-radius: 5px;
            border: 1px solid var(--border);
            background: var(--surface-muted);
            color: var(--text);
            cursor: pointer;
            transition: background 0.15s;
        }
        .stock-search-doc-btn:hover:not(:disabled) { background: #eef1f5; }
        .stock-search-doc-btn:disabled {
            opacity: 0.55;
            cursor: not-allowed;
        }
        .stock-search-section-label {
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.03em;
            color: var(--muted);
            text-transform: uppercase;
            padding: 6px 8px 2px;
        }
        .stock-search-result.stock-search-query-result {
            display: grid;
            grid-template-columns: 92px minmax(0, 1fr);
            gap: 10px;
            align-items: center;
            padding: 8px;
            overflow: visible;
            min-height: 0;
        }
        .stock-search-result.stock-search-query-result .stock-search-result-photo {
            width: 92px;
            height: 64px;
            display: block;
            border-radius: 6px;
            border: 1px solid var(--border);
            object-fit: cover;
            background: #eef1f5;
        }
        .stock-search-result.stock-search-query-result .stock-search-result-main {
            padding: 0;
            gap: 2px;
            align-self: center;
        }
        .stock-search-result.stock-search-query-result .stock-search-result-title {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            line-height: 1.35;
        }
        .stock-search-result.stock-search-recent-query {
            display: grid;
            grid-template-columns: 92px minmax(0, 1fr);
            gap: 10px;
            align-items: center;
            padding: 8px;
            overflow: visible;
        }
        .stock-search-result.stock-search-recent-query .stock-search-result-photo {
            width: 92px;
            height: 64px;
            display: block;
            border-radius: 6px;
            border: 1px solid var(--border);
            object-fit: cover;
            background: #eef1f5;
        }
        .stock-search-result.stock-search-recent-query .stock-search-result-main {
            padding: 0;
            gap: 2px;
            min-width: 0;
        }
        .stock-search-recent-query .stock-search-result-title {
            font-weight: 600;
            white-space: normal;
            overflow: visible;
            text-overflow: unset;
            line-height: 1.35;
            word-break: break-word;
        }
        .stock-search-result-meta .stock-search-dealer-label {
            color: var(--text);
            font-weight: 500;
        }
        .stock-search-result-meta .dot-sep {
            opacity: 0.75;
            margin: 0 4px;
        }
        .header-center-stack {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
            width: 100%;
            max-width: 680px;
            position: relative;
            z-index: 2;
        }
        .header-search-row {
            display: flex;
            align-items: center;
            gap: 10px;
            width: 100%;
        }
        @media (min-width: 901px) {
            .header-center-stack { min-height: var(--header-center-min-height); }
            .header-search-row { min-height: var(--header-control-height); }
        }
        .header-slot-hidden {
            visibility: hidden;
            pointer-events: none;
            opacity: 0;
        }
        @media (max-width: 900px) {
            .stock-search.header-slot-hidden,
            .stock-search-hint.header-slot-hidden {
                display: none !important;
            }
            /* Inventory pages hide search — drop the reserved header-center column entirely */
            .header-center:has(.stock-search.header-slot-hidden):has(.home-mode-toggle.header-slot-hidden) {
                display: none;
            }
            /* Header icon row duplicates mobile FABs on inventory list views */
            body:has(.main:not(.homepage-main)) .header .header-right {
                display: none !important;
            }
        }

        /* Fairfield New/Used flip toggle — segment inside the search bar */
        .home-mode-toggle {
            flex: 0 0 auto;
            align-self: stretch;
            appearance: none;
            border: none;
            margin: 0;
            padding: 0 12px;
            min-width: 54px;
            height: auto;
            border-radius: 0;
            border-left: 1px solid var(--border);
            background: var(--surface);
            color: var(--text);
            font: inherit;
            font-size: 13px;
            font-weight: 600;
            letter-spacing: normal;
            text-transform: none;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            white-space: nowrap;
            box-shadow: none;
            transition: background var(--duration-fast) var(--ease-snappy), color var(--duration-fast) var(--ease-snappy);
        }
        .home-mode-toggle[data-mode="new"] {
            background: var(--accent-light);
            color: var(--accent);
        }
        .home-mode-toggle[data-mode="used"] {
            background: #fff7ed;
            color: #c2410c;
        }
        .home-mode-toggle[data-mode="new"]:hover {
            background: #e8f0fe;
            color: var(--accent-hover);
        }
        .home-mode-toggle[data-mode="used"]:hover {
            background: #ffedd5;
            color: #9a3412;
        }
        .home-mode-toggle:active { transform: scale(0.98); }
        .home-mode-toggle:focus-visible {
            outline: none;
            box-shadow: inset 0 0 0 2px var(--accent-ring);
            z-index: 1;
        }
        .home-mode-toggle.header-slot-hidden {
            width: 0;
            min-width: 0;
            height: 0;
            min-height: 0;
            margin: 0;
            padding: 0;
            border: none;
            overflow: hidden;
            opacity: 0;
            pointer-events: none;
            box-shadow: none;
        }
        .home-mode-toggle-face {
            display: inline-flex;
            align-items: center;
        }
        .home-mode-label-used { display: none; }
        .home-mode-toggle[data-mode="used"] .home-mode-label-new { display: none; }
        .home-mode-toggle[data-mode="used"] .home-mode-label-used { display: inline; }
        .stock-search:has(.home-mode-toggle:not(.header-slot-hidden)) input {
            padding-right: 10px;
        }

        /* Avoid layout shifts while booting: keep header-right width reserved but invisible */
        .header-right.hidden { visibility: hidden; pointer-events: none; }
        .bookmarks-button {
            width: var(--header-control-height);
            height: var(--header-control-height);
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--header-muted);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: border-color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy), color var(--duration-fast) var(--ease-snappy);
            padding: 0;
            position: relative;
        }
        .header-icon-button {
            width: var(--header-control-height);
            height: var(--header-control-height);
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--header-muted);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: border-color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy), color var(--duration-fast) var(--ease-snappy);
            padding: 0;
        }
        .bookmarks-button.hidden { display: none; }
        .bookmarks-button svg {
            width: 22px;
            height: 22px;
            stroke-width: 1.6;
            stroke-linejoin: round;
            stroke-linecap: round;
        }
        .header-icon-button svg {
            width: 22px;
            height: 22px;
            stroke-width: 1.6;
            stroke-linejoin: round;
            stroke-linecap: round;
        }
        .db-button {
            width: auto;
            min-width: var(--header-control-height);
            min-height: var(--header-control-height);
            padding: 0 12px;
            font-size: 12px;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            text-decoration: none;
            color: var(--header-fg);
        }
        .bookmarks-button:hover,
        .header-icon-button:hover {
            border-color: var(--border-strong);
            background: var(--surface-hover);
            color: var(--text);
        }
        .bookmarks-button:active,
        .header-icon-button:active { background: var(--surface-muted); }
        .mobile-logout-button:hover { background: #dc2626; }
        .mobile-logout-button:active { transform: scale(0.99); }
        .mobile-logout-button.hidden { display: none !important; }
        .bookmarks-button.active,
        .bookmarks-button.has-count {
            border-color: var(--accent);
        }
        .bookmarks-button .bookmark-count {
            position: absolute;
            top: -4px;
            right: -4px;
            min-width: 18px;
            height: 18px;
            border-radius: 999px;
            background: #ef4444;
            color: #fff;
            font-size: 11px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 4px;
            box-shadow: 0 0 0 2px var(--surface);
        }
        .bookmarks-clear-button {
            margin-left: 12px;
            border: 1px solid var(--border);
            border-radius: 999px;
            background: white;
            padding: 8px 16px;
            font-size: 14px;
            color: var(--text);
            cursor: pointer;
            transition: border-color 0.2s, background 0.2s;
        }
        .bookmarks-clear-button:hover {
            border-color: var(--accent);
        }
        .bookmarks-clear-button.hidden {
            display: none;
        }

        .status-view-button {
            height: 34px;
            padding: 0 12px;
            border-radius: 999px;
            border: 1px solid rgba(0,0,0,0.12);
            font-weight: 700;
            font-size: 13px;
            letter-spacing: 0.1px;
            cursor: pointer;
            transition: all 0.15s ease;
            white-space: nowrap;
            background: white;
        }
        .status-view-button:active { transform: translateY(0.5px); }
        .status-view-button.active {
            border-color: var(--accent);
            background: var(--accent-light);
            color: var(--accent);
        }
        .view-toggle-button {
            border: 1px solid var(--border);
            border-radius: 999px;
            background: white;
            padding: 8px 14px;
            font-size: 14px;
            color: var(--text);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: border-color 0.2s, background 0.2s, transform 0.2s;
            user-select: none;
        }
        .view-toggle-button:hover {
            border-color: var(--accent);
            background: var(--surface-hover);
        }
        .view-toggle-button.active {
            border-color: var(--accent);
            background: var(--accent-light);
        }
        .view-toggle-button:active {
            transform: translateY(0);
        }
        #view-toggle-icon {
            width: 18px;
            height: 18px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            font-size: 12px;
            font-weight: 700;
            background: #f3f4f6;
            color: #374151;
            letter-spacing: 0.02em;
        }
        .view-toggle-button.active #view-toggle-icon {
            background: var(--accent-light);
            color: var(--accent);
        }
        .view-toggle-button.hidden {
            display: none;
        }
        .sort { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
        .sort-select { border: none; background: transparent; font: inherit; color: var(--text); padding: 4px 0; cursor: pointer; }
        .main { flex: 1; display: flex; padding: 20px 24px 40px; gap: 20px; align-items: flex-start; position: relative; z-index: 1; }
        .main.homepage-main { padding: 16px 20px 40px; justify-content: center; }
        .filters {
            width: 260px;
            flex-shrink: 0;
            padding: 16px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            align-self: flex-start;
            position: sticky;
            top: 16px;
            max-height: calc(100vh - 88px);
            overflow-y: auto;
        }
        .filters.hidden { display: none; }
        /* Sort control lives above the filter stack (sidebar) */
        #filters-sidebar #sort-container {
            width: 100%;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
            padding-bottom: 24px;
            border-bottom: 1px solid var(--border);
            gap: 12px;
        }
        #filters-sidebar #sort-container > span {
            font-size: 13px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--muted);
        }
        #filters-sidebar #sort-container .sort-select {
            margin-left: auto; /* push select to right edge */
            text-align: right;
        }
        /* Slightly tighter spacing to reduce sidebar scrolling */
        .filter-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
        .filter-section:last-child { border-bottom: none; }
        .filter-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
        .filter-clear { font-size: 11px; color: var(--accent); cursor: pointer; text-transform: none; letter-spacing: normal; font-weight: 500; }
        .filter-clear:hover { text-decoration: underline; }
        /* Hide per-filter clear links (use the single "Clear all" control instead). */
        #filters-sidebar .filter-clear { display: none !important; }
        .filter-option { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; cursor: pointer; }
        /* Custom checkbox visuals so we can show ✓ for include and ✕ for exclude */
        .filter-option input {
            -webkit-appearance: none;
            appearance: none;
            cursor: pointer;
            width: 16px;
            height: 16px;
            border: 2px solid #9ca3af;
            border-radius: 4px;
            background: #fff;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            position: relative;
            flex-shrink: 0;
        }
        .filter-option input:checked {
            border-color: var(--accent);
            background: var(--accent-light);
        }
        .filter-option input:checked::after {
            content: '✓';
            color: var(--accent);
            font-size: 12px;
            font-weight: 700;
            line-height: 1;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -56%);
        }
        .filter-option-label { flex: 1; }
        .filter-option-text { }
        .filter-option-excluded .filter-option-label { opacity: 0.6; }
        .filter-option-excluded .filter-option-text { text-decoration: line-through; }
        /* Show a red ✕ inside the checkbox when excluded (even though it's unchecked) */
        .filter-option-excluded input {
            border-color: #dc2626;
            background: #fee2e2;
        }
        .filter-option-excluded input::after {
            content: '✕';
            color: #dc2626;
            font-size: 12px;
            font-weight: 800;
            line-height: 1;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -55%);
        }
        .filter-option-count { font-size: 12px; color: var(--muted); margin-left: 6px; text-decoration: none; }
        .filter-option-desc { font-size: 11px; color: var(--muted); display: block; }
        /* Always show full option lists (no internal scrolling) */
        .filter-options-scroll { max-height: none; overflow: visible; }
        .price-range-inputs { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
        .range-filter { padding: 4px 0 10px; }
        .mileage-filter-select {
            width: 100%;
            font-size: 14px;
            padding: 8px 10px;
            border: 1px solid #d1d5db;
            border-radius: 6px;
            background: #fff;
            color: var(--text);
            cursor: pointer;
        }
        .year-range-dropdowns { padding: 4px 0 10px; }
        .year-filter-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            align-items: end;
        }
        .year-filter-field {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
        }
        .year-filter-label {
            font-size: 12px;
            font-weight: 600;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.02em;
        }
        .range-filter-label-muted {
            font-size: 13px;
            color: var(--muted);
            padding: 4px 0;
        }
        .range-control {
            --range-thumb: 16px;
            --range-track-h: 4px;
            --range-inset: calc(var(--range-thumb) / 2);
            padding: 2px 0 0;
        }
        .range-control-values {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            gap: 6px;
            margin-bottom: 10px;
        }
        .range-control-value {
            font-size: 13px;
            font-weight: 700;
            color: var(--text);
            font-variant-numeric: tabular-nums;
            line-height: 1.2;
        }
        .range-control-value-min { text-align: left; }
        .range-control-value-max { text-align: right; }
        .range-control-value-sep {
            font-size: 11px;
            font-weight: 500;
            color: var(--muted);
            text-transform: lowercase;
        }
        .range-control-track-area {
            position: relative;
            height: 36px;
            padding: 0 var(--range-inset);
        }
        .range-control-rail,
        .range-control-fill {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            height: var(--range-track-h);
            border-radius: 999px;
            pointer-events: none;
        }
        .range-control-rail {
            left: var(--range-inset);
            right: var(--range-inset);
            background: #d1d5db;
        }
        .range-control-fill {
            left: calc(var(--range-inset) + var(--range-lo, 0) * (100% - var(--range-thumb)) / 100);
            width: calc((var(--range-hi, 100) - var(--range-lo, 0)) * (100% - var(--range-thumb)) / 100);
            background: var(--accent);
        }
        .range-control-tick-marks {
            position: absolute;
            left: var(--range-inset);
            right: var(--range-inset);
            top: calc(50% + 5px);
            height: 5px;
            pointer-events: none;
        }
        .range-control-tick-mark {
            position: absolute;
            top: 0;
            width: 1px;
            height: 5px;
            background: #9ca3af;
            transform: translateX(-50%);
        }
        .range-control-tick-mark.is-labeled { height: 7px; background: #64748b; }
        .range-control-scale {
            position: relative;
            height: 14px;
            margin: 8px var(--range-inset) 0;
        }
        .range-control-scale-label {
            position: absolute;
            top: 0;
            transform: translateX(-50%);
            font-size: 10px;
            line-height: 1;
            color: #6b7280;
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }
        .range-control-scale-label.is-end-min {
            transform: translateX(0);
            font-weight: 600;
            color: var(--text);
        }
        .range-control-scale-label.is-end-max {
            transform: translateX(-100%);
            font-weight: 600;
            color: var(--text);
        }
        .range-control input[type="range"] {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 36px;
            margin: 0;
            background: none;
            pointer-events: none;
            -webkit-appearance: none;
            appearance: none;
        }
        .range-control input[type="range"]::-webkit-slider-runnable-track {
            height: var(--range-track-h);
            background: transparent;
            border: none;
        }
        .range-control input[type="range"]::-moz-range-track {
            height: var(--range-track-h);
            background: transparent;
            border: none;
        }
        .range-control input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            pointer-events: auto;
            width: var(--range-thumb);
            height: var(--range-thumb);
            margin-top: calc((var(--range-track-h) - var(--range-thumb)) / 2);
            border-radius: 50%;
            border: 2px solid var(--accent);
            background: #fff;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
            cursor: grab;
        }
        .range-control input[type="range"]::-moz-range-thumb {
            pointer-events: auto;
            width: var(--range-thumb);
            height: var(--range-thumb);
            border-radius: 50%;
            border: 2px solid var(--accent);
            background: #fff;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
            cursor: grab;
        }
        .range-control input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
        .range-control input[type="range"]:active::-moz-range-thumb { cursor: grabbing; }
        .range-control input[type="range"].dual-range-min { z-index: 3; }
        .range-control input[type="range"].dual-range-max { z-index: 4; }
        .price-input { width: 80px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; font: inherit; font-size: 12px; }
        .price-input:focus { outline: none; border-color: var(--accent); }
        .price-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
        .price-input { -moz-appearance: textfield; }
        .active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
        .active-filter-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--accent-light); border: 1px solid #bfdbfe; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; color: var(--accent); }
        .active-filter-tag button { background: none; border: none; padding: 0; cursor: pointer; color: inherit; font-size: 14px; line-height: 1; }
        .exclude-filter-tag { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
        .clear-all-filters { font-size: 12px; color: var(--accent); cursor: pointer; padding: 4px 10px; margin-left: auto; white-space: nowrap; }
        .clear-all-filters:hover { text-decoration: underline; }
        .inventory { flex: 1; min-width: 0; }
        .cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
        .main:not(.homepage-main) .inventory {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            padding: 16px;
            min-height: 200px;
        }
        .vehicle-detail.active .main.vehicle-detail-main .inventory {
            background: transparent;
            border: none;
            border-radius: 0;
            padding: 0;
            min-height: 0;
            box-shadow: none;
        }
        /* When showing bookmark comparison table, the grid layout constrains width; switch to full-width flow */
        .cards-grid.table-view { display: block; }
        /* Also ensure the table container spans the whole grid if grid layout is active for any reason */
        .cards-grid .comparison-table-container { grid-column: 1 / -1; }
        .card {
            background: var(--surface);
            border-radius: var(--radius-md);
            padding: 12px 12px 14px;
            box-shadow: none;
            border: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            gap: 8px;
            transition: border-color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy);
            position: relative;
            overflow: hidden;
        }
        .card.card-external-dealer { background: var(--accent-light); border-color: #bfdbfe; }
        .card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
        .card.card-external-dealer:hover { background: #e8f2ff; }
        .card-link {
            display: flex;
            flex-direction: column;
            gap: 8px;
            flex: 1;
            width: 100%;
            color: inherit;
            text-decoration: none;
            cursor: pointer;
        }
        .card-link[aria-hidden="true"] {
            cursor: default;
        }
        .card-link:hover {
            text-decoration: none;
        }
        .card-link:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 4px;
        }
        .card button:not(.bookmark-button),
        .card .tag-clickable,
        .card .stock-clickable {
            position: relative;
            z-index: 2;
        }
        .card-image-placeholder { background: #f2f2f2; border-radius: 10px 10px 0 0; margin: -12px -12px 8px -12px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #b0b3b8; font-size: 12px; height: 148px; position: relative; }
        .in-transit-badge { position: absolute; top: 12px; left: 12px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.05em; box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
        .card-image-placeholder img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: bottom center; transition: opacity 0.3s ease; position: absolute; top: 0; left: 0; }
        .card-image-placeholder img.interior { opacity: 0; }
        @media (hover: hover) and (pointer: fine) {
            .card-image-placeholder:hover img.exterior { opacity: 0; }
            .card-image-placeholder:hover img.interior { opacity: 1; }
        }
        .bookmark-button,
        .detail-bookmark-button {
            position: absolute;
            top: 10px;
            right: 10px;
            width: var(--header-control-height);
            height: var(--header-control-height);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--surface);
            color: var(--header-muted);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: border-color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy), color var(--duration-fast) var(--ease-snappy);
            z-index: 3;
            padding: 0;
            box-shadow: none;
        }
        .bookmark-button svg,
        .detail-bookmark-button svg {
            width: 18px;
            height: 18px;
            stroke-width: 1.6;
            stroke-linejoin: round;
            stroke-linecap: round;
            pointer-events: none;
        }
        .bookmark-button:hover,
        .detail-bookmark-button:hover {
            border-color: var(--border-strong);
            background: var(--surface-hover);
            color: var(--text);
        }
        .bookmark-button.bookmarked,
        .detail-bookmark-button.bookmarked {
            color: #e11d48;
            background: #fff1f2;
            border-color: #fecdd3;
        }
        .bookmark-button.bookmarked:hover,
        .detail-bookmark-button.bookmarked:hover {
            color: #be123c;
            background: #ffe4e6;
            border-color: #fda4af;
        }
        .card-title { font-size: 14px; font-weight: 500; margin-bottom: 2px; line-height: 1.3; }
        .card-subtitle { font-size: 11px; color: var(--muted); }
        .card-subtitle .card-dealer-label { color: var(--text); font-weight: 500; }
        .card-meta { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
        .card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
        .tag { font-size: 11px; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--surface-muted); border: 1px solid var(--border); color: var(--muted); transition: background var(--duration-fast) var(--ease-snappy), border-color var(--duration-fast) var(--ease-snappy), color var(--duration-fast) var(--ease-snappy); }
        /* Prevent unusually long chip text (e.g., interior materials) from blowing out card layout */
        .card-tags .tag { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
        .tag-equipment { background: var(--accent-light); border-color: #bfdbfe; color: var(--accent); }
        .tag-clickable { cursor: pointer; }
        .tag-clickable:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.08); transform: translateY(-1px); }
        .tag-filter-active { background: var(--accent-light); border-color: #bfdbfe; color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
        .card-footer { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: auto; }
        .price { font-size: 14px; font-weight: 500; }
        .card-footer-used .price,
        .card-odometer { font-size: 16px; font-weight: 700; }
        .loading, .no-results { text-align: center; padding: 48px; color: var(--muted); }
        .cards-grid > .loading,
        .cards-grid > .no-results { grid-column: 1 / -1; }
        /* Vehicle Detail View */
        .vehicle-detail { display: none !important; flex-direction: column; min-height: 100vh; }
        .vehicle-detail.active {
            display: flex !important;
            position: fixed;
            inset: 0;
            z-index: 1000;
            height: 100vh;
            overflow: hidden;
            background: var(--bg);
        }
        html.vehicle-detail-open,
        body.vehicle-detail-open { overflow: hidden; height: 100%; }
        body.vehicle-detail-open .page { overflow: hidden; height: 100%; }
        .vehicle-detail .vehicle-detail-main {
            flex: 1;
            min-height: 0;
            overflow: hidden;
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            gap: 0;
            padding: 20px;
            background: transparent;
        }
        .vehicle-detail .vehicle-detail-main .inventory,
        .vehicle-detail .vehicle-detail-inventory {
            background: transparent;
            border: none;
            padding: 0;
            min-height: 0;
            height: auto;
            display: block;
            box-shadow: none;
            overflow: visible;
            width: fit-content;
            max-width: calc(100vw - 48px);
            margin: 0;
        }
        .vehicle-detail .back-button {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            line-height: 1;
            color: var(--muted);
            cursor: pointer;
            padding: 0 12px 0 0;
            margin: 0;
            transition: color 0.2s;
            white-space: nowrap;
        }
        .vehicle-detail .back-button:hover { color: var(--accent); }
        .vehicle-detail .back-button svg { width: 16px; height: 16px; }
        .detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
        .vehicle-detail .detail-layout {
            width: 100%;
            display: flex;
            justify-content: center;
            padding: 0;
        }
        .vehicle-detail .detail-body {
            position: relative;
            display: grid;
            grid-template-columns: minmax(0, auto) 360px;
            grid-template-rows: auto auto;
            column-gap: 8px;
            row-gap: 12px;
            align-items: start;
            width: fit-content;
            max-width: calc(100vw - 48px);
        }
        .detail-media { position: sticky; top: 24px; min-width: 0; }
        .vehicle-detail .detail-hero {
            grid-column: 1;
            grid-row: 1;
            margin: 0;
            width: min(calc((100vh - 160px) * 4 / 3), calc(100vw - 48px - 360px - 8px));
            max-width: 100%;
            min-width: 0;
        }
        .vehicle-detail .detail-thumbnails {
            grid-column: 1;
            grid-row: 2;
            margin-top: 0;
            width: 100%;
            max-width: min(calc((100vh - 160px) * 4 / 3), calc(100vw - 48px - 360px - 8px));
        }
        .vehicle-detail .back-button {
            position: absolute;
            right: calc(100% + 12px);
            top: 0;
            left: auto;
            padding: 0;
        }
        .detail-media-stack {
            display: flex;
            flex-direction: column;
            min-height: 0;
            min-width: 0;
            width: 100%;
            max-width: 100%;
            margin: 0;
            padding: 0;
        }
        .detail-hero { background: var(--bg); border-radius: 12px; overflow: hidden; position: relative; box-shadow: 0 4px 20px rgba(0,0,0,0.06); aspect-ratio: 4/3; max-height: calc(100vh - 160px); }
        .detail-hero img { width: 100%; height: 100%; object-fit: contain; object-position: center; transition: opacity 0.2s; display: block; }
        .detail-hero-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 8px; border: none; background: rgba(255,255,255,0.5); color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.03); transition: all 0.2s; font-size: 20px; font-weight: 500; z-index: 2; touch-action: manipulation; user-select: none; }
        .detail-hero-nav:hover { background: rgba(255,255,255,0.7); color: var(--accent); transform: translateY(-50%) scale(1.02); box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
        .detail-hero-nav.prev { left: 16px; }
        .detail-hero-nav.next { right: 16px; }
        .detail-thumbnails { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 8px; width: 100%; min-width: 0; }
        .detail-media-stack .detail-hero { width: 100%; margin: 0; }
        .detail-thumbnails::-webkit-scrollbar { height: 4px; }
        .detail-thumbnails::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
        .detail-thumb { width: 60px; height: 45px; border-radius: 6px; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color 0.2s, opacity 0.2s; flex-shrink: 0; opacity: 0.6; }
        .detail-thumb:hover, .detail-thumb.active { opacity: 1; border-color: var(--accent); }
        .detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
        .detail-panel { padding: 0; }
        .vehicle-detail .detail-panel {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            padding: 16px;
            overflow-y: auto;
            overscroll-behavior: contain;
            height: calc(100vh - 40px);
            max-height: calc(100vh - 40px);
            grid-column: 2;
            grid-row: 1 / -1;
            align-self: start;
            margin: 0;
            width: 360px;
            min-width: 0;
            box-sizing: border-box;
        }
        .detail-title { font-size: clamp(20px, 2vw, 26px); font-weight: 600; margin-bottom: 4px; line-height: 1.2; }
        .detail-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
        .vin-container.vin-glow .vin-clickable,
        .vin-prefix:hover { background-color: #e3f2fd; border-radius: 2px; }
        .vin-last8:hover { background-color: #e3f2fd; border-radius: 2px; }
        .vin-clickable { cursor: pointer; user-select: none; transition: background-color 0.2s; }
        .stock-clickable { cursor: pointer; user-select: none; transition: background-color 0.2s; }
        .stock-clickable:hover { background-color: #e3f2fd; border-radius: 2px; }
        .detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
        .detail-tags .tag { font-size: 11px; padding: 4px 10px; }
        .detail-price-section { background: var(--surface); border-radius: var(--radius-md); padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); box-shadow: none; }
        .detail-price-breakdown { display: flex; flex-direction: column; gap: 8px; }
        .price-line { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
        .price-label { font-size: 14px; color: var(--text); }
        .price-value { font-size: 14px; font-weight: 500; }
        .discount-line .price-label,
        .discount-line .price-value { color: #22c55e; } /* green for discounts */
        .discount-green { color: #22c55e; } /* same green as discounts */
        .final-price .price-label,
        .final-price .price-value { font-weight: 600; font-size: 16px; }
        .detail-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 0px; }
        .detail-spec { background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; border: 1px solid var(--border); box-shadow: none; }
        .detail-spec-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
        .detail-spec-value { font-size: 12px; font-weight: 500; }
        .detail-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
        .detail-cta button { flex: 1; padding: 12px 16px; border-radius: 8px; border: none; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.2s, transform 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
        .detail-cta button:active { transform: scale(0.98); }
        .detail-cta button .carfax-logo { height: 20px; width: auto; min-width: 90px; max-width: 100%; vertical-align: middle; }
        .detail-cta .primary { background: var(--accent); color: #fff; }
        .detail-cta .primary:hover { background: var(--accent-hover); }
        .detail-cta .secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
        .detail-cta .secondary:hover { background: #f8f8f8; }
        .detail-cta.layout-used-ford #detail-contact,
        .detail-cta.layout-used-ford #detail-sticker,
        .detail-cta.layout-used-ford #detail-invoice {
            flex: 1 1 calc((100% - 20px) / 3);
        }
        .detail-cta.layout-used-ford #detail-carfax {
            flex: 1 1 100%;
        }
        .detail-cta.layout-used-nonford #detail-contact,
        .detail-cta.layout-used-nonford #detail-carfax {
            flex: 1 1 calc((100% - 10px) / 2);
        }
        .detail-cta.layout-used-nonford-no-carfax #detail-contact {
            flex: 1 1 100%;
        }
        .detail-equipment { background: var(--surface); border-radius: var(--radius-md); padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); box-shadow: none; }
        .detail-equipment-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
        .detail-equipment-title svg { width: 14px; height: 14px; transition: transform 0.2s; }
        .detail-equipment-title.collapsed svg { transform: rotate(-90deg); }
        .detail-equipment-list { display: flex; flex-direction: column; gap: 4px; }
        .detail-equipment-list.collapsed { display: none; }
        .detail-equipment-item {
            font-size: 12px;
            color: var(--muted);
            padding: 3px 0;
            border-bottom: 1px solid #f0f0f0;
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 10px;
        }
        .detail-equipment-item-desc { flex: 1; min-width: 0; }
        .detail-equipment-item-cost {
            flex: 0 0 auto;
            text-align: right;
            white-space: nowrap;
            color: #4b5563;
            font-variant-numeric: tabular-nums;
        }
        .detail-equipment-item:last-child { border-bottom: none; }
        .detail-location { background: var(--surface); border-radius: var(--radius-md); padding: 8px; margin-bottom: 16px; border: 1px solid var(--border); box-shadow: none; }
        .detail-location-map { width: 100%; height: 280px; border-radius: 6px; background: #f5f5f5; margin-bottom: 4px; }
        .detail-location-timestamp { font-size: 10px; color: var(--muted); text-align: center; margin-bottom: 4px; }
        .detail-towing { background: var(--surface); border-radius: var(--radius-md); padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); box-shadow: none; }
        .detail-towing-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
        .detail-towing-subtitle { font-size: 11px; color: var(--muted); margin-top: -6px; margin-bottom: 10px; }
        .detail-towing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
        .detail-towing-item { display: flex; flex-direction: column; gap: 2px; }
        .detail-towing-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
        .detail-towing-value { font-size: 12px; font-weight: 500; color: var(--text); }
        .detail-tow-badges { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
        .detail-tow-badge { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border-radius: 10px; border: 1px solid #c7ddff; background: var(--accent-light); }
        .detail-tow-badge .tow-mode { font-size: 12px; font-weight: 600; color: var(--text); }
        .detail-tow-badge .tow-value { font-size: 14px; font-weight: 700; color: var(--text); }
        .detail-tow-badge .tow-page { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 8px; }
        @media (max-width: 600px) { .detail-towing-grid { grid-template-columns: 1fr; } }
        .detail-price-history {
            margin-top: 16px;
            padding-top: 16px;
            border-top: 1px solid var(--border);
        }
        .detail-price-history-title {
            font-size: 13px;
            font-weight: 600;
            margin-bottom: 8px;
        }
        .detail-price-history-canvas-wrap {
            position: relative;
            width: 100%;
            height: 168px;
        }
        .detail-price-history canvas {
            width: 100%;
            height: 100%;
            display: block;
        }
        .detail-price-history-meta {
            font-size: 10px;
            color: var(--muted);
            margin-top: 6px;
            text-align: center;
        }
        /* Make Leaflet attribution smaller and less intrusive */
        .leaflet-control-attribution { font-size: 8px !important; background: rgba(255,255,255,0.7) !important; padding: 2px 4px !important; }
        @media (max-width: 1000px) {
            .vehicle-detail.active {
                display: block !important;
                position: fixed;
                inset: 0;
                height: 100vh;
                height: 100dvh;
                overflow-x: hidden;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }
            html.vehicle-detail-open,
            body.vehicle-detail-open { overflow: hidden; }
            .vehicle-detail .vehicle-detail-main {
                flex: none;
                overflow: visible;
                display: block;
                width: 100%;
                max-width: 100%;
                min-height: min-content;
                height: auto;
                padding: 12px 16px 24px;
                box-sizing: border-box;
            }
            .vehicle-detail .vehicle-detail-main .inventory,
            .vehicle-detail .vehicle-detail-inventory {
                width: 100%;
                max-width: 100%;
                height: auto;
                overflow: visible;
            }
            .detail-layout { grid-template-columns: 1fr; gap: 24px; }
            .vehicle-detail .detail-layout {
                display: block;
                width: 100%;
                max-width: 100%;
                height: auto;
                overflow: visible;
            }
            .vehicle-detail .detail-body {
                display: flex;
                flex-direction: column;
                gap: 12px;
                width: 100%;
                max-width: 100%;
                height: auto;
                overflow: visible;
            }
            .vehicle-detail .back-button {
                position: static;
                right: auto;
                padding: 0 0 4px;
                white-space: normal;
                align-self: flex-start;
            }
            .vehicle-detail .detail-hero {
                width: 100%;
                max-width: 100%;
            }
            .vehicle-detail .detail-thumbnails {
                width: 100%;
                max-width: 100%;
            }
            .vehicle-detail .detail-panel {
                width: 100%;
                max-width: 100%;
                height: auto;
                max-height: none;
                overflow: visible;
                min-height: 0;
                box-sizing: border-box;
            }
            .detail-specs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
        }
        @media (max-width: 600px) {
            .detail-hero { aspect-ratio: 4/3; max-height: 40vh; }
            .detail-specs { grid-template-columns: 1fr 1fr; }
            .detail-cta { flex-direction: column; }
        }
        /* Page transitions */
        .page-content { transition: opacity 0.15s ease-out; }
        .page-content.fade-out { opacity: 0; }
        .scroll-sentinel { height: 1px; grid-column: 1 / -1; }
        .load-more { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 32px; grid-column: 1 / -1; color: var(--muted); font-size: 14px; }
        .loading-spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
        @keyframes spin { to { transform: rotate(360deg); } }
        /* Homepage model cards */
        .homepage-main .inventory { max-width: 1280px; width: 100%; margin: 0 auto; }
        .homepage-main .cards-grid { display: block; }
        .homepage-main .loading { display: flex; align-items: center; justify-content: center; gap: 12px; }
        .homepage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
        .console-home { width: 100%; max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
        .console-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
        .console-page-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; color: var(--text); line-height: 1.2; }
        .console-page-subtitle { margin: 4px 0 0; font-size: 13px; color: var(--muted); font-weight: 400; }
        .console-panel {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }
        .console-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 12px 16px;
            background: var(--panel-header-bg);
            border-bottom: 1px solid var(--border);
            min-height: 44px;
        }
        .console-panel-title {
            margin: 0;
            font-size: 11px;
            font-weight: 600;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--muted);
        }
        .console-panel-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
        .dealer-home {
            width: 100%;
            display: grid;
            grid-template-columns: 1.2fr 0.8fr;
            gap: 16px;
            align-items: stretch;
        }
        .dealer-map-card, .dealer-list-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            box-shadow: none;
            overflow: hidden;
        }
        .dealer-map-card { padding: 0; min-height: 560px; display: flex; flex-direction: column; }
        .dealer-map-card .console-panel-header { flex-shrink: 0; }
        .dealer-map-card .california-map { flex: 1; min-height: 0; }
        .dealer-list-card {
            padding: 0;
            display: flex;
            flex-direction: column;
            gap: 0;
            background: var(--surface);
        }
        .dealer-list-card .console-panel-header { flex-shrink: 0; }
        .dealer-list-body { flex: 1; overflow-y: auto; }
        .california-map { width: 100%; height: 100%; min-height: 500px; background: var(--surface-muted); }
        .california-map .leaflet-tile-pane { filter: saturate(0.5) contrast(0.94) brightness(1.03); }
        .california-map .leaflet-control-zoom a {
            border-radius: var(--radius-sm) !important;
            border-color: var(--border) !important;
            color: var(--muted) !important;
        }
        .california-map .leaflet-control-attribution { font-size: 10px; }
        .daily-update-panel { margin-bottom: 16px; }
        .daily-update-panel.is-loading .daily-update-body { opacity: 0.55; }
        .daily-update-header {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: space-between;
            gap: 8px 12px;
        }
        .daily-update-day-nav {
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }
        .daily-update-day-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 28px;
            height: 28px;
            padding: 0;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--surface);
            color: var(--text);
            font-size: 18px;
            line-height: 1;
            cursor: pointer;
        }
        .daily-update-day-btn:hover:not(:disabled) {
            border-color: var(--accent);
            background: var(--accent-light);
        }
        .daily-update-day-btn:disabled {
            opacity: 0.35;
            cursor: not-allowed;
        }
        .daily-update-day-label { white-space: nowrap; }
        .daily-update-loading-inline {
            margin: 0;
            font-size: 13px;
            color: var(--muted);
        }
        .daily-update-body { padding: 14px 16px 16px; }
        .daily-update-headline {
            margin: 0 0 8px;
            font-size: 15px;
            font-weight: 600;
            line-height: 1.35;
            color: var(--text);
        }
        .daily-update-summary {
            margin: 0;
            font-size: 14px;
            line-height: 1.5;
            color: var(--text);
        }
        .daily-update-context {
            margin: 10px 0 0;
            font-size: 13px;
            line-height: 1.45;
            color: var(--muted);
        }
        .daily-update-loading {
            padding: 14px 16px;
            font-size: 13px;
            color: var(--muted);
        }
        .daily-update-link {
            display: inline;
            padding: 0;
            margin: 0;
            border: none;
            background: none;
            font: inherit;
            color: var(--accent);
            text-decoration: underline;
            text-underline-offset: 2px;
            cursor: pointer;
            border-radius: 2px;
        }
        .daily-update-link:hover { color: var(--text); }
        .daily-update-link:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }
        .daily-update-summary-sep { color: var(--text); text-decoration: none; }
        .daily-update-summary-lead,
        .daily-update-summary-tail { color: var(--text); text-decoration: none; }
        .daily-update-events-modal {
            width: min(640px, 96vw);
            max-height: min(88vh, 720px);
        }
        .daily-update-events-body {
            padding: 10px 12px 14px;
            min-height: 0;
        }
        .daily-update-events-loading {
            padding: 24px 12px;
            text-align: center;
            font-size: 13px;
            color: var(--muted);
        }
        .daily-update-events-loading.hidden,
        .daily-update-events-list.hidden { display: none; }
        .daily-update-events-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: min(68vh, 560px);
            overflow: auto;
        }
        .daily-update-vehicle-row {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            width: 100%;
            text-align: left;
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--surface);
            cursor: pointer;
            transition: border-color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy);
        }
        .daily-update-vehicle-row:hover {
            border-color: var(--accent);
            background: var(--accent-light);
        }
        .daily-update-vehicle-photo-wrap {
            flex: 0 0 88px;
            width: 88px;
            height: 66px;
            border-radius: var(--radius-sm);
            overflow: hidden;
            background: var(--bg);
        }
        .daily-update-vehicle-photo {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .daily-update-vehicle-copy {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
        }
        .daily-update-vehicle-title {
            display: block;
            font-size: 14px;
            font-weight: 600;
            color: var(--text);
            line-height: 1.35;
            margin-bottom: 4px;
        }
        .daily-update-vehicle-vin {
            display: block;
            margin-top: 2px;
            font-size: 13px;
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
            letter-spacing: 0.02em;
            line-height: 1.4;
        }
        .daily-update-vehicle-vin .vin-container { display: inline; }
        .daily-update-vin-copy-feedback {
            background-color: #e8f0fe;
            color: #3e6ae1;
            padding: 2px 4px;
            border-radius: 2px;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            text-align: center;
            font-size: 12px;
            font-family: system-ui, sans-serif;
        }
        .daily-update-changes { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
        .daily-update-change-row {
            display: flex;
            flex-wrap: wrap;
            align-items: baseline;
            gap: 6px 10px;
            font-size: 12px;
        }
        .daily-update-change-label {
            color: var(--muted);
            font-weight: 500;
            min-width: 5.5rem;
        }
        .daily-update-change-values {
            display: inline-flex;
            align-items: baseline;
            gap: 6px;
            font-variant-numeric: tabular-nums;
        }
        .daily-update-before { color: #c53030; text-decoration: line-through; font-weight: 500; }
        .daily-update-after { color: #276749; font-weight: 600; }
        .daily-update-arrow { color: var(--muted); font-size: 11px; }
        .daily-update-change-row-compact { margin-top: 4px; }
        .daily-update-change-row-compact .daily-update-change-values { font-size: 13px; }
        .daily-update-empty {
            margin: 0;
            padding: 24px 12px;
            text-align: center;
            font-size: 13px;
            color: var(--muted);
        }
        .leaflet-div-icon.dealer-map-marker-icon { background: transparent; border: none; }
        .dealer-map-marker {
            position: absolute;
            left: 0;
            top: 0;
            transform: translate(-50%, -100%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            pointer-events: auto;
            cursor: pointer;
        }
        .dealer-map-marker-label {
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--surface);
            color: var(--text);
            font-weight: 500;
            font-size: 11px;
            letter-spacing: 0;
            line-height: 1.2;
            padding: 5px 10px;
            box-shadow: none;
            white-space: nowrap;
            text-align: center;
            transition: border-color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy);
        }
        .dealer-map-marker-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--accent);
            border: 2px solid var(--surface);
            box-shadow: none;
            flex: 0 0 auto;
        }
        .dealer-map-marker:hover .dealer-map-marker-label {
            border-color: var(--accent);
            background: var(--accent-light);
        }
        .dealer-pin { position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(62,106,225,0.28); background: rgba(255,255,255,0.96); color: var(--text); border-radius: 999px; padding: 9px 12px 9px 10px; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; box-shadow: 0 12px 26px rgba(16,24,40,0.12); transition: transform 0.15s ease-out, border-color 0.15s ease-out, box-shadow 0.15s ease-out; }
        .dealer-pin:hover, .dealer-pin:focus-visible { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 16px 34px rgba(62,106,225,0.18); outline: none; }
        .dealer-pin::before { content: ''; width: 10px; height: 10px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 5px rgba(62,106,225,0.14); }
        .dealer-pin.fairfield { left: 46%; top: 38%; }
        .dealer-pin.dupratt { left: 42%; top: 46%; }
        .dealer-card-button {
            width: 100%;
            text-align: left;
            border: none;
            border-bottom: 1px solid var(--border);
            background: transparent;
            border-radius: 0;
            padding: 11px 16px;
            cursor: pointer;
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: center;
            gap: 12px;
            transition: background var(--duration-fast) var(--ease-snappy);
        }
        .dealer-card-button:last-child { border-bottom: none; }
        .dealer-card-button:hover, .dealer-card-button:focus-visible {
            background: var(--surface-hover);
            outline: none;
        }
        .dealer-card-name {
            font-weight: 500;
            font-size: 13px;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
        }
        .dealer-card-name::before {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #22c55e;
            flex: 0 0 auto;
        }
        .dealer-card-button > .filter-option-count {
            font-size: 13px;
            font-weight: 600;
            font-variant-numeric: tabular-nums;
            color: var(--text);
            margin-left: 0;
            min-width: 3ch;
            text-align: right;
        }
        .dealer-card-button:hover > .filter-option-count,
        .dealer-card-button:focus-visible > .filter-option-count {
            color: var(--accent);
        }
        .dealer-card-note { color: var(--muted); font-size: 12px; }
        .dealer-inventory-heading { width: 100%; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
        .dealer-inventory-heading h2 { margin: 0; font-size: 28px; letter-spacing: -0.03em; }
        .dealer-inventory-heading p { margin: 4px 0 0; color: var(--muted); }
        .dealer-back-button { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 9px 13px; cursor: pointer; font: inherit; font-weight: 650; }
        .dealer-back-button:hover { border-color: var(--accent); color: var(--accent); }
        .model-card {
            background: var(--surface);
            border-radius: var(--radius-md);
            overflow: hidden;
            box-shadow: none;
            border: 1px solid var(--border);
            cursor: pointer;
            transition: border-color var(--duration-fast) var(--ease-snappy), background var(--duration-fast) var(--ease-snappy);
            position: relative;
        }
        .model-card:hover, .model-card:focus {
            border-color: var(--border-strong);
            background: var(--surface-hover);
            outline: none;
        }
        .model-card-image { height: 140px; background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); overflow: hidden; position: relative; }
        .model-card-image img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 0.4s; }
        .model-card:hover .model-card-image img { transform: scale(1.05); }
        .model-card-content { padding: 16px; text-align: center; }

        /* Touch devices can keep :hover state "stuck" after tap; disable hover-only UI there. */
        @media (hover: none), (pointer: coarse) {
            .home-button:hover + .header-subtitle {
                opacity: 0;
                transform: translateY(-2px);
            }
            .header-lead .home-button:hover + .header-subtitle {
                transform: translateX(-50%) translateY(-2px);
            }

            .card:hover,
            .model-card:hover,
            .status-list-grid .card:hover,
            .vehicle-map-popup .card:hover {
                transform: none;
                box-shadow: none;
            }

            .model-card:hover .model-card-image img,
            .stock-search-result:hover,
            .tag-clickable:hover,
            .bookmark-button:hover,
            .view-toggle-button:hover,
            .filter-clear:hover,
            .clear-all-filters:hover,
            .home-button:hover,
            .qr-scan-button:hover {
                transform: none;
                box-shadow: none;
                text-decoration: none;
                filter: none;
                border-color: inherit;
                background: inherit;
                color: inherit;
            }
        }
        .model-card-title-row { display: inline-flex; align-items: baseline; justify-content: center; gap: 6px; }
        .model-card-title { font-size: 18px; font-weight: 600; margin: 0; color: var(--text); }
        .model-card-title-count { margin-left: 0; } /* filter count style supplies spacing where used */
        /* Lightweight skeleton placeholders to prevent "jerky" first paint while inventory loads */
        .model-card.skeleton { cursor: default; }
        .model-card.skeleton:hover, .model-card.skeleton:focus { transform: none; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
        .model-card.skeleton .model-card-image { background: #eceff3; }
        .model-card.skeleton .model-card-image::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(90deg, rgba(236,239,243,0) 0%, rgba(255,255,255,0.65) 50%, rgba(236,239,243,0) 100%);
            transform: translateX(-100%);
            animation: shimmer 1.15s ease-in-out infinite;
        }
        .model-card.skeleton .model-card-title,
        .model-card.skeleton .model-card-title-count {
            color: transparent;
            background: #eceff3;
            border-radius: 6px;
            display: inline-block;
        }
        .model-card.skeleton .model-card-title { width: 120px; height: 18px; }
        .model-card.skeleton .model-card-title-count { width: 26px; height: 12px; }
        /* Inventory list skeleton cards — match final card layout to avoid bordered loading flash */
        .card.skeleton {
            pointer-events: none;
            cursor: default;
            overflow: hidden;
        }
        .card.skeleton:hover { border-color: var(--border); background: var(--surface); }
        .card.skeleton .card-image-placeholder.skeleton-shimmer {
            background: #eceff3;
            position: relative;
            overflow: hidden;
        }
        .card.skeleton .card-image-placeholder.skeleton-shimmer::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(90deg, rgba(236,239,243,0) 0%, rgba(255,255,255,0.65) 50%, rgba(236,239,243,0) 100%);
            transform: translateX(-100%);
            animation: shimmer 1.15s ease-in-out infinite;
        }
        .card.skeleton .skeleton-line {
            display: block;
            height: 12px;
            border-radius: 4px;
            background: #eceff3;
            margin-bottom: 6px;
        }
        .card.skeleton .skeleton-title { width: 78%; height: 14px; }
        .card.skeleton .skeleton-subtitle { width: 52%; }
        .card.skeleton .skeleton-tag { width: 42px; height: 18px; margin-bottom: 0; display: inline-block; }
        .card.skeleton .skeleton-price { width: 46%; height: 16px; margin-top: 4px; margin-bottom: 0; }
        @keyframes shimmer { to { transform: translateX(100%); } }
        @media (max-width: 900px) {
            :root { --header-row-min-height: 0px; --header-center-min-height: 0px; --header-control-height: 44px; }
            .header { padding: 0; gap: 0; }
            .header-row {
                display: flex !important;
                flex-direction: column !important;
                align-items: stretch;
                grid-template-columns: none;
                padding: 14px 16px 16px;
                gap: 14px;
                min-height: 0;
            }
            .header-lead {
                margin-bottom: 0;
                align-items: center;
                justify-content: center;
                order: 1;
                width: 100%;
            }
            .header-ca-button { align-self: center; }
            .header-ca-button:not(.is-visible) { display: none; }
            .header-lead:not(.is-store-context) .header-brand-row {
                display: flex;
                justify-content: center;
                width: 100%;
                grid-template-columns: unset;
            }
            .header-lead:not(.is-store-context) .home-button { justify-content: center; }
            /* Dealer/store: one centered cluster — [< CA][logo + title + count] */
            .header-lead.is-store-context .header-brand-row {
                display: flex;
                flex-direction: row;
                align-items: center;
                gap: 8px;
                width: max-content;
                max-width: 100%;
                margin: 0 auto;
                grid-template-columns: unset;
            }
            .header-lead.is-store-context .header-ca-button {
                grid-column: unset;
                justify-self: unset;
                flex: 0 0 auto;
            }
            .header-lead.is-store-context .home-button {
                grid-column: unset;
                flex: 0 1 auto;
                min-width: 0;
                justify-content: flex-start;
                gap: 6px;
            }
            .header-lead.is-store-context .home-button .home-text {
                flex: 0 1 auto;
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .header-lead.is-store-context .home-button .home-counts {
                flex: 0 0 auto;
            }
            .header-subtitle { left: 50%; transform: translateX(-50%) translateY(-2px); }
            .header-lead .home-button:hover + .header-subtitle,
            .header-lead .home-button:focus-visible + .header-subtitle { transform: translateX(-50%) translateY(0); }
            .home-button { font-size: 15px; }
            .home-button .home-logo { height: 22px; }
            .header-center { order: 2; width: 100%; }
            .header-center-stack { gap: 8px; max-width: none; }
            .header-search-row {
                flex-direction: row;
                align-items: stretch;
                gap: 0;
                flex-wrap: nowrap;
            }
            .home-mode-toggle {
                padding: 0 10px;
                min-width: 48px;
                font-size: 12px;
                flex-shrink: 0;
            }
            .stock-search-dropdown {
                left: 0;
                right: 0;
                width: 100%;
                max-width: none;
            }
            .header-right {
                order: 3;
                justify-content: center;
                margin-left: 0;
                gap: 10px;
                padding-top: 0;
                flex-wrap: wrap;
            }
            .main { padding: 12px 16px 12px; flex-direction: column; gap: 8px; align-items: stretch; }
            .main:not(.homepage-main) {
                gap: 6px;
                padding: 8px 12px 12px;
            }
            .main:not(.homepage-main) .inventory {
                margin-top: 0;
                background: transparent;
                border: none;
                border-radius: 0;
                padding: 0;
                min-height: 0;
            }
            .main:not(.homepage-main) .cards-grid { gap: 10px; }
            .main:not(.homepage-main) .active-filters {
                margin: 0 0 8px;
                gap: 6px;
            }
            .main:not(.homepage-main) .active-filter-tag {
                border-radius: 6px;
                padding: 5px 10px;
                font-size: 12px;
            }
            .main.homepage-main { padding: 12px 16px 24px; }
            .console-page-title { font-size: 18px; }
            .dealer-home { grid-template-columns: 1fr; gap: 12px; }
            /* Mobile filters are handled via a drawer (see below), not horizontal scrolling */
            .filters { display: none; }
            .homepage-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
            .dealer-home { grid-template-columns: 1fr; gap: 14px; }
            .dealer-map-card { min-height: 480px; padding: 0; }
            .california-map { min-height: 480px; }
            .dealer-list-card { border-radius: var(--radius-lg); padding: 4px 0; }
            .dealer-card-button { padding: 13px 16px; }
            .model-card-image { height: 96px; }
            .model-card-content { padding: 10px; }
            .model-card-title { font-size: 14px; }
            .model-card-title-row .filter-option-count { font-size: 11px; }
            .stock-search { flex: 1 1 100%; width: 100%; min-width: 0; max-width: none; gap: 0; }
            /* 16px+ avoids iOS focus zoom; viewport also locks pinch-zoom on mobile */
            .stock-search input { flex: 1; width: 100%; padding: 0 12px; font-size: 16px; border-radius: 6px 0 0 6px; }
            .stock-search-submit,
            .qr-scan-button {
                width: 44px;
                min-width: 44px;
                flex-shrink: 0;
                align-self: stretch;
            }
            .stock-search-submit { border-left: 1px solid rgba(255,255,255,0.28); border-radius: 0; }
            .qr-scan-button {
                display: flex;
                border-left: 1px solid #d5d9e0;
                border-radius: 0 6px 6px 0;
            }
            .price-input { font-size: 16px; }
            .mobile-sort select { font-size: 16px; }
            .header-row:has(.header-lead.is-store-context) {
                display: flex !important;
                flex-direction: column !important;
                align-items: stretch;
                gap: 14px;
                padding: 14px 16px 16px;
            }
            .header-row:has(.header-lead.is-store-context) .header-lead {
                order: 1;
                width: 100%;
                flex: 0 0 auto;
            }
            .header-row:has(.header-lead.is-store-context) .header-center {
                order: 2;
                width: 100%;
                flex: 0 0 auto;
                position: static;
            }
            .header-row:has(.header-lead.is-store-context) .header-right {
                order: 3;
            }
            .header-row:has(.header-lead.is-store-context) .header-brand-row {
                height: var(--header-control-height);
                min-height: var(--header-control-height);
            }
            .header-row:has(.header-lead.is-store-context) .home-button {
                white-space: nowrap;
                max-width: 100%;
                height: var(--header-control-height);
            }

            /* Inventory list cards (non-homepage): 2-up on mobile, with clean spacing */
            .main:not(.homepage-main) .cards-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 12px;
            }
            .main:not(.homepage-main) .card { padding: 12px 12px 14px; gap: 10px; }
            .main:not(.homepage-main) .card-image-placeholder {
                height: 140px;
                margin: -12px -12px 10px -12px;
            }
            .main:not(.homepage-main) .card-title { font-size: 14px; }
            .main:not(.homepage-main) .card-subtitle { font-size: 12px; }
            .main:not(.homepage-main) .card-footer-used .price,
            .main:not(.homepage-main) .card-odometer { font-size: 15px; }
        }

        /* Ultra-narrow phones: keep cards readable */
        @media (max-width: 360px) {
            .main:not(.homepage-main) .cards-grid { grid-template-columns: 1fr; }
        }

        /* Mobile filter bar + drawer (common pattern) */
        .mobile-filter-bar { display: none; }
        @media (max-width: 900px) {
            .main:not(.homepage-main) .mobile-filter-bar { display: block; }
        }
        .mobile-filter-bar {
            position: sticky;
            top: 0;
            z-index: 50;
            background: transparent;
            padding: 4px 0 6px;
            margin-bottom: 0;
            align-self: stretch;
            width: 100%;
            box-sizing: border-box;
        }
        /* Full-bleed 50/50 controls on inventory (cancel main side padding) */
        @media (max-width: 900px) {
            .main:not(.homepage-main) .mobile-filter-bar {
                display: block;
                flex-shrink: 0;
                align-self: stretch;
                width: calc(100% + 24px);
                max-width: none;
                margin-left: -12px;
                margin-right: -12px;
                padding: 4px 12px 6px;
                box-sizing: border-box;
            }
            .main:not(.homepage-main) .mobile-filter-bar-inner {
                display: flex;
                flex-direction: row;
                align-items: stretch;
                gap: 12px;
                width: 100%;
            }
            .main:not(.homepage-main) .mobile-filter-button,
            .main:not(.homepage-main) .mobile-sort {
                flex: 1 1 0;
                min-width: 0;
                width: auto;
                position: relative;
            }
            .main:not(.homepage-main) .mobile-filter-button {
                z-index: 2;
            }
            .main:not(.homepage-main) .mobile-sort {
                z-index: 1;
                overflow: hidden;
            }
            .main:not(.homepage-main) .mobile-sort label {
                display: none;
            }
            .main:not(.homepage-main) .mobile-sort-prefix {
                display: inline;
                flex: 0 0 auto;
                font-size: 14px;
                font-weight: 500;
                color: var(--text);
                pointer-events: none;
                white-space: nowrap;
            }
            .main:not(.homepage-main) .mobile-sort {
                justify-content: center;
                gap: 4px;
                padding: 0 10px;
            }
            .main:not(.homepage-main) .mobile-sort select {
                flex: 1 1 auto;
                width: 100%;
                max-width: 100%;
                min-width: 0;
                text-align: left;
                text-align-last: left;
                font-size: 14px;
                text-overflow: ellipsis;
            }
        }
        .mobile-filter-bar-inner {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            gap: 8px;
            width: 100%;
            box-sizing: border-box;
        }
        .mobile-filter-button,
        .mobile-sort {
            width: 100%;
            min-width: 0;
            min-height: 44px;
            box-sizing: border-box;
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--surface);
            box-shadow: var(--shadow-xs);
            transition: border-color var(--duration-fast) var(--ease-snappy), box-shadow var(--duration-fast) var(--ease-snappy);
        }
        .mobile-filter-button:active,
        .mobile-sort:active {
            border-color: var(--border-strong);
            box-shadow: var(--shadow-sm);
        }
        .mobile-filter-button {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 0 12px;
            font: inherit;
            font-size: 14px;
            font-weight: 500;
            color: var(--text);
            cursor: pointer;
            user-select: none;
            touch-action: manipulation;
        }
        .mobile-filter-button:active { transform: scale(0.99); }
        .mobile-filter-count {
            display: none;
            min-width: 18px;
            height: 18px;
            border-radius: 999px;
            padding: 0 6px;
            background: var(--accent);
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            align-items: center;
            justify-content: center;
        }
        .mobile-sort {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 0 10px 0 12px;
            justify-content: space-between;
        }
        .mobile-sort-prefix { display: none; }
        .mobile-sort label {
            flex: 0 0 auto;
            font-size: 10px;
            color: var(--muted);
            font-weight: 600;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            white-space: nowrap;
        }
        .mobile-sort select {
            flex: 1 1 auto;
            min-width: 0;
            max-width: 100%;
            border: none;
            background: transparent;
            font: inherit;
            font-size: 13px;
            font-weight: 500;
            color: var(--text);
            text-align: center;
            text-align-last: center;
            padding: 0;
            margin: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            -webkit-appearance: none;
            appearance: none;
        }
        .mobile-sort select:focus { outline: none; }

        #mobile-filters-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.55);
            z-index: 10010;
            display: none;
        }
        body.mobile-filters-open #mobile-filters-backdrop { display: block; }

        .mobile-filters-header { display: none; }
        @media (max-width: 900px) {
            body.mobile-filters-open { overflow: hidden; }
            /* Let the fixed drawer stack above the backdrop (main z-index:1 was trapping it). */
            body.mobile-filters-open #main-content {
                position: static;
                z-index: auto;
            }
            body.mobile-filters-open #filters-sidebar {
                display: block;
                position: fixed;
                left: 0;
                right: 0;
                bottom: 0;
                top: 18vh;
                max-height: 82vh;
                background: #fff;
                border-top-left-radius: 16px;
                border-top-right-radius: 16px;
                box-shadow: 0 -18px 50px rgba(0,0,0,0.20);
                padding: 0 16px 18px;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                z-index: 10020;
                pointer-events: auto;
                width: 100%;
                max-width: none;
                box-sizing: border-box;
                padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
            }
            body.mobile-filters-open #filters-sidebar.filters {
                /* Override desktop sidebar sizing when used as a drawer */
                width: 100% !important;
                padding-right: 0 !important;
            }

            #filters-sidebar .mobile-filters-header {
                display: flex;
                position: sticky;
                top: 0;
                background: #fff;
                padding: 14px 0 12px;
                border-bottom: 1px solid var(--border);
                align-items: center;
                justify-content: space-between;
                gap: 12px;
                z-index: 2;
            }
            #filters-sidebar .mobile-filters-header::before {
                content: '';
                position: absolute;
                left: 50%;
                top: 6px;
                transform: translateX(-50%);
                width: 44px;
                height: 4px;
                border-radius: 999px;
                background: #e5e7eb;
            }
            #filters-sidebar .mobile-filters-header { position: sticky; }
            .mobile-filters-title { font-size: 14px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
            .mobile-filters-close {
                border: 1px solid var(--border);
                border-radius: 10px;
                background: #fff;
                padding: 8px 12px;
                font: inherit;
                font-size: 14px;
                cursor: pointer;
            }
            .mobile-filters-close:active { transform: scale(0.99); }

            /* In drawer, keep filters vertical (default desktop styling) */
            #filters-sidebar #sort-container { display: flex; }
            .filter-section { min-width: 0; }
        }
        .comparison-table-container {
            overflow-x: auto;
            width: 100%;
            margin: 20px 0;
        }
        .comparison-table {
            width: 100%;
            border-collapse: collapse;
            background: white;
            min-width: 800px;
        }
        .comparison-table th,
        .comparison-table td {
            padding: 12px 16px;
            text-align: left;
            border: 1px solid #e0e0e0;
            vertical-align: top;
        }
        .comparison-label-cell {
            background: #f8f9fa;
            font-weight: 600;
            color: var(--text);
            width: 150px;
            min-width: 150px;
            position: sticky;
            left: 0;
            z-index: 2;
            box-shadow: 2px 0 4px rgba(0,0,0,0.1);
        }
        .comparison-data-cell {
            min-width: 200px;
            background: white;
        }
        .comparison-data-cell.empty-cell {
            color: #999;
            font-style: italic;
        }
        .comparison-data-cell.no-equipment {
            color: #999;
            font-style: italic;
        }
        .comparison-vehicle-photo {
            width: 180px;
            height: 120px;
            object-fit: cover;
            border-radius: 4px;
            border: 1px solid #ddd;
        }
        .comparison-equipment-list {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .comparison-equipment-item {
            font-size: 13px;
            color: var(--muted);
            padding: 2px 0;
            line-height: 1.3;
        }
        .comparison-equipment-item:not(:last-child)::after {
            content: '';
            display: block;
            height: 1px;
            background: #f0f0f0;
            margin-top: 4px;
        }
        /* Header row styling */
        .comparison-table tbody tr:first-child .comparison-label-cell {
            background: #e9ecef;
            font-weight: 700;
            font-size: 16px;
        }
        .comparison-table tbody tr:first-child .comparison-data-cell {
            background: #f8f9fa;
            font-weight: 600;
            font-size: 15px;
        }
        /* Photo row styling */
        .comparison-table tbody tr:nth-child(2) {
            background: #fafafa;
        }
        .comparison-table tbody tr:nth-child(2) .comparison-label-cell {
            background: #f8f9fa;
        }
        /* Alternate row colors for better readability */
        .comparison-table tbody tr:nth-child(odd) .comparison-data-cell {
            background: #ffffff;
        }
        .comparison-table tbody tr:nth-child(even) .comparison-data-cell {
            background: #f9f9f9;
        }
        /* Hover effect */
        .comparison-table tbody tr:hover .comparison-data-cell {
            background: #e3f2fd;
        }

        /* Odometer tag spacing (inherits general .tag styles) */
        .odometer-tag {
            margin-right: 4px;
            margin-bottom: 4px;
        }

        /* Used inventory cards: mileage opposite price (CarMax-style) */
        .card-odometer {
            color: var(--text);
            white-space: nowrap;
            flex-shrink: 0;
            margin-left: auto;
        }

        /* Mobile-only persistent quick actions (bottom-right) */
        .mobile-quick-actions {
            position: fixed;
            right: 16px;
            bottom: calc(16px + env(safe-area-inset-bottom, 0px));
            z-index: 9999;
            display: none; /* enabled via media query */
            flex-direction: column;
            gap: 10px;
            pointer-events: none; /* only buttons are clickable */
        }
        .mobile-quick-actions button {
            pointer-events: auto;
            width: 48px;
            height: 48px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--shadow-md);
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
        }
        .mobile-quick-actions button:active { transform: scale(0.98); }
        .mobile-quick-actions button svg { width: 22px; height: 22px; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
        .mobile-quick-actions .hidden { display: none !important; }


        /* Ford news ticker (bottom status bar) */
        .news-ticker {
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;
            height: 32px;
            background: var(--surface);
            color: var(--muted);
            border-top: 1px solid var(--border);
            z-index: 10000;
            overflow: hidden;
            display: none;
            align-items: center;
        }
        .news-ticker.visible { display: flex; }
        .news-ticker-viewport {
            flex: 1;
            overflow: hidden;
            position: relative;
            height: 100%;
        }
        .news-ticker-track {
            display: flex;
            flex-wrap: nowrap;
            width: max-content;
            height: 100%;
            align-items: center;
        }
        .news-ticker-track.is-animated {
            will-change: transform;
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
        }
        @media (hover: hover) and (pointer: fine) {
            .news-ticker-track.is-animated:hover { animation-play-state: paused; }
        }
        .news-ticker-set {
            display: inline-flex;
            flex: 0 0 auto;
            flex-wrap: nowrap;
            align-items: center;
            height: 100%;
        }
        .news-ticker-item {
            flex: 0 0 auto;
            white-space: nowrap;
            padding: 0 1.5rem;
            font-size: 11px;
            font-weight: 500;
            letter-spacing: 0.01em;
            line-height: 32px;
        }
        .news-ticker-item::before {
            content: "";
            display: inline-block;
            width: 4px;
            height: 4px;
            margin-right: 0.65rem;
            border-radius: 50%;
            background: var(--border-strong);
            vertical-align: middle;
        }
        .news-ticker-item a {
            color: var(--text);
            text-decoration: none;
            transition: color var(--duration-fast) var(--ease-snappy);
        }
        .news-ticker-item a:hover { color: var(--accent); text-decoration: none; }
        body.has-news-ticker .page {
            padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
        }
        body.has-news-ticker .mobile-quick-actions {
            bottom: calc(48px + env(safe-area-inset-bottom, 0px));
        }
        body.vehicle-detail-open.has-news-ticker .vehicle-detail.active {
            padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
        }
        @media (prefers-reduced-motion: reduce) {
            *:not(.news-ticker-track),
            *:not(.news-ticker-track)::before,
            *:not(.news-ticker-track)::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }
        @media (max-width: 900px) {
            .mobile-quick-actions { display: flex; }
            /* Hide header action buttons on mobile (use floating actions instead) */
            #db-button,
            #map-button,
            #feedback-button,
            #bookmarks-button {
                display: none !important;
            }
        }
/* Lazy-loaded feature modals (map + QR scanner) */
#vehicle-map-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78);
    z-index: 10010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.vehicle-map-modal {
    background: #fff;
    border-radius: 12px;
    width: min(1000px, 96vw);
    height: min(680px, 92vh);
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.vehicle-map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.vehicle-map-header h3 { margin: 0; font-size: 18px; font-weight: 650; }
.vehicle-map-close {
    background: none; border: none;
    font-size: 28px; cursor: pointer;
    color: var(--muted);
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
}
.vehicle-map-close:hover { color: var(--text); background: #f3f4f6; }
.vehicle-map-body { flex: 1; display: flex; flex-direction: column; padding: 14px; gap: 10px; }
.vehicle-map-canvas { flex: 1; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.vehicle-map-footnote { font-size: 12px; color: var(--muted); text-align: right; }
.vehicle-map-modal .leaflet-popup-content { margin: 0; }
.vehicle-map-modal .leaflet-popup-content-wrapper { border-radius: 12px; padding: 0; overflow: hidden; }
.vehicle-map-modal .leaflet-popup-tip { filter: drop-shadow(0 6px 14px rgba(0,0,0,0.18)); }
.vehicle-map-modal .leaflet-popup-close-button { display: none; }
.vehicle-map-popup .card {
    width: min(180px, 72vw);
    margin: 0;
    padding: 6px 8px 8px;
    gap: 4px;
    border-radius: 12px;
}
.vehicle-map-popup .card-title { font-size: 12px; margin-bottom: 0; line-height: 1.25; }
.vehicle-map-popup .card-subtitle { font-size: 10px; }
.vehicle-map-popup .card-tags, .vehicle-map-popup .card-meta, .vehicle-map-popup .bookmark-button { display: none; }
.vehicle-map-popup .price { font-size: 12px; font-weight: 600; }
#vehicle-map-canvas .vehicle-map-legend {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 1005;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 12px;
    box-shadow: 0 14px 28px rgba(0,0,0,0.18);
    padding: 10px;
    min-width: 170px;
    max-width: min(260px, 42vw);
    max-height: min(360px, 50vh);
    overflow: auto;
}
#qr-scan-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 10020;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.qr-scan-modal {
    background: var(--surface);
    border-radius: 12px;
    width: min(480px, 96vw);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
.qr-scan-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px 0; margin-bottom: 16px;
}
.qr-scan-header h3 { margin: 0; font-size: 20px; font-weight: 600; }
.qr-scan-close {
    background: none; border: none; font-size: 28px; cursor: pointer;
    color: var(--muted); padding: 0; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
}
.qr-scan-close:hover { color: var(--text); }
.qr-scan-content { padding: 0 24px 24px; text-align: center; }
#qr-video {
    width: 100%; max-width: 400px; border-radius: 8px;
    border: 2px solid var(--border);
}
.qr-scan-instructions { margin-top: 16px; font-size: 14px; color: var(--muted); }
