/* Nic-Vic — colores de su logo: azul rey, rojo, amarillo. Mucho aire entre bloques. */
:root {
  --azul: #1546c8;
  --azul-osc: #0f2d7a;
  --azul-claro: #e8eefc;
  --rojo: #e2262f;
  --amarillo: #ffd21f;
  --verde: #1a9e55;
  --fondo: #f3f6fc;
  --carta: #ffffff;
  --tinta: #121a33;
  --gris: #5d6782;
  --linea: #dfe5f2;
  --radio: 18px;
  --sombra: 0 1px 2px rgba(18, 26, 51, .06), 0 8px 24px rgba(18, 26, 51, .06);
  --titulo: 'Baloo 2', system-ui, sans-serif;
  --texto: 'Figtree', system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 var(--texto); color: var(--tinta); background: var(--fondo);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
body[data-sec="pedido"] { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
h1, h2 { font-family: var(--titulo); line-height: 1.15; margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
img { display: block; }

/* ---------- cabecera ---------- */
.cab {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  background: linear-gradient(180deg, var(--azul) 0%, #1a52dc 100%);
  box-shadow: 0 4px 18px rgba(15, 45, 122, .25);
}
.cab-logo img { width: 104px; height: auto; border-radius: 14px; }
.quien { display: flex; background: rgba(255, 255, 255, .16); border-radius: 999px; padding: 4px; }
.quien button {
  border: 0; background: none; color: #fff; padding: 8px 16px; border-radius: 999px;
  font-weight: 600; font-size: 15px; min-height: 40px;
}
.quien button[aria-pressed="true"] { background: #fff; color: var(--azul-osc); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }

.senal {
  margin: 0; padding: 12px 20px; background: var(--amarillo); color: var(--tinta);
  font-weight: 600; font-size: 15px; text-align: center;
}

main { max-width: 620px; margin: 0 auto; padding: 28px 20px 24px; outline: none; }

/* ---------- títulos ---------- */
.hola { margin-bottom: 28px; }
.hola--chica { margin-bottom: 20px; }
.hola-fecha { margin: 0 0 4px; color: var(--gris); font-size: 15px; }
.hola h1 { font-size: 34px; color: var(--azul-osc); }
.hola--chica h1 { font-size: 28px; }
.hola-sub { margin: 8px 0 0; color: var(--gris); font-size: 17px; }
.titulo {
  font-size: 21px; color: var(--azul-osc); margin: 36px 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.cuenta { background: var(--azul); color: #fff; font: 700 14px var(--texto); border-radius: 999px; padding: 2px 10px; }
.vacio { color: var(--gris); padding: 8px 2px; margin: 0; }
.link { background: none; border: 0; color: var(--azul); font-weight: 600; text-decoration: none; padding: 8px 4px; }

/* ---------- botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: 14px;
  background: var(--azul); color: #fff; font-weight: 700; font-size: 16px; text-decoration: none;
  box-shadow: 0 4px 12px rgba(21, 70, 200, .25);
}
.boton--rojo { background: var(--rojo); box-shadow: 0 4px 12px rgba(226, 38, 47, .3); }
.boton--verde { background: var(--verde); box-shadow: 0 4px 12px rgba(26, 158, 85, .28); }
.boton--claro { background: var(--carta); color: var(--azul-osc); box-shadow: inset 0 0 0 1.5px var(--linea); }
.boton:active, .sumar:active, .cant button:active { transform: scale(.97); }

/* ---------- inicio ---------- */
.nuevo {
  display: flex; align-items: center; gap: 18px; padding: 24px;
  background: linear-gradient(135deg, var(--azul) 0%, #2a63f0 100%); color: #fff;
  border-radius: 22px; text-decoration: none; box-shadow: 0 10px 28px rgba(21, 70, 200, .3);
}
.nuevo-mas {
  flex: none; width: 56px; height: 56px; border-radius: 16px; background: var(--amarillo); color: var(--azul-osc);
  display: grid; place-items: center; font: 800 34px/1 var(--titulo);
}
.nuevo strong { display: block; font: 700 22px/1.2 var(--titulo); }
.nuevo small { display: block; opacity: .9; font-size: 15px; margin-top: 4px; }

.seguir {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  padding: 18px 20px; margin-bottom: 16px; background: #fff7d1; border-radius: var(--radio);
  text-decoration: none; box-shadow: inset 0 0 0 1.5px #f2dc6a;
}
.seguir span:first-child { font-size: 14px; color: #6b5a00; }
.seguir strong { grid-column: 1; }
.seguir-flecha { grid-row: 1 / 3; grid-column: 2; font-size: 22px; color: var(--azul); }

.avisos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.aviso { display: flex; gap: 14px; padding: 18px; background: var(--carta); border-radius: var(--radio); box-shadow: var(--sombra); }
.aviso strong { display: block; font-size: 16px; }
.aviso p { margin: 4px 0 0; color: var(--gris); font-size: 15px; }
.aviso-ic { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; }
.aviso--rojo .aviso-ic { background: #fde3e4; color: var(--rojo); }
.aviso--amarillo .aviso-ic { background: #fff3c2; color: #8a6d00; }
.aviso--azul .aviso-ic { background: var(--azul-claro); color: var(--azul); }

/* ---------- listas de clientes y boletas ---------- */
.clientes, .boletas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cli button, .boletas a {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-align: left;
  background: var(--carta); border: 0; border-radius: var(--radio); box-shadow: var(--sombra); text-decoration: none;
}
.cli-tx { flex: 1; min-width: 0; }
.cli-tx strong { display: block; font-size: 17px; }
.cli-tx small { display: block; color: var(--gris); font-size: 14px; margin-top: 2px; }
.flecha { color: var(--azul); font-size: 20px; }
.boletas b { font-size: 17px; white-space: nowrap; }
.avatar {
  flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--azul-claro); color: var(--azul);
  display: grid; place-items: center; font: 800 17px var(--titulo);
}
.cli-tx .chip { display: inline-block; margin-top: 6px; }
.chip { flex: none; font-size: 13px; font-weight: 700; background: #fff3c2; color: #6b5a00; padding: 4px 10px; border-radius: 999px; }
.chip--rojo { background: #fde3e4; color: #b3141c; }
.otros { margin-top: 28px; }
.otros summary {
  cursor: pointer; padding: 14px 4px; color: var(--azul); font-weight: 700; list-style: none;
}
.otros summary::before { content: '+ '; }
.otros[open] summary::before { content: '− '; }
.otros .clientes { margin-top: 6px; }

/* ---------- buscador ---------- */
.buscador input {
  width: 100%; min-height: 58px; padding: 0 20px 0 52px; font-size: 18px;
  border: 2px solid var(--linea); border-radius: 16px; background: var(--carta) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%231546c8' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='9.5' cy='9.5' r='7'/%3E%3Cpath d='m15 15 5 5'/%3E%3C/svg%3E") no-repeat 18px center;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.buscador input:focus { border-color: var(--azul); box-shadow: 0 0 0 4px rgba(21, 70, 200, .12); }
.buscador { display: block; margin-bottom: 8px; }

/* ---------- pedido ---------- */
.ped-cliente {
  display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 20px;
  background: var(--carta); border-radius: var(--radio); box-shadow: var(--sombra);
}
.ped-cliente div { flex: 1; min-width: 0; }
.ped-cliente h1 { font-size: 24px; color: var(--azul-osc); }
.ped-cliente p { margin: 2px 0 0; color: var(--gris); font-size: 14px; }

.resultados { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.resultados:not(:empty) { margin: 12px 0 8px; }
.res {
  display: grid; grid-template-columns: 56px 1fr; gap: 10px 14px; align-items: center;
  padding: 14px; background: var(--carta); border-radius: var(--radio); box-shadow: var(--sombra);
}
.res-tx strong { display: block; font-size: 16px; line-height: 1.3; }
.res-tx small { color: var(--gris); font-size: 14px; }
.res-bt { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
mark { background: #fff0a3; color: inherit; border-radius: 4px; padding: 0 1px; }
.sumar {
  flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--azul-claro); color: var(--azul-osc);
  font-size: 15px; min-width: 0; font-weight: 600;
}
.sumar::before { content: '+'; font: 800 20px/1 var(--titulo); color: var(--azul); }
.sumar span { flex: 1; text-align: left; white-space: nowrap; }

.fo { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: var(--azul-claro); }
.fo--letras { display: grid; place-items: center; font: 800 18px var(--titulo); color: #fff; }
.r-golosinas { background: #e2262f; } .r-chocolates { background: #7a4a2a; } .r-galletitas { background: #d98a1c; }
.r-snacks { background: #e8a50b; } .r-almacen { background: #2f8a4c; } .r-perfumeria { background: #7b53c9; }
.r-papel { background: #5d6782; } .r-frio { background: #1d8fd1; }
.frio { display: inline-block; background: #dff1fd; color: #0d6aa3; font-weight: 700; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.poco { color: #b3141c; }

.siempre {
  margin-top: 20px; padding: 22px; border-radius: 20px; background: #fff7d1; box-shadow: inset 0 0 0 1.5px #f2dc6a;
  display: grid; gap: 16px;
}
.siempre h2 { font-size: 21px; color: var(--azul-osc); }
.siempre p { margin: 6px 0 0; color: #5f5310; }

.lineas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.linea {
  display: grid; grid-template-columns: 56px 1fr auto; grid-template-areas: "fo tx tx" "fo cant imp";
  gap: 8px 14px; align-items: center; padding: 14px; background: var(--carta); border-radius: var(--radio); box-shadow: var(--sombra);
}
.linea .fo { grid-area: fo; align-self: start; }
.linea-tx { grid-area: tx; min-width: 0; }
.linea-tx strong { display: block; font-size: 16px; line-height: 1.3; }
.linea-tx small { color: var(--gris); font-size: 14px; }
.linea-imp { grid-area: imp; font-size: 17px; white-space: nowrap; }
.linea--nueva { animation: brillo 1.2s ease-out; }
@keyframes brillo { from { box-shadow: 0 0 0 3px var(--amarillo), var(--sombra); } to { box-shadow: var(--sombra); } }
.modo {
  border: 0; background: var(--azul-claro); color: var(--azul-osc); font-weight: 700; font-size: 13px;
  padding: 3px 10px; border-radius: 999px; min-height: 28px;
}
.modo--fijo { display: inline-block; background: #eef0f5; color: var(--gris); }
.cant { grid-area: cant; display: flex; align-items: center; gap: 4px; justify-self: start; background: var(--fondo); border-radius: 12px; padding: 4px; }
.cant button {
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--carta); color: var(--azul);
  font: 800 22px/1 var(--titulo); box-shadow: 0 1px 3px rgba(18, 26, 51, .1);
}
.cant output { min-width: 34px; text-align: center; font-weight: 700; font-size: 17px; }

.barra {
  position: fixed; left: 0; right: 0; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 620px; margin: 0 auto; padding: 14px 20px;
  background: var(--carta); border-top: 1px solid var(--linea); box-shadow: 0 -8px 24px rgba(18, 26, 51, .08);
}
.barra small { display: block; color: var(--gris); font-size: 14px; }
.barra strong { font: 800 26px/1.1 var(--titulo); color: var(--azul-osc); }

/* ---------- menú de abajo ---------- */
.menu {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 16;
  display: flex; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--carta); border-top: 1px solid var(--linea);
}
.menu a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; text-decoration: none; color: var(--gris); font-size: 13px; font-weight: 600;
}
.menu-ic { font-size: 22px; line-height: 28px; }
.menu-ic--mas {
  width: 28px; height: 28px; border-radius: 9px; background: var(--azul); color: #fff;
  display: grid; place-items: center; font: 800 20px/1 var(--titulo);
}
.menu a[aria-current] { color: var(--azul); }

/* ---------- boleta ---------- */
.bol-acciones { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.estado { font-size: 14px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
.estado--ok { background: #dcf3e5; color: #11713c; }
.estado--espera { background: #fff3c2; color: #6b5a00; }

.boleta {
  background: #fff; border-radius: 20px; box-shadow: var(--sombra); overflow: hidden;
  border-top: 8px solid var(--azul);
}
.bol-cab { display: flex; gap: 16px; align-items: center; padding: 22px 22px 18px; border-bottom: 2px dashed var(--linea); }
.bol-cab img { width: 110px; height: auto; border-radius: 12px; flex: none; }
.bol-datos { display: grid; gap: 2px; font-size: 13px; color: var(--gris); }
.bol-datos strong { font: 800 19px/1.2 var(--titulo); color: var(--azul-osc); }
.bol-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; padding: 18px 22px; background: #f8faff; }
.bol-meta small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gris); }
.bol-meta strong { font-size: 16px; }
.bol-cli span { display: block; font-size: 13px; color: var(--gris); }
.bol-tabla { width: 100%; border-collapse: collapse; font-size: 15px; }
.bol-tabla th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gris);
  padding: 12px 8px; border-bottom: 2px solid var(--linea);
}
.bol-tabla td { padding: 11px 8px; border-bottom: 1px solid #edf0f7; vertical-align: top; }
.bol-tabla th:first-child, .bol-tabla td:first-child { padding-left: 22px; }
.bol-tabla th:last-child, .bol-tabla td:last-child { padding-right: 22px; }
.bol-tabla td small { display: block; color: var(--gris); font-size: 12px; }
.bol-tabla .num { text-align: right; white-space: nowrap; }
.bol-tabla td:first-child { font-weight: 700; }
.bol-total { display: flex; justify-content: space-between; align-items: flex-end; padding: 18px 22px; }
.bol-total > span { color: var(--gris); font-size: 15px; }
.bol-total small { display: block; text-align: right; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--gris); }
.bol-total strong { display: block; margin-top: 4px; font: 800 32px/1.1 var(--titulo); color: var(--azul-osc); }
.bol-fiado { margin: 0 22px 16px; padding: 12px 14px; background: #fff7d1; border-radius: 12px; font-size: 14px; }
.bol-pie { padding: 14px 22px 20px; text-align: center; color: var(--gris); font-size: 13px; border-top: 2px dashed var(--linea); }

.fiado { margin-top: 20px; padding: 18px; background: var(--carta); border-radius: var(--radio); box-shadow: var(--sombra); }
.interruptor { display: flex; gap: 14px; align-items: center; cursor: pointer; }
.interruptor input { width: 26px; height: 26px; accent-color: var(--azul); flex: none; }
.interruptor strong { display: block; }
.interruptor small { color: var(--gris); font-size: 14px; }
.fiado-aviso { margin: 12px 0 0; color: #b3141c; font-weight: 600; font-size: 15px; }
.bol-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.bol-botones .boton--verde { grid-column: 1 / -1; }

/* ---------- hoja de instalar ---------- */
.hoja-instalar {
  position: fixed; left: 12px; right: 12px; top: 12px; z-index: 50; max-width: 480px; margin: 0 auto;
  display: grid; grid-template-columns: 56px 1fr; gap: 12px 14px; align-items: center;
  padding: 18px; background: #fff; border-radius: 20px; box-shadow: 0 16px 40px rgba(18, 26, 51, .25);
  transform: translateY(-140%); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.hoja-instalar--ve { transform: none; }
.hoja-instalar img { border-radius: 14px; }
.hoja-instalar p { margin: 2px 0 0; color: var(--gris); font-size: 14px; }
.hoja-bt { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; }
.hoja-bt .boton { min-height: 46px; }

/* ---------- compu: dos columnas en el pedido ---------- */
@media (min-width: 960px) {
  main { max-width: 1080px; padding-top: 40px; }
  body[data-sec="inicio"] main, body[data-sec="pedidos"] main { max-width: 720px; }
  body[data-sec="boleta"] main { max-width: 760px; }
  .ped { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; align-items: start; }
  .ped-cliente { grid-column: 1 / -1; }
  .ped-lista .titulo { margin-top: 0; }
  .ped-col { position: sticky; top: 100px; }
  .barra { max-width: 1080px; border-radius: 18px 18px 0 0; }
  .cab { padding-left: max(20px, calc((100vw - 1080px) / 2)); padding-right: max(20px, calc((100vw - 1080px) / 2)); }
}

/* ---------- impresión: solo la boleta ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; padding: 0; }
  .cab, .menu, .senal, .no-imprimir, .hoja-instalar { display: none !important; }
  main { max-width: none; padding: 0; }
  .boleta { box-shadow: none; border-radius: 0; border-top-width: 6px; }
  .bol-meta { background: none; }
  .bol-tabla td { padding-top: 5px; padding-bottom: 5px; }
  .bol-tabla td small { display: inline; margin-left: 8px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
