:root {
  --bg: #ffffff;
  --text: #212121;
  --muted: #757575;
  --line: #757575;
  --fill: #e0e0e0;
  --primary: #8a3ff0;
  --primary-dark: #7130cc;
  --error: #c62828;
  --faint: #9e9e9e;
  --strong: #6200ea;
  --strong-dark: #5000c0;
  --surface: #ffffff;
  --accent: #00c4b4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
}

.login {
  max-width: 440px;
  margin: 0 auto;
  /* everything at the top (2026-11-07, was 18vh): on a phone the keyboard
     covers the bottom half and hid INGRESAR */
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 32px max(24px, env(safe-area-inset-left));
}
.login h1 { margin-bottom: 24px; }
.login form { gap: 20px; }

h1 {
  margin: 0 0 clamp(28px, 7vh, 56px);
  text-align: center;
  font-size: clamp(1.5rem, 8vw, 2rem);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
}

form { display: flex; flex-direction: column; gap: 24px; }

/* Material-style text field: an underline at rest, grey fill with a floating
   label when focused or filled — the two states the reference shows. */
.field {
  position: relative;
  display: block;
  border-bottom: 1px solid var(--line);
  border-radius: 4px 4px 0 0;
  transition: background-color .15s;
}
.field:focus-within { background: var(--fill); border-bottom: 2px solid var(--primary); }

.field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 26px 16px 8px;
  font: inherit;
  font-size: 1.15rem;
  color: var(--text);
}
.field input[type="password"], .field input#password, .field:has(.eye) input { padding-right: 56px; }
.field input[readonly] { color: var(--muted); cursor: default; } /* Nuevo Personal: usuario assigned by the server */

.field > span {
  position: absolute;
  left: 16px;
  top: 18px;
  font-size: 1.1rem;
  color: var(--muted);
  pointer-events: none;
  transition: top .15s, font-size .15s, color .15s;
}
.field input:focus + span,
.field input:not(:placeholder-shown) + span {
  top: 6px;
  font-size: .8rem;
  letter-spacing: .03em;
}
.field input:focus + span { color: var(--primary); }
.field textarea {
  display: block;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 26px 16px 8px;
  font: inherit;
  font-size: 1.15rem;
  color: var(--text);
  resize: vertical;
}
.field textarea:focus + span,
.field textarea:not(:placeholder-shown) + span { top: 6px; font-size: .8rem; letter-spacing: .03em; }
.field textarea:focus + span { color: var(--primary); }

.eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #555;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.eye svg { width: 26px; height: 26px; fill: currentColor; }
.eye[aria-pressed="true"] { color: var(--primary); }

.primary {
  margin-top: 16px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: .12em;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,.22);
  transition: background-color .15s, box-shadow .15s;
}
.primary:hover { background: var(--primary-dark); }
.primary:active { box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.primary:disabled { opacity: .6; cursor: default; }

.error { margin: -8px 0 0; color: var(--error); font-size: .95rem; text-align: center; }

/* ---- inicio (mesero home) ---- */
.home {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px max(24px, env(safe-area-inset-right)) 96px max(24px, env(safe-area-inset-left));
}

.top {
  /* who | restaurant (centred on the page, not between its neighbours) | ⋮ */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.who { font-weight: 700; color: var(--muted); font-size: 1.05rem; min-width: 0; overflow-wrap: anywhere; }
.rest { color: var(--faint); font-size: 1.05rem; text-align: center; overflow-wrap: anywhere; }
.top .menu { justify-self: end; margin-right: -10px; }

.tabs { margin-bottom: 20px; }
.tablist { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 4px 6px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--faint);
  font: inherit;
  font-size: clamp(1.05rem, 5vw, 1.4rem);
  font-weight: 700;
  cursor: pointer;
}
.tab[hidden] { display: none; }
.tab[aria-selected="true"] { color: var(--muted); border-bottom-color: var(--strong); }
.tab:focus-visible, .kebab:focus-visible, .menu-list button:focus-visible { outline: 2px solid var(--strong); outline-offset: 2px; }

.tab-icon { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; }
.tab-icon svg { width: 34px; height: 34px; }
.ico-ordenes { fill: #43a047; }
.ico-ordenes .fold { fill: #2e7d32; }
/* No open orders: the green icon goes grey like the other tab. */
.tab-icon.empty .ico-ordenes { fill: var(--faint); }
.tab-icon.empty .ico-ordenes .fold { fill: #7a7a7a; }
.ico-bell { fill: var(--faint); }
.badge {
  position: absolute;
  top: -8px;
  left: 6px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d32f2f;
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}

.menu { position: relative; flex: none; }
.kebab {
  width: 44px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.kebab svg { width: 28px; height: 28px; fill: currentColor; }
.menu-list {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 10;
  min-width: 160px;
  padding: 8px 0;
  background: var(--surface);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.menu-list button {
  display: block;
  width: 100%;
  padding: 12px 20px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}
.menu-list button:hover { background: var(--fill); }
/* A thin line between ⋮ menu options (and between submenu options; the
   `> * + button` beats `.menu-list button { border: 0 }`); tinted
   from --text so it shows on both the menu and the submenu's --fill, in both themes. */
.menu-list > * + *, .menu-list > * + button, .menu-list .submenu > * + * { border-top: 1px solid color-mix(in srgb, var(--text) 18%, transparent); }
/* Gerente ⋮ → Meseros › expands its own items in place, indented. */
.submenu-btn { display: flex !important; justify-content: space-between; align-items: center; gap: 16px; }
.submenu-btn .chevron { font-size: 1.3rem; line-height: 1; transition: transform .15s; }
.submenu-btn[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.submenu { background: var(--fill); }
.menu-list .submenu button { padding-left: 36px; }

/* ⋮ menu icons (added 2026-10-28): a line icon before every option and
   submenu option; .submenu-btn keeps its chevron at the far right. */
.menu-list button:not([hidden]) { display: flex; align-items: center; gap: 12px; }
.menu-list .mi { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--faint); }
.menu-list .submenu .mi { width: 18px; height: 18px; }
.submenu-btn { justify-content: flex-start !important; gap: 12px; }
.submenu-btn .chevron { margin-left: auto; }
.menu-list { min-width: 210px; }

.primary.strong {
  margin-top: 0;
  background: var(--strong);
  letter-spacing: .1em;
  font-size: clamp(1.1rem, 5vw, 1.35rem);
  text-transform: none;
}
.primary.strong:hover { background: var(--strong-dark); }

.panel { padding-top: 32px; }

.orden-actual {
  padding: 20px 20px 24px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  text-align: center;
}
.orden-titulo { margin: 0; font-size: clamp(1.6rem, 7vw, 2rem); font-weight: 700; color: var(--text); }
.orden-estado { margin: 4px 0 20px; color: var(--faint); }
.primary.hablar { display: inline-flex; align-items: center; justify-content: center; gap: 10px; letter-spacing: .04em; }
.primary.hablar svg { width: 26px; height: 26px; fill: currentColor; flex: none; }
.empty { margin: 0; text-align: center; color: var(--faint); }

/* After the first Hablar/Agregar (images_references/mesero-listening.png and
   mesero-pending-item.png) the card flattens to a row — "Para: Barra" + the
   button — with the ESCUCHANDO / PROCESANDO bars and the item cards below.
   While listening the button turns grey (tap again to stop). */
.orden-actual.compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 32px;
  padding: 0;
  background: none;
  box-shadow: none;
  text-align: left;
}
.orden-actual.compact .orden-titulo { color: var(--muted); }
.orden-actual.compact .orden-titulo::before { content: "Para: "; }
.orden-actual.compact .orden-estado { display: none; }
.orden-actual.compact .primary.hablar {
  flex: 0 1 220px;
  min-height: 64px;
  padding: 8px 24px;
  letter-spacing: .12em;
}
.orden-actual.compact .primary.hablar svg { display: none; }
.orden-actual.listening .primary.hablar,
.orden-actual.compact .primary.hablar:disabled {
  background: #e0e0e0;
  color: #757575;
  box-shadow: none;
  opacity: 1;
}

.escuchando {
  flex: 1 0 100%;
  padding: 22px 16px;
  background: #81c784;
  color: #fff;
  text-align: center;
  font-size: clamp(1.2rem, 5.5vw, 1.5rem);
  font-weight: 700;
  animation: parpadeo 1s ease-in-out infinite;
}
@keyframes parpadeo { 50% { opacity: .35; } }
.procesando {
  flex: 1 0 100%;
  padding: 22px 16px;
  border-radius: 12px;
  background: #757575;
  color: #fff;
  text-align: center;
  font-size: clamp(1.2rem, 5.5vw, 1.5rem);
  font-weight: 700;
  animation: parpadeo 1s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .escuchando, .procesando { animation: none; } }

.orden-num {
  flex: 1 0 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: #757575;
  color: #fff;
  text-align: center;
  font-size: clamp(1.5rem, 6.5vw, 1.9rem);
  font-weight: 700;
  box-shadow: 0 3px 6px rgba(0,0,0,.25);
}
.items-pendientes { flex: 1 0 100%; margin: 0; padding: 0 8px; list-style: none; display: flex; flex-direction: column; gap: 20px; }
.items-pendientes:empty { display: none; }
.item-pendiente {
  padding: 24px 24px 28px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.item-pendiente h3 { margin: 0; color: var(--muted); font-size: clamp(1.4rem, 6vw, 1.75rem); font-weight: 700; }
.item-precio { margin: 8px 0 0; color: var(--muted); font-size: clamp(1.1rem, 5vw, 1.35rem); }
.item-extras { margin: 6px 0 0; padding: 0; list-style: none; color: var(--faint); font-size: 1.05rem; }
.item-acciones { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; }
.item-acciones button {
  flex: 0 1 190px;
  min-height: 56px;
  border: 0;
  border-radius: 2px;
  color: #fff;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.item-no { background: #d32f2f; }
.item-si { background: #2e7d32; }
.item-acciones button:disabled { opacity: .6; cursor: default; }
.item-acciones button:active { box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.item-pendiente.confirmado { border: 3px solid #2e7d32; }

/* Barra / Llevar: the order is built locally and sent whole
   (images_references/mesero-confirmed-item.png). */
.orden-envio {
  flex: 1 0 100%;
  padding: 14px 16px 20px;
  border-radius: 14px;
  background: #757575;
  color: #fff;
  text-align: center;
  box-shadow: 0 3px 6px rgba(0,0,0,.25);
}
/* Mesa shows the bar right under Hablar/Agregar before the card goes compact
   (compact already spaces its rows with the flex gap). */
.orden-actual:not(.compact) .orden-envio { margin-top: 24px; }

/* AGREGAR NOTA under the item cards (images_references/mesero-confirmed-item.png). */
.orden-nota-box { flex: 1 0 100%; text-align: left; }
.orden-actual:not(.compact) .orden-nota-box { margin-top: 24px; }
.orden-nota { margin: 0 8px 14px; color: var(--muted); font-size: 1.1rem; overflow-wrap: anywhere; }
.orden-nota::before { content: "Nota: "; font-weight: 700; }
.primary.agregar-nota { width: auto; padding: 14px 40px; letter-spacing: .1em; }
.modal.nota form { gap: 14px; }
.modal.nota h2 { margin-bottom: 0; }
.primary.dictar { margin-top: 0; }
.primary.dictar[aria-pressed="true"] { background: #e0e0e0; color: #757575; box-shadow: none; }
.modal.nota .procesando, .modal.nota .escuchando { padding: 14px 16px; border-radius: 12px; }
.nota-cuenta { margin: 6px 0 0; text-align: right; color: var(--faint); font-size: .9rem; }
.aviso-texto { margin: 10px 0 18px; font-size: 1.15rem; line-height: 1.4; }
.orden-envio-titulo { margin: 0 0 14px; font-size: clamp(1.5rem, 6.5vw, 1.9rem); font-weight: 700; }
.orden-envio-acciones { display: flex; gap: 16px; }
.orden-envio-acciones button {
  flex: 1;
  min-height: 52px;
  padding: 8px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font: inherit;
  font-size: clamp(1.1rem, 5vw, 1.4rem);
  font-weight: 500;
  letter-spacing: .1em;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.envio-cancelar { background: #d32f2f; }
.envio-confirmar { background: #2e7d32; }
.orden-envio-acciones button:disabled { opacity: .6; cursor: default; }
.orden-envio-acciones button[hidden] { display: none; }

/* ---- Tipo de Orden modal ---- */
.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 28px 28px 32px;
  border: 0;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.modal::backdrop { background: rgba(0,0,0,.6); }
/* The login page's `form { gap: 24px }` must not apply here — spacing below is explicit. */
.modal form { gap: 0; }
.modal h2 { margin: 0 0 6px; line-height: 1.2; font-size: clamp(1.5rem, 6.5vw, 1.9rem); font-weight: 500; }

.radios { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 6px; }
.radio {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  font-size: clamp(1.4rem, 6vw, 1.75rem);
  font-weight: 700;
  cursor: pointer;
}
.radio input {
  appearance: none;
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0 0 0 2px;
  border: 2.5px solid #757575;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.radio input::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform .12s;
}
.radio input:checked { border-color: var(--accent); }
.radio input:checked::before { transform: scale(1); }
.radio input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.mesa-field { margin: 0 0 8px; }
.mesa-field input {
  width: 100%;
  padding: 8px 2px;
  border: 0;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: clamp(1.4rem, 6vw, 1.75rem);
  outline: 0;
  caret-color: var(--accent);
}
.mesa-field input:focus { border-bottom-color: var(--accent); }
.mesa-field input::placeholder { color: var(--faint); }
.modal .error { margin: 8px 0 0; text-align: left; }

/* ---- Cambiar mi clave modal (reuses the login's .field + .eye) ---- */
.modal.clave form { gap: 14px; }
.modal.clave .modal-actions { margin-top: 14px; }

.modal-actions { display: flex; gap: 20px; margin-top: 28px; }
.pill {
  flex: 1;
  min-height: 48px;
  padding: 12px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  font: inherit;
  font-size: clamp(1rem, 4.5vw, 1.2rem);
  font-weight: 500;
  letter-spacing: .1em;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,.2);
}
.pill:active { box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.pill.cancel { color: #d32f2f; }
.pill.accept { color: #2e7d32; }

/* ---- Mis Órdenes de Hoy (images_references/mesero-mis-ordenes-hoy.png) ---- */
.modal.mis-ordenes { display: none; padding: 24px 0 20px; }
.modal.mis-ordenes[open] { display: flex; flex-direction: column; overflow: hidden; }
.mis-ordenes h2 { margin: 0 28px 20px; }
.mo-lista { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 24px 8px; display: flex; flex-direction: column; gap: 28px; }
.mo-vacio { margin: 8px 0; color: var(--faint); text-align: center; }
.mo-orden {
  padding: 20px 18px 24px;
  border-radius: 16px;
  background: #757575;
  color: #fff;
  box-shadow: 0 3px 6px rgba(0,0,0,.25);
}
.mo-orden h3 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: clamp(1.5rem, 6.5vw, 1.9rem); font-weight: 700; }
.mo-tipo { font-size: .85em; }
.mo-estado {
  display: inline-block;
  margin: 10px 0 8px;
  padding: 6px 18px;
  border-radius: 999px;
  background: #333;
  font-size: clamp(1.1rem, 5vw, 1.35rem);
  font-weight: 500;
  color: #e0e0e0;
}
.mo-estado.st-abierta { color: #ff6d00; }
.mo-estado.st-cancelada { color: #ef5350; }
.mo-estado.st-pagada { color: #43a047; }
.mo-meta { margin: 4px 0 0; font-size: 1.1rem; }
.mo-nota { margin: 6px 0 0; font-size: 1.1rem; font-weight: 700; }
.mo-items { margin: 18px 0 0; padding: 0 8px; list-style: none; display: flex; flex-direction: column; gap: 16px; }
.mo-item {
  padding: 16px 18px;
  border: 3px solid #9e9e9e;
  border-radius: 14px;
  background: #3a3a3a;
  color: #cfcfcf;
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.mo-item h4 { margin: 0; font-size: clamp(1.2rem, 5.5vw, 1.5rem); font-weight: 700; }
.mo-item ul { margin: 4px 0 0; padding: 0; list-style: none; color: #a8a8a8; }
.mo-item-estado { margin: 8px 0 0; font-size: clamp(1.2rem, 5.5vw, 1.5rem); font-weight: 700; color: #bdbdbd; }
.mo-pidio { margin: 4px 0 0; color: var(--faint); font-size: .95rem; }
.pill.mo-entregado { margin-top: 12px; padding: 10px 20px; background: #2e7d32; color: #fff; font-weight: 700; }
.pill.mo-entregado:disabled { opacity: .6; }
.pill.mo-pagado { display: block; width: 100%; margin-top: 14px; padding: 14px 20px; background: #1565c0; color: #fff; font-weight: 700; font-size: 1.15rem; }
.pill.mo-pagado:disabled { opacity: .6; }
.pill.mo-cancelar { display: block; width: 100%; margin-top: 14px; padding: 14px 20px; background: #d32f2f; color: #fff; font-weight: 700; font-size: 1.15rem; }
.pill.mo-cancelar:disabled { opacity: .6; }
.pill.mo-cancelar-item { display: block; margin-top: 8px; padding: 8px 14px; background: #fff; color: #d32f2f; border: 2px solid #d32f2f; font-weight: 700; font-size: .95rem; }
.pill.mo-cancelar-item:disabled { opacity: .6; }
.pill.mo-agregar { display: block; width: 100%; margin-top: 14px; padding: 14px 20px; background: #6a1b9a; color: #fff; font-weight: 700; font-size: 1.15rem; }
.pill.mo-reimprimir { display: block; width: 100%; margin-top: 14px; padding: 14px 20px; background: #00838f; color: #fff; font-weight: 700; font-size: 1.15rem; }
.pill.mo-reimprimir:disabled { opacity: .6; }
.mo-item.st-entregado { border-color: #2e7d32; }
.mo-item.st-entregado .mo-item-estado { color: #43a047; }
.mo-item.st-listo { border-color: #1e88e5; }
.mo-item.st-listo .mo-item-estado { color: #64b5f6; }
.mo-item.st-pendiente .mo-item-estado { color: #ffb74d; }
.mo-item.st-cancelada { border-color: #c62828; opacity: .75; }
.mo-item.st-cancelada h4 { text-decoration: line-through; }
.mo-item.st-cancelada .mo-item-estado { color: #ef5350; }
.mo-total { margin: 16px 0 0; text-align: right; font-size: 1.25rem; font-weight: 700; }
.pg-resumen { margin: -8px 28px 16px; color: var(--muted); font-size: 1.05rem; }

/* ---- gerente: PREGUNTAR (asistente) ---- */
.agente { display: flex; flex-direction: column; gap: 14px; margin-bottom: 32px; }
.agente-titulo { margin: 0; font-size: 1.2rem; color: var(--muted); }
.agente-ayuda { margin: 0; color: var(--faint); font-size: .95rem; }
.agente .primary.hablar { margin-top: 0; min-height: 64px; letter-spacing: .12em; }
.agente .primary.hablar.activo,
.agente .primary.hablar:disabled { background: #e0e0e0; color: #757575; box-shadow: none; opacity: 1; }
.agente .escuchando { border-radius: 12px; }
.agente-respuestas { display: flex; flex-direction: column; gap: 12px; }
.agente-mesero { margin: 32px 0 0; }
.agente-card { padding: 14px 16px; border-radius: 14px; background: var(--fill); color: var(--text); }
.agente-card.error-card { border-left: 4px solid var(--error); }
.agente-pregunta { margin: 0 0 8px; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.agente-respuesta { margin: 0; font-size: 1.1rem; line-height: 1.4; overflow-wrap: anywhere; }
.agente-tools { margin: 8px 0 0; color: var(--faint); font-size: .85rem; }
.ml-mesero { padding: 16px 18px; }
.ml-mesero h3 { font-size: clamp(1.25rem, 5.5vw, 1.5rem); }
.ml-inactivo { font-size: .8em; font-weight: 500; }
.ml-acciones { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.ml-acciones .pill { flex: 1 1 120px; padding: 12px 16px; color: #fff; font-weight: 700; }
.ml-acciones .pill:disabled { opacity: .6; }
.ml-acciones button.pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.pill .bi { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pill.ml-editar { background: #6a1b9a; }
.ml-cambio { margin: 6px 0 0; color: #ffb74d; font-weight: 700; }
.pill.ml-desactivar { background: #d32f2f; }
.pill.ml-activar { background: #2e7d32; }
.pill.ml-wa { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; background: #25d366; }
.pill.ml-wa svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.pill.ml-eliminar { background: #424242; border: 2px solid #ef5350; }
.ml-rol { font-size: .6em; font-weight: 700; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.18); }
.ml-rol.gerente { background: #6a1b9a; }
.ms-rol { flex-direction: row; gap: 24px; margin-bottom: 8px; }
/* The card's opacity dims an inactive mesero, not its Activar button. */
.ml-mesero.inactivo { opacity: 1; }
.ml-mesero.inactivo > :not(.ml-acciones) { opacity: .6; }
/* ---- Gerente: Cortes (one row per paid order: número, tipo, total) ---- */
.corte-fecha[hidden] { display: none; }
.corte-fecha { display: flex; align-items: center; gap: 12px; margin: -8px 28px 16px; font-size: 1.05rem; color: var(--muted); }
.corte-fecha input { flex: 1 1 auto; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, transparent); color: var(--text); font: inherit; color-scheme: light dark; }
.corte-lista { gap: 0; }
.corte-row { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 4px 14px; padding: 12px 4px; border-bottom: 1px solid color-mix(in srgb, var(--text) 15%, transparent); }
.corte-row b { font-size: 1.15rem; }
.corte-row .corte-tipo { color: var(--muted); }
.corte-row .corte-monto { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.corte-row .corte-sub { grid-column: 1 / -1; color: var(--faint); font-size: .9rem; }
.corte-total { display: flex; justify-content: space-between; padding: 14px 4px 0; font-size: 1.25rem; font-weight: 700; }
.mo-acciones { display: flex; justify-content: flex-end; padding: 16px 24px 0; }
.pill.mo-cerrar { flex: none; padding: 12px 22px; background: #616161; color: #fff; font-weight: 700; }

/* ---- gerente: Órdenes de hoy (start page summary → list → detail) ---- */
.resumen-hoy { display: flex; flex-direction: column; gap: 14px; margin-bottom: 32px; }
.rh-cajas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rh-caja {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 104px; padding: 14px 6px; border: 0; border-top: 4px solid var(--line); border-radius: 14px;
  background: var(--fill); color: var(--text); font: inherit; cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
}
.rh-caja:active { box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.rh-caja.st-abierta { border-top-color: #ff6d00; }
.rh-caja.st-cancelada { border-top-color: #ef5350; }
.rh-caja.st-pagada { border-top-color: #43a047; }
.rh-num { font-size: clamp(1.8rem, 9vw, 2.4rem); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rh-lbl { font-size: clamp(.85rem, 3.6vw, 1rem); color: var(--muted); }
.rh-monto { min-height: 1.2em; font-size: clamp(.8rem, 3.4vw, .95rem); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: center; }
.rs-row { width: 100%; border-width: 0 0 1px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.rs-row:active { background: color-mix(in srgb, var(--text) 8%, transparent); }
.rs-acciones { gap: 12px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(48px, calc(env(safe-area-inset-bottom) + 24px));
  transform: translateX(-50%);
  max-width: calc(100vw - 48px);
  padding: 14px 28px;
  border-radius: 999px;
  background: #616161;
  color: #fff;
  font-size: 1.1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* Short screens (phone in landscape): pull the form up so INGRESAR stays
   visible without scrolling. */
@media (max-height: 500px) {
  .login { padding-top: 24px; }
  .home { padding-top: 16px; }
  .top { margin-bottom: 12px; }
  form { gap: 16px; }
  .primary { margin-top: 8px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --text: #eeeeee; --muted: #b0b0b0; --line: #8a8a8a; --fill: #2a2a2a;
    --primary: #9d5cf5; --primary-dark: #8a3ff0; --error: #ef6b6b;
    --faint: #8a8a8a; --strong: #7c3aed; --strong-dark: #6200ea; --surface: #242424;
    --accent: #26d9c9;
  }
  :root:not([data-theme="light"]) .eye { color: #ccc; }
  :root:not([data-theme="light"]) .pill.cancel { color: #ef6b6b; }
  :root:not([data-theme="light"]) .escuchando { background: #388e3c; }
  :root:not([data-theme="light"]) .agente .primary.hablar.activo,
  :root:not([data-theme="light"]) .agente .primary.hablar:disabled { background: #3a3a3a; color: #b0b0b0; }
  :root:not([data-theme="light"]) .orden-actual.listening .primary.hablar,
  :root:not([data-theme="light"]) .orden-actual.compact .primary.hablar:disabled { background: #3a3a3a; color: #b0b0b0; }
  :root:not([data-theme="light"]) .pill.accept { color: #66bb6a; }
  :root:not([data-theme="light"]) .radio input { border-color: #aaa; }
}

/* Corte › IMPRIMIR (gerente.js imprimirCorte): only #corte-print is printed,
   receipt-style and narrow (fits 80 mm thermal paper too). Scoped with :has so
   pages without a .print-area print as before. */
.pill.mo-imprimir { flex: none; padding: 12px 22px; margin-right: 10px; background: #1565c0; color: #fff; font-weight: 700; }
.pill.mo-imprimir:disabled { opacity: .45; }
.print-area { display: none; }
@media print {
  @page { margin: 6mm; }
  body:has(> .print-area) > :not(.print-area) { display: none !important; }
  body:has(> .print-area) { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .print-area { display: block; max-width: 72mm; font: 11pt/1.35 system-ui, sans-serif; color: #000; }
  .pc-cab { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px; padding-bottom: 6px; border-bottom: 1px dashed #000; }
  .pc-cab b { font-size: 13pt; }
  .pc-sub { font-size: 9pt; }
  .pc-resumen { margin: 6px 0; font-variant-numeric: tabular-nums; }
  .pc-linea { display: flex; justify-content: space-between; padding: 1px 0; }
  .pc-pie { border-top: 1px dashed #000; padding-top: 6px; }
  .pc-total { display: flex; justify-content: space-between; font-size: 13pt; font-weight: 700; margin-top: 2px; }
}

/* ---- hybrid page only (inicio_hybrid.html, see HYBRID.md) ---- */
.hy-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--fill); color: var(--muted); font-size: .75rem; letter-spacing: .06em; vertical-align: middle; }
.hy-inicio { margin-bottom: 20px; }
/* .agente sets display:flex, which beats the [hidden] attribute */
.hy-inicio[hidden] { display: none; }
.hy-propuesta { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--fill); }
.hy-propuesta p { margin: 0; overflow-wrap: anywhere; }
.hy-escuche { color: var(--text); font-style: italic; }
.hy-cuantos { margin-top: 4px !important; color: var(--muted); font-weight: 700; }
.item-pendiente.hy-nota h3 { font-weight: 600; }
.hy-nombre { margin: 4px 0 0; color: var(--text); font-size: 1.1rem; font-weight: 600; overflow-wrap: anywhere; }
.hy-aviso { margin: 8px 0 0; padding: 6px 10px; border-radius: 8px; background: #fff3e0; color: #8a4b00; font-size: 1rem; font-weight: 600; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hy-aviso { background: #4a3000; color: #ffcc80; }
}
.hy-con-mic { display: flex; align-items: center; gap: 8px; }
.hy-con-mic input { flex: 1; min-width: 0; }
.hy-mic-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: #fff; cursor: pointer; }
.hy-mic-btn svg { width: 24px; height: 24px; fill: currentColor; }
.hy-mic-btn[aria-pressed="true"] { background: var(--fill); color: var(--muted); }
.hy-mic-btn.escuchando { animation: hy-parpadeo 1s ease-in-out infinite; background: #2e7d32; color: #fff; }
@keyframes hy-parpadeo { 50% { opacity: .45; } }

/* gerente.html #wa-modal: send access data by WhatsApp (2026-10-28) */
.wa-texto { margin: 8px 0 0; color: var(--muted); line-height: 1.4; }
.pill.wa { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  background: #25d366; color: #fff; font-weight: 700; }
.pill.wa svg, .btn.wa svg { width: 22px; height: 22px; fill: currentColor; flex: none; }

/* ORDEN NUEVA / O AGREGAR on two centered lines (2026-11-05) */
#hy-hablar-lbl { text-align: center; line-height: 1.2; }

/* Primer ingreso dialog at the top (2026-11-07), like the login page: a
   centred dialog put Guardar under the phone keyboard. */
/* + Cambiar mi clave (#clave-modal, inicio_hybrid + gerente) and gerente's
   Nuevo/Editar Personal (#mesero-modal) and the mesero's Nota (#nota-modal),
   same day. */
#primer-modal, #clave-modal, #mesero-modal, #nota-modal { margin: max(12px, env(safe-area-inset-top)) auto auto; padding: 20px 22px 22px; max-height: calc(100dvh - 24px); }
#primer-modal h2, #clave-modal h2, #mesero-modal h2, #nota-modal h2 { font-size: clamp(1.3rem, 5.5vw, 1.7rem); }
#primer-modal form, #clave-modal form, #mesero-modal form, #nota-modal form { gap: 12px; }
#primer-modal .modal-actions, #clave-modal .modal-actions, #mesero-modal .modal-actions, #nota-modal .modal-actions { margin-top: 10px; }

/* AGREGAR NOTA = one tap opens the mic (2026-11-08, #nota-modal removed) */
.orden-nota-fila { display: flex; align-items: flex-start; gap: 8px; margin: 0 8px 14px; }
.orden-nota-fila .orden-nota { flex: 1; margin: 0; }
.nota-quitar { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #e5484d; color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; }
.primary.agregar-nota { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.primary.agregar-nota svg { width: 22px; height: 22px; fill: currentColor; }
.primary.agregar-nota.activo { background: #8d8d8d; }
.orden-nota-box .procesando, .orden-nota-box .escuchando { margin-top: 12px; padding: 14px 16px; border-radius: 12px; }

/* Personal Conectado (gerente.html, 2026-11-08) */
.ml-conectado { font-size: .6em; font-weight: 700; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: #2e7d32; color: #fff; margin-left: 6px; }

/* Mis Órdenes / Pagadas Hoy (inicio_hybrid): X at the top right, always
   visible even when the bottom CERRAR ends up below the screen (2026-11-08) */
.mis-ordenes .mo-x { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: #616161; color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,.25); }
.mis-ordenes:has(> .mo-x) h2 { margin-right: 70px; }
.pill.mo-cerrar-fin { align-self: center; flex: none; margin: 8px 0 4px; padding: 14px 36px; }
.mis-ordenes .mo-lista { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
/* One CERRAR only: the fixed bottom CERRAR of the list dialogs is hidden
   (the × at the top and the CERRAR at the end of the list remain); the
   bottom bar itself hides when nothing else is in it (IMPRIMIR / VOLVER
   keep it). ::after = end spacer every engine counts in the scroll height
   (Safari drops a flex scroll box's padding-bottom). (2026-11-08) */
.mis-ordenes .mo-acciones > [id$="-cerrar"] { display: none; }
.mis-ordenes .mo-acciones:not(:has(> button:not([hidden]):not([id$="-cerrar"]))) { display: none; }
.mis-ordenes .mo-lista { padding-bottom: 0; }
.mis-ordenes .mo-lista::after { content: ""; flex: none; height: 184px; }
/* a bit shorter than other modals so its bottom never falls under a phone's toolbar */
.modal.mis-ordenes { max-height: calc(100dvh - 56px); }
.pill.mo-cerrar-fin { margin: 4px 0 0; }
