/* admin.css -- catálogo de productos */

:root {
  --fondo: #f1f4f7;
  --panel: #ffffff;
  --panel-2: #f5f7f9;
  --panel-3: #eceff2;
  --ink: #1a2230;
  --muted: #5b6675;
  --line: #d3d9e0;
  --line-suave: #e6eaee;
  --azul: #2f6fed;
  --azul-fuerte: #1b52c4;
  --azul-suave: #e8f0fe;
  --rojo: #e4002b;
  --verde: #1c8a4d;
  --amarillo: #efb800;
  --sombra: 0 1px 2px rgba(20,28,40,.07), 0 6px 18px -8px rgba(20,28,40,.16);
  --fuente: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #0f131a; --panel: #191f28; --panel-2: #151a22; --panel-3: #202834;
    --ink: #e7ecf2; --muted: #9aa6b5; --line: #333d4b; --line-suave: #262e3a;
    --azul: #5b93ff; --azul-fuerte: #7dabff; --azul-suave: #1c2c48;
    --rojo: #ff3355; --verde: #3cbf78; --amarillo: #f6d34a;
    --sombra: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px -10px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --fondo: #0f131a; --panel: #191f28; --panel-2: #151a22; --panel-3: #202834;
  --ink: #e7ecf2; --muted: #9aa6b5; --line: #333d4b; --line-suave: #262e3a;
  --azul: #5b93ff; --azul-fuerte: #7dabff; --azul-suave: #1c2c48;
  --rojo: #ff3355; --verde: #3cbf78; --amarillo: #f6d34a;
  --sombra: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px -10px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--fuente);
  background: var(--fondo);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

.cab {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.cab-izq { display: flex; align-items: center; gap: 16px; }
.cab h1 { font-size: 18px; margin: 0; }
.volver {
  color: var(--azul); text-decoration: none; font-weight: 700; font-size: 13px;
  padding: 6px 10px; border-radius: 8px; background: var(--azul-suave);
}
.cab-der { display: flex; gap: 8px; }

/* fichas del área "Admin" (Catálogo/Cierres/Resumen del día/Clientes/Datos) */
.admin-tabs {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 16px 22px;
  background: var(--fondo);
}
.admin-tabs .at-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  flex: 1 1 120px; min-width: 100px;
  padding: 16px 10px;
  background: var(--panel); border: 1px solid var(--line-suave); border-radius: 12px;
  font-size: 12.5px; font-weight: 700; color: var(--ink); text-decoration: none; text-align: center;
  box-shadow: var(--sombra);
  transition: border-color .15s, background .15s, color .15s, transform .1s;
}
.admin-tabs .at-tab svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; opacity: .7;
}
.admin-tabs .at-tab:hover { border-color: var(--azul); transform: translateY(-1px); }
.admin-tabs .at-tab.activo { background: var(--azul); border-color: var(--azul); color: #fff; }
.admin-tabs .at-tab.activo svg { opacity: 1; }

.btn-pri, .btn-sec, .btn-peligro {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
}
.btn-pri { background: var(--azul); color: #fff; }
.btn-pri:hover { background: var(--azul-fuerte); }
.btn-sec { background: var(--panel-2); border-color: var(--line); color: var(--ink); }
.btn-sec:hover { border-color: var(--azul); }
.btn-peligro { background: none; border-color: var(--rojo); color: var(--rojo); }
.btn-peligro:hover { background: var(--rojo); color: #fff; }

.barra {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px;
}
.buscador {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 0 12px; min-width: 230px;
}
.buscador:focus-within { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }
.buscador svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.buscador input { border: none; background: transparent; color: var(--ink); font-size: 14px; padding: 9px 0; outline: none; flex: 1; }

.filtros { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.filtro {
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 100px;
}
.filtro:hover { border-color: var(--azul); }
.filtro.activo { background: var(--azul); border-color: var(--azul); color: #fff; }
.chk-inactivos { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.tabla-wrap {
  margin: 0 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sombra);
  overflow-x: auto;
}
.tabla { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabla th {
  text-align: left;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted);
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--panel);
}
.tabla td { padding: 8px 12px; border-bottom: 1px solid var(--line-suave); }
.tabla tbody tr:hover { background: var(--panel-2); }
.tabla th.c-precio, .c-precio { text-align: center; }
.c-mini { text-align: right; }
th.c-mini, td.c-mini { text-align: center; }
.c-acc { width: 40px; }

.grupo-fam td {
  background: var(--panel-3);
  font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted);
  padding: 7px 12px;
}

.prod-nombre { display: flex; align-items: center; gap: 10px; }
.prod-color { width: 12px; height: 12px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.prod-nombre b { font-weight: 600; }
.prod-nombre.inactivo { opacity: .45; }
.prod-nombre .tag-kg { font-size: 9.5px; font-weight: 800; color: var(--azul); background: var(--azul-suave); padding: 1px 5px; border-radius: 5px; }

.precio-inline {
  width: 96px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 5px 7px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.precio-inline:hover { border-color: var(--line); }
.precio-inline:focus { border-color: var(--azul); background: var(--panel); outline: none; box-shadow: 0 0 0 3px var(--azul-suave); }

/* Íconos SVG en vez de emoji (ver ICONOS en util.js): trazo redondeado,
   tamaño por defecto 14px; .icono-solido es para las rellenas (play, estrella). */
.icono { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icono-solido { fill: currentColor; stroke: none; }

.mini-toggle {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.mini-toggle .icono { width: 13px; height: 13px; }
.mini-toggle.on { background: var(--azul-suave); border-color: var(--azul); color: var(--azul-fuerte); }
.mini-toggle.fav.on { background: #fff6d6; border-color: var(--amarillo); color: var(--amarillo); }


.btn-editar {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 6px; width: 28px; height: 26px; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-editar:hover { border-color: var(--azul); color: var(--azul); }

.tabla-vacio { padding: 40px; text-align: center; color: var(--muted); }
.pie { padding: 16px 22px 40px; color: var(--muted); font-size: 12px; }

/* ---------- modales ---------- */
.modal-fondo {
  position: fixed; inset: 0; background: rgba(10,14,22,.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 40;
}
.modal {
  background: var(--panel); border-radius: 14px;
  box-shadow: 0 24px 64px -12px rgba(0,0,0,.4);
  width: 100%; max-width: 500px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-cab { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--line-suave); }
.modal-cab h2 { margin: 0; font-size: 16px; }
.modal-x { border: none; background: none; color: var(--muted); font-size: 18px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.modal-x .icono { width: 18px; height: 18px; }
.modal-producto .modal-x .icono { width: 22px; height: 22px; }
.modal-cuerpo { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-pie { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-suave); }

/* modal de producto: más grande que el resto (campos y botones más cómodos) */
.modal-producto { max-width: 860px; max-height: 94vh; }
.modal-producto .modal-cab { padding: 22px 30px; }
.modal-producto .modal-cab h2 { font-size: 22px; }
.modal-producto .modal-x { font-size: 24px; }
.modal-producto .modal-cuerpo { padding: 28px 30px; gap: 24px; }
.modal-producto .modal-pie { padding: 20px 30px; gap: 12px; }
.modal-producto .modal-pie button { padding: 13px 26px; font-size: 16px; }
.modal-producto .campo { gap: 8px; }
.modal-producto .campo label { font-size: 14px; }
.modal-producto .campo input[type="text"], .modal-producto .campo input[type="number"], .modal-producto .campo select {
  padding: 14px 16px; font-size: 17px;
}
.modal-producto .campo-fila { gap: 22px; }
.modal-producto .campo-color { flex: 0 0 96px; }
.modal-producto .campo-color input[type="color"] { height: 52px; }
.modal-producto .toggle { font-size: 16px; gap: 10px; }
.modal-producto .toggle input { width: 20px; height: 20px; }
.modal-producto .campo { min-width: 0; }
@media (max-width: 720px) {
  .modal-producto .modal-cab, .modal-producto .modal-cuerpo, .modal-producto .modal-pie { padding-left: 18px; padding-right: 18px; }
  .modal-producto .campo-fila { flex-wrap: wrap; gap: 14px; }
  .modal-producto .campo { flex: 1 1 150px; }
  .modal-producto .campo-color { flex: 0 0 96px; }
}

.campo { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.campo label { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.campo input[type="text"], .campo input[type="number"], .campo select {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; font-family: inherit; outline: none;
}
.campo input:focus, .campo select:focus { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }
.campo input:disabled { background: var(--panel); color: var(--muted); cursor: not-allowed; opacity: 0.6; }
.campo-fila { display: flex; gap: 12px; align-items: flex-end; }
.campo-color { flex: 0 0 64px; }
.campo-color input[type="color"] { width: 100%; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink); }

/* ---------- buscador de cliente/producto (editar un pedido) ---------- */
.cl-resultados { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 220px; overflow-y: auto; }
.cl-item {
  text-align: left; border: 1px solid var(--line-suave); background: var(--panel-2);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; cursor: pointer;
}
.cl-item:hover { border-color: var(--azul); }
.cl-item b { display: block; }
.cl-item small { color: var(--muted); }

/* ---------- editar pedido: canal/medio de pago y productos ---------- */
.toggle-grupo { display: flex; flex-wrap: wrap; gap: 4px; }
.toggle-grupo button {
  flex: 1; min-width: 72px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); font-size: 12px; font-weight: 700; font-family: inherit;
  padding: 8px 6px; border-radius: 8px; cursor: pointer;
}
.toggle-grupo button.activo { background: var(--azul-suave); border-color: var(--azul); color: var(--azul-fuerte); }

.ep-bloqueado { font-size: 12.5px; color: var(--muted); background: var(--panel-2); border-radius: 8px; padding: 10px 12px; margin: 4px 0 0; }

.ep-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.ep-item { display: flex; align-items: center; gap: 6px; }
.ep-item .ep-nombre { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-item .ep-nombre small { color: var(--muted); }
.ep-item input[type="number"] {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 6px; padding: 6px 7px; font-size: 13px; font-family: inherit; outline: none; flex: none;
}
.ep-item .ep-cant { width: 56px; }
.ep-item .ep-precio { width: 76px; }
.ep-item .ep-subtotal { width: 76px; text-align: right; font-weight: 700; font-size: 13px; flex: none; }
.ep-item .ep-x {
  border: none; background: none; color: var(--muted); width: 22px; height: 22px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.ep-item .ep-x .icono { width: 15px; height: 15px; }
.ep-item .ep-x:hover { color: var(--rojo); }

.ep-totales { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }

.fam-nueva { display: flex; gap: 8px; margin-bottom: 14px; }
.fam-nueva input {
  flex: 1; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; outline: none;
}
.fam-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fam-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-suave); border-radius: 8px; padding: 8px 10px; background: var(--panel-2);
}
.fam-item input.fam-nombre { flex: 1; border: 1px solid transparent; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; padding: 4px 6px; border-radius: 6px; }
.fam-item input.fam-nombre:focus { border-color: var(--azul); background: var(--panel); outline: none; }
.fam-item .fam-count { font-size: 11px; color: var(--muted); }
.fam-item .fam-del { border: none; background: none; color: var(--muted); font-size: 14px; padding: 2px 6px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fam-item .fam-del:hover { color: var(--rojo); background: var(--panel-3); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--verde); color: #fff; font-size: 14px; font-weight: 700;
  padding: 12px 22px; border-radius: 100px; box-shadow: 0 10px 30px -8px rgba(0,0,0,.35);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
.toast.mostrar { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--rojo); }

/* ================= arqueo de caja ================= */
.arqueo {
  display: grid;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
  gap: 16px;
  padding: 16px 22px;
  align-items: start;
}
.aq-col { display: flex; flex-direction: column; gap: 16px; }

.aq-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sombra);
  overflow: hidden;
}
.aq-panel-cab { padding: 12px 16px; border-bottom: 1px solid var(--line-suave); background: var(--panel-2); }
.aq-panel-cab h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.aq-sin-turno {
  margin: 40px auto; max-width: 420px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px;
}
.aq-sin-turno p { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.cab-meta-chip {
  font-size: 12px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line-suave); border-radius: 8px; padding: 7px 12px;
}

.aq-fondo-fija {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line-suave);
}
.aq-fondo-fija span { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.aq-fondo-fija b { font-size: 15px; font-variant-numeric: tabular-nums; }

.aq-monedas, .aq-obs {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px;
}
.aq-monedas span, .aq-obs span { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.aq-monedas input {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 8px; padding: 9px 11px; font-size: 15px; font-weight: 700;
  text-align: right; font-variant-numeric: tabular-nums; outline: none;
}
.aq-monedas input:focus, .arqueo-num:focus {
  border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave);
}

.aq-ficha { padding: 6px 16px 12px; }
.aq-ficha-fila {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--line-suave); font-size: 13px;
}
.aq-ficha-fila:last-child { border-bottom: none; }
.aq-ficha-fila span { color: var(--muted); }
.aq-ficha-fila b { font-weight: 700; font-variant-numeric: tabular-nums; }

.aq-medios { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.aq-medios th {
  text-align: right; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.aq-medios th:first-child { text-align: left; }
.aq-medios td { padding: 8px 12px; border-bottom: 1px solid var(--line-suave); text-align: right; font-size: 13px; }
.aq-medios td:first-child { text-align: left; font-weight: 600; }
.aq-medios tfoot td { border-top: 2px solid var(--line); border-bottom: none; font-weight: 800; font-size: 14px; padding-top: 11px; }
.aq-num { font-variant-numeric: tabular-nums; }
.aq-medios .aq-sistema { color: var(--muted); }
.aq-medios input.aq-decl {
  width: 118px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 7px; padding: 6px 8px; font-size: 13px; font-weight: 700;
  text-align: right; font-variant-numeric: tabular-nums; outline: none;
}
.aq-medios input.aq-decl:focus { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }
.aq-medios .aq-contado-cell { font-weight: 700; }

.aq-dif { font-weight: 800; }
.aq-dif.ok { color: var(--verde); }
.aq-dif.falta { color: var(--rojo); }
.aq-dif.sobra { color: var(--amarillo); }

.aq-pie {
  display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap;
  padding: 4px 22px 20px;
}
.aq-obs { flex: 1; min-width: 260px; padding: 0; }
.aq-obs textarea {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 8px; padding: 9px 11px; font-size: 13px; font-family: inherit; resize: vertical; outline: none;
}
.aq-obs textarea:focus { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }
.aq-acciones { display: flex; gap: 10px; }
.btn-cerrar-turno {
  border: none; background: var(--rojo); color: #fff;
  font-size: 15px; font-weight: 800; letter-spacing: .02em;
  padding: 12px 28px; border-radius: 10px; box-shadow: 0 4px 14px -4px var(--rojo);
}
.btn-cerrar-turno:hover { filter: brightness(1.06); }
.btn-cerrar-turno:disabled { background: var(--line); color: var(--muted); box-shadow: none; }

.aq-historial { padding: 8px 22px 50px; }
.aq-historial h2 { font-size: 14px; margin: 0 0 12px; }
.aq-historial-lista { display: flex; flex-direction: column; gap: 6px; }
.aq-hist-item {
  display: grid; grid-template-columns: 60px 1fr auto auto; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line-suave); border-radius: 9px;
  padding: 10px 14px; font-size: 13px; font-variant-numeric: tabular-nums;
}
.aq-hist-item .hi-num { font-weight: 800; }
.aq-hist-item .hi-fecha { color: var(--muted); font-size: 12px; }
.aq-hist-item .hi-total { font-weight: 700; }
.aq-hist-item .hi-dif { font-weight: 800; }
.aq-hist-item .hi-dif.ok { color: var(--verde); }
.aq-hist-item .hi-dif.mal { color: var(--rojo); }

/* modal cierre */
.modal-cierre { max-width: 540px; }
.cierre-ficha {
  background: var(--panel-2); border: 1px solid var(--line-suave); border-radius: 10px;
  padding: 4px 14px; margin-bottom: 14px;
}
.cierre-ficha .aq-ficha-fila { padding: 7px 0; }
.cierre-tabla { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.cierre-tabla th, .cierre-tabla td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line-suave); }
.cierre-tabla th:first-child, .cierre-tabla td:first-child { text-align: left; }
.cierre-tabla th { font-size: 10px; text-transform: uppercase; color: var(--muted); }
.cierre-nuevo { margin-top: 14px; padding: 10px 12px; background: var(--azul-suave); color: var(--azul-fuerte); border-radius: 8px; font-size: 13px; font-weight: 700; text-align: center; }

/* recibo de cierre estilo SmartFran (ver public/admin/recibo.js) */
.recibo-titulo {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 16px 0 6px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.recibo-titulo:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.recibo-vacio { font-size: 13px; color: var(--muted); font-style: italic; padding: 6px 2px 2px; }
.recibo-obs { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* ================= historial de pedidos ================= */
.hist-fecha { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.hist-fecha input {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; outline: none;
}
.hist-fecha input:focus { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }
.rango-fechas { display: flex; gap: 14px; }

.hist-resumen { display: flex; gap: 10px; padding: 14px 22px 4px; flex-wrap: wrap; }
.hist-card {
  background: var(--panel); border: 1px solid var(--line-suave); border-radius: 10px;
  padding: 10px 16px; min-width: 120px;
}
.hist-card span { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); display: block; }
.hist-card b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

.btn-ranking { margin-left: auto; }

/* ================= ranking de productos (admin/ranking.html) ================= */
.rk-tabla .h-pos { text-align: center; width: 1%; }
.rk-tabla .h-cant { text-align: right; }
.rk-pos {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: var(--panel-2); color: var(--muted);
}
.rk-tabla tr:nth-child(1) .rk-pos { background: color-mix(in srgb, var(--amarillo) 35%, transparent); color: var(--ink); }
.rk-tabla tr:nth-child(2) .rk-pos { background: var(--panel-3); color: var(--ink); }
.rk-tabla tr:nth-child(3) .rk-pos { background: color-mix(in srgb, var(--rojo) 12%, transparent); color: var(--ink); }

.hist-tabla td { vertical-align: top; }
.hist-tabla .h-num, .hist-tabla .h-total { text-align: right; }
.hist-tabla .h-hora, .hist-tabla .h-turno { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist-items { font-size: 12.5px; }
.hist-cg, .hist-desc {
  display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 800;
  padding: 1px 6px; border-radius: 5px; vertical-align: middle;
}
.hist-cg { background: color-mix(in srgb, var(--rojo) 14%, transparent); color: var(--rojo); }
.hist-desc { background: var(--panel-3); color: var(--muted); }
.badge-ok { font-size: 10.5px; font-weight: 800; color: var(--verde); }
.badge-anulada { font-size: 10.5px; font-weight: 800; color: var(--rojo); background: color-mix(in srgb, var(--rojo) 12%, transparent); padding: 2px 7px; border-radius: 5px; }
.hist-motivo { color: var(--muted); font-size: 10.5px; }
.hist-anulada { opacity: .55; }
.hist-anulada .hist-items, .hist-anulada .h-total b { text-decoration: line-through; }
.btn-anular {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 7px; padding: 5px 12px; font-size: 12px; font-weight: 700;
}
.btn-anular:hover { border-color: var(--rojo); color: var(--rojo); background: color-mix(in srgb, var(--rojo) 8%, transparent); }

/* ================= cierres de caja (historial) ================= */
.cierres-tabla td { vertical-align: top; font-variant-numeric: tabular-nums; }
.cierres-tabla .h-num, .cierres-tabla .h-total { text-align: right; }
.cierres-tabla .h-acc { text-align: center; }

@media print {
  .cab, .aq-pie, .aq-historial, .modal-x, .modal-pie, .toast { display: none !important; }
  .modal-fondo { position: static; background: none; padding: 0; }
  .modal { box-shadow: none; max-width: none; }
}

[hidden] { display: none !important; }

/* ================= historial de compras de un cliente ================= */
.acc-btns { display: flex; gap: 6px; justify-content: flex-end; }
.btn-historial svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.modal-historial { max-width: 720px; }
.hist-resumen-modal { padding: 0; }
.hist-resumen-modal .hist-card { flex: 1; min-width: 110px; }
.top-productos { display: flex; flex-wrap: wrap; gap: 6px; }
.top-prod {
  background: var(--azul-suave); color: var(--azul-fuerte); border-radius: 999px;
  padding: 4px 11px; font-size: 12px; font-weight: 600;
}
.top-prod b { font-variant-numeric: tabular-nums; }
.compras-lista { border: 1px solid var(--line-suave); border-radius: 10px; overflow: hidden; }
.compra { border-bottom: 1px solid var(--line-suave); }
.compra:last-child { border-bottom: none; }
.compra summary {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  cursor: pointer; font-size: 13px; list-style: none;
}
.compra summary::-webkit-details-marker { display: none; }
.compra summary:hover, .compra[open] summary { background: var(--panel-2); }
.cp-fecha { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.cp-num { flex: 1; color: var(--muted); font-size: 12px; }
.cp-total { font-variant-numeric: tabular-nums; }
.cp-tag { font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 5px; text-transform: uppercase; letter-spacing: .03em; }
.cp-pos { background: var(--azul-suave); color: var(--azul-fuerte); }
.cp-delivery { background: color-mix(in srgb, var(--amarillo) 22%, transparent); color: var(--ink); }
.cp-mostrador { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.cp-items { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; margin: 0; }
.cp-items td { padding: 4px 12px; border-top: 1px solid var(--line-suave); }
.cp-items td:first-child { width: 1%; white-space: nowrap; text-align: right; color: var(--muted); }
.cp-items td:last-child { text-align: right; white-space: nowrap; }

/* tipo de cliente (Público / Store / Express) */
.tipo-tag {
  display: inline-block; font-size: 10.5px; font-weight: 800; padding: 2px 8px;
  border-radius: 6px; white-space: nowrap;
}
.tipo-store { background: var(--azul-suave); color: var(--azul-fuerte); }
.tipo-express { background: color-mix(in srgb, var(--amarillo) 22%, transparent); color: var(--ink); }
.tipo-publico { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-suave); }
.filtro-tipo {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; outline: none;
}
.filtro-tipo:focus { border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-suave); }

/* ================= mobile (celular) =================
   Las pantallas de Admin están armadas para escritorio: encabezado en una
   sola línea, fichas de navegación en fila, tablas de 7-10 columnas y modales
   centrados. Acá se pasan a una sola columna: encabezado que baja de línea,
   fichas en tira scrolleable, tablas como tarjetas (las celdas se etiquetan
   con public/admin/mobile-tablas.js) y modales como hoja desde abajo, igual
   que en el POS. Los inputs van a 16px para que iOS no haga zoom al enfocar. */
@media (max-width: 720px) {
  .cab { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
  .cab-izq { gap: 10px; min-width: 0; }
  .cab h1 { font-size: 16px; }
  .cab-der { flex-wrap: wrap; gap: 8px; width: 100%; }
  .rango-fechas { flex-wrap: wrap; gap: 8px; width: 100%; }
  .rango-fechas .hist-fecha { flex: 1 1 42%; min-width: 0; }
  .rango-fechas .hist-fecha input { flex: 1; min-width: 0; }
  .btn-pri, .btn-sec, .btn-peligro { padding: 10px 14px; }
  .hist-fecha input { font-size: 16px; padding: 9px 10px; }

  .admin-tabs {
    flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 10px 12px;
    -webkit-overflow-scrolling: touch;
  }
  .admin-tabs .at-tab { flex: 0 0 auto; min-width: 88px; padding: 10px 12px; gap: 4px; font-size: 12px; }

  .barra { padding: 10px 12px; gap: 8px; }
  .buscador { flex: 1 1 100%; min-width: 0; }
  .buscador input { font-size: 16px; }
  .filtros { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; }
  .filtro { flex: none; white-space: nowrap; }
  .filtro-tipo { font-size: 16px; }

  .hist-resumen { padding: 12px 12px 4px; }
  .hist-card { flex: 1 1 40%; min-width: 0; }
  .btn-ranking { margin-left: 0; flex: 1 1 100%; text-align: center; }
  .pie { padding: 12px 14px 32px; }

  /* Tablas -> tarjetas. Una fila es una tarjeta; cada celda muestra su
     título de columna (data-label) a la izquierda y el valor a la derecha. */
  .tabla-wrap { margin: 0 12px; background: none; border: none; box-shadow: none; overflow: visible; }
  .tabla, .aq-medios { display: block; width: 100%; }
  .tabla thead, .aq-medios thead { display: none; }
  .tabla tbody, .tabla tfoot, .aq-medios tbody, .aq-medios tfoot { display: block; }
  .tabla tr, .aq-medios tr {
    display: block; margin-bottom: 10px; overflow: hidden;
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sombra);
  }
  .tabla td, .aq-medios td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 12px; text-align: right !important; width: auto !important;
    border-bottom: 1px solid var(--line-suave);
  }
  .tabla td:last-child, .aq-medios td:last-child { border-bottom: none; }
  .tabla td::before, .aq-medios td::before {
    content: attr(data-label); flex: none; text-align: left;
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  }
  /* La primera celda es el "título" de la tarjeta (producto, N° de turno,
     cliente...): va sin etiqueta y destacada. Igual las celdas sin título
     (la columna de acciones). */
  .tabla td:first-child, .aq-medios td:first-child {
    justify-content: flex-start; text-align: left !important;
    background: var(--panel-2); font-size: 14px; font-weight: 700;
  }
  .tabla td:first-child::before, .aq-medios td:first-child::before,
  .tabla td[data-label=""]::before, .aq-medios td[data-label=""]::before { display: none; }
  /* Botones de acción (editar, ver, anular): arriba a la derecha de la tarjeta,
     así no suman una fila entera. */
  .tabla tr, .aq-medios tr { position: relative; }
  .tabla td[data-label=""] { position: absolute; top: 4px; right: 8px; padding: 0; border: none; background: none; }
  .tabla tr:has(td[data-label=""]) td:first-child { padding-right: 104px; min-height: 48px; }

  /* Listas de ventas: el título de la tarjeta es el número de venta. */
  .hist-tabla td.h-num:first-child::before { display: inline; content: "N° "; }

  /* Encabezado de grupo del catálogo (familia): banda, no tarjeta. */
  .tabla tr.grupo-fam { background: none; border: none; box-shadow: none; margin: 14px 0 6px; }
  .tabla tr.grupo-fam td { display: block; background: none; padding: 0 2px; border: none; text-align: left !important; }

  /* Catálogo: precios editables a mano -> con borde visible y de tamaño táctil. */
  .precio-inline {
    width: 120px; border-color: var(--line); background: var(--panel-2);
    font-size: 16px; padding: 8px 10px;
  }
  .mini-toggle { width: 32px; height: 32px; font-size: 15px; }
  .btn-editar { width: 40px; height: 34px; font-size: 15px; }
  .btn-anular { padding: 8px 14px; }
  .prod-nombre { flex-wrap: wrap; }

  /* Modales: hoja desde abajo, ancho completo. */
  .modal-fondo { padding: 0; align-items: flex-end; }
  .modal { max-width: 100% !important; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .modal-cab { padding: 14px 16px; }
  .modal-cuerpo { padding: 16px; }
  .modal-pie { padding: 12px 16px; flex-wrap: wrap; }
  .campo-fila { flex-wrap: wrap; }
  .campo-fila .campo { flex: 1 1 140px; min-width: 0; }
  .campo input[type="text"], .campo input[type="number"], .campo input[type="password"], .campo select { font-size: 16px; }
  .modal-cuerpo { overflow-x: auto; }
  .cierre-tabla th, .cierre-tabla td { padding: 6px 4px; font-size: 12px; }
  .compra summary { flex-wrap: wrap; }

  /* Arqueo */
  .arqueo { padding: 12px; gap: 12px; }
  .aq-medios input.aq-decl { width: 100%; max-width: 170px; font-size: 16px; }
  .aq-monedas input { font-size: 16px; }
  .aq-medios tfoot tr { background: var(--panel-2); }
  .aq-pie { padding: 4px 12px 20px; gap: 12px; }
  .aq-obs { min-width: 0; flex: 1 1 100%; }
  .aq-obs textarea { font-size: 16px; }
  .aq-acciones { width: 100%; }
  .btn-cerrar-turno { width: 100%; }
  .aq-historial { padding: 8px 12px 40px; }
  .aq-hist-item { grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 8px; padding: 10px; }
  .aq-hist-item .hi-fecha { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .aq-sin-turno { margin: 24px 12px; }
}
