/* Librería Zuly (base: 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) */
/* Ticket de 80 mm: una sola columna, puntos entre bloques, cifras tabulares. En pantalla se muestra al ancho del papel. */
.receipt { font-size: 13.5px; max-width: 320px; margin: 0 auto; font-variant-numeric: tabular-nums; color: #111; line-height: 1.35; }
.receipt.voided { opacity: .75; }
.rc-head { text-align: center; padding-bottom: 6px; }
.rc-logo { max-width: 120px; max-height: 64px; display: block; margin: 0 auto 6px; }
.rc-biz { font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.rc-tag { font-size: 12px; color: #444; margin-top: 1px; }
.rc-meta { font-size: 12px; color: #333; margin-top: 4px; }
.rc-rule { border-top: 1px dashed #777; margin: 8px 0; }
.rc-doc { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 4px; }
.rc-doc b { font-size: 16px; }
.rc-kv { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.rc-kv > span:first-child { color: #333; }
.rc-kv > span:last-child { text-align: right; }
.rc-kv small { color: #555; }
.rc-small { font-size: 12px; color: #555; }
.rc-lines { width: 100%; border-collapse: collapse; }
.rc-lines th { font-size: 11.5px; font-weight: 600; color: #333; text-align: left; padding: 2px 0 4px; border-bottom: 1px solid #ccc; }
.rc-lines td { padding: 5px 0; vertical-align: top; border-bottom: 1px dotted #ddd; }
.rc-lines tr:last-child td { border-bottom: 0; }
.rc-lines td small { display: block; color: #555; font-size: 11.5px; }
.rc-lines .q { width: 44px; white-space: nowrap; }
.rc-lines .num { text-align: right; white-space: nowrap; padding-left: 8px; }
.rc-total { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 6px; font-size: 15px; font-weight: 700; }
.rc-total b { font-size: 24px; }
.rc-foot { text-align: center; font-size: 12px; color: #333; }
.rc-foot > div { margin: 3px 0; }
.rc-sign { margin-top: 26px; font-size: 11.5px; }
.rc-sigline { width: 170px; margin: 0 auto 4px; border-top: 1px solid #333; }
.rc-thanks { margin-top: 10px; font-weight: 600; font-size: 13px; }
.rc-status { text-align: center; margin-top: 10px; }

/* Nota de envío: el mismo formato que la de papel */
.doc { background: #fff; color: #111; border: 1px solid var(--doc); padding: 18px 22px 26px; font-size: 14px; line-height: 1.4; position: relative; }
.doc .d-brand { display: grid; grid-template-columns: 110px 1fr 110px; align-items: start; gap: 12px; }
.doc .d-brand:not(:has(.d-logo)) { grid-template-columns: 110px 1fr 110px; }
.doc .d-logo { max-width: 110px; max-height: 64px; justify-self: start; }
.doc .d-business { grid-column: 2; text-align: center; color: var(--doc); font-weight: 700; font-size: 20px; }
.doc .d-business small { display: block; font-weight: 400; font-size: 12.5px; color: #444; }
.doc .d-title { grid-column: 1 / -1; text-align: right; color: var(--doc); font-weight: 700; font-size: 26px; line-height: 1.15; margin-top: 4px; }
.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: var(--doc); }
.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: var(--doc); 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: 72mm; margin: auto; font-size: 12px; color: #000; }
  .rc-biz { font-size: 15px; }
  .rc-total b { font-size: 20px; }
  .rc-lines td { padding: 3px 0; }
  .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; }

/* 1.8 · Familias de productos (variantes) y permisos */
.pill-mini { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--violet-tint); color: var(--violet); font-size: 11.5px; font-weight: 600; vertical-align: middle; }
.ac-list.ac-grid { min-width: min(560px, 92vw); max-height: 420px; }
.ac-grid-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 4px 6px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.ac-grid-head .hint { font-size: 12.5px; }
.ac-list .ac-grid-head button.link { width: auto; padding: 0; color: var(--primary); font-weight: 600; }
.ac-grid-table { overflow-x: auto; }
.ac-grid-table table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.ac-grid-table th { text-align: left; padding: 4px 6px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ac-grid-table td { padding: 2px; }
.ac-list button.ac-cell { display: block; text-align: center; padding: 6px 8px; border: 1px solid var(--line); background: var(--surface); }
.ac-list button.ac-cell small { margin: 0; }
.ac-list button.ac-cell.none strong { color: var(--danger); }
table.matrix th { white-space: nowrap; }
table.matrix td { padding: 4px; }
.cellbtn { display: block; width: 100%; min-height: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: right; font: inherit; cursor: pointer; }
.cellbtn:hover { background: var(--primary-tint); }
.cellbtn small { display: block; color: var(--muted); font-size: 12px; }
.count-cell { min-width: 96px; }
.count-cell input { width: 100%; text-align: right; padding: 6px 8px; }
.count-cell small { display: block; font-size: 12px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px 10px; margin: 0; background: var(--tint); }
.perm-group legend { font-weight: 600; font-size: 13.5px; padding: 0 4px; }
.perm-group .check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; margin: 6px 0; }
.perm-group .check input { margin-top: 2px; }
.tile.family { border-style: dashed; }
.tile-ini.fam { display: flex; flex-direction: column; gap: 2px; color: var(--violet); background: var(--violet-tint); }
.tile-ini.fam small { font-size: 12px; font-weight: 600; letter-spacing: 0; }
.family-pick .row { margin-bottom: 8px; }
table.vgrid { border-collapse: separate; border-spacing: 6px; }
table.vgrid th { text-align: left; font-size: 13px; color: var(--ink-2); white-space: nowrap; padding: 2px 4px; }
.vcell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 88px; min-height: 54px; padding: 6px 10px; border-radius: 10px; background: var(--surface); }
.vcell:hover { border-color: var(--primary); background: var(--primary-tint); }
.vcell small { color: var(--muted); font-size: 12px; font-weight: 400; }
.vcell.out strong { color: var(--danger); }
/* La cuadrícula de variantes ocupa todo el ancho de la zona de productos. */
.tiles > .family-pick { grid-column: 1 / -1; }
.family-pick .row { margin-bottom: 8px; }
.perm-group .check input { flex: none; width: 18px; height: 18px; }
table.price-grid { border-collapse: separate; border-spacing: 6px 4px; margin-bottom: 10px; }
table.price-grid th { text-align: left; font-size: 13px; color: var(--ink-2); white-space: nowrap; padding: 2px 6px 2px 0; }
table.price-grid input { width: 110px; text-align: right; }
table.price-grid .fill-row input { background: var(--tint); border-style: dashed; }

/* ---------- Reportes (1.9) ---------- */
.rep-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.rep-menu { padding: 10px 8px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.rep-menu h3 { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 10px 4px; }
.rep-menu h3:first-child { margin-top: 2px; }
.rep-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; color: var(--ink); min-height: 0; white-space: normal; line-height: 1.25; }
.rep-item:hover { background: var(--tint); }
.rep-item.active { background: var(--primary-tint); color: var(--primary); font-weight: 600; }
.rep-filters { padding: 14px 18px; }
.rep-head h2 { margin-bottom: 2px; }
.rep-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; }
.rep-controls .seg .hint { padding: 0 8px; align-self: center; font-size: 12.5px; }
.rep-range { display: flex; gap: 10px; align-items: flex-end; }
.rep-range .field { margin: 0; }
.rep-days label { font-size: 13px; color: var(--muted); margin-right: 6px; }
.rep-days input { width: 70px; text-align: right; }
.rep-pick { min-width: 320px; margin: 0; }
.rep-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.rep-chart { padding: 14px 18px; }
.rep-chart h3 { font-size: 14px; margin-bottom: 6px; }
svg.chart { width: 100%; height: auto; max-height: 280px; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .tick { font-size: 11.5px; fill: var(--ink-2); font-family: inherit; }
svg.chart rect:hover { opacity: .8; }
.donut-wrap { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.donut { width: 200px; height: 200px; flex: none; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 18px; flex: 1; }
.legend li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; font-size: 13.5px; }
.legend li b { font-weight: 600; }
.legend li small { grid-column: 2 / 4; color: var(--muted); font-size: 12px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.c0 { background: #0b2a5b; } .sw.c1 { background: #2f80ed; } .sw.c2 { background: #f2994a; } .sw.c3 { background: #27ae60; }
.sw.c4 { background: #9b51e0; } .sw.c5 { background: #eb5757; } .sw.c6 { background: #56ccf2; } .sw.c7 { background: #f2c94c; }
.rep-table th, .rep-table td { white-space: nowrap; }
.rep-table td.wrap { white-space: normal; min-width: 180px; }
.rep-table td.wrap-sm { white-space: normal; max-width: 220px; font-size: 13px; color: var(--ink-2); }
.rep-table tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); }
.rep-print-head { display: none; }
@media (max-width: 900px) {
  .rep-layout { grid-template-columns: 1fr; }
  .rep-menu { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .rep-menu h3 { width: 100%; }
  .rep-item { width: auto; }
}
@media print {
  body[data-page=reports] > *:not(#app), body[data-page=reports] #sidebar, body[data-page=reports] .topbar, body[data-page=reports] .no-print, body[data-page=reports] #error,
  body[data-page=reports] .rep-menu, body[data-page=reports] .rep-filters, body[data-page=reports] #page-tools { display: none !important; }
  body[data-page=reports] #app, body[data-page=reports] #workspace, body[data-page=reports] .rep-layout, body[data-page=reports] .rep-body { display: block !important; padding: 0; margin: 0; }
  body[data-page=reports] .rep-print-head { display: block; margin-bottom: 10px; }
  body[data-page=reports] .rep-print-head h1 { font-size: 18px; margin: 2px 0; }
  body[data-page=reports] .panel { box-shadow: none; border: 0; padding: 0; }
  body[data-page=reports] svg.chart { max-height: 220px; }
  body[data-page=reports] .rep-table th, body[data-page=reports] .rep-table td { font-size: 10.5px; padding: 3px 5px; }
}

/* ---------- Imagen del negocio (1.10) ---------- */
.logo.has-logo { background: #fff; border: 1px solid var(--line); padding: 3px; overflow: hidden; }
.logo.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-card .logo.has-logo { width: 52px; height: 52px; }
.brand-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 28px; }
.brand-grid h3 { margin: 10px 0 8px; font-size: 14px; }
.logo-drop { height: 120px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: repeating-conic-gradient(#f3f4f7 0 25%, #fff 0 50%) 0 0 / 16px 16px; display: grid; place-items: center; padding: 10px; }
.logo-drop { overflow: hidden; }
.logo-drop img { max-width: 100%; max-height: 100px; width: auto; height: auto; object-fit: contain; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.swatch { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; min-height: 0; }
.swatch .chip { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.swatch.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.custom-color { justify-content: flex-start; gap: 10px; margin: 10px 0 4px; }
.custom-color input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.custom-color input[type=text], #brand-hex { width: 100px; font-family: ui-monospace, monospace; }
.brand-preview { display: grid; grid-template-columns: 150px 1fr; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; min-height: 120px; }
.bp-side { background: var(--canvas); padding: 10px; border-right: 1px solid var(--line); }
.bp-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bp-brand img { width: 30px; height: 30px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); padding: 2px; }
.bp-letter { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.bp-brand strong { display: block; font-size: 12.5px; }
.bp-brand small { display: block; font-size: 10.5px; color: var(--muted); }
.bp-nav span { display: block; padding: 5px 8px; border-radius: 6px; font-size: 12px; }
.bp-nav span.on { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.bp-main { padding: 12px; background: var(--surface); }
.bp-bar { height: 8px; background: var(--doc); border-radius: 2px; margin-bottom: 12px; }
.bp-pill { background: var(--primary-tint); color: var(--primary); }
@media (max-width: 760px) { .brand-grid { grid-template-columns: 1fr; } }

/* =====================================================================================================
   1.11 · Sistema visual: minimalista, ordenado y limpio.
   Un solo color de acento (el de la marca); todo lo demás gris y blanco. Menos cajas, menos negritas,
   etiquetas en una sola forma. Estas reglas van al final y mandan sobre las anteriores.
   ===================================================================================================== */
:root {
  --canvas: #f3f4f6;
  --line: #e6e8ee;
  --line-strong: #d4d8e1;
  --tint: #f7f8fa;
  --muted: #6b7280;
  --ink-2: #3f4756;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 12px 36px rgba(16, 26, 48, .12);
  --font-size: 14.5px;
  /* Estados: tintas suaves, sin bordes de color. */
  --ok: #1f7a4d; --ok-tint: #e8f4ed;
  --danger: #b3392f; --danger-tint: #fbecea;
  --warn: #8a5a0b; --warn-tint: #fdf3e0;
  --orange: #9a4d12; --orange-tint: #fdeee2;
  --info: #3f4756; --info-tint: #eef0f4;
  --violet: #3f4756; --violet-tint: #eef0f4;
}
body { font-size: var(--font-size); }
h1 { font-size: 21px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; color: var(--ink); }
strong { font-weight: 600; }
label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.hint { font-size: 12.5px; }

/* Botones: solo uno lleno por pantalla; los demás, discretos. */
button, .button { border-color: var(--line-strong); font-weight: 500; font-size: 14px; min-height: 38px; box-shadow: 0 1px 1px rgba(16, 26, 48, .03); }
button:hover, .button:hover { background: var(--tint); border-color: var(--line-strong); }
button.primary, .button.primary { box-shadow: none; }
button.small, .button.small { min-height: 31px; font-size: 13px; }
button.danger { color: var(--danger); }
input, select, textarea { min-height: 40px; font-size: 14.5px; border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--primary-tint); }
.searchbig input { min-height: 48px; font-size: 16px; }

/* Menú lateral: igual de claro, con menos relieve. */
#sidebar { background: var(--canvas); border-right-color: var(--line); padding: 18px 12px 14px; }
#nav button { min-height: 38px; font-weight: 500; color: var(--ink-2); gap: 11px; }
#nav button .icon { width: 19px; height: 19px; stroke-width: 1.6; }
#nav button.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(16, 26, 48, .06); }
.nav-group + .nav-group { border-top-color: var(--line); }
.count { font-size: 11px; min-width: 19px; height: 19px; }
.topbar { min-height: 62px; }

/* Paneles y tablas: borde fino, sin sombras, más aire entre filas. */
.panel, .card { border-color: var(--line); border-radius: var(--radius); padding: 18px 20px; }
table { font-size: 14px; }
th { font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 10px; letter-spacing: .01em; }
td { padding: 10px 10px; border-bottom-color: var(--line); }
td strong { font-weight: 500; }
td small { font-size: 12px; }
tfoot td { font-weight: 600; border-top-color: var(--line-strong); }
tr.click:hover td { background: var(--tint); }

/* Indicadores: cifras limpias con una línea fina entre ellas, sin marco. */
.kpis { gap: 0; background: var(--surface); border: 1px solid var(--line); }
.kpis > * { padding: 14px 18px; border-left: 1px solid var(--line); }
.kpis > *:first-child { border-left: 0; }
.kpis label { font-size: 12.5px; font-weight: 500; }
.metric { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }

/* Etiquetas de estado: tinta suave, sin borde. */
.pill { border: 0; padding: 3px 9px; font-size: 12px; font-weight: 500; }
.st-completo, .st-emitida { background: var(--primary-tint); color: var(--primary); }
.st-facturado { background: var(--primary-tint); color: var(--primary); }
.st-enviado, .st-enviada { background: var(--info-tint); color: var(--info); }
.st-parcial { background: var(--orange-tint); color: var(--orange); }
.st-credito { background: var(--primary-tint); color: var(--primary); }
.pill.ok, .st-pagado, .st-completa, .st-contado { background: var(--ok-tint); color: var(--ok); }
.pill.warn, .st-pendiente { background: var(--warn-tint); color: var(--warn); }
.pill.danger, .st-vencida { background: var(--danger-tint); color: var(--danger); }

/* Pestañas y segmentos */
.tabs button { font-weight: 500; font-size: 14px; }
.tabs button[aria-selected=true] { font-weight: 600; }
.seg { border-color: var(--line); padding: 3px; border-radius: 10px; background: var(--tint); }
.seg button { min-height: 32px; font-size: 13.5px; box-shadow: none; }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 26, 48, .08); font-weight: 600; }
.seg button[aria-pressed=true] .count { background: var(--primary); color: #fff; }
.option span { font-weight: 500; font-size: 14px; min-height: 40px; }
.cat-chips button { font-weight: 500; background: var(--surface); }
.cat-chips button[aria-selected=true] { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Vender: la lista del ticket más calmada; el total es lo único grande. */
.ticket { border-radius: var(--radius); padding: 16px 18px; }
.ticket .total { font-size: 34px; }
.cart td strong, .tile-name { font-weight: 500; }
.tile { border-radius: 10px; }
.tile:hover { box-shadow: none; }
.tile-foot strong { font-weight: 600; }
.tile-ini { font-weight: 600; color: var(--ink-2); }
.client-box strong { font-weight: 600; }

/* Pedido: datos en una sola forma de etiqueta. */
.facts dt { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.facts dd { font-weight: 500; }
.timeline li.now::before { background: var(--warn); }

/* Reportes: menú ligero, filtros en una línea, gráfica con el color de la marca. */
.rep-menu { padding: 8px 6px; }
.rep-menu h3 { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 500; margin: 14px 10px 4px; }
.rep-item { font-size: 13.5px; padding: 6px 10px; color: var(--ink-2); }
.rep-item.active { font-weight: 600; }
.rep-filters { padding: 12px 18px; }
.rep-head h2 { font-size: 17px; }
.rep-kpis { border: 0; background: transparent; }
.rep-kpis > * { background: transparent; padding: 10px 0 10px 18px; }
.rep-kpis > *:first-child { padding-left: 0; }
.rep-chart { padding: 12px 16px 8px; }
svg.chart .grid { stroke: var(--line); }
svg.chart .tick { font-size: 11px; fill: var(--muted); }
.rep-table th { background: transparent; }
.rep-table td { padding: 8px 10px; }
.rep-table tfoot td { border-top-width: 1px; }
.legend li { font-size: 13px; }

/* Diálogos */
dialog { border-radius: 14px; padding: 22px 24px 20px; }
dialog h2 { font-size: 19px; }
.ac-list { border-radius: 10px; }
.ac-list button { font-weight: 500; }
/* Cuadros de producto: una sola tinta neutra (las iniciales de colores eran ruido); la familia, con la tinta de la marca. */
.tile-ini, .hue-0, .hue-1, .hue-2, .hue-3, .hue-4, .hue-5 { background: var(--tint); color: var(--ink-2); }
.tile-ini.fam { background: var(--primary-tint); color: var(--primary); }
.tile-foot strong { color: var(--ink); }
/* Botones que no son botones (menú, pestañas, listas): sin relieve. */
#nav button, .tabs button, .seg button, .rep-item, button.link, .ac-list button, .cat-chips button, .swatch, .logout, .kpis > button, .tile { box-shadow: none; }
.seg button[aria-pressed=true] { box-shadow: 0 1px 2px rgba(16, 26, 48, .08); }
.seg { gap: 2px; }
.seg button { padding: 4px 10px; }

/* =====================================================================================================
   1.12 · Letra Manrope, barra oscura en el color de la marca, encabezados con subtítulo, cifras en tarjetas,
   «Tu siguiente paso» y el recorrido de Pedidos.
   ===================================================================================================== */
@font-face { font-family: 'Manrope'; src: url('/fonts/manrope.woff2') format('woff2'); font-weight: 200 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; src: url('/fonts/manrope-ext.woff2') format('woff2'); font-weight: 200 800; font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root { --font: 'Manrope', 'Plex', 'Segoe UI', system-ui, sans-serif; --font-size: 14.5px; --canvas: #f4f5f2; --line: #e7e8e3; --tint: #f7f8f5; }
body { letter-spacing: -.005em; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16.5px; font-weight: 700; }
.metric { font-weight: 700; }
button, .button { font-weight: 600; }
.pill { font-weight: 600; }

/* Barra lateral oscura en el color de la marca. */
#sidebar { background: var(--side-bg); border-right: 0; color: #fff; padding: 20px 14px 14px; }
#sidebar .brand strong { color: #fff; font-weight: 700; }
#sidebar .brand small { color: rgba(255, 255, 255, .62); }
#sidebar .logo { background: var(--side-active); color: var(--side-bg); border: 0; }
#sidebar .logo.has-logo { background: #fff; }
#nav { gap: 6px; }
.nav-group { gap: 1px; }
.nav-group + .nav-group { border-top: 0; padding-top: 8px; }
.nav-group h4 { margin: 6px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
#nav button { color: rgba(255, 255, 255, .86); font-weight: 600; border-radius: 10px; }
#nav button:hover { background: rgba(255, 255, 255, .09); color: #fff; }
#nav button.active { background: var(--side-active); color: var(--side-bg); box-shadow: none; }
#nav button .count { background: rgba(255, 255, 255, .16); color: #fff; }
#nav button.active .count { background: var(--side-bg); color: #fff; }
#nav button .count-danger { background: var(--danger); }
#nav button .count-warn { background: #d99a1e; color: #1a1a1a; }
.session { border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 14px; color: rgba(255, 255, 255, .8); }
.session .who { display: flex; align-items: center; gap: 10px; }
.session .who strong { color: #fff; font-weight: 600; }
.session .who small, .session > small { color: rgba(255, 255, 255, .55); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.logout { color: rgba(255, 255, 255, .8); }
.logout:hover { background: rgba(255, 255, 255, .1); color: #fff; }
@media (max-width: 900px) { #sidebar { background: var(--side-bg); } }

/* Encabezado de pantalla: título, para qué sirve, un botón principal. */
.topbar { min-height: 76px; align-items: center; }
.title-block { order: 1; display: grid; gap: 1px; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.subtitle:empty { display: none; }
.topbar .date { order: 2; }

/* Cifras como tarjetas; la primera, resaltada. */
.kpis { gap: 12px; background: transparent; border: 0; border-radius: 0; overflow: visible; }
.kpis > * { background: var(--surface); border: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpis > *:first-child { border-left: 1px solid var(--line); background: var(--primary-tint); border-color: var(--primary-tint); }
.kpis > button:hover { background: var(--tint); }
.kpis > *:first-child:hover { background: var(--primary-tint); }
.kpis .metric { font-size: 26px; }
.rep-kpis { gap: 12px; }
.rep-kpis > * { padding: 14px 18px; background: var(--surface); }
.rep-kpis > *:first-child { background: var(--primary-tint); padding-left: 18px; }

/* Tablero: el siguiente paso, en una frase. */
.next-step { background: var(--primary-tint); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; display: grid; gap: 6px; justify-items: start; }
.next-step small { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.next-step h2 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.02em; line-height: 1.25; max-width: 40ch; }
.next-step p { margin: 0 0 6px; color: var(--ink-2); max-width: 60ch; }

/* Pedidos: el recorrido por etapas, arriba de las pestañas. */
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin-bottom: 14px; }
.stage { display: grid; gap: 2px; justify-items: start; padding: 12px 16px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--surface); text-align: left; min-height: 0; white-space: normal; box-shadow: none; }
.stage:first-child { border-left: 0; }
.stage small { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stage strong { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stage span { font-size: 12.5px; color: var(--muted); }
.stage:hover { background: var(--tint); }
.stage.on { background: var(--primary-tint); }
.stage.on small { color: var(--primary); }
@media (max-width: 760px) { .pipeline { grid-template-columns: repeat(2, 1fr); } .stage:nth-child(3) { border-left: 0; } .stage:nth-child(n+3) { border-top: 1px solid var(--line); } }

/* Listas: lo principal arriba, lo secundario abajo en gris (sin color en lo secundario). */
td strong { font-weight: 600; }
td small { color: var(--muted); }
.mini-row small { color: var(--muted); }
.title-block > * { order: 0; }

/* ---------- 1.16 · Proyectos ---------- */
.pry-section { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; background: var(--surface); }
.pry-section.current { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.pry-section .row { margin-bottom: 6px; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.pry-section table.compact td { padding: 5px 8px; }
.pry-section .lines-form { margin-top: 6px; }
.pre { white-space: pre-wrap; }
.span2 { grid-column: span 2; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pair input { min-width: 0; }
.totals-box { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: flex-end; padding: 12px 4px 0; border-top: 1px solid var(--line); margin-top: 8px; color: var(--muted); }
.totals-box strong { color: var(--text); margin-left: 6px; }
.totals-box .big, .totals-box .big strong { font-size: 18px; color: var(--primary); }
tr.warn-row td { background: #fff7ed; }
.panel.fel-box { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.panel.fel-box span { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel.fel-box small { color: var(--muted); }
@media (max-width: 720px) { .span2 { grid-column: auto; } .totals-box { justify-content: flex-start; } }

/* ---------- 1.17 · Buscador global ---------- */
.gsearch { order: 2; position: relative; flex: 0 1 340px; min-width: 160px; }
.gsearch input { width: 100%; padding-right: 30px; border-radius: 999px; background: var(--surface); }
.gsearch-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; pointer-events: none; }
.gsearch .ac-list button small { display: block; color: var(--muted); font-weight: 400; }
.gsearch .ac-list .gkind { flex: none; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); padding-top: 2px; min-width: 76px; }
@media (max-width: 900px) { .gsearch { order: 5; flex: 1 1 100%; } .gsearch-kbd { display: none; } }

/* ---------- 1.17 · Tablas como tarjetas en el teléfono ---------- */
@media (max-width: 640px) {
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; box-sizing: border-box; }
  table.cards thead, table.cards tfoot { display: none; }
  table.cards tr { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
  table.cards tr.click { cursor: pointer; }
  table.cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  table.cards td::before { content: attr(data-label); flex: 0 0 38%; text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
  table.cards td:first-child { padding-bottom: 6px; border-bottom: 1px dashed var(--line); font-size: 15.5px; }
  table.cards td:first-child::before { display: none; }
  table.cards td:first-child { justify-content: flex-start; text-align: left; }
  table.cards td.hide-phone { display: none; }
  table.cards td[data-label=""]::before { display: none; }
  table.cards td.cell-actions { justify-content: flex-end; }
  table.cards td.cell-actions::before { display: none; }
  table.cards td small { display: inline; margin-left: 6px; }
  table.cards td:empty { display: none; }
  table.cards td.num { font-variant-numeric: tabular-nums; }
  .tablewrap:has(table.cards) { overflow: visible; }
}

.quote-doc tr.d-section td { background: #f0f3f7; padding-top: 8px; padding-bottom: 8px; }
.quote-doc tr.d-sub td { padding: 3px 6px; color: var(--muted); border-bottom: 0; }
.quote-doc tfoot td { font-size: 13px; }
.pager { align-items: center; padding-top: 10px; }
.pager .hint { margin-right: auto; }

.file-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--canvas); }
details.muted summary { cursor: pointer; color: var(--muted); font-size: 13px; }

.gsearch-empty { padding: 8px 10px; white-space: normal; line-height: 1.4; }

/* ---------- Librería: presupuesto de la OPF (barra en vivo), bolsas y documento de la cotización ---------- */
.budget-bar { position: sticky; top: 76px; z-index: 12; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 16px 0; box-shadow: 0 8px 22px rgba(30, 12, 20, .10); }
.budget-bar[hidden] { display: none; }
.budget-bar > div { background: var(--surface); padding: 10px 14px; min-width: 0; }
.budget-bar label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 0; }
.budget-bar strong { display: block; font-size: 19px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.budget-bar small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.budget-bar .bb-state.ok { background: var(--ok-tint); }
.budget-bar .bb-state.ok strong, .budget-bar .bb-state.ok small { color: var(--ok); }
.budget-bar .bb-state.bad { background: var(--danger-tint); }
.budget-bar .bb-state.bad strong, .budget-bar .bb-state.bad small { color: var(--danger); }
.budget-bar > button { margin: 0; border: 0; border-radius: 0; min-height: 0; padding: 0 18px; background: var(--surface); color: var(--primary); font-weight: 600; }
.budget-bar > button:hover { background: var(--primary-tint); }
.budget-table td { vertical-align: top; }
.budget-table .kit-cell { min-width: 230px; }
.budget-table .kit-cell small { display: block; margin-top: 4px; }
.budget-table select { min-width: 110px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pick-list { display: grid; gap: 8px; margin: 12px 0 16px; }
.pick-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 12px 14px; text-align: left; white-space: normal;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: inherit; font-weight: 400; min-height: 0; }
.pick-row:hover { border-color: var(--primary); background: var(--primary-tint); }
.pick-row small { display: block; color: var(--muted); }
.option-row { flex-direction: row; gap: 12px; cursor: pointer; }
.option-row input { margin-top: 4px; }
.quote-doc .d-program { text-align: center; margin: 2px 0 10px; }
.quote-doc .d-program p { margin: 2px 0; }
.quote-doc .d-budget { margin: 6px 0 4px; font-size: 13px; }
.quote-doc .d-kits { margin: 10px 0 12px; font-size: 12.5px; }
.quote-doc .d-kits p { margin: 8px 0 2px; }
.quote-doc .d-kits ul { margin: 0 0 6px 18px; padding: 0; columns: 2; column-gap: 28px; }
@media (max-width: 900px) {
  .budget-bar { position: static; grid-template-columns: 1fr 1fr; }   /* en el teléfono la barra de arriba ya ocupa espacio: no se pega */
  .budget-bar > button { grid-column: 1 / -1; padding: 10px; }
  .quote-doc .d-kits ul { columns: 1; }
}
@media print { .budget-bar { display: none; } }
@media (max-width: 640px) {
  .budget-table thead { display: none; }
  .budget-table, .budget-table tbody { display: block; }
  .budget-table tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .budget-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .budget-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
  .budget-table td:first-child { grid-column: 1 / -1; padding-right: 44px; }
  .budget-table td.kit-cell { grid-column: 1 / -1; min-width: 0; }
  .budget-table td.num { text-align: left; align-self: end; padding-bottom: 8px; font-weight: 600; }
  .budget-table td.g-x { position: absolute; top: 30px; right: 0; }
  .budget-table input, .budget-table select { width: 100%; }
}

/* ---------- Pedidos de maestros y fotos del catálogo ---------- */
#page-tools .count { margin-left: 6px; }
.portal-panel { margin-bottom: 16px; }
.portal-url { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 14px; }
.portal-url input { flex: 1 1 320px; min-width: 0; font-family: var(--font); background: var(--tint); }
.portal-form .grid3 { align-items: start; }
.pick-cell { width: 36px; }
.pick-cell input { width: 20px; height: 20px; }
.warntext { color: var(--orange); }
.req-head { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin: 12px 0; }
.req-head > div { background: var(--surface); padding: 10px 12px; min-width: 0; }
.req-head label { display: block; font-size: 12px; color: var(--muted); margin: 0; }
.req-head strong { display: block; }
.req-head small { display: block; color: var(--muted); font-size: 12.5px; }
.req-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.req-item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.req-item img, .req-item .req-ph { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; }
.req-ph { display: grid; place-items: center; background: var(--primary-tint); color: var(--primary); font-weight: 700; text-transform: uppercase; }
.req-item small { display: block; color: var(--muted); font-size: 12.5px; }
.req-total { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: flex-end; margin: 12px 0 6px; font-size: 15px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.photo-card .photo-box { aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--tint); display: grid; place-items: center; }
.photo-card .photo-box img { width: 100%; height: 100%; object-fit: cover; }
.photo-card .photo-box span { font-size: 30px; font-weight: 700; color: var(--line-strong); text-transform: uppercase; }
.photo-card strong { font-size: 13.5px; line-height: 1.25; }
.photo-card small { color: var(--muted); font-size: 12px; }
.photo-card .photo-pick { justify-content: center; cursor: pointer; }
.photo-card .check { font-size: 13px; }
/* Pedidos juntos por escuela */
.req-group { margin-bottom: 14px; }
.req-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.req-group-head h3 { margin: 0; font-size: 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.req-group-head small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.req-group-total { text-align: right; white-space: nowrap; }
.req-group-total label { display: block; font-size: 12px; color: var(--muted); margin: 0; }
.req-group-total strong { font-size: 19px; }
.req-group table td small.warntext { display: block; }
/* Enlaces: uno por programa */
.portal-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 16px; }
.page .portal-cards > .panel { display: flex; flex-direction: column; gap: 4px; margin: 0; }
#portal-prices { align-items: end; }
#portal-prices .actions { margin: 0 0 2px; }
.portal-card .portal-url { margin: 6px 0 2px; }
.portal-card .portal-url input { flex-basis: 100%; font-size: 13px; }
.portal-card .actions { margin: 6px 0 8px; }
.portal-card .portal-form { border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.actions.tight { gap: 6px; margin: 0; flex-wrap: nowrap; }
#school-links td { vertical-align: middle; }
/* En qué página sale cada producto */
.bulk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 12px; background: var(--tint); border-radius: var(--radius-sm); font-size: 14px; }
.bulk-row select { width: auto; min-height: 36px; }
.web-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.web-chip { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.web-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.web-chip span { display: inline-block; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.web-chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.web-chip input:focus-visible + span { outline: 3px solid var(--focus, #f2bf3b); outline-offset: 2px; }
.web-field .web-chips { padding-top: 4px; }
.web-field .web-chip span { padding: 8px 14px; font-size: 14px; }
@media (max-width: 640px) {
  .req-head { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .req-group-head { flex-direction: column; gap: 4px; }
  .req-group-total { text-align: left; }
  .portal-cards { grid-template-columns: 1fr; }
  .actions.tight { flex-wrap: wrap; }
}
