/* ComparaCarritos — hoja de estilos
   Estética de plano técnico (papel milimetrado y cotas) con los colores del logo: azul petróleo
   (#105060) como tinta, naranja (#d85018, más oscuro en los textos para que se lea) como acento y
   melocotón (#f8e0c8) para resaltar el mejor dato. Todos los textos cumplen un contraste de 4,5:1. */

:root {
  --paper: #f4f7f7;
  --paper-2: #e7eeef;
  --sheet: #fdfefe;
  --ink: #105060;
  --ink-2: #3a5d68;
  --muted: #526a77;
  --grid: #d3e0e2;
  --grid-major: #b6cacd;
  --rule: #c6d6d9;
  --accent: #b2410f;
  --accent-ink: #ffffff;
  --best-bg: #fbe6d4;
  --warn: #8a5d00;
  --shadow: rgba(16, 80, 96, 0.4);

  /* Series de los dibujos y la ficha comparada: la primera es el azul petróleo, la segunda el naranja */
  --s1: #0f7286;
  --s2: #c84a14;
  --s3: #2b7a3d;
  --s4: #7c4bc0;
  --s5: #b8336a;
  --s6: #3557c0;

  --f-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "Barlow", "Segoe UI", system-ui, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.5rem, 5.2vw, 3.75rem);

  --radius: 6px;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1240px;
  color-scheme: only light; /* solo tema claro; «only» pide al navegador que no la oscurezca por su cuenta */
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

img { max-width: 100%; display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: var(--radius);
}
.skip:focus { top: 12px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.05; margin: 0; letter-spacing: 0; }
h1 { font-size: var(--step-4); font-weight: 600; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
p { margin: 0; }

/* ---------- Header */
.site-header { border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 72px; }
.logo { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; margin-right: auto; min-width: 0; }
/* el texto del logo ocupa solo una cuarta parte de su altura (el carrito es más alto) */
.logo-img { height: 54px; width: auto; max-width: none; flex: none; }
.logo-tag { color: var(--muted); font-size: var(--step--1); line-height: 1.3; max-width: 20ch; padding-left: 14px; border-left: 1px solid var(--rule); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: var(--radius);
  font-weight: 500;
}
.nav a:hover { background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }
.lang { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.lang a {
  font-size: var(--step--1); font-weight: 600; background: transparent; color: var(--muted);
  padding: 6px 10px; text-decoration: none;
}
.lang a:hover { color: var(--ink); }
.lang a[aria-current="true"] { background: var(--ink); color: var(--paper); }

.nav a { white-space: nowrap; }
@media (max-width: 480px) {
  .nav a.nav-home { display: none; }
  .logo-img { height: 40px; }
  .lang a { padding: 6px 8px; }
}
@media (max-width: 640px) {
  .logo-tag { display: none; }
  .site-header .wrap { gap: 8px; }
  .nav a { padding: 8px 8px; }
}
@media (max-width: 360px) {
  .logo-img { height: 30px; }
  .site-header .wrap { gap: 6px; }
  .nav a { padding: 8px 6px; }
  .lang a { padding: 6px 7px; }
}

/* ---------- Hero */
.hero { padding: clamp(28px, 5vw, 56px) 0 8px; }
.hero h1 { max-width: 16ch; }
.hero .lead { margin-top: 14px; max-width: 58ch; color: var(--ink-2); font-size: var(--step-1); line-height: 1.45; }

/* ---------- Catalog */
.section { margin-top: clamp(36px, 6vw, 64px); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; margin-bottom: 16px; }
.section-head p { color: var(--muted); }
/* portada: el catálogo va justo debajo de la entradilla, sin título propio */
.catalog-section { margin-top: 28px; }
.catalog-lead { color: var(--muted); margin-bottom: 12px; max-width: 75ch; }

.filters {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end;
  padding: 14px 16px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
}
/* En escritorio los filtros se ven siempre: el contenedor no cuenta para el flex y no hay botón «Filtros» */
.filter-fields { display: contents; }
.filters-toggle { display: none; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span, .field legend { font-size: var(--step--1); color: var(--muted); font-weight: 500; padding: 0; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg button, .seg a, .chipbtn {
  font: inherit; font-size: 0.9375rem; font-weight: 500;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-2);
  padding: 6px 12px; border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
.seg button:hover, .seg a:hover, .chipbtn:hover { border-color: var(--ink-2); }
.seg button[aria-pressed="true"], .seg a[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
/* número de carritos de cada marca en el filtro */
.seg .n { font-size: 0.8125rem; color: var(--muted); margin-left: 2px; }
/* Marca: desplegable (escala a muchas marcas), a la altura de los botones */
.facet-select select { min-width: 13rem; min-height: 36px; padding: 5px 10px; }
.seg [aria-pressed="true"] .n { color: inherit; opacity: 0.75; }
/* opción sin carritos con los demás filtros: se puede pulsar, pero se ve apagada */
.seg button.zero:not([aria-pressed="true"]) { opacity: 0.5; }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-2); }
.empty p + * { margin-top: 12px; }
input[type="number"], select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 7px 10px; min-height: 38px;
}
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; min-height: 38px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.count { margin-left: auto; color: var(--muted); font-size: var(--step--1); align-self: center; }

.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
table { border-collapse: collapse; width: 100%; }
.catalog th, .catalog td { padding: 10px 12px; text-align: left; vertical-align: middle; }
.catalog thead th {
  font-size: var(--step--1); font-weight: 600; color: var(--muted); white-space: nowrap;
  border-bottom: 1px solid var(--rule); background: var(--sheet); position: sticky; top: 0;
}
.catalog thead th button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 4px; align-items: center;
}
.catalog thead th button:hover { color: var(--ink); }
.catalog thead th[aria-sort] button { color: var(--ink); }
.sort-ind { font-size: 0.7em; }
.catalog tbody tr { border-bottom: 1px solid var(--grid); }
.catalog tbody tr:last-child { border-bottom: 0; }
.catalog tbody tr:hover { background: var(--paper); }
.num { text-align: right; white-space: nowrap; }
.catalog th.num, .catalog td.num { text-align: right; } /* .catalog td (alineado a la izquierda) pesa más que .num */
.dims { white-space: nowrap; }
.pose-note { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 400; font-family: var(--f-body); line-height: 1.3; margin-top: 2px; white-space: normal; }
.catalog .pose-note { white-space: nowrap; }
.unit { color: var(--muted); font-size: 0.85em; }

.thumb {
  width: 64px; height: 64px; border-radius: var(--radius); background: #fff; border: 1px solid var(--grid);
  object-fit: contain; padding: 2px;
  max-width: none; /* con max-width: 100% (regla general de img), la tabla encogía la columna de la foto */
}
.thumb-ph {
  width: 64px; height: 64px; border-radius: var(--radius); border: 1px dashed var(--grid-major);
  display: grid; place-items: center; color: var(--muted); font-family: var(--f-display); font-size: 0.8rem; text-align: center; line-height: 1.1; padding: 4px;
}
.vname { font-family: var(--f-display); font-size: 1.25rem; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.1; }
.vname:hover { color: var(--accent); text-decoration: underline; }
.vmeta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 3px; font-size: var(--step--1); color: var(--muted); }
.vmeta a { color: var(--muted); }

.cats { color: var(--ink-2); font-size: 0.9375rem; }

.selbtn {
  font: inherit; font-size: var(--step--1); font-weight: 600; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink-2);
  border-radius: var(--radius); padding: 6px 10px; min-height: 34px; display: inline-flex; gap: 6px; align-items: center;
}
.selbtn:hover { border-color: var(--accent); color: var(--accent); }
.selbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.selbtn svg { width: 14px; height: 14px; }


/* Filtros en el móvil: una fila por filtro, con la etiqueta a la izquierda y botones pequeños.
   Si no caben (p. ej. muchas marcas), los botones pasan a la línea siguiente: así no se esconde ninguno. */
@media (max-width: 640px) {
  .filters { padding: 8px 12px; gap: 6px; align-items: center; }
  /* plegados por defecto: el botón los abre y cierra (client.js añade .open) */
  .filters-toggle {
    display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 0.875rem; font-weight: 600;
    color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
    padding: 5px 10px; min-height: 34px; cursor: pointer;
  }
  .filters-toggle svg { width: 16px; height: 16px; }
  .filters-toggle[aria-expanded="true"] { background: var(--paper-2); border-color: var(--ink-2); }
  .filters-toggle .active-n {
    min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--ink); color: var(--paper);
    font-size: 0.75rem; line-height: 18px; text-align: center;
  }
  .filters-toggle .active-n[hidden] { display: none; }
  .filter-fields { display: flex; flex-direction: column; gap: 6px; order: 2; width: 100%; padding-top: 4px; }
  .filters:not(.open) .filter-fields { display: none; }
  .filters .field { flex-direction: row; align-items: flex-start; gap: 8px; width: 100%; min-width: 0; }
  /* float: la leyenda deja de ser la especial del fieldset y entra en el flex */
  .filters .field legend, .filters .facet-select > span { float: left; flex: none; width: 3.4rem; font-size: 0.75rem; line-height: 32px; }
  /* 16px: con menos, iOS amplía la página al tocar el desplegable */
  .filters .facet-select select { flex: 1; min-width: 0; min-height: 34px; padding: 4px 8px; font-size: 1rem; }
  .filters .seg { flex: 1; min-width: 0; gap: 4px; }
  .filters .seg button { white-space: nowrap; font-size: 0.8125rem; padding: 4px 9px; min-height: 32px; }
  .filters .seg .n { font-size: 0.75rem; }
  /* «Todas»: su número es el mismo que «N versiones» */
  .filters .seg button[data-value="all"] .n { display: none; }
  .filters .count { margin-left: auto; font-size: 0.75rem; }
}
@media (max-width: 760px) {
  .catalog thead { display: none; }
  .catalog, .catalog tbody, .catalog tr, .catalog td { display: block; }
  .catalog tbody tr {
    display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px; align-items: start;
  }
  .catalog td { padding: 0; }
  .catalog td.c-img { grid-row: span 2; }
  .catalog td.c-sel { grid-column: 3; grid-row: 1; }
  .catalog td.c-name { grid-column: 2; grid-row: 1; }
  .catalog td[data-label] { grid-column: 2 / 4; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .catalog td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: var(--step--1); text-align: left; }
  .catalog td.c-cats { grid-column: 2 / 4; }
}

/* ---------- Buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius); padding: 9px 16px; min-height: 40px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--ink); background: var(--paper-2); color: var(--ink); }
.btn svg { width: 14px; height: 14px; flex: none; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Tray */
.tray {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--sheet); border-top: 1px solid var(--rule);
  box-shadow: 0 -8px 24px -18px var(--shadow);
}
.tray .wrap { display: flex; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.tray-list { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; padding: 2px; }
.tray-chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none;
  border: 1px solid var(--rule); border-radius: 999px; padding: 3px 4px 3px 10px; background: var(--paper);
  font-family: var(--f-display); font-weight: 600; font-size: 1rem;
}
.tray-chip button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem;
}
.tray-chip button:hover { background: var(--paper-2); color: var(--ink); }
.swatch { width: 18px; height: 8px; flex: none; }
body.has-tray { padding-bottom: 76px; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(12px); opacity: 0;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); z-index: 40;
  max-width: min(92vw, 460px); pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Breadcrumb / page head */
.crumbs { margin-top: 24px; font-size: var(--step--1); color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.crumbs span[aria-hidden] { color: var(--grid-major); }
.page-head { margin-top: 10px; display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.page-head .lead { margin-top: 10px; color: var(--ink-2); max-width: 60ch; font-size: var(--step-1); line-height: 1.45; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-img {
  width: 220px; height: 220px; object-fit: contain; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px;
}
@media (max-width: 640px) {
  .page-head { grid-template-columns: 1fr; }
  .hero-img { width: 160px; height: 160px; grid-row: 1; }
}

.keyfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin-top: 24px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.keyfacts div { background: var(--sheet); padding: 12px 14px; }
.keyfacts dt { font-size: var(--step--1); color: var(--muted); }
.keyfacts dd { margin: 2px 0 0; font-family: var(--f-display); font-size: 1.5rem; font-weight: 600; line-height: 1.15; }
.keyfacts dd .unit { font-family: var(--f-body); font-size: 0.8rem; font-weight: 400; }

/* ---------- Drawing */
.drawing-block { margin-top: 20px; }
.draw-controls { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; margin-bottom: 12px; }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .panels { grid-template-columns: 1fr; } }
.panel {
  background-color: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 12px 6px;
}
/* Selector de versión y año en la ficha */
.version-pick { margin-top: 16px; max-width: 30rem; }
.version-pick select { width: 100%; }
.panel h4 { font-family: var(--f-display); font-size: 1.2rem; font-weight: 600; line-height: 1.05; margin: 0 0 4px; }
.view-ico { flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.panel-head { display: flex; align-items: center; gap: 12px; }
.panel-head .view-ico { width: 46px; height: 38px; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 4px 6px; box-sizing: content-box; }
.panel-head h4 { margin: 0; }
.panel-view { font-size: 0.9375rem; color: var(--ink-2); margin-top: 3px; }
.panel-view span { color: var(--muted); font-size: var(--step--1); margin-left: 4px; }
.seg-views { margin-top: 10px; }
.seg .view-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; padding: 5px 10px; }
.seg .view-btn .view-ico { width: 24px; height: 20px; stroke-width: 2.8; }
.panel-use { font-size: var(--step--1); color: var(--muted); margin: 8px 0 2px; }
.draw-notes { margin-top: 10px; }
.draw-notes p { font-size: var(--step--1); color: var(--muted); }
.draw-notes p + p { margin-top: 2px; }
.panel svg { width: 100%; height: auto; display: block; }

.dw-grid { stroke: var(--grid); stroke-width: 0.6; }
.dw-grid.major { stroke: var(--grid-major); stroke-width: 0.9; }
.dw-axis { font-family: var(--f-body); font-size: 9px; fill: var(--muted); }
.dw-ground { stroke: var(--ink); stroke-width: 1.3; }
.dw-hatch { stroke: var(--ink-2); stroke-width: 0.7; }
.dw-box { stroke: var(--c); fill: var(--c); fill-opacity: 0.035; stroke-width: 2; vector-effect: non-scaling-stroke; }
.dw-ext { stroke: var(--c); stroke-width: 0.7; stroke-dasharray: 2 2; opacity: 0.8; }
.dw-cota { stroke: var(--c); stroke-width: 1; }
.dw-text {
  fill: var(--c); font-family: var(--f-display); font-weight: 600; font-size: 12.5px;
  paint-order: stroke; stroke: var(--sheet); stroke-width: 3.5px; stroke-linejoin: round;
}
.dw-ref { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 3; fill: none; }
.dw-ref-text { fill: var(--muted); font-family: var(--f-body); font-size: 10px; }

.ser-0 { --c: var(--s1); } .ser-1 { --c: var(--s2); } .ser-2 { --c: var(--s3); }
.ser-3 { --c: var(--s4); } .ser-4 { --c: var(--s5); } .ser-5 { --c: var(--s6); }

/* Leyenda del dibujo: encima de los paneles. En el móvil los paneles van uno debajo de otro, así que
   se queda fija bajo la cabecera mientras se ve el dibujo. */
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; font-size: 0.9375rem; }
@media (max-width: 760px) {
  .drawing-block .legend {
    position: sticky; top: 72px; z-index: 3; background: var(--paper); gap: 4px 12px; font-size: 0.8125rem;
    padding: 8px 0; margin-bottom: 8px; border-bottom: 1px solid var(--rule);
  }
  .drawing-block .legend svg { width: 22px; }
}
.legend span { display: inline-flex; gap: 8px; align-items: center; }
.legend svg, .key svg { width: 28px; height: 10px; flex: none; }
.key-line { stroke: var(--c); stroke-width: 2.5; }

/* ---------- Compare */
.cmp-heads { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-top: 20px; }
.cmp-card { background: var(--sheet); border: 1px solid var(--rule); border-top: 4px solid var(--c); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.cmp-card img, .cmp-card .thumb-ph { width: 100%; height: 120px; object-fit: contain; background: #fff; border-radius: 4px; }
.cmp-card .thumb-ph { background: transparent; }
.cmp-card .rm {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--rule);
  background: var(--sheet); color: var(--ink-2); cursor: pointer; font-size: 1rem; display: grid; place-items: center; text-decoration: none;
}
.cmp-card .rm:hover { border-color: var(--ink); color: var(--ink); }
.cmp-add { border: 1px dashed var(--grid-major); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.cmp-add select { width: 100%; }
.key { display: inline-flex; align-items: center; gap: 6px; font-size: var(--step--1); color: var(--muted); }
/* Comparador en el móvil: las tarjetas de los carritos de tres en tres, con la foto pequeña */
@media (max-width: 640px) {
  .cmp-heads { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .cmp-card { padding: 6px; gap: 4px; }
  .cmp-card img, .cmp-card .thumb-ph { height: 72px; }
  .cmp-card .vname { font-size: 1rem; line-height: 1.1; }
  .cmp-card .key { font-size: 0.75rem; gap: 4px; }
  .cmp-card .rm { width: 26px; height: 26px; top: 3px; right: 3px; font-size: 0.875rem; }
  .cmp-add { grid-column: 1 / -1; padding: 10px; }
}

.trunk { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.trunk-inputs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.trunk-inputs input { width: 96px; }
.trunk-res { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; }
.trunk-res li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.trunk-res b { font-family: var(--f-display); font-size: 1.1rem; font-weight: 600; color: var(--c); }
.fit-yes { color: var(--s3); font-weight: 600; }
.fit-no { color: var(--ink-2); }

.spec-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
.spec { table-layout: fixed; min-width: calc(220px + var(--n, 1) * 170px); }
.spec .c-label { width: 220px; }
.spec th, .spec td { padding: 9px 12px; overflow-wrap: anywhere; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: top; }
.spec thead th { vertical-align: bottom; border-bottom: 1px solid var(--rule); font-family: var(--f-display); font-size: 1.1rem; font-weight: 600; min-width: 150px; }
.spec thead th .key-line { stroke-width: 3; }
.spec tbody th { font-weight: 500; color: var(--ink-2); min-width: 190px; position: sticky; left: 0; background: var(--sheet); z-index: 1; }
.spec .grp th {
  font-family: var(--f-display); font-size: 1.15rem; font-weight: 600; color: var(--ink); background: var(--paper-2);
  padding-top: 8px; padding-bottom: 8px; position: static;
}
.spec td.best { background: var(--best-bg); font-weight: 600; }
.spec td.best::after { content: attr(data-best); display: block; font-size: 0.72rem; font-weight: 500; color: var(--accent); }
.spec td .muted, .muted { color: var(--muted); }
.spec .grp-note { display: block; font-family: var(--f-body); font-size: 0.8rem; font-weight: 400; color: var(--muted); margin-top: 2px; }
.spec td small { display: block; color: var(--muted); font-size: 0.78rem; line-height: 1.3; margin-top: 2px; }
.dash { color: var(--muted); }
.flag { color: var(--warn); font-weight: 700; cursor: help; text-decoration: none; border-bottom: 1px dotted currentColor; }
.spec tr.same td { color: var(--ink-2); }
/* «Solo diferencias» (client.js añade .only-diff a la tabla) */
.spec.only-diff tr.same, .spec.only-diff tr.grp.all-same { display: none; }

/* Ficha técnica en el móvil. Con varios carritos (.multi), el nombre de cada fila va en su propia línea,
   encima de los valores, y los carritos se reparten todo el ancho: caben 2 o 3. Con más, la tabla se
   desplaza en horizontal, pero los nombres de fila y de grupo se quedan a la izquierda (sticky). Con 2 o 3
   (.fit) no hay desplazamiento lateral, así que la fila con los nombres de los carritos se queda arriba. */
@media (max-width: 640px) {
  .spec { min-width: 0; width: 100%; }
  .spec .c-label { width: 42%; }
  .spec th, .spec td { padding: 8px 10px; }
  .spec tbody th { position: static; min-width: 0; }

  .spec.multi, .spec.multi thead, .spec.multi tbody { display: block; }
  .spec.multi colgroup { display: none; }
  .spec.multi { min-width: calc(var(--n) * 104px); }
  .spec.multi tr { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); border-bottom: 1px solid var(--grid); }
  .spec.multi th, .spec.multi td { border-bottom: 0; }
  .spec.multi thead tr { border-bottom-color: var(--rule); }
  .spec.multi thead td { display: none; }
  .spec.multi thead th { min-width: 0; font-size: 1rem; line-height: 1.15; padding: 10px; }
  .spec.multi thead th .vmeta { margin-top: 1px; }
  .spec.multi tbody th {
    grid-column: 1 / -1; justify-self: start; position: sticky; left: 0; z-index: 1;
    background: none; padding: 8px 10px 0; font-size: 0.8125rem; color: var(--muted);
  }
  .spec.multi td { padding: 2px 10px 8px; }
  .spec.multi td.best::after { font-size: 0.6875rem; }
  .spec.multi tr.grp th {
    width: calc(100vw - 2 * var(--gutter) - 2px); background: var(--paper-2);
    padding: 8px 10px; font-size: 1.05rem; color: var(--ink);
  }
  .spec-wrap.fit { overflow: visible; }
  .spec-wrap.fit .spec.multi thead { position: sticky; top: 72px; z-index: 2; background: var(--sheet); box-shadow: 0 1px 0 var(--rule); }
}
/* Filtros del catálogo: las filas ocultas no deben mostrarse ni en la vista de tarjetas del móvil */
.catalog[hidden], .catalog tr[hidden] { display: none !important; }

/* ---------- Ficha */
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.hl { padding-left: 1.1em; margin: 10px 0 0; display: grid; gap: 6px; max-width: 70ch; }
.note { color: var(--muted); font-size: var(--step--1); margin-top: 6px; max-width: 70ch; }
.packs { width: 100%; }
.packs th, .packs td { padding: 8px 10px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
.packs thead th { font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.notes-list { margin-top: 10px; display: grid; gap: 4px; }

/* ---------- Final de la página (no hay pie) */
main { display: block; padding-bottom: clamp(48px, 8vw, 72px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
