/* ============================================================================
   Baqqo Restaurante · Vista COMENSAL (Baqqo AI en mesa) — estilo piloto.
   Chat por defecto + toggle a carta. Cabecera del restaurante (marca del local),
   Baqqo discreto. Mobile-first. Fondo hueso, acento rojo Baqqo.
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { overscroll-behavior: none; }
body { margin: 0; font-family: var(--bq2-font); color: var(--bq2-ink); background: var(--bq2-bg);
  -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
button { font: inherit; }

.app { max-width: 540px; margin-inline: auto; min-height: 100vh; position: relative; display: flex; flex-direction: column; }

/* ── Gate de entrada (disclaimer demo) ── */
.cgate { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: var(--bq2-dark); color: var(--bq2-on-dark); padding: 24px; }
.cgate__box { text-align: center; max-width: 360px; }
.cgate__logo { display: flex; justify-content: center; margin: 0 auto 18px; font-size: 1.25rem; }
.cgate__box img { height: 40px; }
.cgate__box h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 8px; }
.cgate__box p { color: var(--bq2-on-dark-soft); margin: 0 0 22px; font-size: .95rem; line-height: 1.5; }
.cgate__box .btn { background: var(--bq2-accent); color: var(--bq2-accent-ink); border: 0; padding: .9em 1.8em;
  border-radius: var(--bq2-r-pill); font-weight: 700; cursor: pointer; }

/* ── Cabecera del restaurante (se compacta con el scroll) ──
   COMPACTACIÓN PROGRESIVA (2026-10-30, D11): el JS fija --rhead-p (0 = arriba, 1 = compacta tras ~80 px de scroll)
   y el tamaño del logo, del botón de pedido, el hueco y la opacidad del subtítulo salen de calc() sobre esa variable.
   Antes era una clase binaria (.scrolled) y el subtítulo pasaba de height:auto a 0, que CSS no puede animar (saltaba);
   y el fallback de iniciales (.brand-mark) no llevaba la clase .rhead__logo, así que nunca encogía. */
.rhead { --rhead-p: 0; position: sticky; top: 0; z-index: 20; background: var(--bq2-bg);
  padding: calc(16px - 6px * var(--rhead-p)) var(--bq2-pad, 18px) calc(12px - 4px * var(--rhead-p)); border-bottom: 1px solid transparent;
  transition: box-shadow .25s, border-color .25s; }
.rhead.scrolled { box-shadow: 0 1px 0 var(--bq2-line); border-color: var(--bq2-line); }
.rhead__brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.rhead__logo { height: calc(42px - 12px * var(--rhead-p)); width: auto; }
.rhead .brand-mark { font-size: calc(1rem - .285rem * var(--rhead-p)); }
.rhead__sub { text-align: center; color: var(--bq2-ink-soft); font-size: .85rem; overflow: hidden;
  margin-top: calc(6px * (1 - var(--rhead-p))); max-height: calc(1.25em * (1 - var(--rhead-p)));
  opacity: clamp(0, calc(1 - var(--rhead-p) * 1.6), 1); }
.rhead__powered { text-align: center; font-size: .68rem; color: var(--bq2-ink-faint); margin-top: 4px; }
.rhead__powered b { color: var(--bq2-ink-soft); }

/* ── Selector de modo (chat / carta) ── */
.mode { display: flex; gap: 4px; background: var(--bq2-bg-sunken); border: 1px solid var(--bq2-line);
  border-radius: var(--bq2-r-pill); padding: 4px; margin: 14px var(--bq2-pad, 18px) 0; }
.mode button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: var(--bq2-r-pill);
  font-weight: 700; color: var(--bq2-ink-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px;
  position: relative; z-index: 1; transition: color .25s ease; }
.mode button.on { color: var(--bq2-accent); }
/* Pastilla que se DESLIZA entre opciones: un solo indicador bajo los botones, ancho =
   medio contenedor menos padding (4+4) y gap (4) repartidos. Deslizamiento limpio con
   frenada suave, sin rebote ni compresión (probados y descartados por el owner, 2026-10-22:
   el overshoot se salía por los lados y el "choque" sobraba). */
.mode { position: relative; }
.mode::before {
  content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 12px) / 2);
  background: var(--bq2-bg-elev); border-radius: var(--bq2-r-pill); box-shadow: var(--bq2-shadow);
  transition: translate .32s cubic-bezier(.3, .7, .4, 1);
}
.mode.is-carta::before { translate: calc(100% + 4px) 0; }
@media (prefers-reduced-motion: reduce) { .mode::before { transition: none; } }
.mode button svg { width: 18px; height: 18px; }

/* ── Paneles chat / carta: transición horizontal sincronizada con la pastilla ──
   Fuera de la transición sigue habiendo UNA sola sección visible (como antes). Durante el
   cambio (.is-anim) las dos se apilan en la misma celda de grid y se desplazan en X con la
   misma duración y curva que la pastilla (.32s); al acabar, la saliente se oculta. */
.panes { flex: 1; display: flex; flex-direction: column; overflow-x: clip; }
.panes.is-anim { display: grid; grid-template: 1fr / 1fr; align-items: start; }
.panes.is-anim > .chat, .panes.is-anim > .carta { grid-area: 1 / 1; will-change: transform; }
.panes.is-anim > .chat { display: flex; }
.panes.is-anim > .carta { display: block; }
.panes.is-moving > .chat, .panes.is-moving > .carta { transition: transform .32s cubic-bezier(.3, .7, .4, 1); }

/* ── CHAT ── */
.chat { flex: 1; display: flex; flex-direction: column; padding: 16px var(--bq2-pad, 18px) max(160px, calc(var(--bq2-composer-h, 0px) + 72px)); gap: 14px; }
.msg { max-width: 86%; padding: 13px 16px; border-radius: 20px; line-height: 1.45; font-size: .97rem; }
.msg.bot { align-self: flex-start; background: var(--bq2-bg-elev); border: 1px solid var(--bq2-line); border-bottom-left-radius: 6px; }
.msg.user { align-self: flex-end; background: var(--bq2-accent); color: var(--bq2-accent-ink); border-bottom-right-radius: 6px; }
.msg b { font-weight: 800; }
.msg.bot.typing { display: inline-flex; gap: 5px; align-items: center; padding: 15px 18px; }
.msg.bot.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--bq2-ink-soft, var(--bq2-line)); opacity: .45; animation: bq2-typing 1.1s infinite ease-in-out; }
.msg.bot.typing i:nth-child(2) { animation-delay: .15s; }
.msg.bot.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bq2-typing { 0%, 70%, 100% { transform: translateY(0); opacity: .35; } 35% { transform: translateY(-4px); opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .msg.bot.typing i { animation: none; opacity: .6; } }
.composer__send:disabled { opacity: .55; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 100%; }
.chip-u { font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: var(--bq2-r-pill);
  background: var(--bq2-accent-soft); color: var(--bq2-accent); }

/* recomendación embebida (tarjeta de vino en el chat) */
.rec { align-self: flex-start; width: 100%; display: grid; gap: 10px; }
.rec-card { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center;
  background: var(--bq2-bg-elev); border: 1px solid var(--bq2-line); border-radius: var(--bq2-r-m); padding: 12px 14px; box-shadow: var(--bq2-shadow); }
.rec-card.best { border-color: var(--bq2-accent); box-shadow: 0 0 0 2px var(--bq2-accent-soft), var(--bq2-shadow); }
.rec-card .shot { width: 56px; height: 74px; display: grid; place-items: center; background: var(--bq2-photo-bg); border: 1px solid var(--bq2-photo-line); border-radius: 10px; overflow: hidden; }
.rec-card .shot img { max-height: 68px; }
.rec-card .n { font-weight: 700; font-size: .95rem; }
.rec-card .m { font-size: .8rem; color: var(--bq2-ink-soft); margin-top: 2px; }
.rec-card .pills { margin-top: 6px; display: flex; gap: 5px; flex-wrap: wrap; }
.rec-card .p { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: var(--bq2-r-pill); background: var(--bq2-bg-sunken); color: var(--bq2-ink-soft); }
.rec-card .price { text-align: right; font-weight: 800; }
.rec-card .price small { display: block; font-weight: 600; font-size: .68rem; color: var(--bq2-ink-faint); }
.rec-card .match { display: block; font-size: .68rem; color: var(--bq2-accent); font-weight: 700; }

/* sugerencias rápidas */
.suggest { display: flex; gap: 8px; flex-wrap: wrap; align-self: flex-start; margin-top: 2px; }
.suggest button { border: 1px solid var(--bq2-line); background: var(--bq2-bg-elev); color: var(--bq2-ink-soft);
  padding: 8px 13px; border-radius: var(--bq2-r-pill); font-size: .85rem; font-weight: 600; cursor: pointer; }
.suggest button:hover { border-color: var(--bq2-accent); color: var(--bq2-accent); }

/* barra de entrada */
.composer { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(540px, 100%);
  background: linear-gradient(to top, var(--bq2-bg) 72%, transparent); padding: 14px var(--bq2-pad, 18px) 18px; z-index: 30; }
.composer__row { display: flex; gap: 10px; align-items: flex-end; background: var(--bq2-bg-elev);
  border: 1.5px solid var(--bq2-line); border-radius: var(--bq2-r-l); padding: 6px 6px 6px 18px; box-shadow: var(--bq2-shadow-lg); }
/* v19 (FEAT-10) · cuadro de texto que crece: una línea en reposo, hasta ~6 líneas (max-height) y luego scroll
   interno. El JS fija la altura en línea (fitInput en cliente-bq2.js). Los 44 px mínimos igualan al botón de envío
   para que una sola línea quede centrada con él; 16 px como mínimo evita el zoom automático de iOS al enfocar.
   --bq2-r-l (28 px) con una línea = píldora; al crecer pasa a rectángulo redondeado en vez de deformarse. */
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: max(16px, 1rem); line-height: 1.4;
  outline: none; padding: 11px 0; color: var(--bq2-ink); resize: none; overflow-y: hidden; box-sizing: border-box;
  min-height: 44px; max-height: calc(6 * 1.4em + 22px); overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--bq2-line) transparent; }
.composer__row:focus-within { border-color: var(--bq2-accent); }
.composer__send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bq2-accent); color: #fff; cursor: pointer; display: grid; place-items: center; }
.composer__send svg { width: 20px; height: 20px; }

/* ── v19 (FEAT-11) · nota de voz ──
   Campo vacío → micrófono en el hueco del botón de enviar (como WhatsApp); con texto, enviar. Al grabar, `.vbar` sustituye al campo:
   descartar · punto + contador · onda de nivel (Web Audio AnalyserNode) · enviar. Todo 44 px táctil, foco visible y colores por tokens. */
.composer__send[hidden], .composer__row[hidden], .vbar[hidden], .vnote[hidden], .vmsg[hidden] { display: none; }
.composer__mic svg { width: 22px; height: 22px; }
.composer button:focus-visible { outline: 2px solid var(--bq2-accent); outline-offset: 2px; }
.composer__send:focus-visible { outline-color: var(--bq2-ink); }
.vbar { display: flex; align-items: center; gap: 10px; box-sizing: border-box; min-height: 58px; background: var(--bq2-bg-elev);
  border: 1.5px solid var(--bq2-accent); border-radius: var(--bq2-r-l); padding: 6px 6px 6px 8px; box-shadow: var(--bq2-shadow-lg); }
.vbar__x { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--bq2-ink-soft); cursor: pointer; display: grid; place-items: center; }
.vbar__x:hover { background: var(--bq2-bg-sunken); color: var(--bq2-ink); }
.vbar__x svg { width: 20px; height: 20px; }
.vbar__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--bq2-danger); animation: bq2-rec 1.4s ease-in-out infinite; }
.vbar__t { flex: none; min-width: 3.4ch; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--bq2-ink); }
.vbar__t.is-warn { color: var(--bq2-danger); }
.vbar__bars { flex: 1; min-width: 0; height: 34px; display: flex; align-items: center; justify-content: flex-end; gap: 3px; overflow: hidden; }
.vbar__bars i { flex: 1 1 0; min-width: 2px; max-width: 5px; height: 100%; border-radius: 3px; background: var(--bq2-accent); opacity: .85; transform: scaleY(.08); }
@keyframes bq2-rec { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.vnote { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 8px; padding: 12px 14px; background: var(--bq2-bg-elev);
  border: 1px solid var(--bq2-line); border-radius: var(--bq2-r-m); box-shadow: var(--bq2-shadow); }
.vnote p { flex: 1 1 200px; margin: 0; font-size: .88rem; line-height: 1.35; color: var(--bq2-ink-soft); }
.vnote__ok, .vmsg button { flex: none; min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--bq2-r-pill); background: var(--bq2-accent); color: var(--bq2-accent-ink);
  font: inherit; font-weight: 700; cursor: pointer; }
.vmsg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px; padding: 10px 14px; border-radius: var(--bq2-r-m);
  background: var(--bq2-accent-soft); color: var(--bq2-accent-deep); font-size: .88rem; font-weight: 600; line-height: 1.35; }
.vmsg span { flex: 1 1 180px; }
.msg.user .vmic { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; opacity: .85; }
.msg.user.is-pending { display: inline-flex; gap: 5px; align-items: center; padding: 15px 18px; }
.msg.user.is-pending i { width: 7px; height: 7px; border-radius: 50%; background: var(--bq2-accent-ink); opacity: .55; animation: bq2-typing 1.1s infinite ease-in-out; }
.msg.user.is-pending i:nth-child(2) { animation-delay: .15s; }
.msg.user.is-pending i:nth-child(3) { animation-delay: .3s; }
@media (prefers-reduced-motion: reduce) { .vbar__dot, .msg.user.is-pending i { animation: none; } }

/* ── CARTA (modo lista) ── */
.carta { flex: 1; padding: 16px var(--bq2-pad, 18px) 120px; display: none; }
.carta.on { display: block; }
.chat.off { display: none; }
/* Pastilla secundaria de la carta (Ver todos / Ver por copas): más fina, pequeña y
   discreta que la principal, centrada. inline-grid 1fr 1fr = dos mitades iguales al ancho
   de la etiqueta más larga, para que el indicador mida exactamente media pastilla. */
.cfilter { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: max-content;
  margin: 0 auto 20px; padding: 3px; background: var(--bq2-bg-sunken); border: 1px solid var(--bq2-line);
  border-radius: var(--bq2-r-pill); }
.cfilter button { position: relative; z-index: 1; border: 0; background: transparent; cursor: pointer;
  padding: 5px 14px; border-radius: var(--bq2-r-pill); font-size: .78rem; font-weight: 600;
  color: var(--bq2-ink-soft); transition: color .25s ease; white-space: nowrap; }
/* área táctil cómoda sin engordar la pastilla visible */
.cfilter button::after { content: ""; position: absolute; inset: -7px 0; }
.cfilter button.on { color: var(--bq2-ink); }
.cfilter button:focus-visible { outline: 2px solid var(--bq2-accent); outline-offset: 1px; }
.cfilter::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 8px) / 2);
  background: var(--bq2-bg-elev); border-radius: var(--bq2-r-pill); box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition: translate .32s cubic-bezier(.3, .7, .4, 1);
}
.cfilter.is-copas::before { translate: calc(100% + 2px) 0; }
@media (prefers-reduced-motion: reduce) { .cfilter::before { transition: none; } }
.carta__empty { text-align: center; color: var(--bq2-ink-soft); font-size: .9rem; margin: 24px 0; }
.carta__group { margin-bottom: 26px; }
.carta__group h2 { font-size: 1.1rem; font-weight: 800; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.carta__group h2 .dot { width: 10px; height: 10px; border-radius: 50%; }
.c-wine { display: grid; grid-template-columns: 50px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--bq2-line); }
.c-wine .shot { width: 50px; height: 66px; display: grid; place-items: center; background: var(--bq2-photo-bg); border: 1px solid var(--bq2-photo-line); border-radius: 8px; overflow: hidden; }
.c-wine .shot img { max-height: 60px; }
.c-wine .n { font-weight: 700; font-size: .95rem; }
.c-wine .m { font-size: .8rem; color: var(--bq2-ink-soft); margin-top: 2px; }
.c-wine .price { text-align: right; font-weight: 800; font-size: .95rem; }
.c-wine .price small { display: block; font-weight: 600; font-size: .68rem; color: var(--bq2-ink-faint); }

/* ── FAB Baqqo ── */
.fab { position: fixed; right: 18px; bottom: max(92px, calc(var(--bq2-composer-h, 0px) + 4px)); z-index: 40; width: 54px; height: 54px; border-radius: 50%;
  background: var(--bq2-dark); box-shadow: var(--bq2-shadow-lg); border: 0; cursor: pointer; display: grid; place-items: center; }
.fab img { width: 30px; }
.carta.on ~ .fab { bottom: 24px; }
.modal-ov { position: fixed; inset: 0; background: rgba(20,15,13,.5); z-index: 50; opacity: 0; visibility: hidden; transition: opacity .25s; backdrop-filter: blur(2px); }
.modal-ov.open { opacity: 1; visibility: visible; }
.modal { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%) translateY(100%); width: min(540px, 100%);
  background: var(--bq2-bg-elev); border-radius: var(--bq2-r-l) var(--bq2-r-l) 0 0; padding: 28px 24px 34px; z-index: 51;
  transition: transform .3s var(--bq2-ease); text-align: center; }
.modal-ov.open .modal { transform: translateX(-50%); }
.modal img.logo { height: 30px; margin: 0 auto 14px; }
.modal h3 { font-size: 1.2rem; font-weight: 800; margin: 0 0 8px; }
.modal p { color: var(--bq2-ink-soft); margin: 0 0 20px; }
.modal .stores { display: flex; gap: 12px; justify-content: center; }
.modal .store { background: var(--bq2-dark); color: var(--bq2-on-dark); padding: 10px 18px; border-radius: var(--bq2-r-m); font-weight: 700; font-size: .85rem; }

/* volver a landing (esquina, discreto) */
.back-demo { position: fixed; top: 14px; left: 14px; z-index: 25; background: rgba(255,255,255,.8);
  backdrop-filter: blur(8px); border: 1px solid var(--bq2-line); border-radius: var(--bq2-r-pill);
  padding: 7px 14px; font-size: .8rem; font-weight: 600; color: var(--bq2-ink-soft); text-decoration: none; }

/* ════════════ MI SELECCIÓN (F1) ════════════
   Conversión DECLARADA del comensal: tocar un vino → modal (formato + cantidad) → se añade a
   "Mi selección" (el modal viaja al icono y este pulsa) → "¡Ya se lo he dicho al camarero!". No se envía al
   restaurante. Ver PLAN_ADAPTACION_DEMO.md (R11, D8-D10). */

/* Icono arriba a la derecha, en línea con el logo; se reduce con la cabecera al hacer scroll. */
.order-btn { position: absolute; top: calc(15px - 7px * var(--rhead-p, 0)); right: var(--bq2-pad, 18px); z-index: 2;
  width: calc(44px - 10px * var(--rhead-p, 0)); height: calc(44px - 10px * var(--rhead-p, 0));
  border-radius: 50%; border: 1px solid var(--bq2-line); background: var(--bq2-bg-elev); color: var(--bq2-accent);
  display: grid; place-items: center; cursor: pointer; padding: 0;
  transition: border-color .2s; }
.order-btn svg { width: calc(24px - 6px * var(--rhead-p, 0)); height: calc(24px - 6px * var(--rhead-p, 0)); }
.order-btn:hover { border-color: var(--bq2-accent); }
.order-btn:focus-visible, .sheet-x:focus-visible, .fmt:focus-visible, .stepper button:focus-visible, .obtn:focus-visible,
[data-wine-id]:focus-visible { outline: 2px solid var(--bq2-accent); outline-offset: 2px; }
.order-btn__count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bq2-accent); color: var(--bq2-accent-ink); font-size: .68rem; font-weight: 800; line-height: 1;
  display: grid; place-items: center; }
.order-btn__count[hidden] { display: none; }
/* pulso al recibir el vino: anillo que se expande + pequeño rebote del icono */
.order-btn::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--bq2-accent); opacity: 0; pointer-events: none; }
.order-btn.pulse { animation: order-pop .42s ease-out; }
.order-btn.pulse::after { animation: order-ring .6s ease-out; }
@keyframes order-pop { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes order-ring { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.8); } }

/* los vinos son tocables sin botón: solo afordancia mínima */
[data-wine-id] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.c-wine[data-wine-id]:active, .rec-card[data-wine-id]:active { background: var(--bq2-bg-sunken); }
/* línea de ayuda, no intrusiva; desaparece tras el primer pedido */
.carta__hint, .rec__hint { text-align: center; font-size: .78rem; color: var(--bq2-ink-faint); margin: -6px 0 14px; }
.rec__hint { text-align: left; margin: 2px 0 0; }

/* hojas inferiores */
.sheet-ov { position: fixed; inset: 0; background: rgba(20, 15, 13, .5); z-index: 60; opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s; backdrop-filter: blur(2px); }
.sheet-ov.open { opacity: 1; visibility: visible; }
.addm, .ordersheet { position: fixed; left: 0; right: 0; bottom: 0; margin-inline: auto; width: min(540px, 100%); z-index: 61;
  background: var(--bq2-bg-elev); border-radius: var(--bq2-r-l) var(--bq2-r-l) 0 0; padding: 26px 22px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18); max-height: calc(100vh - 32px); overflow-y: auto; outline: none;
  transform: translateY(100%); visibility: hidden; transform-origin: center;
  /* visibility pasa a "visible" al instante al abrir (si no, el diálogo no puede recibir el foco) y se retrasa al cerrar */
  transition: transform .3s var(--bq2-ease), visibility 0s linear .3s; }
.addm.open, .ordersheet.open { transform: none; visibility: visible; transition: transform .3s var(--bq2-ease), visibility 0s; }
.sheet-x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--bq2-line);
  background: var(--bq2-bg); color: var(--bq2-ink-soft); cursor: pointer; font-size: 1rem; display: grid; place-items: center; }

.addm__head { display: flex; gap: 14px; align-items: center; padding-right: 40px; }
.addm__head .shot { flex: 0 0 56px; width: 56px; height: 74px; display: grid; place-items: center; background: var(--bq2-photo-bg);
  border: 1px solid var(--bq2-photo-line); border-radius: 10px; overflow: hidden; }
.addm__head .shot img { max-height: 68px; }
.addm__head h3 { font-size: 1.05rem; font-weight: 800; margin: 0; line-height: 1.2; }
.addm__head p { margin: 3px 0 0; font-size: .82rem; color: var(--bq2-ink-soft); }
.addm__fmt { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 18px; }
.fmt { text-align: left; border: 1.5px solid var(--bq2-line); background: var(--bq2-bg-elev); border-radius: 14px; padding: 12px 14px;
  cursor: pointer; font-weight: 700; color: var(--bq2-ink); display: flex; flex-direction: column; gap: 2px; min-height: 56px; }
.fmt small { font-weight: 600; font-size: .8rem; color: var(--bq2-ink-soft); }
.fmt[aria-checked="true"] { border-color: var(--bq2-accent); background: var(--bq2-accent-soft); }
.fmt[aria-checked="true"] small { color: var(--bq2-accent); }
.addm__qty { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-weight: 700; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--bq2-line); background: var(--bq2-bg-elev);
  font-size: 1.2rem; font-weight: 700; cursor: pointer; color: var(--bq2-ink); display: grid; place-items: center; padding: 0; }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper output { min-width: 36px; text-align: center; font-weight: 800; font-size: 1.05rem; }
.obtn { display: block; width: 100%; margin-top: 18px; padding: 14px 18px; border: 0; border-radius: var(--bq2-r-pill);
  background: var(--bq2-accent); color: var(--bq2-accent-ink); font-weight: 800; font-size: 1rem; cursor: pointer; min-height: 48px; }
.obtn:disabled { opacity: .45; cursor: default; }

.ordersheet h2 { font-size: 1.3rem; font-weight: 800; margin: 0 40px 10px 0; }
.ordersheet__note { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--bq2-r-m); background: var(--bq2-accent-soft);
  color: var(--bq2-accent-deep); font-size: .86rem; font-weight: 600; line-height: 1.4; }
.ordersheet__list { list-style: none; margin: 0; padding: 0; }
.ordersheet__list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--bq2-line); }
.ordersheet__list .n { font-weight: 700; font-size: .95rem; }
.ordersheet__list .m { font-size: .8rem; color: var(--bq2-ink-soft); }
.ordersheet__list .p { font-weight: 800; text-align: right; }
.ordersheet__list .row2 { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.ordersheet__list .rm { border: 0; background: none; color: var(--bq2-ink-soft); font-size: .82rem; font-weight: 600; text-decoration: underline;
  cursor: pointer; padding: 10px 4px; min-height: 44px; }
.ordersheet__list .stepper button { width: 36px; height: 36px; font-size: 1rem; }
.ordersheet__list .stepper output { min-width: 28px; font-size: .95rem; }
.ordersheet__empty { margin: 8px 0 4px; color: var(--bq2-ink-soft); font-size: .92rem; line-height: 1.45; }
.ordersheet__total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; font-size: 1.1rem; }
.ordersheet__total b { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.ordersheet__fine { margin: 10px 0 0; text-align: center; font-size: .74rem; color: var(--bq2-ink-faint); }
.ordersheet.is-empty .ordersheet__total, .ordersheet.is-empty .obtn, .ordersheet.is-empty .ordersheet__note { display: none; }
.ordersheet:not(.is-empty) .ordersheet__empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  .order-btn, .order-btn svg, .addm, .ordersheet, .sheet-ov { transition: none; }
  .order-btn.pulse, .order-btn.pulse::after { animation: none; }
}

.otoast { position: fixed; left: 50%; bottom: max(96px, calc(var(--bq2-composer-h, 0px) + 8px)); transform: translate(-50%, 20px); background: var(--bq2-ink); color: #fff; padding: 11px 18px;
  border-radius: var(--bq2-r-pill); font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none; z-index: 70; width: max-content; max-width: calc(100vw - 32px); text-align: center; line-height: 1.3;
  transition: opacity .25s, transform .25s; }
.otoast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .otoast { transition: none; } }

/* subsecciones de la carta (F3) */
.carta__sub { font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--bq2-ink-soft); margin: 18px 0 2px; }

/* Dirección sin carta activa: solo se ve este bloque */
body.is-na > *:not(#na) { display: none !important; }
.na { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: 14px; padding: 32px 24px; text-align: center; background: var(--bq2-bg); }
.na[hidden] { display: none; }
.na img { height: 26px; margin-bottom: 8px; }
.na h1 { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.na p { margin: 0; max-width: 34ch; color: var(--bq2-ink-soft); line-height: 1.5; }
.na .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; margin-top: 8px; border-radius: 999px;
  background: var(--bq2-accent); color: var(--bq2-accent-ink); font-weight: 700; text-decoration: none; }

/* Selección validada: modal central (hay que comunicarlo al personal de sala) */
.handoff-ov { z-index: 80; }
.handoff { position: fixed; left: 50%; top: 50%; z-index: 81; width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto;
  background: var(--bq2-bg-elev); border-radius: var(--bq2-r-l); padding: 28px 22px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); outline: none;
  transform: translate(-50%, -46%) scale(.97); opacity: 0; visibility: hidden;
  transition: transform .28s var(--bq2-ease), opacity .22s, visibility 0s linear .28s; }
.handoff.open { transform: translate(-50%, -50%); opacity: 1; visibility: visible; transition: transform .28s var(--bq2-ease), opacity .22s, visibility 0s; }
.handoff h2 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; text-align: center; }
.handoff__sub { margin: 0 0 16px; text-align: center; font-size: 1rem; line-height: 1.4; color: var(--bq2-ink); font-weight: 600; }
.handoff__list { list-style: none; margin: 0; padding: 4px 14px; background: var(--bq2-accent-soft); border-radius: var(--bq2-r-m); }
.handoff__list li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--bq2-line); }
.handoff__list li:last-child { border-bottom: 0; }
.handoff__list .q { font-weight: 800; font-size: 1.05rem; min-width: 2ch; }
.handoff__list .n { font-weight: 700; font-size: .98rem; line-height: 1.25; }
.handoff__list .n small { display: block; margin-top: 2px; font-weight: 500; font-size: .8rem; color: var(--bq2-ink-soft); }
.handoff__list b { font-weight: 800; white-space: nowrap; }
.handoff__total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; font-size: 1.05rem; }
.handoff__total b { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
@media (prefers-reduced-motion: reduce) { .handoff, .handoff.open { transition: none; } }

/* ═══ Fase 3 · chat del sommelier (2.8): escritura simulada y cascada de tarjetas ═══ */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.msg.bot.is-writing { cursor: pointer; }
.msg.bot.is-writing .msg__t::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -0.14em;
  background: var(--bq2-accent); animation: bq2-caret .8s steps(1) infinite; }
@keyframes bq2-caret { 50% { opacity: 0; } }
/* las tarjetas esperan (sin ocupar atención ni foco) a que acabe el texto y entran de arriba abajo */
.rec--pending .rec-card { visibility: hidden; }
.rec--show .rec-card { animation: bq2-card-in .35s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 120ms); }
@keyframes bq2-card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .msg.bot.is-writing .msg__t::after { animation: none; }
  .rec--show .rec-card { animation: none; }
}

/* ═══ v19 · plan de mesa: tarjetas agrupadas por tiempo, respuestas rápidas y chip «Tu elección» ═══ */
.chip-u--pref { background: transparent; box-shadow: inset 0 0 0 1.5px var(--bq2-accent); }
.rec--plan { gap: 18px; }
.rec__group { position: relative; display: grid; gap: 10px; padding-left: 16px; border-left: 2px solid var(--bq2-line); }
.rec__gh { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .02em; color: var(--bq2-ink-soft); line-height: 1.35; }
.rec__gh::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bq2-bg); border: 2px solid var(--bq2-accent); }
.rec__add { margin-top: 0; }
.rec__add:focus-visible { outline: 2px solid var(--bq2-accent); outline-offset: 2px; }
.rec--pending .rec__add { visibility: hidden; }
.suggest--quick button { min-height: 44px; padding: 10px 16px; }
.suggest--quick button:focus-visible { outline: 2px solid var(--bq2-accent); outline-offset: 2px; }
@media (min-width: 700px) { .rec__add { width: auto; justify-self: start; padding-inline: 28px; } }
/* v19 (FEAT-5 #9) · aviso de sistema cuando el sommelier no responde: fuera de la burbuja del sommelier, sobrio y con "Reintentar" */
.sysnote { align-self: stretch; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 14px; border-radius: 12px;
  border: 1px dashed var(--bq2-line); color: var(--bq2-ink-soft); font-size: .85rem; line-height: 1.4; }
.sysnote__t { flex: 1 1 200px; }
.sysnote__retry { min-height: 44px; padding: 8px 16px; border-radius: var(--bq2-r-pill); border: 1px solid var(--bq2-line); background: var(--bq2-bg-elev);
  color: var(--bq2-ink); font-size: .85rem; font-weight: 600; cursor: pointer; }
.sysnote__retry:hover { border-color: var(--bq2-accent); color: var(--bq2-accent); }
.sysnote__retry:focus-visible { outline: 2px solid var(--bq2-accent); outline-offset: 2px; }
/* v19 (FEAT-7) · selector de idioma discreto en el pie de la carta (js/i18n.js → mountSwitcher). Texto, sin iconos: objetivos táctiles
   de 44 px, foco visible y sin saltos de layout con idiomas largos. */
.clang { display: flex; justify-content: center; align-items: center; gap: 2px; margin: 28px 0 8px; }
.clang[hidden] { display: none; }
.clang button { min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; border-radius: var(--bq2-r-pill); background: transparent;
  color: var(--bq2-ink-faint); font: inherit; font-size: .78rem; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
.clang button:hover { color: var(--bq2-ink-soft); }
.clang button[aria-pressed="true"] { color: var(--bq2-ink); background: var(--bq2-bg-sunken); }
.clang button:focus-visible { outline: 2px solid var(--bq2-accent); outline-offset: 1px; }
/* Expansión de texto (I18N_SCOPE §7): las etiquetas en inglés/alemán pueden ser más largas que en español; nada se corta ni desborda. */
.mode button, .cfilter button, .suggest button, .obtn { overflow-wrap: anywhere; }
.rec__gh, .carta__group h2, .rec-card .n { overflow-wrap: anywhere; }