* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #faf8f6; color: #222; }

.barra { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: #fff; border-bottom: 1px solid #e6e1dc; }
.barra h1 { margin: 0; font-size: 1.2rem; }
.btn-carrito { background: #222; color: #fff; border: 0; border-radius: 20px; padding: 8px 14px; cursor: pointer; font-size: 0.95rem; }
#contador { background: #fff; color: #222; border-radius: 10px; padding: 0 7px; margin-left: 4px; font-weight: 600; }

main { max-width: 1000px; margin: 0 auto; padding: 16px; }
.filtros { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
#buscador { width: 100%; padding: 10px 14px; font-size: 1rem; border: 1px solid #cfc8c1; border-radius: 8px; }
.categorias { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid #cfc8c1; background: #fff; border-radius: 16px; padding: 6px 12px; cursor: pointer; font-size: 0.9rem; }
.chip.activo { background: #222; color: #fff; border-color: #222; }

.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.tarjeta { background: #fff; border: 1px solid #e6e1dc; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.foto { aspect-ratio: 4 / 5; background-size: cover; background-position: center; }
.info { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.info h3 { margin: 0; font-size: 0.95rem; }
.precio { font-weight: 700; }
.tarjeta button { margin-top: auto; padding: 8px; border: 0; border-radius: 6px; background: #222; color: #fff; cursor: pointer; }
.vacio { color: #777; text-align: center; }

.panel { position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, 0.45); display: flex; justify-content: flex-end; }
.panel[hidden] { display: none; }
.panel-contenido { background: #fff; width: min(420px, 100%); height: 100%; overflow-y: auto; padding: 16px; }
.panel-cabecera { display: flex; justify-content: space-between; align-items: center; }
.panel-cabecera h2 { margin: 0; }
.panel-cabecera button { background: none; border: 0; font-size: 1.3rem; cursor: pointer; }
.items { list-style: none; padding: 0; margin: 12px 0; }
.items li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee; }
.items .nom { flex: 1; font-size: 0.9rem; }
.items button { width: 26px; height: 26px; border: 1px solid #ccc; background: #fff; border-radius: 4px; cursor: pointer; }
.total { font-size: 1.1rem; text-align: right; }
#datos label { display: block; margin-bottom: 10px; font-size: 0.9rem; }
#datos input, #datos select, #datos textarea { width: 100%; margin-top: 4px; padding: 8px; font: inherit; border: 1px solid #cfc8c1; border-radius: 6px; }
.nota { font-size: 0.8rem; color: #777; }
.acciones { display: grid; gap: 8px; margin-top: 12px; }
.acciones button { padding: 10px; border: 1px solid #222; background: #fff; border-radius: 6px; cursor: pointer; font-size: 0.95rem; }
.acciones .principal { background: #25a244; border-color: #25a244; color: #fff; }
.acciones .secundario { border-color: #ccc; color: #777; }
.aviso { min-height: 1.2em; font-size: 0.85rem; color: #25a244; text-align: center; }

/* Colores, galería y avisos */
.foto { cursor: pointer; }
.swatches { display: flex; gap: 6px; min-height: 18px; }
.sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid #bbb; padding: 0; cursor: pointer; }
.sw.activo { outline: 2px solid #222; outline-offset: 2px; }
.tarjeta .sw { margin-top: 0; padding: 0; }
.foto-mini { width: 38px; height: 46px; border-radius: 4px; background-size: cover; background-position: center; border: 1px solid #ddd; flex: none; }

.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-contenido { position: relative; background: #fff; border-radius: 12px; width: min(420px, 100%); max-height: 100%; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.modal-contenido h2 { margin: 4px 0 0; }
.modal-contenido p { margin: 0; }
.cerrar { position: absolute; top: 8px; right: 8px; z-index: 1; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.9); cursor: pointer; font-size: 1rem; }
.foto.grande { border-radius: 8px; cursor: default; }
.miniaturas { display: flex; gap: 8px; }
.mini { width: 56px; height: 70px; border: 2px solid transparent; border-radius: 6px; background-size: cover; background-position: center; cursor: pointer; padding: 0; }
.mini.activo { border-color: #222; }
.color-nombre { color: #555; font-size: 0.9rem; }
.agregar { margin-top: 6px; padding: 12px; border: 0; border-radius: 8px; background: #222; color: #fff; font-size: 1rem; cursor: pointer; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; background: #222; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.toast.visible { opacity: 1; }

/* Promos */
.insignia-promo { align-self: flex-start; background: #fff3cd; color: #7a5c00; border-radius: 4px; padding: 2px 8px; font-size: 0.78rem; font-weight: 600; }
.resumen { margin: 8px 0; }
.resumen-fila { margin: 2px 0; font-size: 0.9rem; text-align: right; }
.resumen-fila.promo { color: #25a244; font-weight: 600; }
.resumen-fila.pista { text-align: center; background: #fff3cd; color: #7a5c00; padding: 6px; border-radius: 6px; margin-top: 6px; }
