.estimator-page {
  display: grid;
  gap: 18px;
}

.estimator-lookup,
.estimator-visual,
.estimator-summary,
.estimator-lines {
  border-radius: 8px;
}

.estimator-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.estimator-search label,
.context-field,
.rate-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 13px;
}

.estimator-context {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 220px;
  gap: 12px;
  margin-top: 14px;
}

.context-box {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.46);
}

.context-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.context-box strong {
  color: var(--text);
}

.context-box span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.estimator-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.estimator-toolbar,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.estimator-toolbar h2,
.section-head h2,
.estimator-summary h2 {
  margin-top: 0;
}

.damage-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.damage-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.damage-option.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124, 225, 255, 0.14);
}

.damage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.damage-lieve { fill: #2ecc71 !important; background: #2ecc71; }
.damage-medio { fill: #3498db !important; background: #3498db; }
.damage-grave { fill: #e74c3c !important; background: #e74c3c; }
.damage-sostituzione { fill: #f1c40f !important; background: #f1c40f; color: #111827; }

.car-map {
  display: block;
  width: 100%;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 48%, rgba(148, 163, 184, 0.12), transparent 42%),
    #101827;
}

.car-map-side {
  aspect-ratio: 1000 / 560;
}

.car-side-label {
  fill: var(--muted-strong);
  font-size: 18px;
  font-weight: 700;
}

.car-shell {
  fill: url(#carPaint);
  opacity: 0.24;
  stroke: rgba(226, 232, 240, 0.72);
  stroke-width: 3;
}

.car-shell-lower {
  opacity: 0.18;
}

.car-silhouette {
  fill: url(#carPaint);
  opacity: 0.28;
  stroke: rgba(226, 232, 240, 0.7);
  stroke-width: 3;
}

.car-centerline {
  fill: none;
  stroke: rgba(226, 232, 240, 0.18);
  stroke-width: 2;
  stroke-dasharray: 10 12;
}

.car-part,
.car-window,
.car-light {
  fill: rgba(30, 41, 59, 0.86);
  stroke: rgba(226, 232, 240, 0.78);
  stroke-width: 2;
  cursor: pointer;
  transition: fill 0.16s ease, stroke 0.16s ease, opacity 0.16s ease, filter 0.16s ease;
}

.car-window {
  fill: url(#glassPaint);
  opacity: 0.82;
}

.car-light.front-light {
  fill: rgba(252, 211, 77, 0.82);
}

.car-light.rear-light {
  fill: rgba(248, 113, 113, 0.82);
}

.panel-roof {
  fill: rgba(15, 23, 42, 0.78);
}

.rocker {
  fill: rgba(51, 65, 85, 0.9);
}

.panel-hood,
.panel-tailgate,
.panel-door,
.panel-fender,
.panel-bumper,
.panel-roof,
.rocker {
  fill: rgba(30, 41, 59, 0.92);
}

.car-part:hover,
.car-window:hover,
.car-light:hover {
  stroke: var(--accent);
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(124, 225, 255, 0.35));
}

.rate-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.totals {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.totals span {
  color: var(--muted);
}

.totals strong {
  color: var(--text);
}

.totals .grand-total {
  margin-top: 4px;
  padding: 12px;
  border: 1px solid rgba(124, 225, 255, 0.28);
  border-radius: 8px;
  background: rgba(124, 225, 255, 0.08);
}

.totals .grand-total strong {
  color: var(--accent);
  font-size: 20px;
}

.damage-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #07111f;
  font-size: 12px;
  font-weight: 700;
}

.labor-total-row th {
  border-top: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(15, 23, 42, 0.56);
}

.btn.compact {
  padding: 6px 9px;
  min-height: 30px;
  font-size: 12px;
}

.table-scroll {
  overflow-x: auto;
}

@media (max-width: 1100px) {
  .estimator-workspace,
  .estimator-context {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .estimator-search,
  .estimator-toolbar,
  .section-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .damage-selector {
    justify-content: flex-start;
  }
}
