/* ============================================================
   COMANDA — sistema visual
   Concepto: minimalismo tipo Apple — superficies neutras (blanco/
   gris muy claro), tipografía del sistema (usa SF Pro de verdad en
   iPhone/Mac), un solo color de acento para lo interactivo, y
   colores de estado (verde/ámbar/rojo) reservados solo para
   comunicar estado (mesa libre/ocupada, urgencia en cocina) — nunca
   para decorar.
   ============================================================ */

:root {
  /* Superficies y texto (roles semánticos: se invierten en modo oscuro) */
  --paper: #F5F5F7;        /* fondo de página */
  --paper-dim: #ECECEF;    /* fondo secundario / hover */
  --paper-line: #D9D9DE;   /* bordes y separadores */
  --ink: #1D1D1F;          /* texto principal */
  --ink-soft: #6E6E73;     /* texto secundario */
  --ink-faint: #A1A1A6;    /* texto terciario / placeholders */
  --surface: #FFFFFF;      /* tarjetas, modales, inputs */
  --surface-2: #F2F2F5;    /* superficie secundaria (chips, control segmentado) */

  /* Acento único — todo lo interactivo (botones primarios, activos, enlaces) */
  --accent: #0071E3;
  --accent-hover: #0077ED;
  --accent-soft: #E8F1FE;

  /* "Kiosco" oscuro — usado solo en la pantalla de Cocina */
  --charcoal: #000000;
  --charcoal-2: #1C1C1E;
  --charcoal-line: #2C2C2E;

  /* Colores de estado — reservados solo para comunicar estado, nunca decorativos */
  --red: #E0342A;
  --red-bg: #FDE7E5;
  --green: #29A745;
  --green-bg: #E4F6E8;
  --amber: #E28A00;
  --amber-bg: #FDF0DC;
  --blue: var(--accent);
  --blue-bg: var(--accent-soft);

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 6px 16px -10px rgba(0,0,0,0.12);
  --shadow-pop: 0 30px 60px -20px rgba(0,0,0,0.28);

  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Courier New', monospace;
}

/* ---------------- Modo oscuro ----------------
   Mismo set de variables semánticas, valores invertidos. Todo el resto del
   CSS usa var(--paper)/var(--ink)/var(--surface)/etc., así que el tema
   se propaga solo con este bloque — no hay reglas duplicadas por vista. */
:root[data-theme="dark"] {
  --paper: #000000;
  --paper-dim: #1C1C1E;
  --paper-line: #38383A;
  --ink: #F5F5F7;
  --ink-soft: #98989D;
  --ink-faint: #6E6E73;
  --surface: #1C1C1E;
  --surface-2: #2C2C2E;

  --accent: #0A84FF;
  --accent-hover: #3396FF;
  --accent-soft: #0A2540;

  --red-bg: #3A1614;
  --green-bg: #12301A;
  --amber-bg: #3A2A0C;

  --shadow-card: 0 1px 2px rgba(0,0,0,0.5), 0 10px 24px -12px rgba(0,0,0,0.7);
  --shadow-pop: 0 30px 70px -20px rgba(0,0,0,0.85);
}

.theme-toggle {
  font-size: 1.1rem;
  line-height: 1;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -0.02em; font-weight: 650; }
p { margin: 0; }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }

.hidden { display: none !important; }

/* Visible solo para lectores de pantalla — para dar etiqueta/estado a
   controles cuyo diseño visual no tiene espacio para texto explicativo. */
.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;
}

/* ---------------- Layout shells ---------------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--ink);
  border-bottom: 1px solid var(--paper-line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.topbar .meta {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.tabbar {
  display: flex;
  gap: 4px;
  padding: 6px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--paper-line);
  overflow-x: auto;
}
.tabbar a {
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.tabbar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.view {
  flex: 1;
  padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ---------------- Buttons ---------------- */
.btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-m);
  border: none;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-accent { background: var(--amber); color: #fff; }
.btn-good { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--paper-line); color: var(--ink); }
.btn-ghost.on-dark { border-color: var(--charcoal-line); color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.02rem; border-radius: var(--radius-m); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 0.85rem; border-radius: var(--radius-s); }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: var(--surface-2); color: var(--ink); cursor: pointer;
  transition: background 0.15s ease;
}

/* Hover solo con mouse real — en touch, :hover se queda "pegado" tras el
   tap y confunde más de lo que ayuda. */
@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover { background: var(--surface-2); }
  .icon-btn:hover { background: var(--paper-line); }
}

/* Foco visible al navegar con teclado (Tab), invisible con mouse/touch —
   antes ningún botón mostraba dónde estaba el foco. */
.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------- Cards / surfaces ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  padding: 18px;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.eyebrow {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------------- Login / keypad ---------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--paper);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-pop);
  padding: 32px 26px 26px;
  border: 1px solid var(--paper-line);
}
.auth-logo {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 4px;
}
.auth-logo .mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
}
.auth-title { text-align: center; font-size: 1.5rem; margin-top: 10px; }
.auth-sub { text-align: center; color: var(--ink-soft); font-size: 0.88rem; margin-top: 4px; margin-bottom: 24px; }

/* Botón de tema, fijo en la esquina — antes vivía como estilo inline en el HTML. */
.theme-toggle-fixed { position: fixed; top: 18px; right: 18px; z-index: 10; }

.pin-display {
  display: flex; justify-content: center; gap: 12px; margin-bottom: 20px;
}
.pin-display.shake { animation: pin-shake 0.32s ease; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes pin-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(3px); }
  }
}
.pin-dot {
  width: 12px; height: 12px; border-radius: 50%;
  /* --ink-soft (no --ink-faint): un borde vacío necesita al menos 3:1 de
     contraste para leerse como límite de control, no solo como decoración. */
  border: 1.5px solid var(--ink-soft);
  background: transparent;
  transition: background 0.1s ease, border-color 0.1s ease;
}
.pin-dot.filled { background: var(--ink); border-color: var(--ink); }

.user-select {
  width: 100%; min-height: 48px; border-radius: var(--radius-m);
  border: 1px solid var(--paper-line); background: var(--surface-2);
  padding: 0 14px; font-size: 0.95rem; margin-bottom: 14px; font-family: var(--font-body);
  color: var(--ink);
  transition: border-color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .user-select:hover { border-color: var(--ink-faint); }
}
.user-select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Fila de solo lectura con el mismo alto/tipografía que un input real, para
   datos que se muestran pero nunca se editan (ej. cajero, fecha de apertura).
   Un <input disabled> ahí sugiere "podrías editar esto" y además baja mucho
   el contraste del texto — esto evita ambas cosas. */
.field-static {
  width: 100%; min-height: 48px; border-radius: var(--radius-m);
  border: 1px solid var(--paper-line); background: var(--paper-dim);
  padding: 0 14px; font-size: 0.95rem; font-family: var(--font-body);
  color: var(--ink);
  display: flex; align-items: center;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.keypad button {
  aspect-ratio: 1;
  min-height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.1s ease, transform 0.06s ease;
}
.keypad button:active { background: var(--paper-line); transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .keypad button:hover { background: var(--paper-line); }
}
.keypad button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.keypad .wide { font-size: 0.72rem; font-weight: 600; }

.auth-error {
  color: var(--red); font-size: 0.85rem; text-align: center; min-height: 18px; margin-top: 10px;
}

/* ---------------- Mesas grid ---------------- */
.mesas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.mesa-card {
  min-height: 118px;
  border-radius: var(--radius-l);
  border: 1px solid var(--paper-line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-card);
  transition: transform 0.08s ease;
}
.mesa-card:active { transform: scale(0.97); }
.mesa-card .estado-bar {
  position: absolute; top: 16px; right: 16px;
  width: 9px; height: 9px; border-radius: 50%;
}
.mesa-card .nombre { font-family: var(--font-display); font-weight: 650; font-size: 1.05rem; letter-spacing: -0.01em; }
.mesa-card .info { font-family: var(--font-body); font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }
.mesa-card .badge-estado {
  font-family: var(--font-body); font-size: 0.7rem; font-weight: 600;
  margin-top: 8px;
}
.mesa-card.st-libre .estado-bar { background: var(--ink-faint); }
.mesa-card.st-libre .badge-estado { color: var(--ink-soft); }
.mesa-card.st-ocupada .estado-bar { background: var(--green); }
.mesa-card.st-ocupada .badge-estado { color: var(--green); }
.mesa-card.st-cuenta .estado-bar { background: var(--amber); }
.mesa-card.st-cuenta .badge-estado { color: var(--amber); }
.mesa-card.add-mesa {
  border-style: dashed;
  color: var(--ink-soft);
  background: transparent;
  box-shadow: none;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 8px;
}

/* Teléfonos: tarjetas de mesa más grandes y con más aire para el pulgar */
@media (max-width: 480px) {
  .mesas-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .mesa-card { min-height: 128px; padding: 18px; }
  .mesa-card .nombre { font-size: 1.15rem; }
}

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100; padding: 0;
  backdrop-filter: blur(2px);
}
.modal-sheet {
  width: 100%; max-width: 480px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-pop);
  max-height: 92vh;
  overflow-y: auto;
  animation: sheet-up 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-sheet::before {
  content: '';
  display: block;
  width: 36px; height: 5px;
  border-radius: 3px;
  background: var(--paper-line);
  margin: 6px auto 14px;
}
@keyframes sheet-up { from { transform: translateY(28px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media (min-width: 620px) {
  .modal-backdrop { align-items: center; }
  .modal-sheet { border-radius: var(--radius-l); }
  .modal-sheet::before { display: none; }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.modal-head h3 { font-size: 1.2rem; letter-spacing: -0.01em; }

.stepper {
  display: flex; align-items: center; justify-content: center; gap: 24px; margin: 18px 0;
}
.stepper .num { font-family: var(--font-display); font-weight: 650; font-size: 2.4rem; min-width: 70px; text-align: center; }
.stepper button {
  width: 50px; height: 50px; border-radius: 50%;
  border: none; background: var(--surface-2); color: var(--ink); font-size: 1.4rem; cursor: pointer;
}

.field { margin-bottom: 14px; }
.field label {
  display: block; font-family: var(--font-body); font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; border-radius: var(--radius-m);
  border: 1px solid var(--paper-line); background: var(--surface-2); padding: 0 14px;
  font-family: var(--font-body); font-size: 0.95rem; color: var(--ink);
  transition: border-color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .field input:hover, .field select:hover { border-color: var(--ink-faint); }
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.field textarea { min-height: 70px; padding: 10px 14px; resize: vertical; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* ---------------- Tabs de persona (control segmentado, estilo iOS) ---------------- */
.persona-tabs {
  display: flex; gap: 2px; overflow-x: auto; margin-bottom: 14px;
  background: var(--surface-2); border-radius: 10px; padding: 3px;
}
.persona-tab {
  font-family: var(--font-body); font-size: 0.82rem; font-weight: 500; white-space: nowrap;
  padding: 9px 14px; border-radius: 8px; border: none;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  flex: 1 0 auto;
  transition: background 0.15s ease, color 0.15s ease;
}
.persona-tab.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

.linea-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--paper-line);
}
.linea-item:last-child { border-bottom: none; }
.linea-item .li-main { flex: 1; }
.linea-item .li-nombre { font-weight: 600; font-size: 0.94rem; }
.linea-item .li-notas { font-size: 0.8rem; color: var(--ink-soft); font-style: italic; margin-top: 2px; }
.linea-item .li-cant { font-family: var(--font-body); color: var(--ink-soft); font-size: 0.85rem; }
.linea-item .li-price { font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
.status-chip {
  font-family: var(--font-body); font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 3px 9px; border-radius: 999px; display: inline-block; margin-top: 4px;
}
.status-chip.pendiente { background: var(--surface-2); color: var(--ink-soft); }
.status-chip.enviado { background: var(--blue-bg); color: var(--blue); }
.status-chip.preparando { background: var(--amber-bg); color: var(--amber); }
.status-chip.listo { background: var(--green-bg); color: var(--green); }

.menu-cat { margin-bottom: 18px; }
.menu-cat h4 { font-family: var(--font-body); font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 8px; }
.menu-item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px; border: 1px solid var(--paper-line); border-radius: var(--radius-m);
  background: var(--surface); margin-bottom: 8px; cursor: pointer;
  transition: background 0.1s ease;
}
.menu-item-row:active { background: var(--surface-2); }
.menu-item-row .mi-name { font-weight: 600; font-size: 0.94rem; }
.menu-item-row .mi-price { font-family: var(--font-display); color: var(--ink-soft); font-size: 0.85rem; }
.menu-item-row.agotado { opacity: 0.4; pointer-events: none; }

.total-bar {
  position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--paper-line);
  padding: 14px 0 4px; margin-top: 10px;
}
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.total-row .label { font-family: var(--font-body); color: var(--ink-soft); font-size: 0.85rem; }
.total-row .amount { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }

.chipbar { display: flex; gap: 8px; flex-wrap: wrap; }
.chipbar button {
  padding: 8px 15px; border-radius: 999px; border: none;
  background: var(--surface-2); color: var(--ink); font-size: 0.84rem; font-weight: 500; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.chipbar button.on { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------------- Cocina (KDS) ---------------- */
.kds-shell { background: var(--charcoal); min-height: 100vh; color: #F5F5F7; }
.kds-topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 18px;
  padding-top: calc(16px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--charcoal-line);
  position: sticky; top: 0; background: var(--charcoal); z-index: 20;
}
.kds-topbar .brand { font-family: var(--font-display); font-weight: 650; font-size: 1.15rem; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.kds-topbar .brand .dot { background: var(--accent-hover, #0A84FF); }
.kds-toggle { display: flex; gap: 6px; }
.kds-toggle button {
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 500; padding: 8px 14px; border-radius: 999px;
  border: none; background: var(--charcoal-2); color: #98989D; cursor: pointer;
}
.kds-toggle button.active { background: #F5F5F7; color: #000; font-weight: 600; }

.kds-subbar {
  display: flex; gap: 6px; padding: 10px 18px; overflow-x: auto;
  background: var(--charcoal-2); border-bottom: 1px solid var(--charcoal-line);
}
.kds-subbar button {
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 500; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--charcoal-line); background: transparent; color: #98989D; cursor: pointer; white-space: nowrap;
}
.kds-subbar button.active { background: var(--accent-hover, #0A84FF); color: #fff; border-color: transparent; font-weight: 600; }

.kds-board {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.ticket {
  background: var(--charcoal-2);
  color: #F5F5F7;
  border-radius: var(--radius-m);
  position: relative;
  padding: 16px 16px 22px;
  font-family: var(--font-mono);
  box-shadow: 0 12px 26px -14px rgba(0,0,0,0.7);
  border: 1px solid var(--charcoal-line);
  transition: background 0.25s ease, border-color 0.25s ease;
}

/* Estado por color: la tarjeta ENTERA se pinta, no solo el temporizador,
   para que se lea la urgencia de un vistazo desde cualquier punto de la cocina. */
.ticket.t-verde {
  background: var(--green);
  border-color: transparent;
  color: #fff;
}
.ticket.t-amarillo {
  background: var(--amber);
  border-color: transparent;
  color: #2A1D00;
}
.ticket.t-rojo {
  background: var(--red);
  border-color: transparent;
  color: #fff;
  animation: pulse-urgent 1.4s ease-in-out infinite;
}
@keyframes pulse-urgent {
  0%, 100% { box-shadow: 0 12px 26px -14px rgba(0,0,0,0.6); transform: scale(1); }
  50% { box-shadow: 0 14px 34px -8px rgba(224,52,42,0.6); transform: scale(1.015); }
}
.ticket-head {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px;
}
.ticket-mesa { font-family: var(--font-display); font-weight: 650; font-size: 1.3rem; letter-spacing: -0.01em; }
.ticket-hora { font-size: 0.72rem; color: #98989D; }
.ticket.t-verde .ticket-hora,
.ticket.t-rojo .ticket-hora { color: rgba(255,255,255,0.78); }
.ticket.t-amarillo .ticket-hora { color: rgba(42,29,0,0.68); }

.ticket-timer {
  font-size: 1.1rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.08);
}
.ticket.t-verde .ticket-timer,
.ticket.t-rojo .ticket-timer { background: rgba(255,255,255,0.22); color: #fff; }
.ticket.t-amarillo .ticket-timer { background: rgba(42,29,0,0.14); color: #2A1D00; }

.ticket-persona { margin-top: 10px; padding-top: 8px; border-top: 1px dashed rgba(255,255,255,0.15); }
.ticket-persona .p-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: #98989D; margin-bottom: 4px; }
.ticket.t-verde .ticket-persona,
.ticket.t-rojo .ticket-persona { border-top-color: rgba(255,255,255,0.3); }
.ticket.t-verde .p-label,
.ticket.t-rojo .p-label { color: rgba(255,255,255,0.75); }
.ticket.t-amarillo .ticket-persona { border-top-color: rgba(42,29,0,0.2); }
.ticket.t-amarillo .p-label { color: rgba(42,29,0,0.65); }

.ticket-line { font-size: 0.88rem; display: flex; gap: 8px; padding: 2px 0; }
.ticket-line .qty { font-weight: 700; }
.ticket-line .notas { display: block; font-size: 0.78rem; color: #FF8A80; font-style: italic; }
.ticket-line .por { display: block; font-size: 0.68rem; color: #98989D; margin-top: 1px; }
.ticket.t-verde .ticket-line .por,
.ticket.t-rojo .ticket-line .por { color: rgba(255,255,255,0.7); }
.ticket.t-amarillo .ticket-line .por { color: rgba(42,29,0,0.6); }
.ticket.t-verde .ticket-line .notas,
.ticket.t-rojo .ticket-line .notas { color: #FFE9CC; }
.ticket.t-amarillo .ticket-line .notas { color: #5C3D00; }

.ticket-actions { display: flex; gap: 8px; margin-top: 14px; }
.ticket-actions button {
  flex: 1; min-height: 44px; border-radius: var(--radius-s); border: 1px solid rgba(255,255,255,0.25);
  background: transparent; font-family: var(--font-body); font-weight: 600; font-size: 0.82rem; cursor: pointer;
  color: inherit;
}
.ticket-actions .go { background: rgba(255,255,255,0.16); border-color: transparent; }
.ticket.t-verde .ticket-actions .go,
.ticket.t-rojo .ticket-actions .go { background: rgba(0,0,0,0.28); color: #fff; border-color: transparent; }
.ticket.t-amarillo .ticket-actions .go { background: #2A1D00; color: var(--amber); border-color: transparent; }

.kds-empty {
  grid-column: 1/-1; text-align: center; padding: 60px 20px; color: #6E6E73;
  font-family: var(--font-body);
}

.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 999px;
  font-size: 0.88rem; z-index: 200; box-shadow: var(--shadow-pop);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty-state {
  text-align: center; padding: 50px 20px; color: var(--ink-soft);
}
.empty-state .glyph { font-size: 2.2rem; margin-bottom: 8px; }

/* ---------------- Admin menú ---------------- */
.admin-grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .admin-grid { grid-template-columns: 1fr 1fr; } }

/* En teléfono, el texto de estado de caja no cabe junto a los botones —
   se prioriza la marca y las acciones; el detalle vive en la vista misma. */
@media (max-width: 560px) {
  .topbar .meta { display: none; }
}

/* ---------------- Utilidades ---------------- */
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.82rem; }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }

/* ---------------- Ticket de venta (impresión térmica 80mm) ---------------- */
#ticketImprimible { display: none; }
@media print {
  body > *:not(#ticketImprimible) { display: none !important; }
  #ticketImprimible {
    display: block;
    width: 80mm;
    margin: 0;
    padding: 4mm;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.4;
    color: #000;
    background: #fff;
  }
  #ticketImprimible .t-center { text-align: center; }
  #ticketImprimible .t-bold { font-weight: 700; }
  #ticketImprimible .t-der { text-align: right; }
  #ticketImprimible hr { border: none; border-top: 1px dashed #000; margin: 4px 0; }
  #ticketImprimible .t-tabla { width: 100%; border-collapse: collapse; }
  #ticketImprimible .t-tabla td { padding: 1px 0; }
  @page { margin: 0; size: 80mm auto; }
}
