:root {
  --ink: #12191d;
  --muted: #5f6b72;
  --line: #d8dee1;
  --soft: #f2f5f5;
  --paper: #fbfcfb;
  --white: #fff;
  --teal: #0e7c72;
  --teal-dark: #075b54;
  --teal-soft: #e2f1ee;
  --amber: #e5a93d;
  --amber-soft: #fbf1d9;
  --blue: #397bb3;
  --red: #cb4c3e;
  --red-soft: #f8e7e4;
  --shadow: 0 18px 45px rgba(20, 35, 40, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.45 "DM Sans", sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.topbar { height: 66px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(251, 252, 251, .94); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 21px "Manrope", sans-serif; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; background: var(--ink); color: white; font-size: 17px; }
.status-cluster { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.status-dot.ready { background: var(--teal); }
.status-dot.error { background: var(--red); }

main { max-width: 1680px; margin: 0 auto; padding: 0 34px 80px; }
.intro-band { display: flex; align-items: end; justify-content: space-between; padding: 54px 0 42px; border-bottom: 1px solid var(--ink); }
.eyebrow { margin: 0 0 13px; color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.intro-band h1 { max-width: 820px; margin: 0; font: 600 42px/1.08 "Manrope", sans-serif; }
.intro-meta { display: flex; gap: 22px; color: var(--muted); font-size: 13px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr) minmax(300px, .68fr); gap: 0; border-left: 1px solid var(--line); }
.form-column, .side-column { min-width: 0; border-right: 1px solid var(--line); }
.section-block { padding: 32px 30px 36px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; gap: 16px; align-items: start; margin-bottom: 27px; }
.section-heading.compact { margin-bottom: 22px; }
.section-number { color: var(--teal); font: 700 13px "Manrope", sans-serif; padding-top: 5px; }
.section-heading h2 { margin: 0 0 3px; font: 600 21px "Manrope", sans-serif; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }

.field-grid { display: grid; gap: 19px 14px; }
.field-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; min-width: 0; gap: 7px; }
.field > span { color: #39464c; font-size: 12px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #cbd3d6; border-radius: 3px; background: var(--white); color: var(--ink); outline: 0; transition: border-color .15s, box-shadow .15s; }
.field input, .field select { height: 42px; padding: 0 11px; }
.field textarea { padding: 12px; resize: vertical; min-height: 248px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 124, 114, .1); }
.field input:user-invalid, .field select:user-invalid { border-color: var(--red); }
.input-suffix { display: flex; align-items: center; border: 1px solid #cbd3d6; border-radius: 3px; background: white; }
.input-suffix:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 124, 114, .1); }
.input-suffix input { border: 0; box-shadow: none !important; }
.input-suffix span { padding: 0 10px; color: var(--muted); font-size: 12px; border-left: 1px solid var(--line); }

.legend { display: flex; flex-wrap: wrap; gap: 13px; margin: -7px 0 22px 40px; color: var(--muted); font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; display: block; }
.original { background: #c9ced0 !important; }
.local-painted { background: #ed9844 !important; }
.painted { background: var(--blue) !important; color: white !important; }
.replaced { background: var(--red) !important; color: white !important; }
.parts-layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: center; }
.car-map { width: 170px; height: 300px; position: relative; margin: auto; }
.car-map::before { content: ""; position: absolute; inset: 22px 25px; background: #e5e8e9; border: 7px solid white; outline: 1px solid #bfc7ca; border-radius: 50px 50px 32px 32px; }
.car-part { position: absolute; display: grid; place-items: center; border: 2px solid white; outline: 1px solid #b9c2c5; color: #4a565c; font-size: 9px; font-weight: 700; z-index: 1; transition: background .18s; }
.p-hood { left: 43px; top: 22px; width: 84px; height: 56px; border-radius: 22px 22px 5px 5px; }
.p-roof { left: 43px; top: 94px; width: 84px; height: 99px; }
.p-trunk { left: 43px; top: 213px; width: 84px; height: 58px; border-radius: 5px 5px 18px 18px; }
.p-lf, .p-rf, .p-lr, .p-rr { width: 35px; height: 50px; }
.p-lf { left: 7px; top: 58px; border-radius: 20px 3px 3px 3px; }
.p-rf { right: 7px; top: 58px; border-radius: 3px 20px 3px 3px; }
.p-lr { left: 7px; top: 194px; border-radius: 3px 3px 3px 20px; }
.p-rr { right: 7px; top: 194px; border-radius: 3px 3px 20px 3px; }
.p-lfd, .p-rfd, .p-lrd, .p-rrd { width: 35px; height: 65px; }
.p-lfd { left: 7px; top: 112px; }.p-rfd { right: 7px; top: 112px; }.p-lrd { left: 7px; top: 179px; }.p-rrd { right: 7px; top: 179px; }
.parts-list { display: grid; gap: 6px; }
.part-row { display: grid; grid-template-columns: minmax(112px, 1fr) 106px; gap: 8px; align-items: center; }
.part-row span { font-size: 12px; color: #3c484e; }
.part-row select { height: 31px; border: 1px solid var(--line); background: white; border-radius: 3px; font-size: 11px; padding: 0 6px; }
.condition-meta { margin-top: 25px; padding-top: 24px; border-top: 1px solid var(--line); }

.equipment-groups { display: grid; gap: 20px; }
.equipment-group h3 { margin: 0 0 10px; color: var(--teal); font-size: 12px; }
.equipment-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 11px; }
.equipment-option { display: flex; align-items: start; gap: 7px; font-size: 11px; cursor: pointer; }
.equipment-option input, .check-row input { accent-color: var(--teal); margin: 2px 0 0; }
.binary-grid { display: grid; gap: 10px; padding: 19px 0 24px; }
.check-row { display: flex; gap: 8px; align-items: start; font-size: 12px; color: #39464c; }
.sticky-panel { position: sticky; top: 66px; }
.primary-action { width: 100%; min-height: 55px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 3px; background: var(--ink); color: white; font-weight: 700; transition: background .15s, transform .15s; }
.primary-action:hover { background: var(--teal-dark); }
.primary-action:active { transform: translateY(1px); }
.primary-action:disabled { opacity: .55; cursor: wait; }
.button-icon { font-size: 21px; }
.form-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

.result-shell { margin-top: 42px; border: 1px solid var(--line); background: white; box-shadow: var(--shadow); }
.loading-state, .error-state { min-height: 320px; display: flex; flex-direction: column; justify-content: center; padding: 54px; }
.loading-copy h2, .error-state h2 { margin: 0 0 8px; font: 600 32px "Manrope", sans-serif; }
.loading-copy p:last-child { color: var(--muted); }
.loading-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 50px; }
.loading-bars span { height: 6px; background: var(--soft); overflow: hidden; position: relative; }
.loading-bars span::before { content: ""; position: absolute; inset: 0; background: var(--teal); animation: loading 1.5s infinite ease-in-out; transform-origin: left; }
.loading-bars span:nth-child(2)::before { animation-delay: .16s; }.loading-bars span:nth-child(3)::before { animation-delay: .32s; }.loading-bars span:nth-child(4)::before { animation-delay: .48s; }
@keyframes loading { 0%, 100% { transform: scaleX(.08); } 50% { transform: scaleX(1); } }
.secondary-action { align-self: start; margin-top: 18px; border: 1px solid var(--ink); background: transparent; padding: 11px 18px; }

.result-header { display: flex; justify-content: space-between; align-items: end; padding: 38px 42px 30px; border-bottom: 1px solid var(--ink); }
.result-header h2 { margin: 0; font: 600 31px "Manrope", sans-serif; }
.confidence { text-align: right; }
.confidence span { display: block; color: var(--muted); font-size: 12px; }
.confidence strong { font: 700 30px "Manrope", sans-serif; color: var(--teal); }
.price-grid { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); }
.price-grid article { min-height: 165px; padding: 29px 30px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.price-grid article:last-child { border-right: 0; }
.price-grid article > span { color: var(--muted); font-size: 12px; }
.price-grid strong { display: block; margin-top: 17px; font: 600 25px "Manrope", sans-serif; }
.price-primary { background: var(--teal-soft); }
.price-primary strong { font-size: 36px; color: var(--teal-dark); }
.price-primary p { margin: 12px 0 0; color: #31504d; font-size: 12px; }
.range-block { padding: 27px 42px 34px; border-bottom: 1px solid var(--line); }
.range-block > div:first-child { display: flex; justify-content: space-between; }
.range-block span { color: var(--muted); font-size: 12px; }.range-block strong { font-size: 15px; }
.range-track { height: 9px; margin-top: 19px; background: linear-gradient(90deg, var(--amber-soft), var(--teal-soft)); position: relative; }
.range-track i { position: absolute; top: -5px; width: 3px; height: 19px; background: var(--ink); left: 50%; }
.analysis-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.analysis-grid article { padding: 31px 34px; border-right: 1px solid var(--line); }
.analysis-grid article:last-child { border-right: 0; }
.analysis-grid h3, .subsection-heading h3, .method-section h3 { margin: 0 0 17px; font: 600 18px "Manrope", sans-serif; }
.analysis-grid ul, .method-section ol { margin: 0; padding-left: 19px; color: #455158; }
.analysis-grid li, .method-section li { margin-bottom: 9px; }
.comparables-section, .method-section { padding: 34px 42px; border-bottom: 1px solid var(--line); }
.subsection-heading { display: flex; justify-content: space-between; align-items: center; }
.subsection-heading span { color: var(--muted); font-size: 12px; }
.comparables-table { overflow-x: auto; }
.comparable-row { min-width: 800px; display: grid; grid-template-columns: minmax(280px, 1.6fr) 90px 100px 130px 150px; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.comparable-row.header { color: var(--muted); font-size: 11px; font-weight: 600; }
.comparable-row a { color: var(--teal-dark); font-weight: 600; text-decoration: none; }.comparable-row a:hover { text-decoration: underline; }
.comparable-row small { display: block; color: var(--muted); margin-top: 3px; }
.disclaimer { margin: 20px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

@media (max-width: 1220px) {
  .workspace { grid-template-columns: 1fr 1fr; }
  .side-column { grid-column: 1 / -1; }
  .sticky-panel { position: static; }
  .side-column .section-block { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
  .side-column .section-heading, .side-column .primary-action, .side-column .form-note { grid-column: 1 / -1; }
  .field-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price-grid { grid-template-columns: repeat(2, 1fr); }
  .price-grid article:nth-child(2) { border-right: 0; }
}

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 62px; padding: 13px 18px; align-items: start; }
  .status-cluster { flex-wrap: wrap; justify-content: end; max-width: 225px; }
  main { padding: 0 18px 52px; }
  .intro-band { align-items: start; gap: 25px; padding: 38px 0 30px; }
  .intro-band h1 { font-size: 31px; }
  .intro-meta { display: none; }
  .workspace { display: block; border-left: 1px solid var(--line); }
  .section-block { padding: 27px 20px 31px; }
  .field-grid-3, .field-grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .parts-layout { grid-template-columns: 1fr; }
  .car-map { transform: scale(.9); margin-top: -10px; margin-bottom: -12px; }
  .equipment-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-column .section-block { display: block; }
  .binary-grid { margin-top: 0; }
  .result-header { align-items: start; gap: 20px; padding: 28px 23px; }
  .result-header h2 { font-size: 24px; }
  .price-grid, .analysis-grid { grid-template-columns: 1fr; }
  .price-grid article, .analysis-grid article { border-right: 0; }
  .range-block, .comparables-section, .method-section { padding-left: 23px; padding-right: 23px; }
  .loading-state, .error-state { padding: 35px 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
