/* JENAT · estilos base (mobile first) */
:root {
  --marino: #0F2557;
  --azul: #1E6FD9;
  --azul-claro: #EAF2FD;
  --fondo: #F4F6FA;
  --blanco: #FFFFFF;
  --texto-2: #4A5568;
  --borde: #C9D3E3;
  --linea: #EEF1F6;
  --naranja: #8A3708;
  --naranja-fondo: #FDF0E7;
  --naranja-borde: #E9A36F;
  --verde: #1E5F3F;
  --verde-fondo: #E3F3EA;
  --azul-osc: #174F9E;
  --sombra: 0 1px 3px rgba(15, 37, 87, 0.08);
  --radio: 14px;
}
* { box-sizing: border-box; }
/* Lo oculto con el atributo hidden se oculta siempre, aunque su clase le dé display: grid/flex. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--fondo); color: var(--marino);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.4;
}
a { color: var(--azul); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
p { margin: 0; }

/* Encabezado */
.barra {
  background: var(--marino); color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.barra .marca { display: flex; flex-direction: column; }
.barra .logo { font-weight: 700; font-size: 18px; letter-spacing: .08em; color: #fff; text-decoration: none; }
.barra .sub { font-size: 13px; color: #C9D6EE; }
.barra select {
  background: transparent; color: #fff; border: 1px solid #4D6699; border-radius: 8px;
  font: inherit; font-size: 13px; padding: 4px 6px;
}
.barra select option { color: var(--marino); }
.menu { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.menu a, .menu button {
  color: #fff; text-decoration: none; font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 10px; border-radius: 8px; border: 0; background: transparent; cursor: pointer;
}
.menu a.activo { background: rgba(255, 255, 255, .14); }

/* Encabezado: logo del negocio, contexto, menú y engrane */
.barra { position: sticky; top: 0; z-index: 10; }
.barra .marca { gap: 2px; align-items: center; text-align: center; }
.logo-negocio { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; }
.logo-negocio img {
  display: block; max-height: 60px; max-width: 220px; object-fit: contain;
  background: #fff; border-radius: 10px; padding: 1px;
}
.logo-negocio img + .nombre-negocio { font-size: 13px; }
.nombre-negocio { color: #fff; font-weight: 700; font-size: 17px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.powered { font-size: 11px; color: #9FB3D9; letter-spacing: .02em; white-space: nowrap; }
.powered strong { color: #C9D6EE; letter-spacing: .08em; }
a.powered { text-decoration: none; }
a.powered:hover, a.powered:focus-visible { text-decoration: underline; color: #fff; }
.barra .menu { margin-left: auto; }
.engrane-caja { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.usuario-actual { font-size: 12px; color: #C9D6EE; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.engrane { position: relative; }
.engrane summary {
  list-style: none; cursor: pointer; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .1); border: 1.5px solid #4D6699; color: #fff;
}
.engrane summary::-webkit-details-marker { display: none; }
.engrane[open] summary, .engrane summary:hover { background: #fff; color: var(--marino); }
.engrane[open] summary svg { transform: rotate(45deg); transition: transform .2s; }
.menu-engrane {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; z-index: 20;
  background: var(--blanco); border-radius: 12px; box-shadow: 0 8px 24px rgba(15, 37, 87, .22);
  padding: 6px; display: flex; flex-direction: column;
}
.menu-engrane a, .menu-engrane button {
  display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: 8px; border: 0;
  background: none; color: var(--marino); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.menu-engrane a:hover, .menu-engrane button:hover { background: var(--azul-claro); }
.menu-engrane > form:last-child { border-top: 1px solid var(--linea); margin-top: 4px; padding-top: 4px; }
.menu-engrane > form:last-child button { color: var(--naranja); }
.menu-titulo { display: block; padding: 8px 14px 4px; font-size: 12px; font-weight: 700; color: var(--texto-2); text-transform: uppercase; letter-spacing: .05em; }
.menu-sucursales { border-bottom: 1px solid var(--linea); margin-bottom: 4px; padding-bottom: 4px; }
.menu-sucursales button.actual, .menu-engrane a.actual { background: var(--azul-claro); }
.menu-seccion { border-bottom: 1px solid var(--linea); margin-bottom: 4px; padding-bottom: 4px; }
.logo-vista { min-height: 64px; display: flex; align-items: center; justify-content: center; background: var(--fondo); border-radius: 10px; padding: 12px; }
.logo-vista img { max-height: 90px; max-width: 100%; object-fit: contain; }

/* Contenido */
.contenido { max-width: 560px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ancho { max-width: 880px; }
.tarjeta { background: var(--blanco); border-radius: var(--radio); padding: 16px 18px; box-shadow: var(--sombra); }
.pila { display: flex; flex-direction: column; gap: 10px; }
.fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.fila-total { border-top: 1px solid #E3E8F0; padding-top: 10px; font-weight: 700; font-size: 17px; }
.gris { color: var(--texto-2); }
.chico { font-size: 13px; }
.grande { font-size: 34px; font-weight: 700; }
.etiqueta { font-size: 13px; font-weight: 600; color: var(--texto-2); }
.rejilla-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rejilla-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rejilla-mesas { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.rejilla-mesas .btn { padding: 10px 6px; }
.cambiar-mesa summary { cursor: pointer; font-weight: 600; color: var(--azul); }
.mesa-ocupada { flex-direction: column; gap: 0; background: var(--marino); border-color: var(--marino); color: #fff; line-height: 1.2; }
.punto {width: 8px; height: 8px; border-radius: 50%; background: #1E8E5A; display: inline-block; }

/* Botones */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  font: inherit; font-size: 16px; font-weight: 600; padding: 14px; border-radius: 12px;
  border: 1.5px solid var(--borde); background: var(--blanco); color: var(--marino);
  text-decoration: none; cursor: pointer; min-height: 48px;
}
.btn-primario { background: var(--azul); border-color: var(--azul); color: #fff; font-size: 18px; }
.btn-oscuro { background: var(--marino); border-color: var(--marino); color: #fff; }
.btn-contorno { background: transparent; border: 2px solid var(--marino); }
.btn-grande { padding: 18px; font-size: 20px; }
.btn-link { background: none; border: 0; color: var(--azul); font: inherit; font-weight: 600; cursor: pointer; padding: 8px; }

/* Formularios */
label { display: flex; flex-direction: column; gap: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input:not([type]), select, textarea {
  font: inherit; font-size: 16px; color: var(--marino); background: var(--blanco);
  border: 1.5px solid var(--borde); border-radius: 10px; padding: 12px 14px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--azul); outline-offset: 1px; }
.monto { display: flex; align-items: center; gap: 8px; border: 2px solid var(--azul); border-radius: 12px; padding: 10px 16px; background: var(--blanco); }
.monto span { font-size: 26px; font-weight: 600; color: var(--texto-2); }
.monto input { border: 0; outline: none; font-size: 30px; font-weight: 700; padding: 0; }
.check { flex-direction: row; align-items: center; gap: 12px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--azul); }

/* Chips (radio con estilo de botón) */
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span, .chips select {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 46px;
  border: 1.5px solid var(--borde); border-radius: 10px; background: var(--blanco);
  font-weight: 600; font-size: 14px; padding: 8px 6px; cursor: pointer; height: 100%;
}
.chip input:checked + span { border: 2px solid var(--azul); background: var(--azul-claro); }
.chip input:focus-visible + span { outline: 2px solid var(--azul); }
.chips select.elegido { border: 2px solid var(--azul); background: var(--azul-claro); }
.segmentos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: #E3E8F0; padding: 4px; border-radius: 12px; }
.segmentos a { text-align: center; text-decoration: none; color: var(--texto-2); font-weight: 600; padding: 10px; border-radius: 9px; }
.segmentos a.activo { background: var(--blanco); color: var(--marino); box-shadow: 0 1px 2px rgba(15, 37, 87, .12); }

/* Listas */
.lista { list-style: none; margin: 0; padding: 0; background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); }
.lista > li { border-bottom: 1px solid var(--linea); }
.lista > li:last-child { border-bottom: 0; }
.renglon { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 16px; color: inherit; text-decoration: none; }
.renglon .izq { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.renglon .der { text-align: right; flex-shrink: 0; font-weight: 600; }
.anulado { opacity: .55; text-decoration: line-through; }
.negativo { color: #A8430B; }
.vacio { padding: 18px 16px; text-align: center; color: var(--texto-2); }

/* Avisos */
.aviso { border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: 14px; }
.aviso-error { background: var(--naranja-fondo); color: var(--naranja); border: 1.5px solid var(--naranja-borde); }
.aviso-ok { background: var(--verde-fondo); color: var(--verde); border: 1.5px solid #8CCBA8; }
.aviso-info { background: var(--azul-claro); color: var(--azul-osc); border: 1.5px solid #8DB6EE; }
.etiq { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; display: inline-block; }
.etiq-baja { color: var(--naranja); background: var(--naranja-fondo); }
.etiq-ok { color: var(--verde); background: var(--verde-fondo); }
.etiq-abierto { color: var(--azul-osc); background: var(--azul-claro); }
.dif-falta { color: var(--naranja); background: var(--naranja-fondo); border: 1.5px solid var(--naranja-borde); }
.dif-sobra { color: var(--azul-osc); background: var(--azul-claro); border: 1.5px solid #8DB6EE; }
.dif-cuadra { color: var(--verde); background: var(--verde-fondo); border: 1.5px solid #8CCBA8; }

/* Venta con menú */
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.cats button {
  flex-shrink: 0; border: 1.5px solid var(--borde); background: var(--blanco); color: var(--marino);
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.cats button[aria-pressed=true] { background: var(--marino); border-color: var(--marino); color: #fff; }
.productos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.prod {
  position: relative; text-align: left; min-height: 78px; border: 2px solid #E3E8F0; background: var(--blanco);
  color: var(--marino); font: inherit; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
}
.prod.en-ticket { border-color: var(--azul); }
.prod[disabled] { opacity: .5; cursor: not-allowed; }
.prod .nombre { font-weight: 600; font-size: 14px; padding-right: 24px; }
.prod .pie { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.prod .precio { font-weight: 700; }
.prod .quedan { font-size: 12px; color: var(--texto-2); }
.prod .cuenta {
  position: absolute; top: 8px; right: 8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--azul); color: #fff; font-size: 13px; font-weight: 700; display: none; align-items: center; justify-content: center;
}
.prod.en-ticket .cuenta { display: flex; }
.ancho-venta { max-width: 1280px; }
.venta-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.ticket { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 14px 16px 16px;
          display: flex; flex-direction: column; gap: 10px; scroll-margin-top: calc(var(--alto-barra, 80px) + 12px); }
/* Computadora / tablet horizontal: productos a la izquierda, ticket a la derecha siguiendo el scroll. */
@media (min-width: 900px) {
  .venta-layout { grid-template-columns: minmax(0, 1fr) 400px; }
  .ticket { position: sticky; top: calc(var(--alto-barra, 80px) + 12px);
            max-height: calc(100vh - var(--alto-barra, 80px) - 24px); overflow-y: auto; }
}
/* Celular: barra delgada abajo con el total, que lleva al ticket. */
.barra-ticket {
  position: sticky; bottom: 0; display: block; text-align: center; text-decoration: none;
  background: var(--azul); color: #fff; font-weight: 700; padding: 14px; border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 10px rgba(15, 37, 87, .15);
}
@media (min-width: 900px) { .barra-ticket { display: none !important; } }
.ticket ul { list-style: none; margin: 0; padding: 0; max-height: 140px; overflow-y: auto; }
.ticket li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.ticket li .n { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini { width: 34px; height: 34px; border: 1.5px solid var(--borde); background: var(--blanco); color: var(--marino); border-radius: 8px; font: inherit; font-size: 18px; font-weight: 600; cursor: pointer; }

/* Login */
.entrar { max-width: 400px; margin: 0 auto; padding: 48px 20px; display: flex; flex-direction: column; gap: 20px; }
.entrar .logo-grande { font-size: 32px; font-weight: 800; letter-spacing: .1em; text-align: center; }
.entrar .lema { text-align: center; color: var(--texto-2); font-style: italic; }

/* Pantalla de cocina */
.cocina { max-width: 1400px; }
.comandas { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.comanda {
  background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); border: 3px solid transparent;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.comanda .num { font-size: 28px; }
.comanda ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 18px; flex-grow: 1; }
.comanda-tarde { border-color: var(--naranja-borde); }
.comanda-tarde header .chico { color: var(--naranja); font-weight: 700; }
.comanda-cancelada { border-color: var(--naranja); background: var(--naranja-fondo); }
.cancelada-aviso { color: var(--naranja); font-weight: 800; letter-spacing: .04em; }
.tachado { text-decoration: line-through; opacity: .6; }
.para-llevar { align-self: flex-start; background: var(--marino); color: #fff; font-weight: 800; letter-spacing: .05em; padding: 4px 10px; border-radius: 6px; }
.nota-cocina { background: #FFF6D6; border-radius: 8px; padding: 8px 10px; font-weight: 600; }

/* Reportes */
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; align-items: end; }
.rejilla-reportes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.grafica { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; }
.eje-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; height: 200px; }
.columnas { display: grid; gap: 2px; height: 200px; border-bottom: 1px solid var(--borde);
            background: linear-gradient(var(--linea), var(--linea)) top / 100% 1px no-repeat; }
.col { position: relative; display: flex; align-items: flex-end; height: 100%; cursor: default; outline: none; }
.col .barra { width: 100%; background: var(--azul); border-radius: 4px 4px 0 0; min-height: 0; }
.col:hover .barra, .col:focus .barra { background: var(--marino); }
.col .tip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--marino); color: #fff; font-size: 12px; line-height: 1.35; padding: 6px 8px; border-radius: 6px;
  white-space: nowrap; z-index: 2; pointer-events: none;
}
.col:hover .tip, .col:focus .tip { display: block; }
.col:first-child .tip { left: 0; transform: none; }
.col:last-child .tip { left: auto; right: 0; transform: none; }
.etiquetas-x { display: grid; gap: 2px; margin-top: 4px; text-align: center; white-space: nowrap; }
.hbarra { display: flex; flex-direction: column; gap: 4px; outline: none; }
.hbarra:focus .hbarra-valor, .hbarra:hover .hbarra-valor { background: var(--marino); }
.hbarra-pista { height: 10px; background: var(--linea); border-radius: 4px; }
.hbarra-valor { height: 10px; background: var(--azul); border-radius: 0 4px 4px 0; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th, .tabla td { padding: 8px 6px; border-bottom: 1px solid var(--linea); text-align: left; }
.tabla th { font-size: 12px; color: var(--texto-2); font-weight: 600; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Impresión del corte */
@media print {
  .barra, .no-imprimir { display: none !important; }
  body { background: #fff; }
  .tarjeta { box-shadow: none; padding: 0; }
}
