/* Hoja inferior del catálogo: tres alturas, pestañas, buscador, filtros, tarjetas, kits y ficha 3D.
   Usa los tokens de /estilos/base.css. Propietario: CATALOGO. */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; height: var(--sheet-h); z-index: 14; background: var(--surface); border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 28px rgba(20,24,31,.12), 0 -1px 0 rgba(20,24,31,.05); transition: height .24s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; overflow: hidden; }
.sheet.dragging { transition: none; }
.handle { height: 28px; flex: none; display: grid; place-items: center; cursor: grab; touch-action: none; }
.handle span { width: 44px; height: 5px; border-radius: 3px; background: #c9c6bf; }
.handle:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 12px; }

/* Cabecera: pestañas, buscador y acciones */
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px 16px; flex: none; }
.pestanas { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; flex: none; }
.pestanas button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.pestanas button svg { width: 15px; height: 15px; color: #e0a526; }
.pestanas button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(20,24,31,.12); }
.pestanas .n, .btn-icono .n { font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e8e6e0; color: #3a3f47; display: inline-grid; place-items: center; }
.pestanas .n:empty, .btn-icono .n:empty { display: none; }
.buscador { flex: 1; min-width: 120px; display: flex; align-items: center; gap: 8px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 14px; color: var(--muted); }
.buscador:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
#search { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; min-height: 42px; color: var(--text); }
.btn-icono { flex: none; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.btn-icono[aria-expanded="true"], .sheet.con-filtros #btn-filtros { border-color: #1f2328; }
.btn-icono .n { background: var(--accent); color: #fff; }
.btn-icono.repetir { max-width: 230px; }
.btn-icono.repetir span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-icono:disabled { opacity: .45; cursor: default; }

/* Chips de categoría */
.sheet .chips { flex: none; padding: 0 16px 8px; }
.sheet .chip { display: inline-flex; align-items: center; gap: 6px; }
.sheet .chip[hidden] { display: none; }
.sheet .chip-repetir { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 650; max-width: 240px; }
.sheet .chip-repetir span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .chip small { font-size: 11px; color: var(--muted); font-weight: 600; }
.sheet .chip.on small { color: #c8ccd2; }

/* Panel de filtros */
.filtros { flex: none; display: grid; grid-template-columns: minmax(240px, 1.1fr) 1.4fr 1.4fr auto; gap: 10px 18px; align-items: start; padding: 4px 16px 10px; border-bottom: 1px solid var(--line); }
.filtro { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filtro .rotulo { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.filtro .rotulo small { text-transform: none; font-weight: 500; letter-spacing: 0; }
.filtro .valor { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rangos-precio { display: flex; flex-wrap: wrap; gap: 6px; }
.precio-exacto { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.precio-exacto label { display: inline-flex; align-items: center; gap: 6px; }
.precio-exacto input { width: 4.6em; min-height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-variant-numeric: tabular-nums; text-align: right; background: var(--surface); color: var(--text); }
.mini-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 600; color: #3a3f47; }
.mini-chip[aria-pressed="true"] { background: #1f2328; color: #fff; border-color: #1f2328; }
.limpiar { align-self: center; }
/* Deslizador doble: dos range superpuestos sobre una pista común. */
.doble { position: relative; height: 36px; }
.doble .pista { position: absolute; left: 10px; right: 10px; top: 16px; height: 4px; border-radius: 2px; background: var(--line); }
.doble .relleno { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 2px; }
.doble input[type=range] { position: absolute; inset: 0; width: 100%; margin: 0; background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none; height: 36px; }
.doble input[type=range]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.2); cursor: grab; }
.doble input[type=range]::-moz-range-thumb { pointer-events: auto; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: grab; }
.doble input[type=range]::-webkit-slider-runnable-track { background: transparent; }

/* Tarjetas */
.cards { flex: 1; min-height: 0; display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; padding: 2px 16px 6px; touch-action: pan-x; scrollbar-width: thin; overscroll-behavior: contain; }
.sheet[data-state="full"] .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); grid-auto-rows: max-content; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; align-content: start; }
.sheet[data-state="peek"] .cards, .sheet[data-state="peek"] .sheet-head, .sheet[data-state="peek"] .sheet-pie, .sheet[data-state="peek"] .filtros { display: none; }
.card { position: relative; flex: none; width: 176px; display: flex; flex-direction: column; align-items: stretch; gap: 1px; text-align: left; padding: 6px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.card:hover { border-color: #cfccc4; box-shadow: 0 2px 10px rgba(20,24,31,.08); }
.card:active { transform: scale(.985); border-color: var(--accent); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumb { flex: none; height: 120px; border-radius: 10px; background: linear-gradient(#f6f5f2, #e7e4dd); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.card .name { font-weight: 650; font-size: 13.5px; padding: 5px 4px 0; line-height: 1.22; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.44em; }
.card .dims { font-size: 12px; color: var(--muted); padding: 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .precio { font-size: 13px; font-weight: 700; padding: 1px 4px 2px; font-variant-numeric: tabular-nums; }
.card .precio small { color: var(--muted); font-weight: 600; margin-left: 1px; }
.card .fav, .card .info { position: absolute; top: 8px; width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255,255,255,.86); display: grid; place-items: center; color: #b5b2aa; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card .fav { left: 8px; }
.card .info { right: 8px; color: #6b7079; }
.card .fav[aria-pressed="true"] { color: #e0a526; }
.card .insignia { position: absolute; top: 96px; right: 10px; font-size: 10px; font-weight: 700; letter-spacing: .02em; background: #1f2328; color: #fff; border-radius: 6px; padding: 2px 6px; }
.card.kit .thumb.mosaico { display: grid; gap: 2px; grid-template-columns: 1fr 1fr; background: #ebe8e2; padding: 2px; }
.card.kit .thumb.mosaico.n1 { grid-template-columns: 1fr; }
.card.kit .thumb.mosaico img { background: linear-gradient(#f6f5f2, #e7e4dd); border-radius: 7px; min-height: 0; }
.card.kit .dims { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vacio { color: var(--muted); padding: 18px 4px; margin: 0; }

.sheet-pie { flex: none; display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; padding: 6px 16px 8px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.sheet-pie a { color: var(--accent); }
.sheet-pie kbd { font: 600 11px/1 ui-monospace, monospace; padding: 2px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }
@media (pointer: coarse) { .sheet-pie .atajos { display: none; } }

/* Ficha del producto (ocupa el área de tarjetas en altura completa) */
.ficha { position: absolute; left: 0; right: 0; bottom: 0; top: 28px; background: var(--surface); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); z-index: 2; border-top: 1px solid var(--line); }
.ficha-visor { position: relative; background: radial-gradient(ellipse at 50% 40%, #fbfaf8, #e6e3dc); min-height: 0; overflow: hidden; touch-action: none; }
.ficha-visor img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .3s; }
.ficha-visor .visor-lienzo { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .35s; }
.ficha-visor[data-estado="listo"] .visor-lienzo { opacity: 1; }
.ficha-visor[data-estado="listo"] img, .ficha-visor[data-estado="listo"] .cargando { opacity: 0; }
.ficha-visor .cargando, .ficha-visor .pista-visor { position: absolute; left: 14px; bottom: 12px; font-size: 12px; font-weight: 600; color: var(--muted); background: rgba(255,255,255,.85); padding: 4px 10px; border-radius: 999px; transition: opacity .3s; }
.ficha-visor .pista-visor { left: auto; right: 14px; opacity: 0; }
.ficha-visor[data-estado="listo"] .pista-visor { opacity: 1; }
.ficha-visor[data-estado="error"] .cargando { color: var(--bad); }
.ficha-datos { overflow-y: auto; padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.ficha-cabecera { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ficha-cabecera h3 { margin: 2px 0 0; font-size: 20px; line-height: 1.2; }
.ficha .sku { margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.precio-grande { margin: 0; font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.precio-grande small { font-size: 12px; font-weight: 600; color: var(--muted); }
.ficha h4 { margin: 8px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ficha h4 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.tabla { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.tabla dt { color: var(--muted); }
.tabla dd { margin: 0; font-variant-numeric: tabular-nums; }
.licencia { margin: 0; font-size: 14px; }
.licencia a { color: var(--accent); }
.chico { font-size: 12px; margin: 0; }
.ficha-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.ficha-acciones .btn svg { color: #e0a526; }
.configurar { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.configurar h4 { margin-top: 0; }
.param { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.param .paso { display: flex; align-items: center; gap: 8px; }
.param .paso b { min-width: 56px; text-align: center; font-variant-numeric: tabular-nums; }

/* Arrastre y aviso de kit */
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); margin: -30px 0 0 -40px; opacity: .88; border: 2px dashed var(--muted); }
.drag-ghost.over { border-color: var(--accent); opacity: 1; }
.drag-ghost img { width: 56px; height: 42px; object-fit: contain; }
.drag-ghost span { font-size: 13px; font-weight: 600; }
.aviso-kit { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 14px; background: #1f2328; color: #fff; box-shadow: var(--shadow); font-size: 14px; }
.aviso-kit .btn { min-height: 40px; }

/* Tablet vertical y pantallas estrechas */
@media (max-width: 900px) {
  .sheet-head { flex-wrap: wrap; row-gap: 8px; }
  .buscador { order: 3; flex-basis: 100%; }
  .btn-icono span { display: none; }
  .btn-icono.repetir span { display: none; }
  .filtros { grid-template-columns: 1fr 1fr; }
  .ficha { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 42%) 1fr; }
  .card { width: 160px; }
  .sheet[data-state="full"] .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-height: 899px) {
  /* Tablet horizontal: tarjetas compactas a media altura (nombre en una línea). */
  /* Nombre en dos líneas (no se corta «Escritorio recto 160…»); la miniatura cede el alto. */
  .sheet[data-state="half"] .thumb { height: 62px; }
  .sheet[data-state="half"] .card { width: 168px; padding: 5px; gap: 0; }
  .sheet[data-state="half"] .card .name { -webkit-line-clamp: 2; min-height: 0; padding-top: 3px; font-size: 12.5px; line-height: 1.18; }
  .sheet[data-state="half"] .card .insignia { top: 44px; }
  .sheet[data-state="half"] .card .fav, .sheet[data-state="half"] .card .info { width: 32px; height: 32px; top: 7px; }
  .sheet[data-state="half"] .sheet-pie { display: none; }
}
@media (max-width: 900px) {
  /* Tablet vertical: a media altura, tarjetas con nombre en una línea para que se vean completas. */
  .sheet[data-state="half"] .sheet-pie { display: none; }
  .sheet[data-state="half"] .thumb { height: 92px; }
  .sheet[data-state="half"] .card .name { -webkit-line-clamp: 2; min-height: 0; font-size: 12.5px; line-height: 1.18; }
  .sheet[data-state="half"] .card .insignia { top: 72px; }
}
/* Kits a media altura: nombre y composición en una línea cada uno (el mosaico ocupa más alto). */
.sheet[data-state="half"] .card.kit .name { -webkit-line-clamp: 1; }
.sheet[data-state="half"] .card.kit .dims { -webkit-line-clamp: 1; }

/* ═════════ PANEL LATERAL (15-11, pedido de Carlos): el catálogo vive a la izquierda, junto al riel, y se esconde
   del todo al cerrarlo. Buscador arriba (el teclado en pantalla no lo tapa), lista vertical en dos columnas y la
   ficha encima de la lista. Estos estilos pisan los de la hoja inferior de arriba. ═════════ */
.sheet.lateral { left: 104px; right: auto; top: 76px; bottom: 12px; height: auto; width: var(--catalogo-w, 440px); border-radius: 20px;
  box-shadow: 0 10px 34px rgba(20,24,31,.18); transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .18s; z-index: 16; }
.sheet.lateral[data-state="peek"] { transform: translateX(calc(-100% - 130px)); opacity: 0; pointer-events: none; }
.sheet.lateral .handle { display: none; }
.lateral-cab { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 18px; flex: none; }
.lateral-cab b { font-size: 17px; }
.sheet.lateral .sheet-head { flex-wrap: wrap; row-gap: 8px; padding: 0 12px 8px 14px; }
.sheet.lateral .buscador { order: -1; flex-basis: 100%; }
.sheet.lateral .pestanas { flex: 1; }
.sheet.lateral .pestanas button { padding: 0 9px; font-size: 13px; }
.sheet.lateral .btn-icono span { display: none; }
.sheet.lateral .btn-icono.repetir { display: none; }
.sheet.lateral .chips { display: flex; flex-wrap: wrap; overflow: visible; padding: 0 14px 8px; }
.sheet.lateral .chip-repetir { display: none; }
.sheet.lateral .filtros { grid-template-columns: 1fr; max-height: 46%; overflow-y: auto; }
.sheet.lateral .cards, .sheet.lateral[data-state] .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; align-content: start; padding: 2px 14px 10px; }
.sheet.lateral .card, .sheet.lateral[data-state] .card { width: auto; padding: 6px; }
.sheet.lateral[data-state] .thumb { height: 108px; }
.sheet.lateral[data-state] .card .insignia { top: 88px; }
.sheet.lateral[data-state] .card .fav, .sheet.lateral[data-state] .card .info { width: 34px; height: 34px; top: 8px; }
.sheet.lateral .card.marcada { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.sheet.lateral .card .usar { margin-top: 6px; min-height: 40px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; }
.sheet.lateral .sheet-pie { display: none; }
.sheet.lateral .ficha { top: 52px; grid-template-columns: 1fr; grid-template-rows: minmax(200px, 38%) 1fr; border-radius: 0 0 20px 20px; }
@media (max-width: 900px) {
  .sheet.lateral { top: 128px; }
}

/* Ambientación (16-11): decoración que no entra en la cotización. Botón al final, separado y punteado; tarjetas con
   borde punteado y el rótulo «No incluida en la cotización» en gris. */
.chip.chip-ambientacion { border-style: dashed; margin-left: 10px; position: relative; }
.chip.chip-ambientacion::before { content: ""; position: absolute; left: -8px; top: 20%; bottom: 20%; width: 1px; background: var(--line); }
.card.ambientacion { border: 1.5px dashed var(--line); }
.card.ambientacion .precio { color: var(--muted); font-weight: 600; font-size: 12px; }

/* Tarjeta de la IA (paso 2 «en prueba»): qué muebles elegidos del carrito llevó el pedido y cuáles usó cada opción. */
.ia-tarjeta .cv-ia-elegidos { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.ia-tarjeta .cv-ia-elegidos b { color: var(--text); font-weight: 650; }
.ia-tarjeta .cv-ia-usados { margin: 4px 0 0; font-size: 13px; color: #1d4ed8; font-weight: 600; }
.ia-tarjeta .cv-ia-fuera { margin: 2px 0 0; font-size: 13px; color: #b45309; font-weight: 600; }

/* Menú de módulos en la barra del Estudio (22-11-2026; reemplaza al botón «Catálogo», mismo id): «Catálogo» · «Estudio»
   con el Estudio marcado. En la barra angosta (tablet en vertical) queda solo el ícono «Catálogo» de 48 px, y para que
   la píldora de estado no se corte (guías natural-correcciones.mjs y catalogo-real-fichas.mjs) el botón del proyecto
   queda solo con su ícono. «Catálogo completo» sigue en la tienda. */
#accion-catalogo-real.cv-modulos .cv-modulo-largo { display: none; }
#accion-catalogo-real.cv-modulos .cv-modulo-corto { display: inline; }
#accion-catalogo-real.cv-modulos .cv-modulo { font-size: 14px; padding: 0 14px 0 10px; gap: 6px; }
/* Tablet en horizontal (1280×800) y pantallas de hasta 1400 px (revisión del 23-11-2026): con «Catálogo · Estudio» la
   píldora de estado quedaba en 126 de 166 px («Sin espacio defin»). Queda solo el enlace «Catálogo», como el botón que
   reemplazó; el Estudio es la pantalla actual (lo dice el aria-current del enlace oculto y el título de la barra). */
@media (max-width: 1400px) {
  #accion-catalogo-real.cv-modulos { padding: 0; }
  #accion-catalogo-real.cv-modulos .cv-modulo[aria-current="page"] { display: none; }
}
/* «Portafolio» (23-11-2026): en la barra del Estudio aparece solo en pantallas anchas. Hasta 1600 px queda «Catálogo»
   como hasta ahora (la píldora de estado no se corta) y el portafolio se abre desde el menú del catálogo. */
@media (max-width: 1600px) {
  #accion-catalogo-real.cv-modulos .cv-modulo[data-modulo="portafolio"] { display: none; }
}
/* Con eso aún faltaban 4 px a 1280: cuando la barra no alcanza, cede primero el nombre del proyecto (se corta con «…» y
   sigue entero en «Proyectos»), no la píldora de estado. No se usa `flex-shrink: 0` en la píldora: con un resumen largo
   («12 muebles · 2 no cumplen…») la barra se saldría de la pantalla. Desde 901 px y sin tope (revisión del 23-11-2026):
   entre 1401 y 1424 px vuelve «Estudio de espacios» al menú y la píldora se cortaba 1–3 px; en pantallas anchas el nombre
   tiene espacio y no se corta. */
@media (min-width: 901px) {
  html[data-catalogo-real] .topbar .brand { flex-shrink: 100; min-width: 120px; }
}
@media (max-width: 900px) {
  #accion-catalogo-real.cv-modulos { padding: 0; box-shadow: var(--shadow); }
  #accion-catalogo-real.cv-modulos .cv-modulo[aria-current="page"] { display: none; }
  #accion-catalogo-real.cv-modulos .cv-modulo { width: var(--tap); min-height: var(--tap); padding: 0; color: var(--text); }
  #accion-catalogo-real.cv-modulos .cv-modulo span { display: none !important; }
  /* En vertical la barra lleva además «Paso 1: definir el espacio»: sin el nombre del proyecto (como ya pasa por debajo de
     700 px) la píldora de estado entra entera. El nombre sigue en «Proyectos». */
  html[data-catalogo-real] .topbar .brand-texto { display: none; }
  html[data-catalogo-real] .topbar .brand { padding-right: 6px; }
}
