@font-face {
  font-family: "Manrope";
  src: url("vendor/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* Toda la identidad visual sale de estas variables. */
:root {
  --fondo: #f5f2ec;
  --panel: #ffffff;
  --texto: #1b2a26;
  --suave: #687571;
  --linea: #e7e2d8;
  --linea-fuerte: #d5cfc3;
  --pri: #1f6b55;
  --pri-osc: #175040;
  --pri-claro: #e2f0ea;
  --tinta: #12302a;
  --tinta-2: #1a3f37;
  --acento: #dd7a34;
  --acento-osc: #c26624;
  --acento-claro: #fbeadb;
  --ok: #23774c;
  --ok-claro: #e1f2e8;
  --aviso: #96600a;
  --aviso-claro: #fcefd2;
  --mal: #b5382c;
  --mal-claro: #fae7e4;
  --radio: 14px;
  --radio-ctrl: 10px;
  --sombra: 0 1px 2px rgba(18, 48, 42, .05), 0 6px 20px rgba(18, 48, 42, .05);
  --sombra-alta: 0 18px 50px rgba(18, 48, 42, .22);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo);
  color: var(--texto);
  font: 500 15px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; }
h2 { font-size: 15.5px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
a { color: var(--pri); text-underline-offset: 2px; }
b { font-weight: 700; }
.suave { color: var(--suave); }
.chico { font-size: 13px; }
.der { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.negrita { font-weight: 700; }
.ico { width: 20px; height: 20px; flex: none; }

/* ---- estructura ---- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.lateral {
  background: linear-gradient(180deg, var(--tinta) 0%, #0f2823 100%);
  color: #c9d8d3;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.marca { padding: 20px 18px 16px; display: flex; align-items: center; gap: 11px; color: #fff; font-weight: 800; font-size: 15.5px; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
.marca .sello {
  width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #f0a25a, var(--acento)); color: #fff; box-shadow: 0 4px 12px rgba(221, 122, 52, .35);
}
.lateral nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.lateral nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #c9d8d3; text-decoration: none; font-weight: 600; position: relative; transition: background .12s, color .12s;
}
.lateral nav a .ico { opacity: .75; }
.lateral nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.lateral nav a.activo { background: rgba(255, 255, 255, .11); color: #fff; }
.lateral nav a.activo .ico { opacity: 1; color: #f0a25a; }
.lateral nav a.activo::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--acento); }
.lateral nav a.cta { background: var(--acento); color: #fff; margin: 4px 0 10px; justify-content: center; box-shadow: 0 4px 14px rgba(221, 122, 52, .3); }
.lateral nav a.cta:hover { background: var(--acento-osc); }
.lateral nav a.cta .ico, .lateral nav a.cta.activo .ico { opacity: 1; color: #fff; }
.lateral nav a.cta::before { display: none; }
.lateral .pie { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .09); font-size: 13px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.lateral .pie .usuario { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; min-width: 0; }
.lateral .pie .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lateral .pie a { flex: none; }
.lateral .pie .inicial { width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .13); display: grid; place-items: center; font-weight: 800; text-transform: uppercase; flex: none; }
.lateral .pie a { color: #9fb5ae; }
.lateral .pie a:hover { color: #fff; }
.barra { display: none; }
.contenido { padding: 30px 34px 70px; max-width: 1320px; width: 100%; margin: 0 auto; }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.cabecera .volver { font-size: 13px; font-weight: 600; text-decoration: none; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- paneles ---- */
.panel { background: var(--panel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); }
.panel + .panel { margin-top: 18px; }
.panel > header { padding: 14px 18px; border-bottom: 1px solid var(--linea); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel .cuerpo { padding: 18px; }
.grilla { display: grid; gap: 18px; }
.grilla.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grilla.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grilla > .panel { margin-top: 0; }
.panel .tabla-scroll:last-child, .panel .lista-simple:last-child { border-radius: 0 0 var(--radio) var(--radio); }

.dato { padding: 18px; position: relative; overflow: hidden; }
.dato .chip { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--pri-claro); color: var(--pri); margin-bottom: 14px; }
.dato .chip.naranja { background: var(--acento-claro); color: var(--acento-osc); }
.dato .chip.rojo { background: var(--mal-claro); color: var(--mal); }
.dato .etq { color: var(--suave); font-size: 13px; font-weight: 600; }
.dato .valor { font-size: 25px; font-weight: 800; letter-spacing: -.03em; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.25; }
a.dato { display: block; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s, border-color .12s; }
a.dato:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(18, 48, 42, .1); border-color: var(--linea-fuerte); }
.dato.destacado { background: linear-gradient(135deg, var(--pri) 0%, var(--tinta-2) 100%); border-color: transparent; color: #fff; }
.dato.destacado::after { content: ""; position: absolute; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.dato.destacado .etq, .dato.destacado .suave { color: rgba(255, 255, 255, .75); }
.dato.destacado .chip { background: rgba(255, 255, 255, .16); color: #fff; }

/* ---- tablas ---- */
.tabla-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--suave); text-transform: uppercase; letter-spacing: .06em; padding: 11px 16px; background: #faf8f4; border-bottom: 1px solid var(--linea); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #fcfbf8; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #f6f9f7; }
th.num { text-align: right; }
.vacio { padding: 38px 18px; text-align: center; color: var(--suave); }
tr.anulada td { color: var(--suave); text-decoration: line-through; }
tr.anulada td.sin-tachar { text-decoration: none; }

/* ---- formularios ---- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--suave); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--linea-fuerte); border-radius: var(--radio-ctrl);
  background: #fff; color: var(--texto); font: inherit; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(31, 107, 85, .16); }
input::placeholder, textarea::placeholder { color: #a2aba8; }
textarea { resize: vertical; min-height: 64px; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; margin: 0 8px 0 0; accent-color: var(--pri); box-shadow: none; }
.check { display: flex; align-items: center; color: var(--texto); font-size: 15px; font-weight: 500; margin: 0; cursor: pointer; }
.campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.campos .ancho { grid-column: 1 / -1; }
.campos.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.buscador { max-width: 340px; }
.filtros { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.filtros > div { min-width: 150px; }
.filtros .check { padding-bottom: 9px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radio-ctrl); border: 1px solid var(--linea-fuerte); background: #fff; color: var(--texto);
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .06s;
}
button:hover, .btn:hover { background: #f8f6f1; border-color: #c4bdaf; }
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(31, 107, 85, .35); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: default; }
.pri { background: var(--pri); border-color: var(--pri); color: #fff; box-shadow: 0 2px 8px rgba(31, 107, 85, .25); }
.pri:hover { background: var(--pri-osc); border-color: var(--pri-osc); }
.peligro { color: var(--mal); border-color: #e6c4bf; }
.peligro:hover { background: var(--mal-claro); border-color: #dba9a2; }
.mini { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.icono { border: 0; background: none; padding: 4px 8px; font-size: 17px; line-height: 1; color: var(--suave); border-radius: 8px; }
.icono:hover { background: var(--fondo); color: var(--texto); }

.pastilla { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #efece5; color: var(--suave); }
.pastilla.ok { background: var(--ok-claro); color: var(--ok); }
.pastilla.aviso { background: var(--aviso-claro); color: var(--aviso); }
.pastilla.mal { background: var(--mal-claro); color: var(--mal); }
.rojo { color: var(--mal); }
.verde { color: var(--ok); }

.pestanas { display: inline-flex; gap: 4px; background: #ebe7de; padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.pestanas button { border: 0; background: none; padding: 7px 16px; color: var(--suave); border-radius: 9px; }
.pestanas button.activo { background: #fff; color: var(--texto); box-shadow: 0 1px 3px rgba(18, 48, 42, .12); }

/* ---- modal ---- */
.modal-fondo { position: fixed; inset: 0; background: rgba(14, 34, 30, .5); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; z-index: 50; animation: aparecer .15s ease; }
.modal { background: var(--panel); border-radius: 16px; width: 100%; max-width: 580px; box-shadow: var(--sombra-alta); animation: subir .18s ease; }
.modal.grande { max-width: 880px; }
.modal > header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--linea); }
.modal-cuerpo { padding: 20px; }
.modal > footer { padding: 14px 20px; border-top: 1px solid var(--linea); background: #faf8f4; border-radius: 0 0 16px 16px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal > footer .izq { margin-right: auto; }
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { opacity: 0; transform: translateY(10px); } }

/* ---- avisos ---- */
.avisos { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(92vw, 420px); }
.aviso-msg { background: var(--tinta); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--sombra-alta); font-weight: 600; border-left: 4px solid #5fc59e; animation: subir .18s ease; }
.aviso-msg.error { border-left-color: #f08a7d; }

/* ---- acceso ---- */
.acceso { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.acceso .presentacion {
  background:
    radial-gradient(circle at 85% 12%, rgba(240, 162, 90, .28), transparent 42%),
    radial-gradient(circle at 10% 90%, rgba(95, 197, 158, .22), transparent 45%),
    linear-gradient(150deg, var(--tinta-2), #0d231f);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.acceso .presentacion .marca { padding: 0; font-size: 17px; }
.acceso .presentacion h2 { font-size: 38px; font-weight: 800; letter-spacing: -.035em; line-height: 1.12; max-width: 460px; }
.acceso .presentacion p { color: rgba(255, 255, 255, .72); max-width: 420px; margin: 14px 0 0; font-size: 16px; }
.acceso .presentacion ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.acceso .presentacion li { padding: 6px 13px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 13px; font-weight: 600; }
.acceso .formulario { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.acceso .formulario > div { width: 100%; max-width: 350px; }
.acceso form { display: grid; gap: 14px; margin-top: 24px; }
.acceso form button { padding: 12px; font-size: 15px; margin-top: 4px; }

/* ---- venta ---- */
.buscar-prod { position: relative; }
.buscar-prod > input { padding: 12px 14px; font-size: 15.5px; }
.resultados { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--linea); border-radius: 12px; box-shadow: var(--sombra-alta); z-index: 10; max-height: 320px; overflow-y: auto; margin-top: 6px; padding: 4px; }
.resultados button { display: flex; justify-content: space-between; width: 100%; border: 0; border-radius: 8px; text-align: left; padding: 10px 12px; white-space: normal; gap: 12px; font-weight: 600; }
.resultados button:hover { background: var(--pri-claro); }
.renglon input { min-width: 70px; }
.totales { margin-left: auto; max-width: 340px; display: grid; gap: 8px; }
.totales > div { display: flex; justify-content: space-between; gap: 16px; align-items: center; font-variant-numeric: tabular-nums; }
.totales .total { font-size: 24px; font-weight: 800; letter-spacing: -.03em; border-top: 1px dashed var(--linea-fuerte); padding-top: 10px; margin-top: 2px; }
.opciones { display: flex; gap: 8px; flex-wrap: wrap; }
.opciones label { margin: 0; padding: 8px 14px; border: 1px solid var(--linea-fuerte); border-radius: var(--radio-ctrl); color: var(--texto); font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; transition: all .12s; }
.opciones label:hover { border-color: var(--pri); }
.opciones label.sel { border-color: var(--pri); background: var(--pri-claro); color: var(--pri-osc); box-shadow: inset 0 0 0 1px var(--pri); }
.opciones input { position: absolute; opacity: 0; pointer-events: none; }

/* ---- entregas ---- */
.entrega { padding: 18px 18px 18px 22px; position: relative; overflow: hidden; }
.entrega::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--linea-fuerte); }
.entrega.hoy::before { background: var(--pri); }
.entrega.atrasada::before { background: var(--mal); }
.entrega + .entrega { margin-top: 14px; }
.entrega .fila { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.entrega .dir { font-size: 16px; font-weight: 600; margin: 10px 0 6px; }
.entrega ul { margin: 8px 0 14px; padding-left: 18px; color: var(--suave); }

/* ---- gráfico ---- */
.barras { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.barras .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.barras .b { width: 100%; max-width: 38px; background: linear-gradient(180deg, #58a88d, var(--pri)); border-radius: 7px 7px 3px 3px; min-height: 3px; transition: filter .12s; }
.barras .col:hover .b { filter: brightness(1.12); }
.barras .col.hoy .b { background: linear-gradient(180deg, #f0a25a, var(--acento)); }
.barras .d { font-size: 11px; font-weight: 600; color: var(--suave); }
.barras .col.hoy .d { color: var(--acento-osc); }

.logo-prev { max-width: 170px; max-height: 110px; border: 1px solid var(--linea); border-radius: 12px; padding: 8px; background: #fff; display: block; }
.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--linea); }
.lista-simple li:last-child { border-bottom: 0; }
.lista-simple a { font-weight: 600; text-decoration: none; }
.lista-simple a:hover { text-decoration: underline; }

@media (max-width: 1150px) {
  .grilla.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contenido { padding-left: 22px; padding-right: 22px; }
}

/* ---- teléfono ---- */
@media (max-width: 820px) {
  body { font-size: 16px; }
  h1 { font-size: 23px; }
  input, select, textarea { font-size: 16px; padding: 11px 12px; }
  button, .btn { padding: 11px 16px; font-size: 15px; }
  .mini { padding: 7px 11px; font-size: 13px; }
  .app { display: block; }
  .barra {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    background: var(--tinta); color: #fff; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
    box-shadow: 0 2px 12px rgba(18, 48, 42, .2);
  }
  .barra button { background: none; border: 0; color: #fff; font-size: 22px; padding: 2px 8px; }
  .barra .titulo { font-weight: 700; flex: 1; }
  .barra .mas { background: var(--acento); border-radius: 9px; font-size: 14px; font-weight: 700; padding: 7px 12px; color: #fff; text-decoration: none; }
  .lateral { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; height: auto; }
  .lateral.abierto { transform: none; box-shadow: 0 0 50px rgba(0, 0, 0, .4); }
  .lateral nav a { padding: 13px 12px; }
  .velo { position: fixed; inset: 0; background: rgba(14, 34, 30, .5); z-index: 35; }
  .contenido { padding: 18px 12px 90px; }
  .grilla { gap: 12px; }
  .grilla.c2 { grid-template-columns: 1fr; }
  .grilla.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .campos, .campos.c3 { grid-template-columns: 1fr; }
  .ocultar-chico { display: none; }
  .buscador { max-width: none; }
  .dato { padding: 14px; }
  .dato .chip { width: 32px; height: 32px; margin-bottom: 10px; }
  .dato .valor { font-size: 19px; }
  .modal-fondo { padding: 0; align-items: stretch; }
  .modal, .modal.grande { max-width: none; border-radius: 0; min-height: 100%; display: flex; flex-direction: column; }
  .modal > footer { border-radius: 0; }
  .modal-cuerpo { flex: 1; }
  td, th { padding: 10px; }
  .totales { max-width: none; }
  .barras { gap: 4px; height: 120px; }
  .acceso { grid-template-columns: 1fr; }
  .acceso .presentacion { padding: 28px 22px; gap: 22px; }
  .acceso .presentacion h2 { font-size: 26px; }
  .acceso .presentacion p, .acceso .presentacion ul { display: none; }
  .acceso .formulario { align-items: flex-start; padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
@media print {
  .lateral, .barra, .acciones { display: none !important; }
  .app { display: block; }
}
