/* ============================================
   TrueLease — The Auto Dealership Decoder
   Premium Dark Theme Stylesheet
   ============================================ */

/* === CSS Custom Properties === */
:root {
    --bg-deep: #0f1117;
    --bg-card: #1a1e26;
    --bg-card-hover: #1f2430;
    --bg-input: #141820;
    --border-card: #2a2f3a;
    --border-input: #333a48;
    --border-focus: #d4a843;

    --gold: #d4a843;
    --gold-dim: #b8922e;
    --gold-glow: rgba(212, 168, 67, 0.15);

    --emerald: #2ecc71;
    --amber: #f0b429;
    --orange: #e67e22;
    --crimson: #dc3545;
    --blue: #4a9eff;

    --text-primary: #e8eaed;
    --text-secondary: #8892a0;
    --text-muted: #5a6270;

    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 20px rgba(212, 168, 67, 0.08);

    --transition: 0.25s ease;
    --transition-slow: 0.5s ease;
}

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* === Background Pattern === */
.bg-pattern {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.03;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='120' viewBox='0 0 200 120'%3E%3Cpath d='M40 90 Q60 30 80 50 Q100 70 120 30 Q140 -10 160 40 Q180 90 200 60' fill='none' stroke='%23d4a843' stroke-width='1'/%3E%3Cpath d='M0 80 Q30 50 60 70 Q90 90 120 60 Q150 30 180 50' fill='none' stroke='%23d4a843' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 300px 180px;
}

/* === Container === */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* === Header === */
.site-header {
    position: relative;
    z-index: 10;
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--border-card);
    background: linear-gradient(180deg, rgba(26, 30, 38, 0.9) 0%, rgba(15, 17, 23, 0.95) 100%);
    backdrop-filter: blur(12px);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(212, 168, 67, 0.4));
}

.site-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-subtitle {
    margin-top: 10px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.header-subtitle em {
    color: var(--gold);
    font-style: italic;
}

/* === Ad Placeholders === */
.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-card);
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: rgba(26, 30, 38, 0.3);
    margin: 20px auto;
    position: relative;
    z-index: 1;
}

.ad-mobile {
    width: 320px;
    height: 50px;
    max-width: 100%;
}

.ad-desktop {
    display: none;
    width: 728px;
    height: 90px;
    max-width: 100%;
}

/* === Panels === */
.panel {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    margin: 24px 0;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition);
}

.panel:hover {
    border-color: rgba(212, 168, 67, 0.2);
}

.panel-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-card);
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.04) 0%, transparent 60%);
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--bg-deep);
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.panel-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 6px;
}

.panel-body {
    padding: 24px;
}

/* === Forms === */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input:focus,
select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

select {
    cursor: pointer;
    font-family: var(--font-body);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238892a0' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

.input-wrap:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.input-wrap input {
    border: none;
    background: transparent;
    box-shadow: none;
}

.input-wrap input:focus {
    border: none;
    box-shadow: none;
}

.input-prefix {
    padding: 0 0 0 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    pointer-events: none;
    flex-shrink: 0;
}

.input-suffix {
    padding: 0 12px 0 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    pointer-events: none;
    flex-shrink: 0;
}

.input-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.input-hint.tip {
    color: var(--blue);
}

.input-hint.warning {
    color: var(--amber);
}

/* === Inline Stats === */
.inline-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(212, 168, 67, 0.06);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(212, 168, 67, 0.12);
}

.inline-stat.hidden {
    display: none;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold);
}

.stat-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.stat-badge.good {
    background: rgba(46, 204, 113, 0.15);
    color: var(--emerald);
}

.stat-badge.warn {
    background: rgba(240, 180, 41, 0.15);
    color: var(--amber);
}

.stat-badge.bad {
    background: rgba(220, 53, 69, 0.15);
    color: var(--crimson);
}

/* === APR Reveal === */
.apr-reveal {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(212, 168, 67, 0.08);
    border: 1px solid rgba(212, 168, 67, 0.2);
    border-radius: var(--radius-sm);
    margin-top: 4px;
}

.apr-reveal.hidden {
    display: none;
}

.apr-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.apr-number {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    transition: color 0.3s ease, transform 0.5s ease;
    transform-origin: left center;
}

.apr-number.apr-green { color: var(--emerald); }
.apr-number.apr-amber { color: var(--amber); }
.apr-number.apr-orange { color: var(--orange); }
.apr-number.apr-red { color: var(--crimson); }

@keyframes aprReveal {
    0% {
        transform: scale(0.4);
        opacity: 0;
    }
    60% {
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.apr-number.animate {
    animation: aprReveal 0.6s ease-out forwards;
}

/* === Dealer Add-Ons === */
.addons-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-card);
}

.addons-section h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.addons-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 14px;
}

.addon-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    border: 1px solid transparent;
}

.addon-item:hover {
    background: var(--bg-card-hover);
}

.addon-item.checked {
    border-color: rgba(220, 53, 69, 0.3);
    background: rgba(220, 53, 69, 0.05);
}

.addon-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--crimson);
    cursor: pointer;
    flex-shrink: 0;
}

.addon-name {
    font-size: 0.88rem;
    color: var(--text-primary);
}

.addon-cost {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--crimson);
    white-space: nowrap;
}

.addon-warning {
    font-size: 0.72rem;
    color: var(--amber);
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition);
}

.addon-item.checked .addon-warning {
    opacity: 1;
}

.addon-markup-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(220, 53, 69, 0.12);
    color: var(--crimson);
    font-weight: 600;
}

.custom-addon-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
}

.custom-addon-row input[type="text"] {
    flex: 1;
    min-width: 140px;
}

.input-wrap.compact {
    flex: 0 0 120px;
}

.btn-add {
    padding: 10px 16px;
    background: var(--gold);
    color: var(--bg-deep);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--transition), transform 0.15s;
    white-space: nowrap;
}

.btn-add:hover {
    background: var(--gold-dim);
}

.btn-add:active {
    transform: scale(0.96);
}

/* === Fee Summary === */
.fee-summary {
    margin-top: 24px;
    padding: 20px;
    background: rgba(220, 53, 69, 0.04);
    border: 1px solid rgba(220, 53, 69, 0.15);
    border-radius: var(--radius-md);
}

.fee-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.fee-summary-row + .fee-summary-row {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.fee-summary-row.highlight {
    padding-top: 14px;
    margin-top: 6px;
    border-top: 2px solid rgba(220, 53, 69, 0.3);
    font-weight: 600;
    color: var(--text-primary);
}

.mono-value {
    font-family: var(--font-mono);
    font-weight: 600;
}

.fee-load-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* === Waterfall Layout === */
.waterfall {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 32px;
}

.waterfall-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-card);
    transition: border-color var(--transition);
}

.waterfall-step.result {
    border-left-color: var(--gold);
    background: rgba(212, 168, 67, 0.06);
}

.waterfall-label {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.waterfall-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.waterfall-step.result .waterfall-value {
    color: var(--gold);
    font-size: 1.1rem;
}

.waterfall-connector {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 2px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.waterfall-connector.add { color: var(--crimson); }
.waterfall-connector.subtract { color: var(--emerald); }
.waterfall-connector.result { color: var(--gold); font-size: 1rem; }

/* === Monthly Breakdown Grid === */
.monthly-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 28px;
}

.monthly-card {
    padding: 16px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.monthly-card.highlight-card {
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.08) 0%, rgba(212, 168, 67, 0.02) 100%);
    border-color: rgba(212, 168, 67, 0.3);
}

.monthly-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.monthly-value {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.monthly-value.big {
    font-size: 1.6rem;
    color: var(--gold);
}

.monthly-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    width: 0;
    transition: width 0.8s ease;
}

.monthly-bar.depreciation .bar-fill { background: var(--text-secondary); }
.monthly-bar.finance .bar-fill { background: var(--blue); }
.monthly-bar.tax .bar-fill { background: var(--amber); }
.monthly-bar.fees .bar-fill { background: var(--crimson); }

/* === Totals Grid === */
.totals-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.total-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
}

.total-card.big-total {
    background: linear-gradient(135deg, rgba(212, 168, 67, 0.1) 0%, rgba(212, 168, 67, 0.03) 100%);
    border-color: var(--gold);
    padding: 18px 16px;
}

.total-card.effective {
    background: rgba(74, 158, 255, 0.05);
    border-color: rgba(74, 158, 255, 0.3);
    flex-wrap: wrap;
}

.total-label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.total-value {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.big-total .total-label {
    color: var(--gold);
    font-weight: 700;
    font-size: 0.95rem;
}

.big-total .total-value {
    color: var(--gold);
    font-size: 1.4rem;
}

.effective .total-value {
    color: var(--blue);
}

.total-note {
    width: 100%;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.total-note em {
    color: var(--blue);
}

/* === Dealer Markup Detector === */
.benchmark-table-wrap {
    overflow-x: auto;
    margin: 20px 0;
    -webkit-overflow-scrolling: touch;
}

.benchmark-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.benchmark-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-card);
}

.benchmark-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-card);
    color: var(--text-primary);
}

.benchmark-table tr[data-tier].active-tier {
    background: rgba(212, 168, 67, 0.08);
    border-left: 3px solid var(--gold);
}

.benchmark-table tr[data-tier].active-tier td {
    color: var(--gold);
}

/* Markup Result */
.markup-result {
    padding: 20px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-card);
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.markup-result.hidden {
    display: none;
}

.markup-result.warning-pulse {
    border-color: var(--crimson);
    animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
    50% { box-shadow: 0 0 20px 4px rgba(220, 53, 69, 0.2); }
}

.markup-scanner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
}

.scanner-bar {
    width: 60px;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0% { transform: translateX(-60px); }
    100% { transform: translateX(calc(100vw + 60px)); }
}

.markup-verdict {
    font-size: 0.92rem;
    line-height: 1.7;
}

.markup-verdict .verdict-icon {
    font-size: 1.2rem;
    margin-right: 6px;
}

.markup-verdict .verdict-highlight {
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(212, 168, 67, 0.1);
    color: var(--gold);
}

.markup-verdict .verdict-bad {
    color: var(--crimson);
    background: rgba(220, 53, 69, 0.1);
}

.markup-verdict .verdict-good {
    color: var(--emerald);
    background: rgba(46, 204, 113, 0.1);
}

/* === APR Gauge === */
.apr-gauge-section {
    margin: 24px 0;
}

.apr-gauge-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.apr-gauge {
    position: relative;
    padding: 40px 0 30px;
}

.gauge-track {
    display: flex;
    height: 28px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.gauge-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.7);
    letter-spacing: 0.3px;
}

.gauge-zone.green { background: var(--emerald); }
.gauge-zone.amber { background: var(--amber); }
.gauge-zone.orange { background: var(--orange); }
.gauge-zone.red { background: var(--crimson); }

.gauge-marker {
    position: absolute;
    top: 6px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.6s ease;
    z-index: 2;
}

.gauge-marker .marker-line {
    width: 3px;
    height: 48px;
    background: var(--text-primary);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.gauge-marker .marker-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-card);
    margin-top: 4px;
    white-space: nowrap;
}

.gauge-marker.buy-rate .marker-line {
    background: var(--emerald);
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.4);
}

.gauge-marker.buy-rate .marker-label {
    color: var(--emerald);
    border-color: rgba(46, 204, 113, 0.3);
}

/* === Profit Estimate === */
.profit-estimate {
    margin-top: 24px;
}

.profit-estimate h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.profit-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.profit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
}

.profit-item.total {
    background: rgba(220, 53, 69, 0.05);
    border-color: rgba(220, 53, 69, 0.25);
}

.profit-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profit-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--crimson);
}

.profit-item.total .profit-label {
    color: var(--crimson);
    font-weight: 600;
}

/* === Comparison Table === */
.compare-inputs {
    margin-bottom: 24px;
}

.compare-inputs h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.compare-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.compare-table th {
    padding: 12px 14px;
    text-align: center;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-card);
}

.compare-table th:first-child {
    text-align: left;
}

.compare-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-card);
    text-align: center;
    color: var(--text-primary);
}

.compare-table td:first-child {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
}

.compare-table .row-highlight {
    background: rgba(212, 168, 67, 0.05);
}

.compare-table .row-highlight td {
    font-weight: 700;
}

.col-lease { color: var(--amber); }
.col-buy { color: var(--emerald); }
.col-finance { color: var(--blue); }

.compare-table td.winner {
    color: var(--emerald);
    position: relative;
}

.compare-table td.winner::after {
    content: '✓';
    margin-left: 6px;
    font-size: 0.85rem;
}

.compare-winner {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 600;
    margin: 16px 0;
    text-align: center;
}

.compare-winner.hidden {
    display: none;
}

.compare-winner.lease-wins {
    background: rgba(240, 180, 41, 0.08);
    border: 1px solid rgba(240, 180, 41, 0.25);
    color: var(--amber);
}

.compare-winner.buy-wins {
    background: rgba(46, 204, 113, 0.08);
    border: 1px solid rgba(46, 204, 113, 0.25);
    color: var(--emerald);
}

.compare-winner.finance-wins {
    background: rgba(74, 158, 255, 0.08);
    border: 1px solid rgba(74, 158, 255, 0.25);
    color: var(--blue);
}

.compare-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 12px;
}

/* === Charts === */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

.chart-card {
    padding: 20px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-card);
}

.chart-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* Stacked Bar */
.stacked-bar-chart {
    padding: 10px 0;
}

.stacked-bar-container {
    display: flex;
    height: 56px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
}

.stacked-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: width 0.8s ease;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.stacked-segment.depreciation { background: var(--text-secondary); }
.stacked-segment.finance { background: var(--blue); }
.stacked-segment.tax { background: var(--amber); }
.stacked-segment.fees { background: var(--crimson); }

.seg-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
    padding: 0 4px;
}

.seg-value {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}

/* Chart Legend */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot.depreciation { background: var(--text-secondary); }
.legend-dot.finance { background: var(--blue); }
.legend-dot.tax { background: var(--amber); }
.legend-dot.fees { background: var(--crimson); }
.legend-dot.down { background: var(--gold); }

/* Donut Chart */
.donut-chart-wrap {
    display: flex;
    justify-content: center;
}

.donut-chart {
    position: relative;
    width: 220px;
    height: 220px;
}

.donut-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.04);
    stroke-width: 24;
}

.donut-seg {
    fill: none;
    stroke-width: 24;
    stroke-dasharray: 0 502.65;
    transition: stroke-dasharray 1s ease;
}

.donut-seg.seg-depreciation { stroke: var(--text-secondary); }
.donut-seg.seg-finance { stroke: var(--blue); }
.donut-seg.seg-tax { stroke: var(--amber); }
.donut-seg.seg-fees { stroke: var(--crimson); }
.donut-seg.seg-down { stroke: var(--gold); }

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.donut-total-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.donut-total-value {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
}

/* === Negotiation Tips === */
.tips-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tip-placeholder {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.tip-item {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid;
    animation: tipSlideIn 0.3s ease-out forwards;
}

@keyframes tipSlideIn {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.tip-item.danger {
    background: rgba(220, 53, 69, 0.06);
    border-color: rgba(220, 53, 69, 0.2);
    color: var(--crimson);
}

.tip-item.warning {
    background: rgba(240, 180, 41, 0.06);
    border-color: rgba(240, 180, 41, 0.2);
    color: var(--amber);
}

.tip-item.info {
    background: rgba(74, 158, 255, 0.06);
    border-color: rgba(74, 158, 255, 0.2);
    color: var(--blue);
}

.tip-item.good {
    background: rgba(46, 204, 113, 0.06);
    border-color: rgba(46, 204, 113, 0.2);
    color: var(--emerald);
}

.tip-item.general {
    background: rgba(212, 168, 67, 0.06);
    border-color: rgba(212, 168, 67, 0.15);
    color: var(--text-secondary);
}

.tip-icon {
    margin-right: 6px;
    font-size: 1rem;
}

/* === Footer === */
.site-footer {
    position: relative;
    z-index: 1;
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid var(--border-card);
    margin-top: 40px;
}

.site-footer p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.footer-disclaimer {
    margin-top: 6px;
    font-style: italic;
}

/* ===========================================
   RESPONSIVE — TABLET (min-width: 640px)
   =========================================== */
@media (min-width: 640px) {
    .container {
        padding: 0 24px;
    }

    .form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .form-grid.cols-3 {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .monthly-grid {
        grid-template-columns: 1fr 1fr;
    }

    .totals-grid {
        grid-template-columns: 1fr 1fr;
    }

    .total-card.big-total,
    .total-card.effective {
        grid-column: 1 / -1;
    }

    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }

    .profit-grid {
        grid-template-columns: 1fr 1fr;
    }

    .profit-item.total {
        grid-column: 1 / -1;
    }
}

/* ===========================================
   RESPONSIVE — DESKTOP (min-width: 960px)
   =========================================== */
@media (min-width: 960px) {
    .container {
        padding: 0 32px;
    }

    .site-header {
        padding: 36px 0 28px;
    }

    .site-header h1 {
        font-size: 2.1rem;
    }

    .panel-header {
        padding: 28px 32px 18px;
    }

    .panel-body {
        padding: 28px 32px;
    }

    .panel-header h2 {
        font-size: 1.5rem;
    }

    .ad-mobile {
        display: none;
    }

    .ad-desktop {
        display: flex;
    }

    .monthly-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .monthly-card.highlight-card {
        grid-column: 1 / -1;
    }

    .addon-item {
        grid-template-columns: auto 1fr auto auto auto;
    }

    .donut-chart {
        width: 260px;
        height: 260px;
    }

    .donut-total-value {
        font-size: 1.4rem;
    }
}

/* === Utility — Hidden === */
.hidden {
    display: none !important;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--border-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === Selection === */
::selection {
    background: rgba(212, 168, 67, 0.25);
    color: var(--text-primary);
}
