/* Carrito, hojas y visor */
[hidden] { display: none !important; }
.cils-boton--sm { min-height: 44px; padding: 0 18px; font-size: 14px; border-radius: 10px; }
.cils-boton--suave { background: var(--brand-100); color: var(--brand-700); }
.cils-boton--suave:hover { background: #e6d5f2; }
.cils-boton.is-cargando { opacity: 0.7; pointer-events: none; }
.cils-boton:disabled { cursor: progress; }
.cils-error { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fdecef; color: #8c1d40; font-size: 14px; }
.cils-giro { display: inline-block; width: 20px; height: 20px; border: 3px solid var(--brand-100); border-top-color: var(--brand-600); border-radius: 50%; animation: cils-gira 0.8s linear infinite; }
@keyframes cils-gira { to { transform: rotate(360deg); } }
@keyframes cils-sube { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cils-fundido { from { opacity: 0; } to { opacity: 1; } }
@keyframes cils-aviso-entra { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.cils-carro {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--linea); box-shadow: 0 -8px 24px rgba(36, 27, 43, 0.1);
}
.cils-carro__resumen { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.cils-carro__icono { position: relative; flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); }
.cils-carro__n { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--oferta); color: #fff; font: 700 12px/20px var(--fuente); text-align: center; }
.cils-carro__texto small { display: block; color: var(--suave); font-size: 12px; line-height: 1.2; }
.cils-carro__texto strong { display: block; font: 700 18px/1.25 var(--fuente); }
.cils-con-carro .cils-pie { padding-bottom: calc(28px + 84px + env(safe-area-inset-bottom)); }

.cils-aviso {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 90;
  transform: translateX(-50%); max-width: min(92vw, 420px);
  padding: 12px 18px; border-radius: var(--r-md);
  background: var(--tinta); color: #fff; font: 500 14px/1.4 var(--fuente); box-shadow: var(--sombra);
  animation: cils-aviso-entra 0.22s ease;
}
.cils-con-carro .cils-aviso { bottom: calc(92px + env(safe-area-inset-bottom)); }
body.cils-dlg-abierto { overflow: hidden; }

dialog.cils-hoja, dialog.cils-visor { border: 0; padding: 0; color: var(--tinta); }
dialog.cils-hoja::backdrop, dialog.cils-visor::backdrop { background: rgba(36, 27, 43, 0.6); }
dialog.cils-hoja {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 100%; max-height: 92dvh;
  border-radius: 20px 20px 0 0; background: #fff; overflow: hidden;
  box-shadow: 0 -10px 40px rgba(36, 27, 43, 0.25);
}
dialog.cils-hoja[open] { display: flex; flex-direction: column; animation: cils-sube 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); }
.cils-hoja__cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 12px 20px; border-bottom: 1px solid var(--linea); }
.cils-hoja__cab h2 { font: 700 18px/1.3 var(--fuente); }
.cils-hoja__cuerpo { flex: 1; overflow-y: auto; padding: 16px 20px; overscroll-behavior: contain; }
.cils-hoja__pie { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); }

.cils-cantidad { display: inline-flex; align-items: center; border: 1px solid var(--linea); border-radius: var(--r-md); }
.cils-cantidad button { width: 44px; height: 44px; border: 0; background: none; font: 500 22px/1 var(--fuente); color: var(--tinta); cursor: pointer; border-radius: var(--r-md); }
.cils-cantidad button:hover { background: var(--brand-50); }
.cils-cantidad output { min-width: 36px; text-align: center; font-weight: 600; }
.cils-cantidad--sm button { width: 36px; height: 36px; font-size: 18px; }
.cils-cantidad-fila { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; font-weight: 600; }

.cils-var__cab { justify-content: flex-start; }
.cils-var__img { flex: none; width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--brand-50); border: 1px solid var(--linea); }
.cils-var__titulos { flex: 1; min-width: 0; }
.cils-var__titulos h2 { font-size: 16px; }
.cils-var__precio { margin-top: 2px; }
.cils-var__precio strong { font: 700 18px/1.2 var(--fuente); }
.cils-var__precio s { color: var(--suave); font-size: 13px; }
.cils-grupo { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.cils-grupo legend { padding: 0; margin-bottom: 8px; font: 600 14px/1.3 var(--fuente); }
.cils-grupo__sel { margin-left: 8px; color: var(--suave); font-weight: 400; }
.cils-opciones { display: flex; flex-wrap: wrap; gap: 8px; }
.cils-opcion { min-height: 44px; padding: 0 16px; border: 1px solid #cfc4d8; border-radius: 999px; background: #fff; color: var(--tinta); font: 500 14px/1 var(--fuente); cursor: pointer; }
.cils-opcion:hover { border-color: var(--brand-600); }
.cils-opcion.is-sel { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.cils-opcion.is-no { color: #8f869a; border-style: dashed; text-decoration: line-through; }

.cils-pedido__lista { display: grid; }
.cils-pedido__item { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--linea); }
.cils-pedido__item img, .cils-pedido__sinfoto { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--brand-50); border: 1px solid var(--linea); }
.cils-pedido__nombre { font: 600 14px/1.35 var(--fuente); }
.cils-pedido__variante { color: var(--suave); font-size: 12px; margin-top: 1px; }
.cils-pedido__precio { font: 600 14px/1.3 var(--fuente); margin-top: 4px; }
.cils-pedido__quitar { padding: 6px 0; font-size: 13px; font-weight: 500; color: var(--suave); background: none; border: 0; cursor: pointer; }
.cils-pedido__total { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 0 4px; }
.cils-pedido__total strong { font: 700 22px/1.2 var(--fuente); }
.cils-pedido__nota { color: var(--suave); font-size: 13px; margin-bottom: 4px; }
.cils-campo { margin-top: 14px; }
.cils-campo label { display: block; margin-bottom: 6px; font: 600 14px/1.3 var(--fuente); }
.cils-campo label span { color: var(--suave); font-weight: 400; }
.cils-campo input, .cils-campo textarea { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid #cfc4d8; border-radius: var(--r-md); background: #fff; color: var(--tinta); font: 400 16px/1.4 var(--fuente); }
.cils-campo textarea { resize: vertical; }
.cils-campo [aria-invalid="true"] { border-color: var(--oferta); }
.cils-trampa { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#cils-ped-form .cils-boton { margin-top: 18px; }
.cils-campo__ayuda { margin-top: 6px; color: var(--suave); font-size: 13px; }
.cils-casilla { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; font-size: 14px; color: #3a3142; cursor: pointer; }
.cils-casilla input { flex: none; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--brand-600); }
.cils-casilla a { color: var(--brand-600); }
.cils-ped-hola, .cils-ped-intro { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-top: 18px; padding: 12px 14px; border-radius: var(--r-md); background: var(--brand-50); font-size: 14px; }
.cils-ped-hola strong { font: 700 16px/1.3 var(--fuente); }
.cils-ped-hola .cils-enlace, .cils-ped-intro .cils-enlace { padding: 4px 0; border: 0; background: none; color: var(--brand-600); font: 600 13px/1.3 var(--fuente); text-decoration: underline; cursor: pointer; }
.cils-ped-envio { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; display: grid; gap: 8px; }
.cils-ped-envio legend { padding: 0; margin-bottom: 8px; font: 600 14px/1.3 var(--fuente); }
.cils-ped-opcion { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid #cfc4d8; border-radius: var(--r-md); cursor: pointer; }
.cils-ped-opcion:has(input:checked) { border-color: var(--brand-600); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-600); }
.cils-ped-opcion input { flex: none; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--brand-600); }
.cils-ped-opcion strong { display: block; font: 600 14px/1.3 var(--fuente); }
.cils-ped-opcion small { display: block; margin-top: 2px; color: var(--suave); font-size: 13px; }
.cils-pedido__ok { text-align: center; display: grid; gap: 12px; justify-items: center; padding-block: 28px; }
.cils-pedido__ok-icono { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: #e1f4ec; color: var(--wa); }
.cils-pedido__ok h3 { font: 700 20px/1.3 var(--fuente); }
.cils-pedido__ok p { color: var(--suave); max-width: 34ch; }

dialog.cils-visor { position: fixed; inset: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: #0e0a14; color: #fff; }
dialog.cils-visor[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; animation: cils-fundido 0.2s ease; }
.cils-visor__cab { display: flex; align-items: center; justify-content: space-between; padding: calc(8px + env(safe-area-inset-top)) 8px 0 20px; }
.cils-visor__contador { font-weight: 600; font-size: 14px; }
.cils-visor__escena { position: relative; min-height: 0; }
.cils-visor__pista { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.cils-visor__pista::-webkit-scrollbar { display: none; }
.cils-slide { flex: 0 0 100%; height: 100%; display: grid; place-items: center; padding: 8px 12px; overflow: hidden; scroll-snap-align: center; }
.cils-slide img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; background: #fff; cursor: zoom-in; user-select: none; }
.cils-slide.is-zoom { overflow: auto; place-items: start; }
.cils-slide.is-zoom img { max-width: none; max-height: none; width: 220%; height: auto; cursor: zoom-out; }
.cils-visor__flecha { position: absolute; top: 50%; z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; transform: translateY(-50%); border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.92); color: var(--tinta); cursor: pointer; }
.cils-visor__flecha--ant { left: 14px; }
.cils-visor__flecha--sig { right: 14px; }
@media (hover: none) { .cils-visor__flecha { display: none; } }
.cils-visor__puntos { display: flex; justify-content: center; padding-top: 6px; }
.cils-visor__puntos button { position: relative; width: 28px; height: 28px; border: 0; background: none; cursor: pointer; }
.cils-visor__puntos button::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.4); }
.cils-visor__puntos button[aria-current="true"]::after { background: #fff; }
.cils-visor__pie { display: flex; align-items: center; gap: 16px; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, 0.14); }
.cils-visor__info { flex: 1; min-width: 0; }
.cils-visor__nombre { font: 600 15px/1.35 var(--fuente); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cils-visor__precio { font: 700 17px/1.3 var(--fuente); margin-top: 2px; }
.cils-visor .cils-boton-icono--claro { color: #fff; }

@media (min-width: 768px) {
  dialog.cils-hoja { inset: 0; margin: auto; width: min(560px, 92vw); height: fit-content; max-height: 90dvh; border-radius: 20px; }
}
@media (min-width: 900px) {
  .cils-carro {
    left: 50%; right: auto; bottom: 20px; width: min(720px, calc(100% - 2 * var(--pad)));
    transform: translateX(-50%); border: 1px solid var(--linea); border-radius: 20px;
    padding: 10px 14px 10px 16px; box-shadow: 0 12px 36px rgba(36, 27, 43, 0.22);
  }
  .cils-con-carro .cils-aviso { bottom: 100px; }
}
