:root{
  /* Paleta de EcoSoftware: azul marino del logo con el verde del rayo como acento. */
  --ink:#1d2b38; --muted:#5b6b79; --bg:#f2f5f8; --surface:#fff; --line:#dbe3ea; --field:#b8c6d2; --tint:#f6f8fa;
  --brand:#264965; --brand-dark:#1b354b; --brand-soft:#e7eef5; --accent:#489f60;
  --ok:#2f7a48; --ok-soft:#e3f2e8; --warn:#8a5800; --warn-soft:#fcefd4; --bad:#a3261f; --bad-soft:#fbe6e3;
  --focus:#2f6f9f;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.5 'Segoe UI',Tahoma,sans-serif}
a{color:var(--brand);text-underline-offset:3px}
button,input,select,textarea{font:inherit}
button,.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:46px;padding:10px 18px;border:1px solid var(--brand);border-radius:7px;background:var(--brand);color:#fff;font-weight:600;text-decoration:none;cursor:pointer}
button:hover,.button:hover{filter:brightness(.93)}
button:disabled{opacity:.5;cursor:not-allowed}
.secondary{background:#fff;color:var(--ink);border-color:var(--field)}
/* Botón liviano para ir a otra sección ("Ver todas las ventas"): sin borde ni fondo hasta pasar el mouse. */
.ghost{background:transparent;color:var(--brand);border-color:transparent}
.ghost:hover{background:var(--brand-soft);filter:none}
/* Atajo para crear lo que falta en una lista ("+ Nuevo cliente"), arriba a la derecha del rótulo del campo. */
label.with-add{position:relative}
.field-add{position:absolute;top:-6px;right:0;display:inline-flex;align-items:center;gap:4px;min-height:32px;padding:4px 12px 4px 9px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-size:13px;font-weight:600;line-height:1;text-decoration:none;white-space:nowrap}
.field-add .icon{width:15px;height:15px}
.field-add:hover{background:#d6e3ee}
.field-add:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
/* "Ver todos" al lado del título de una sección. */
.section-heading>a:not(.button){font-size:14px;font-weight:600;text-decoration:none;white-space:nowrap}
.section-heading>a:not(.button)::after{content:" →"}
.section-heading>a:not(.button):hover{text-decoration:underline}
.danger-button{background:var(--bad);border-color:var(--bad)}
.ghost-danger{background:#fff;color:var(--bad);border-color:#e8bdb8}
.ghost-danger:hover{background:var(--bad-soft);filter:none}
button.small,.button.small{min-height:36px;padding:6px 12px;font-size:14px}
.icon{width:20px;height:20px;flex-shrink:0}
.button .icon,button .icon{width:18px;height:18px}

/* Cabecera y navegación */
.topbar{height:72px;background:linear-gradient(100deg,var(--brand-dark) 0%,var(--brand) 60%,#2c5574 100%);color:#fff;display:flex;align-items:center;gap:18px;padding:0 28px;border-bottom:3px solid var(--accent);box-shadow:0 4px 14px rgba(16,34,47,.18)}
.brand{display:flex;align-items:center;gap:12px;color:#fff;text-decoration:none;min-width:0}
.brand-tile{display:flex;align-items:center;justify-content:center;width:46px;height:46px;flex-shrink:0;background:#fff;color:var(--brand);border-radius:10px;box-shadow:0 2px 6px rgba(40,4,9,.25)}
.brand-tile .icon{width:26px;height:26px}
.brand-tile.has-logo{width:auto;max-width:190px;padding:4px 10px}
.brand-tile.has-logo img{display:block;max-width:100%;max-height:38px;width:auto;height:auto}
.brand-text{display:flex;flex-direction:column;min-width:0}
.brand-text b{font:700 22px/1.1 Bahnschrift,'Arial Narrow',sans-serif;font-stretch:condensed;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-text small{margin-top:3px;color:#cfe0ec;font:600 11px/1.2 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.14em;text-transform:uppercase}
.brand-mark{display:inline-flex;align-items:center;justify-content:center;width:46px;height:46px;flex-shrink:0;background:var(--brand-soft);color:var(--brand);border-radius:10px}
.brand-mark .icon{width:26px;height:26px}
.identity{margin-left:auto;display:flex;align-items:center;gap:10px;min-width:0}
.avatar{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:38px;height:38px;border-radius:50%;background:rgba(255,255,255,.16);border:1px solid rgba(255,255,255,.4);font-size:14px;font-weight:700}
.identity-text{display:flex;flex-direction:column;min-width:0;line-height:1.25}
.identity-text b{font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.identity-text small{color:#cfe0ec;font-size:12px}
.logout{min-height:40px;padding:6px 14px;background:transparent;border-color:rgba(255,255,255,.45);font-size:14px}
.logout:hover{background:rgba(255,255,255,.12);filter:none}
.shell{display:grid;grid-template-columns:236px minmax(0,1fr);min-height:calc(100vh - 72px)}
.side-nav{background:#fff;border-right:1px solid var(--line);padding:20px 14px;display:flex;flex-direction:column;gap:2px}
.side-nav a{display:flex;align-items:center;gap:12px;color:var(--ink);text-decoration:none;padding:9px 12px;border-radius:8px;font-weight:600;font-size:15px}
.side-nav a .icon{color:#7f93a5}
.side-nav a:hover{background:var(--tint)}
.side-nav a[aria-current]{background:var(--brand-soft);color:var(--brand)}
.side-nav a[aria-current] .icon{color:var(--brand)}
.side-nav a[aria-current=page]{box-shadow:inset 3px 0 0 var(--brand)}
.nav-group{margin:16px 12px 4px;font:600 11px/1.3 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
.nav-foot{font-size:13px;color:var(--muted);padding:24px 12px 4px;margin:auto 0 0}

/* Estructura de página */
main{padding:30px 38px;max-width:1550px;width:100%;margin:0 auto}
h1{font-size:30px;line-height:1.2;letter-spacing:-.6px;margin:3px 0 0}
h2{font-size:21px;line-height:1.3;margin:0 0 14px}
h3{font-size:19px;margin:0 0 6px}
p{max-width:80ch}
.date{margin:0 0 4px;font:600 13px/1.4 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.08em;text-transform:uppercase;color:var(--brand)}
.page-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:26px}
.page-actions{display:flex;flex-wrap:wrap;gap:10px}
.panel,.empty,.receipt{background:#fff;border:1px solid var(--line);border-radius:10px;padding:26px;margin-bottom:24px}
.panel-alert{border-color:#e8bdb8;box-shadow:inset 4px 0 0 var(--bad)}
.narrow{max-width:720px}
.section-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:18px}
.section-heading h2{margin:0}
.section-heading p{margin:4px 0 0}
.intro{color:var(--muted);margin-top:-8px;margin-bottom:22px}
.muted{color:var(--muted)}
small{display:block;color:var(--muted);font-size:13px}
.warn-text{color:var(--warn)}
.bad-text{color:var(--bad)!important;font-weight:600}
.alert{padding:13px 17px;border:1px solid #b9dcc8;border-left:4px solid var(--ok);border-radius:5px;background:#eef8f2;color:#1d5239;max-width:none}
.error{border-color:#ebc3be;border-left-color:var(--bad);background:#fdf0ee;color:#8a2019}
.alert.warn{border-color:#ecd7a8;border-left-color:var(--warn);background:var(--warn-soft);color:#6b4500}

/* Indicadores */
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px;margin-bottom:24px}
/* Movimientos de un producto: Vendido, Entró, Salió, Diferencia y Stock en una fila. */
@media(min-width:761px){
  .stats.five{grid-template-columns:repeat(auto-fit,minmax(155px,1fr));gap:12px}
  .stats.five .stat{flex-direction:column;gap:10px;padding:16px 18px}
  .stats.five strong{font-size:22px}
}
.stat{display:flex;align-items:flex-start;gap:16px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:18px 20px;color:var(--ink);text-decoration:none}
a.stat:hover{border-color:var(--field)}
.stat-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;height:44px;border-radius:10px;background:var(--tint);color:#7f93a5}
.stat-icon .icon{width:22px;height:22px}
.stat-label{color:var(--muted);font-size:14px;font-weight:600}
.stat strong{display:block;margin:4px 0;font-size:28px;line-height:1.15;letter-spacing:-.5px;font-variant-numeric:tabular-nums}
.stat small{font-size:12.5px}
.stat-amber .stat-icon{background:var(--warn-soft);color:var(--warn)}
.stat-amber strong{color:var(--warn)}
.stat-red .stat-icon{background:var(--bad-soft);color:var(--bad)}
.stat-red strong{color:var(--bad)}
.stat-green .stat-icon{background:var(--ok-soft);color:var(--ok)}
.home-grid{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(300px,1fr);gap:24px;align-items:start;margin-bottom:24px}
.home-grid .panel{margin-bottom:0}

/* Puesta en marcha y estados vacíos */
.setup .section-heading{align-items:flex-start}
.setup-count{flex-shrink:0;padding:5px 12px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-size:13px;font-weight:700;white-space:nowrap}
.steps{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.step{display:flex;align-items:center;gap:16px;padding:14px 16px;border:1px solid var(--line);border-radius:10px}
.step.done{background:#f7fbf8}
.step-mark{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:34px;height:34px;border-radius:50%;background:var(--tint);font-weight:700}
.step.done .step-mark{background:var(--ok);color:#fff}
.step-body{flex:1;min-width:0}
.step-body strong{display:block}
.step .button{flex-shrink:0;min-height:42px;padding:8px 16px}
.empty-state{display:flex;flex-direction:column;align-items:center;gap:6px;padding:24px 12px 16px;text-align:center}
.empty-state p{margin:6px 0 10px;color:var(--muted)}
.empty-state p strong{color:var(--ink)}
.empty-icon{display:inline-flex;align-items:center;justify-content:center;width:52px;height:52px;border-radius:50%;background:var(--tint);color:#7f93a5}
.empty-icon .icon{width:26px;height:26px}
.empty-ok{background:var(--ok-soft);color:var(--ok)}
.empty{padding:35px}
.empty-small{color:var(--muted);padding:12px 0}

/* Tablas */
.table-wrap{overflow-x:auto}
table{border-collapse:collapse;width:100%;font-size:14px}
th{text-align:left;font-size:13px;color:var(--muted);font-weight:600;background:var(--tint)}
th,td{padding:12px 13px;border-bottom:1px solid var(--line);vertical-align:middle}
tfoot th{color:var(--ink);font-size:16px;background:#eaf0f5}
tfoot tr.subtotal th{font-size:14px;color:var(--muted);background:var(--tint)}
.num{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.voided td{background:#fdf5f4;color:#7d6b67}
.c-qty.neg{color:var(--bad)}
.c-qty.pos{color:var(--ok)}
.c-id a,.c-product a{font-weight:600}
.lot-table .c-product a,.receipt-table .c-product a{font-weight:inherit}
.lots-cell small{white-space:nowrap}
.badge{display:inline-block;padding:3px 9px;background:var(--ok-soft);border-radius:5px;color:#245a40;font-size:12px;font-weight:600;white-space:nowrap}
.badge.danger{background:var(--bad-soft);color:#8a2019}
.badge.pending{background:var(--warn-soft);color:#6f4700}
.badge.type-ingreso{background:var(--ok-soft);color:#245a40}
.badge.type-salida{background:#e9eef6;color:#2f4b70}
.badge.type-ajuste{background:var(--warn-soft);color:#6f4700}
.badge.type-anulacion{background:#eceff3;color:#4d5a66}
.badge.type-devolucion{background:var(--ok-soft);color:#245a40}
.row-actions{display:inline-flex;align-items:center;justify-content:flex-end;gap:8px}
.row-actions form{margin:0}

/* Listas de clientes, proveedores y productos */
.client-list>a,.list-row{display:flex;justify-content:space-between;gap:16px;align-items:center;padding:14px 0;border-bottom:1px solid var(--line);text-decoration:none;color:var(--ink)}
.client-list>a:last-child,.list-row:last-child{border:0}
.client-list>a:hover strong,.list-row>a:hover strong{color:var(--brand)}
.client-list>a>span,.list-row>a,.list-row>span:first-child{flex:1;min-width:0;color:var(--ink);text-decoration:none}
.client-list>a .icon{width:18px;height:18px;color:#9aabba}
.client-list b{font-variant-numeric:tabular-nums;white-space:nowrap}
.price-row input{width:150px;flex-shrink:0;text-align:right;font-variant-numeric:tabular-nums}
.list-row.inactive strong{color:var(--muted)}
.search-label{width:300px;margin:0}

/* Formularios */
label{display:flex;flex-direction:column;gap:6px;font-size:14px;font-weight:600;margin-bottom:18px}
label small{font-weight:400}
input,select,textarea{width:100%;min-height:46px;border:1px solid var(--field);border-radius:6px;padding:10px 12px;background:#fff;color:var(--ink)}
textarea{resize:vertical}
input[type=date]::-webkit-date-and-time-value{text-align:left}
input[type=search]{-webkit-appearance:none;appearance:none}
/* Precio fijo de lista, en la venta del vendedor. */
input[readonly]{background:var(--tint);color:var(--ink);cursor:default}
input:focus,select:focus,textarea:focus{outline:3px solid #bcd3e6;outline-offset:1px;border-color:var(--focus)}
/* Un campo que el usuario dejó vacío o fuera de rango queda en rojo antes de enviar. */
input:user-invalid,select:user-invalid,textarea:user-invalid{border-color:var(--bad)}
a:focus-visible,button:focus-visible,summary:focus-visible,.button:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
fieldset{border:0;margin:0 0 18px;padding:0;min-width:0}
legend{padding:0;margin-bottom:8px;font-size:14px;font-weight:600}
.choice{flex-direction:row;align-items:flex-start;gap:12px;margin:0 0 8px;padding:12px 14px;border:1px solid var(--line);border-radius:8px;font-weight:400;cursor:pointer}
.choice:has(input:checked){border-color:var(--brand);background:var(--brand-soft)}
.choice input{width:20px;min-height:0;height:20px;margin:2px 0 0;flex-shrink:0;accent-color:var(--brand)}
.choice span{min-width:0}
.choice+button{margin-top:10px}
.unit-choice{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 10px}
.unit-choice legend{grid-column:1/-1}
.unit-choice p{grid-column:1/-1;margin:0}
.lot-choice{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:0 10px}
.lot-choice legend{grid-column:1/-1}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 22px}
.wide{grid-column:1/-1}
.form-end{align-self:center}
.form-buttons{display:flex;flex-wrap:wrap;gap:10px}
.filters{display:flex;flex-wrap:wrap;align-items:flex-end;gap:0 16px;margin-bottom:6px}
.filters label{min-width:170px;flex:1}
.filters.inline{margin:0;flex:1}
.filters.inline label{margin:0;max-width:360px}
.filter-actions{display:flex;gap:10px;margin-bottom:18px}
.filters .search-label{width:auto;margin:0 0 18px}
.adjust-form{margin-top:18px}
.product-photo{display:flex;flex-wrap:wrap;align-items:flex-start;gap:6px 18px}
.product-photo img{width:120px;height:90px;object-fit:cover;border:1px solid var(--line);border-radius:8px}
.product-photo>label:not(.choice){flex:1 1 260px}
.count-history{margin:26px 0 4px}

/* Renglones de ingresos y remitos */
.line{display:grid;gap:14px;align-items:start;border-top:1px solid var(--line);padding:20px 0}
.line label{margin:0}
.entry-line{grid-template-columns:minmax(180px,2fr) minmax(100px,1fr) minmax(100px,1fr) minmax(140px,1fr) auto}
.line-prices{grid-column:1/-1;display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px;align-items:start;padding:14px 16px;background:var(--tint);border:1px solid var(--line);border-radius:8px}
.line-value small{margin-top:4px}
.vat-choice{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 10px;margin-top:4px}
.vat-choice legend{grid-column:1/-1}
/* Cobro de la venta: tres opciones, y el monto y la forma de pago cuando corresponde. */
.pay-choice{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 10px;margin-top:22px}
.pay-choice legend{grid-column:1/-1}
.pay-fields{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 14px;margin-top:10px}
.pay-fields label{margin-bottom:8px}
.pay-owed{grid-column:1/-1;margin:4px 0 0;font-weight:600}
.pay-owed:empty{display:none}
.pay-summary{display:flex;flex-wrap:wrap;gap:12px 40px;margin:20px 0}
.pay-summary dt{font-size:13px;color:var(--muted)}
.pay-summary dd{margin:2px 0 0;font-size:18px;font-weight:700;font-variant-numeric:tabular-nums}
.doc-summary{display:flex;flex-wrap:wrap;gap:10px 32px;margin:6px 0 0;padding:0 20px}
.doc-summary dt{font-size:13px;color:var(--muted)}
.doc-summary dd{margin:0;font-weight:600;font-variant-numeric:tabular-nums}
/* Versión lite: el renglón del ingreso es sólo producto y cantidad, sin lote ni vencimiento. */
.entry-line.simple{grid-template-columns:minmax(200px,3fr) minmax(130px,1fr) auto}
.dispatch-line{grid-template-columns:minmax(200px,2fr) minmax(110px,1fr) minmax(110px,1fr) minmax(100px,.8fr) auto}
.line-value>span{font-size:14px;font-weight:600;display:block}
.line-value strong{display:block;padding-top:11px;white-space:nowrap;font-variant-numeric:tabular-nums}
.remove-line{margin-top:28px;padding:8px 12px}
.qty-hint,.price-hint{min-height:1.4em}
/* Venta pieza por pieza: el peso de cada media res o caja, debajo del renglón, y la suma pasa a la cantidad. */
.l-pieces{grid-column:1/-1;order:1}
.pieces-box{display:grid;gap:8px;padding:14px 16px;background:var(--tint);border:1px solid var(--line);border-radius:8px}
.piece-entry{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px}
.piece-entry label{flex:0 1 280px}
.piece-error:empty{display:none}
.piece-list{display:flex;flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none;counter-reset:piece}
.piece-list:empty{display:none}
.piece-list li{counter-increment:piece;display:inline-flex;align-items:center;gap:6px;padding:2px 2px 2px 10px;background:var(--surface);border:1px solid var(--field);border-radius:999px;font-variant-numeric:tabular-nums}
.piece-list li::before{content:counter(piece);color:var(--muted);font-size:12px}
.piece-remove{min-height:32px;width:32px;padding:0;border:0;border-radius:50%;background:none;color:var(--muted);font-size:20px;line-height:1}
.piece-remove:hover{background:var(--bad-soft);color:var(--bad);filter:none}
.piece-sum{margin:0;font-weight:700;font-variant-numeric:tabular-nums}
.piece-sum:empty{display:none}
.pieces-box>[data-pieces-clear]{justify-self:start}
.pieces-note{margin-top:2px;font-weight:400;white-space:normal;font-variant-numeric:tabular-nums}
[data-add-line]{margin:4px 0 6px}
.doc-total{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#eaf0f5;border-radius:7px;padding:18px 20px;margin:6px 0 18px}
.doc-total strong{font-size:28px;font-variant-numeric:tabular-nums}
.doc-total small{font-weight:400}
.submit-hint{margin:10px 0 0;font-size:13px;color:var(--muted)}
.submit-hint:empty{display:none}

/* Buscador del producto: el texto filtra la lista; el select original queda oculto y es el que se envía. */
.combo{position:relative}
.combo-icon{position:absolute;left:13px;top:50%;width:18px;height:18px;transform:translateY(-50%);color:#7f93a5;pointer-events:none}
input.combo-input{padding-left:40px}
input.combo-input:focus{border-color:var(--focus)}
.combo-list{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:20;max-height:340px;margin:0;padding:4px;overflow-y:auto;overscroll-behavior:contain;list-style:none;background:#fff;border:1px solid var(--field);border-radius:8px;box-shadow:0 12px 28px rgba(16,34,47,.16);font-size:15px;font-weight:400;line-height:1.35}
.combo-list li{display:flex;flex-direction:column;justify-content:center;min-height:44px;padding:7px 10px;border-radius:6px;cursor:pointer}
.combo-list small{margin-top:1px;font-size:13px}
.combo-list .is-current>span{font-weight:600}
.combo-list [aria-selected=true]{background:var(--brand-soft)}
.combo-list [aria-disabled=true]{color:var(--muted);cursor:not-allowed}
.combo-list .combo-note{min-height:0;padding:10px;color:var(--muted);font-size:14px;cursor:default}
@media(hover:hover){.combo-list [aria-selected=false]:not([aria-disabled=true]):hover{background:var(--tint)}}

/* Categorías */
.category-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:end;margin:0}
.category-row label{margin:0}
.category-item{display:grid;grid-template-columns:minmax(0,1fr) 160px auto;gap:16px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line)}
.category-item:last-child{border:0}
.category-item form{margin:0}
.category-count{font-size:14px;font-variant-numeric:tabular-nums}

/* Logo en Configuración */
.logo-setting{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px;align-items:start}
.logo-preview{display:flex;align-items:center;justify-content:center;min-height:140px;padding:16px;border:1px solid var(--line);border-radius:10px;background:#fff}
.logo-preview img{display:block;max-width:100%;max-height:120px;width:auto;height:auto}
.logo-preview.empty{border-style:dashed;background:var(--tint);color:var(--muted);font-size:14px;text-align:center}
.logo-preview.empty .icon{display:block;width:30px;height:30px;margin:0 auto 8px}
.logo-actions form{margin:0 0 10px}
input[type=file]{padding:8px;font-size:14px;color:var(--muted)}
input[type=file]::file-selector-button{margin-right:12px;padding:7px 14px;border:1px solid var(--field);border-radius:6px;background:var(--tint);color:var(--ink);font-family:inherit;font-size:14px;font-weight:600;cursor:pointer}
.no-expiry-note{padding-top:12px}

/* Ficha de producto */
.product-head{display:flex;justify-content:space-between;align-items:flex-start;gap:24px}
.product-head h2{font-size:25px;margin-bottom:4px}
.product-head p{margin:4px 0}
.product-head .actions{margin:0;justify-content:flex-end}

/* Comprobantes */
.actions{display:flex;align-items:center;flex-wrap:wrap;gap:14px;margin:0 0 22px}
.receipt{max-width:1000px;padding:36px}
.receipt-heading{display:flex;justify-content:space-between;gap:30px;border-bottom:3px solid var(--brand);padding-bottom:20px;margin-bottom:24px}
.receipt-heading h2{margin-bottom:4px}
.receipt-heading p{margin:0}
.receipt-brand{display:flex;align-items:center;gap:16px}
.receipt-brand h2{margin:0 0 2px}
.receipt-brand p{color:var(--muted);font-size:13px}
.receipt-brand .doc-logo{display:block;width:auto;height:auto;max-width:220px;max-height:72px}
.doc-credit{margin:14px 0 0;font-size:11px;color:var(--muted)}
.signature{margin-top:80px;border-top:1px solid var(--ink);padding-top:8px;width:300px;max-width:100%;font-size:13px}

details>summary{cursor:pointer;padding:10px 0;font-weight:600}
details>form{margin-top:14px}
.member{border-bottom:1px solid var(--line);padding:6px 0 10px}
.member summary{display:flex;align-items:center;gap:12px;list-style:none;font-weight:400}
.member summary::-webkit-details-marker{display:none}
.member summary>span{flex:1;min-width:0}
.member summary::after{content:"";flex-shrink:0;width:9px;height:9px;margin:0 6px 4px;border:solid #7f93a5;border-width:0 2px 2px 0;transform:rotate(45deg)}
.member[open] summary::after{margin:4px 6px 0;transform:rotate(-135deg)}
.member.inactive summary{color:var(--muted)}
.product-row{display:grid;grid-template-columns:2fr 2fr auto;gap:16px;align-items:end;margin-bottom:12px}
.product-row.has-phone{grid-template-columns:2fr 2fr 1.5fr auto}
.product-row label{margin:0}
.inline-void summary{padding:0;color:var(--bad);font-size:14px}
.inline-void form{min-width:240px;margin-top:10px;text-align:left}
.inline-void label{margin-bottom:10px}

/* Pie y barra rápida */
.app-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-top:40px;padding-top:16px;border-top:1px solid var(--line);font-size:13px;color:var(--muted)}
.app-footer b{color:var(--ink)}
.made-by{display:inline-flex;align-items:center;gap:10px;font-size:12px}
.made-by img{display:block;width:auto;height:30px;opacity:.9}
.quick-bar{display:none}
.skip{position:absolute;top:-100px;left:20px;background:#fff;padding:12px;z-index:3}
.skip:focus{top:10px}
[hidden]{display:none!important}

/* Instalación */
.auth{display:flex;align-items:center;justify-content:center;min-height:100vh;border-top:8px solid var(--brand)}
.auth-box{max-width:480px;background:#fff;border:1px solid var(--line);border-radius:12px;margin:35px 16px;padding:36px}
.auth h1{margin-top:18px}
.auth form{margin-top:24px}
.auth form button{width:100%;margin-top:8px}
.auth-logo{display:block;width:200px;height:auto}
.auth .muted{font-size:13px}

/* Ingreso */
.login{min-height:100vh;display:grid;grid-template-columns:minmax(0,1.1fr) minmax(420px,1fr);background:#fff}
.login-brand{position:relative;overflow:hidden;isolation:isolate;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;gap:40px;padding:48px 56px;background:linear-gradient(155deg,#2c5574 0%,var(--brand-dark) 60%,#10222f 100%);color:#fff}
.login-brand::before{content:"";position:absolute;z-index:-1;width:820px;height:820px;right:-330px;top:-300px;border:2px solid rgba(255,255,255,.12);border-radius:50%}
.login-brand::after{content:"";position:absolute;z-index:-1;left:-15%;right:-15%;bottom:-170px;height:300px;border-radius:50%;background:rgba(8,20,30,.35);border-top:3px solid rgba(72,159,96,.45)}
.login-eco{display:inline-flex;padding:10px 16px;background:#fff;border-radius:12px;box-shadow:0 6px 18px rgba(8,20,30,.25)}
.login-eco img{display:block;width:210px;height:auto}
.login-eyebrow{margin:0;font:600 13px/1.4 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.16em;text-transform:uppercase;color:#cfe0ec}
.login-claim{margin:0 0 30px;max-width:14ch;font:700 clamp(36px,4.2vw,58px)/1.04 Bahnschrift,'Arial Narrow',sans-serif;font-stretch:condensed}
.login-points{list-style:none;margin:0;padding:0;display:grid;gap:14px;font-size:17px;color:#e3edf4}
.login-points li{position:relative;padding-left:34px}
.login-points li::before{content:"";position:absolute;left:0;top:3px;width:20px;height:20px;border-radius:50%;background:var(--accent)}
.login-points li::after{content:"";position:absolute;left:7px;top:7px;width:5px;height:9px;border:solid #fff;border-width:0 2.5px 2.5px 0;transform:rotate(45deg)}
.login-date{margin:0;font:600 15px/1.4 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.04em;color:#cfe0ec}
.login-panel{position:relative;display:flex;flex-direction:column;align-items:center;gap:32px;max-width:none;margin:0;padding:48px 32px 28px}
.login-card{width:100%;max-width:380px;margin:auto 0;text-align:left}
.login-mark{display:flex;align-items:center;justify-content:center;width:64px;height:64px;margin:0 auto 20px;border-radius:16px;background:var(--brand-soft);color:var(--brand)}
.login-mark .icon{width:34px;height:34px}
.login-client-logo{display:block;max-width:260px;max-height:96px;width:auto;height:auto;margin:0 auto 22px}
.login h1{margin:0;font-size:28px;text-align:center}
.login-sub{margin:6px auto 26px;color:var(--muted);text-align:center}
.login .alert{margin:0 0 20px;font-size:15px}
.login-field{margin-bottom:18px}
.login-field label{display:block;margin:0 0 7px}
.login input{min-height:52px;border-radius:8px;font-size:17px}
.pass-field{position:relative}
.pass-field input{padding-right:100px}
.pass-toggle{position:absolute;top:6px;right:6px;bottom:6px;min-height:0;padding:0 14px;border:0;border-radius:6px;background:var(--tint);color:var(--ink);font-size:14px}
.pass-toggle:hover{background:#e5ecf2;filter:none}
.caps-hint{margin-top:7px;color:var(--warn);font-weight:600}
.login button[type=submit]{width:100%;min-height:54px;margin-top:8px;border-radius:8px;font-size:17px}
.login-credit{display:flex;flex-direction:column;align-items:center;gap:8px;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.login-credit img{display:block;width:150px;height:auto;opacity:.9}

@media(max-width:1150px){
  main{padding:28px 22px}
  .shell{grid-template-columns:200px minmax(0,1fr)}
  .home-grid{grid-template-columns:1fr}
  .entry-line,.entry-line.simple,.dispatch-line{grid-template-columns:repeat(2,minmax(0,1fr))}
  .entry-line .l-product,.dispatch-line .l-product{grid-column:1/-1}
  .remove-line{margin:0;justify-self:start}
  .line-value strong{padding-top:2px}
  .product-row,.product-row.has-phone{grid-template-columns:1fr 1fr}
  .product-row button{grid-column:1/-1;justify-self:start}
}
@media(max-width:760px){
  .topbar{height:62px;padding:0 12px;gap:10px}
  .brand{gap:9px}
  .brand-tile{width:38px;height:38px;border-radius:8px}
  .brand-tile .icon{width:22px;height:22px}
  .brand-text b{font-size:19px}
  .brand-text small,.identity-text{display:none}
  .avatar{width:34px;height:34px;font-size:13px}
  .logout{min-height:36px;padding:6px 10px}
  .logout span{display:none}
  .shell{display:block}
  .side-nav{flex-direction:row;overflow-x:auto;padding:8px 10px;border-right:0;border-bottom:1px solid var(--line);gap:4px}
  .side-nav a{white-space:nowrap;font-size:14px;padding:9px 12px;gap:8px}
  .side-nav a .icon{width:18px;height:18px}
  .side-nav a[aria-current=page]{box-shadow:inset 0 -3px 0 var(--brand)}
  .nav-group,.nav-foot{display:none}
  .brand-tile.has-logo{max-width:120px;padding:3px 8px}
  .brand-tile.has-logo img{max-height:30px}
  .has-logo+.brand-text{display:none}
  .logo-setting{grid-template-columns:1fr}
  .unit-choice{grid-template-columns:1fr}
  .quick-bar{position:fixed;left:0;right:0;bottom:0;z-index:6;display:grid;grid-template-columns:1.4fr 1fr;gap:10px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:rgba(255,255,255,.97);border-top:1px solid var(--line);box-shadow:0 -6px 18px rgba(16,34,47,.08)}
  .quick-bar .button{min-height:50px;font-size:15px}
  .has-quick main{padding-bottom:96px}
  main{padding:22px 16px}
  h1{font-size:25px}
  .page-heading{align-items:flex-start;margin-bottom:20px}
  .page-actions{display:none}
  .panel,.empty,.receipt{padding:20px 16px;border-radius:8px}
  .stats{grid-template-columns:1fr;gap:10px;margin-bottom:18px}
  .stat{padding:13px 16px}
  .stat-icon{display:none}
  .stat>div{flex:1;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;column-gap:12px}
  .stat-label{grid-area:1/1}
  .stat strong{grid-area:1/2;margin:0;font-size:21px}
  .stat small{grid-area:2/1/3/3;margin-top:2px}
  .step{flex-wrap:wrap;gap:12px 14px}
  .step-body{flex-basis:calc(100% - 60px)}
  .step .button{width:100%}
  .section-heading{flex-direction:column;align-items:stretch;gap:14px}
  .search-label{width:100%}
  .filters label,.filters.inline label{min-width:0;max-width:none;flex-basis:100%}
  .filter-actions{flex-wrap:wrap}
  /* Una columna, salvo los datos cortos marcados .half (CUIT y teléfono), que van de a dos. */
  .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:12px}
  .form-grid>*{grid-column:1/-1}
  .form-grid>.half{grid-column:auto}
  .form-end{margin-bottom:12px}
  .product-head{flex-direction:column}
  .product-head .actions{justify-content:flex-start}
  .entry-line,.dispatch-line{gap:14px 12px}
  .line-prices{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 12px;margin-top:2px;padding:14px 0 0;background:none;border:0;border-top:1px dashed var(--line);border-radius:0}
  .vat-choice,.pay-choice,.pay-fields{grid-template-columns:1fr}
  .doc-summary{padding:0 4px;gap:8px 20px}
  .remove-line{grid-column:1/-1;width:100%;min-height:40px}
  .pieces-box{padding:12px}
  .piece-entry label{flex:1 1 160px}
  .doc-total{padding:15px}
  .doc-total strong{font-size:23px}
  .product-row{grid-template-columns:1fr}
  .receipt-heading{display:block}
  .receipt-brand{flex-direction:column;align-items:flex-start;gap:10px}
  .receipt-brand .doc-logo{max-width:180px;max-height:60px}
  .receipt-heading>div+div{margin-top:16px}
  th,td{padding:11px 9px}
  .auth-box{padding:28px 22px}
  /* En el celular las tablas de movimientos, documentos y stock se muestran como tarjetas. */
  .move-table,.move-table tbody,.doc-table,.doc-table tbody,.stock-table,.stock-table tbody,.stock-table tfoot{display:block}
  .move-table thead,.doc-table thead,.stock-table thead{display:none}
  .move-table tr,.doc-table tr,.stock-table tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;padding:12px 0;border-bottom:1px solid var(--line)}
  .move-table td,.doc-table td,.stock-table td{padding:0;border:0;text-align:left}
  .move-table .c-product,.doc-table .c-id,.stock-table .c-product{grid-area:1/1}
  .move-table .c-qty,.doc-table .c-amount,.stock-table .c-available{grid-area:1/2;text-align:right;font-weight:700}
  .move-table .c-doc,.doc-table .c-client,.stock-table .c-next{grid-area:2/1}
  .move-table .c-date,.doc-table .c-state,.stock-table .c-state{grid-area:2/2;text-align:right}
  .move-table .c-date{font-size:13px;color:var(--muted)}
  .move-table .c-balance{grid-area:3/2;text-align:right;color:var(--muted);font-size:13px}
  .move-table .c-user,.doc-table .c-user{grid-area:3/1;color:var(--muted);font-size:13px}
  .move-table .c-state{grid-area:3/2;text-align:right}
  .move-table.with-balance .c-balance::before{content:"Saldo "}
  /* Totales por producto de Movimientos: entró y salió debajo del nombre, el stock debajo de la diferencia. */
  .totals-table .c-in,.totals-table .c-out{color:var(--muted);font-size:13px}
  .totals-table .c-in{grid-area:2/1}
  .totals-table .c-out{grid-area:3/1}
  .totals-table .c-balance{grid-area:2/2}
  .totals-table .c-in::before{content:"Entró "}
  .totals-table .c-out::before{content:"Salió "}
  .totals-table .c-balance::before{content:"Stock "}
  .doc-table .c-items{display:none}
  .doc-table .c-margin{grid-area:3/2;text-align:right;font-size:13px}
  .doc-table .c-margin::before{content:"Margen ";color:var(--muted)}
  .sold-table .c-product{grid-area:1/1}
  .sold-table .c-qty{grid-area:2/1}
  .sold-table .c-count{grid-area:2/2;text-align:right;color:var(--muted);font-size:13px}
  .sold-table .c-count::before{content:"Ventas: "}
  .stock-table .c-category,.stock-table .c-min{display:none}
  .stock-table .c-expired{grid-area:3/1}
  .stock-table .c-value{grid-area:3/2;text-align:right;color:var(--muted);font-size:13px}
  .stock-table .c-available small{font-weight:400}
  .stock-table .c-expired:not(:has(.bad-text)){display:none}
  .stock-table tfoot tr{border:0}
  .stock-table tfoot th{background:none;padding:12px 0 0;font-size:15px;text-align:left}
  .stock-table tfoot th.num{text-align:right}
  .list-row{flex-wrap:wrap;gap:10px}
  .category-item{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px}
  .category-item .category-row{grid-column:1/-1}
  .panel>.category-row{grid-template-columns:1fr}
  .login{display:block;background:var(--bg)}
}
/* Celular, sólo en pantalla: el bloque anterior también alcanza a los comprobantes impresos en A4; éste no. */
@media screen and (max-width:760px){
  /* Navegación: separador entre grupos y sombra en el borde del que quedan más secciones. */
  .side-nav{scrollbar-width:none;background:linear-gradient(90deg,#fff 30%,rgba(255,255,255,0)) left/32px 100% no-repeat local,linear-gradient(270deg,#fff 30%,rgba(255,255,255,0)) right/32px 100% no-repeat local,radial-gradient(farthest-side at 0 50%,rgba(16,34,47,.2),rgba(16,34,47,0)) left/12px 100% no-repeat scroll,radial-gradient(farthest-side at 100% 50%,rgba(16,34,47,.2),rgba(16,34,47,0)) right/12px 100% no-repeat scroll,#fff}
  .side-nav::-webkit-scrollbar{display:none}
  .nav-group{display:block;flex-shrink:0;width:1px;margin:6px 4px;overflow:hidden;font-size:0;background:var(--line)}
  .intro{font-size:15px}
  .section-heading{flex-direction:row;flex-wrap:wrap;align-items:baseline;gap:6px 14px}
  .section-heading>div,.section-heading>.filters,.section-heading>.search-label,.section-heading>.button{flex:1 1 100%}
  .filters:not(.inline){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 12px}
  .filters .search-label,.filter-actions{grid-column:1/-1}
  .filter-actions>*{flex:1 1 auto}

  /* Botones a mano del pulgar */
  button.small,.button.small{min-height:40px}
  .actions>.button,.actions>button,.form-buttons>*{flex:1 1 auto}
  [data-add-line],.adjust-form>button,.form-end>button,.narrow form>button:not(.small),details>form>button:not(.small){width:100%}
  .product-row button{justify-self:stretch}

  /* Cada renglón de ingreso o remito es una tarjeta numerada, con Quitar arriba a la derecha. */
  .lines{counter-reset:line}
  .line{counter-increment:line;margin-bottom:12px;padding:12px 12px 14px;border:1px solid var(--line);border-radius:10px;box-shadow:0 1px 3px rgba(16,34,47,.06)}
  .line::before{grid-area:1/1;align-self:center;font:600 12px/1.3 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
  .entry-line::before{content:"Lote " counter(line)}
  .entry-line.simple::before{content:"Producto " counter(line)}
  .entry-line.simple .l-qty{grid-column:1/-1}
  .dispatch-line::before{content:"Producto " counter(line)}
  .line .remove-line{grid-area:1/2;justify-self:end;width:auto;min-height:36px;margin:0;padding:4px 12px;font-size:14px}
  .entry-line .l-exp{grid-column:1/-1}
  .entry-line .qty-hint:empty{display:none}
  /* Costo, margen y precio: cada rótulo ocupa tres filas compartidas (rótulo, campo, ayuda), así un rótulo de dos renglones no desalinea los campos de al lado. */
  .line-prices>label{display:grid;grid-row:span 3;grid-template-rows:subgrid;align-content:start;margin-bottom:8px}
  .line-prices:has(.l-vat[hidden]) .l-cost{grid-column:1/-1}
  /* El importe del renglón cierra la tarjeta, en ingresos y en remitos. */
  .line .line-value{grid-column:1/-1;order:1;display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:0 12px;padding-top:10px;border-top:1px dashed var(--line)}
  .line .line-value strong{padding:0;font-size:18px}
  .line .line-value small{flex-basis:100%;margin:0;text-align:right}

  /* Ingreso y remito: el formulario va de borde a borde y el total con el botón quedan fijos abajo. */
  .doc-form{margin:0 -16px 24px;padding:20px 16px;border-width:1px 0;border-radius:0}
  .doc-form [data-lines-status]{font-size:13px}
  .doc-submit{position:sticky;bottom:0;z-index:5;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:14px;margin:18px -16px -20px;padding:12px 16px calc(12px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid var(--line);box-shadow:0 -6px 18px rgba(16,34,47,.08)}
  .doc-submit .doc-total{grid-area:2/1;display:block;min-width:0;margin:0;padding:0;background:none;border-radius:0}
  .doc-submit .doc-total span{display:block;font-size:13px;line-height:1.3;color:var(--muted)}
  .doc-submit .doc-total small{display:none}
  .doc-submit .doc-total strong{display:block;font-size:22px;line-height:1.25}
  .doc-submit>button{grid-area:2/2;min-height:50px;padding:10px 20px}
  .doc-submit>button:only-child{grid-column:1/-1;width:100%}
  .doc-submit .label-tail{display:none}
  .submit-hint{grid-area:1/1/2/3;margin:0 0 8px}
  html:has(.doc-submit){scroll-padding-bottom:110px}
  /* Mientras se escribe, la barra vuelve al pie del formulario y la barra rápida se esconde: queda más pantalla para el teclado. */
  .doc-form:has(:is(input:not([type=radio],[type=checkbox],[type=date]),textarea):focus) .doc-submit{position:static}
  body:has(:is(input:not([type=radio],[type=checkbox],[type=date],[type=file]),textarea):focus) .quick-bar{display:none}

  /* Unidad del producto: el ejemplo va al lado del nombre, no debajo. */
  .unit-choice .choice{padding:11px 14px}
  .unit-choice .choice>span{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px}

  /* Más tablas como tarjetas: lotes, productos, comprobantes e historial. */
  .lot-table,.lot-table tbody,.lot-detail-table,.lot-detail-table tbody,.product-table,.product-table tbody,.receipt-table,.receipt-table tbody,.receipt-table tfoot,.audit-table,.audit-table tbody{display:block}
  .lot-table thead,.lot-detail-table thead,.product-table thead,.receipt-table thead,.audit-table thead{display:none}
  .lot-table tr,.lot-detail-table tr,.product-table tr,.receipt-table tbody tr,.audit-table tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;padding:12px 0;border-bottom:1px solid var(--line)}
  .lot-table td,.lot-detail-table td,.product-table td,.receipt-table td,.audit-table td{padding:0;border:0;text-align:left}
  .move-table tr.voided,.doc-table tr.voided,.lot-detail-table tr.voided{padding:12px 10px;border-radius:8px;background:#fdf5f4}
  .move-table tr.voided td,.doc-table tr.voided td,.lot-detail-table tr.voided td{background:none}
  .lot-table .c-lot::before,.lot-detail-table .c-lot::before,.receipt-table .c-lot::before,.kardex .c-product::before{content:"Lote "}
  .kardex .c-balance::before{content:"Saldo "}
  /* Kardex de la versión lite, sin columna de lote: el documento encabeza la tarjeta. */
  .kardex.no-lot .c-doc{grid-area:1/1}
  .kardex.no-lot .c-date{grid-area:2/1;text-align:left}
  .kardex.no-lot .c-balance{grid-area:2/2}
  .stock-table .c-expired .bad-text::before{content:"Vencido "}

  .lot-table .c-product{grid-area:1/1;font-weight:600}
  .lot-table .c-qty{grid-area:1/2;text-align:right;font-weight:700}
  .lot-table .c-lot{grid-area:2/1;color:var(--muted);font-size:13px}
  .lot-table .c-exp{grid-area:2/2;text-align:right}
  .lot-table .c-action{grid-area:3/1/4/3;margin-top:6px;text-align:right}

  .lot-detail-table .c-lot{grid-area:1/1;font-weight:700}
  .lot-detail-table .c-left{grid-area:1/2;text-align:right}
  .lot-detail-table .c-exp{grid-area:2/1}
  .lot-detail-table .c-received{grid-area:2/2;text-align:right;color:var(--muted);font-size:13px}
  .lot-detail-table .c-received::before{content:"de "}
  .lot-detail-table .c-entry{grid-area:3/1}
  .lot-detail-table .c-cost{grid-area:3/2;text-align:right;color:var(--muted);font-size:13px}
  .lot-detail-table .c-cost::before{content:"Costo "}
  .lot-detail-table .c-action{grid-area:4/1/5/3;text-align:right}
  .lot-detail-table .c-action a{display:inline-flex;align-items:center;min-height:40px;font-weight:600}

  .product-table tr{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px 10px}
  .product-table .c-product{grid-area:1/1/2/3}
  .product-table .c-stock{grid-area:1/3;text-align:right;font-weight:700}
  .product-table .c-price{grid-area:2/1}
  .product-table .c-cost{grid-area:2/2}
  .product-table .c-margin{grid-area:2/3}
  .product-table .c-min{grid-area:3/1}
  .product-table .c-actions{grid-area:3/2/4/4;align-self:end;text-align:right}
  .product-table td small{white-space:normal}
  .product-table .c-stock::before,.product-table .c-price::before,.product-table .c-cost::before,.product-table .c-margin::before,.product-table .c-min::before{display:block;font-size:12px;font-weight:600;color:var(--muted)}
  .product-table .c-stock::before{content:"Stock"}
  .product-table .c-price::before{content:"Precio"}
  .product-table .c-cost::before{content:"Costo"}
  .product-table .c-margin::before{content:"Margen"}
  .product-table .c-min::before{content:"Mínimo"}

  .receipt-table .c-product{grid-area:1/1;font-weight:600}
  .receipt-table .c-amount{grid-area:1/2;text-align:right;font-weight:700}
  .receipt-table .c-qty{grid-area:2/1}
  .receipt-table .c-price{grid-area:2/2;text-align:right;color:var(--muted);font-size:13px}
  .receipt-table tr:not(:has(.c-amount)) .c-qty{grid-area:1/2;text-align:right;font-weight:700}
  .receipt-table .c-lot{grid-area:3/1;color:var(--muted);font-size:13px}
  .receipt-table .c-exp{grid-area:3/2;text-align:right;color:var(--muted);font-size:13px}
  .receipt-table .c-exp:not(.no-date)::before{content:"Vence "}
  .receipt-table .c-sale{grid-area:4/1;font-size:13px}
  .receipt-table .c-sale:not(.no-price)::before{content:"Venta "}
  .receipt-table .c-left{grid-area:4/2;text-align:right;color:var(--muted);font-size:13px}
  .receipt-table .c-left::before{content:"Queda "}
  .receipt-table .lots-cell{grid-area:3/1/4/3}
  .receipt-table .lots-cell small{white-space:normal}
  .receipt-table tfoot tr{display:flex;justify-content:space-between;gap:12px;padding:12px 14px;border-radius:7px;background:#eaf0f5}
  .receipt-table tfoot tr:first-child{margin-top:10px}
  .receipt-table tfoot tr.subtotal{padding:6px 14px;background:none}
  .receipt-table tfoot tr th{padding:0;border:0;background:none;text-align:left}
  .receipt-table tfoot th:empty{display:none}

  .audit-table .c-action{grid-area:1/1;font-weight:600}
  .audit-table .c-date{grid-area:1/2;text-align:right;color:var(--muted);font-size:13px}
  .audit-table .c-user{grid-area:2/1/3/3;color:var(--muted);font-size:13px}
  .audit-table .c-detail{grid-area:3/1/4/3;margin-top:4px}

  /* Anular un ajuste abre el motivo a todo el ancho de la tarjeta. */
  .move-table td.c-state:has(.inline-void[open]){grid-area:4/1/5/3;text-align:left}
  .inline-void form{min-width:0}
}
/* Celulares y tabletas: campos de 16 px. Con letra más chica, el iPhone agranda la página cada vez que se toca un campo. */
@media screen and (max-width:760px),(pointer:coarse){
  input,select,textarea{font-size:16px}
}
/* Celulares angostos (320 a 359 px) */
@media screen and (max-width:359px){
  main{padding:18px 12px}
  .panel,.empty,.receipt{padding:18px 12px}
  .doc-form{margin:0 -12px 24px;padding:18px 12px}
  .doc-submit{margin:18px -12px -18px;padding-left:12px;padding-right:12px}
  .doc-submit>button{padding:10px 14px}
  .form-grid>.half{grid-column:1/-1}
  .filters:not(.inline),.line-prices{grid-template-columns:1fr}
  .line{padding:10px 10px 14px}
  .stat strong{font-size:19px}
  .doc-total strong{font-size:21px}
  .product-table tr{grid-template-columns:repeat(2,minmax(0,1fr))}
  .product-table .c-product{grid-area:1/1}
  .product-table .c-stock{grid-area:1/2}
  .product-table .c-price{grid-area:2/1}
  .product-table .c-cost{grid-area:2/2}
  .product-table .c-margin{grid-area:3/1}
  .product-table .c-min{grid-area:3/2}
  .product-table .c-actions{grid-area:4/1/5/3}
  .quick-bar{gap:8px;padding-left:10px;padding-right:10px}
}
@media(max-width:900px){
  .login{display:block;background:var(--bg)}
  .login-brand{gap:6px;padding:20px 20px 92px}
  .login-brand::before{width:420px;height:420px;right:-200px;top:-230px}
  .login-brand::after,.login-pitch{display:none}
  .login-eco{padding:7px 12px}
  .login-eco img{width:150px}
  .login-eyebrow{font-size:11px}
  .login-date{font-size:14px}
  .login-panel{gap:24px;margin-top:-72px;padding:0 16px 24px}
  .login-card{margin:0;padding:26px 22px 24px;background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:0 12px 32px rgba(16,34,47,.12)}
  .login h1{font-size:24px}
  .login-sub{margin-bottom:20px;font-size:15px}
}
/* Lista de precios pública (precios.php). La paleta va en tokens: cada empresa cambia sólo estos valores.
   Por defecto, la del catálogo de fiambres: crema, negro, dorado y precios en bordó. */
.prices{--p-bg:#f6f2e8;--p-ink:#131313;--p-text:#2b2722;--p-muted:#6f675c;--p-gold:#c8a149;--p-gold-dim:rgba(200,161,73,.5);--p-price:#9e1a2d;--p-card:#fff;--p-line:#e4d9c3;--p-hero:#131313;--p-hero-text:#f6f2e8;--p-serif:Georgia,'Times New Roman',serif;
  min-height:100vh;display:flex;flex-direction:column;background:var(--p-bg);color:var(--p-text)}
.prices-hero{background:radial-gradient(120% 160% at 12% 0%,#2b2620 0%,var(--p-hero) 58%);color:var(--p-hero-text);border-bottom:3px solid var(--p-gold)}
.prices-hero-in{max-width:1120px;margin:0 auto;padding:28px 24px;display:flex;flex-wrap:wrap;align-items:center;gap:16px 24px}
.prices-logo{display:block;width:auto;height:104px;max-width:220px;object-fit:contain}
.prices-title{flex:1 1 260px;min-width:0}
.prices-eyebrow{margin:0;font:600 12px/1.3 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.2em;text-transform:uppercase;color:var(--p-gold)}
.prices-title h1{margin:6px 0 0;font:700 36px/1.1 var(--p-serif);letter-spacing:.01em;color:var(--p-hero-text);overflow-wrap:anywhere}
.prices-address{margin:6px 0 0;font-size:15px;color:#d9d1c1}
.prices-call{display:flex;flex-direction:column;padding:10px 18px;border:1px solid var(--p-gold-dim);border-radius:10px;color:var(--p-hero-text);text-decoration:none}
.prices-call small{color:var(--p-gold);font:600 11px/1.3 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.16em;text-transform:uppercase}
.prices-call b{font-size:19px;font-variant-numeric:tabular-nums}
.prices-call:hover{border-color:var(--p-gold)}
main.prices-main{flex:1;max-width:1120px;padding:26px 24px 8px}
.prices-tools{display:flex;align-items:flex-end;gap:12px;margin-bottom:14px}
.prices-search{flex:1;margin:0;color:var(--p-text)}
.prices input{border-color:var(--p-line)}
.prices input:focus{outline-color:rgba(200,161,73,.35);border-color:var(--p-gold)}
.prices .secondary{border-color:var(--p-line);color:var(--p-ink)}
.prices-index{display:flex;flex-wrap:wrap;gap:8px;max-width:none;margin:0 0 26px}
.prices-index a{padding:6px 14px;border:1px solid var(--p-line);border-radius:999px;background:var(--p-card);color:var(--p-ink);font-size:14px;font-weight:600;text-decoration:none}
.prices-index a:hover{border-color:var(--p-gold);color:var(--p-price)}
.price-group{margin-bottom:32px;scroll-margin-top:12px}
.price-group h2{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:0 0 14px;padding:12px 16px 12px 20px;background:var(--p-ink);border-radius:8px;box-shadow:inset 6px 0 0 var(--p-gold);font:700 15px/1.3 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.16em;text-transform:uppercase;color:var(--p-gold)}
.price-group h2 small{flex-shrink:0;font:400 12px/1.3 'Segoe UI',sans-serif;letter-spacing:.02em;text-transform:none;color:#cfc6b4}
.price-grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.price-card{display:flex;flex-direction:column;min-width:0;background:var(--p-card);border-radius:12px;overflow:hidden;box-shadow:0 1px 2px rgba(19,19,19,.06),0 6px 18px rgba(19,19,19,.07)}
.price-photo{aspect-ratio:4/3;overflow:hidden;background:var(--p-ink);border-bottom:3px solid var(--p-gold)}
.price-photo img{display:block;width:100%;height:100%;object-fit:cover}
.price-photo.is-empty{display:flex;align-items:center;justify-content:center;background:radial-gradient(circle at 50% 42%,#2b2620,var(--p-ink) 70%)}
.price-photo .price-mark{width:auto;height:72%;max-width:80%;object-fit:contain}
.price-photo.is-empty .icon{width:40px;height:40px;color:var(--p-gold)}
.price-body{flex:1;display:flex;flex-direction:column;gap:4px;padding:12px 14px 14px}
.price-brand{margin:0;font:600 11px/1.2 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.16em;text-transform:uppercase;color:var(--p-gold)}
.price-name{margin:0;font:700 15px/1.3 'Segoe UI',Tahoma,sans-serif;color:var(--p-ink);overflow-wrap:anywhere}
.price-name::after{content:"";display:block;width:28px;height:2px;margin-top:8px;background:var(--p-gold)}
.price-value{margin:auto 0 0;padding-top:8px;max-width:none}
.price-value b{display:block;font-size:22px;font-weight:800;line-height:1.15;color:var(--p-price);font-variant-numeric:tabular-nums}
.price-value small{font-size:12px;color:var(--p-muted)}
.prices .empty{background:var(--p-card);border-color:var(--p-line)}
.prices-cta{display:flex;flex-wrap:wrap;align-items:center;gap:16px 22px;margin:8px 0 22px;padding:22px 24px;background:var(--p-ink);border-radius:12px;border-top:3px solid var(--p-gold);color:var(--p-hero-text)}
.prices-cta img{width:auto;height:72px;max-width:160px;object-fit:contain}
.prices-cta div{flex:1 1 200px}
.prices-cta h2{margin:0;font:700 24px/1.2 var(--p-serif);color:var(--p-hero-text)}
.prices-cta p{margin:4px 0 0;font:600 12px/1.3 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.16em;text-transform:uppercase;color:var(--p-gold)}
.prices-cta .button{background:var(--p-gold);border-color:var(--p-gold);color:var(--p-ink)}
.prices-note{margin:4px 0 0;color:var(--p-muted);font-size:14px}
.prices-foot{display:flex;flex-direction:column;align-items:center;gap:6px;padding:26px 16px 30px;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--p-muted)}
.prices-foot img{display:block;width:130px;height:auto;opacity:.9}
/* Carrito de pedidos: control en cada tarjeta, barra fija abajo y ventana con el pedido, en la paleta de la lista. */
.prices-howto{margin:-4px 0 18px;max-width:none;color:var(--p-muted);font-size:14px}
.prices-howto b{color:var(--p-ink)}
.cart-ctl{margin-top:10px}
.prices .cart-add{width:100%;min-height:42px;padding:8px 12px;background:var(--p-ink);border-color:var(--p-ink);color:var(--p-hero-text);font-size:15px}
.prices .cart-add .icon{color:var(--p-gold)}
.cart-step{display:grid;grid-template-columns:40px minmax(0,1fr) auto 40px;align-items:center;border:1px solid var(--p-gold);border-radius:8px;background:var(--p-card);overflow:hidden}
.prices .cart-step button{min-height:40px;padding:0;border:0;border-radius:0;background:var(--p-ink);color:var(--p-gold);font-size:22px;font-weight:700;line-height:1}
.prices .cart-step input{min-height:40px;min-width:0;padding:0 4px;border:0;border-radius:0;text-align:right;font-size:16px;font-weight:700;color:var(--p-ink);font-variant-numeric:tabular-nums}
.cart-step .cart-unit{padding:0 8px 0 2px;font-size:13px;color:var(--p-muted)}
.price-card.in-cart{box-shadow:0 0 0 2px var(--p-gold),0 6px 18px rgba(19,19,19,.1)}
body.prices.cart-active{padding-bottom:92px}
.cart-bar{position:fixed;left:0;right:0;bottom:0;z-index:20;padding:10px 16px calc(10px + env(safe-area-inset-bottom));pointer-events:none}
.prices .cart-bar button{pointer-events:auto;display:flex;align-items:center;gap:12px;width:100%;max-width:560px;min-height:60px;margin:0 auto;padding:8px 10px 8px 16px;background:var(--p-ink);border:1px solid var(--p-gold);border-radius:12px;color:var(--p-hero-text);box-shadow:0 10px 28px rgba(19,19,19,.3);text-align:left}
.cart-bar-icon .icon{width:24px;height:24px;color:var(--p-gold)}
.cart-bar-text{flex:1;display:flex;flex-direction:column;min-width:0}
.cart-bar-text small{font:600 11px/1.3 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.14em;text-transform:uppercase;color:var(--p-gold)}
.cart-bar-text b{font-size:19px;font-variant-numeric:tabular-nums}
.cart-bar-go{flex-shrink:0;padding:10px 14px;border-radius:8px;background:var(--p-gold);color:var(--p-ink);font-weight:700}
dialog.cart{width:min(560px,calc(100% - 32px));max-width:none;max-height:min(90vh,900px);margin:auto;padding:0;border:0;border-radius:14px;overflow:auto;overscroll-behavior:contain;background:var(--p-bg);color:var(--p-text);box-shadow:0 20px 60px rgba(19,19,19,.35)}
dialog.cart::backdrop{background:rgba(19,19,19,.62)}
.cart-in{padding:0 20px 22px}
.cart-head{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 -20px 4px;padding:16px 20px 12px;background:var(--p-bg);border-bottom:2px solid var(--p-gold)}
.cart-head h2{margin:0;font:700 22px/1.2 var(--p-serif);color:var(--p-ink)}
.prices .cart-close{width:42px;min-height:42px;padding:0;background:var(--p-card);border:1px solid var(--p-line);color:var(--p-ink);font-size:26px;font-weight:400;line-height:1}
.cart-lines{list-style:none;margin:0;padding:0}
.cart-line{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"name total" "step remove";align-items:center;gap:8px 12px;padding:12px 0;border-bottom:1px solid var(--p-line)}
.cart-line-name{grid-area:name;min-width:0}
.cart-line-name strong{display:block;color:var(--p-ink);overflow-wrap:anywhere}
.cart-line-name small{color:var(--p-muted);font-size:13px}
.cart-line-total{grid-area:total;align-self:start;color:var(--p-price);font-variant-numeric:tabular-nums}
.cart-line .cart-step{grid-area:step;max-width:210px}
.prices .cart-remove{grid-area:remove;justify-self:end;min-height:40px;padding:4px 6px;background:none;border:0;color:var(--p-muted);font-size:14px;text-decoration:underline}
.cart-sum{display:flex;align-items:baseline;justify-content:space-between;gap:12px;max-width:none;margin:14px 0 2px;font-weight:700;color:var(--p-ink)}
.cart-sum b{font-size:24px;color:var(--p-price);font-variant-numeric:tabular-nums}
.cart-weigh{max-width:none;margin:0;font-size:13px;color:var(--p-muted)}
.cart-to{max-width:none;margin:16px 0 18px;padding:10px 12px;border:1px solid var(--p-line);border-radius:8px;background:var(--p-card);font-size:14px}
.cart-in>label:first-of-type:not(.cart-to+label){margin-top:16px}
.cart label{color:var(--p-ink)}
.prices select,.prices textarea{border-color:var(--p-line)}
.prices select:focus,.prices textarea:focus{outline-color:rgba(200,161,73,.35);border-color:var(--p-gold)}
.cart-error{max-width:none;margin:0 0 12px;color:var(--p-price);font-weight:600}
.prices .cart-send{width:100%;min-height:52px;background:var(--p-gold);border-color:var(--p-gold);color:var(--p-ink);font-size:16px}
.cart-sent{max-width:none;margin:12px 0 0;padding:10px 12px;border-radius:8px;background:#edf5ee;color:#235c33;font-size:14px}
.prices .cart-clear{width:100%;margin-top:10px;background:none;border:1px solid var(--p-line);color:var(--p-ink)}
@media(min-width:640px){.price-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}}
@media(min-width:960px){.price-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:760px){
  .prices-hero-in{padding:18px 16px;gap:12px 16px}
  .prices-logo{height:68px}
  .prices-title{flex-basis:0}
  .prices-title h1{font-size:26px}
  .prices-call{flex:1 1 100%;flex-direction:row;align-items:baseline;justify-content:space-between;padding:10px 14px}
  main.prices-main{padding:18px 16px 6px}
  .prices-tools [data-print]{display:none}
  .prices-index{margin-bottom:20px}
  .price-group h2{padding:11px 12px 11px 16px;font-size:13px;letter-spacing:.12em}
  .price-body{padding:10px 12px 12px}
  .price-name{font-size:14px}
  .price-value b{font-size:19px}
  .prices-cta{padding:18px 16px}
  .prices-cta .button{width:100%}
  dialog.cart{width:100%;max-height:92vh;margin:auto 0 0;border-radius:16px 16px 0 0}
  .cart-in{padding:0 16px calc(18px + env(safe-area-inset-bottom))}
  .cart-head{margin:0 -16px 4px;padding:14px 16px 10px}
  .prices .cart-add{font-size:14px}
  .cart-step{grid-template-columns:34px minmax(0,1fr) auto 34px}
}
@media print{
  body.prices{background:#fff}
  .prices{display:block;color:#000}
  .prices-hero{background:none;color:#000;border-bottom:2px solid #000}
  .prices-hero-in{padding:0 0 10px;max-width:none}
  .prices-logo{height:60px}
  .prices-eyebrow,.prices-title h1,.prices-address,.prices-call,.prices-call small{color:#000}
  .prices-call{border:0;padding:0}
  .prices-tools,.prices-index,.prices-cta,.prices-foot,.prices-howto,.cart-ctl,.cart-bar,dialog.cart{display:none!important}
  body.prices.cart-active{padding-bottom:0}
  .price-card.in-cart{box-shadow:none}
  main.prices-main{padding:12px 0 0;max-width:none}
  .price-group{margin-bottom:14px}
  .price-group h2{background:none;box-shadow:none;border-radius:0;border-bottom:1px solid #000;padding:6px 0;color:#000;break-after:avoid}
  .price-group h2 small{color:#000}
  .price-grid{display:block;columns:2;column-gap:28px}
  .price-card{display:block;break-inside:avoid;box-shadow:none;border-radius:0;border-bottom:1px solid #bbb}
  .price-photo,.price-photo.is-empty{display:none}
  .price-body{flex-direction:row;align-items:baseline;justify-content:space-between;gap:10px;padding:4px 0}
  .price-brand,.price-name::after{display:none}
  .price-name{font-size:12px}
  .price-value{margin:0;padding:0;text-align:right;white-space:nowrap}
  .price-value b{display:inline;font-size:13px;color:#000}
  .price-value small{display:inline;margin-left:4px;color:#000}
}

@media print{
  body{background:#fff;color:#000;font-size:12px}
  .topbar,nav,.page-heading,.no-print,.app-footer,.quick-bar,.alert[role=status],.skip{display:none!important}
  .shell{display:block}
  main{padding:0;max-width:none}
  .receipt,.panel{padding:0;border:0;margin:12px 0;max-width:none}
  .table-wrap{overflow:visible}
  th,td{padding:8px 6px}
  th{background:none}
  a{color:#000;text-decoration:none}
  .receipt-heading{display:flex;border-color:#000}
  .brand-mark{background:none;border:1px solid #000;color:#000}
  tr{break-inside:avoid}
  .signature{margin-top:60px}
  @page{size:A4;margin:16mm}
}

/* Página pública del comprobante (sin el armazón del sistema). */
.public-receipt{background:var(--bg)}
.public-wrap{max-width:1000px;margin:0 auto;padding:24px 16px 48px}
.public-wrap .actions{justify-content:flex-end}
.receipt-account{margin-top:28px;border-top:1px solid var(--line);padding-top:20px}
.receipt-account h4{margin:0 0 2px;font-size:18px}

/* Panel para enviar el comprobante al cliente. */
.share-panel .actions{margin:0}
.share-panel .share-link{word-break:break-all;font-size:13px;margin:12px 0 0}

/* Pestaña Descargar aplicación (PWA Android, iPhone y Windows) */
.pwa-hero{display:flex;align-items:flex-start;gap:22px;background:linear-gradient(135deg,#fff 0%,#f6f9fc 100%)}
.pwa-app-icon{display:block;width:84px;height:84px;flex-shrink:0;border-radius:18px;box-shadow:0 4px 14px rgba(16,34,47,.12)}
.pwa-hero-body{flex:1;min-width:0}
.pwa-hero-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin-bottom:8px}
.pwa-hero-head h2{margin:0;font-size:24px}
.pwa-hero-body p{margin:0}
.pwa-perks{list-style:none;margin:16px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:8px 22px;font-size:14px;font-weight:600;color:var(--ink)}
.pwa-perks li{display:inline-flex;align-items:center;gap:7px}
.pwa-perks .icon{width:17px;height:17px;color:var(--accent)}
.pwa-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:24px;align-items:stretch;margin-bottom:24px}
.pwa-grid .panel{margin-bottom:0;display:flex;flex-direction:column}
.pwa-card.is-current-os{border-color:var(--brand);box-shadow:inset 0 3px 0 var(--accent),0 8px 22px rgba(38,73,101,.08)}
.pwa-card-head{display:flex;align-items:center;gap:14px;margin-bottom:14px}
.pwa-os-icon{display:inline-flex;align-items:center;justify-content:center;width:54px;height:54px;flex-shrink:0;border-radius:14px}
.pwa-os-icon .icon{width:28px;height:28px}
.pwa-os-icon.is-android{background:var(--ok-soft);color:var(--ok)}
.pwa-os-icon.is-windows{background:var(--brand-soft);color:var(--brand)}
.pwa-os-icon.is-ios{background:var(--tint);color:var(--ink);border:1px solid var(--line)}
.pwa-os-title h2{margin:0 0 4px;font-size:22px}
.pwa-cta{margin:6px 0 22px}
.pwa-btn{width:100%;min-height:50px;font-size:16px}
.pwa-btn.is-ready{background:var(--ok);border-color:var(--ok)}
.pwa-feedback{margin:12px 0 0;padding:12px 14px;border:1px solid #bcd3e6;border-left:4px solid var(--brand);border-radius:6px;background:var(--brand-soft);color:var(--ink);font-size:14px;max-width:none}
.pwa-feedback.is-ok{border-color:#b9dcc8;border-left-color:var(--ok);background:#eef8f2;color:#1d5239}
.pwa-steps-title{margin:auto 0 10px;font:600 12px/1.3 Bahnschrift,'Segoe UI',sans-serif;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
.pwa-steps .step{padding:11px 14px}
.pwa-steps .step-body small b{color:var(--ink)}
.pwa-local-note{display:flex;align-items:flex-start;gap:10px;margin:16px 0 0;padding:12px 14px;border:1px solid #f0d7a7;border-radius:8px;background:var(--warn-soft);color:#6f4700;font-size:14px;max-width:none}
.pwa-local-note .icon{margin-top:2px;color:var(--warn)}
.pwa-local-note code{padding:1px 5px;border-radius:4px;background:rgba(255,255,255,.7);font-size:13px}
.login-pwa{margin-top:18px;padding-top:16px;border-top:1px solid var(--line);text-align:center}
.login-pwa button{width:100%;min-height:44px}
@media(max-width:960px){
  .pwa-grid{grid-template-columns:1fr;gap:18px}
  .pwa-card.is-current-os{order:-1}
}
@media(max-width:760px){
  .pwa-hero{flex-direction:column;gap:14px}
  .pwa-app-icon{width:70px;height:70px;border-radius:15px}
  .pwa-perks{flex-direction:column;gap:8px}
}
