/* Panel del bar: pensado primero para el teléfono (una mano, pulgar abajo).
   Colores de la marca: negro pared, rojo, crema. */
:root {
  --negro: #0a0a09;
  --fondo: #f3efe4;
  --papel: #fff;
  --tinta: #1b1a17;
  --suave: #6d6a62;
  --linea: #e2dccd;
  --rojo: #b9261c;
  --rojo-osc: #951d15;
  --verde: #2f6b3a;
  --crema: #e8e2d0;
  --alto-arriba: 56px;
  --alto-pestanas: 62px;
  --abajo: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font: 17px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
small { color: var(--suave); font-size: 13px; font-weight: 400; }

/* ---------- campos ---------- */
.campo { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--suave); }
input, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--linea);
  border-radius: 10px;
  background: #fff;
  color: var(--tinta);
  font: inherit;
  font-size: 17px; /* >= 16: que el iPhone no haga zoom */
  font-weight: 400;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, textarea:focus { outline: 2px solid var(--rojo); outline-offset: 0; border-color: transparent; }
.con-euro { position: relative; display: block; }
.con-euro input { padding-right: 34px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.con-euro span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--suave); font-size: 18px; pointer-events: none; }

/* ---------- botones ---------- */
.boton {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  font-weight: 650;
  cursor: pointer;
}
.boton--principal { background: var(--rojo); color: #fff; }
.boton--principal:active { background: var(--rojo-osc); }
.boton--principal:disabled { opacity: 0.5; }
.boton--grande { width: 100%; min-height: 52px; font-size: 18px; }
.boton--claro { background: transparent; color: var(--tinta); }
.boton--borrar { width: 100%; background: transparent; color: var(--rojo); border: 1px solid var(--linea); }
.boton--peligro { background: var(--rojo); color: #fff; }
.boton--agregar {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  background: transparent;
  border: 1.5px dashed #c9c1ad;
  color: var(--tinta);
}
.error { margin: 0; color: var(--rojo); font-size: 15px; }
.ayuda { margin: 0; color: var(--suave); font-size: 14px; }

/* ---------- entrar ---------- */
.entrar { min-height: 100svh; display: grid; place-items: center; padding: 24px 20px; background: var(--negro); }
.entrar-caja { width: min(100%, 380px); display: grid; gap: 16px; }
.entrar-logo { justify-self: center; border-radius: 22px; }
.entrar h1 { margin: 0 0 4px; text-align: center; color: var(--crema); font-size: 22px; font-weight: 600; }
.entrar .campo { color: #b8b19f; }
.entrar input { background: #1c1b18; border-color: #34322c; color: var(--crema); }
.entrar .error { color: #ff8a80; text-align: center; }

/* ---------- arriba ---------- */
.arriba {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  height: calc(var(--alto-arriba) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 8px 0 16px;
  background: var(--negro);
  color: var(--crema);
}
.arriba h1 { flex: 1; margin: 0; overflow: hidden; font-size: 19px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.arriba-volver { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -12px; border: 0; background: none; color: inherit; cursor: pointer; }
.arriba-accion { min-height: 40px; padding: 0 14px; border: 1px solid #3a3832; border-radius: 999px; background: none; color: inherit; font-size: 15px; cursor: pointer; }
.arriba-accion[aria-pressed='true'] { background: var(--crema); color: var(--negro); border-color: var(--crema); }

/* ---------- vista ---------- */
.vista {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px calc(var(--alto-pestanas) + var(--abajo) + 96px);
}
.seccion-titulo { margin: 22px 4px 8px; color: var(--suave); font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.seccion-titulo:first-child { margin-top: 4px; }

/* buscador */
.buscar { position: relative; margin-bottom: 6px; }
.buscar input { padding-left: 42px; border-radius: 12px; }
.buscar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--suave); pointer-events: none; }

/* listas tipo "ajustes del teléfono" */
.lista { margin: 0; padding: 0; list-style: none; background: var(--papel); border: 1px solid var(--linea); border-radius: 14px; overflow: hidden; }
.lista > li + li { border-top: 1px solid var(--linea); }
.fila {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.fila:active { background: #f6f3ea; }
.fila-texto { flex: 1; min-width: 0; }
.fila-texto strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.fila-texto small { display: block; margin-top: 1px; }
.fila-flecha { flex: none; width: 18px; height: 18px; color: #b5ae9c; }
.cuenta { flex: none; color: var(--suave); font-size: 15px; font-variant-numeric: tabular-nums; }

/* un plato en la lista: toco el texto = editar; el interruptor = se muestra o no */
.plato { display: flex; align-items: center; }
.plato .fila { flex: 1; min-width: 0; padding-right: 6px; }
.plato-precio { flex: none; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.plato-precio small { display: block; color: var(--suave); font-size: 12px; font-weight: 500; }
.plato.apagado .fila-texto strong { color: var(--suave); text-decoration: line-through; text-decoration-color: #b5ae9c; }
.plato.apagado .plato-precio { color: var(--suave); }
.etiqueta { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 999px; background: #efe9da; color: var(--suave); font-size: 12px; font-weight: 600; }
.etiqueta--nuevo { background: #fbe3df; color: var(--rojo); }
.plato.cambiado .fila-texto strong::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: var(--rojo); vertical-align: middle; }
.plato .mini-interruptor { flex: none; margin-right: 12px; }
.mover { display: flex; flex: none; gap: 6px; margin-right: 10px; }
.mover button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--linea); border-radius: 10px; background: #fff; cursor: pointer; }
.mover button:disabled { opacity: 0.3; }
.mover svg { width: 20px; height: 20px; }
.resaltar { animation: resaltar 1.4s ease-out; }
@keyframes resaltar { from { background: #fbe3df; } to { background: transparent; } }

/* interruptores */
input[type='checkbox'][role='switch'] {
  appearance: none;
  flex: none;
  position: relative;
  width: 52px;
  min-height: 0;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #cfc8b6;
  cursor: pointer;
  transition: background 0.15s;
}
input[type='checkbox'][role='switch']::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
input[type='checkbox'][role='switch']:checked { background: var(--verde); }
input[type='checkbox'][role='switch']:checked::after { transform: translateX(20px); }
input[type='checkbox'][role='switch']:focus-visible { outline: 2px solid var(--rojo); outline-offset: 2px; }
.interruptor { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; cursor: pointer; }
.interruptor > span { flex: 1; display: grid; gap: 2px; }
.interruptor strong { font-weight: 600; }

/* en la web */
.tarjeta-web { align-items: center; }
.tarjeta-web + .tarjeta-web { margin-top: 10px; }

/* ---------- cambios pendientes ---------- */
.pendientes {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(var(--alto-pestanas) + var(--abajo) + 10px);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto;
  padding: 8px 8px 8px 16px;
  border-radius: 16px;
  background: var(--negro);
  color: var(--crema);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  animation: subir 0.2s ease-out;
}
@keyframes subir { from { transform: translateY(20px); opacity: 0; } }
.pendientes-texto { flex: 1; display: grid; justify-items: start; min-height: 44px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.pendientes-texto strong { font-size: 16px; }
.pendientes-texto span { color: #b8b19f; font-size: 13px; text-decoration: underline; }
.pendientes .boton { min-height: 48px; padding: 0 22px; }

/* ---------- pestañas ---------- */
.pestanas {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 25;
  display: flex;
  height: calc(var(--alto-pestanas) + var(--abajo));
  padding-bottom: var(--abajo);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--linea);
  backdrop-filter: blur(8px);
}
.pestanas button {
  flex: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 0;
  background: none;
  color: var(--suave);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pestanas button[aria-current='page'] { color: var(--rojo); }

/* ---------- hojas (editar plato, revisar) ---------- */
dialog { padding: 0; border: 0; color: inherit; }
.hoja {
  width: 100%;
  max-width: 640px;
  height: 100%;
  max-height: 100%;
  margin: auto auto 0;
  background: var(--fondo);
}
.hoja[open] { animation: hoja 0.22s ease-out; }
@keyframes hoja { from { transform: translateY(40px); opacity: 0; } }
.hoja::backdrop { background: rgba(10, 10, 9, 0.5); }
.hoja-caja { display: flex; flex-direction: column; height: 100%; }
.hoja-arriba {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px 18px;
  background: var(--papel);
  border-bottom: 1px solid var(--linea);
}
.hoja-arriba h2 { flex: 1; margin: 0; overflow: hidden; font-size: 18px; white-space: nowrap; text-overflow: ellipsis; }
.hoja-cuerpo { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 16px; padding: 18px 16px calc(28px + var(--abajo)); }
.precio-vino { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.idiomas { padding: 4px 14px; background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; }
.idiomas summary { min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.idiomas[open] { padding-bottom: 14px; }
.idiomas fieldset { display: grid; gap: 12px; margin: 14px 0 0; padding: 0; border: 0; }
.idiomas legend { margin-bottom: 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--suave); }
@media (min-width: 700px) {
  .hoja { height: auto; max-height: 88vh; margin: auto; border-radius: 16px; overflow: hidden; }
  .hoja-caja { max-height: 88vh; }
}

.lista-cambios { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lista-cambios li { padding: 12px 14px; background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; }
.lista-cambios li small { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

/* confirmar */
.aviso { width: min(92vw, 380px); padding: 20px; border-radius: 16px; background: var(--papel); }
.aviso::backdrop { background: rgba(10, 10, 9, 0.5); }
.aviso p { margin: 0 0 18px; font-size: 17px; }
.aviso-botones { display: flex; justify-content: flex-end; gap: 8px; }

/* tostada */
.tostada {
  position: fixed;
  left: 50%;
  top: calc(var(--alto-arriba) + env(safe-area-inset-top, 0px) + 10px);
  z-index: 50;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--tinta);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
  animation: bajar 0.2s ease-out;
}
.tostada.ok { background: var(--verde); }
.tostada.mal { background: var(--rojo); }
@keyframes bajar { from { transform: translate(-50%, -10px); opacity: 0; } }

/* más */
.mas-usuario { margin: 4px 4px 14px; color: var(--suave); font-size: 15px; }
.pasos { margin: 0; padding: 12px 14px 12px 32px; background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; font-size: 15px; }
.pasos li + li { margin-top: 6px; }
.vacio { padding: 28px 10px; color: var(--suave); text-align: center; }
.fila--quieta { cursor: default; }
.fila--quieta:active { background: none; }
a.fila { color: inherit; text-decoration: none; }
.rojo { color: var(--rojo); }
.ayuda--web { margin: 14px 4px 0; }
.tostada { pointer-events: none; }
