.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-btn); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); }
.btn-text { background: none; border-color: transparent; color: var(--link); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: var(--surface-2); }
  .btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
  .btn-text:hover:not(:disabled) { background: var(--surface-2); }
}
.btn-primary { background: var(--brand); color: var(--brand-text); border-color: var(--brand); font-weight: 700; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--surface-2); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-link { background: none; border: 0; color: var(--link); text-decoration: underline; text-underline-offset: 3px; min-height: 40px; cursor: pointer; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.field label { font-weight: 600; font-size: .9rem; }
.field input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }
.form-error { color: var(--danger); min-height: 1.4em; margin: 0; }
.who { font-weight: 600; margin: 0; }
.user-list { display: grid; gap: 8px; }
.user-btn { min-height: 48px; text-align: left; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); cursor: pointer; }
.user-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--surface-2); }
.divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.code { font: 700 1.8rem/1.2 var(--font-mono); letter-spacing: .15em; text-align: center; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.card-link { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: inherit; }
.empty { padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.toast { position: fixed; left: 50%; translate: -50% 8px; opacity: 0; bottom: calc(var(--nav-h) + var(--sp-4) + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-btn); z-index: var(--z-toast); box-shadow: var(--shadow-2); transition: opacity 140ms var(--ease-in), translate 140ms var(--ease-in); }
.toast.is-in { opacity: 1; translate: -50% 0; transition: opacity var(--dur-3) var(--ease-out), translate var(--dur-3) var(--ease-out); }
@media (min-width: 1024px) { .toast { bottom: 24px; } }
/* Mapache (D5): una cabeza, poses por data-pose, todo con transform/opacity */
.rc { width: min(200px, 56vw); height: auto; overflow: visible; --ex: calc(var(--gx, 0) * 4px); --ey: calc(var(--gy, 0) * 3px); --hx: calc(var(--gx, 0) * 3px); --hr: calc(var(--gx, 0) * 2deg); }
.fur { fill: var(--r-fur); stroke: var(--r-line); stroke-width: 2; } .lt { fill: var(--r-lt); } .dk { fill: var(--r-dk); } .eye { fill: var(--r-eye); } .hl { fill: #fff; }
.nose { fill: var(--r-nose); } .blush { fill: var(--r-blush); opacity: .45; } .toe { fill: var(--r-line); }
.brow { fill: none; stroke: var(--r-lt); stroke-width: 3.5; stroke-linecap: round; opacity: 0; transform-box: fill-box; transform-origin: center; transition: opacity var(--dur-3), transform var(--t-slow) var(--ease-out); }
.mouth { fill: none; stroke: var(--r-nose); stroke-width: 2.5; stroke-linecap: round; opacity: 0; transition: opacity var(--dur-3); }
.okbg { fill: var(--ok); } .tick { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.r-bob { transform-origin: 100px 150px; }
.r-head { transform: translate(var(--hx), var(--hy, 0px)) rotate(var(--hr)); transform-origin: 100px 140px; transition: transform var(--t-slow) var(--ease-out); }
.r-eye { transform: translate(var(--ex), var(--ey)); transition: transform var(--dur-3) var(--ease-out); }
.r-hl { transform: translate(calc(var(--ex) * .3), calc(var(--ey) * .3)); }
.r-ball { transform-box: fill-box; transform-origin: center; transition: transform var(--dur-3) var(--ease-out); animation: blink 5.4s var(--ease-in-out) infinite; }
.r-tail { transform-origin: 0 0; animation: sway 6s var(--ease-in-out) infinite alternate; }
.r-paws { opacity: 0; transform: translateY(80px); transition: transform 200ms var(--ease-in), opacity var(--dur-3) var(--ease-in); }
.r-check { opacity: 0; transform: scale(.7); transform-box: fill-box; transform-origin: center; transition: opacity var(--dur-3), transform var(--t-slow) var(--ease-out); }
.m-smile { opacity: 1; }
[data-pose] { --gx: var(--px, 0); --gy: var(--py, 0); }
[data-pose="watch"] { --gx: var(--look, 0); --gy: .6; }
[data-pose="away"] { --gx: var(--form-x, 1); --gy: var(--form-y, .4); --hr: 3deg; }
[data-pose="away"] .brow { opacity: .8; transform: translateY(-3px); }
[data-pose="wrong"] { --gx: 0; --gy: .9; }
[data-pose="wrong"] .r-bob { animation: no-no 1100ms var(--ease-in-out); }
[data-pose="wrong"] .brow-l { opacity: 1; transform: rotate(-16deg); } [data-pose="wrong"] .brow-r { opacity: 1; transform: rotate(16deg); }
[data-pose="ok"], [data-pose="success"] { --gx: 0; --gy: .4; }
[data-pose="ok"] .r-bob, [data-pose="success"] .r-bob { animation: nod 900ms var(--ease-in-out); }
[data-pose="ok"] .r-ball, [data-pose="success"] .r-ball { transform: scaleY(.55); animation: none; }
[data-pose="success"] .r-check { opacity: 1; transform: none; }
[data-pose="success"] .tick { stroke-dashoffset: 0; transition: stroke-dashoffset 450ms var(--ease-out) 150ms; }
[data-pose="cover"] { --gx: 0; --gy: 0; }
[data-pose="cover"] .r-paws { opacity: 1; transform: none; transition: transform var(--t-slow) var(--ease-out), opacity var(--dur-3) var(--ease-out); }
[data-pose="away"] .m-smile, [data-pose="wrong"] .m-smile, [data-pose="cover"] .m-smile { opacity: 0; }
[data-pose="away"] .m-flat, [data-pose="wrong"] .m-frown { opacity: 1; }
@media (max-width: 767px) { .rc { --form-x: 0; --form-y: 1; } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(.1); } }
@keyframes sway { to { transform: rotate(4deg); } }
@keyframes nod { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(7px); } 58% { transform: translateY(-1px); } 78% { transform: translateY(3px); } }
@keyframes no-no { 0%, 100% { transform: rotate(0); } 18% { transform: rotate(-4deg) translateX(-3px); } 42% { transform: rotate(4deg) translateX(3px); } 64% { transform: rotate(-3deg) translateX(-2px); } 84% { transform: rotate(2deg); } }
@media (prefers-reduced-motion: reduce) {
  .r-ball, .r-tail, .r-bob { animation: none !important; }
  .r-head, .r-eye, .brow, .r-paws, .r-check, .mouth, .tick, .toast { transition: none !important; }
  .rc { --ex: 0px; --ey: 0px; --hx: 0px; --hr: 0deg; }
  .pf-section > summary::after { transition: none; }
}
/* Estado vacío: mapache quieto con parpadeo, una frase y un botón */
.empty-state { display: grid; justify-items: center; gap: var(--sp-3); padding: var(--sp-6) var(--sp-4); text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.empty-state .empty-art { width: 120px; }
.empty-state .rc { width: 100%; }
.empty-state p { margin: 0; color: var(--muted); max-width: 36ch; }
/* Esqueleto: solo si la carga pasa de 150 ms */
.skeleton { display: grid; gap: var(--sp-2); animation: skeleton-in 0s linear 150ms backwards; }
.skeleton > span { display: block; height: 16px; border-radius: 6px; background: var(--line); animation: pulse 1.4s var(--ease-in-out) infinite; }
.skeleton > span:nth-child(2) { width: 80%; } .skeleton > span:nth-child(3) { width: 60%; }
@keyframes skeleton-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skeleton > span { animation: none; } }

/* Lista de productos: tabla en escritorio, tarjetas en celular */
.ptoolbar { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.ptoolbar .field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.ptoolbar input, .ptoolbar select { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); font-weight: 400; }
.ptable { width: 100%; border-collapse: collapse; }
.ptable th, .ptable td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ptable th { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.ptable td { font-variant-numeric: tabular-nums; }
.ptable td { overflow-wrap: anywhere; } /* nombres de 200 letras seguidas no ensanchan la tabla; los estados (.badge) van con nowrap y no se parten */
@media (hover: hover) and (pointer: fine) { .ptable tbody tr:hover { background: var(--surface-2); } }
.ptable-wrap { overflow-x: auto; }
.ptable .num, .ptable th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pcards { display: none; gap: 12px; }
.pcard { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pcard-price { font-weight: 700; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .ptable-wrap:has(+ .pcards) { display: none; } /* solo cuando hay tarjetas equivalentes (Productos); el resto de tablas se desplaza */
  :not(.ptable-wrap) > .ptable { display: block; max-width: 100%; overflow-x: auto; }
  .pcards { display: grid; }
}

/* Formularios compartidos (registro de producto y catálogo) */
.btn-small { min-height: 44px; padding: 0 12px; font-size: .9rem; }
.field select, .field input[type="text"] { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); width: 100%; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); margin: 0; font-size: .9rem; }
.field-error:empty { display: none; }
.hint { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--text); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-off, .badge-neutral { background: var(--surface-2); color: var(--muted); }

/* Registro rápido de producto */
.pf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pf-head h1 { margin: 0; }
.pf { max-width: 860px; }
.pf-main { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pf-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pf-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pf-section > summary { min-height: 44px; display: flex; align-items: center; padding: 0 16px; font-weight: 600; cursor: pointer; list-style: none; }
.pf-section > summary::-webkit-details-marker { display: none; }
/* Chevron propio (display:flex quita el marcador nativo): apunta a la derecha cerrado y abajo abierto */
.pf-section > summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur); }
.pf-section[open] > summary::after { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .pf-section > summary::after { transition: none; } }
.pf-section[open] > summary { border-bottom: 1px solid var(--line); }
.pf-section > :not(summary) { margin: 14px 16px; }
.pf-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-packs { display: grid; gap: 12px; }
.pf-pack { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; margin: 0; display: grid; gap: 10px; justify-items: start; }
.pf-pack > .pf-grid { width: 100%; }
.pf-pack legend { font-weight: 600; padding: 0 4px; }
.pf-photobox { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.pf-photoacts { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.pf-photo { width: 120px; height: 120px; border-radius: 16px; border: 1px solid var(--line); object-fit: cover; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.inline-new { display: grid; gap: 6px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; }
.inline-new label { font-weight: 600; font-size: .9rem; }
.inline-row { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-row input { flex: 1 1 160px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }
.field > .btn-small { justify-self: start; }
.pcard-actions { margin-top: 6px; }
@media (max-width: 640px) {
  .pf-actions .btn { flex: 1 1 100%; }
}

/* Ajustes de catálogo */
.cs-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.cs-tab { min-height: 44px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer; white-space: nowrap; }
.cs-tab[aria-selected="true"] { border-bottom-color: var(--brand); font-weight: 600; }
.cs-panel { display: grid; gap: 16px; }
.cs-create { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.cs-create-fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); flex: 1 1 280px; }
.cs-create > .field-error, .cs-create > .hint { flex-basis: 100%; }
.cs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cs-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cs-row > .field-error { flex-basis: 100%; }
.cs-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.cs-name { font-weight: 600; overflow-wrap: anywhere; }
.cs-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-rename { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 260px; }
.cs-rename input { flex: 1 1 160px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }

/* Importación de productos */
.imp-drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 24px; text-align: center; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.imp-drop.dragover { border-color: var(--brand); background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .imp-drop:hover { border-color: var(--brand); background: var(--surface-2); } }
.imp-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.imp-stat { flex: 1 1 140px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.imp-stat-num { font-size: 1.5rem; font-weight: 700; }
.badge-ok, .badge-success { background: var(--success-bg); color: var(--success); }
.badge-error, .badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn, .badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.sunat-state { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 4px; }
.imp-errors { margin: 0; padding-left: 18px; color: var(--danger); font-size: 0.85rem; }

/* Ventas (T3.1/T3.2) */
.btn-danger { background: var(--danger); color: var(--surface); border-color: var(--danger); font-weight: 600; }
.dlg { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: var(--surface); color: var(--text); width: min(440px, calc(100vw - 32px)); }
.dlg { box-shadow: var(--shadow-3); opacity: 1; transform: none; transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out); }
@starting-style { .dlg[open] { opacity: 0; transform: translateY(8px); } }
.dlg.is-closing { opacity: 0; transform: translateY(4px); transition-duration: 140ms; transition-timing-function: var(--ease-in); }
.dlg::backdrop { background: rgb(23 34 54 / .4); }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.sale-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sale-head h1 { margin: 0; }
.sale-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.sale-main { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-content: start; min-width: 0; }
.sale-searchrow { display: flex; gap: 8px; align-items: center; }
.sale-searchrow .btn { flex: none; min-height: 52px; }
.scan-btn { width: 52px; padding: 0; display: grid; place-items: center; color: var(--hot-strong); }
.sale-search { flex: 1; min-width: 0; width: 100%; min-height: 52px; padding: 0 16px; font-size: 1.1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }
.sale-search:focus { border-color: var(--brand); outline: 2px solid var(--focus); outline-offset: 2px; }
.sale-results { display: grid; gap: 6px; }
.sale-result { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; padding: 8px 14px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.sale-result:focus-visible { border-color: var(--brand); background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .sale-result:hover { border-color: var(--brand); background: var(--surface-2); } }
.sale-cart { display: grid; gap: 8px; }
.sale-line { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.sale-line-name { display: grid; min-width: 0; }
.sale-line-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-stepper { display: inline-flex; align-items: center; gap: 4px; }
.sale-stepper input { width: 52px; min-height: 44px; text-align: center; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }
.sale-stepper .btn { padding: 0; min-width: 44px; font-size: 1.2rem; }
.sale-line-total { min-width: 84px; text-align: right; }
.sale-del { padding: 0; min-width: 44px; color: var(--muted); }
.sale-notice { margin: 0; padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.sale-notice.is-ok { background: var(--success-bg); color: var(--success); }
.sale-notice.is-error { background: var(--danger-bg); color: var(--danger); }
.sale-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; min-width: 0; }
.sale-card > * { min-width: 0; }
.sale-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.sale-card h2 { font-size: 1rem; margin: 0; color: var(--muted); font-weight: 600; }
.sale-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--bg); border-radius: 10px; }
.sale-seg-btn { min-height: 44px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: .9rem; }
.sale-seg-btn[aria-pressed="true"] { background: var(--brand); color: var(--brand-text); font-weight: 600; }
.sale-seg-btn { white-space: nowrap; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.sale-customer { justify-content: space-between; text-align: left; width: 100%; }
.sale-payrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sale-payrow select, .sale-payrow input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); width: 100%; }
.sale-payactions { display: flex; gap: 8px; flex-wrap: wrap; }
.sale-hint { margin: 0; font-weight: 700; }
.sale-hint.is-ok { color: var(--success); }
.sale-hint.is-warn { color: var(--warning); }
.sale-sumrow { display: flex; justify-content: space-between; }
.sale-sumtotal { font-size: 1.5rem; font-weight: 800; padding-top: 6px; border-top: 1px solid var(--line); }
.sale-emit { width: 100%; min-height: 56px; font-size: 1.1rem; }
.sales-view .sale-head { margin-bottom: 8px; }
/* Dos columnas solo si el área útil alcanza: con menú expandido hace falta más ancho que con el compacto. */
@media (min-width: 900px) {
  .frame.nav-compact .sale-view { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .frame.nav-compact .sale-view .sale-side { position: sticky; top: 12px; }
}
@media (min-width: 1180px) {
  .sale-view { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .sale-view .sale-side { position: sticky; top: 12px; }
}
/* En PC el panel derecho cabe en la pantalla: si no alcanza el alto, se desplaza por dentro y el total con «Cobrar» queda siempre visible abajo. */
@media (min-width: 900px) {
  .sale-view .sale-side { max-height: calc(100dvh - var(--nav-h) - 28px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .sale-side .sale-card { padding: 12px; gap: 8px; }
  .sale-side .sale-seg-btn { min-height: 40px; }
  .sale-side .sale-sum { position: sticky; bottom: 0; z-index: 1; box-shadow: 0 -6px 16px rgb(0 0 0 / .18); }
  .sale-side .sale-emit { min-height: 50px; }
}
@media (max-width: 899px) {
  .sale-line { grid-template-columns: 1fr auto; }
  .sale-line-total { text-align: left; }
}

/* Caja (T3.3) */
.cash-view { display: grid; gap: 14px; }
.cash-body { display: grid; gap: 14px; align-content: start; }
.cash-sub { font-size: 1.1rem; margin: 8px 0 0; }
.cash-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.cash-card { align-content: start; }
.cash-amount { font-size: 1.5rem; }
.cash-count input { min-height: 48px; padding: 0 12px; font-size: 1.1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); width: 100%; }
.cash-diff { font-weight: 700; }
.cash-diff.is-ok, .cash-diff.is-over { color: var(--success); }
.cash-diff.is-short, .cash-diff.is-invalid { color: var(--danger); }
.cash-moves { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cash-moves li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }

/* D1.3 Clases que las vistas ya usaban sin definir */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.between { justify-content: space-between; }
.gap-xs { gap: var(--sp-1); } .gap-sm { gap: var(--sp-2); }
.text-right { text-align: right; } .text-center { text-align: center; }
.font-bold { font-weight: 700; } .font-xs { font-size: .8rem; }
.mono { font-family: var(--font-mono); }
.input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }
select.input { max-width: 100%; }
.error-msg, .feedback { color: var(--danger); margin: 0; }
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.table th { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.table .text-right, .table th.text-right { text-align: right; }
@media (hover: hover) and (pointer: fine) { .table tbody tr:hover { background: var(--surface-2); } }
.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--gap); background: rgb(23 34 54 / .4); }
.modal-card { width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: var(--sp-5); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-3); }
.scanner-video { width: 100%; border-radius: var(--radius); background: #000; }

/* D4 Venta */
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.sale-reason { margin: 0; font-size: .9rem; color: var(--muted); text-align: center; }
.sale-line.is-flash { animation: line-flash 600ms var(--ease-out); }
@keyframes line-flash { from { background: var(--info-bg); } to { background: var(--surface); } }
.sale-lots { display: grid; gap: 4px; }
.sale-lots:empty { display: none; }
.sale-lot select { min-height: 44px; max-width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); padding: 0 8px; }
.sale-bar { position: fixed; z-index: var(--z-nav); left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--gap); background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-2); }
.sale-bar[hidden] { display: none; }
.sale-bar-info { font-weight: 700; font-variant-numeric: tabular-nums; }
.sale-bar-btn { min-width: 132px; }
.sale-view { padding-bottom: 72px; }
@media (min-width: 900px) { .sale-bar { display: none; } .sale-view { padding-bottom: 0; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } .sale-line.is-flash { animation: none; } }

/* D5.3 Entrada */
.field-pin { position: relative; }
.field-pin input { padding-right: 52px; }
.pin-eye { position: absolute; right: 0; bottom: 0; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: var(--radius-field); background: none; color: var(--muted); cursor: pointer; }
.pin-eye[aria-pressed="true"] { color: var(--brand); }
.field input[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.form-error:not(:empty) { animation: err-in var(--dur-3) var(--ease-out); }
@keyframes err-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.demo-box { margin-top: var(--sp-4); border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.demo-box > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--muted); }
.demo-box .user-list { margin-top: var(--sp-2); }
@media (prefers-reduced-motion: reduce) { .form-error:not(:empty) { animation: none; } }

/* D5.5 Inicio */
.home-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.home-datum { margin: 0; font-size: clamp(1.4rem, 4.5vw, 2.1rem); font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.home-datum a { color: inherit; text-decoration: none; }
.home-sell { min-height: 52px; padding: 0 28px; font-size: 1.05rem; }
.home-card { margin-bottom: var(--sp-5); padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); display: grid; gap: var(--sp-3); }
.home-card[hidden] { display: none; }
.home-card h2 { margin: 0; font-size: 1.05rem; }
.home-card.is-quiet { background: transparent; box-shadow: none; }
.home-card.is-quiet h2 { color: var(--muted); font-size: .95rem; }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.today-item { display: flex; gap: var(--sp-3); align-items: baseline; }
.today-item a, .home-card > a { display: inline-block; min-height: 24px; line-height: 24px; } /* WCAG 2.2 AA 2.5.8: objetivo >=24px */
.today-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transform: translateY(-1px); }
.today-item.is-high .today-dot { background: var(--danger); }
.today-item.is-medium .today-dot { background: var(--warning); }

/* D6 Pulido */
.skip-link { position: absolute; left: var(--sp-3); top: -100px; z-index: var(--z-toast); padding: 10px 16px; border-radius: var(--radius-btn); background: var(--brand); color: var(--brand-text); }
.skip-link:focus { top: var(--sp-3); }
.frame-main:focus { outline: none; }
.user-menu-panel, .more-panel { animation: pop-in var(--dur-3) var(--ease-out); transform-origin: top right; }
.more-panel { transform-origin: bottom right; }
.user-menu-panel.is-out, .more-panel.is-out { animation: pop-out 140ms var(--ease-in) forwards; }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop-out { to { opacity: 0; transform: translateY(4px) scale(.98); } }
.inventory-view > .input { width: 100%; }
.inventory-view .table-container { max-height: 68dvh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.inventory-view .table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
@media (prefers-reduced-motion: reduce) {
  .user-menu-panel, .more-panel, .user-menu-panel.is-out, .more-panel.is-out { animation: none; }
  .toast, .toast.is-in, .dlg, .dlg.is-closing { transition: none; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* D6.3 Formularios de configuración */
.form-page { max-width: 600px; }
.form-section { display: grid; gap: var(--sp-3); padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.form-section h2 { margin: 0; font-size: 1.05rem; }
.field-label { font-weight: 600; font-size: .9rem; }
.dropzone { position: relative; display: grid; place-items: center; min-height: 96px; padding: var(--sp-4); text-align: center; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--muted); cursor: pointer; transition: border-color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out); }
.dropzone.dragover, .dropzone:focus-within { border-color: var(--brand); background: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .dropzone:hover { border-color: var(--brand); background: var(--surface-2); } }
.dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* ADR 0041 · Profundidad: superficies con borde de luz y sombra teñida de navy */
.card-link, .home-card:not(.is-quiet), .imp-stat, .sale-card, .sale-line, .sale-result, .pcard, .form-section, .pf-section, .cs-row, .cs-create, .cash-moves li, .empty-state, .modal-card, .dlg,
.inventory-view .table-container {
  border-color: var(--edge); border-top-color: var(--edge-top); box-shadow: var(--shadow-1);
}
.empty-state { border-style: solid; }
/* Tarjetas de acceso con el tono de su área */
.card-link:not([data-tone]) { --tone: var(--c-sales); --tone-bg: var(--c-sales-bg); }
.card-link { position: relative; gap: 12px; padding: 18px; background: linear-gradient(135deg, var(--surface) 58%, var(--tone-bg)); transition: transform var(--dur-3) var(--ease-spring), box-shadow var(--dur-3) var(--ease-out), border-color var(--dur-2) var(--ease-out); }
.card-link .ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--tone-bg); color: var(--tone); }
.card-link strong { font-size: 1.02rem; }
.card-link:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .card-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--tone) 35%, var(--edge)); } }
/* KPI: micro-degradado hacia el tono, cifra grande */
.imp-stat { --tone: var(--c-sales); --tone-bg: var(--c-sales-bg); gap: 6px; padding: 14px 16px; border-radius: 12px; background: linear-gradient(135deg, var(--surface) 55%, var(--tone-bg)); }
.imp-stat-num { font-size: 1.65rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.imp-stat > .muted { font-size: .85rem; font-weight: 600; }
.imp-stats > .imp-stat:nth-child(4n+2) { --tone: var(--c-cash); --tone-bg: var(--c-cash-bg); }
.imp-stats > .imp-stat:nth-child(4n+3) { --tone: var(--c-reports); --tone-bg: var(--c-reports-bg); }
.imp-stats > .imp-stat:nth-child(4n+4) { --tone: var(--c-stock); --tone-bg: var(--c-stock-bg); }
/* Inicio: banda terracota con saludo, dato del día y venta (como el hero de Ánfora) */
.home-hero { position: relative; overflow: hidden; display: grid; justify-content: stretch; align-items: start; gap: var(--sp-3); padding: clamp(20px, 4vw, 32px); border-radius: 20px; color: #faf7f2;
  background: radial-gradient(520px 260px at 92% 0%, rgb(245 158 11 / .28), transparent 70%), radial-gradient(420px 240px at 0% 110%, rgb(124 45 18 / .55), transparent 70%), linear-gradient(135deg, #7c2d12, #c2410c);
  box-shadow: var(--shadow-2); }
.home-hero h1 { margin: 0; font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 600; color: #ffe8d1; }
.home-hero .home-datum { color: #fff; }
.home-hero .home-datum a { color: inherit; }
.home-hero-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); }
.home-hero .home-sell { background: #faf7f2; border-color: #faf7f2; color: #7c2d12; box-shadow: 0 8px 22px rgb(60 20 5 / .35); }
@media (hover: hover) and (pointer: fine) { .home-hero .home-sell:hover:not(:disabled) { background: #fff; border-color: #fff; } }
.today-item.is-info .today-dot { background: var(--c-sales); }
.sale-sumtotal .money, .cash-amount.money { font-size: 1.6rem; }

/* Campos al estilo de la referencia del dueño: esquinas amplias, etiqueta corta en mayúsculas, foco naranja */
.field label:not(:has(input, select)), .field-label { font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text); }
.field input, .field select, .field textarea, .input, .ptoolbar input, .ptoolbar select, .sale-search, .cash-count input, .inline-row input, .cs-rename input, .sale-payrow select, .sale-payrow input {
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .ptoolbar input:focus, .ptoolbar select:focus, .cash-count input:focus, .inline-row input:focus, .sale-payrow select:focus, .sale-payrow input:focus {
  outline: none; border-color: var(--hot-strong); box-shadow: 0 0 0 4px var(--hot-soft);
}
.sale-search:focus { outline: none; border-color: var(--hot-strong); box-shadow: 0 0 0 4px var(--hot-soft); }

/* ADR 0041 · Movimiento */
/* Al entrar a una pantalla, sus bloques suben y aparecen uno tras otro (40 ms entre cada uno) */
@media (prefers-reduced-motion: no-preference) {
  .frame-main > * { animation: view-in 300ms var(--ease-out) both; }
  .frame-main > :nth-child(2) { animation-delay: 40ms; } .frame-main > :nth-child(3) { animation-delay: 80ms; }
  .frame-main > :nth-child(4) { animation-delay: 120ms; } .frame-main > :nth-child(5) { animation-delay: 160ms; }
  .frame-main > :nth-child(n+6) { animation-delay: 200ms; }
  .cards > * { animation: view-in 320ms var(--ease-out) both; }
  .cards > :nth-child(2) { animation-delay: 140ms; } .cards > :nth-child(3) { animation-delay: 180ms; } .cards > :nth-child(4) { animation-delay: 220ms; }
  .cards > :nth-child(5) { animation-delay: 260ms; } .cards > :nth-child(n+6) { animation-delay: 300ms; }
  .cards > :first-child { animation-delay: 100ms; }
}
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
/* Píldora que se desliza entre opciones (Nota de venta · Boleta · Factura) */
.sale-seg.has-pill { position: relative; isolation: isolate; }
.seg-pill { position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 16px) / 3); border-radius: 8px; background: var(--brand); box-shadow: 0 2px 8px rgb(20 35 58 / .18); }
.sale-seg.has-pill .sale-seg-btn[aria-pressed="true"] { background: none; }
.sale-seg-btn { transition: color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out); }
/* Respuesta al tocar: todo lo que se presiona se hunde un poco */
.sale-seg-btn:active, .sale-result:active, .user-btn:active, .cs-tab:active, .user-menu-btn:active, .pcard:active, .imp-drop:active, .dropzone:active { transform: scale(.97); }
.sale-result, .user-btn, .cs-tab, .user-menu-btn { transition: transform var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out); }
.btn-primary { box-shadow: 0 2px 6px rgb(20 35 58 / .14); transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
@media (any-hover: hover) { .btn-primary:hover:not(:disabled) { box-shadow: 0 6px 16px rgb(20 35 58 / .22); } .sale-result:hover { transform: translateX(2px); } }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 2px rgb(20 35 58 / .2); }

/* ADR 0041 · Gráficos (ui/charts.js) */
.chart-card { padding: var(--sp-4) var(--sp-5); border: 1px solid var(--edge); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); min-width: 0; }
.chart-card h2 { margin: 0; font-size: 1.05rem; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.chart-head .sale-seg { grid-template-columns: repeat(3, auto); }
.report-grid { display: grid; align-items: start; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.chart { display: grid; gap: var(--sp-2); --chart-a: var(--c-sales); }
.chart-wrap { position: relative; }
.chart-svg { display: block; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--chart-a); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-ghost { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 4 4; opacity: .55; }
.chart-dot { fill: var(--chart-a); stroke: var(--surface); stroke-width: 2; }
.chart-dot-ghost { fill: var(--muted); stroke: var(--surface); stroke-width: 2; }
.chart-cross { stroke: var(--line-strong); stroke-width: 1; }
.chart-tip { position: absolute; top: 8px; display: grid; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: .85rem; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-2); }
.chart-tip .muted { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.chart-tip-row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-4); font-size: .85rem; color: var(--muted); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.key-a { background: var(--chart-a, var(--c-sales)); }
.key-ghost { height: 0; width: 14px; border-top: 2px dashed var(--muted); border-radius: 0; }
.chart-table > summary { cursor: pointer; color: var(--link); font-size: .9rem; min-height: 32px; display: flex; align-items: center; }
/* Dona */
.donut { display: grid; grid-template-columns: minmax(140px, 180px) 1fr; gap: var(--sp-4); align-items: center; }
@media (max-width: 480px) { .donut { grid-template-columns: 1fr; justify-items: center; } .donut-svg { max-width: 180px; } }
.donut-svg { width: 100%; height: auto; }
.donut-track { fill: none; stroke: var(--surface-2); stroke-width: 22; }
.donut-seg { fill: none; stroke-width: 22; transform: rotate(-90deg); transform-origin: 100px 100px; }
.donut-cap { font-size: 12px; fill: var(--muted); font-weight: 600; }
.donut-total { font-size: 19px; fill: var(--text); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.donut-legend li { display: grid; grid-template-columns: auto 1fr auto 3.2em; align-items: center; gap: 8px; font-size: .92rem; }
.donut-legend .key { width: 12px; height: 12px; border-radius: 4px; }
.donut-legend .muted { text-align: right; }
/* Barras horizontales */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hbars:not([data-tone]) { --tone: var(--c-sales); }
.hbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline; }
.hbar-name { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.hbar-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hbar-name .muted { font-size: .82rem; white-space: nowrap; }
.hbar-val { font-size: .92rem; }
.hbar-track { grid-column: 1 / -1; height: 10px; border-radius: 0 6px 6px 0; background: var(--surface-2); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 0 6px 6px 0; background: var(--tone); transform-origin: left center; }
/* KPI: cambio frente al periodo anterior */
.kpi-delta { font-size: .8rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi-delta.is-good { color: var(--success); } .kpi-delta.is-bad { color: var(--danger); }
/* Sparkline del Inicio con el punto de hoy «en vivo» */
.home-spark { display: grid; gap: 4px; justify-items: start; color: #b9c7da; font-size: .8rem; font-weight: 600; }
.spark { width: 160px; height: 48px; overflow: visible; }
.spark-line { fill: none; stroke: #5cc0e8; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: rgb(92 192 232 / .16); }
.spark-dot { fill: #ff8a1f; stroke: #0f1d33; stroke-width: 2; }
.spark-pulse { fill: #ff8a1f; opacity: 0; transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .chart-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 900ms var(--ease-out) 120ms forwards; }
  .chart-area { animation: fade-in 600ms var(--ease-out) 300ms both; }
  .donut-seg { animation: donut-in 700ms var(--ease-out) both; animation-delay: calc(var(--i) * 70ms); }
  .hbar-fill { animation: grow 700ms var(--ease-spring) both; animation-delay: calc(var(--i) * 60ms + 100ms); }
  .spark-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s var(--ease-out) 200ms forwards; }
  .spark-pulse { animation: live 2.4s var(--ease-out) 1.2s infinite; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes donut-in { from { opacity: 0; transform: rotate(-120deg); } }
@keyframes live { 0% { opacity: .55; transform: scale(.6); } 100% { opacity: 0; transform: scale(2.4); } }
.home-hero-main { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-5); }

/* Inicio: accesos grandes y stock crítico con medidor (ADR 0042) */
.dash-quick-panel { margin-bottom: var(--sp-5); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--sp-3); }
.panel-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; letter-spacing: .01em; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.quick-card { background: var(--surface); border: 1px solid var(--edge); border-radius: 12px; padding: var(--sp-3) var(--sp-1) var(--sp-2); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: inherit; text-decoration: none; cursor: pointer; font-family: inherit; transition: transform 120ms var(--ease-out), border-color 120ms var(--ease-out); -webkit-tap-highlight-color: transparent; }
.quick-card:active { transform: translateY(1px) scale(.96); border-color: var(--tone, var(--hot)); }
.quick-icon { width: 38px; height: 38px; border-radius: 9px; background: var(--tone-bg, var(--hot-soft)); color: var(--tone, var(--hot)); display: flex; align-items: center; justify-content: center; }
.quick-card.quick-scan .quick-icon { background: linear-gradient(135deg, var(--hot), var(--hot-strong)); color: #fff; }
.quick-icon svg { width: 20px; height: 20px; }
.quick-label { font-size: .75rem; font-weight: 700; line-height: 1.2; }
.quick-sub { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 0 var(--sp-1); }
@media (min-width: 720px) { .quick-grid { gap: var(--sp-3); } .quick-card { padding: var(--sp-4) var(--sp-2) var(--sp-3); } .quick-label { font-size: .85rem; } }
@media (hover: hover) and (pointer: fine) { .quick-card:hover { border-color: var(--tone, var(--hot)); transform: translateY(-1px); } }
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.alert-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.alert-main { display: grid; min-width: 0; }
.alert-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-main .muted { font-family: var(--font-mono); font-size: .78rem; }
/* Medidor de stock: una barra que se llena suave hasta el stock (color del nivel); la rayita es el mínimo */
.meter { --lvl: var(--success); position: relative; flex: 0 0 110px; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--text) 10%, transparent); }
.meter-low { --lvl: var(--warning); } .meter-critical { --lvl: var(--danger); }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--lvl) 70%, transparent), var(--lvl)); transform-origin: left center; }
.meter-min { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--text); opacity: .55; }
@media (prefers-reduced-motion: no-preference) {
  .meter-fill { animation: meter-grow 900ms cubic-bezier(.22, 1, .36, 1) both; }
  .meter-critical .meter-fill { animation: meter-grow 900ms cubic-bezier(.22, 1, .36, 1) both, meter-alert 1.4s ease-in-out 1s 2; }
}
@keyframes meter-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes meter-alert { 50% { box-shadow: 0 0 10px var(--lvl); } }
/* Productos: lista con existencia y ficha (ADR 0042) */
.is-click { cursor: pointer; }
.ptable tr.is-click:focus-visible, .pcard.is-click:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.p-stock { display: grid; gap: 4px; min-width: 110px; }
.p-stock .meter { flex: none; width: 100%; }
.lvl-text-critical { color: var(--danger); font-weight: 700; } .lvl-text-low { color: var(--warning); font-weight: 700; } .lvl-text-ok { color: var(--success); }
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-pill); font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.chip.is-ok, .chip.lvl-ok { background: var(--success-bg); color: var(--success); }
.chip.is-off { background: var(--surface-2); color: var(--muted); }
.chip.lvl-low { background: var(--warning-bg); color: var(--warning); }
.chip.lvl-critical { background: var(--danger-bg); color: var(--danger); }
/* Ficha de producto: panel lateral derecho (como Ánfora) */
.dlg.pd-drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(460px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; padding: 0; border-radius: 20px 0 0 20px; border-width: 0 0 0 1px; background: var(--bg); overflow: hidden; }
.dlg.pd-drawer[open] { animation: pd-slide 260ms var(--ease-out); }
@keyframes pd-slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dlg.pd-drawer[open] { animation: none; } }
.dlg.pd-drawer.is-closing { transform: translateX(24px); }
.pd-body { display: grid; align-content: start; gap: var(--sp-5); padding: 0 20px 40px; height: 100dvh; overflow-y: auto; }
.pd-back { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 2px; width: calc(100% + 40px); min-height: 64px; margin: 0 -20px; padding: 0 70px 0 14px; border: 0; background: var(--bg); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.pd-back:hover { color: var(--hot-text); }
.pd-hero { display: grid; justify-items: center; gap: 8px; padding-bottom: var(--sp-5); border-bottom: 1px solid var(--line); text-align: center; }
.pd-photo { width: 140px; height: 140px; border-radius: 16px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); }
.pd-photo.is-empty { display: grid; place-items: center; }
.pd-photo.is-empty span { font-size: 3.4rem; font-weight: 700; color: var(--hot); }
.pd-addphoto { min-height: 44px; padding: 0 14px; border: 0; background: none; font: inherit; font-size: .9rem; font-weight: 600; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.pd-hero h2 { margin: 4px 0 0; padding: 0; font-family: var(--font); font-size: 1.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.pd-meta { margin: 0; color: var(--muted); font-size: .8rem; }
.pd-summary { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.pd-card { display: grid; align-content: start; justify-items: center; gap: 2px; padding: 14px 10px; border: 1px solid var(--line); border-radius: var(--radius-field); background: var(--surface); text-align: center; }
.pd-card b { font-family: var(--font-mono); font-size: 1.35rem; }
.pd-card span { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pd-card small { font-size: .75rem; color: var(--muted); }
.pd-actions { display: grid; gap: var(--sp-3); }
.pd-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--sp-3); }
.pd-actions .btn { min-height: 50px; font-weight: 700; text-align: center; }
.pd-actions .pd-btn-line { background: var(--surface); border-color: var(--line); color: var(--hot-text); }
.pd-actions .pd-btn-line:hover { border-color: var(--hot); background: var(--hot-soft); }
.pd-actions .pd-btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; width: 100%; }
.pd-sec { display: grid; gap: var(--sp-3); }
.pd-sec h3 { margin: 0; font-size: 1rem; }
.pd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pd-wh { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-field); background: var(--surface-2); text-align: left; font: inherit; color: inherit; }
button.pd-wh.is-click { cursor: pointer; }
button.pd-wh.is-click:hover { border-color: var(--hot); background: var(--hot-soft); }
.pd-wh-name { font-weight: 600; }
.pd-wh b { font-size: 1.05rem; }
.pd-lot > span { display: grid; gap: 2px; }
.pd-lot.is-soon { border-color: var(--warning); background: var(--warning-bg); }
.pd-lot.is-expired { border-color: var(--danger); background: var(--danger-bg); }
.pd-move { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-3); align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-field); background: var(--surface); }
.pd-move.is-void { opacity: .55; }
.pd-move-info { display: grid; gap: 2px; min-width: 0; font-size: .9rem; }
.pd-move-info small { font-size: .75rem; }
.pd-move-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-weight: 700; background: var(--surface-2); }
.pd-move-ic.is-in, .pd-move b.is-in { color: var(--success); }
.pd-move-ic.is-out, .pd-move b.is-out { color: var(--danger); }
.pd-label .lbl-preview { display: block; max-width: 100%; margin: var(--sp-3) auto; background: #fff; border-radius: 8px; }
.pd-printframe { position: fixed; width: 0; height: 0; border: 0; }
@media (max-width: 520px) { .dlg.pd-drawer { border-radius: 0; } }

/* Formulario de producto: nivel 1 siempre visible, nivel 2 en acordeones (ADR 0042) */
.pf-main { grid-template-columns: 1fr; }
.pf-more-hint { margin: var(--sp-2) 0 calc(var(--sp-2) * -1); font-weight: 600; }
.pf-group-body { display: grid; gap: var(--sp-5); }
.pf-sub { display: grid; gap: var(--sp-3); }
.pf-sub + .pf-sub { padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.pf-sub h4 { margin: 0; font-size: .95rem; color: var(--muted); }
.pf-grid { align-items: start; }
.pf-main .field { align-content: start; }

/* Venta: resultados con stock, presentación por línea y selector de cliente (ADR 0042) */
.sale-result-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.sale-result .chip { flex: none; }
.sale-pres { width: 100%; min-width: 0; box-sizing: border-box; text-overflow: ellipsis; min-height: 36px; margin-top: 4px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }
.dlg.cp { width: min(520px, calc(100vw - 24px)); }
.cp-list { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: 6px; max-height: 38vh; overflow-y: auto; }
.cp-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-field); background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cp-row:hover, .cp-row:focus-visible { border-color: var(--hot); background: var(--hot-soft); }
.cp-new { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.cp-current { margin: 0; }
@media (max-width: 640px) { .sale-line-total { min-width: 0; } .sale-line { grid-template-columns: 1fr auto auto; } .sale-line-name { grid-column: 1 / -1; } .sale-line .sale-del { grid-column: 1 / -1; justify-self: end; } .sale-pres, .sale-lot select { width: 100%; box-sizing: border-box; } .sale-lot select { font-size: 0.8125rem; padding: 0 4px; text-overflow: ellipsis; } }

/* Detalle de venta */
.dlg.sd { width: min(560px, calc(100vw - 24px)); }
.sd-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sd-lines li > :last-child { white-space: nowrap; }
.sd-lines li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-field); }
.sd-total { display: flex; justify-content: flex-end; gap: 8px; margin: 0; font-size: 1.1rem; }

/* Perfiles de negocio (Rubro y módulos) */
.profiles { display: grid; gap: var(--sp-3); }
.profiles h2 { margin: 0; }
.profile-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-3); }
.profile-card { display: grid; gap: 6px; align-content: start; padding: 16px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; font: inherit; cursor: pointer; transition: transform var(--dur-3) var(--ease-spring), border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out); }
.profile-card strong { font-family: var(--font-display); font-size: 1.1rem; }
.profile-card:active { transform: scale(.98); }
.profile-card[aria-pressed="true"] { border-color: var(--hot); background: var(--hot-soft); box-shadow: 0 0 0 1px var(--hot); }
@media (hover: hover) and (pointer: fine) { .profile-card:hover:not(:disabled) { border-color: var(--hot); transform: translateY(-2px); } }

/* Entrada escalonada de listas y respuesta al tocar (como en Ánfora) */
@media (prefers-reduced-motion: no-preference) {
  .ptable tbody tr, .pcards > *, .quick-grid > *, .alert-row, .profile-card, .pd-list > li, .sd-lines > li { animation: view-in 300ms var(--ease-out) both; }
  :is(.ptable tbody, .pcards, .quick-grid, .alert-list, .profile-cards, .pd-list, .sd-lines) > :nth-child(2) { animation-delay: 40ms; }
  :is(.ptable tbody, .pcards, .quick-grid, .alert-list, .profile-cards, .pd-list, .sd-lines) > :nth-child(3) { animation-delay: 80ms; }
  :is(.ptable tbody, .pcards, .quick-grid, .alert-list, .profile-cards, .pd-list, .sd-lines) > :nth-child(4) { animation-delay: 120ms; }
  :is(.ptable tbody, .pcards, .alert-list) > :nth-child(n+5) { animation-delay: 160ms; }
}
.pd-wh:active, .cp-row:active, .profile-card:active, .chip:active { transform: scale(.98); }
.pd-wh, .cp-row { transition: transform var(--dur-1) var(--ease-out), border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out); }

/* Mi cuenta: equipos con huella / Face ID */
.passkey-box { display: grid; gap: var(--sp-3); }
.passkey-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.passkey-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 10px 14px; border: 1px solid var(--edge); border-radius: var(--radius-field); background: var(--surface); }
.passkey-row .chip { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--hot-soft); color: var(--hot-text); font-size: .75rem; font-weight: 700; }

/* Pestañas internas (Productos, Inventario, Facturación): una fila con desplazamiento horizontal en celular. */
.tabs { display: flex; gap: 4px; margin: 0 0 16px; padding: 0; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; font-weight: 600; font-size: .9375rem; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out); }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--hot-text); border-bottom-color: var(--hot); font-weight: 800; }
.tab:focus-visible { outline: 2px solid var(--hot); outline-offset: -2px; border-radius: var(--radius-field); }

/* Modal de venta cobrada */
.dlg.ss { width: min(460px, calc(100vw - 24px)); }
.ss-sum { margin: 0; font-size: 1.1rem; }
.ss-actions { display: grid; gap: 10px; margin: var(--sp-3) 0; }
.ss-btn { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow-1, none); transition: border-color var(--dur-2, 150ms), background var(--dur-2, 150ms); }
.ss-btn:hover, .ss-btn:focus-visible { border-color: var(--hot); background: var(--hot-soft); }
.ss-btn > span:last-child { display: grid; gap: 2px; }
.ss-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--hot-soft); color: var(--hot); flex: none; }

/* Kardex: buscador de producto */
.kardex-prod { position: relative; min-width: min(320px, 100%); }
.kardex-prod .input { width: 100%; box-sizing: border-box; }
.kardex-chip { cursor: pointer; font: inherit; min-height: 40px; padding: 0 14px; }
.kardex-results { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; display: grid; background: var(--surface); border-radius: var(--radius-field); box-shadow: var(--shadow-3); }
.kardex-results:empty { display: none; }
.kardex-result { text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; cursor: pointer; }
.kardex-result:hover, .kardex-result:focus-visible { background: var(--hot-soft); }

/* Ficha de producto: acciones rápidas de stock + filas clicables */
tr.is-click { cursor: pointer; }
tr.is-click:hover, tr.is-click:focus-visible { background: var(--hot-soft); outline: none; }

/* Asistente de inicio (#/setup) */
.wiz-head { display: flex; gap: 12px; align-items: center; }
.wiz-head h2, .wiz-head p { margin: 0; }
.wiz-n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--hot); color: #fff; font-weight: 700; flex: none; }
.wiz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-3); }
.wiz-card { position: relative; display: grid; gap: 6px; align-content: start; padding: 18px 16px; text-align: left; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; font: inherit; cursor: pointer; box-shadow: var(--shadow-1, none); transition: border-color var(--dur-2, 150ms), background-color var(--dur-2, 150ms), transform var(--dur-2, 150ms); }
.wiz-card:hover, .wiz-card:focus-visible { border-color: var(--hot); transform: translateY(-1px); }
.wiz-card.is-on { border-color: var(--hot); background: var(--hot-soft); }
.wiz-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--hot-soft); color: var(--hot); }
.wiz-card.is-on .wiz-ic { background: var(--hot); color: #fff; }
.wiz-tick { position: absolute; top: 12px; right: 12px; display: none; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--hot); color: #fff; }
.wiz-card.is-on .wiz-tick { display: grid; }
.wiz-apply { min-height: 48px; padding: 0 28px; }
.wiz-done { display: grid; gap: 12px; justify-items: center; text-align: center; padding: 32px 16px; }
.wiz-ic-big { width: 72px; height: 72px; border-radius: 50%; background: var(--hot); color: #fff; }
.wiz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wiz-list li::before { content: '✓ '; color: var(--hot); font-weight: 700; }

/* Accesos rápidos con profundidad (estilo Ánfora) */
.quick-card { box-shadow: var(--shadow-1); transition: transform var(--dur-2, 150ms), border-color var(--dur-2, 150ms), box-shadow var(--dur-2, 150ms); }
@media (hover: hover) and (pointer: fine) { .quick-card:hover { box-shadow: var(--shadow-2); } }

/* Reportes: más análisis plegado y gráficos Chart.js */
.rp-more > summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.cjs-box canvas { max-width: 100%; }

/* Acciones de una fila: bajan de línea en vez de forzar scroll lateral (media pantalla) */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ptable td.actions-cell { width: 1%; min-width: 180px; max-width: 340px; }

/* Ficha de producto: «Volver» y el ✕ nunca se encima */
.pd-topbar { display: flex; align-items: center; padding-top: 8px; }

/* Botón ✕ de todos los modales */
.dlg, .modal-card { position: relative; }
.dlg { position: fixed; }
.modal-x { position: absolute; top: 10px; right: 10px; z-index: 6; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2, var(--surface)); color: var(--text); cursor: pointer; box-shadow: var(--shadow-1); }
.modal-x:hover, .modal-x:focus-visible { border-color: var(--hot); color: var(--hot); }
.dlg h2, .modal-card > h2 { padding-right: 52px; }

/* Modal de movimiento de stock */
.dlg.mv { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.mv-actions { position: sticky; bottom: -22px; margin: 0 -22px -22px; padding: 12px 22px; background: var(--surface); border-top: 1px solid var(--line); }

/* Pago compacto: píldoras arriba en una fila; debajo, Monto y Referencia en una sola línea sin huecos */
.sale-payrow .pay-seg { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; }
.sale-payrow .pay-seg .sale-seg-btn { flex: 1 0 auto; min-height: 38px; padding: 0 8px; font-size: .85rem; overflow: visible; }
.sale-payrow .pay-amt { flex: 1 1 0; min-width: 0; min-height: 42px; }
.sale-payrow .pay-ref { flex: 1.4 1 0; min-width: 0; min-height: 42px; }
.sale-payrow .btn { flex: 0 0 auto; }
.sale-payactions { gap: 6px; }
.sale-card h2 { margin-bottom: 6px; }

/* Calculadora de importaciones: 2 pasos */
.imp-hero { display: grid; gap: 12px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, var(--hot-soft), var(--surface)); box-shadow: var(--shadow-1); }
.imp-hero h2, .imp-hero p { margin: 0; }
.imp-hero-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.imp-big { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; padding: 0 20px; font-size: 1.05rem; font-weight: 700; text-align: left; }
.imp-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.imp-card h2 { margin: 0 0 10px; }
.imp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
.imp-manual { margin: 8px 0 12px; }
.imp-manual > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.imp-final { font-weight: 800; color: var(--hot-text, var(--hot)); }
.imp-confirm { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; position: sticky; bottom: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.imp-confirm .imp-big { flex: 1 1 280px; }
.imp-card .ptable td:first-child { min-width: 180px; }
.imp-card .ptable input { width: 100%; min-width: 72px; box-sizing: border-box; }
.imp-card .ptable td, .imp-card .ptable th { white-space: nowrap; }
.imp-card .ptable td:first-child { white-space: normal; }

/* Reportes: barra de periodo + PDF destacado y contenedores de gráfico (Ánfora) */
.rp-bar { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
.rp-bar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rp-bar-row .sale-seg { grid-template-columns: repeat(4, auto); flex: 1 1 340px; }
.rp-bar-row select { min-height: 44px; }
.rp-range { align-items: center; }
.rp-bar-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.rp-pdf { flex: 1 1 320px; min-height: 56px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.02rem; font-weight: 800; text-align: left; box-shadow: var(--shadow-2); }
.rp-bar-actions .btn:not(.rp-pdf) { min-height: 56px; display: inline-flex; align-items: center; gap: 8px; }
.chart-wrap { position: relative; height: 220px; padding: 10px 6px 14px; }
.chart-card { margin-top: 16px; }
/* Oscuro: el rojo se aclara, así que el texto pasa a tinta oscura para mantener el contraste */
:root[data-theme="dark"] .pd-actions .pd-btn-danger { color: #1d0f00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pd-actions .pd-btn-danger { color: #1d0f00; } }

/* Listas de precios (rescate UI v83): tarjetas de ganancia por categoría y revisión de precios */
.pr-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.pr-card { min-width: 0; display: grid; gap: 6px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pr-card.is-general { border-color: var(--brand); }
.pr-card-name { font-weight: 700; font-size: 1rem; overflow-wrap: anywhere; }
.pr-today { margin: 0; font-size: .9rem; }
.pr-pctrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pr-pct { width: 96px; min-height: 44px; padding: 0 12px; font-size: 1.1rem; font-weight: 700; text-align: right; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--bg); }
.pr-sign { font-weight: 700; color: var(--muted); }
.pr-example { margin: 0; font-size: .85rem; color: var(--muted); }
.pr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pr-chip { padding: 4px 12px; border-radius: var(--radius-pill); font-weight: 700; font-size: .9rem; background: var(--surface-2); }
.pr-chip.is-up { background: var(--success-bg); color: var(--success); }
.pr-chip.is-down { background: var(--danger-bg); color: var(--danger); }
.pr-warn { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--warning-bg); color: var(--warning); font-weight: 600; }
.pr-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 10px; background: var(--bg); width: fit-content; max-width: 100%; }
.pr-filter { min-height: 38px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; font-size: .9rem; }
.pr-filter[aria-pressed="true"] { background: var(--brand); color: var(--brand-text); font-weight: 700; }
.pr-filter:disabled { opacity: .45; cursor: default; }
.pr-table td { vertical-align: middle; }
.pr-name { display: block; }
.pr-sub { display: block; font-size: .8rem; }
.pr-new { width: 96px; min-height: 40px; padding: 0 10px; text-align: right; font-weight: 700; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--bg); }
.pr-new[aria-invalid="true"] { border-color: var(--danger); }
.pr-diff { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); font-weight: 700; font-size: .85rem; white-space: nowrap; background: var(--surface-2); }
.pr-diff.is-up { background: var(--success-bg); color: var(--success); }
.pr-diff.is-down { background: var(--danger-bg); color: var(--danger); }
.pr-table input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--brand); cursor: pointer; }
.pf-pricecol { display: grid; gap: 6px; align-content: start; min-width: 0; }
.pf-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--success-bg); color: var(--success); font-weight: 600; font-size: .9rem; }
.pf-suggest[hidden] { display: none; }

/* Órdenes de compra (rescate UI v84): tarjetas, estado en palabras, recepción clara */
.po-summary { margin: 0; font-size: 1rem; }
.po-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.po-card { display: grid; gap: 6px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.po-supplier { margin: 0; font-size: 1.1rem; font-weight: 700; }
.po-meta { margin: 0; font-size: .85rem; }
.po-total { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.po-pending { margin: 0; font-weight: 700; color: var(--warning); }
.po-status { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 700; background: var(--surface-2); }
.po-status.is-warn { background: var(--warning-bg); color: var(--warning); }
.po-status.is-info { background: var(--info-bg); color: var(--info); }
.po-status.is-ok { background: var(--success-bg); color: var(--success); }
.po-status.is-off { color: var(--muted); }
.po-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.po-head h2 { margin: 0; }
.po-head p { margin: 4px 0 0; }
.po-headtotal { display: grid; text-align: right; }
.po-headtotal strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.po-receive { display: grid; gap: 8px; padding: 16px; border: 2px solid var(--brand); border-radius: 12px; background: var(--surface); }
.po-receive h3, .po-receive p { margin: 0; }
.po-receive:focus { outline: none; }
.po-recv { display: flex; flex-wrap: wrap; gap: 6px; }
.po-qty { width: 90px; }
.po-left { font-weight: 700; color: var(--warning); }
.po-done { font-weight: 700; color: var(--success); }
.po-cancel { color: var(--danger); }
.po-line { grid-template-columns: minmax(0, 1fr) auto auto auto auto; }
.po-costlabel { display: grid; gap: 2px; font-size: .75rem; }
.po-cost { width: 96px; min-height: 44px; font-size: 1rem; padding: 0 10px; text-align: right; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }
@media (max-width: 899px) { .po-line { grid-template-columns: minmax(0, 1fr) auto; } }

/* Registrar movimiento estilo Ánfora (rescate UI v85) */
.dlg.mv2 { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.mv2-form { gap: 14px; }
.mv2-form h2 { margin: 0; }
.mv2-product { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.mv2-photo { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.mv2-photo.is-empty { display: grid; place-items: center; background: var(--brand); color: var(--brand-text); font-weight: 800; font-size: 1.3rem; }
.mv2-info { flex: 1; min-width: 0; }
.mv2-name { margin: 0; font-weight: 700; line-height: 1.25; }
.mv2-meta { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.mv2-stock { text-align: right; flex: none; }
.mv2-stock small { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mv2-stocknum { display: inline-block; margin-top: 3px; padding: 2px 10px; font-size: 1.25rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.mv2-stocknum em { font-style: normal; font-size: .75rem; color: var(--muted); }
.mv2-types { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mv2-type { display: flex; align-items: center; gap: 10px; padding: 12px; text-align: left; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.mv2-sign { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 1.4rem; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.mv2-typetext strong { display: block; }
.mv2-typetext small { color: var(--muted); font-size: .8rem; }
.mv2-type.is-in[aria-pressed="true"] { border-color: var(--success); background: var(--success-bg); }
.mv2-type.is-in[aria-pressed="true"] .mv2-sign { background: var(--success); color: #fff; }
.mv2-type.is-in[aria-pressed="true"] strong { color: var(--success); }
.mv2-type.is-out[aria-pressed="true"] { border-color: var(--danger); background: var(--danger-bg); }
.mv2-type.is-out[aria-pressed="true"] .mv2-sign { background: var(--danger); color: #fff; }
.mv2-type.is-out[aria-pressed="true"] strong { color: var(--danger); }
.mv2-type.is-adjust[aria-pressed="true"] { border-color: var(--warning); background: var(--warning-bg); }
.mv2-type.is-adjust[aria-pressed="true"] .mv2-sign { background: var(--warning); color: #fff; }
.mv2-type.is-adjust[aria-pressed="true"] strong { color: var(--warning); }
.mv2-type.is-transfer[aria-pressed="true"] { border-color: var(--brand); background: var(--surface-2); }
.mv2-type.is-transfer[aria-pressed="true"] .mv2-sign { background: var(--brand); color: var(--brand-text); }
.mv2-type.is-transfer[aria-pressed="true"] strong { color: var(--brand); }
@media (hover: hover) and (pointer: fine) { .mv2-type:hover, .mv2-qbtn:hover { border-color: var(--brand); } }
.mv2-stepper { display: flex; align-items: center; gap: 10px; }
.mv2-qbtn { width: 54px; height: 54px; flex: none; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 1.6rem; font-weight: 700; cursor: pointer; }
.mv2-stepper input { flex: 1; min-width: 0; height: 54px; text-align: center; font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; border: 1px solid var(--line-strong); border-radius: var(--radius-field); background: var(--surface); }
.mv2-hint { margin: 4px 0 0; font-weight: 600; }
.mv2-row2 { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mv2-error:empty { display: none; }
.mv2-confirm { width: 100%; min-height: 54px; font-size: 1.1rem; }

/* Formulario de producto estilo Ánfora (rescate UI v85): foto grande arriba a la izquierda, código y nombre al lado */
.pf-top { display: grid; gap: 16px; grid-template-columns: 160px minmax(0, 1fr); align-items: start; }
.pf-topfields { display: grid; gap: 14px; min-width: 0; }
.pf-top .pf-photobox { display: grid; gap: 6px; justify-items: center; }
.pf-photodrop { position: relative; width: 160px; height: 160px; padding: 0; overflow: hidden; display: grid; place-items: center; border: 2px dashed var(--line-strong); border-radius: 16px; background: var(--surface-2); color: var(--muted); cursor: pointer; font: inherit; }
.pf-photodrop .pf-photo { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; }
.pf-photo-empty { display: grid; gap: 6px; justify-items: center; padding: 12px; text-align: center; font-size: .85rem; font-weight: 600; }
.pf-photo-icon { font-size: 2rem; line-height: 1; }
@media (hover: hover) and (pointer: fine) { .pf-photodrop:hover { border-color: var(--brand); color: var(--brand); } }
.pf-photodrop:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 560px) { .pf-top { grid-template-columns: 1fr; } .pf-top .pf-photobox { justify-items: start; } .pf-photodrop { width: 120px; height: 120px; } }
/* Botón chico junto a la etiqueta (Escanear, + Nueva, + Nuevo): en la misma línea, a la derecha, no en una fila propia */
.pf .field:has(> label + .btn-small) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: end; }
.pf .field:has(> label + .btn-small) > * { grid-column: 1 / -1; }
.pf .field:has(> label + .btn-small) > label { grid-column: 1; align-self: center; }
.pf .field:has(> label + .btn-small) > label + .btn-small { grid-column: 2; min-height: 30px; padding: 0 12px; font-size: .85rem; margin-bottom: 4px; }
.dlg.mv2 { overflow-x: hidden; }
.mv2-stepper input { width: 100%; -moz-appearance: textfield; appearance: textfield; }
.mv2-stepper input::-webkit-outer-spin-button, .mv2-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Pantalla Escanear (como Ánfora): oscura en los dos temas, es la pantalla de la cámara */
.scan { max-width: 520px; margin: 0 auto; padding: 18px 16px 24px; border-radius: 22px; color: #f2f4f8; background: radial-gradient(120% 100% at 50% 0%, #1f3556, #0f1c33); }
.scan-head h1 { margin: 0 0 4px; font-size: 1.4rem; color: #fff; }
.scan-head p { margin: 0; color: rgb(255 255 255 / .65); font-size: .92rem; }
.scan-stage { display: flex; justify-content: center; padding: 22px 0 8px; }
.scan-frame { position: relative; width: min(300px, 78vw); aspect-ratio: 1; background: rgb(255 255 255 / .07); border-radius: 20px; overflow: hidden; }
.scan-frame .corner { position: absolute; width: 30px; height: 30px; border: 4px solid var(--hot); z-index: 2; }
.scan-frame .corner-tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.scan-frame .corner-tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.scan-frame .corner-bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.scan-frame .corner-br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.scan .scan-video { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; background: #000; border-radius: 0; }
.scan-line { position: absolute; left: 10%; right: 10%; height: 2.5px; z-index: 3; background: linear-gradient(90deg, transparent, var(--hot), transparent); box-shadow: 0 0 14px var(--hot); animation: scanMove 2.2s ease-in-out infinite; }
@keyframes scanMove { 0%, 100% { top: 13%; } 50% { top: 84%; } }
@media (prefers-reduced-motion: reduce) { .scan-line { animation: none; top: 50%; } }
.scan-note { text-align: center; color: rgb(255 255 255 / .7); font-size: .85rem; margin: 10px 0 0; }
.scan-fallback { padding-top: 18px; display: grid; gap: 10px; }
.scan-fallback .field label { color: rgb(255 255 255 / .75); }
.scan-fallback .form-error { color: #ffb199; margin: 0; }

/* «Ver QR» de la ficha (como Ánfora): tarjeta centrada con el código en marco blanco */
.pd-label { width: min(360px, calc(100vw - 32px)); text-align: center; }
.pd-label-card { display: grid; gap: 12px; justify-items: center; }
.pd-modes { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-2); }
.pd-mode { min-height: 36px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); background: none; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.pd-mode.is-on { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgb(20 35 58 / .18); }
.pd-label-frame { display: grid; place-items: center; width: min(260px, 100%); aspect-ratio: 1; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.pd-label .pd-label-frame .lbl-preview { margin: 0; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.pd-label-card h2 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.pd-label-code { margin: 0; color: var(--muted); font-size: .85rem; font-weight: 600; }
.pd-label-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 6px; }
.pd-label-card { justify-items: stretch; padding-top: 6px; }
.pd-label-card .pd-modes { width: calc(100% - 36px); justify-self: start; }
.pd-label-card .pd-label-frame { justify-self: center; }
.pd-label-card h2, .pd-label-card .pd-label-code { text-align: center; }
.pd-mode { padding: 0 8px; white-space: nowrap; }
.pd-label .pd-label-card h2 { text-align: center; justify-self: stretch; width: 100%; }

/* Ficha del producto igual a la de Ánfora: foto cuadrada grande, tarjetas chicas, botones con brillo, filas con nombre a la izquierda y cantidad en mono */
.pd-hero { gap: 12px; padding: 8px 0 22px; }
.pd-photo { width: 160px; height: 160px; border: 2px solid var(--line-strong); border-radius: 16px; background: var(--bg); }
.pd-photo.is-empty span { font-size: 3.6rem; color: var(--text); }
.pd-hero h2 { margin: 2px 0 0; font-size: 1.38rem; font-weight: 700; line-height: 1.2; }
.pd-meta { margin: 0; font-size: .72rem; color: var(--muted); }
.pd-summary { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); max-width: 320px; gap: 12px; }
.pd-card { gap: 3px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.pd-card b { font-size: 1.06rem; }
.pd-card span { font-size: .68rem; }
.pd-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.pd-actions .pd-row { display: contents; }
.pd-actions .btn { flex: 1 1 140px; min-height: 48px; border-radius: 14px; }
.pd-actions .btn-primary { box-shadow: 0 8px 20px rgb(249 115 22 / .28); }
.pd-actions .pd-btn-line { background: var(--surface-2); border-color: var(--line); color: var(--hot-text); }
.pd-actions .pd-btn-danger { flex-basis: 100%; background: var(--danger); border-color: var(--danger); box-shadow: 0 8px 20px rgb(224 112 92 / .25); }
.pd-sec { gap: 10px; }
.pd-sec h3 { font-size: 1.06rem; font-weight: 600; }
.pd-wh { padding: 12px 16px; border-radius: 12px; background: var(--surface-2); }
.pd-wh-name { font-size: .88rem; font-weight: 600; }
.pd-wh b { font-size: 1rem; }
.pd-move { padding: 12px; border-radius: 12px; background: var(--surface-2); }
.pd-move-ic { width: 34px; height: 34px; border-radius: 50%; background: var(--bg); }
.pd-move-info strong { font-size: .92rem; }
.pd-move-info small { font-family: var(--font-mono); font-size: .72rem; }
.pd-move b { padding: 3px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: .9rem; }
.pd-hero > * { justify-self: center; max-width: 100%; }
.pd-hero h2, .pd-hero .pd-meta { width: 100%; text-align: center; }
.pd-summary { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-width: none; }
.pd-label .pd-label-card h2 { padding: 0; }
/* Tactil: objetivos de toque de 44px tambien en los selectores compactos (QA M11) */
@media (pointer: coarse) { .sale-payrow .pay-seg .sale-seg-btn, .sale-side .sale-seg-btn, .pr-filter { min-height: 44px; } .sale-payrow .pay-amt { min-height: 44px; } }

/* ── Pulido v115: tarjetas más suaves, links con forma de botón, accesos 3×3 animados, estados visibles ── */
/* Tarjetas: esquinas amplias, borde casi invisible y sombra difusa (antes se veían toscas) */
.home-card, .form-section, .pcard, .imp-card, .po-card, .pr-card, .rp-bar { border-radius: 16px; }
.home-card { padding: 20px; gap: 14px; }
.home-card h2 { font-size: 1rem; font-weight: 650; letter-spacing: -.01em; }
.form-section { padding: 20px; }
.pcard { padding: 16px 18px; }
.imp-stat { border-radius: 14px; }

/* Estados (Emitida, Anulada…): nunca se parten ni se aplastan; los neutros llevan borde para leerse */
.badge { white-space: nowrap; flex-shrink: 0; line-height: 1.5; }
.badge:not([class*="badge-"]) { box-shadow: inset 0 0 0 1px var(--line); }

/* Botón con icono + texto y botón solo icono de WhatsApp */
.btn-ico { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-wa { display: inline-grid; place-items: center; min-width: 44px; padding: 0 10px; color: #1faa53; }
.btn-wa svg { transition: transform var(--dur-3) var(--ease-spring); }
@media all /* sin filtro de hover: ver .quick-card:hover */ { .btn-wa:hover { border-color: #25d366; background: rgb(37 211 102 / .1); } .btn-wa:hover svg { transform: scale(1.12); } }
.ss-btn.is-wa .ss-ic { color: #1faa53; }
:root[data-theme="dark"] .btn-wa, :root[data-theme="dark"] .ss-btn.is-wa .ss-ic { color: #25d366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-wa, :root:not([data-theme="light"]) .ss-btn.is-wa .ss-ic { color: #25d366; } }

/* Botón tenue (Editar accesos, Restablecer) */
.btn-quiet { display: inline-flex; align-items: center; gap: 6px; background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
@media all /* sin filtro de hover: ver .quick-card:hover */ { .btn-quiet:hover { background: var(--surface-2); color: var(--text); } }

/* «Ver todos con stock bajo» / «Ver reportes»: píldora con flecha en vez de link subrayado */
.home-card > a.card-cta, a.card-cta { justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; line-height: 1; padding: 0 16px; border-radius: var(--radius-pill); background: var(--hot-soft); color: var(--hot-text); font-weight: 650; font-size: .9rem; text-decoration: none; transition: background-color var(--dur-2) var(--ease-out), gap var(--dur-3) var(--ease-spring); }
a.card-cta svg:last-child { transition: transform var(--dur-3) var(--ease-spring); }
@media all /* sin filtro de hover: ver .quick-card:hover */ { a.card-cta:hover { background: color-mix(in srgb, var(--hot) 18%, transparent); } a.card-cta:hover svg:last-child { transform: translateX(3px); } }
a.card-cta:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.home-card.is-quiet a.card-cta { background: var(--surface); box-shadow: var(--shadow-1); color: var(--text); }
.home-card.is-quiet a.card-cta svg:first-child { color: var(--c-reports); }

/* «Para hoy»: cada aviso es una fila tocable entera, sin subrayado, con flecha */
.today-list { gap: 6px; }
.today-item { align-items: center; gap: 10px; }
.today-item .today-dot { transform: none; }
.today-item a.today-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; line-height: 1.35; padding: 8px 12px; margin: 0 -12px 0 -4px; border-radius: 12px; color: var(--text); text-decoration: none; transition: background-color var(--dur-2) var(--ease-out); }
.today-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.today-area { font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.today-title { font-weight: 600; }
.today-detail { font-size: .85rem; }
.today-link > svg { flex: none; color: var(--muted); transition: transform var(--dur-3) var(--ease-spring), color var(--dur-2) var(--ease-out); }
.today-item.is-high a.today-link { background: color-mix(in srgb, var(--danger-bg) 55%, transparent); }
@media all /* sin filtro de hover: ver .quick-card:hover */ {
  .today-item a.today-link:hover { background: var(--surface-2); }
  .today-item.is-high a.today-link:hover { background: var(--danger-bg); }
  .today-link:hover > svg { transform: translateX(3px); color: var(--text); }
}
.today-item a.today-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }

/* Stock crítico: filas tocables que abren la ficha al costado */
.alert-list { gap: 4px; }
.alert-row.is-click { padding: 10px 12px; margin: 0 -12px; border-radius: 12px; cursor: pointer; transition: background-color var(--dur-2) var(--ease-out); -webkit-tap-highlight-color: transparent; }
@media all /* sin filtro de hover: ver .quick-card:hover */ { .alert-row.is-click:hover { background: var(--surface-2); } }
.alert-row.is-click:active { background: var(--hot-soft); }
.alert-row.is-click:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Accesos rápidos: siempre 3×3 (como Ánfora); el icono crece al pasar el mouse o al tocar */
.dash-quick-panel .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.quick-edit { min-height: 36px; padding: 0 10px; font-size: .85rem; }
.quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 720px) { .quick-card { padding: 18px 8px 14px; } .quick-icon { width: 44px; height: 44px; border-radius: 12px; } .quick-icon svg { width: 22px; height: 22px; } }
/* Al pasar el mouse (como el menú): la tarjeta se amplía, entra un fondo de su color desde abajo y el icono crece */
.quick-card { position: relative; isolation: isolate; overflow: hidden; border-radius: 16px; transition: scale 300ms var(--ease-spring), transform 300ms var(--ease-spring), box-shadow 300ms var(--ease-out), border-color 200ms var(--ease-out); }
.quick-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--tone, var(--hot)) 16%, transparent), transparent 70%); opacity: 0; transform: scale(.6); transition: opacity 260ms var(--ease-out), transform 360ms var(--ease-spring); }
.quick-icon { transition: transform 340ms cubic-bezier(.34, 1.56, .64, 1), box-shadow 300ms var(--ease-out); }
.quick-label { font-weight: 650; transition: color 200ms var(--ease-out); }
/* Sin @media (hover: hover): hay laptops con pantalla táctil que dicen «hover: none» aunque tengan mouse, y ahí no se veía. */
.quick-card:hover { scale: 1.06; z-index: 1; box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--tone, var(--hot)) 55%, var(--edge)); }
.quick-card:hover::before { opacity: 1; transform: none; }
.quick-card:hover .quick-icon { transform: scale(1.28) translateY(-2px); box-shadow: 0 8px 18px color-mix(in srgb, var(--tone, var(--hot)) 30%, transparent); }
.quick-card:hover .quick-label { color: var(--tone, var(--hot)); }
.quick-card:active { scale: .96; }
.quick-card:active::before { opacity: 1; transform: none; }
.quick-card:active .quick-icon { transform: scale(1.22); transition-duration: 140ms; }
.quick-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.quick-none { grid-column: 1 / -1; margin: 0; }
@media (prefers-reduced-motion: reduce) { .quick-card, .quick-icon, a.card-cta svg, .today-link > svg { transition: none !important; } .quick-card:hover, .quick-card:active, .quick-card:hover .quick-icon, .quick-card:active .quick-icon { transform: none; scale: 1; } .quick-card::before { transition: none; } }

/* Edición tipo widgets del celular: tiemblan, ⊖ para quitar, se arrastran para ordenar, «+» para agregar */
.quick-tools { display: flex; align-items: center; gap: 4px; }
.quick-grid { position: relative; } /* los accesos miden su posición (offsetLeft/Top) contra la rejilla al arrastrar */
@media (min-width: 720px) { .quick-grid.is-editing .quick-card[data-id] { animation-name: jiggle-soft; } }
@keyframes jiggle-soft { from { rotate: -.5deg; } to { rotate: .5deg; } }
.quick-edit.is-done { background: var(--hot); border-color: var(--hot); color: #fff; }
.quick-hint { margin: -4px 0 10px; font-size: .85rem; }
.quick-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.quick-rm { position: absolute; top: 6px; left: 6px; z-index: 2; display: none; place-items: center; width: 24px; height: 24px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: var(--danger); cursor: pointer; box-shadow: 0 2px 6px rgb(0 0 0 / .25); }
.quick-rm span { width: 10px; height: 2px; border-radius: 2px; background: #fff; }
.quick-grid.is-editing .quick-rm { display: grid; animation: rm-in 260ms var(--ease-spring) both; }
.quick-grid.is-editing .quick-card[data-id] { cursor: grab; touch-action: none; animation: jiggle 280ms ease-in-out infinite alternate; }
.quick-grid.is-editing .quick-card[data-id]:nth-child(2n) { animation-duration: 320ms; animation-delay: -120ms; }
.quick-grid.is-editing .quick-card[data-id]:nth-child(3n) { animation-duration: 300ms; animation-delay: -60ms; }
.quick-grid.is-editing .quick-card:hover { transform: none; scale: 1; }
.quick-grid.is-editing .quick-card:hover .quick-icon { transform: none; }
.quick-card.is-drag { z-index: 6; cursor: grabbing !important; animation: none !important; scale: 1.08; box-shadow: var(--shadow-3); border-color: var(--tone, var(--hot)); transition: scale 160ms var(--ease-out); }
.quick-card.is-leaving { animation: none !important; transition: scale 180ms var(--ease-out), opacity 180ms var(--ease-out); scale: .5; opacity: 0; }
.quick-add { border: 2px dashed color-mix(in srgb, var(--hot) 45%, var(--line)); background: transparent; box-shadow: none; color: var(--hot-text); font: inherit; animation: rm-in 300ms var(--ease-spring) both; }
.quick-add .quick-icon { background: var(--hot-soft); color: var(--hot); }
@keyframes jiggle { from { rotate: -1.2deg; } to { rotate: 1.2deg; } }
@keyframes rm-in { from { scale: 0; } to { scale: 1; } }
@media (prefers-reduced-motion: reduce) { .quick-grid.is-editing .quick-card[data-id], .quick-grid.is-editing .quick-rm, .quick-add { animation: none; } }
.dlg.quick-dlg { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.quick-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.quick-pick-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; transition: border-color var(--dur-2) var(--ease-out), transform var(--dur-3) var(--ease-spring); }
.quick-pick-item .quick-icon { width: 32px; height: 32px; flex: none; border-radius: 9px; }
.quick-pick-item .quick-icon svg { width: 18px; height: 18px; }
@media all /* sin filtro de hover: ver .quick-card:hover */ { .quick-pick-item:hover { border-color: var(--tone, var(--hot)); transform: translateY(-2px); } }
/* Productos: chip del filtro activo */
.filter-chip-row { margin: 0 0 8px; display: flex; gap: 8px; }
.filter-chip-row:empty { display: none; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); border-radius: var(--radius-pill); background: var(--warning-bg); color: var(--warning); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }

/* Aviso flotante de órdenes de compra pendientes (Inicio) */
.po-toast { position: fixed; z-index: var(--z-panel); right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); width: min(380px, calc(100vw - 32px)); display: flex; align-items: center; gap: 12px; padding: 14px 44px 14px 14px; border: 1px solid color-mix(in srgb, var(--hot) 35%, var(--edge)); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-3); animation: po-in 520ms var(--ease-spring) both; }
.po-toast.is-out { animation: po-out 220ms var(--ease-out) forwards; }
.po-toast-ic { position: relative; display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 14px; background: linear-gradient(135deg, var(--hot), var(--hot-strong)); color: #fff; }
.po-toast-n { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: var(--text); color: var(--surface); font-size: .72rem; font-weight: 800; }
.po-toast-ic svg { animation: po-wiggle 1.6s ease-in-out 600ms 2; }
.po-toast-text { flex: 1; min-width: 0; display: grid; gap: 2px; line-height: 1.3; }
.po-toast-text .muted { font-size: .85rem; }
.po-toast-x { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.po-toast-x:hover { background: var(--surface-2); color: var(--text); }
@media (min-width: 1024px), (min-width: 640px) and (pointer: fine) { .po-toast { bottom: 20px; right: 24px; } }
@keyframes po-in { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes po-out { to { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes po-wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .po-toast, .po-toast.is-out, .po-toast-ic svg { animation: none; } }

/* «← Productos» en el formulario de producto: botón con borde suave en vez de link subrayado */
.pf-back { border: 1px solid var(--line); color: var(--text); text-decoration: none; padding: 0 14px 0 10px; }

/* Usuarios y roles */
.team-view { display: grid; gap: 12px; }
.team-view h1 { margin: 0; }
.team-view > .muted { margin: -6px 0 0; }
.team-tabs { width: fit-content; max-width: 100%; }
.team-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.team-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.team-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px 14px; padding: 16px; border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-1); transition: box-shadow var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-spring); }
@media all /* sin filtro de hover: ver .quick-card:hover */ { .team-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); } }
.team-card.is-off { opacity: .65; }
.team-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--c-sales), color-mix(in srgb, var(--c-sales) 55%, var(--c-reports))); color: #fff; font-weight: 800; letter-spacing: .02em; }
.team-avatar.is-role { background: linear-gradient(135deg, var(--c-reports), color-mix(in srgb, var(--c-reports) 55%, var(--c-sunat))); }
.team-info { display: grid; gap: 2px; min-width: 0; }
.team-info strong { font-size: 1.02rem; overflow-wrap: anywhere; }
.team-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.team-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.dlg.team-dlg { width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; }
.team-perms-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.team-perm-groups { display: grid; gap: 10px; }
.team-perms { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 2px; }
.team-perms legend { padding: 0 6px; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.team-perm { display: flex; align-items: flex-start; gap: 10px; min-height: 40px; padding: 8px 6px; border-radius: 10px; cursor: pointer; line-height: 1.35; }
.team-perm input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--hot); }
@media all /* sin filtro de hover: ver .quick-card:hover */ { .team-perm:hover { background: var(--surface-2); } }

/* Medios de pago: píldora que se desliza al botón elegido (igual que la del comprobante, con anchos libres) */
.sale-seg.has-glide { position: relative; isolation: isolate; }
.seg-glide { position: absolute; z-index: -1; border-radius: 8px; background: var(--brand); box-shadow: 0 2px 8px rgb(20 35 58 / .18); pointer-events: none; }
.sale-seg.has-glide .sale-seg-btn[aria-pressed="true"] { background: none; }
