/* Oswald — bundled locally (21KB, latin subset). No external CDN dependency,
   works fully offline. Variable-weight font covers both 600 and 700. */
@font-face {
    font-family: 'Oswald';
    font-style: normal;
    font-weight: 600 700;
    font-display: swap;
    src: url('/_content/IntelliCarCheck.Shared/fonts/oswald-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-2: #1e2230;
    --border: #2a2f3d;
    --text: #e8ecf3;
    --text-dim: #9aa3b2;
    --accent: #4dabf7;
    --accent-2: #74c0fc;
    --green: #37b24d;
    --amber: #f59f00;
    --red: #e03131;
    --purple: #ae3ec9;
    --radius: 14px;
}

* { box-sizing: border-box; }

/* Blazor error UI — lives OUTSIDE .app-shell so safe-area on the shell
   doesn't reach it. Add bottom padding to clear the Android gesture bar
   / iPhone home indicator, otherwise the dismiss ✕ isn't tappable. */
#blazor-error-ui {
    padding: 12px 14px calc(max(env(safe-area-inset-bottom), 12px) + 4px);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c1a1a;
    color: #ffd6d6;
    border-top: 1px solid rgba(255, 140, 140, 0.4);
    display: none;
    z-index: 1000;
    font-size: 13px;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    padding: 4px 10px;
    float: right;
    font-size: 18px;
}
#blazor-error-ui .reload { color: #ffa8a8; font-weight: 700; text-decoration: underline; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    max-width: 780px;
    margin: 0 auto;
    /* Respect iOS and Android notches / status / nav bars. The MAUI
       WebView sets viewport-fit=cover, so without env() padding the
       header and footer slide under system chrome. */
    padding:
        max(env(safe-area-inset-top),  8px)
        max(env(safe-area-inset-right), 12px)
        max(env(safe-area-inset-bottom), 8px)
        max(env(safe-area-inset-left),  12px);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 4px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

/* Narrow screens — auth links shrink and the whole row wraps so the
   Create account button never falls off-screen. */
@media (max-width: 480px) {
    .app-header { padding: 14px 0 10px; gap: 8px; }
    .auth-nav { gap: 6px; }
    .auth-link { padding: 5px 10px; font-size: 12px; }
    .auth-email { display: none; }   /* Hide email on tiny screens; identity still shown on /history */
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

/* Auth nav — sits on the right of the header; on narrow screens the header
   wraps but the buttons stay tap-friendly. Keeps out of the way when the
   user is anonymous, becomes the identity hook when signed in. */
.auth-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.auth-email {
    color: var(--text-dim);
    font-size: 12.5px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.auth-link {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 6px 12px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.4;
}
.auth-link:hover { border-color: var(--accent); color: var(--accent); }
.auth-link-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #001019;
    font-weight: 700;
}
.auth-link-primary:hover { color: #001019; opacity: 0.9; }

/* History page — a list of saved checks with quick controls per row. */
.history-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.history-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}
.history-open {
    flex: 1 1 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
    padding: 0;
}
.history-plate-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.history-plate { flex-shrink: 0; }
.history-verdict {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.4;
    background: rgba(0,0,0,0.25);
}
.history-verdict.rec-buy { color: #8ce99a; background: rgba(140,233,154,0.10); }
.history-verdict.rec-mid { color: #ffd43b; background: rgba(255,212,59,0.10); }
.history-verdict.rec-walk { color: #ff8787; background: rgba(255,135,135,0.10); }
.history-meta { color: var(--text); font-size: 13.5px; line-height: 1.5; }
.history-nickname { font-style: italic; color: var(--text-dim); margin-bottom: 2px; }
.history-model { font-weight: 600; }
.history-numbers { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.history-sep { margin: 0 4px; opacity: 0.5; }
.history-pill {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.history-pill.green { color: #8ce99a; border-color: rgba(55, 178, 77, 0.5); }
.history-pill.amber { color: #ffd43b; border-color: rgba(245, 159, 0, 0.5); }
.history-pill.red   { color: #ffa8a8; border-color: rgba(224, 49, 49, 0.5); }
.history-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: flex-start;
}
.history-action {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
}
.history-action:hover { color: var(--accent); border-color: var(--accent); }
.history-action-danger:hover { color: #ff8787; border-color: rgba(255,135,135,0.5); }
.history-rename {
    display: flex;
    gap: 8px;
    flex-basis: 100%;
    align-items: center;
}
.history-rename-input {
    flex: 1;
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
}
.history-rename-input:focus { outline: none; border-color: var(--accent); }
.history-rename-save { padding: 6px 14px; font-size: 13px; }
.history-empty {
    padding: 18px 4px;
    color: var(--text-dim);
    font-size: 14px;
    text-align: center;
}

/* Folder picker in each history row */
.history-folder-picker {
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    max-width: 160px;
}
.history-folder-picker:focus { outline: none; border-color: var(--accent); }

/* Create-folder bar on /folders */
.folder-create {
    display: flex;
    gap: 8px;
    margin: 12px 0 16px;
}
.folder-create .history-rename-input { flex: 1; }

/* Comparison page */
.compare-winner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    background: var(--panel-2);
    border: 1px solid var(--green);
    border-radius: 10px;
    margin-top: 8px;
}
.compare-winner-trophy { font-size: 32px; line-height: 1; }
.compare-winner-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}
.compare-winner-reasoning {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}
.compare-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.compare-row {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    align-items: start;
}
.compare-row-winner {
    border-color: var(--green);
    background: var(--panel-2);
}
.compare-rank {
    font-weight: 700;
    font-size: 20px;
    color: var(--text-dim);
}
.compare-body { display: flex; flex-direction: column; gap: 4px; }
.compare-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.compare-points {
    margin: 6px 0 0;
    padding-left: 18px;
    font-size: 13px;
    color: var(--text-dim);
}
.compare-points li { margin-bottom: 2px; }
.compare-actions { align-self: center; }

.history-back { margin: 0 0 10px; font-size: 13.5px; }
.history-back a { color: var(--accent); text-decoration: none; }
.history-back a:hover { text-decoration: underline; }

.saved-check-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: rgba(77, 171, 247, 0.08);
    border: 1px solid rgba(77, 171, 247, 0.30);
}
.saved-check-banner-icon { font-size: 22px; line-height: 1; padding-top: 2px; }
.saved-check-banner-title { font-weight: 700; color: #a5d8ff; }
.saved-check-banner-text { color: var(--text); font-size: 13.5px; margin-top: 2px; }

/* Auth pages (login / register) — narrow card centred in the main area. */
.auth-card { max-width: 420px; margin: 8px auto; }
.auth-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}
.auth-footer a { color: var(--accent); text-decoration: none; margin-left: 4px; }
.auth-footer a:hover { text-decoration: underline; }
.brand-icon {
    font-size: 32px;
    line-height: 1;
}
.brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.2px;
}
.brand-sub {
    font-size: 12px;
    color: var(--text-dim);
}

.app-main {
    flex: 1;
    padding: 8px 0 24px;
}

.app-footer {
    padding: 12px 4px;
    color: var(--text-dim);
    font-size: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}
.app-footer-nav {
    display: flex;
    gap: 6px;
    align-items: center;
}
.app-footer-nav a {
    color: var(--text-dim);
    text-decoration: none;
}
.app-footer-nav a:hover { color: var(--text); text-decoration: underline; }
.app-footer-sep { color: var(--text-dim); opacity: 0.6; }

/* Legal pages (/terms, /privacy, /cookies) */
.legal-page h3 {
    margin-top: 20px;
    margin-bottom: 8px;
    font-size: 15px;
}
.legal-page p, .legal-page ul {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
}
.legal-page ul { padding-left: 20px; }
.legal-page li { margin-bottom: 4px; }
.legal-meta {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.legal-review { margin: 10px 0 20px; }
.legal-table {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin: 12px 0;
}
.legal-row {
    display: grid;
    grid-template-columns: 1.3fr 3fr 1fr 1.2fr;
    gap: 10px;
    padding: 10px 12px;
    font-size: 13px;
    border-top: 1px solid var(--border);
    align-items: start;
}
.legal-row:first-child { border-top: none; }
.legal-row-head {
    background: var(--panel-2);
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
}
.legal-row code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    background: var(--panel-2);
    padding: 1px 5px;
    border-radius: 4px;
}
@media (max-width: 640px) {
    .legal-row { grid-template-columns: 1fr; }
    .legal-row-head { display: none; }
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
}

.card h2, .card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
}

.card .card-hint {
    color: var(--text-dim);
    font-size: 12px;
    margin: -4px 0 10px;
}

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0;
}

.field label {
    font-size: 13px;
    color: var(--text-dim);
}

.field input, .field select {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 16px;
    outline: none;
    /* Tells the browser to render native widgets (the dropdown panel, the
       scrollbar inside it, date-picker chrome, etc.) in dark mode. Without
       this, the open <select> list falls back to white-on-white on Windows
       Chrome / Edge and the options are invisible. */
    color-scheme: dark;
}
/* Belt-and-braces for Firefox and older browsers that don't fully honour
   color-scheme on <option>: explicitly style the option list. */
.field select option,
.condition-row select option {
    background: var(--panel-2);
    color: var(--text);
}

/* Recent-work section inside the condition card — buyer ticks maintenance
   items the seller has recently done and each adds £ back to the ceiling. */
.recent-work-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.recent-work-section h3 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
}
.recent-work-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 10px;
}
@media (min-width: 520px) {
    .recent-work-grid { grid-template-columns: 1fr 1fr; }
}
.recent-work-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.recent-work-item input[type=checkbox] { width: 16px; height: 16px; }
.recent-work-item .rw-label { }
.recent-work-item .rw-credit { color: #8ce99a; font-weight: 700; font-size: 13px; }
.recent-work-summary {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(55, 178, 77, 0.1);
    border: 1px solid rgba(55, 178, 77, 0.4);
    border-radius: 8px;
    color: #8ce99a;
    font-size: 13px;
    font-weight: 600;
}

/* Model-specific wear items (Known-for-this-model section) */
.wear-item-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
}
.wear-item {
    padding: 10px 12px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.wear-item.triggered {
    border-color: rgba(255, 212, 59, 0.5);
    background: rgba(255, 212, 59, 0.06);
}
.wear-item-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.wear-item-title { font-weight: 700; font-size: 14px; }
.wear-item-trigger { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.wear-item.triggered .wear-item-trigger { color: #ffd43b; }
.wear-item-credit { color: #8ce99a; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.wear-item select { margin-top: 8px; width: 100%; color-scheme: dark; }

.field input:focus, .field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.15);
}

/* UK number plate styling for the registration input.
   Yellow-ochre (#ffcc00) background with a blue GB identifier flash on the left.
   Font uses Google Fonts' "Oswald" as a bold, boxy substitute for Charles Wright —
   loaded from the CSP-approved fonts.googleapis.com. Falls back to Impact / Arial
   Black for offline / restricted environments. */
.reg-field { align-items: center; }

.reg-plate {
    display: inline-flex;
    align-items: stretch;
    background: #ffcc00;
    border: 3px solid #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 0 rgba(0,0,0,0.4);
    max-width: 340px;
    margin: 0 auto;
}
.reg-plate-gb {
    background: #003399;
    color: #ffcc00;
    font-family: -apple-system, 'Segoe UI', sans-serif;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 1px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    border-right: 2px solid rgba(0,0,0,0.4);
}
.reg-plate-input.reg-plate-input {
    /* double-class specificity to override the generic .field input styling */
    flex: 1;
    min-width: 0;
    background: #ffcc00;
    color: #000;
    border: none;
    border-radius: 0;
    padding: 10px 14px 8px;
    font-family: 'Oswald', 'Charles Wright', 'UKNumberPlate', 'Impact', 'Arial Black', 'Helvetica Neue', sans-serif;
    font-weight: 700;
    font-size: 34px;
    line-height: 1;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-align: center;
    outline: none;
    box-shadow: none;
    /* Slight text-shadow to sharpen edges of any fallback font on low-DPI displays */
    text-shadow: 0 0 1px rgba(0,0,0,0.4);
}
.reg-plate-input.reg-plate-input::placeholder {
    color: rgba(0,0,0,0.3);
    font-weight: 600;
    letter-spacing: 4px;
}
.reg-plate-input.reg-plate-input:focus {
    background: #ffd633;
    box-shadow: none;
}
.reg-plate:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.35), 0 3px 0 rgba(0,0,0,0.4);
}

/* Compact display-only variant of the plate, used in the vehicle summary card. */
.reg-plate-mini {
    display: inline-flex;
    align-items: stretch;
    background: #ffcc00;
    border: 2px solid #000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 0 rgba(0,0,0,0.35);
    line-height: 1;
    vertical-align: middle;
}
.reg-plate-mini .reg-plate-gb {
    font-size: 10px;
    padding: 0 6px;
    min-width: 22px;
    border-right: 1.5px solid rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
}
.reg-plate-mini-text {
    color: #000;
    font-family: 'Oswald', 'Charles Wright', 'UKNumberPlate', 'Impact', 'Arial Black', 'Helvetica Neue', sans-serif;
    font-weight: 700;
    font-size: 18px;
    line-height: 1;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 5px 10px 4px;
    text-shadow: 0 0 1px rgba(0,0,0,0.4);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #0b1220;
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}

.btn:hover { background: var(--accent-2); }
.btn[disabled] { opacity: 0.6; cursor: default; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    white-space: nowrap;
}

.badge.green { background: rgba(55, 178, 77, 0.15); color: #8ce99a; border-color: rgba(55, 178, 77, 0.4); }
.badge.amber { background: rgba(245, 159, 0, 0.15); color: #ffd43b; border-color: rgba(245, 159, 0, 0.4); }
.badge.red   { background: rgba(224, 49, 49, 0.15); color: #ffa8a8; border-color: rgba(224, 49, 49, 0.4); }
.badge.info  { background: rgba(77, 171, 247, 0.15); color: #a5d8ff; border-color: rgba(77, 171, 247, 0.4); }
.badge.dim   { color: var(--text-dim); }

/* "due 1 Jan 2027" caption that sits next to the tax status badge in
   the vehicle summary card — subtle, so the status itself leads the eye. */
.tax-due {
    margin-left: 8px;
    color: var(--text-dim);
    font-size: 12.5px;
}

/* "Add physical condition" card — three stacked rows with a label on the
   left and a full-width select on the right. On mobile it collapses to a
   single column so the selects stay comfortably tappable. */
.condition-card { border-left: 3px solid var(--accent); }
.condition-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.condition-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: 10px;
}
.condition-row label { color: var(--text-dim); font-size: 13.5px; }
.condition-row select {
    width: 100%;
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13.5px;
    font-family: inherit;
    color-scheme: dark;
}
.condition-row select:focus { outline: none; border-color: var(--accent); }
@media (max-width: 420px) {
    .condition-row { grid-template-columns: 1fr; gap: 4px; }
}
.condition-applied {
    margin-top: 12px;
    padding: 8px 10px;
    background: rgba(140, 233, 154, 0.08);
    border-left: 3px solid #8ce99a;
    border-radius: 4px;
    color: #8ce99a;
    font-size: 13px;
    line-height: 1.5;
}

/* Price-ceiling block in the Buying risk estimate card. The traffic-light
   border reflects asking price vs ceiling: green deep below, amber slightly
   over, red significantly over. The breakdown collapses so the main view
   stays legible but the chain is one click away. */
.ceiling-block {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}
.ceiling-block.ceiling-deep { border-left-color: #8ce99a; }
.ceiling-block.ceiling-low  { border-left-color: #8ce99a; }
.ceiling-block.ceiling-mid  { border-left-color: #ffd43b; }
.ceiling-block.ceiling-high { border-left-color: #ff8787; }
.ceiling-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.ceiling-label { font-weight: 700; }
.ceiling-value { font-weight: 700; font-size: 17px; }
.ceiling-ratio { margin-top: 6px; color: var(--text-dim); font-size: 13.5px; }
.ceiling-ratio strong { color: var(--text); }
.ceiling-breakdown { margin-top: 8px; }
.ceiling-breakdown summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 13px;
    user-select: none;
}
.ceiling-breakdown ul {
    margin: 6px 0 0 0;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-dim);
}
.ceiling-breakdown ul strong { color: var(--text); }
.ceiling-caveat {
    margin-top: 8px;
    font-size: 12px;
    font-style: italic;
    color: var(--text-dim);
    line-height: 1.5;
}
.ceiling-caveat strong { font-style: normal; }

.pill {
    display: inline-block;
    background: var(--panel-2);
    color: var(--text-dim);
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    margin-right: 4px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 12px;
    margin: 4px 0 6px;
}
.grid .k { color: var(--text-dim); font-size: 12px; }
.grid .v { font-weight: 600; }

.score-hero {
    display: flex;
    align-items: center;
    gap: 16px;
}
.score-hero .score-num {
    font-size: 44px;
    font-weight: 800;
    line-height: 1;
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    min-width: 110px;
    text-align: center;
}
.score-hero .score-num.green { color: #8ce99a; border-color: rgba(55, 178, 77, 0.5); }
.score-hero .score-num.amber { color: #ffd43b; border-color: rgba(245, 159, 0, 0.5); }
.score-hero .score-num.red   { color: #ffa8a8; border-color: rgba(224, 49, 49, 0.5); }
.score-hero .score-meta { flex: 1; }
.score-hero .score-band { font-weight: 700; font-size: 14px; }
.score-hero .score-rec { color: var(--text-dim); font-size: 13px; }

/* Dual-score pills — Risk + Deal, side by side */
.dual-score {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.dual-score-pill {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
}
.dual-score-pill .pill-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}
.dual-score-pill .pill-num {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 2px;
}
.dual-score-pill .pill-num .pill-max { font-size: 16px; color: var(--text-dim); font-weight: 600; }
.dual-score-pill .pill-band {
    font-size: 12px;
    font-weight: 700;
    margin-top: 2px;
}
.dual-score-pill .pill-help {
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--text-dim);
    margin-top: 10px;
    text-align: left;
    font-weight: 400;
}
.dual-score-pill .pill-help em { color: var(--text); font-style: normal; font-weight: 600; }
.dual-score-pill.green { border-color: rgba(55, 178, 77, 0.5); }
.dual-score-pill.green .pill-num, .dual-score-pill.green .pill-band { color: #8ce99a; }
.dual-score-pill.amber { border-color: rgba(245, 159, 0, 0.5); }
.dual-score-pill.amber .pill-num, .dual-score-pill.amber .pill-band { color: #ffd43b; }
.dual-score-pill.red   { border-color: rgba(224, 49, 49, 0.5); }
.dual-score-pill.red   .pill-num, .dual-score-pill.red   .pill-band { color: #ffa8a8; }
.score-rec { font-size: 14px; }

/* Seller first-contact message card */
.seller-message {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    resize: vertical;
    box-sizing: border-box;
    color-scheme: dark;
}
.seller-message-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}
.btn-copy {
    background: var(--accent, #4c6ef5);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-copy:hover { filter: brightness(1.1); }
.btn-copy.copied { background: #37b24d; }

.rec-buy   { color: #8ce99a; }
.rec-mid   { color: #ffd43b; }
.rec-walk  { color: #ffa8a8; }

.timeline {
    margin: 0;
    padding: 0;
    list-style: none;
}

.timeline > li {
    position: relative;
    border-left: 2px solid var(--border);
    padding: 6px 0 14px 16px;
    margin-left: 4px;
}
.timeline > li::before {
    content: "";
    position: absolute;
    top: 8px;
    left: -6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}
.timeline > li.pass::before { background: var(--green); }
.timeline > li.fail::before { background: var(--red); }

.timeline .t-date { font-weight: 700; }
.timeline .t-meta { color: var(--text-dim); font-size: 12px; margin: 2px 0; }
.timeline .t-defects { margin: 6px 0 0; padding-left: 18px; }
.timeline .t-defects li { margin: 2px 0; }
.timeline .t-defects.adv li { color: var(--text-dim); }
.timeline .t-defects.fail li { color: #ffa8a8; }
.timeline .t-repeat { color: var(--amber); font-size: 12px; margin-top: 4px; }

.issue {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    margin: 8px 0;
    transition: opacity 0.15s;
}
.issue.dimmed {
    opacity: 0.45;
    background: transparent;
}
.issue.dimmed .issue-title,
.issue.dimmed .issue-desc,
.issue.dimmed .issue-explain {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}
.issue.dimmed .badge:not(.green),
.issue.dimmed .pill {
    opacity: 0.7;
}
.issue.dimmed .declared-toggle {
    opacity: 1;
    color: var(--text);
}
.issue .issue-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.issue .issue-title { font-weight: 700; }
.issue .issue-desc { color: var(--text-dim); font-size: 13px; }
.issue .issue-explain { margin-top: 6px; font-size: 13px; }

/* Sticky score bar + quick-jump chip nav. Appears at the top of the viewport once
   the exec summary scrolls past, keeps the verdict always visible. */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 17, 21, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    margin: 12px -12px 12px;
    padding: 10px 12px;
}
.sticky-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow-x: auto;
}
.sticky-line .sticky-score {
    color: var(--text-dim);
    font-weight: 700;
}

.jump-chips {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.jump-chips::-webkit-scrollbar { display: none; }

.jump-chip {
    flex: 0 0 auto;
    padding: 5px 12px;
    background: var(--panel-2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.jump-chip:hover, .jump-chip:focus {
    color: var(--text);
    border-color: var(--accent);
    text-decoration: none;
}
.jump-chip.active {
    color: #0b1220;
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 700;
}

/* Anchor-scroll offset so sticky header doesn't cover section titles */
[id^="section-"] { scroll-margin-top: 96px; }

/* Executive summary card at the top of the report */
.exec-summary {
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
}
.exec-verdict-line {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}
.exec-verdict-line .exec-score {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px 10px;
    font-size: 16px;
    color: var(--text-dim);
}
.exec-verdict-line .exec-score.green { color: #8ce99a; border-color: rgba(55, 178, 77, 0.4); }
.exec-verdict-line .exec-score.amber { color: #ffd43b; border-color: rgba(245, 159, 0, 0.4); }
.exec-verdict-line .exec-score.red   { color: #ffa8a8; border-color: rgba(224, 49, 49, 0.4); }
.exec-summary .exec-line {
    color: var(--text-dim);
    font-size: 14px;
}
.exec-summary .exec-line strong { color: var(--text); }
.exec-summary .exec-flag {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
}
.exec-summary .exec-flag .exec-dot { font-size: 10px; }

/* Collapse controls for long lists (MOT history, checklist sections) */
.collapse-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
}
.collapse-toggle:hover { text-decoration: underline; }

.checklist-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}
.checklist-section-header .chev {
    color: var(--text-dim);
    font-size: 14px;
    transition: transform 0.15s;
}
.checklist-section-header.expanded .chev { transform: rotate(90deg); }

.declared-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
}
.declared-toggle input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--green);
    cursor: pointer;
}

.flag-list { margin: 8px 0 0; padding-left: 20px; }
.flag-list li { margin: 4px 0; }
.flag-list.red li { color: #ffa8a8; }
.flag-list.amber li { color: #ffd43b; }
.flag-list.green li { color: #8ce99a; }

.checklist { margin: 0; padding: 0; list-style: none; }
.checklist > li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--border);
}
.checklist > li:last-child { border-bottom: 0; }
.checklist input[type=checkbox] {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}
.checklist .ci-detail { color: var(--text-dim); font-size: 12px; }

.repair-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.repair-row:last-child { border-bottom: 0; }
.repair-row .r-title { font-weight: 600; }
.repair-row .r-range { font-weight: 700; }
.repair-row .r-desc { color: var(--text-dim); font-size: 12px; grid-column: 1 / -1; }
.repair-row .r-override {
    grid-column: 1 / -1;
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
}
.repair-row .r-override input {
    width: 100px;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
}

.negotiation-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin: 8px 0;
}
.negotiation-box .k { color: var(--text-dim); font-size: 12px; }
.negotiation-box .v { font-weight: 700; }

/* Negotiation ladder — one row per price, action-focused label on the left
   and the number on the right so it's obvious which value belongs to which. */
.neg-ladder {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 0;
    margin: 8px 0;
}
.neg-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.neg-row:last-child { border-bottom: none; }

.neg-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.neg-role { font-weight: 700; font-size: 14px; color: var(--text); }
.neg-hint { font-size: 12px; color: var(--text-dim); line-height: 1.3; }
.neg-price { font-weight: 800; font-size: 20px; white-space: nowrap; letter-spacing: -0.3px; }

/* Role-based tints so the four rows read as distinct roles at a glance */
.neg-row.neg-asking { border-left: 3px solid var(--text-dim); }
.neg-row.neg-asking .neg-price { color: var(--text-dim); }

.neg-row.neg-opening { border-left: 3px solid var(--accent); background: rgba(77,171,247,0.06); }
.neg-row.neg-opening .neg-price { color: #a5d8ff; }

.neg-row.neg-target { border-left: 3px solid var(--green); background: rgba(55,178,77,0.06); }
.neg-row.neg-target .neg-price { color: #8ce99a; }

.neg-row.neg-max { border-left: 3px solid var(--amber); }
.neg-row.neg-max .neg-price { color: #ffd43b; }

.script {
    background: rgba(77, 171, 247, 0.08);
    border: 1px solid rgba(77, 171, 247, 0.3);
    border-radius: 12px;
    padding: 12px;
    color: var(--text);
    font-style: italic;
    margin-top: 8px;
    white-space: pre-wrap;
}

.recall-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(180deg, rgba(224, 49, 49, 0.15) 0%, rgba(224, 49, 49, 0.08) 100%);
    border: 1px solid rgba(224, 49, 49, 0.6);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 12px 0;
}
.recall-banner .recall-icon {
    font-size: 26px;
    line-height: 1;
    padding-top: 2px;
}
.recall-banner .recall-title {
    font-size: 16px;
    font-weight: 800;
    color: #ffa8a8;
    margin-bottom: 4px;
}
.recall-banner .recall-text {
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
.recall-banner a { color: #ffa8a8; text-decoration: underline; }

/* Recall campaign detail — surfaced when we can match the DVSA outstanding
   flag to a specific campaign in the OGL recalls dataset. Tightly grouped
   under the main banner so it reads as one thought, but tinted a shade
   softer so the top-level warning still dominates. */
.recall-campaigns {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 107, 107, 0.06);
    border: 1px solid rgba(255, 107, 107, 0.25);
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.5;
}
.recall-campaigns-title {
    font-weight: 700;
    color: #ffc9c9;
    margin-bottom: 8px;
    font-size: 14px;
}
.recall-campaigns-count {
    font-weight: 500;
    color: rgba(255, 201, 201, 0.7);
    font-size: 12.5px;
    margin-left: 4px;
}
/* The "at least one is outstanding" caveat. Sits just under the title so
   it's read before the first campaign card — the honest framing that
   stops the buyer assuming ALL of these are still open. */
.recall-campaigns-caveat {
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.20);
    border-left: 3px solid rgba(255, 201, 201, 0.5);
    border-radius: 4px;
}
.recall-campaigns-caveat strong { color: #ffd0d0; }

/* "Find nearest dealer" action row inside the recall block. Big, tappable,
   red-tinted so it stands out from the surrounding neutral text and reads as
   the primary next step from the recall panel. */
.recall-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.recall-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: rgba(255, 135, 135, 0.15);
    border: 1px solid rgba(255, 135, 135, 0.55);
    border-radius: 8px;
    color: #ffd0d0;
    text-decoration: none;
    font-weight: 700;
    font-size: 14.5px;
    line-height: 1.2;
    transition: background 120ms ease, border-color 120ms ease;
}
.recall-action-btn:hover,
.recall-action-btn:focus-visible {
    background: rgba(255, 135, 135, 0.25);
    border-color: #ff8787;
    color: #ffe3e3;
    outline: none;
}
.recall-action-hint {
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.5;
    padding: 0 2px;
}

/* Phone numbers detected inside prose Defect/Remedy text become tel:
   links — style them subtly (dashed underline) so they read as tappable
   without shouting. */
.recall-phone {
    color: inherit;
    text-decoration: underline dashed;
    text-underline-offset: 3px;
    font-variant-numeric: tabular-nums;
}
.recall-phone:hover { color: #ffe3e3; }
.recall-campaign {
    padding: 8px 0;
    border-top: 1px dashed rgba(255, 107, 107, 0.25);
}
.recall-campaign:first-of-type { border-top: none; padding-top: 0; }
.recall-campaign-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.recall-campaign-ref {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-weight: 700;
    color: #ffe3e3;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
}
.recall-campaign-date {
    color: rgba(255, 201, 201, 0.7);
    font-size: 12.5px;
}
.recall-campaign-concern {
    color: #ffd0d0;
    font-weight: 600;
    margin: 6px 0 4px;
}
.recall-campaign-detail {
    color: var(--text);
    margin-top: 3px;
}
.recall-campaigns-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 107, 107, 0.2);
    color: rgba(255, 201, 201, 0.65);
    font-size: 12px;
    font-style: italic;
}

.data-warning {
    background: rgba(245, 159, 0, 0.10);
    border: 1px solid rgba(245, 159, 0, 0.4);
    border-radius: 10px;
    padding: 10px 12px;
    color: #ffd43b;
    font-size: 13px;
    margin: 8px 0;
}

.verdict {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
}
.verdict h2 {
    margin-top: 0;
    font-size: 18px;
}
.verdict .verdict-line {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
    margin: 4px 0 12px;
}

@media (min-width: 720px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
    .negotiation-box { grid-template-columns: repeat(4, 1fr); }
}
