/*
 * Vehicle Condition Score: badge (list cards) and "Vehicle condition" section (details page).
 * Shared by the trader website and the trader app. Drawn by /assets/js/condition-score.js.
 * Colours are never the only signal: every state also has text and an icon. Tokens follow public_html/style.md.
 */

/* ---------- badge + warnings on the list cards ---------- */
.cs-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0; font-family: 'Poppins', sans-serif; }
.cs-badge {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; max-width: 100%; box-sizing: border-box;
  min-height: 34px; padding: 5px 12px; border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-weight: 600; line-height: 1.4; color: #0d131c; background: #f1f5f9;
}
.cs-badge-car { flex: none; font-size: 18px; }
.cs-badge-main { font-weight: 700; }
.cs-badge-label { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.cs-badge-label i { font-size: 16px; }
.cs-badge-partial {
  display: inline-flex; align-items: center; padding: 1px 8px; border: 1px dashed currentColor; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5; background: rgba(255, 255, 255, 0.65);
}
.cs-badge--very_good { background: #dcfce7; border-color: #86efac; color: #14532d; }
.cs-badge--good { background: #fdf6dc; border-color: #ecc95c; color: #5f4300; }
.cs-badge--attention { background: #ffedd5; border-color: #fdba74; color: #7c2d12; }
.cs-badge--significant { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.cs-badge--none { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }

.cs-flag {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; border-radius: 10px;
  font-size: 14px; font-weight: 500; line-height: 1.4;
}
.cs-flag i { flex: none; font-size: 18px; }
.cs-flag--danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; font-weight: 600; }
.cs-flag--warn { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; font-weight: 600; }   /* a fault: red */
.cs-flag--info { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }   /* an older corrosion advisory is still a recorded fault: red */

/* ---------- details page section ---------- */
.cs-sec {
  box-sizing: border-box; margin: 0 0 20px; padding: 20px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  font-family: 'Poppins', sans-serif; color: #0d131c; text-align: left;
}
.cs-sec *, .cs-sec *::before, .cs-sec *::after { box-sizing: border-box; }
.cs-sec-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; margin-bottom: 20px; }
.cs-sec-head h3 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.25; color: #0d131c; }
.cs-sec-sub { margin: 4px 0 0; font-size: 14px; font-weight: 500; line-height: 1.5; color: #475569; }
.cs-indicative { padding: 2px 10px; border: 1px solid #cbd5e1; border-radius: 999px; font-size: 13px; font-weight: 500; color: #475569; background: #f5f7f9; }

.cs-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.cs-ring { position: relative; flex: none; width: 148px; height: 148px; }
.cs-ring svg { display: block; width: 100%; height: 100%; }
.cs-ring-track { fill: none; stroke: #e5e7eb; stroke-width: 10; }
.cs-ring-fill { fill: none; stroke: #c8860d; stroke-width: 10; stroke-linecap: round; }
.cs-ring--very_good .cs-ring-fill { stroke: #15803d; }
.cs-ring--good .cs-ring-fill { stroke: #c8860d; }
.cs-ring--attention .cs-ring-fill { stroke: #c2410c; }
.cs-ring--significant .cs-ring-fill { stroke: #dc2626; }
.cs-ring--none .cs-ring-track { stroke-dasharray: 5 6; stroke: #cbd5e1; }
.cs-ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.cs-ring-text strong { font-size: 46px; font-weight: 700; line-height: 1; color: #0d131c; }
.cs-ring-text span { margin-top: 4px; font-size: 15px; font-weight: 500; color: #475569; }

/* "10.0" is one character wider than "8.0": a little smaller so it still sits inside the ring */
.cs-ring--long .cs-ring-text strong { font-size: 38px; }

.cs-sum-text { flex: 1 1 240px; min-width: 0; }
.cs-sum-label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; line-height: 1.3; color: #0d131c; }
.cs-summary { margin: 6px 0 0; font-size: 14px; font-weight: 500; line-height: 1.5; color: #475569; }
.cs-sum-label i { font-size: 24px; }
.cs-sum-label--very_good i { color: #15803d; }
.cs-sum-label--good i { color: #a86a00; }
.cs-sum-label--attention i { color: #c2410c; }
.cs-sum-label--significant i { color: #dc2626; }
.cs-sum-label--none i { color: #64748b; }
.cs-complete { margin-top: 6px; font-size: 14px; font-weight: 500; color: #0d131c; }
.cs-complete-sub { color: #475569; }
.cs-complete-bar { height: 6px; margin-top: 6px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.cs-complete-bar span { display: block; height: 100%; border-radius: 999px; background: #475569; }
.cs-sum-note { margin: 8px 0 0; font-size: 13px; font-weight: 500; line-height: 1.5; color: #475569; }

.cs-alerts { display: grid; gap: 10px; margin-top: 16px; }
.cs-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 14px; font-weight: 500; line-height: 1.5; }
.cs-alert i { flex: none; font-size: 22px; line-height: 1.2; }
.cs-alert strong { font-weight: 700; }
.cs-alert--danger { background: #fee2e2; border-color: #f87171; color: #7f1d1d; }
.cs-alert--danger i { color: #dc2626; }
.cs-alert--warn { background: #ffedd5; border-color: #fdba74; color: #7c2d12; }
.cs-alert--warn i { color: #c2410c; }
.cs-alert--info { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }
.cs-alert--info i { color: #2563eb; }

/* how the score is worked out: base - mileage - age = score */
.cs-calc { margin-top: 16px; padding: 12px 14px; background: #f5f7f9; border: 1px solid #e2e8f0; border-radius: 10px; }
.cs-calc-title { margin-bottom: 8px; font-size: 14px; font-weight: 600; line-height: 1.4; color: #0d131c; }
.cs-calc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.cs-calc-term { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 64px; padding: 6px 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; }
.cs-calc-k { font-size: 12px; font-weight: 500; line-height: 1.3; color: #475569; }
.cs-calc-term strong { font-size: 18px; font-weight: 700; line-height: 1.3; color: #0d131c; }
.cs-calc-term--ded strong { color: #991b1b; }
.cs-calc-term--nil strong { color: #475569; }
.cs-calc-term--final { background: #0d131c; border-color: #0d131c; }
.cs-calc-term--final .cs-calc-k { color: #cbd5e1; }
.cs-calc-term--final strong { color: #fff; }
.cs-calc-op { font-size: 18px; font-weight: 600; line-height: 1; color: #475569; }
.cs-calc-note { margin: 8px 0 0; font-size: 13px; font-weight: 500; line-height: 1.5; color: #475569; }

.cs-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.cs-group { min-width: 0; padding: 14px; background: #f5f7f9; border-radius: 10px; }
.cs-group h4 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; color: #0d131c; }
.cs-group-note { margin: 2px 0 12px; font-size: 13px; font-weight: 500; line-height: 1.5; color: #475569; }
.cs-empty { margin: 0 0 10px; font-size: 13px; font-weight: 500; line-height: 1.5; color: #475569; }
.cs-checks { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.cs-check-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; line-height: 1.4; color: #0d131c; }
.cs-check-pts { flex: none; font-weight: 600; color: #475569; }
.cs-check-answer { margin: 1px 0 6px; font-size: 14px; font-weight: 500; line-height: 1.5; color: #334155; overflow-wrap: anywhere; }
.cs-bar { height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.cs-bar-fill { display: block; height: 100%; border-radius: 999px; background: #15803d; }
.cs-check--mid .cs-bar-fill { background: #c8860d; }
.cs-check--low .cs-bar-fill { background: #dc2626; min-width: 4px; }
.cs-check--wear .cs-bar-fill { background: #64748b; }   /* a deduction is a wear estimate, not a fault: neutral grey */
.cs-check--unknown .cs-bar { background: repeating-linear-gradient(135deg, #e2e8f0 0 6px, #f8fafc 6px 12px); border: 1px dashed #cbd5e1; }
.cs-check--unknown .cs-check-answer { font-style: italic; color: #475569; }
.cs-check-note { margin-top: 6px; font-size: 13px; font-weight: 500; line-height: 1.5; color: #475569; }
.cs-check-note--bad { color: #991b1b; font-weight: 600; }

.cs-corr { display: grid; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.cs-corr-item { padding: 9px 11px; background: #fff; border: 1px solid #fdba74; border-left: 4px solid #c2410c; border-radius: 8px; }
.cs-corr-item--minor { border-color: #e2e8f0; border-left-color: #94a3b8; }
.cs-corr-text { display: block; font-size: 14px; font-weight: 500; line-height: 1.5; color: #0d131c; quotes: "\201C" "\201D"; overflow-wrap: anywhere; }
.cs-corr-meta { display: block; margin-top: 3px; font-size: 13px; font-weight: 500; line-height: 1.5; color: #475569; }

.cs-disclaimer { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid #e2e8f0; font-size: 13px; font-weight: 500; line-height: 1.5; color: #475569; }

@media (max-width: 520px) {
  .cs-sec { padding: 16px; }
  .cs-sum { gap: 14px; }
  .cs-ring { width: 128px; height: 128px; }
  .cs-ring-text strong { font-size: 40px; }
  .cs-ring--long .cs-ring-text strong { font-size: 33px; }
  .cs-calc-term { min-width: 56px; padding: 5px 8px; }
  .cs-sec-head h3 { font-size: 22px; }
  .cs-groups { gap: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  .cs-bar-fill { transition: width 0.4s ease; }
  .cs-ring-fill { animation: cs-ring-reveal 2s ease-in-out both; }
}
@keyframes cs-ring-reveal {
  from { stroke-dashoffset: var(--cs-ring-length); }
  to { stroke-dashoffset: 0; }
}

/* ---------- score tile on the panel list card (the empty space to the right of the car details) ---------- */
.cs-tile { display: flex; align-items: center; gap: 14px; margin: 8px 0 12px; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
.cs-tile-cap { display: none; font-size: .75rem; font-weight: 600; line-height: 1.4; color: #475569; }
.cs-ring--sm { width: 92px; height: 92px; }
.cs-ring--sm .cs-ring-text strong { font-size: 1.75rem; }
.cs-ring--sm .cs-ring-text span { margin-top: 2px; font-size: .625rem; }
.cs-ring--sm.cs-ring--long .cs-ring-text strong { font-size: 1.4rem; }
.cs-tile-info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.cs-tile-label { display: inline-flex; align-items: center; gap: 6px; font-size: .9375rem; font-weight: 700; line-height: 1.35; color: #0d131c; }
.cs-tile-label i { display: block; flex: none; font-size: 16px; line-height: 1; }
.cs-tile--very_good .cs-tile-label i { color: #15803d; }
.cs-tile--good .cs-tile-label i { color: #a86a00; }
.cs-tile--attention .cs-tile-label i { color: #c2410c; }
.cs-tile--significant .cs-tile-label i { color: #dc2626; }
.cs-tile--none .cs-tile-label i { color: #64748b; margin-top: .125em; }
.cs-tile--none .cs-tile-label { align-items: flex-start; font-size: .8125rem; color: #334155; }
.cs-tile .cs-badge-partial { color: #334155; font-size: .6875rem; }
.car-item-info:has(> .cs-tile) { display: flow-root; }
@container leads-list (min-width: 960px) {
  .cs-tile {
    float: right; flex-direction: column; align-items: center; gap: 6px; width: 126px; margin: 2px 0 12px 20px; padding: 10px 8px 12px;
    text-align: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px;
  }
  .cs-tile-cap { display: block; font-size: .75rem; }
  .cs-ring--sm { width: 90px; height: 90px; }
  .cs-ring--sm .cs-ring-text strong { font-size: 1.625rem; }
  .cs-ring--sm .cs-ring-text span { margin-top: 2px; font-size: .625rem; }
  .cs-ring--sm.cs-ring--long .cs-ring-text strong { font-size: 1.3rem; }
  .cs-tile-info { align-items: center; }
  .cs-tile-label { gap: 4px; text-align: center; font-size: .75rem; }
  .cs-tile-label i { font-size: 14px; }
  .cs-tile--none .cs-tile-label { font-size: .6875rem; }
  .cs-tile--none .cs-tile-label i { font-size: 12px; }
}

/* ---------- mileage classification: its own coloured tag after the mileage tag ("102,000 Miles" [High Mileage]) ----------
   Drawn by SACCondition.mileageTagHtml / mileageTag (panel, app) and sac_mileage_class_tag (/cars-for-trade/); on the details pages the label is a small
   pill (.mc-pill) in its own "Mileage for its Age" row. Soft colours: green low, turquoise normal, amber above average, red high (deeper red very high).
   Not part of the condition score. */
.mc-pill--very_low, .mc-pill--low, .mc-tag--very_low, .mc-tag--low { --mc-bg: #dcfce7; --mc-fg: #14532d; --mc-icon: #16a34a; }
.mc-pill--normal, .mc-tag--normal { --mc-bg: #ccfbf1; --mc-fg: #115e59; --mc-icon: #0d9488; }
.mc-pill--above_average, .mc-tag--above_average { --mc-bg: #fef3c7; --mc-fg: #78350f; --mc-icon: #d97706; }
.mc-pill--high, .mc-tag--high { --mc-bg: #fee2e2; --mc-fg: #991b1b; --mc-icon: #dc2626; }
.mc-pill--very_high, .mc-tag--very_high { --mc-bg: #fecaca; --mc-fg: #7f1d1d; --mc-icon: #b91c1c; }
.mc-pill { display: inline-flex; align-items: center; flex: none; padding: 1px 9px; border-radius: 999px; font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--mc-bg, #e2e8f0); color: var(--mc-fg, #334155); }
/* the tag is the page's own chip (panel .car-item-chip, app .lead-card-chip, /cars-for-trade/ .cfs-spec) tinted; the selector is as specific as the app's own chip rule so the colour wins there */
:is(.car-item-chip, .cfs-spec, .app-trader-leads .car-card-body .lead-card-chip).mc-tag { background: var(--mc-bg, #f1f5f9); color: var(--mc-fg, #334155); font-weight: 600; }
:is(.car-item-chip, .cfs-spec, .app-trader-leads .car-card-body .lead-card-chip).mc-tag i { color: var(--mc-icon, #64748b); opacity: 1; }
