/* ============================================================
   CARPINTERÍA MUNDO — Estilos Base
   Identidad visual para el cotizador automático
   ============================================================ */

:root {
  /* Paleta Carpintería Mundo */
  --cm-primario: #5C3D2E;        /* Café oscuro — madera */
  --cm-primario-claro: #8B6914;  /* Dorado madera */
  --cm-secundario: #D4A84B;      /* Dorado cálido */
  --cm-acento: #2E7D32;          /* Verde — confianza */
  --cm-fondo: #FAF7F2;           /* Crema suave */
  --cm-fondo-card: #FFFFFF;
  --cm-texto: #333333;
  --cm-texto-claro: #666666;
  --cm-borde: #E0D5C7;
  --cm-exito: #2E7D32;
  --cm-advertencia: #F57C00;
  --cm-error: #C62828;
  --cm-info: #1565C0;

  /* Gamas */
  --gama-baja: #78909C;
  --gama-media: #5C6BC0;
  --gama-alta: #D4A84B;
  --gama-premium: #8B6914;

  /* Tipografía */
  --fuente-principal: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --fuente-titulo: 'Georgia', 'Times New Roman', serif;

  /* Espaciado */
  --espaciado-xs: 4px;
  --espaciado-sm: 8px;
  --espaciado-md: 16px;
  --espaciado-lg: 24px;
  --espaciado-xl: 32px;
  --espaciado-2xl: 48px;

  /* Bordes */
  --radio-sm: 4px;
  --radio-md: 8px;
  --radio-lg: 12px;
  --radio-xl: 16px;

  /* Sombras */
  --sombra-sm: 0 1px 3px rgba(0,0,0,0.1);
  --sombra-md: 0 4px 12px rgba(0,0,0,0.1);
  --sombra-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* --- RESET --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--fuente-principal);
  color: var(--cm-texto);
  background-color: var(--cm-fondo);
  line-height: 1.5;
  min-height: 100vh;
}

/* --- TIPOGRAFÍA --- */
h1, h2, h3 {
  font-family: var(--fuente-titulo);
  color: var(--cm-primario);
  line-height: 1.2;
}

h1 { font-size: 1.75rem; margin-bottom: var(--espaciado-md); }
h2 { font-size: 1.375rem; margin-bottom: var(--espaciado-sm); }
h3 { font-size: 1.125rem; margin-bottom: var(--espaciado-sm); }

/* --- LAYOUT --- */
.contenedor {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--espaciado-md);
}

.contenedor--ancho {
  max-width: 960px;
}

/* --- HEADER --- */
.header {
  background: linear-gradient(135deg, var(--cm-primario), var(--cm-primario-claro));
  color: white;
  padding: var(--espaciado-lg) var(--espaciado-md);
  text-align: center;
}

.header h1 {
  color: white;
  font-size: 1.5rem;
  margin-bottom: var(--espaciado-xs);
}

.header .subtitulo {
  color: var(--cm-secundario);
  font-size: 0.875rem;
  font-weight: 500;
}

.logo {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--espaciado-sm);
  background: var(--cm-secundario);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fuente-titulo);
  font-size: 2rem;
  font-weight: bold;
  color: var(--cm-primario);
}

/* --- CARDS --- */
.card {
  background: var(--cm-fondo-card);
  border-radius: var(--radio-lg);
  padding: var(--espaciado-lg);
  margin-bottom: var(--espaciado-md);
  box-shadow: var(--sombra-sm);
  border: 1px solid var(--cm-borde);
}

.card--destacada {
  border-color: var(--cm-secundario);
  box-shadow: var(--sombra-md);
}

.card__titulo {
  font-size: 1rem;
  font-weight: 600;
  color: var(--cm-primario);
  margin-bottom: var(--espaciado-md);
  padding-bottom: var(--espaciado-sm);
  border-bottom: 2px solid var(--cm-borde);
}

/* --- FORMULARIO --- */
.campo {
  margin-bottom: var(--espaciado-md);
}

.campo label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cm-texto);
  margin-bottom: var(--espaciado-xs);
}

.campo input,
.campo select,
.campo textarea {
  width: 100%;
  padding: var(--espaciado-sm) var(--espaciado-md);
  border: 1px solid var(--cm-borde);
  border-radius: var(--radio-md);
  font-size: 1rem;
  font-family: var(--fuente-principal);
  color: var(--cm-texto);
  background: white;
  transition: border-color 0.2s;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--cm-secundario);
  box-shadow: 0 0 0 3px rgba(212, 168, 75, 0.15);
}

.campo input[type="number"] {
  -moz-appearance: textfield;
}

/* --- BOTONES --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--espaciado-sm);
  padding: var(--espaciado-sm) var(--espaciado-lg);
  border: none;
  border-radius: var(--radio-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: var(--fuente-principal);
}

.btn--primario {
  background: var(--cm-primario);
  color: white;
}
.btn--primario:hover { background: #4A3125; }
.btn--primario:active { transform: scale(0.98); }

.btn--secundario {
  background: var(--cm-secundario);
  color: var(--cm-primario);
}
.btn--secundario:hover { background: #C49A3F; }

.btn--outline {
  background: transparent;
  color: var(--cm-primario);
  border: 2px solid var(--cm-primario);
}
.btn--outline:hover { background: var(--cm-primario); color: white; }

.btn--block {
  display: flex;
  width: 100%;
}

.btn--lg {
  padding: var(--espaciado-md) var(--espaciado-xl);
  font-size: 1.125rem;
}

/* --- TABLAS --- */
.tabla-contenedor {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--espaciado-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: var(--cm-primario);
  color: white;
  padding: var(--espaciado-sm) var(--espaciado-md);
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

tbody td {
  padding: var(--espaciado-sm) var(--espaciado-md);
  border-bottom: 1px solid var(--cm-borde);
}

tbody tr:hover {
  background: rgba(212, 168, 75, 0.05);
}

/* --- BADGES DE GAMA --- */
.gama-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

.gama-badge--baja { background: var(--gama-baja); }
.gama-badge--media { background: var(--gama-media); }
.gama-badge--alta { background: var(--gama-alta); color: var(--cm-primario); }
.gama-badge--premium { background: var(--gama-premium); }

/* --- OPCIONES (radio/checkbox visual) --- */
.opciones {
  display: flex;
  flex-direction: column;
  gap: var(--espaciado-sm);
}

.opcion {
  display: flex;
  align-items: center;
  gap: var(--espaciado-md);
  padding: var(--espaciado-md);
  border: 2px solid var(--cm-borde);
  border-radius: var(--radio-md);
  cursor: pointer;
  transition: all 0.2s;
}

.opcion:hover {
  border-color: var(--cm-secundario);
  background: rgba(212, 168, 75, 0.05);
}

.opcion.seleccionada {
  border-color: var(--cm-secundario);
  background: rgba(212, 168, 75, 0.1);
}

.opcion input[type="radio"],
.opcion input[type="checkbox"] {
  accent-color: var(--cm-secundario);
  width: 18px;
  height: 18px;
}

.opcion__texto {
  flex: 1;
}

.opcion__titulo {
  font-weight: 600;
  font-size: 0.9375rem;
}

.opcion__desc {
  font-size: 0.8125rem;
  color: var(--cm-texto-claro);
}

.opcion__img {
  width: 60px;
  height: 60px;
  border-radius: var(--radio-sm);
  object-fit: cover;
  background: var(--cm-borde);
}

/* --- STEPPER (pasos) --- */
.stepper {
  display: flex;
  justify-content: center;
  gap: var(--espaciado-xs);
  padding: var(--espaciado-md) 0;
}

.stepper__paso {
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--cm-borde);
  transition: all 0.3s;
}

.stepper__paso--activo {
  background: var(--cm-secundario);
  width: 48px;
}

.stepper__paso--completo {
  background: var(--cm-acento);
}

/* --- PRECIO --- */
.precio {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cm-primario);
}

.precio--grande {
  font-size: 2rem;
}

.precio__moneda {
  font-size: 0.75em;
  vertical-align: super;
}

.precio__nota {
  font-size: 0.75rem;
  color: var(--cm-texto-claro);
  font-weight: 400;
}

/* --- ALERTAS --- */
.alerta {
  padding: var(--espaciado-md);
  border-radius: var(--radio-md);
  font-size: 0.875rem;
  margin-bottom: var(--espaciado-md);
}

.alerta--info {
  background: #E3F2FD;
  color: var(--cm-info);
  border: 1px solid #90CAF9;
}

.alerta--exito {
  background: #E8F5E9;
  color: var(--cm-exito);
  border: 1px solid #A5D6A7;
}

.alerta--advertencia {
  background: #FFF3E0;
  color: var(--cm-advertencia);
  border: 1px solid #FFCC80;
}

.alerta--error {
  background: #FFEBEE;
  color: var(--cm-error);
  border: 1px solid #EF9A9A;
}

/* --- COMPARATIVO DE GAMAS --- */
.comparativo {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--espaciado-md);
}

.gama-card {
  border: 2px solid var(--cm-borde);
  border-radius: var(--radio-lg);
  overflow: hidden;
  transition: all 0.2s;
}

.gama-card--recomendada {
  border-color: var(--cm-secundario);
  box-shadow: var(--sombra-md);
}

.gama-card__header {
  padding: var(--espaciado-md);
  color: white;
  text-align: center;
}

.gama-card__header--baja { background: var(--gama-baja); }
.gama-card__header--media { background: var(--gama-media); }
.gama-card__header--alta { background: linear-gradient(135deg, var(--gama-alta), var(--gama-premium)); color: var(--cm-primario); }
.gama-card__header--premium { background: linear-gradient(135deg, var(--gama-premium), #A67C00); }

.gama-card__body {
  padding: var(--espaciado-md);
}

.gama-card__precio {
  text-align: center;
  padding: var(--espaciado-md);
  background: var(--cm-fondo);
}

/* --- UTILIDADES --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-sm { margin-top: var(--espaciado-sm); }
.mt-md { margin-top: var(--espaciado-md); }
.mt-lg { margin-top: var(--espaciado-lg); }
.mb-md { margin-bottom: var(--espaciado-md); }
.mb-lg { margin-bottom: var(--espaciado-lg); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: var(--espaciado-sm); }
.gap-md { gap: var(--espaciado-md); }
.hidden { display: none !important; }

/* --- RESPONSIVE --- */
@media (min-width: 768px) {
  .contenedor { max-width: 720px; }

  .comparativo {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .contenedor--ancho { max-width: 1100px; }

  .comparativo {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- COTIZADOR ESPECÍFICO --- */
.paso {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Opción seleccionada visual feedback */
.opcion:has(input:checked) {
  border-color: var(--cm-secundario);
  background: rgba(212, 168, 75, 0.1);
}

/* Fix for select inside campo on mobile */
.campo select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* --- RESULTADO / PRESENTACIÓN (Fase 4) --- */
.resultado-header {
  text-align: center;
  padding: var(--espaciado-xl) var(--espaciado-md);
  background: linear-gradient(135deg, var(--cm-primario), var(--cm-primario-claro));
  border-radius: var(--radio-lg);
  margin-bottom: var(--espaciado-lg);
  color: white;
}

.resultado-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--espaciado-sm);
  background: var(--cm-secundario);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fuente-titulo);
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--cm-primario);
}

.resultado-titulo {
  color: white;
  font-size: 1.5rem;
  margin-bottom: 0;
}

.resultado-subtitulo {
  color: var(--cm-secundario);
  font-size: 0.9rem;
  margin-top: var(--espaciado-xs);
}

/* Gama cards — presentación */
.gama-card {
  display: flex;
  flex-direction: column;
}

.gama-card__material {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.gama-card__nivel {
  font-size: 1.125rem;
  font-weight: 700;
  font-family: var(--fuente-titulo);
}

.gama-recomendada-badge {
  display: inline-block;
  background: white;
  color: var(--cm-primario);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
  margin-bottom: var(--espaciado-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gama-card__precio {
  padding: var(--espaciado-md);
  text-align: center;
  background: var(--cm-fondo);
}

.gama-card__precio .precio--grande {
  font-size: 1.35rem;
}

.gama-beneficios {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--espaciado-md) 0;
  font-size: 0.85rem;
}

.gama-beneficios li {
  padding: var(--espaciado-xs) 0;
  border-bottom: 1px solid var(--cm-borde);
  padding-left: 18px;
  position: relative;
}

.gama-beneficios li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--cm-acento);
  font-weight: bold;
}

.gama-pagos {
  background: var(--cm-fondo);
  border-radius: var(--radio-sm);
  padding: var(--espaciado-sm) var(--espaciado-md);
  font-size: 0.85rem;
}

.gama-pagos .flex-between {
  padding: var(--espaciado-xs) 0;
}

.gama-desglose {
  margin-top: var(--espaciado-md);
  font-size: 0.8rem;
}

.gama-desglose table {
  font-size: 0.8rem;
}

.gama-desglose .desglose-total td {
  border-top: 2px solid var(--cm-primario);
  padding-top: var(--espaciado-sm);
}

.btn--sm {
  padding: var(--espaciado-xs) var(--espaciado-md);
  font-size: 0.8rem;
}

/* Condiciones comerciales */
.condiciones-lista {
  list-style: none;
  padding: 0;
  font-size: 0.85rem;
}

.condiciones-lista li {
  padding: var(--espaciado-sm) 0;
  border-bottom: 1px solid var(--cm-borde);
  line-height: 1.4;
}

.condiciones-lista li:last-child {
  border-bottom: none;
}

/* --- PANEL DE ADMINISTRACIÓN (Fase 5) --- */
.admin-nav {
  display: flex;
  gap: var(--espaciado-xs);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--espaciado-sm);
  margin-bottom: var(--espaciado-md);
}

.admin-nav__btn {
  flex-shrink: 0;
  padding: var(--espaciado-sm) var(--espaciado-md);
  border: 1px solid var(--cm-borde);
  border-radius: var(--radio-md);
  background: white;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cm-texto-claro);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--fuente-principal);
}

.admin-nav__btn:hover {
  border-color: var(--cm-secundario);
  color: var(--cm-primario);
}

.admin-nav__btn--activo {
  background: var(--cm-primario);
  color: white;
  border-color: var(--cm-primario);
}

.admin-subtitulo {
  font-size: 0.9rem;
  color: var(--cm-primario);
  margin: var(--espaciado-md) 0 var(--espaciado-sm) 0;
  padding-bottom: var(--espaciado-xs);
  border-bottom: 1px dashed var(--cm-borde);
}

.admin-campo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--espaciado-sm);
  padding: var(--espaciado-sm) 0;
  border-bottom: 1px solid var(--cm-borde);
}

.admin-campo--modificado {
  background: rgba(212, 168, 75, 0.08);
  margin: 0 calc(-1 * var(--espaciado-sm));
  padding: var(--espaciado-sm);
  border-radius: var(--radio-sm);
}

.admin-campo__info {
  flex: 1;
  min-width: 0;
}

.admin-campo__label {
  font-size: 0.85rem;
  font-weight: 500;
  display: block;
}

.admin-campo__original {
  font-size: 0.7rem;
  color: var(--cm-advertencia);
}

.admin-campo__input {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.admin-campo__input input {
  width: 90px;
  padding: 4px 8px;
  border: 1px solid var(--cm-borde);
  border-radius: var(--radio-sm);
  font-size: 0.85rem;
  text-align: right;
  font-family: var(--fuente-principal);
}

.admin-campo__input input:focus {
  outline: none;
  border-color: var(--cm-secundario);
}

.admin-campo__unidad {
  font-size: 0.7rem;
  color: var(--cm-texto-claro);
  white-space: nowrap;
}

.admin-campo__reset {
  background: none;
  border: none;
  color: var(--cm-error);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.admin-total {
  text-align: right;
  font-weight: 700;
  color: var(--cm-primario);
  padding: var(--espaciado-sm) 0;
  font-size: 0.95rem;
}

/* ============================================================
   SUB-STEPPER (paso 2 interno)
   ============================================================ */
.sub-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1px solid var(--cm-borde);
  border-radius: var(--radio-lg);
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: var(--sombra-sm);
}
.sub-stepper__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cm-texto-claro);
}
.sub-stepper__label strong { color: var(--cm-primario); }
.sub-stepper__dots { display: flex; gap: 5px; }
.sub-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--cm-borde);
  transition: background 0.2s, transform 0.2s;
}
.sub-dot--activo { background: var(--cm-secundario); transform: scale(1.3); }
.sub-dot--completo { background: var(--cm-primario); }

/* Sub-pasos (ocultos por defecto) */
.sub-paso { display: none; }
.sub-paso--activo { display: block; }

/* ============================================================
   OPCIONES CON IMAGEN (paso 2)
   ============================================================ */
.opciones-imagen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.opcion--imagen {
  border: 2px solid var(--cm-borde);
  border-radius: var(--radio-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
  user-select: none;
}
.opcion--imagen:hover { border-color: var(--cm-secundario); box-shadow: var(--sombra-md); }
.opcion--imagen.opcion--seleccionada {
  border-color: var(--cm-primario);
  box-shadow: 0 0 0 3px rgba(92,61,46,0.12);
}
.opcion--imagen.opcion--deshabilitada {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.opcion__galeria {
  width: 100%;
  aspect-ratio: 4/3;
  background: #F5F0EB;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.opcion__galeria img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opcion__galeria-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--cm-texto-claro);
  font-size: 0.75rem;
  text-align: center;
  padding: 8px;
  width: 100%; height: 100%;
}
.opcion__galeria-placeholder .icono { font-size: 1.8rem; margin-bottom: 4px; opacity: 0.5; }
.opcion__body {
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.opcion__body .opcion__titulo { font-size: 0.875rem; }
.opcion__body .opcion__desc { font-size: 0.75rem; }

/* Radio visual para opciones-imagen */
.opcion__radio-vis {
  width: 18px; height: 18px;
  border: 2px solid var(--cm-borde);
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.2s;
}
.opcion--seleccionada .opcion__radio-vis {
  border-color: var(--cm-primario);
  background: var(--cm-primario);
  box-shadow: inset 0 0 0 3px white;
}

/* Checkbox visual para opciones-imagen multi-select */
.opcion__check-vis {
  width: 18px; height: 18px;
  border: 2px solid var(--cm-borde);
  border-radius: var(--radio-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0.7rem;
  color: transparent;
}
.opcion--seleccionada .opcion__check-vis {
  border-color: var(--cm-primario);
  background: var(--cm-primario);
  color: white;
}

/* ============================================================
   COMPARADOR LED
   ============================================================ */
.comparador-led {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.comparador-panel {
  border: 2px solid var(--cm-borde);
  border-radius: var(--radio-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
  background: white;
}
.comparador-panel:hover { border-color: var(--cm-secundario); }
.comparador-panel.opcion--seleccionada { border-color: var(--cm-primario); }
.comparador-img {
  width: 100%;
  aspect-ratio: 3/4;
  background: #F5F0EB;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.comparador-img img { width: 100%; height: 100%; object-fit: cover; }
.comparador-img-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--cm-texto-claro);
  text-align: center;
  padding: 6px;
  width: 100%; height: 100%;
}
.comparador-img-placeholder .icono { font-size: 2rem; margin-bottom: 4px; opacity: 0.4; }
.comparador-label {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.comparador-label .opcion__titulo { font-size: 0.8125rem; }

/* ============================================================
   OPCIONES ALTURA
   ============================================================ */
.opciones-altura {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.opcion--altura {
  border: 2px solid var(--cm-borde);
  border-radius: var(--radio-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
  text-align: center;
  background: white;
  user-select: none;
}
.opcion--altura:hover { border-color: var(--cm-secundario); }
.opcion--altura.opcion--seleccionada { border-color: var(--cm-primario); background: #FDF8F2; }
.opcion-altura__img {
  width: 100%;
  aspect-ratio: 3/4;
  background: #F5F0EB;
  position: relative;
  overflow: hidden;
}
.opcion-altura__img img { width: 100%; height: 100%; object-fit: cover; }
.altura-barra-vis {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: linear-gradient(to top, var(--cm-primario), var(--cm-primario-claro));
  display: flex;
  align-items: center;
  justify-content: center;
}
.altura-barra-vis span {
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 0;
}
.opcion-altura__label {
  padding: 8px 4px;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--cm-texto);
}

/* ============================================================
   AVISO DE RESTRICCIÓN DE NEGOCIO
   ============================================================ */
.aviso-restriccion {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #FFF3E0;
  border: 1px solid var(--cm-advertencia);
  border-radius: var(--radio-md);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.8125rem;
  color: #7A3800;
}
.aviso-restriccion .icono { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.aviso-restriccion a {
  color: var(--cm-primario);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

/* ============================================================
   VALIDACIÓN DE CAMPOS
   ============================================================ */
.campo--error {
  border-color: var(--cm-error) !important;
  box-shadow: 0 0 0 2px rgba(211,47,47,0.15);
}
.campo-error {
  display: block;
  color: var(--cm-error);
  font-size: 0.78rem;
  margin-top: 4px;
}
.campo-error.hidden { display: none; }

/* ============================================================
   SPINNER DE CARGA
   ============================================================ */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(92,61,46,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(212,168,83,0.3);
  border-top-color: var(--cm-dorado, #D4A853);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   ESTILOS DE IMPRESIÓN (Ctrl+P / Guardar como PDF)
   ============================================================ */
@media print {
  /* Ocultar todo lo que no es la cotización */
  .header,
  .stepper,
  .sub-stepper,
  .admin-nav,
  .paso:not(#paso-6),
  .btn,
  .btn--imprimir,
  footer {
    display: none !important;
  }

  /* Forzar colores claros para impresión */
  body {
    background: white !important;
    color: #111 !important;
    font-size: 11pt;
  }

  .contenedor {
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* Header de impresión con datos del proyecto */
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 16pt;
    padding-bottom: 8pt;
    border-bottom: 2pt solid #5C3D2E;
  }
  .print-header h1 {
    font-size: 18pt;
    color: #5C3D2E;
    margin: 0 0 4pt;
  }
  .print-header p {
    font-size: 10pt;
    color: #555;
    margin: 2pt 0;
  }

  /* Grid de gamas: forzar 2 columnas en papel */
  .comparativo-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8pt !important;
  }

  /* Cards de gama */
  .gama-card {
    page-break-inside: avoid;
    border: 1pt solid #ccc !important;
    border-radius: 4pt !important;
    padding: 8pt !important;
    background: white !important;
    box-shadow: none !important;
  }
  .gama-card__header {
    background: #5C3D2E !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 6pt 8pt !important;
    border-radius: 3pt 3pt 0 0 !important;
  }
  .gama-card--recomendada .gama-card__header {
    background: #D4A853 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Precio principal */
  .gama-card__precio {
    font-size: 16pt !important;
    font-weight: bold;
    color: #5C3D2E !important;
  }

  /* Desglose expandido automáticamente en impresión */
  .gama-card__desglose {
    display: block !important;
  }

  /* Condiciones comerciales */
  .resultado-condiciones {
    page-break-inside: avoid;
    margin-top: 12pt;
    font-size: 9pt;
    border-top: 1pt solid #ccc;
    padding-top: 8pt;
  }

  /* Ocultar botones de acción del paso 6 */
  .resultado-acciones {
    display: none !important;
  }

  /* Tabla de desglose */
  table {
    font-size: 9pt;
  }
  thead { background: #f0ece6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
   RESPONSIVE MÓVIL (aditivo)
   Todo este bloque vive dentro de media queries que NO aplican
   en escritorio (≥768px con puntero fino), por lo que el
   comportamiento desktop queda intacto.
   Los !important de esta sección existen únicamente para vencer
   atributos style="" inline del HTML/JS en pantallas chicas.
   ============================================================ */

/* --- Objetivos táctiles (dispositivos touch) --- */
@media (pointer: coarse) {
  .btn {
    min-height: 44px;
  }

  .campo input,
  .campo select {
    min-height: 44px;
  }

  /* Botón × para quitar un render (clase asignada en
     cotizador-items.js; su tamaño base viene de un style= inline) */
  .modal-img-cerrar {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.1rem !important;
  }
}

/* --- Teléfonos y tablets verticales --- */
@media (max-width: 767px) {
  .btn {
    min-height: 44px;
  }

  .campo input,
  .campo select {
    min-height: 44px;
  }

  /* Red de seguridad: el desglose por gama contiene una tabla
     generada en app.js; scroll horizontal interno en vez de
     desbordar la página */
  .gama-desglose {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .gama-desglose table {
    font-size: 0.8rem;
  }
}

/* --- Teléfonos --- */
@media (max-width: 480px) {
  /* Grid de renders del modo ítems: 2 columnas en vez de las 3
     fijadas por style= inline en cotizador-items.html */
  #renders-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Aviso flotante de Notion a lo ancho de la pantalla
     (clase asignada en cotizador-items.js) */
  .cm-toast {
    left: 16px !important;
    right: 16px !important;
    max-width: none !important;
  }
}

/* La envoltura .tabla-contenedor añadida en app.js al desglose trae
   margin-bottom:16px de su regla base; se neutraliza aquí para que el
   desglose se vea EXACTAMENTE igual que antes en desktop. Solo afecta
   al elemento nuevo (no existía ningún .tabla-contenedor dentro de
   .gama-desglose antes de este cambio). */
.gama-desglose .tabla-contenedor {
  margin-bottom: 0;
}

/* --- Teléfonos chicos --- */
@media (max-width: 380px) {
  :root {
    --espaciado-lg: 20px;
    --espaciado-xl: 28px;
  }

  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.25rem; }

  .header h1 {
    font-size: 1.3rem;
  }

  .logo {
    width: 64px;
    height: 64px;
    font-size: 1.6rem;
  }
}
