/*
  Plantilla de las pantallas del local y del administrador: cabecera con el nombre,
  menú y "Salir", título de pantalla, y las pantallas hechas con Twig.
*/

.pagina {
  max-width: var(--ancho-pagina);
  margin: 0 auto;
  padding: 0 var(--margen) var(--s-8);
}

/* ---------- Cabecera (C · Cabecera local) ---------- */

.cabecera {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-4);
  min-height: 60px;
  padding-top: var(--s-4);
}
.cabecera-nombre { font-size: var(--text-24); font-weight: 700; letter-spacing: -0.01em; }
.cabecera-nombre small { margin-left: var(--s-2); font-size: var(--text-16); font-weight: 500; color: var(--color-text2); }
.menu { display: flex; gap: var(--s-2); }
.menu a {
  display: inline-flex;
  align-items: center;
  min-height: var(--alto-boton-s);
  padding: 0 var(--s-5);
  border-radius: var(--radio-s);
  font-size: var(--text-18);
  font-weight: 500;
  color: var(--color-text2);
  text-decoration: none;
}
.menu a:hover { color: var(--color-text); background: var(--color-free); }
.menu a[aria-current="page"] { background: var(--color-text); color: var(--color-surface); font-weight: 600; }
.cabecera-salir { justify-self: end; font-size: var(--text-18); }
.menu-movil { display: none; }

@media (max-width: 900px) {
  .cabecera { grid-template-columns: 1fr auto; min-height: 72px; }
  .cabecera > .menu, .cabecera > .cabecera-salir { display: none; }
  .menu-movil { display: block; position: relative; justify-self: end; }
  .menu-movil summary {
    display: grid;
    place-items: center;
    width: var(--alto-boton-s);
    height: var(--alto-boton-s);
    border-radius: var(--radio-s);
    list-style: none;
    cursor: pointer;
  }
  .menu-movil summary::-webkit-details-marker { display: none; }
  .menu-movil summary svg { width: 26px; height: 26px; }
  .menu-movil[open] summary { background: var(--color-free); }
  .menu-movil-lista {
    position: absolute;
    right: 0;
    top: calc(100% + var(--s-2));
    z-index: 20;
    display: grid;
    gap: var(--s-1);
    min-width: 240px;
    padding: var(--s-2);
    border: 1px solid var(--color-line);
    border-radius: var(--radio-l);
    background: var(--color-surface);
    box-shadow: var(--sombra-dialogo);
  }
  .menu-movil-lista a {
    display: flex;
    align-items: center;
    min-height: var(--alto-boton-m);
    padding: 0 var(--s-4);
    border-radius: var(--radio-s);
    font-size: var(--text-18);
    font-weight: 500;
    text-decoration: none;
  }
  .menu-movil-lista a[aria-current="page"] { background: var(--color-text); color: var(--color-surface); }
}

/* ---------- Título de pantalla ---------- */

.titulo-pantalla {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin: var(--s-2) 0 var(--s-6);
}
.titulo-pantalla h1 { font-size: var(--text-40); font-weight: 700; letter-spacing: -0.02em; }
.titulo-pantalla .subtitulo { margin-top: var(--s-1); font-size: var(--text-18); color: var(--color-text2); }
.titulo-pantalla .acciones { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.titulo-pantalla .acciones .boton { min-height: var(--alto-boton); padding: 0 var(--s-6); }

@media (max-width: 640px) {
  .titulo-pantalla { margin: 0 0 var(--s-4); }
  .titulo-pantalla .acciones { width: 100%; }
  .titulo-pantalla .acciones > .boton { flex: 1; padding: 0 var(--s-3); }
  .titulo-pantalla h1 { font-size: var(--text-32); }
  .titulo-pantalla .subtitulo { font-size: var(--text-16); }
  .titulo-pantalla .acciones .boton { min-height: var(--alto-boton-m); font-size: var(--text-18); }
}

/* Volver (migas de una sola miga) */
.volver {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  font-size: var(--text-16);
  font-weight: 500;
  color: var(--color-text2);
  text-decoration: none;
}
.volver:hover { color: var(--color-text); }

/* Columna de formulario de las páginas de gestión */
.hoja { max-width: 640px; }
.hoja .panel { padding: var(--s-6); }
.hoja h2 { font-size: var(--text-20); font-weight: 700; margin-bottom: var(--s-4); }
.hoja section + section { margin-top: var(--s-6); }

/* ---------- Entrar ---------- */

.pagina-entrar {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--margen);
}
.entrar {
  width: min(440px, 100%);
  padding: var(--s-8);
  border: 1px solid var(--color-line);
  border-radius: var(--radio-xl);
  background: var(--color-surface);
}
.entrar-marca { font-size: var(--text-18); font-weight: 700; color: var(--color-primary); }
.entrar h1 { margin-top: var(--s-4); font-size: var(--text-32); font-weight: 700; }
.entrar .subtitulo { margin: var(--s-2) 0 var(--s-6); font-size: var(--text-18); color: var(--color-text2); }
.entrar .boton { margin-top: var(--s-2); }

/* ---------- Configurar mesas (E · Fila de mesa con QR) ---------- */

.fila-mesa { gap: var(--s-5); padding: var(--s-3) var(--s-4); }
.fila-mesa img { width: 88px; height: 88px; border-radius: 6px; background: var(--color-surface); }
.fila-mesa .fila-titulo { font-size: var(--text-24); font-weight: 700; }
.fila-mesa .acciones { display: flex; gap: var(--s-2); align-items: center; }

/* ---------- Cuentas ---------- */

.dia-navegacion { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.dia-navegacion form { display: flex; gap: var(--s-2); }
.dia-navegacion .entrada { width: auto; min-height: var(--alto-boton-m); font-size: var(--text-16); }

.caja {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}
.caja-dato { padding: var(--s-4) var(--s-5); border-radius: var(--radio-l); background: var(--color-surface); }
.caja-dato dt { font-size: var(--text-16); font-weight: 500; color: var(--color-text2); }
.caja-dato dd { margin-top: var(--s-1); font-size: var(--text-28); font-weight: 700; letter-spacing: -0.01em; }
.caja-dato.caja-total { background: var(--color-text); color: var(--color-surface); }
.caja-dato.caja-total dt { color: var(--color-disabled); }
.caja-dato.caja-total dd { font-size: var(--text-36); }

.fila-cuenta .fila-titulo { font-size: var(--text-20); font-weight: 700; }
.fila-cuenta .fila-cifra { font-size: var(--text-20); font-weight: 700; min-width: 110px; }

.detalle-lineas { display: grid; gap: var(--s-1); }
.detalle-linea { display: flex; gap: var(--s-3); font-size: var(--text-18); line-height: 1.6; }
.detalle-linea span:first-child { flex: 1; }
.detalle-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 2px solid var(--color-line);
  font-size: var(--text-28);
  font-weight: 700;
}

@media (max-width: 760px) {
  .caja { grid-template-columns: 1fr 1fr; }
  .caja-dato.caja-total { grid-column: 1 / -1; }
  .fila-cuenta { flex-wrap: wrap; }
}

/* ---------- Administrador ---------- */

.fila-local .fila-titulo { font-size: var(--text-20); font-weight: 700; }
.fila-local .etiqueta { margin-left: var(--s-2); }
.usuarios { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.usuarios .panel { padding: var(--s-5); }
.usuarios h3 { font-size: var(--text-20); font-weight: 700; }
.usuarios .texto-suave { margin: var(--s-1) 0 var(--s-4); }
@media (max-width: 760px) { .usuarios { grid-template-columns: 1fr; } }

/* ---------- Imprimir los QR ---------- */

.hoja-qr {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-4);
}
.tarjeta-qr {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-5);
  border: 2px dashed var(--color-line);
  border-radius: var(--radio-l);
  background: var(--color-surface);
  break-inside: avoid;
  text-align: center;
}
.tarjeta-qr img { width: 180px; height: auto; }
.tarjeta-qr .local { font-size: var(--text-14); font-weight: 600; color: var(--color-text2); }
.tarjeta-qr .frase { font-size: var(--text-16); font-weight: 600; }

@media print {
  body { background: var(--color-surface); }
  .sin-imprimir { display: none !important; }
  .pagina { padding: 0; max-width: none; }
  .hoja-qr { grid-template-columns: repeat(3, 1fr); gap: 0; }
  .tarjeta-qr { border-radius: 0; }
}

/*
  Carta del local (vistas "Carta del local" y "Carta del local · móvil" de VSD):
  carril de categorías, filas de producto y formulario en panel lateral.
*/

.carta-titulo { align-items: flex-start; }

.carta-local {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: var(--s-6);
  align-items: start;
}
.con-panel .carta-local { grid-template-columns: 232px minmax(0, 1fr) var(--ancho-panel); }

/* ---------- Carril de categorías ---------- */

.carril { display: grid; gap: var(--s-1); position: sticky; top: var(--s-4); }
.carril-categoria {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: var(--alto-boton-m);
  padding: 0 var(--s-3);
  border-radius: var(--radio-s);
  font-size: var(--text-18);
  font-weight: 500;
  color: var(--color-text2);
  text-decoration: none;
}
.carril-categoria:hover { background: var(--color-free); color: var(--color-text); }
.carril-categoria[aria-current="true"] { background: var(--color-text); color: var(--color-surface); font-weight: 600; }
.carril-numero { font-size: var(--text-16); font-weight: 500; }

/* ---------- Productos ---------- */

.productos-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  min-height: var(--alto-boton-m);
  margin-bottom: var(--s-3);
}
.productos-cabecera h2 { font-size: var(--text-24); font-weight: 700; }
.productos-acciones { display: flex; gap: var(--s-3); }

/* E · Fila de producto */
.producto { gap: var(--s-4); padding: var(--s-3); min-height: 80px; }
.producto.seleccionada { padding: 9px; }
.producto-foto {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: var(--radio-s);
  object-fit: cover;
  background: var(--color-free);
}
.producto-sin-foto { display: grid; place-items: center; color: var(--color-text2); }
.producto-sin-foto svg { width: 24px; height: 24px; opacity: 0.7; }
.producto .fila-titulo { font-size: var(--text-18); font-weight: 600; }
.producto .fila-detalle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.producto-precio { min-width: 72px; }
.producto-editar { background: var(--color-surface); }
.producto-agotado .fila-principal, .producto-agotado .producto-precio, .producto-agotado .producto-foto { opacity: 0.55; }

.productos-vacio { max-width: none; }

/* ---------- Panel del formulario ---------- */

.panel-formulario { position: sticky; top: var(--s-4); display: grid; gap: var(--s-4); }
.panel-formulario-cabecera { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.panel-formulario-cabecera h2 { font-size: var(--text-28); font-weight: 700; }
.panel-formulario .formulario { gap: var(--s-4); }
.panel-formulario-acciones .boton-principal { flex: 1.7; }
.panel-borrar { display: flex; justify-content: center; }
.panel-borrar .boton { min-height: var(--alto-boton-s); font-size: var(--text-16); }
.panel-borrar svg { width: 18px; height: 18px; }
.panel-volver { display: none; }
.foto-quitar { font-size: var(--text-16); color: var(--color-text2); }
.foto-quitar input { width: 18px; height: 18px; }

/* ---------- Tableta y móvil ---------- */

@media (max-width: 1180px) {
  .con-panel .carta-local { grid-template-columns: minmax(0, 1fr) var(--ancho-panel); }
  .con-panel .carril { display: none; }
}

@media (max-width: 900px) {
  .carta-local, .con-panel .carta-local { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }

  /* Categorías en pestañas que se deslizan */
  .carril, .con-panel .carril {
    position: static;
    display: flex;
    gap: var(--s-1);
    overflow-x: auto;
    margin: 0 calc(-1 * var(--margen));
    padding: 0 var(--margen) var(--s-1);
    scrollbar-width: none;
  }
  .carril::-webkit-scrollbar { display: none; }
  .carril-categoria { flex: none; padding: 0 var(--s-4); gap: var(--s-1); }
  .carril-categoria .carril-numero { display: none; }
  .carril-categoria[aria-current="true"] .carril-numero { display: inline; }
  .carril-categoria[aria-current="true"] .carril-numero::before { content: '· '; }

  /* Con el formulario abierto, solo se ve el formulario */
  .con-panel .carril, .con-panel .productos, .con-panel .carta-titulo { display: none; }
  .panel-formulario { position: static; padding: var(--s-4); }
  .panel-volver { display: flex; min-height: var(--alto-boton-m); }

  /* Fila compacta: foto, nombre y precio, interruptor */
  .productos-cabecera h2 { font-size: var(--text-20); }
  .producto { flex-wrap: wrap; gap: var(--s-3); padding: var(--s-2); }
  .producto .fila-detalle { display: none; }
  .producto-precio { order: 3; }
}

@media (max-width: 640px) {
  .producto { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: var(--s-3); row-gap: 0; }
  .producto > .producto-foto { grid-row: 1 / 3; }
  .producto > .fila-principal { grid-column: 2; grid-row: 1; align-self: end; }
  .producto > .producto-precio { grid-column: 2; grid-row: 2; text-align: left; font-size: var(--text-16); align-self: start; }
  .producto > form:first-of-type { grid-column: 3; grid-row: 1 / 3; }
  .producto > .producto-editar, .producto > form:last-of-type { display: none; }
  .producto .fila-titulo { font-size: var(--text-18); font-weight: 700; }
  .producto .interruptor { flex-direction: column; gap: 2px; font-size: var(--text-14); }
  .productos-acciones { width: 100%; }
  .productos-acciones .boton, .productos-acciones form { flex: 1; }
  .productos-acciones form .boton { width: 100%; }
  /* En móvil, se edita tocando la fila: el nombre lleva al formulario */
  .producto .fila-principal { cursor: pointer; }
}

.producto-enlace { text-decoration: none; }
.producto-enlace:hover { text-decoration: underline; }

/*
  Capa de profundidad de las pantallas del panel (barra, cuentas, carta del local, configurar
  mesas y entrar). Va aparte de profundidad.css porque tiene que cargarse después de panel.css
  y carta-local.css: profundidad.css lo comparte la carta del cliente y el compilador lo carga antes.
*/

/* ---------- Barra superior ---------- */

.barra {
  position: sticky;
  top: 0;
  z-index: 25;
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid color-mix(in srgb, var(--color-line) 60%, transparent);
  box-shadow: var(--sombra-1);
}
.barra .cabecera {
  max-width: var(--ancho-pagina);
  margin: 0 auto;
  min-height: 72px;
  padding: 0 var(--margen);
}
.cabecera-nombre { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.cabecera-marca { flex: none; width: 40px; height: 40px; color: var(--color-primary); filter: drop-shadow(0 2px 4px rgb(60 40 20 / 0.2)); }
.cabecera-local {
  font-family: var(--font-titulo);
  font-size: var(--text-20);
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cabecera-rol { font-size: var(--text-13); font-weight: 500; color: var(--color-text2); }
.menu a { gap: var(--s-2); font-size: var(--text-16); padding: 0 var(--s-4); transition: background-color var(--rapido), color var(--rapido); }
.menu a .icono { width: 20px; height: 20px; opacity: 0.8; }
.menu a[aria-current="page"] { box-shadow: var(--sombra-1), var(--brillo); }
.menu a[aria-current="page"] .icono { opacity: 1; }
.cabecera-salir { gap: var(--s-2); font-size: var(--text-16); }
.cabecera-salir .icono { width: 20px; height: 20px; }
.menu-movil-lista a { gap: var(--s-3); }
.menu-movil-lista .icono { width: 20px; height: 20px; }
.pagina { padding-top: var(--s-6); }

/* ---------- Cuentas ---------- */

.caja-dato { box-shadow: var(--sombra-1); border: 1px solid color-mix(in srgb, var(--color-line) 45%, transparent); }
.caja-dato dt { display: flex; align-items: center; gap: var(--s-2); }
.caja-dato dt .icono { width: 18px; height: 18px; color: var(--color-accent); }
.caja-dato.caja-total {
  background:
    radial-gradient(420px 220px at 100% 0%, color-mix(in srgb, var(--color-accent) 70%, transparent), transparent),
    radial-gradient(300px 200px at 0% 120%, color-mix(in srgb, var(--color-primary) 45%, transparent), transparent),
    linear-gradient(160deg, var(--color-text-hover), var(--color-text));
  border: 0;
  box-shadow: var(--sombra-3);
}
.caja-dato.caja-total dt { color: var(--color-accent-soft); }
.caja-dato.caja-total dt .icono { color: var(--color-accent-soft); }
.etiqueta { gap: var(--s-1); }
.etiqueta .icono { width: 16px; height: 16px; }
.dia-navegacion .boton .icono { width: 18px; height: 18px; }

/* ---------- Carta del local ---------- */

.carril-categoria { transition: background-color var(--rapido), color var(--rapido); }
.carril-categoria[aria-current="true"] { box-shadow: var(--sombra-2), var(--brillo); }
.producto-foto { box-shadow: inset 0 0 0 1px rgb(60 40 20 / 0.08); }
.panel-formulario { animation: entra-derecha var(--normal) var(--salida); }
@keyframes entra-derecha { from { opacity: 0; transform: translateX(16px); } }
.foto-previa { box-shadow: var(--sombra-1); }

/* ---------- Configurar mesas ---------- */

.fila-mesa img { box-shadow: var(--sombra-1); border: 1px solid color-mix(in srgb, var(--color-line) 45%, transparent); padding: 2px; background: white; }

/* ---------- Entrar ---------- */

.pagina-entrar {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  padding: 0;
}
.entrar-portada {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--s-4);
  min-height: 100vh;
  padding: var(--s-12);
  overflow: hidden;
  color: var(--color-surface);
  background:
    radial-gradient(600px 400px at 85% 10%, color-mix(in srgb, var(--color-accent) 45%, transparent), transparent),
    radial-gradient(700px 500px at 0% 100%, color-mix(in srgb, var(--color-primary) 70%, transparent), transparent),
    linear-gradient(160deg, var(--color-text-hover), var(--color-text));
}
.entrar-portada .marca { width: 56px; height: 56px; color: var(--color-primary); position: absolute; top: var(--s-12); left: var(--s-12); }
.entrar-portada h2 { font-family: var(--font-titulo); font-size: 3.5rem; font-weight: 700; line-height: 1.05; max-width: 12ch; }
.entrar-portada p { font-size: var(--text-18); color: var(--color-disabled); max-width: 40ch; }
.entrar-columna { display: grid; place-items: center; padding: var(--margen); }
.entrar { box-shadow: var(--sombra-3); border-color: color-mix(in srgb, var(--color-line) 55%, transparent); }
@media (max-width: 900px) {
  .pagina-entrar { grid-template-columns: 1fr; }
  .entrar-portada { display: none; }
}
.entrar-portada { width: 100%; justify-self: stretch; }

