/* Ferretería EDEN · hoja de estilos 1.1
   Misma base que POS Peces: una herramienta de mostrador tranquila y clara. Fondo gris azulado, paneles
   blancos y un solo azul marino de acción, el mismo de la nota de envío en papel. */

@font-face {
  font-family: 'Plex';
  src: url('/fonts/ibm-plex-sans.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #16213a;          /* texto principal */
  --ink-2: #44506a;        /* texto secundario */
  --muted: #5d6880;        /* notas y etiquetas */
  --canvas: #eef1f6;       /* fondo de la aplicación */
  --surface: #ffffff;      /* paneles */
  --tint: #f5f7fb;         /* zonas suaves dentro de un panel */
  --line: #dde2ec;
  --line-strong: #c6cedd;
  --primary: #0b2a5b;      /* azul de la nota de envío: la acción principal */
  --primary-strong: #071e44;
  --primary-tint: #e6ecf7;
  --doc: #002060;          /* barras del formato impreso */
  --ok: #1f7a4d;
  --ok-tint: #e3f3ea;
  --danger: #b3392f;
  --danger-tint: #fbebe8;
  --warn: #8a5a0b;
  --warn-tint: #fff3da;
  --orange: #a44a0a;
  --orange-tint: #ffeedd;
  --violet: #5b3cc4;
  --violet-tint: #efeafd;
  --info: #24577e;
  --info-tint: #e5f0f8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(16, 26, 48, .16);
  --font: 'Plex', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--canvas); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 17px; line-height: 1.3; margin-bottom: 12px; }
h3 { font-size: 14.5px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
a { color: var(--primary); text-underline-offset: 3px; }
strong { font-weight: 600; }
small { font-size: 12.5px; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid #8fb0e3; outline-offset: 2px; }

button, .button, input, select, textarea { font: inherit; color: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 14.5px; font-weight: 500; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
button:hover, .button:hover { border-color: var(--primary); background: #f6f8fc; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); background: var(--danger-tint); }
button.okbtn, a.button.okbtn { background: var(--ok); border-color: var(--ok); color: #fff; }
button.small, .button.small { min-height: 32px; padding: 5px 10px; font-size: 13px; border-radius: 8px; }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
button.link:hover { background: none; color: var(--primary-strong); }
.icon-button { width: 40px; padding: 0; }
.wide { width: 100%; }

input, select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; font-size: 15px;
}
textarea { min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 42, 91, .14); }
input[readonly] { background: var(--tint); }
input[type=checkbox], input[type=radio] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
input[type=file] { padding: 8px; min-height: 0; }
label { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 14.5px; margin: 4px 0 8px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.55; }
.lead { color: var(--ink-2); font-size: 14.5px; margin-bottom: 18px; }
.dangertext { color: var(--danger) !important; }
.oktext { color: var(--ok) !important; }
.warntext { color: var(--orange) !important; }
.field-error { color: var(--danger); background: var(--danger-tint); padding: 9px 12px; border-radius: 8px; font-size: 13.5px; margin: 10px 0; }
.notice { background: var(--warn-tint); color: var(--warn); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; }
.notice.info { background: var(--info-tint); color: var(--info); }
.notice.ok { background: var(--ok-tint); color: var(--ok); }
#error { background: var(--danger-tint); color: var(--danger); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.num { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* ---------- Armazón: menú lateral y barra superior ---------- */
#app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
#sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px 16px; border-right: 1px solid var(--line); background: var(--canvas); overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 18px; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); display: grid; place-items: center; flex: none; color: #fff; font-weight: 700; font-size: 18px; }
#nav { display: grid; gap: 14px; }
.nav-group { display: grid; gap: 2px; }
.nav-group + .nav-group { padding-top: 14px; border-top: 1px solid var(--line); }
#nav button { justify-content: flex-start; gap: 12px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; background: transparent; color: var(--ink-2); font-weight: 500; border-radius: 9px; }
#nav button:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
#nav button.active { background: var(--surface); color: var(--primary); box-shadow: inset 0 0 0 1px var(--line); }
#nav button.active .icon { stroke-width: 2; }
#nav button .count { margin-left: auto; }
.session { margin-top: auto; padding: 16px 8px 0; display: grid; gap: 8px; font-size: 13px; }
.session .who strong { display: block; font-size: 14px; }
.session .who small, .session > small { display: block; color: var(--muted); font-size: 12px; }
.logout { justify-content: flex-start; min-height: 34px; padding: 6px 8px; border: 0; background: none; color: var(--ink-2); font-size: 13.5px; }
.logout:hover { background: var(--surface); }
.logout .icon { width: 18px; height: 18px; }
#scrim { position: fixed; inset: 0; background: rgba(16, 26, 48, .4); z-index: 25; }
@media (min-width: 901px) { #scrim { display: none !important; } }

#workspace { min-width: 0; padding: 0 28px 48px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; min-height: 68px; margin: 0 -28px 18px; padding: 12px 28px; background: var(--canvas); }
#menu-button { display: none; }
.topbar .date { color: var(--muted); font-size: 13.5px; order: 2; }
#title { order: 1; }
#page-tools { order: 3; margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.page { max-width: 1440px; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 600; }

/* ---------- Piezas comunes ---------- */
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.page .panel + .panel, .page .panel + .layout, .page .layout + .panel, .page .kpis + .panel, .stack > .panel + .panel { margin-top: 16px; }
details > summary { cursor: pointer; font-weight: 500; font-size: 14.5px; }
details[open] > summary { margin-bottom: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row > h2 { margin-bottom: 0; }
.panel > .row:first-child { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px; }
.layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; align-content: start; }
.layout > *, .stack > *, .grid2 > *, .grid3 > *, .grid4 > * { min-width: 0; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.actions.start { justify-content: flex-start; margin-top: 12px; }
.summary-line { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; margin: 0 0 12px; font-size: 14.5px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 420px; }
.toolbar select { width: auto; min-width: 200px; max-width: 340px; }
.page .layout > .panel + .panel, .page .layout > .stack + .stack, .page .pano-grid > .panel + .panel, .page .dash-grid > * + * { margin-top: 0; }
.foot-hint { margin-top: 14px; }
.unit-pick { width: auto; min-width: 150px; min-height: 38px; padding: 6px 8px; }
.cmp-table td:first-child { white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--tint); border: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; vertical-align: middle; }
.pill.ok, .st-pagado, .st-completa { background: var(--ok-tint); border-color: #bfe0cd; color: var(--ok); }
.pill.warn, .st-pendiente { background: var(--warn-tint); border-color: #ecd7a8; color: var(--warn); }
.st-parcial { background: var(--orange-tint); border-color: #f2cfac; color: var(--orange); }
.st-completo, .st-emitida { background: var(--violet-tint); border-color: #d6cbf6; color: var(--violet); }
.st-facturado { background: var(--primary-tint); border-color: #c8d5ee; color: var(--primary); }
.st-enviado, .st-enviada { background: var(--info-tint); border-color: #c4dcee; color: var(--info); }
.st-cerrado, .st-anulado, .st-anulada { background: var(--tint); color: var(--muted); }
.pill.danger, .st-vencida { background: var(--danger-tint); border-color: #f0c9c3; color: var(--danger); }
.st-contado { background: var(--ok-tint); border-color: #bfe0cd; color: var(--ok); }
.st-credito { background: var(--primary-tint); border-color: #c8d5ee; color: var(--primary); }
.prio { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; font-weight: 700; background: var(--tint); color: var(--muted); border: 1px solid var(--line); }
.prio-1 { background: var(--danger-tint); color: var(--danger); border-color: #f0c9c3; }

/* Pestañas: subrayado bajo la pestaña elegida */
.tabs { display: flex; gap: 4px; margin: -2px 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { min-height: 42px; padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--ink-2); font-weight: 500; margin-bottom: -1px; }
.tabs button:hover { background: none; color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabs .count { background: var(--line-strong); color: var(--ink); }
.tabs button[aria-selected=true] .count { background: var(--primary); color: #fff; }

/* Indicadores en una franja */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.kpis > * { background: var(--surface); padding: 16px 20px; border: 0; border-radius: 0; min-width: 0; text-align: left; display: block; white-space: normal; min-height: 0; color: inherit; font-weight: 400; }
.kpis > button:hover { background: #f8fafd; }
.kpis label { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0; }
.kpis small { display: block; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.kpis .bad .metric { color: var(--danger); }
.kpis .warnk .metric { color: var(--orange); }
.metric { font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin: 4px 0 2px; overflow-wrap: anywhere; }

.ledger-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row > span { min-width: 0; }
.ledger-row small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-top: 2px; }
.ledger-row > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 12px; text-align: right; }
.ledger-row.voided > span strong { color: var(--muted); text-decoration: line-through; }

table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th { padding: 10px 12px; font-size: 12.5px; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; }
td small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
th.num, td.num { text-align: right; }
tr.voided td { color: var(--muted); }
tr.voided td strong { text-decoration: line-through; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8fafd; }
.tablewrap { overflow-x: auto; }
.panel.tablewrap { padding: 4px 10px; }
.cell-actions { white-space: nowrap; text-align: right; }
.cell-actions button + button { margin-left: 6px; }

.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-bottom: 16px; }
.filter-row .field { margin: 0; }
.filter-row input[type=date] { min-width: 150px; }
.filter-row select { min-width: 150px; }

progress.bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 70px; height: 6px; border: 0; border-radius: 3px; background: var(--line); overflow: hidden; margin: 6px 0 2px; }
progress.bar::-webkit-progress-bar { background: var(--line); border-radius: 3px; }
progress.bar::-webkit-progress-value { background: var(--primary); border-radius: 3px; }
progress.bar::-moz-progress-bar { background: var(--primary); border-radius: 3px; }

/* ---------- Opciones de un toque y piezas de captura ---------- */
fieldset.field { min-width: 0; margin: 0 0 14px; padding: 0; border: 0; }
fieldset.field > legend { margin-bottom: 6px; padding: 0; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.options { display: flex; flex-wrap: wrap; gap: 6px; }
.option { position: relative; margin: 0; font-weight: 400; }
.option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.option span { display: flex; flex-direction: column; justify-content: center; min-height: 42px; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.3; }
.option small { margin-top: 1px; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.option:hover span { border-color: var(--primary); }
.option input:checked + span { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-tint); color: var(--primary); }
.option input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.option input:disabled { cursor: not-allowed; }
.option input:disabled + span { opacity: .4; border-style: dashed; }
.form-more { margin: 2px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--tint); }
.form-more > summary { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.form-more[open] > summary { margin-bottom: 12px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.quick button { min-height: 32px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; }

/* Buscador con resultados (productos y clientes) */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; min-width: 300px; max-height: 330px; overflow: auto; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.ac-list button { display: flex; justify-content: space-between; gap: 12px; width: 100%; min-height: 0; padding: 9px 10px; border: 0; border-radius: 8px; text-align: left; white-space: normal; font-weight: 500; }
.ac-list button[aria-selected=true], .ac-list button:hover { background: var(--primary-tint); }
.ac-list small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.ac-list .right { text-align: right; white-space: nowrap; font-size: 13.5px; }
.ac-list .none { color: var(--danger); }
.ac-empty { padding: 8px 10px; margin: 0; }

/* ---------- Vender ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 380px); gap: 18px; align-items: start; }
.pos-main { display: grid; gap: 14px; min-width: 0; }
.searchbig input { font-size: 17px; min-height: 52px; padding: 12px 16px; }
.cart td { vertical-align: middle; }
.cart input { width: 96px; min-height: 38px; padding: 6px 8px; text-align: right; }
.cart .warn-text { color: var(--danger); font-size: 12.5px; }
.ticket { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.ticket .total { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; margin: 2px 0 4px; color: var(--primary); }
.client-box { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.client-box strong { display: block; }
.change-line { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0 0; color: var(--ok); font-size: 14px; }
.change-line strong { font-size: 20px; }
.last-sale { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px 10px 16px; border-radius: var(--radius-sm); background: var(--ok-tint); color: var(--ok); font-size: 14px; }

/* ---------- Pedido ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 18px; margin: 0; }
.facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 1px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.facts .wide-fact { grid-column: 1 / -1; }
.facts dd small { display: block; font-weight: 400; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 7px 0 7px 20px; border-left: 2px solid var(--line); font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.timeline li.done::before { background: var(--ok); }
.timeline li.now::before { background: #d38a10; box-shadow: 0 0 0 3px var(--warn-tint); }
.timeline small { display: block; color: var(--muted); }
.balance-pend { color: var(--orange); font-weight: 700; }
.balance-zero { color: var(--ok); font-weight: 600; }
.lines-form td { vertical-align: middle; padding: 8px 8px; }
.lines-form input { min-height: 40px; padding: 7px 9px; }
.lines-form .q input { width: 96px; text-align: right; }
.lines-form .p input { width: 108px; text-align: right; }
.lines-form .prod { min-width: 260px; }
.lines-form .prod small { display: block; margin-top: 3px; }
.send-input { width: 100px; text-align: right; font-weight: 600; min-height: 38px; padding: 6px 8px; }
.send-list { display: grid; margin: 8px 0 14px; border-top: 1px solid var(--line); }
.send-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 100px 130px; gap: 6px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.send-info small { display: block; color: var(--muted); }
.send-fig { text-align: right; }
.send-fig small { display: block; color: var(--muted); font-size: 12px; }
.send-fig b { font-size: 16px; }
.send-in label { margin: 0 0 2px; font-size: 12px; text-align: right; }
.send-in .send-input { width: 100%; }
.send-in small { display: block; text-align: right; }
.doc-head { padding-right: 52px; }
.action-list { display: grid; gap: 4px; margin-top: 14px; }
.action-list details { border-top: 1px solid var(--line); padding: 10px 0 2px; }
.action-list details > summary { color: var(--primary); font-weight: 600; }
.action-list details.danger > summary { color: var(--danger); }

/* ---------- Ventanas ---------- */
dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 26px 26px 22px; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: auto; }
dialog.big { width: min(980px, calc(100% - 24px)); }
dialog.doc-dialog { width: min(1060px, calc(100% - 24px)); background: var(--canvas); }
dialog::backdrop { background: rgba(16, 26, 48, .42); }
dialog h2 { font-size: 21px; margin: 0 44px 8px 0; }
dialog .close { position: absolute; top: 16px; right: 16px; width: 36px; min-height: 36px; border-color: transparent; background: var(--tint); }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: rise .16s ease-out; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.modal-msg { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--info-tint); color: var(--info); font-size: 14px; }
.modal-msg.error { background: var(--danger-tint); color: var(--danger); }

/* Comprobante de venta (impresora de 80 mm) */
.receipt { font-size: 14px; }
.receipt .center { text-align: center; }
.receipt table { margin: 8px 0; font-size: 13px; }
.receipt th, .receipt td { padding: 6px 4px; }
.receipt .total { font-size: 28px; font-weight: 600; }

/* Nota de envío: el mismo formato que la de papel */
.doc { background: #fff; color: #111; border: 1px solid #1c2f6b; padding: 18px 22px 26px; font-size: 14px; line-height: 1.4; position: relative; }
.doc .d-business { text-align: center; color: #1c2f6b; font-weight: 700; font-size: 20px; }
.doc .d-title { text-align: right; color: #1c2f6b; font-weight: 700; font-size: 26px; line-height: 1.15; margin-top: 12px; }
.doc .d-top { display: flex; justify-content: space-between; gap: 16px; margin-top: 16px; font-size: 15px; }
.doc .d-top .right { text-align: right; }
.doc .d-blue { color: #1c2f6b; }
.doc .d-bar { height: 12px; background: var(--doc); margin: 14px -22px 10px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc .d-parts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.doc .d-parts p { margin: 3px 0; }
.doc .d-ref { text-align: center; font-weight: 700; margin: 22px 0 8px; font-size: 15px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.doc th { background: var(--doc); color: #fff; text-transform: uppercase; font-size: 11.5px; padding: 7px 5px; text-align: center; border: 1px solid var(--doc); white-space: normal; font-weight: 600; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc td { border: 1px dotted #777; padding: 4px 6px; text-align: center; vertical-align: middle; }
.doc td.d-desc { text-align: left; }
.doc .d-boxes { margin: 30px 0 0 70px; font-size: 15px; }
.doc .d-boxes div { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.doc .d-box { display: inline-block; width: 70px; height: 24px; border: 1px solid #333; text-align: center; line-height: 22px; font-weight: 700; }
.doc .d-sign { margin-top: 16px; font-size: 15px; }
.doc .d-sign .d-line { display: grid; grid-template-columns: 80px 1fr 64px 1fr; gap: 8px; align-items: end; margin: 8px 0 0 60px; }
.doc .d-rule { border-bottom: 1px solid #333; min-height: 22px; text-align: center; }
.doc .d-final { width: 340px; max-width: 100%; margin: 54px auto 0; text-align: center; font-size: 15px; border-top: 1px solid #333; padding-top: 4px; }
.doc .d-void { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: 84px; font-weight: 800; color: rgba(179, 57, 47, .22);
  border: 8px solid rgba(179, 57, 47, .22); padding: 0 28px; pointer-events: none; }

/* ---------- Tablero ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mini-row:last-child { border-bottom: 0; }
.mini-row small { display: block; color: var(--muted); }
.mini-row .right { text-align: right; white-space: nowrap; }

/* ---------- Entrada ---------- */
#auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--primary); }
.auth-card { width: min(440px, 100%); padding: 30px 28px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card .brand { padding: 0 0 22px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card form { margin: 18px 0 14px; }
.auth-card button.primary { min-height: 48px; font-size: 16px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: none; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14.5px; box-shadow: var(--shadow); text-align: center; }

/* ---------- Seguimiento de requisiciones (Pendientes) ---------- */
.count.count-danger { background: var(--danger); }
.count.count-warn { background: #d38a10; }
.kpis .okk .metric { color: var(--ok); }
.kpis > button.picked { box-shadow: inset 0 -3px 0 var(--primary); background: #f8fafd; }
.kpis-6 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; vertical-align: middle; background: var(--line-strong); }
.dot-rojo { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-tint); }
.dot-amarillo { background: #d38a10; box-shadow: 0 0 0 3px var(--warn-tint); }
.dot-verde { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.seg button { min-height: 34px; padding: 5px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font-size: 13.5px; }
.seg button:hover { background: var(--tint); }
.seg button[aria-pressed=true] { background: var(--primary); color: #fff; }
.seg button[aria-pressed=true] .count { background: #fff; color: var(--primary); }
.seg .count { background: var(--line-strong); color: var(--ink); margin-left: 2px; }
.fu-filters select { width: auto; min-width: 180px; }
.fu-filters input[type=search] { max-width: 300px; }
.fu-list { display: grid; gap: 10px; margin-bottom: 14px; }
.fu-row { display: grid; grid-template-columns: 210px minmax(0, 1fr) 250px; gap: 8px 22px; padding: 16px 20px; background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--radius); }
.fu-row.lvl-rojo { border-left-color: var(--danger); }
.fu-row.lvl-amarillo { border-left-color: #d38a10; }
.fu-row.lvl-verde { border-left-color: var(--ok); }
.fu-state { display: flex; gap: 12px; align-items: flex-start; }
.fu-state .dot { margin-top: 6px; }
.fu-state small { display: block; color: var(--muted); }
.fu-timing { font-size: 15.5px; }
.lvl-rojo .fu-timing { color: var(--danger); }
.lvl-amarillo .fu-timing { color: var(--warn); }
.fu-main { min-width: 0; }
.fu-main p { margin: 2px 0 0; }
.fu-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 16px; font-weight: 600; }
.fu-title a { color: var(--ink); text-decoration: none; }
.fu-title a:hover { text-decoration: underline; }
.fu-who { color: var(--ink-2); font-size: 14px; }
.fu-progress { display: flex; align-items: center; gap: 10px; max-width: 360px; margin-top: 8px; }
.fu-progress small { color: var(--muted); white-space: nowrap; }
.fu-missing { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; font-size: 13.5px; color: var(--ink-2); }
.fu-missing .buy { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--orange-tint); color: var(--orange); font-size: 12px; font-weight: 600; }
.fu-missing .ready { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--ok-tint); color: var(--ok); font-size: 12px; font-weight: 600; }
.fu-next { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; text-align: right; }
.fu-next p { margin: 0; font-size: 14px; font-weight: 500; }
.fu-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.print-only { display: none; }

/* Panorama de cumplimiento */
.cmp-table tr.picked td { background: var(--primary-tint); }
.cmp-bar-cell { width: 45%; min-width: 120px; vertical-align: middle; }
.cmp-bar { display: flex; height: 14px; min-width: 4px; border-radius: 4px; overflow: hidden; background: var(--line); }
.cmp-bar span, .legend i { display: block; height: 100%; }
.seg-ok { background: var(--ok); }
.seg-late { background: var(--danger); }
.seg-open { background: #9fb0cc; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }

/* ---------- Catálogos ---------- */
.tree { display: grid; }
.tree-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tree-row:last-child { border-bottom: 0; }
.tree-row.sub { padding-left: 22px; position: relative; }
.tree-row.sub::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 50%; width: 10px; border-left: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.tree-row.off strong { color: var(--muted); text-decoration: line-through; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { min-height: 32px; padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.tag.off { color: var(--muted); text-decoration: line-through; border-style: dashed; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 11px; border-radius: 999px; background: var(--primary-tint); color: var(--primary); font-size: 13px; font-weight: 500; }
.chip-x { min-height: 24px; width: 24px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--primary); font-size: 16px; }
.chip-x:hover { background: rgba(11, 42, 91, .12); }
.chip-add { display: inline-flex; flex: 1 1 200px; gap: 6px; }
.chip-add input { min-height: 34px; padding: 5px 8px; border: 0; box-shadow: none; }
.chip-add input:focus { box-shadow: none; }
.contacts { display: grid; gap: 8px; margin-bottom: 8px; }
.contact-row { display: grid; grid-template-columns: 1.3fr 1fr 0.9fr 1.3fr auto auto; gap: 6px; align-items: center; }
.contacts[data-invoices="0"] .contact-row { grid-template-columns: 1.3fr 1fr 0.9fr 1.3fr auto; }
.contact-row input { min-height: 40px; padding: 7px 9px; font-size: 14px; }
label.check.mini { margin: 0; font-size: 13px; gap: 6px; white-space: nowrap; }
.product-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 12px; }
.product-head > div { min-width: 0; flex: 1; }
.product-head .facts { margin-top: 10px; }
.product-head .photo { width: 150px; height: 150px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); flex: none; background: var(--tint); }
.photo-field { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.photo-field .field { flex: 1 1 220px; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 14px; }
.icon.tiny { width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Punto de venta 1.2 ---------- */
kbd { display: inline-block; padding: 1px 6px; border: 1px solid currentColor; border-radius: 5px; font: 600 11px/1.4 var(--font); opacity: .7; }
.pos2 { display: grid; gap: 14px; }
.pos-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.held { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; max-width: 100%; }
.held-tab { flex-direction: column; align-items: flex-start; gap: 0; min-height: 46px; padding: 6px 14px; border-radius: 12px; background: var(--surface); min-width: 120px; }
.held-tab small { color: var(--muted); font-weight: 400; font-size: 12px; }
.held-tab.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-tint); color: var(--primary); }
.held-new { min-height: 46px; border-style: dashed; border-radius: 12px; color: var(--ink-2); }
.cash-chip { min-height: 40px; border-radius: 999px; padding: 6px 14px; font-size: 13.5px; }
.cash-chip.on { color: var(--ok); border-color: #bfe0cd; background: var(--ok-tint); }
.cash-chip.off { color: var(--danger); border-color: #f0c9c3; background: var(--danger-tint); }
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: 18px; align-items: start; }
.pos-left { display: grid; gap: 12px; min-width: 0; }
.pos-search { position: relative; }
.pos-search input { font-size: 17px; min-height: 54px; padding: 12px 56px 12px 18px; border-radius: 14px; border-width: 1.5px; }
.pos-search kbd { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.cat-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.cat-chips button { min-height: 36px; padding: 5px 14px; border-radius: 999px; font-size: 13.5px; white-space: nowrap; background: var(--surface); }
.cat-chips button[aria-selected=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 8px; min-height: 0; padding: 10px; border-radius: 14px; text-align: left; white-space: normal; background: var(--surface); }
.tile:hover { border-color: var(--primary); box-shadow: 0 6px 18px rgba(16, 26, 48, .08); background: var(--surface); }
.tile:active { transform: scale(.98); }
.tile img, .tile-ini { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 9px; background: var(--tint); }
.tile-ini { display: grid; place-items: center; font-size: 26px; font-weight: 700; letter-spacing: .02em; color: var(--primary); }
.hue-0 { background: #e6ecf7; color: #0b2a5b; } .hue-1 { background: #e3f3ea; color: #1f7a4d; } .hue-2 { background: #fff3da; color: #8a5a0b; }
.hue-3 { background: #efeafd; color: #5b3cc4; } .hue-4 { background: #ffeedd; color: #a44a0a; } .hue-5 { background: #e5f0f8; color: #24577e; }
.tile-name { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 34px; }
.tile-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.tile-foot strong { font-size: 15px; color: var(--primary); }
.tile-foot small { color: var(--muted); font-size: 11.5px; font-weight: 400; text-align: right; }
.tile.out { opacity: .6; }
.tile.out .tile-foot small { color: var(--danger); }
.mult { grid-column: 1 / -1; margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--primary-tint); color: var(--primary); font-size: 14px; }
.pos-ticket { position: sticky; top: 84px; display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; max-height: calc(100vh - 100px); overflow: auto; }
.pos-ticket .field { margin: 0; }
.pos-ticket .client-box { margin: 0; padding-bottom: 10px; }
.client-acts { display: flex; gap: 6px; }
.recent { display: flex; flex-wrap: wrap; gap: 6px; }
.recent:empty { display: none; }
.chip-btn { min-height: 30px; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; background: var(--tint); }
.cart { display: grid; gap: 2px; max-height: 42vh; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.cart .empty { padding: 18px 8px; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "step price" "step sub"; gap: 4px 10px; align-items: center;
  padding: 10px 2px; border-bottom: 1px solid var(--line); position: relative; }
.cart-line { grid-template-columns: minmax(0, 1fr) 84px 84px 26px; grid-template-areas: "name name name x" "step price sub sub"; }
.cl-name { grid-area: name; min-width: 0; }
.cl-name strong { display: block; font-size: 13.5px; line-height: 1.3; }
.cl-name small { color: var(--muted); font-size: 12px; }
.stepper { grid-area: step; display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; width: max-content; }
.stepper button { min-height: 34px; width: 34px; padding: 0; border: 0; border-radius: 0; font-size: 18px; background: var(--tint); }
.stepper input { width: 64px; min-height: 34px; border: 0; border-radius: 0; text-align: center; padding: 4px; font-weight: 600; }
.cart-price { grid-area: price; min-height: 34px; padding: 4px 8px; text-align: right; font-size: 14px; }
.cl-sub { grid-area: sub; text-align: right; font-size: 15px; }
.cl-x { grid-area: x; align-self: start; min-height: 26px; width: 26px; padding: 0; border: 0; color: var(--muted); font-size: 18px; background: none; }
.cl-x:hover { color: var(--danger); background: var(--danger-tint); }
@keyframes flash { from { background: var(--primary-tint); } }
.cart-line.flash { animation: flash .9s ease-out; }
.ticket-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-top: 4px; }
.ticket-total strong { font-size: 38px; letter-spacing: -.03em; color: var(--primary); line-height: 1.1; }
.ticket-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
button.charge { min-height: 56px; font-size: 18px; border-radius: 14px; }
button.charge kbd { border-color: rgba(255, 255, 255, .6); }
.pos-mobilebar { display: none; }
.charge-total { font-size: 48px; font-weight: 600; letter-spacing: -.03em; color: var(--primary); margin: 2px 0 14px; }
.big-input { font-size: 24px; min-height: 56px; font-weight: 600; }
.bills button { min-height: 42px; padding: 6px 16px; font-size: 15px; font-weight: 600; }
.pay-row { display: grid; grid-template-columns: 110px 1fr 1.4fr auto; gap: 8px; align-items: center; margin: 8px 0; }
.change-big { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: baseline; margin: 14px 0 6px; padding: 12px 14px; border-radius: 12px; background: var(--tint); font-size: 15px; }
.change-big .chg { color: var(--ok); font-size: 18px; }
.change-big .chg strong { font-size: 26px; }
.receipt .pays { font-size: 12.5px; }

/* ---------- Cotizaciones ---------- */
.client-chip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 10px 14px; border: 1px solid var(--primary); border-radius: var(--radius-sm); background: var(--primary-tint); }
.client-chip strong { display: block; color: var(--primary); }
.client-chip small { color: var(--ink-2); }
.quote-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; margin-top: 14px; }
.quote-doc .d-title { font-size: 24px; }
.quote-doc .d-rev { font-size: 14px; font-weight: 600; }
.quote-doc td.d-num, .quote-doc th:nth-child(4), .quote-doc th:nth-child(5) { text-align: right; }
.quote-doc tfoot td { border: 0; padding-top: 8px; font-size: 15px; }
.quote-doc .d-words { margin: 12px 0 4px; }
.quote-doc .d-terms { margin-top: 16px; }
.quote-doc .d-terms dl { display: grid; grid-template-columns: 150px 1fr; gap: 3px 12px; margin: 6px 0 0; }
.quote-doc .d-terms dt { font-weight: 600; }
.quote-doc .d-terms dd { margin: 0; }
.quote-doc .d-code { margin-top: 26px; color: #1c2f6b; font-size: 13px; }
.quote-doc .d-final { margin-top: 70px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.inline-form .field { flex: 1 1 260px; margin: 0; }

/* ---------- Panorama general ---------- */
.pano-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; }
.pano { border-top: 4px solid var(--line-strong); }
.pano.bad { border-top-color: var(--danger); }
.pano.warn { border-top-color: #d38a10; }
.pano.ok { border-top-color: var(--ok); }
.pano.muted { opacity: .65; }
.pano-metric { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.pano-metric small { font-size: 13px; font-weight: 500; color: var(--muted); }
.pano.bad .pano-metric { color: var(--danger); }
.pano .mini-row .dot { width: 9px; height: 9px; margin-right: 4px; }

/* ---------- Pantallas medianas ---------- */
@media (max-width: 1180px) {
  #app { grid-template-columns: 210px minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fu-row { grid-template-columns: 180px minmax(0, 1fr); }
  .pos-grid { grid-template-columns: minmax(0, 1fr) minmax(310px, 350px); }
  .quote-layout { grid-template-columns: minmax(0, 1fr); }
  .fu-next { grid-column: 2; flex-direction: row; align-items: center; text-align: left; }
}

/* ---------- Teléfono y tableta: el menú se desliza desde la izquierda ---------- */
@media (max-width: 900px) {
  #app { display: block; }
  #sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 84vw); height: 100dvh; background: var(--canvas); transform: translateX(-102%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  #app.menu-open #sidebar { transform: none; visibility: visible; box-shadow: var(--shadow); transition: transform .2s ease; }
  #menu-button { display: inline-flex; border-color: transparent; background: var(--surface); }
  #workspace { padding: 0 14px 40px; }
  .topbar { margin: 0 -14px 14px; padding: 10px 14px; min-height: 60px; gap: 10px; }
  .topbar .date { display: none; }
  .pos, .layout, .dash-grid, .pos-grid { grid-template-columns: minmax(0, 1fr); }
  .pos-ticket { position: static; max-height: none; }
  .pos-mobilebar { display: flex; position: sticky; bottom: 8px; z-index: 15; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px;
    border-radius: 16px; background: var(--ink); color: #fff; box-shadow: var(--shadow); }
  .pos-mobilebar button { min-height: 44px; padding: 8px 22px; background: #fff; color: var(--ink); border-color: #fff; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .ticket { position: static; }
  .grid3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  #page-tools:empty { display: none; }
  #page-tools { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  #page-tools > * { flex: none; }
  .tool span { display: none; }
  .grid2, .grid4 { grid-template-columns: minmax(0, 1fr); }
  .panel, .card { padding: 16px; }
  dialog { padding: 22px 16px 18px; width: calc(100% - 12px); }
  .filter-row .field { flex: 1 1 140px; }
  .filter-row input[type=date], .filter-row select { min-width: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > * { padding: 14px 16px; }
  .metric { font-size: 22px; }
  .hide-phone { display: none; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc { padding: 12px; font-size: 12px; }
  .doc .d-parts { grid-template-columns: 1fr; gap: 6px; }
  .doc .d-sign .d-line { margin-left: 0; grid-template-columns: 64px 1fr; }
  .doc .d-boxes { margin-left: 0; }
  .send-row { grid-template-columns: 1fr 1fr 1.3fr; }
  .send-info { grid-column: 1 / -1; }
  .send-fig { text-align: left; }
  .fu-row { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .fu-next { grid-column: auto; flex-direction: column; align-items: stretch; }
  .fu-actions { justify-content: flex-start; }
  .seg { width: 100%; }
  .fu-filters select, .fu-filters input[type=search], .toolbar select { max-width: none; width: 100%; }
  .pay-row { grid-template-columns: 1fr 1fr; }
  .quote-doc .d-terms dl { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-row, .contacts[data-invoices="0"] .contact-row { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .product-head { flex-direction: column; }
  .product-head .photo { width: 100%; height: 200px; }
  .kpis-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---------- Impresión: solo el documento abierto ---------- */
@media print {
  @page { margin: 9mm; }
  body { background: #fff; }
  body > *:not(dialog) { display: none !important; }
  dialog, dialog.big, dialog.doc-dialog { position: static; display: block; width: 100%; max-width: none; max-height: none; height: auto; margin: 0; padding: 0; box-shadow: none; border-radius: 0; background: #fff; overflow: visible; }
  dialog .actions, dialog .close, dialog .no-print { display: none !important; }
  .receipt { max-width: 76mm; margin: auto; }
  .receipt th, .receipt td { padding: 4px 2px; font-size: 11px; }
  .doc { font-size: 12px; padding: 12px 14px 18px; }
  .doc .d-bar { margin: 10px -14px 8px; }
  .print-only { display: block; }
  body[data-page=quotes] > *:not(#app), body[data-page=quotes] #sidebar, body[data-page=quotes] .topbar, body[data-page=quotes] .no-print, body[data-page=quotes] #error { display: none !important; }
  body[data-page=quotes] #app, body[data-page=quotes] #workspace, body[data-page=quotes] .quote-layout { display: block !important; padding: 0; margin: 0; }
  body[data-page=quotes]:has(dialog[open]) #app { display: none !important; }
  .print-sheet .kpis { grid-template-columns: repeat(3, 1fr); }
  .print-sheet .layout { grid-template-columns: 1fr 1fr; }
  .print-table th, .print-table td { padding: 5px 6px; font-size: 11.5px; }
  .dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cmp-bar span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Compras, cuentas por pagar y bodegas (1.3) ---------- */
.aging-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 110px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.aging-row strong { text-align: right; }
.aging-bar { height: 10px; border-radius: 5px; background: var(--tint); overflow: hidden; }
.aging-bar i { display: block; height: 100%; min-width: 0; border-radius: 5px; background: var(--ok); }
.aging-bar i.warn { background: #d38a10; }
.aging-bar i.bad { background: var(--danger); }
.pos-bar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.wh-pick { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 0 4px 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); }
.wh-pick select { border: 0; min-height: 34px; padding: 4px 6px; width: auto; background: transparent; font-size: 13.5px; font-weight: 500; }
.wh-pick .icon { width: 17px; height: 17px; }
.mini-row.voided strong { text-decoration: line-through; color: var(--muted); }
@media (max-width: 640px) { .aging-row { grid-template-columns: 90px minmax(0, 1fr) 90px; } }
.layout.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.page .panel + .layout.even { margin-top: 16px; }
@media (max-width: 900px) { .layout.even { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- transporte (1.4) */
.load { display: grid; gap: 4px; margin: 8px 0; }
.load-bar { height: 12px; border-radius: 6px; background: var(--tint); border: 1px solid var(--line); overflow: hidden; }
.load-bar i { display: block; height: 100%; min-width: 0; background: var(--ok); border-radius: 6px; transition: width .2s; }
.load-bar.near i { background: #d38a10; }
.load-bar.over i { background: var(--danger); }
.trip-list { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.trip-card { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line-strong); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; }
.trip-card:hover { border-color: var(--primary); }
.trip-card.st-border-en_ruta { border-left-color: var(--info); }
.trip-card.st-border-planificado { border-left-color: var(--primary); }
.trip-card.st-border-terminado { border-left-color: var(--ok); }
.trip-card.st-border-anulado { border-left-color: var(--line); opacity: .7; }
.trip-head { display: flex; gap: 8px; align-items: center; }
.trip-head .hint { margin-left: auto; }
.trip-who { margin: 6px 0 0; }
.trip-who small { color: var(--muted); }
.trip-plan { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; margin: 10px 0; }
.trip-plan h3 { margin: 0 0 8px; font-size: 14px; }
.stop-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stop-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; background: var(--tint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }
.stop-list li.empty { display: block; }
.stop-list small, .pool-item small { display: block; color: var(--muted); font-size: 12px; }
.stop-n { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.stop-acts { display: flex; gap: 4px; }
.stop-pool { display: grid; gap: 6px; max-height: 340px; overflow: auto; }
.pool-item { display: flex; justify-content: space-between; gap: 10px; text-align: left; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px; }
.pool-item:hover { border-color: var(--primary); background: var(--primary-tint); }
.pool-item .right { text-align: right; white-space: nowrap; }
.finish-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 150px minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.finish-row small { display: block; color: var(--muted); }
.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 14px; }
.fleet > .panel { margin: 0; }
.truck.off { opacity: .65; }
.truck .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.delivery-box { margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint); }
.delivery-box .field { margin: 8px 0 0; }
.route-stop { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid #ccc; break-inside: avoid; }
.route-n { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--doc); color: var(--doc); display: grid; place-items: center; font-weight: 700; }
.route-body p { margin: 0 0 2px; }
.route-body p small { display: block; color: #555; font-size: 12px; }
.route-body table { width: 100%; margin: 4px 0; font-size: 12.5px; }
.route-body td { padding: 1px 6px 1px 0; border: 0; }
.route-body .d-line { display: grid; grid-template-columns: 60px 1fr 46px 120px; gap: 8px; align-items: end; margin-top: 6px; }
.route-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; text-align: center; }
.route-sign .d-rule { display: block; margin-bottom: 4px; }
@media (max-width: 760px) {
  .trip-plan { grid-template-columns: 1fr; }
  .finish-row { grid-template-columns: 1fr 1fr; }
  .finish-row > div { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- pedidos 1.5: captura tipo punto de venta y documentos */
.oadd { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 10px; align-items: end; }
.oadd-search input { font-size: 16.5px; min-height: 50px; padding: 11px 16px; border-radius: 12px; border-width: 1.5px; }
.oadd-qty label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.oadd-qty input { min-height: 50px; font-size: 18px; font-weight: 600; text-align: right; border-radius: 12px; }
.oadd > button { min-height: 50px; }
.oadd kbd { margin-left: 6px; opacity: .75; font-size: 11px; }
.oadd-picked { margin: 8px 2px 12px; min-height: 20px; font-size: 13.5px; }
.lines-form tr.flash td { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--ok-tint); } to { background: transparent; } }
.lines-form .empty-row td { padding: 22px; text-align: center; }
.attach-new { margin-top: 6px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--tint); }
.attach-new .field { margin: 0 0 4px; }
.file-list { display: grid; gap: 8px; }
.file-item { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.file-item small { display: block; color: var(--muted); font-size: 12.5px; }
.file-ic { display: grid; place-items: center; height: 38px; border-radius: 8px; background: var(--primary-tint); color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.attach-list { display: grid; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--tint); }
.attach-list .check small { margin-left: 4px; }
@media (max-width: 640px) {
  .oadd { grid-template-columns: minmax(0, 1fr) 96px; }
  .oadd > button { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- facturación FEL (1.6) */
.nit-field .inline { display: flex; gap: 6px; align-items: center; }
.nit-field .inline input { flex: 1 1 auto; min-width: 0; }
.fel-box { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--tint); }
.fel-box p { margin: 0; flex: 1 1 100%; }
.fel-pos { margin: 10px 0 4px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--primary-tint); }
textarea.raw { width: 100%; font-size: 12px; white-space: pre; overflow: auto; background: var(--tint); }

/* ---------------------------------------------------------------- NIT emisores y notas de crédito (1.7) */
.emitters { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.emitter { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 8px; }
.emitter.in-use { border-color: var(--ok); box-shadow: inset 4px 0 0 var(--ok); }
.emitter.off { opacity: .6; }
.emitter small { display: block; color: var(--muted); }
.emitter .row small { margin-top: 2px; }
.emitter .actions { margin: 0; }
.usage { display: grid; gap: 4px; }
.metric-line { margin: 10px 0 0; font-size: 18px; font-weight: 700; }
.small-input { width: 90px; text-align: right; min-height: 34px; }
.right-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
