:root {
  --asphalt: #20252b;
  --asphalt-2: #2c333b;
  --ink: #14181c;
  --paper: #eceff2;
  --surface: #ffffff;
  --sunken: #f5f6f8;
  --line: #d6dbe0;
  --line-strong: #b9c0c8;
  --muted: #4f5965;
  --signal: #f5b800;
  --signal-soft: #fff4cc;
  --signal-ink: #4a3800;
  --ok: #1d7a46;
  --ok-soft: #e3f3ea;
  --warn: #7a5200;
  --warn-soft: #fff3d1;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --focus: #1a73e8;
  --radius-s: 6px;
  --radius-m: 10px;
  /* Fuentes del sistema: se ven nitidas en cada dispositivo y no hay que descargar nada */
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-cond: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.grow { flex: 1; }

/* ---------- Cabecera ---------- */

.masthead { background: var(--asphalt); color: #fff; padding: 18px 0 0; position: relative; }
.masthead::after {
  /* linea discontinua de carretera */
  content: ""; display: block; height: 4px; margin-top: 0;
  background: repeating-linear-gradient(90deg, var(--signal) 0 28px, transparent 28px 46px);
  opacity: .9;
}
.masthead-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-mark { width: 46px; height: 46px; color: #fff; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.wordmark { font-family: var(--font-cond); font-weight: 700; font-size: 1.85rem; letter-spacing: .005em; line-height: 1; }
.wm-light { font-weight: 500; color: var(--signal); }
.tagline { margin: 4px 0 0; color: #b8c0c9; font-size: .9rem; }

.menu { margin-top: 14px; }
.menu-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.menu-inner::-webkit-scrollbar { display: none; }
.seg {
  border: 0; background: transparent; color: #c6cdd5; font-weight: 600; font-size: 1rem; padding: 12px 16px 10px; cursor: pointer;
  white-space: nowrap; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0;
}
.seg:hover { color: #fff; background: var(--asphalt-2); }
.lbl-short { display: none; }
.seg.active { color: #fff; border-bottom-color: var(--signal); background: var(--asphalt-2); }

/* ---------- Bloque de entrada ---------- */

main.wrap { padding-top: 20px; padding-bottom: 40px; }
.tool { background: var(--surface); border-radius: var(--radius-m); border: 1px solid var(--line); padding: 18px; margin-bottom: 20px; }
.tool-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.btn-reset { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font-weight: 600; font-size: .92rem; padding: 7px 14px; border-radius: 999px; cursor: pointer; min-height: 38px; }
.btn-reset svg { width: 17px; height: 17px; }
.btn-reset:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.vehicle { display: flex; align-items: center; gap: 10px; }
.vehicle label { font-weight: 600; font-size: .92rem; }
.vehicle select {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--line); background: var(--sunken)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b6570' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center;
  padding: 7px 32px 7px 12px; border-radius: var(--radius-s); font-weight: 600; min-height: 38px;
}
.hint { color: var(--muted); margin: 10px 0 14px; max-width: 70ch; }

.rows { display: flex; flex-direction: column; gap: 12px; }
.picker { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; background: var(--sunken); }
.picker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.picker-name { font-size: .88rem; font-weight: 600; color: var(--muted); }
.readout { font-family: var(--font-cond); font-weight: 600; font-size: 1.9rem; letter-spacing: .03em; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.readout .empty { color: var(--line-strong); }
.readout .svc { color: var(--muted); margin-left: .25em; }
.picker-meta { font-size: .88rem; color: var(--muted); margin-top: 10px; min-height: 1.3em; }

.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fields .f-load, .fields .f-speed { grid-column: span 1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.field-hint { font-size: .78rem; color: var(--muted); min-height: 1.1em; font-variant-numeric: tabular-nums; }
.picker-remove {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; font-size: .88rem;
  padding: 4px 6px; border-radius: var(--radius-s);
}
.picker-remove:hover { color: var(--bad); background: var(--bad-soft); }

/* ---------- Ajustar a llanta ---------- */

.rimfit { margin-top: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-m); background: var(--surface); }
.rimfit.active { border-style: solid; border-color: var(--signal); background: var(--signal-soft); }
.add-row { margin-top: 12px; }
.rimfit-head { display: flex; align-items: center; gap: 8px; padding-right: 10px; }
.rimfit-toggle { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border: 0; background: transparent; cursor: pointer; text-align: left; min-height: 48px; }
.rimfit-title { font-weight: 700; }
.rimfit-title::before { content: "+"; display: inline-block; width: 1.2em; font-weight: 700; color: var(--muted); }
.rimfit.open .rimfit-title::before { content: "\2212"; }
.rimfit-state { font-size: .88rem; color: var(--muted); font-weight: 600; }
.rimfit.active .rimfit-state { color: var(--signal-ink); }
.rimfit-body { padding: 0 14px 14px; }
.rimfit-body .hint { margin: 0 0 10px; }
.rimfit-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 10px; }
.rim-range { display: block; width: 100%; font-size: .8rem; color: var(--muted); }

/* ---------- Configurador ---------- */

.limits { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; background: var(--sunken); }
.limits-title { font-weight: 700; margin-bottom: 10px; }
.limits-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 12px; }
.unit-input { position: relative; }
.unit-input input { width: 100%; min-height: 46px; padding: 10px 44px 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); font-weight: 600; font-size: 1.05rem; }
.unit-input input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(26, 115, 232, .18); }
.unit-input span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.cfg-list { border-top: 1px solid var(--line); margin-top: 14px; }
.cfg-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2.6fr) 150px; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.cfg-row.is-original { background: linear-gradient(90deg, var(--signal-soft), transparent 70%); }
.cfg-size .size-mark { display: block; }
.cfg-meta { font-size: .85rem; color: var(--muted); }
.cfg-combos { display: flex; flex-wrap: wrap; gap: 6px; }
.combo-chip { display: inline-flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 5px 10px; background: var(--surface); line-height: 1.25; }
.combo-chip b { font-family: var(--font-cond); font-size: 1.1rem; }
.combo-chip span { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cfg-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cfg-side strong { font-family: var(--font-cond); font-size: 1.3rem; }

/* ---------- Llanta en el comparador ---------- */

.wheel { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.wheel-title { font-size: .88rem; font-weight: 700; margin-bottom: 8px; }
.wheel-title span { font-weight: 500; color: var(--muted); margin-left: 4px; }
.wheel-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 10px; }
.et-input { padding-right: 12px; }
.hint-ok { color: var(--ok); font-weight: 700; }
.hint-bad { color: var(--bad); font-weight: 700; }

.fitbox { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; margin-top: 14px; }
.fitbox h3 { margin: 0 0 8px; font-size: 1rem; }
.fit { margin: 0; display: grid; gap: 6px; }
.fit div { display: grid; grid-template-columns: 190px 1fr; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fit div:last-child { border-bottom: 0; }
.fit dt { font-weight: 600; }
.fit dt span { font-weight: 400; color: var(--muted); }
.fit dd { margin: 0; }
.fit-note { font-size: .85rem; margin: 8px 0 0; }

/* ---------- Combobox con buscador ---------- */

.combo { position: relative; }
.combo-input {
  width: 100%; min-height: 46px; padding: 10px 34px 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--surface); font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums;
}
.combo-input::placeholder { color: #9aa3ad; font-weight: 500; }
.combo-input:disabled { background: var(--sunken); border-color: var(--line); cursor: not-allowed; }
.combo-input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(26, 115, 232, .18); }
.combo::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px; margin-top: -6px; pointer-events: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg);
}
.combo.open::after { transform: rotate(-135deg); margin-top: -2px; }
.combo-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: 264px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-s); box-shadow: 0 12px 28px rgba(20, 24, 28, .16); min-width: 120px;
  overscroll-behavior: contain;
}
.combo-list li {
  padding: 9px 10px; border-radius: 4px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px;
  font-variant-numeric: tabular-nums; font-weight: 600;
}
.combo-list li small { font-weight: 400; color: var(--muted); }
.combo-list li.active { background: var(--signal-soft); }
.combo-list li.selected { box-shadow: inset 3px 0 0 var(--signal); }
.combo-list li.none { color: var(--muted); cursor: default; font-weight: 400; }

/* ---------- Botones y controles ---------- */

.tool-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: var(--radius-s); border: 1px solid transparent; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--asphalt); color: #fff; margin-left: auto; }
.btn-primary:hover { background: #000; }
.btn-quiet { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-quiet:hover { background: var(--sunken); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.btn-icon {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--sunken); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; flex: none;
}
.btn-icon svg { width: 20px; height: 20px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--asphalt); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Avisos ---------- */

.notice { border-radius: var(--radius-s); padding: 10px 14px; margin: 0 0 10px; font-size: .94rem; border-left: 4px solid; }
.notice-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--signal); }
.notice-bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.notice-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }

/* ---------- Resultados de equivalencias ---------- */

.results { background: var(--surface); border-radius: var(--radius-m); border: 1px solid var(--line); padding: 18px; margin-bottom: 20px; }
.results-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.results-head h2 { margin: 0; font-family: var(--font-cond); font-size: 1.6rem; font-weight: 700; }
.results-head p { margin: 0; color: var(--muted); font-size: .92rem; }
.results-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 12px 0 14px; }

.chips-label { font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer;
  font-weight: 600; white-space: nowrap; min-height: 36px; font-variant-numeric: tabular-nums;
}
.chip small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.chip[aria-pressed="true"] { background: var(--asphalt); border-color: var(--asphalt); color: #fff; }
.chip[aria-pressed="true"] small { color: #c6cdd5; }

.res-list { border-top: 1px solid var(--line); margin-top: 14px; }
.res-row {
  display: grid; grid-template-columns: minmax(0, 1.2fr) 100px minmax(0, 1fr) 150px minmax(0, 1.3fr) 150px;
  align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.res-row.res-header { font-size: .8rem; font-weight: 600; color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
.res-row.is-original { background: linear-gradient(90deg, var(--signal-soft), transparent 70%); }
.res-size { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.size-mark { font-family: var(--font-cond); font-weight: 600; font-size: 1.35rem; letter-spacing: .03em; font-variant-numeric: tabular-nums; margin: 0; line-height: 1.1; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.tag-signal { background: var(--signal); color: var(--signal-ink); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }
.res-diam { color: var(--muted); }
.diffs { display: flex; flex-direction: column; gap: 2px; font-size: .92rem; }
.diff { font-variant-numeric: tabular-nums; font-weight: 600; }
.diff small { font-weight: 500; color: var(--muted); }
.diff.out { color: var(--muted); font-weight: 400; text-decoration: line-through; text-decoration-color: var(--line-strong); }
.res-req { font-size: .92rem; }
.count-cap { display: none; font-size: .8rem; color: var(--muted); }
.res-count { display: flex; align-items: center; gap: 10px; }
.res-count strong { font-family: var(--font-cond); font-size: 1.35rem; min-width: 3.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.meter { flex: 1; height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; min-width: 40px; }
.meter span { display: block; height: 100%; background: var(--signal); }
.cell-label { display: none; }
.empty-state { padding: 18px 4px; color: var(--muted); }

/* ---------- Comparador ---------- */

.verdict { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-m); margin-bottom: 14px; }

/* Comparador: cabecera, veredicto y comprobaciones */
.cmp-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-bottom: 16px; }
.cmp-title .size-mark { font-size: 2rem; }
.cmp-title .size-mark.is-old { color: var(--muted); }
.cmp-arrow { font-size: 1.6rem; color: var(--signal); font-weight: 700; }
.verdict-row { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 14px; align-items: stretch; margin-bottom: 22px; }
.verdict-row .verdict { flex-direction: column; align-items: flex-start; justify-content: center; margin: 0; padding: 18px 20px; gap: 8px; }
.verdict-row .verdict-big { font-size: 3rem; }
.verdict-row .verdict p strong { display: block; font-size: 1.05rem; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; align-content: start; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-s); background: var(--sunken); }
.check strong { display: block; font-size: .98rem; }
.check span:not(.check-icon) { color: var(--muted); font-size: .92rem; }
.check-icon { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; color: #fff; margin-top: 1px; }
.check-ok .check-icon { background: var(--ok); }
.check-bad .check-icon { background: var(--bad); }
.check-warn .check-icon { background: var(--signal); color: var(--signal-ink); }
.check-bad { background: var(--bad-soft); }

/* Diagramas */
.diagrams { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fig { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 12px 6px; background: var(--surface); }
.fig figcaption { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.fig figcaption span { font-weight: 500; color: var(--muted); }
.diagram { width: 100%; height: auto; display: block; font-family: var(--font); }
.d-ground { stroke: var(--ink); stroke-width: 2; }
.d-hatch { stroke: var(--line-strong); stroke-width: 1.5; }
.d-tyre-new { fill: var(--asphalt); }
.d-rim-new { fill: #d3d8de; stroke: #9aa3ad; stroke-width: 1.5; }
.d-spoke { stroke: #9aa3ad; stroke-width: 6; stroke-linecap: round; }
.d-hub { fill: var(--asphalt-2); }
.d-outline { fill: none; stroke: #d98c00; stroke-width: 2.5; stroke-dasharray: 7 5; }
.d-dim { stroke: var(--muted); stroke-width: 1.2; }
.d-dim.is-new { stroke: var(--ink); stroke-width: 1.6; }
.d-label { font-size: 14px; font-weight: 600; fill: var(--muted); }
.d-label.is-new { fill: var(--ink); font-weight: 700; }
.d-delta { font-size: 17px; font-weight: 800; fill: var(--ink); font-family: var(--font-cond); }
.d-small { font-size: 12.5px; fill: #fff; font-weight: 600; }
.diagram .d-small[x] { paint-order: stroke; }
.d-small-dark { font-size: 13px; fill: var(--muted); font-weight: 600; }
.d-side { font-size: 13.5px; font-weight: 700; fill: var(--muted); }
.d-body { fill: #9aa3ad; }
.d-body-dark { fill: #7d8792; }
.d-shift { stroke: #d98c00; stroke-width: 3; stroke-linecap: round; }
.d-hubface { stroke: var(--bad); stroke-width: 2; stroke-dasharray: 4 4; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 10px 2px 4px; font-size: .9rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 26px; height: 12px; border-radius: 3px; }
.lg-new { background: var(--asphalt); }
.lg-old { border: 2.5px dashed #d98c00; }

/* Encaje y datos */
.cmp-h { font-size: 1.15rem; margin: 26px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stat { background: var(--sunken); border-radius: var(--radius-s); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.stat-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.stat-value strong { font-family: var(--font-cond); font-size: 1.6rem; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.stat-value em { font-style: normal; font-weight: 600; }
.stat-sub { font-size: .85rem; color: var(--muted); }
.table-scroll { overflow-x: auto; }
.cmp-card h4 { margin: 0 0 2px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.cmp-count strong { font-family: var(--font-cond); font-size: 1.5rem; }
.verdict-ok { background: var(--ok-soft); color: var(--ok); }
.verdict-bad { background: var(--bad-soft); color: var(--bad); }
.verdict-big { font-family: var(--font-cond); font-weight: 700; font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.verdict p { margin: 0; }
.cmp-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin-top: 6px; }
.cmp-table th, .cmp-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; }
.cmp-table thead th { font-size: .82rem; color: var(--muted); font-weight: 600; }
.cmp-table thead th .size-mark { font-size: 1.15rem; color: var(--ink); }
.speedo { margin: 14px 0 0; padding: 12px 14px; background: var(--sunken); border-radius: var(--radius-s); }
.cmp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.cmp-card { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px; }
.cmp-card h3 { margin: 0 0 4px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.cmp-card .size-mark { font-size: 1.6rem; }
.cmp-card p { margin: 6px 0; }

/* ---------- Detalle (hoja) ---------- */

.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(20, 24, 28, .55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto; }
.sheet-box { background: var(--surface); width: 100%; max-width: 1120px; border-radius: var(--radius-m); box-shadow: 0 24px 64px rgba(0, 0, 0, .3); }
.sheet-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--line); border-radius: var(--radius-m) var(--radius-m) 0 0; }
.sheet-head .size-mark { font-size: 1.8rem; }
.sheet-sub { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.sheet-body { padding: 16px 18px 24px; }

.filters-toggle { display: none; }
.filters-toggle svg { width: 20px; height: 20px; flex: none; }
.filters-count { background: var(--signal); color: var(--signal-ink); border-radius: 999px; min-width: 24px; height: 24px;
  padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 800; }
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.filters .field select {
  appearance: none; -webkit-appearance: none; min-height: 46px; padding: 10px 32px 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-s); background: var(--surface)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235b6570' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-weight: 600;
}
.filters .field input[type=text], .filters .field input[type=number] {
  min-height: 46px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); font-weight: 600; width: 100%;
}
.filters .field-pack { grid-column: span 2; }
.filters .switches { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 22px; }

.list-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 8px; }
.list-head h3 { margin: 0; font-family: var(--font-cond); font-size: 1.4rem; }
.list-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.sort { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.sort select { border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 6px 10px; background: var(--surface); font-weight: 600; color: var(--ink); min-height: 36px; }

.tyres { border-top: 1px solid var(--line); }
.tyre {
  display: grid; grid-template-columns: minmax(0, 2.4fr) 130px 100px 80px 80px minmax(0, 1.3fr) 130px;
  gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: .94rem;
}
.tyre-head { font-size: .8rem; font-weight: 600; color: var(--muted); }
.tyre-eu, .tyre-foot { display: contents; }
.tyre-name strong { display: block; font-weight: 700; }
.tyre-name span { color: var(--muted); }
.svc-code { font-family: var(--font-cond); font-weight: 600; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eu { display: inline-flex; align-items: center; gap: 6px; }
.eu-label { display: inline-block; min-width: 24px; text-align: center; font-weight: 800; color: #fff; border-radius: 3px; padding: 1px 6px; font-size: .85rem; }
.eu-A { background: #1a8a3c; } .eu-B { background: #62a832; } .eu-C { background: #c9a800; color: #222; }
.eu-D { background: #e57a13; } .eu-E { background: #d4271d; }
.eu-cap { display: none; font-size: .78rem; color: var(--muted); }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.tyre-end { font-size: .88rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.pager span { color: var(--muted); font-size: .9rem; }

/* ---------- Pie ---------- */

.method { padding: 8px 2px 0; color: var(--muted); }
.method h2 { color: var(--ink); font-size: 1.05rem; margin: 0 0 10px; }
.method dl { margin: 0 0 12px; display: grid; gap: 8px; }
.method dl div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.method dt { font-weight: 700; color: var(--ink); }
.method dd { margin: 0; }
.disclaimer, .source { font-size: .88rem; margin: 0 0 8px; max-width: 80ch; }
.source a { color: inherit; }
.loading { color: var(--muted); padding: 16px 0; }

/* ---------- Escritorio ---------- */

@media (min-width: 900px) {
  .fields { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- Movil ---------- */

@media (max-width: 899px) {
  .res-row.res-header, .tyre-head { display: none; }
  .res-row {
    grid-template-columns: 1fr auto; grid-template-areas: "size count" "diffs diffs" "req action";
    gap: 8px 12px; padding: 14px 2px;
  }
  .res-size { grid-area: size; }
  .res-diam { display: none; }
  .diffs { grid-area: diffs; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
  .res-req { grid-area: req; color: var(--muted); }
  .res-count { grid-area: count; }
  .res-count .meter { display: none; }
  .res-count { flex-direction: column; align-items: flex-end; gap: 0; }
  .count-cap { display: block; }
  .res-action { grid-area: action; justify-self: end; }
  .res-diam-inline { font-size: .88rem; }
  .cell-label { display: inline; color: var(--muted); font-size: .85rem; }

  .tyre {
    grid-template-columns: 1fr auto; grid-template-areas: "name svc" "eu eu" "foot foot";
    gap: 8px 10px; padding: 12px 2px;
  }
  .tyre-name { grid-area: name; }
  .tyre-svc { grid-area: svc; text-align: right; align-self: start; }
  .tyre-eu { grid-area: eu; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
  .tyre-eu .eu-cap { display: inline; }
  .tyre-foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }

  .filters-toggle { display: flex; width: 100%; min-height: 52px; margin-bottom: 14px; background: var(--asphalt); color: #fff; font-size: 1.02rem; }
  .filters-toggle[aria-expanded="true"] { background: var(--sunken); color: var(--ink); border-color: var(--line-strong); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field-pack { grid-column: 1 / -1; }
  .filters.collapsed { display: none; }
  .cmp-cards { grid-template-columns: 1fr; }
  .cfg-row { grid-template-columns: 1fr; gap: 8px; }
  .cfg-side { flex-direction: row; justify-content: space-between; align-items: center; }
  .verdict-row { grid-template-columns: 1fr; }
  .diagrams { grid-template-columns: 1fr; }
}

@media (min-width: 900px) {
  .res-diam-inline { display: none; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 12px; }
  .masthead { padding-top: 14px; }
  .masthead::after { margin-top: 0; }
  .wordmark { font-size: 1.55rem; }
  .brand-mark { width: 40px; height: 40px; }
  .tagline { font-size: .85rem; }
  .menu-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0 8px; }
  .seg { padding: 11px 4px 9px; font-size: .95rem; text-align: center; }
  .lbl-long { display: none; }
  .lbl-short { display: inline; }
  main.wrap { padding-top: 14px; }
  .tool, .results { padding: 14px; border-radius: var(--radius-m); }
  .picker { padding: 12px; }
  .readout { font-size: 1.6rem; }
  .fields { grid-template-columns: repeat(6, 1fr); }
  .fields .f-width, .fields .f-aspect, .fields .f-rim { grid-column: span 2; }
  .fields .f-load, .fields .f-speed { grid-column: span 3; }
  .tool-foot .btn-primary { width: 100%; margin-left: 0; order: 3; }
  .tool-foot .btn-quiet { flex: 1; }
  .add-row .btn { width: 100%; }
  .sheet { padding: 0; }
  .sheet-box { border-radius: 0; min-height: 100%; }
  .sheet-head { border-radius: 0; }
  .sheet-body { padding: 14px 12px 28px; }
  .method dl div { grid-template-columns: 1fr; gap: 0; }
  .fit div { grid-template-columns: 1fr; gap: 2px; }
  .verdict-big { font-size: 1.8rem; }
  .cmp-title .size-mark { font-size: 1.55rem; }
  .verdict-row .verdict-big { font-size: 2.4rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .limits-fields { grid-template-columns: 1fr; }
  .stat-value strong { font-size: 1.35rem; }
  .btn-reset { padding: 6px 12px; }
  .cmp-table { font-size: .86rem; }
  .cmp-table th, .cmp-table td { padding: 8px 4px; }
  .cmp-table td { white-space: nowrap; }
  .cmp-table td:first-child { white-space: normal; }
  .cmp-table thead th .size-mark { font-size: 1rem; display: inline-block; max-width: 4.6em; white-space: normal; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Pie de pagina ---------- */

.site-footer { background: var(--asphalt); color: #c6cdd5; margin-top: 30px; font-size: .92rem; }
.site-footer::before { content: ""; display: block; height: 4px;
  background: repeating-linear-gradient(90deg, var(--signal) 0 28px, transparent 28px 46px); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 40px; padding-top: 26px; padding-bottom: 18px; }
.footer-brand { max-width: 520px; }
.footer-brand .wordmark { color: #fff; font-size: 1.5rem; }
.footer-brand p { margin: 8px 0 0; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: #fff; text-decoration: none; font-weight: 600; }
.footer-links a:hover { color: var(--signal); text-decoration: underline; }
.footer-bottom { border-top: 1px solid var(--asphalt-2); padding-top: 14px; padding-bottom: 22px; font-size: .85rem; color: #9aa3ad; }

/* ---------- Paginas legales ---------- */

.legal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 28px 32px; max-width: 860px; margin: 0 auto; }
.legal h1 { font-family: var(--font-cond); font-size: 2.2rem; margin: 0 0 6px; }
.legal .updated { color: var(--muted); margin: 0 0 22px; font-size: .92rem; }
.legal h2 { font-size: 1.2rem; margin: 28px 0 8px; }
.legal p, .legal li { max-width: 72ch; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal dl { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; margin: 0; }
.legal dt { font-weight: 600; }
.legal dd { margin: 0; }
.legal .ph { background: var(--signal-soft); color: var(--signal-ink); border-radius: 3px; padding: 0 4px; font-weight: 600; }
.legal table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.legal th, .legal td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; font-weight: 600; padding: 12px 0 10px; }
.back-link:hover { color: var(--signal); }
@media (max-width: 600px) {
  .legal { padding: 20px 16px; }
  .legal dl { grid-template-columns: 1fr; gap: 0 0; }
  .legal dd { margin-bottom: 8px; }
}

/* ---------- Contenido para buscadores ---------- */

a.seg { display: inline-flex; align-items: center; text-decoration: none; }
.intro { margin: 4px 2px 16px; }
.intro h1 { font-family: var(--font-cond); font-size: 2rem; margin: 0 0 6px; letter-spacing: .005em; }
.intro p { margin: 0; color: var(--muted); max-width: 75ch; }
.seo-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px; margin-bottom: 20px; }
.seo-block h2 { margin: 0 0 12px; font-size: 1.2rem; }
.seo-block h3 { font-size: 1rem; margin: 16px 0 4px; }
.seo-block p { margin: 0 0 8px; max-width: 78ch; }
.link-grid { display: flex; flex-wrap: wrap; gap: 6px; max-width: none !important; }
.link-grid a { display: inline-block; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); text-decoration: none;
  color: var(--ink); font-family: var(--font-cond); font-weight: 600; font-size: 1.05rem; font-variant-numeric: tabular-nums; background: var(--surface); }
.link-grid a:hover { border-color: var(--asphalt); background: var(--signal-soft); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 12px; font-size: .9rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.crumbs a { color: var(--muted); }
.seo-page { padding-top: 16px; }
.size-page h1 { margin-bottom: 8px; }
.lead-text { color: var(--muted); font-size: 1.05rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; max-width: none !important; }
.cta-row .btn { text-decoration: none; margin: 0; }
.spec { margin-top: 6px !important; }
.brand-list { display: flex; flex-wrap: wrap; gap: 6px; max-width: none !important; }
.brand-list span { background: var(--sunken); border-radius: 999px; padding: 4px 10px; font-weight: 600; font-size: .9rem; }
.brand-list small { color: var(--muted); font-weight: 500; }
.eq-table a { font-family: var(--font-cond); font-weight: 600; font-size: 1.08rem; }
.size-page h3 { font-size: 1.02rem; margin: 18px 0 4px; }
.legal a, .seo-block a { color: var(--ink); text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.legal a.btn { text-decoration: none; }
.legal a.btn-primary { color: #fff; }
.link-grid a { text-decoration: none !important; }

/* ---------- Catalogo ---------- */

.fields-3 { grid-template-columns: repeat(3, minmax(0, 200px)) !important; }
.progress { height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; max-width: 360px; }
.progress span { display: block; height: 100%; width: 0; background: var(--signal); transition: width .2s; }
.svc-size { display: block; font-weight: 700; font-size: .95rem; white-space: nowrap; }
.size-mark, .readout, .svc-code, .wordmark, .stat-value strong, .verdict-big, .results-head h2, .intro h1 { letter-spacing: -0.01em; }
@media (max-width: 600px) {
  .menu-inner { grid-template-columns: repeat(2, 1fr) !important; }
  .fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

/* ---------- Menu con iconos y version movil ---------- */

.seg { display: inline-flex; align-items: center; gap: 8px; }
.seg-icon { width: 18px; height: 18px; flex: none; opacity: .85; }
.seg.active .seg-icon { color: var(--signal); opacity: 1; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .masthead { padding-top: 10px; }
  .brand-mark { width: 34px; height: 34px; }
  .wordmark { font-size: 1.35rem; }
  .tagline { font-size: .78rem; margin-top: 2px; }
  .menu { margin-top: 8px; }
  .menu-inner { grid-template-columns: repeat(4, 1fr) !important; gap: 0; padding: 0 4px; }
  .seg { flex-direction: column; gap: 3px; padding: 8px 2px 7px; font-size: .74rem; font-weight: 600; border-radius: 6px 6px 0 0; min-width: 0; }
  .seg-icon { width: 20px; height: 20px; }
  .seg .lbl-short { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .intro { margin: 2px 2px 12px; }
  .intro h1 { font-size: 1.35rem; margin-bottom: 4px; }
  .intro p { font-size: .9rem; line-height: 1.45; }
  .tool { padding: 12px; }
  .tool-head { flex-wrap: nowrap; }
  .vehicle { gap: 6px; min-width: 0; }
  .vehicle label { font-size: .85rem; }
  .vehicle select { min-width: 0; padding: 6px 28px 6px 10px; font-size: .92rem; }
  .btn-reset { padding: 6px 10px; font-size: .85rem; min-height: 34px; white-space: nowrap; }
  .picker { padding: 10px; }
  .picker-head { margin-bottom: 8px; }
  .readout { font-size: 1.35rem; }
  .fields { gap: 8px; }
  .field > label { font-size: .76rem; }
  .combo-input { min-height: 42px; padding: 8px 26px 8px 10px; font-size: .98rem; }
  .combo::after { right: 10px; width: 7px; height: 7px; }
  .field-hint { font-size: .74rem; }
  .picker-meta { font-size: .8rem; margin-top: 8px; min-height: 0; }
  .btn { min-height: 44px; }
  .results-head h2 { font-size: 1.3rem; }
  .results-head p { font-size: .85rem; }
  .seo-block { padding: 14px; }
  .seo-block h2 { font-size: 1.05rem; }
  .seo-block p, .method { font-size: .92rem; }
}
@media (max-width: 360px) {
  .seg { font-size: .68rem; }
  .btn-reset svg { display: none; }
}
.field-hint:empty, .picker-meta:empty { display: none; }
.fields-3 .field { grid-column: auto !important; }
@media (max-width: 600px) {
  .limits { padding: 12px; }
  .limits-fields { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .limits .field-hint { display: none; }
  .unit-input input { min-height: 42px; padding-right: 38px; }
}

/* ---------- Comparar desde el configurador ---------- */

button.combo-chip { cursor: pointer; font: inherit; text-align: left; color: inherit; }
button.combo-chip:hover { border-color: var(--asphalt); background: var(--signal-soft); }
.cfg-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cc-controls { position: sticky; top: 74px; z-index: 4; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 12px 14px; margin-bottom: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; box-shadow: 0 6px 16px rgba(20, 24, 28, .06); }
.cc-group { min-width: 0; }
.cc-label { display: block; font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.chip.is-fit { border-color: var(--ok); }
.chip.is-fit:not([aria-pressed="true"])::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-left: 6px; vertical-align: middle; }
.cc-et { display: flex; align-items: center; gap: 10px; }
.cc-et .btn-icon { width: 38px; height: 38px; font-size: 1.3rem; font-weight: 700; }
.cc-et input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 8px; border-radius: 4px; background: var(--line); min-width: 80px; }
.cc-et input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--asphalt); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer; }
.cc-et input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--asphalt); border: 3px solid #fff; cursor: pointer; }
.cc-et output { font-weight: 800; font-size: 1.15rem; min-width: 4.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.cc-hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.cc-foot { margin: 16px 0 0; }
.sheet .cmp .cmp-title { display: none; }
@media (max-width: 760px) {
  .cc-controls { grid-template-columns: 1fr; padding: 10px; }
}
@media (max-width: 760px) {
  .cc-controls { position: static; box-shadow: none; }
  .cfg-side { flex-wrap: wrap; }
  .cfg-btns { width: 100%; }
  .cfg-btns .btn { flex: 1; }
}

/* Comparar en directo: resumen y mando fijo abajo en movil */
.sheet-body.cc-mode { display: flex; flex-direction: column; }
.sheet-body.cc-mode .cc-controls { order: -1; }
.cc-summary { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 8px 12px; border-radius: var(--radius-s);
  font-size: .92rem; font-variant-numeric: tabular-nums; }
.cc-summary strong { font-size: 1rem; }
.cc-summary b { font-weight: 800; }
.cc-summary.is-ok { background: var(--ok-soft); color: var(--ok); }
.cc-summary.is-bad { background: var(--bad-soft); color: var(--bad); }

@media (max-width: 760px) {
  .sheet-body.cc-mode { padding-bottom: 0; }
  .sheet-body.cc-mode .cc-controls {
    order: 2; position: sticky; bottom: 0; top: auto; margin: 14px -12px 0; border-radius: 14px 14px 0 0; border-bottom: 0;
    box-shadow: 0 -8px 24px rgba(20, 24, 28, .14); gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }
  .sheet-body.cc-mode .cc-foot { order: 1; }
  .cc-controls .cc-label { display: none; }
  .cc-widths { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .cc-widths .chip { min-height: 40px; padding: 6px 14px; }
  .cc-et { gap: 8px; }
  .cc-et .btn-icon { width: 44px; height: 44px; }
  .cc-et input[type=range] { height: 10px; }
  .cc-et input[type=range]::-webkit-slider-thumb { width: 30px; height: 30px; }
  .cc-et input[type=range]::-moz-range-thumb { width: 26px; height: 26px; }
  .cc-hint { font-size: .8rem; margin-top: 2px; }
  .cc-summary { font-size: .85rem; padding: 6px 10px; gap: 2px 10px; }
}
@media (max-width: 600px) {
  .sheet-head { padding: 10px 12px; }
  .sheet-head .size-mark { font-size: 1.3rem; }
  .sheet-sub { font-size: .8rem; }
}
.sheet-body.cc-mode .diagrams .fig:nth-child(2) { order: -1; }
