/* Bajón la esquina — estilos. Un solo tema claro; todos los colores salen de estas variables. */
:root {
  --fondo: #FFFBF3;
  --papel: #FFFFFF;
  --tinta: #2B1B14;
  --gris: #6B5E57;
  --borde: #EADFCB;
  --borde-fuerte: #CDBFA9;
  --crema: #EFE6D8;
  --rojo: #D62718;
  --rojo-osc: #A81C10;
  --rojo-suave: #FFF1EF;
  --amarillo: #FFC72C;
  --verde: #1E7A46;
  --radio: 12px;
  --barra-alto: 76px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--barra-alto) + 16px);
}
body.modal { overflow: hidden; }
h1, h2, h3, h4, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--tinta); outline-offset: 2px; }
[hidden] { display: none !important; }

.envuelve { max-width: 640px; margin-inline: auto; padding-inline: 16px; }

/* Cabecera */
.cabecera { background: var(--papel); border-bottom: 4px solid var(--rojo); }
.fila-cabecera { display: flex; align-items: center; gap: 12px; padding-block: 12px; }
.logo { width: 72px; height: 72px; flex: none; border-radius: 10px; }
.datos-local { min-width: 0; }
.datos-local h1 { font-size: 1.35rem; line-height: 1.2; }
.dato { color: var(--gris); font-size: .9rem; margin-top: 2px; }

.pill {
  display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700;
  border: 1.5px solid currentColor; white-space: nowrap; vertical-align: 1px;
}
.pill.abierto { color: var(--verde); }
.pill.cerrado { color: var(--tinta); background: var(--crema); border-color: var(--crema); }

/* Inicio */
.inicio { display: flex; flex-direction: column; gap: 12px; padding-block: 16px; }
.pregunta { font-size: 1.05rem; margin-top: 4px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.aviso {
  background: var(--papel); border: 2px solid var(--amarillo); border-radius: var(--radio);
  padding: 14px; text-align: center;
}
.aviso-titulo { font-weight: 800; font-size: 1.1rem; }
.aviso-detalle { color: var(--gris); margin-top: 2px; }

/* Botones */
button { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 10px 16px; border-radius: 10px; border: 2px solid transparent;
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer; color: var(--tinta);
  background: transparent;
}
.btn.ancho { width: 100%; }
.btn.rojo { background: var(--rojo); color: #fff; }
.btn.rojo:active { background: var(--rojo-osc); }
.btn.borde { background: var(--papel); border-color: var(--tinta); }
.btn.modo { background: var(--papel); border-color: var(--tinta); }
.btn.modo[aria-pressed="true"] { background: var(--tinta); color: #fff; }
.btn.pendiente { background: var(--crema); color: var(--tinta); }
.btn.apagado { background: var(--crema); color: var(--gris); cursor: not-allowed; }
.btn.texto { min-height: 44px; padding-inline: 8px; color: var(--rojo-osc); text-decoration: underline; border: 0; }

/* Pestañas */
.tabs {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; overflow-x: auto;
  padding: 10px 16px; background: var(--fondo); border-bottom: 1px solid var(--borde);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 9px 16px; border-radius: 99px; border: 2px solid var(--borde-fuerte);
  background: var(--papel); text-decoration: none; font-weight: 700; font-size: .95rem; min-height: 44px;
  display: inline-flex; align-items: center;
}
.tab.activa { background: var(--tinta); color: #fff; border-color: var(--tinta); }

/* Menú */
.cargando { padding: 24px 0; text-align: center; color: var(--gris); }
.familia { padding-top: 20px; scroll-margin-top: 64px; }
.familia h2 { font-size: 1.35rem; }
.familia h3 {
  font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gris);
  margin: 16px 0 8px;
}
.lista { display: flex; flex-direction: column; gap: 8px; }
.prod {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  background: var(--papel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px;
}
.foto {
  width: 64px; height: 64px; border-radius: 10px; background: var(--crema); color: var(--borde-fuerte);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.foto svg { width: 34px; height: 34px; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.info h4 { font-size: 1rem; line-height: 1.25; }
.desc { color: var(--gris); font-size: .85rem; line-height: 1.3; margin-top: 2px; }
.precio { font-weight: 800; color: var(--rojo-osc); margin-top: 3px; }
.etiqueta-promo {
  display: inline-block; background: var(--amarillo); color: var(--tinta); font-size: .75rem;
  font-weight: 800; padding: 1px 8px; border-radius: 99px; margin-bottom: 3px;
}
.accion { min-height: 44px; padding-inline: 12px; font-size: .9rem; white-space: nowrap; }

.pie { color: var(--gris); font-size: .85rem; padding-block: 28px 8px; text-align: center; }

/* Barra del pedido */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--amarillo);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px));
}
.barra-in { max-width: 640px; margin-inline: auto; padding-inline: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.barra-txt { display: flex; flex-direction: column; line-height: 1.2; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--barra-alto) + 12px + env(safe-area-inset-bottom, 0px));
  max-width: 608px; margin-inline: auto; z-index: 30; background: var(--tinta); color: #fff;
  border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 600;
}
.toast button { background: none; border: 0; color: var(--amarillo); font-weight: 800; text-decoration: underline; min-height: 36px; cursor: pointer; }

/* Hojas (diálogos) */
dialog {
  border: 0; padding: 0; background: var(--papel); color: var(--tinta); width: 100%; max-width: 640px;
  margin: auto auto 0; border-radius: 20px 20px 0 0; max-height: 92dvh; overflow: auto;
}
dialog::backdrop { background: rgba(43, 27, 20, .55); }
.hoja { padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
.hoja-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.hoja-cab h2 { font-size: 1.25rem; line-height: 1.2; }
.cerrar { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--borde-fuerte); background: var(--papel); font-size: 1.2rem; cursor: pointer; color: var(--tinta); }
.grupo { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.grupo > legend, .grupo-titulo { font-weight: 800; padding: 0; margin-bottom: 2px; }
.nota { color: var(--gris); font-size: .9rem; }
.opcion {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px;
  border: 2px solid var(--borde); border-radius: 10px; padding: 10px 12px; font-weight: 600; cursor: pointer;
}
.opcion input { width: 22px; height: 22px; accent-color: var(--rojo); flex: none; margin: 0; }
.opcion .izq { display: flex; align-items: center; gap: 10px; min-width: 0; }
.opcion:has(input:checked) { border-color: var(--rojo); background: var(--rojo-suave); }
.opciones-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cantidad { display: flex; align-items: center; justify-content: center; gap: 20px; font-size: 1.25rem; font-weight: 800; }
.cantidad button {
  width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--tinta); background: var(--papel);
  font-size: 1.4rem; font-weight: 800; cursor: pointer; color: var(--tinta);
}
.cantidad button:active { background: var(--crema); }
.cantidad .n { min-width: 2ch; text-align: center; }
.error { color: var(--rojo-osc); font-weight: 700; font-size: .92rem; min-height: 1.2em; }

/* Pedido */
.linea { border-bottom: 1px solid var(--borde); padding: 10px 0; }
.linea-top { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.linea small { display: block; color: var(--gris); font-size: .85rem; margin-top: 2px; }
.linea-acc { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.linea .cantidad { gap: 12px; font-size: 1.05rem; }
.linea .cantidad button { width: 40px; height: 40px; font-size: 1.2rem; }
.total-fila { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.total-fila.grande { font-size: 1.2rem; font-weight: 800; }
.caja { border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; background: var(--fondo); }
.campo label, .campo .etq { display: block; font-weight: 800; margin-bottom: 4px; }
.campo input[type="text"], .campo input[type="tel"], .campo select, .campo textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--borde-fuerte); border-radius: 10px;
  font: inherit; background: var(--papel); color: var(--tinta);
}
.campo textarea { min-height: 76px; resize: vertical; }
.campo [aria-invalid="true"] { border-color: var(--rojo); }
.campo .ayuda { color: var(--gris); font-size: .85rem; margin-top: 3px; }
.acciones { display: flex; flex-direction: column; gap: 8px; }
.numero-pedido { font-size: 1.3rem; background: var(--crema); border-radius: var(--radio); padding: 10px; }
.listo { text-align: center; display: flex; flex-direction: column; gap: 12px; padding-block: 8px; }

@media (min-width: 520px) {
  .logo { width: 88px; height: 88px; }
  .datos-local h1 { font-size: 1.6rem; }
  dialog { margin-bottom: auto; border-radius: 20px; margin-top: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
