/* TheEVScore — Design System */

:root {
    /* Surfaces */
    --bg-base: #f8f8f7;
    --bg-card: #ffffff;
    --bg-muted: #f3f3f1;
    --bg-elevated: #fafaf9;

    /* Foreground */
    --fg-primary: #1a1a19;
    --fg-secondary: #52524e;
    --fg-muted: #8c8c89;
    --fg-faint: #b5b5b1;

    /* Borders */
    --border-default: rgba(0, 0, 0, 0.08);
    --border-subtle: rgba(0, 0, 0, 0.04);
    --border-strong: rgba(0, 0, 0, 0.15);

    /* Tier colors */
    --t1-bg: #ecfdf5;
    --t1-text: #065f46;
    --t1-border: #6ee7b7;
    --t1-accent: #059669;

    --t2-bg: #eff6ff;
    --t2-text: #1e40af;
    --t2-border: #93c5fd;
    --t2-accent: #2563eb;

    --t3-bg: #faf5ff;
    --t3-text: #6b21a8;
    --t3-border: #c4b5fd;
    --t3-accent: #7c3aed;

    /* Flags */
    --flag-under-bg: #f0f4ff;
    --flag-under-text: #4b5563;
    --flag-ok-bg: #ecfdf5;
    --flag-ok-text: #065f46;
    --flag-soft-bg: #fffbeb;
    --flag-soft-text: #92400e;
    --flag-over-bg: #fef2f2;
    --flag-over-text: #991b1b;

    /* Spacing base */
    --space-unit: 4px;
}

/* Typography */
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Smooth transitions for htmx swaps */
.htmx-settling {
    opacity: 0.8;
}

.htmx-swapping {
    opacity: 0.5;
    transition: opacity 0.1s ease-out;
}

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    overflow: hidden;
}

/* Tier accent top border */
.tier-accent-1 { border-top: 3px solid var(--t1-accent); }
.tier-accent-2 { border-top: 3px solid var(--t2-accent); }
.tier-accent-3 { border-top: 3px solid var(--t3-accent); }

/* Tier badge */
.tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.tier-badge-1 { background: var(--t1-bg); color: var(--t1-text); }
.tier-badge-2 { background: var(--t2-bg); color: var(--t2-text); }
.tier-badge-3 { background: var(--t3-bg); color: var(--t3-text); }

/* Flag badge */
.flag-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.flag-under { background: var(--flag-under-bg); color: var(--flag-under-text); }
.flag-ok { background: var(--flag-ok-bg); color: var(--flag-ok-text); }
.flag-soft_over { background: var(--flag-soft-bg); color: var(--flag-soft-text); }
.flag-over { background: var(--flag-over-bg); color: var(--flag-over-text); }

/* Verdict pills (history table) */
.verdict-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
/* New verdict labels */
.verdict-pill-reject {
    background: var(--flag-over-bg);
    color: var(--flag-over-text);
}
.verdict-pill-mixed-bag {
    background: var(--flag-soft-bg);
    color: var(--flag-soft-text);
}
.verdict-pill-good-bet {
    background: #eff6ff;
    color: #1e40af;
}
.verdict-pill-strong-buy {
    background: var(--flag-ok-bg);
    color: var(--flag-ok-text);
}
/* Legacy aliases for cached narratives */
.verdict-pill-pass {
    background: var(--flag-over-bg);
    color: var(--flag-over-text);
}
.verdict-pill-worth-a-look {
    background: var(--flag-soft-bg);
    color: var(--flag-soft-text);
}
.verdict-pill-shortlist {
    background: #eff6ff;
    color: #1e40af;
}

/* Stat block */
.stat-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.stat-label {
    font-size: 12px;
    color: var(--fg-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 500;
}
.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--fg-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.stat-value-sm {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg-primary);
    font-variant-numeric: tabular-nums;
}

/* Monthly loan pill */
.monthly-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.monthly-under {
    background: var(--flag-under-bg);
    color: var(--flag-under-text);
}
.monthly-ok {
    background: var(--flag-ok-bg);
    color: var(--flag-ok-text);
}
.monthly-soft_over {
    background: var(--flag-soft-bg);
    color: var(--flag-soft-text);
}
.monthly-over {
    background: var(--flag-over-bg);
    color: var(--flag-over-text);
}

/* Verdict block */
.verdict-block {
    border-radius: 8px;
    padding: 20px 24px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--fg-secondary);
}
.verdict-block-1 { background: var(--t1-bg); border-left: 3px solid var(--t1-accent); }
.verdict-block-2 { background: var(--t2-bg); border-left: 3px solid var(--t2-accent); }
.verdict-block-3 { background: var(--t3-bg); border-left: 3px solid var(--t3-accent); }

/* Narrative formatting inside verdict blocks */

/* Verdict line: large label + colored tag */
.narrative-verdict {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.narrative-verdict-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-muted);
}
.narrative-verdict-tag {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
/* New verdict tag labels */
.verdict-tag-reject {
    background: var(--flag-over-bg);
    color: var(--flag-over-text);
    border: 1px solid #fca5a5;
}
.verdict-tag-mixed-bag {
    background: var(--flag-soft-bg);
    color: var(--flag-soft-text);
    border: 1px solid #fcd34d;
}
.verdict-tag-good-bet {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
.verdict-tag-strong-buy {
    background: var(--flag-ok-bg);
    color: var(--flag-ok-text);
    border: 1px solid #6ee7b7;
}
/* Legacy tag aliases */
.verdict-tag-pass {
    background: var(--flag-over-bg);
    color: var(--flag-over-text);
    border: 1px solid #fca5a5;
}
.verdict-tag-worth-a-look {
    background: var(--flag-soft-bg);
    color: var(--flag-soft-text);
    border: 1px solid #fcd34d;
}
.verdict-tag-shortlist {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.verdict-block h4.narrative-heading {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 14px 0 4px 0;
    color: var(--fg-muted);
}
.verdict-block h4.narrative-heading:first-child {
    margin-top: 0;
}
.verdict-block p {
    margin: 0 0 8px 0;
}
.verdict-block p:last-child {
    margin-bottom: 0;
}
.verdict-block strong {
    color: var(--fg-primary);
    font-weight: 600;
}
.verdict-block a.narrative-link {
    color: var(--t2-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.verdict-block a.narrative-link:hover {
    opacity: 0.8;
}

/* Scoring dimension tiles — 2-column grid */
.dim-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
}
@media (max-width: 640px) {
    .dim-grid { grid-template-columns: 1fr !important; }
}
/* Dimension tiles — layout classes (sizing via inline styles) */
.dim-tile {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-muted);
}
.dim-strength { border-left: 3px solid #22c55e; }
.dim-weakness { border-left: 3px solid #ef4444; }
.dim-neutral { border-left: 3px solid #eab308; }

/* Financials — inputs grid */
.fin-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Financials — computed results bar */
.fin-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 24px;
    padding: 14px 16px;
    background: var(--bg-muted);
    border-radius: 8px;
    margin-top: 12px;
}
.fin-label {
    font-size: 12px;
    color: var(--fg-muted);
}
.fin-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-primary);
    font-variant-numeric: tabular-nums;
}

/* Range slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--fg-primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--fg-primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* Price band badges (replaces tier badges) */
.price-band-budget { background: var(--t1-bg); color: var(--t1-text); }
.price-band-mid { background: var(--t2-bg); color: var(--t2-text); }
.price-band-premium { background: var(--t3-bg); color: var(--t3-text); }

/* Verdict-colored narrative blocks */
.verdict-block-strong-buy { background: var(--t1-bg); border-left: 3px solid var(--t1-accent); }
.verdict-block-good-bet { background: var(--t2-bg); border-left: 3px solid var(--t2-accent); }
.verdict-block-mixed-bag { background: var(--flag-soft-bg); border-left: 3px solid #f59e0b; }
.verdict-block-reject { background: var(--flag-over-bg); border-left: 3px solid #ef4444; }
/* Legacy block aliases */
.verdict-block-shortlist { background: var(--t2-bg); border-left: 3px solid var(--t2-accent); }
.verdict-block-worth-a-look { background: var(--flag-soft-bg); border-left: 3px solid #f59e0b; }
.verdict-block-pass { background: var(--flag-over-bg); border-left: 3px solid #ef4444; }

/* Verdict accent top border */
.verdict-accent-strong-buy { border-top: 3px solid var(--t1-accent); }
.verdict-accent-good-bet { border-top: 3px solid var(--t2-accent); }
.verdict-accent-mixed-bag { border-top: 3px solid #f59e0b; }
.verdict-accent-reject { border-top: 3px solid #ef4444; }
/* Legacy accent aliases */
.verdict-accent-shortlist { border-top: 3px solid var(--t2-accent); }
.verdict-accent-worth-a-look { border-top: 3px solid #f59e0b; }
.verdict-accent-pass { border-top: 3px solid #ef4444; }

/* Verdict showcase on homepage */
.verdict-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.verdict-showcase-card {
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}
.verdict-showcase-card .showcase-score {
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.verdict-showcase-card .showcase-range {
    font-size: 12px;
    color: var(--fg-muted);
    margin-top: 2px;
}

/* Spinner animation fallback */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.animate-spin {
    animation: spin 1s linear infinite;
}

/* ── Analytics dashboard ──────────────────────────── */

/* Horizontal bar charts */
.analytics-bar-track {
    height: 20px;
    background: var(--bg-muted);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.analytics-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    min-width: 2px;
}
.bar-excellent { background: #059669; }
.bar-good { background: #2563eb; }
.bar-average { background: #eab308; }
.bar-poor { background: #ef4444; }
.bar-blue { background: #2563eb; }

/* Heatmap cells (verdict x tier) */
.heatmap-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
}

/* Dimension heatmap cells */
.dim-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 4px 8px;
    border-radius: 5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}
.dim-cell-good { background: var(--flag-ok-bg); color: var(--flag-ok-text); }
.dim-cell-mid { background: var(--flag-soft-bg); color: var(--flag-soft-text); }
.dim-cell-poor { background: var(--flag-over-bg); color: var(--flag-over-text); }

/* Exit viability diverging bars */
.exit-bar-container {
    flex: 1;
    height: 20px;
    position: relative;
    background: var(--bg-muted);
    border-radius: 4px;
    overflow: hidden;
}
.exit-bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-strong);
}
.exit-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.exit-bar-positive { background: #059669; }
.exit-bar-negative { background: #ef4444; }

/* Chart containers */
#scoreDistChart,
#coeTimingChart {
    max-height: 250px;
}

/* ── Homepage horizontal scroll cards ─────────────── */

.home-card-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
}
.home-card-scroll::-webkit-scrollbar {
    height: 4px;
}
.home-card-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.home-card-scroll::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 2px;
}
.home-card {
    flex: 0 0 220px;
    scroll-snap-align: start;
    transition: box-shadow 0.15s ease;
}
.home-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.home-card-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
}
.home-card-img-placeholder {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    background: var(--fg-muted);
    color: white;
}
.home-card-body {
    padding: 8px 10px 10px;
}

/* ── Verdict-grouped sections (history page) ─────── */

.verdict-section {
    border-radius: 10px;
    overflow: hidden;
}
.verdict-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    border-radius: 10px;
    transition: background 0.15s;
}
.verdict-section-header::marker,
.verdict-section-header::-webkit-details-marker {
    display: none;
}
.verdict-section-header::before {
    content: "\25B8";
    font-size: 12px;
    transition: transform 0.15s;
    flex-shrink: 0;
}
details[open] > .verdict-section-header::before {
    transform: rotate(90deg);
}
details[open] > .verdict-section-header {
    border-radius: 10px 10px 0 0;
}
.verdict-section-label {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.verdict-section-count {
    font-size: 12px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(0,0,0,0.08);
}

/* Section colors — new labels */
.verdict-section-strong-buy {
    background: var(--flag-ok-bg);
    color: var(--flag-ok-text);
    border: 1px solid #6ee7b7;
}
.verdict-section-good-bet {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
.verdict-section-mixed-bag {
    background: var(--flag-soft-bg);
    color: var(--flag-soft-text);
    border: 1px solid #fcd34d;
}
.verdict-section-reject {
    background: var(--flag-over-bg);
    color: var(--flag-over-text);
    border: 1px solid #fca5a5;
}
/* Legacy section aliases */
.verdict-section-shortlist {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
.verdict-section-worth-a-look {
    background: var(--flag-soft-bg);
    color: var(--flag-soft-text);
    border: 1px solid #fcd34d;
}
.verdict-section-pass {
    background: var(--flag-over-bg);
    color: var(--flag-over-text);
    border: 1px solid #fca5a5;
}

/* Hidden overflow rows */
.row-hidden {
    display: none !important;
}

/* Show more bar */
.show-more-bar {
    text-align: center;
    padding: 8px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-muted);
}
.show-more-btn {
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 12px;
}
.show-more-btn:hover {
    text-decoration: underline;
}

/* Inline re-analyze button (detail page) */
.inline-reanalyze-btn {
    font-size: 12px;
    font-weight: 500;
    color: #2563eb;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}
.inline-reanalyze-btn:hover {
    background: #eff6ff;
}
.inline-reanalyze-btn:disabled {
    cursor: default;
}

/* ── History: mobile card view ────────────────────── */

/* Mobile cards hidden by default (desktop shows table) */
.history-mobile-card {
    display: none;
    cursor: pointer;
}

/* ── Scan card ────────────────────────────────────── */

.scan-card {
    border-left: 3px solid #2563eb;
}
.scan-card select,
.scan-card input[type="number"],
.scan-card input[type="text"] {
    background: var(--bg-base);
}
.scan-card details summary {
    list-style: none;
}
.scan-card details summary::marker,
.scan-card details summary::-webkit-details-marker {
    display: none;
}
.scan-card details summary::before {
    content: "\\25B8 ";
}
.scan-card details[open] summary::before {
    content: "\\25BE ";
}

/* ── Compare page ────────────────────────────────── */

.compare-hero {
    display: flex;
    align-items: stretch;
    gap: 16px;
}
.compare-hero-card {
    flex: 1;
    min-width: 0;
}
.compare-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: var(--fg-muted);
    flex-shrink: 0;
    width: 40px;
}
.compare-winner-cell {
    font-weight: 700;
    color: var(--t1-text) !important;
}
.compare-delta {
    font-size: 12px;
    font-weight: 600;
}
.compare-delta-positive {
    color: var(--t1-text);
}
.compare-delta-negative {
    color: var(--flag-over-text);
}

/* Quick Take banner */
.quick-take-banner {
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--fg-secondary);
}
.quick-take-inner {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}
.quick-take-strong {
    background: var(--flag-ok-bg);
    border: 1px solid #6ee7b7;
}
.quick-take-moderate {
    background: var(--flag-soft-bg);
    border: 1px solid #fcd34d;
}
.quick-take-close {
    background: var(--t2-bg);
    border: 1px solid var(--t2-border);
}

/* Compare score row */
.compare-score-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}
.compare-score-cell {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg-muted);
}
.compare-score-leader {
    background: var(--flag-ok-bg);
}
.compare-score-num {
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--fg-primary);
}
.compare-score-rating {
    font-size: 12px;
    font-weight: 600;
    color: var(--fg-muted);
    text-transform: uppercase;
}
.compare-score-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-muted);
}

/* Spec pills */
.spec-pill {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    background: var(--bg-muted);
    color: var(--fg-secondary);
    margin: 1px 2px;
    white-space: nowrap;
}

/* 3B: Info tooltips (CSS-only) */
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    color: var(--fg-muted);
    background: var(--bg-muted);
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 3px;
}
.tooltip-trigger:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: var(--fg-primary);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    width: 220px;
    text-align: left;
    z-index: 50;
    pointer-events: none;
    white-space: normal;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
/* Allow tooltips to overflow table containers */
.overflow-visible {
    overflow: visible;
}

/* Detail toggle */
.compare-detail-toggle summary {
    list-style: none;
}
.compare-detail-toggle summary::marker,
.compare-detail-toggle summary::-webkit-details-marker {
    display: none;
}

/* ── Floating compare bar ────────────────────────── */

.compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-card);
    border-top: 3px solid #2563eb;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
    padding: 10px 16px;
    display: none;
}
.compare-bar.active {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.compare-bar-slot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-muted);
    color: var(--fg-primary);
    max-width: 200px;
}
.compare-bar-slot .slot-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.compare-bar-slot .slot-remove {
    cursor: pointer;
    font-size: 14px;
    color: var(--fg-muted);
    line-height: 1;
    padding: 0 2px;
}
.compare-bar-slot .slot-remove:hover {
    color: var(--flag-over-text);
}
.compare-bar-empty {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--fg-muted);
    border: 1px dashed var(--border-default);
}
.compare-bar-go {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    background: #2563eb;
    border: none;
    cursor: pointer;
}
.compare-bar-go:hover {
    background: #1d4ed8;
}
.compare-bar-go:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Compare add button (detail/recommend pages) */
.compare-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #2563eb;
    background: none;
    border: 1px solid #2563eb;
    cursor: pointer;
    transition: background 0.15s;
}
.compare-add-btn:hover {
    background: #eff6ff;
}
.compare-add-btn.in-compare {
    background: #eff6ff;
    color: #1d4ed8;
}

/* ── Dashboard stat cards ─────────────────────────── */

.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.dash-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.dash-stat-number {
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    color: var(--fg-primary);
}
.dash-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-muted);
    margin-top: 4px;
}
.dash-stat-sub {
    font-size: 12px;
    color: var(--fg-muted);
    margin-top: 2px;
}

/* Verdict count pills row */
.verdict-counts-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.verdict-count-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}
.verdict-count-pill .vc-num {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ── Tesla model selector ─────────────────────────── */

.tesla-selector {
    display: flex;
    gap: 16px;
    justify-content: center;
}
.tesla-selector-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 24px 12px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex: 0 1 220px;
}
.tesla-selector-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: var(--fg-primary);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.tesla-selector-card.active::after {
    transform: translateX(-50%) scaleX(1);
}
.tesla-selector-img {
    width: 180px;
    height: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
    opacity: 0.45;
}
.tesla-selector-card.active .tesla-selector-img {
    opacity: 1;
}
.tesla-selector-card:hover .tesla-selector-img {
    transform: scale(1.03);
    opacity: 0.8;
}
.tesla-selector-card.active:hover .tesla-selector-img {
    opacity: 1;
}
.tesla-selector-label {
    margin-top: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--fg-muted);
    letter-spacing: -0.01em;
    transition: color 0.2s;
}
.tesla-selector-card.active .tesla-selector-label {
    color: var(--fg-primary);
}

@media (max-width: 640px) {
    .tesla-selector {
        gap: 8px;
    }
    .tesla-selector-card {
        padding: 12px 12px 10px;
    }
    .tesla-selector-img {
        width: 140px;
    }
    .tesla-selector-label {
        font-size: 14px;
    }
}

/* ── Mobile responsive ────────────────────────────── */

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

    .fin-results {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 16px;
    }

    /* Let mobile tables scroll */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    /* Exit bar container */
    .exit-bar-container {
        min-width: 120px;
    }

    /* History: swap table for cards on mobile */
    .history-table-wrapper {
        display: none !important;
    }
    .history-table-row {
        display: none !important;
    }
    .history-mobile-card {
        display: block;
    }

    /* Compare hero stacks on mobile */
    .compare-hero {
        flex-direction: column;
    }
    .compare-vs {
        width: auto;
        padding: 4px 0;
    }
    .compare-bar.active {
        flex-wrap: wrap;
        gap: 8px;
    }
    .compare-bar-slot {
        max-width: none;
        flex: 1;
    }

    /* Dashboard stat cards on mobile */
    .dash-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .dash-stat-number {
        font-size: 22px;
    }

    /* Smaller homepage cards on mobile */
    .home-card {
        flex: 0 0 180px;
    }
    .home-card-img {
        height: 80px;
    }
    .home-card-img-placeholder {
        height: 80px;
    }

    /* Compare: stacked metric cards on mobile */
    .compare-dim-table th:nth-child(4),
    .compare-dim-table td:nth-child(4) {
        display: none;
    }
    .compare-score-row {
        gap: 12px;
    }
    .compare-score-num {
        font-size: 22px;
    }
    .compare-score-cell {
        padding: 6px 12px;
    }
    .quick-take-banner {
        font-size: 13px;
        padding: 10px 14px;
    }
    .tooltip-trigger:hover::after {
        left: auto;
        right: 0;
        transform: none;
        width: 180px;
    }
}
