:root {
  --amarillo: #FFEB00;
  --negro: #0d0d0d;
  --gris: #1c1c1c;
  --gris2: #2a2a2a;
  --texto: #f2f2f2;
  --verde: #2ecc71;
  --rojo: #e74c3c;
  --naranja: #f39c12;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--negro);
  color: var(--texto);
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}
header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--gris);
  border-bottom: 3px solid var(--amarillo);
  position: sticky; top: 0; z-index: 10;
}
header h1 {
  font-size: 17px; text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: 9px; white-space: nowrap;
}
header h1 span { color: var(--amarillo); }
.logo-icon {
  width: 32px; height: 32px; border-radius: 9px; background: var(--amarillo);
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
  box-shadow: 0 2px 0 #b8a900;
}
header nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
header nav a {
  color: var(--texto); text-decoration: none; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px; background: var(--gris2);
  border: 1px solid transparent; transition: transform .08s, background .15s;
}
header nav a:hover { border-color: var(--amarillo); }
header nav a:active { transform: scale(.95); }
header nav a.activo {
  background: var(--amarillo); color: #000;
  box-shadow: 0 2px 0 #b8a900;
}
header nav a.salir { background: rgba(231, 76, 60, .16); color: #ff9a8d; }
header nav a.salir:hover { border-color: var(--rojo); }
header nav a.vista { background: transparent; border: 1px dashed #555; font-weight: 600; }
header nav a.vista:hover { border-color: var(--amarillo); }
.chip-usuario {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gris2); border-radius: 999px; padding: 5px 14px 5px 5px;
  font-size: 13px; font-weight: 700;
}
.avatar {
  width: 27px; height: 27px; border-radius: 50%; background: var(--amarillo); color: #000;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
main { padding: 16px; max-width: 1100px; margin: 0 auto; }

/* ---- salón estilo FUDO ---- */
.salon-barra {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.salon-barra .titulo { font-weight: 800; font-size: 15px; }
.salon {
  position: relative; background: #f4f4f4; border-radius: 12px;
  height: calc(100vh - 160px); min-height: 420px; overflow: hidden;
  touch-action: none;
}
.salon.editando { outline: 3px dashed var(--amarillo); }
.tile {
  position: absolute; width: 68px; height: 68px; border-radius: 10px;
  background: #5ecf86; box-shadow: 0 4px 0 #3da865, 0 6px 10px rgba(0,0,0,.15);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 22px; cursor: pointer; user-select: none;
  transform: translate(-50%, -50%);
}
.tile small { font-size: 10px; font-weight: 600; line-height: 1; margin-top: 2px; }
.tile.ocupada { background: #e8564a; box-shadow: 0 4px 0 #b93d33, 0 6px 10px rgba(0,0,0,.15); }
.tile.lista { animation: pulso 1.2s infinite; }
.salon.editando .tile { cursor: grab; }
.salon.editando .tile:active { cursor: grabbing; }

.grid-mesas {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.mesa {
  background: var(--gris); border: 2px solid var(--gris2); border-radius: 14px;
  padding: 18px 14px; text-align: center; cursor: pointer; user-select: none;
  transition: transform .1s;
}
.mesa:active { transform: scale(.97); }
.mesa .nombre { font-size: 17px; font-weight: 700; }
.mesa .detalle { font-size: 13px; opacity: .7; margin-top: 6px; }
.mesa.ocupada { border-color: var(--amarillo); }
.mesa.ocupada .nombre { color: var(--amarillo); }
.mesa.lista { border-color: var(--verde); animation: pulso 1.2s infinite; }
@keyframes pulso { 50% { box-shadow: 0 0 14px rgba(46,204,113,.5); } }

button {
  background: var(--amarillo); color: #000; border: 0; border-radius: 10px;
  padding: 12px 18px; font-size: 15px; font-weight: 700; cursor: pointer;
}
button.sec { background: var(--gris2); color: var(--texto); }
button.peligro { background: var(--rojo); color: #fff; }
button:disabled { opacity: .4; cursor: default; }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.chip.pendiente { background: var(--naranja); color: #000; }
.chip.listo { background: var(--verde); color: #000; }
.chip.nuevo { background: var(--gris2); color: var(--texto); }
.chip.entregado { background: #555; color: #ccc; }

.item-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--gris); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.item-row .info { flex: 1; }
.item-row .nota { font-size: 12px; color: var(--amarillo); }
.precio { font-variant-numeric: tabular-nums; }

.cat-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 4px; }
.cat-tabs button { white-space: nowrap; background: var(--gris2); color: var(--texto); }
.cat-tabs button.activo { background: var(--amarillo); color: #000; }
.grid-prod {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.prod {
  background: var(--gris); border-radius: 10px; padding: 12px; cursor: pointer;
  border: 2px solid transparent;
}
.prod:active { border-color: var(--amarillo); }
.prod .p-nombre { font-size: 14px; font-weight: 600; }
.prod .p-precio { color: var(--amarillo); margin-top: 4px; font-size: 13px; }

.barra-acciones {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--gris); border-top: 2px solid var(--amarillo);
  padding: 12px 16px; display: flex; gap: 10px; align-items: center;
  justify-content: space-between;
}
.barra-acciones .total { font-size: 20px; font-weight: 800; color: var(--amarillo); }

.grid-cocina {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px;
}
.ticket {
  background: var(--gris); border-radius: 14px; overflow: hidden;
  border: 2px solid var(--gris2);
}
.ticket.todo-listo { border-color: var(--verde); }
.ticket header2 {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--amarillo); color: #000; padding: 8px 12px; font-weight: 800;
}
.ticket .t-items { padding: 10px 12px; }
.ticket .t-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--gris2); gap: 8px;
}
.ticket .t-item:last-child { border-bottom: 0; }
.ticket .t-item.listo { opacity: .5; text-decoration: line-through; }
.tiempo { font-size: 12px; font-weight: 600; }
.tiempo.tarde { color: var(--rojo); }

table { width: 100%; border-collapse: collapse; }
td, th { padding: 10px 8px; border-bottom: 1px solid var(--gris2); text-align: left; font-size: 14px; }
input, select {
  background: var(--gris2); border: 1px solid #444; color: var(--texto);
  border-radius: 8px; padding: 10px; font-size: 15px; width: 100%;
}
.fila-form { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.fila-form > * { flex: 1; min-width: 120px; }
.fila-form button { flex: 0; }
h2 { margin: 22px 0 10px; font-size: 16px; text-transform: uppercase; color: var(--amarillo); }
.vacio { opacity: .5; text-align: center; padding: 40px 0; }

/* ---- celular (pantalla vertical) ---- */
@media (max-width: 640px) {
  header { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  header h1 { font-size: 14px; }
  .logo-icon { width: 27px; height: 27px; font-size: 14px; }
  header nav { gap: 6px; }
  header nav a { font-size: 12px; padding: 7px 12px; }
  .chip-usuario { font-size: 12px; }
  main { padding: 12px; }

  /* mismo mapa FUDO pero girado a vertical y más chico para que entre completo */
  .salon { height: calc(100vh - 170px); min-height: 480px; }
  .tile { width: 54px; height: 54px; font-size: 17px; border-radius: 8px;
    box-shadow: 0 3px 0 #3da865, 0 4px 8px rgba(0,0,0,.15); }
  .tile.ocupada { box-shadow: 0 3px 0 #b93d33, 0 4px 8px rgba(0,0,0,.15); }
  .tile small { font-size: 8px; }
  .salon-barra .titulo { font-size: 14px; }
  #btn-editar { display: none !important; } /* mover mesas: solo en pantalla grande */

  /* tablas con scroll horizontal para que nada se corte */
  table { display: block; overflow-x: auto; white-space: nowrap; }

  .grid-prod { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .barra-acciones { padding: 10px 12px; }
  .barra-acciones .total { font-size: 17px; }
  .barra-acciones button { padding: 10px 12px; font-size: 13px; }
}
