/* FM · Facturador Modular — estilos
   Concepto: el mostrador. Superficies limpias, un solo color de acento elegido por el comercio
   y el sello de goma como firma (el estado fiscal se "estampa"). Todo se tematiza con variables. */

@font-face { font-family: 'Public Sans'; src: url('/fonts/public-sans.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Onest'; src: url('/fonts/onest.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('/fonts/nunito.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url('/fonts/bricolage.woff2') format('woff2'); font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/fonts/plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('/fonts/plex-mono-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

/* ───────── Tokens ───────── */
:root {
  /* Paleta Centro Electricidad: azul del logo, gris del disco y azul noche de fondo */
  --stamp: #0060a8;
  --centro-gris: #c3c4c6;
  --centro-noche: #0b1016;
  --on-stamp: #fff;
  --fs: 15px;
  --ink: #171c28;
  --ink-2: #4b5468;
  --ink-3: #7d8598;
  --line: #e1e4ea;
  --line-2: #cdd2db;
  --paper: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --campo: #ffffff;
  --ok: #1d7a4b;
  --warn: #9a610f;
  --bad: #c0352b;
  --stamp-hover: color-mix(in oklab, var(--stamp), black 14%);
  --stamp-soft: color-mix(in oklab, var(--stamp) 11%, var(--surface));
  --stamp-line: color-mix(in oklab, var(--stamp) 30%, var(--surface));
  --ok-soft: color-mix(in oklab, var(--ok) 12%, var(--surface));
  --warn-soft: color-mix(in oklab, var(--warn) 13%, var(--surface));
  --bad-soft: color-mix(in oklab, var(--bad) 11%, var(--surface));
  --focus: 0 0 0 3px color-mix(in oklab, var(--stamp) 38%, transparent);
  --sombra-1: 0 1px 2px rgba(16, 22, 36, .05), 0 1px 1px rgba(16, 22, 36, .03);
  --sombra-2: 0 10px 30px -12px rgba(16, 22, 36, .22), 0 2px 6px rgba(16, 22, 36, .05);
  --sombra-3: 0 28px 70px -20px rgba(10, 14, 24, .45);
  --r: 8px;
  --r-lg: 14px;
  --d: 1;
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', var(--font);
  --mono: 'Plex Mono', ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t: 1;
  /* Menú lateral (oscuro por defecto, teñido con el acento) */
  --side: color-mix(in oklab, var(--stamp) 16%, var(--centro-noche));
  --side-2: color-mix(in oklab, var(--stamp) 24%, var(--centro-noche));
  --side-ink: rgba(232, 236, 245, .72);
  --side-strong: #fff;
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: rgba(255, 255, 255, .12);
  --side-line: rgba(255, 255, 255, .08);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #eceef3; --ink-2: #a6adbd; --ink-3: #737b8e; --line: rgba(255, 255, 255, .075); --line-2: rgba(255, 255, 255, .13);
  --paper: #0a0c11; --surface: #12151c; --surface-2: #181c25; --campo: #0e1117;
  --ok: #58c891; --warn: #e3ac55; --bad: #f2786d;
  --stamp-hover: color-mix(in oklab, var(--stamp), white 12%);
  --stamp-soft: color-mix(in oklab, var(--stamp) 20%, var(--surface));
  --sombra-1: 0 1px 2px rgba(0, 0, 0, .3);
  --sombra-2: 0 12px 32px -12px rgba(0, 0, 0, .6);
  --side: color-mix(in oklab, var(--stamp) 10%, #0a0d13);
  --side-2: color-mix(in oklab, var(--stamp) 16%, #0a0d13);
  color-scheme: dark;
}
:root[data-menu="color"] {
  --side: color-mix(in oklab, var(--stamp), black 18%);
  --side-2: color-mix(in oklab, var(--stamp), black 42%);
  --side-ink: rgba(255, 255, 255, .8);
  --side-hover: rgba(255, 255, 255, .1);
  --side-active: rgba(255, 255, 255, .18);
  --side-line: rgba(255, 255, 255, .14);
}
:root[data-menu="claro"] {
  --side: var(--surface); --side-2: var(--surface); --side-ink: var(--ink-2); --side-strong: var(--ink);
  --side-hover: var(--surface-2); --side-active: var(--stamp-soft); --side-line: var(--line);
}
:root[data-densidad="compacta"] { --d: .78; }
:root[data-esquinas="rectas"] { --r: 3px; --r-lg: 5px; }
:root[data-esquinas="redondas"] { --r: 12px; --r-lg: 20px; }
:root[data-fuente="onest"] { --font: 'Onest', system-ui, sans-serif; }
:root[data-fuente="nunito"] { --font: 'Nunito', system-ui, sans-serif; }
:root[data-fuente="sistema"] { --font: system-ui, -apple-system, 'Segoe UI', sans-serif; }
:root[data-titulos="no"] { --font-display: var(--font); }
:root[data-anim="reducidas"] { --t: .55; }

* { box-sizing: border-box; }
html { font-size: calc(var(--fs) * 16 / 15); }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: .9375rem; line-height: 1.45; color: var(--ink); background: var(--paper);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
:root[data-fondo="puntos"] body { background-image: radial-gradient(color-mix(in oklab, var(--ink) 9%, transparent) 1px, transparent 1.2px); background-size: 18px 18px; }
:root[data-fondo="tinte"] body { background: color-mix(in oklab, var(--stamp) 6%, var(--paper)); }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 650; letter-spacing: -0.015em; font-family: var(--font-display); }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.28rem; }
h3 { font-size: 1.07rem; }
p { margin: 0 0 .75em; }
a { color: var(--stamp); }
small, .muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code, .mono { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: color-mix(in oklab, var(--stamp) 28%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* Animaciones: nivel elegido en Apariencia. "ninguna" y reduced-motion las apagan. */
:root[data-anim="ninguna"] *, :root[data-anim="ninguna"] *::before, :root[data-anim="ninguna"] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fundido { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
@keyframes estampar {
  0% { opacity: 0; transform: scale(2.4) rotate(-14deg); }
  55% { opacity: 1; transform: scale(.9) rotate(-3deg); }
  75% { transform: scale(1.05) rotate(-5deg); }
  100% { opacity: 1; transform: scale(1) rotate(-4deg); }
}
@keyframes latido { 0% { transform: scale(1); } 40% { transform: scale(1.045); } 100% { transform: scale(1); } }
@keyframes brillo { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes crecer { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes girar { to { transform: rotate(360deg); } }

/* ───────── Arranque ───────── */
.arranque { min-height: 100vh; display: grid; place-items: center; background: var(--paper); }
.arranque .brand-mark { width: 54px; height: 54px; font-size: 22px; border-radius: 16px; animation: latido 1.2s var(--ease) infinite; }

/* ───────── Layout ───────── */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; transition: grid-template-columns calc(.28s * var(--t)) var(--ease); }
:root[data-compacto="si"] .shell { grid-template-columns: 72px 1fr; }
.side {
  background: linear-gradient(180deg, var(--side), var(--side-2)); color: var(--side-ink); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; z-index: 30;
}
:root[data-menu="claro"] .side { border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; color: var(--side-strong); min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--stamp); color: var(--on-stamp); display: grid; place-items: center; flex: none;
  font-family: var(--font-display); font-weight: 800; font-size: 16px; letter-spacing: -.05em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 6px 16px -6px color-mix(in oklab, var(--stamp) 70%, transparent);
}
:root[data-menu="color"] .side .brand-mark { background: rgba(255, 255, 255, .95); color: var(--stamp); }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; object-fit: contain; background: #fff; flex: none; padding: 3px; }
.brand-centro { border-radius: 50%; padding: 0; background: transparent; box-shadow: 0 0 0 2px color-mix(in oklab, var(--centro-gris) 55%, transparent), 0 6px 16px -6px color-mix(in oklab, var(--stamp) 70%, transparent); }
.arranque-logo { width: 84px; height: 84px; border-radius: 50%; animation: latido 1.2s var(--ease) infinite; }
/* En modo oscuro el azul del logo se aclara para textos y enlaces (contraste legible) */
:where(:root[data-theme="dark"]) a { color: color-mix(in oklab, var(--stamp), white 38%); }
.brand-name { font-family: var(--font-display); font-weight: 650; font-size: 1rem; line-height: 1.15; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.brand-name small { display: block; color: var(--side-ink); font-family: var(--font); font-weight: 400; font-size: .76rem; }
.nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; position: relative; }
.nav-indicador {
  position: absolute; left: 12px; right: 12px; top: 0; height: 40px; border-radius: var(--r); background: var(--side-active); pointer-events: none;
  transition: transform calc(.32s * var(--t)) var(--ease), height calc(.32s * var(--t)) var(--ease), opacity .2s; opacity: 0;
}
.nav-indicador::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--stamp); }
:root[data-menu="color"] .nav-indicador::before { background: #fff; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; color: var(--side-ink); text-decoration: none; height: 40px;
  padding: 0 12px; border-radius: var(--r); font-size: .93rem; font-weight: 500; white-space: nowrap; transition: color .15s, background .15s;
}
.nav a:hover { color: var(--side-strong); background: var(--side-hover); }
.nav a.activo { color: var(--side-strong); font-weight: 600; }
.nav a.activo svg { color: var(--stamp); opacity: 1; }
:root[data-menu="oscuro"] .nav a.activo svg, :root[data-menu="color"] .nav a.activo svg { color: var(--side-strong); }
.nav svg { width: 19px; height: 19px; flex: none; opacity: .85; transition: transform .2s var(--ease); }
.nav a:hover svg { transform: translateX(1px) scale(1.06); }
.nav .sep { height: 1px; background: var(--side-line); margin: 8px 6px; }
.side-foot { padding: 14px 16px 16px; font-size: .82rem; border-top: 1px solid var(--side-line); display: flex; flex-direction: column; gap: 10px; }
.usuario-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: .82rem; background: var(--side-active); color: var(--side-strong); }
.usuario-chip b { color: var(--side-strong); font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-chip span { min-width: 0; }
.powered { font-size: .72rem; letter-spacing: .01em; color: var(--side-ink); opacity: .75; display: flex; align-items: center; gap: 6px; }
.powered b { color: var(--side-strong); font-weight: 650; font-family: var(--font-display); }
.powered::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--stamp); box-shadow: 0 0 0 3px color-mix(in oklab, var(--stamp) 25%, transparent); }
:root[data-menu="color"] .powered::before { background: #fff; }
.side-acciones { display: flex; gap: 6px; }
.side-acciones .btn { flex: 1; }

/* Menú compacto: solo íconos */
:root[data-compacto="si"] .brand { padding: 20px 17px 16px; }
:root[data-compacto="si"] .brand-name, :root[data-compacto="si"] .nav a span, :root[data-compacto="si"] .usuario-chip span,
:root[data-compacto="si"] .powered span, :root[data-compacto="si"] .side-acciones .btn span { display: none; }
:root[data-compacto="si"] .nav a { justify-content: center; padding: 0; }
:root[data-compacto="si"] .side-foot { align-items: center; padding: 14px 8px; }
:root[data-compacto="si"] .side-acciones { flex-direction: column; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  position: sticky; top: 0; z-index: 20; min-height: 62px;
}
.topbar h1 { font-size: 1.22rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .menu-btn { display: none; }
.reloj { font-size: .84rem; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.content { padding: 24px 28px 48px; max-width: 1440px; width: 100%; }
.content.full { max-width: none; padding: 0; }
.content.entra { animation: aparecer calc(.34s * var(--t)) var(--ease) both; }

@media (max-width: 860px) {
  .shell, :root[data-compacto="si"] .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; transform: translateX(-102%); transition: transform .26s var(--ease); z-index: 60; }
  .side.abierto { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  :root[data-compacto="si"] .brand-name, :root[data-compacto="si"] .nav a span, :root[data-compacto="si"] .usuario-chip span { display: initial; }
  :root[data-compacto="si"] .nav a { justify-content: flex-start; padding: 0 12px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .reloj { display: none; }
}

/* ───────── Componentes ───────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sombra-1); }
.panel-pad { padding: calc(20px * var(--d)); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: calc(14px * var(--d)) 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { flex: 1; }
.stack { display: flex; flex-direction: column; gap: calc(18px * var(--d)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: .9rem;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: var(--r);
  padding: calc(8px * var(--d)) 14px; cursor: pointer; white-space: nowrap; text-decoration: none; min-height: calc(38px * var(--d));
  transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease), box-shadow .2s;
  box-shadow: var(--sombra-1);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* Operación en curso: el botón queda bloqueado con un indicador (evita grabar dos veces) */
.btn.ocupado { position: relative; color: transparent !important; opacity: .8; cursor: progress; }
.btn.ocupado::after { content: ''; position: absolute; inset: 0; margin: auto; width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-color: var(--ink-3) var(--ink-3) transparent transparent; animation: girar .7s linear infinite; }
.btn.primario.ocupado::after { border-color: #fff #fff transparent transparent; }
@keyframes girar { to { transform: rotate(360deg); } }
.btn.primario { background: var(--stamp); border-color: var(--stamp); color: var(--on-stamp); box-shadow: 0 6px 16px -8px color-mix(in oklab, var(--stamp) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn.primario:hover { background: var(--stamp-hover); border-color: var(--stamp-hover); }
.btn.peligro { color: var(--bad); border-color: color-mix(in oklab, var(--bad) 40%, transparent); }
.btn.peligro:hover { background: var(--bad-soft); }
.btn.fantasma { border-color: transparent; background: transparent; box-shadow: none; }
.btn.fantasma:hover { background: var(--surface-2); }
.btn.chico { padding: 4px 10px; min-height: 30px; font-size: .84rem; }
.btn.grande { padding: 14px 22px; font-size: 1.05rem; min-height: 54px; border-radius: calc(var(--r) + 2px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.cargando { pointer-events: none; color: transparent !important; position: relative; }
.btn.cargando::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--on-stamp) transparent var(--on-stamp) transparent; animation: girar .7s linear infinite; }
.side .btn { background: transparent; color: var(--side-ink); border-color: var(--side-line); box-shadow: none; }
.side .btn:hover { color: var(--side-strong); background: var(--side-hover); }
kbd { font-family: var(--mono); font-size: .7rem; padding: 1px 5px; border: 1px solid currentColor; border-radius: 4px; opacity: .65; font-weight: 400; }

label.campo, div.campo { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; color: var(--ink-2); font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--campo); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: calc(8px * var(--d)) 11px; min-height: calc(40px * var(--d)); width: 100%;
  transition: border-color .15s, box-shadow .2s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--stamp); box-shadow: var(--focus); }
input:disabled { background: var(--surface-2); color: var(--ink-2); }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--stamp); flex: none; }
input[type="color"] { padding: 3px; width: 52px; cursor: pointer; }
input[type="range"] { padding: 0; min-height: 28px; accent-color: var(--stamp); border: 0; background: none; }
label.check { display: inline-flex; align-items: center; gap: 9px; font-size: .92rem; cursor: pointer; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(14px * var(--d)) 14px; }
.form-grid .ancho { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr !important; } .form-grid > * { grid-column: auto !important; } }
.ayuda { font-size: .8rem; color: var(--ink-3); font-weight: 400; }
.campo .aviso-campo { font-size: .8rem; font-weight: 500; }
.aviso-campo.bad { color: var(--bad); } .aviso-campo.ok { color: var(--ok); } .aviso-campo.warn { color: var(--warn); }

/* Interruptor (checkbox con estilo de switch) */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 4px 0; }
.switch input { appearance: none; -webkit-appearance: none; width: 40px; height: 23px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; cursor: pointer; border: 0; padding: 0; min-height: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .22s var(--ease-spring); }
.switch input:checked { background: var(--stamp); }
.switch input:checked::after { transform: translateX(17px); }
.switch span { flex: 1; } .switch small { display: block; color: var(--ink-3); }

/* Selector segmentado */
.segmento { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: calc(var(--r) + 2px); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmento button { font: inherit; font-size: .86rem; font-weight: 600; border: 0; background: transparent; color: var(--ink-2); padding: 6px 12px; border-radius: var(--r); cursor: pointer; transition: background .18s, color .18s, box-shadow .18s; }
.segmento button:hover { color: var(--ink); }
.segmento button.activo { background: var(--surface); color: var(--ink); box-shadow: var(--sombra-1), 0 0 0 1px var(--line); }
.segmento.acento button.activo { background: var(--stamp); color: var(--on-stamp); box-shadow: none; }

/* Tablas */
.tabla-wrap { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabla th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: .78rem; padding: calc(10px * var(--d)) 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.panel > .tabla-wrap:first-child .tabla th:first-child, .panel > .tabla:first-child th:first-child { border-top-left-radius: var(--r-lg); }
.tabla td { padding: calc(10px * var(--d)) 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr { transition: background .12s; }
.tabla tbody tr.clic { cursor: pointer; }
.tabla tbody tr.clic:hover td, .tabla tbody tr:hover td { background: color-mix(in oklab, var(--stamp) 3.5%, var(--surface)); }
.tabla .num { text-align: right; white-space: nowrap; }
.tabla tfoot td { font-weight: 650; border-top: 2px solid var(--line); }
.vacio { padding: 48px 20px; text-align: center; color: var(--ink-2); }
.vacio b { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; font-family: var(--font-display); }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .77rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.stamp { background: var(--stamp-soft); color: var(--stamp); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* El sello: estado fiscal como sello de goma */
.sello {
  display: inline-block; font-family: var(--mono); font-weight: 600; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border: 1.5px solid currentColor; border-radius: 4px; transform: rotate(-2deg); line-height: 1.4; white-space: nowrap;
}
.sello.autorizado { color: var(--ok); }
.sello.pendiente { color: var(--warn); }
.sello.error { color: var(--bad); }
.sello.cancelado, .sello.no_aplica { color: var(--ink-3); }
.sello.grande { font-size: 1.05rem; padding: 7px 16px; border-width: 3px; border-radius: 7px; transform: rotate(-4deg); box-shadow: inset 0 0 0 1px currentColor; }
.sello.grande.estampa { animation: estampar calc(.55s * var(--t)) var(--ease) both; }

/* Métricas del tablero */
.metrica { padding: calc(18px * var(--d)) 20px; position: relative; overflow: hidden; }
.metrica .valor { font-family: var(--font-display); font-size: clamp(1.3rem, 2.2vw, 1.85rem); font-weight: 700; letter-spacing: -0.025em; margin-top: 4px; white-space: nowrap; }
.metrica .etq { font-size: .84rem; color: var(--ink-2); }
.metrica .delta { font-size: .82rem; margin-top: 2px; }
.metrica.destacada { background: linear-gradient(140deg, var(--stamp), color-mix(in oklab, var(--stamp), black 30%)); border-color: transparent; color: var(--on-stamp); }
.metrica.destacada .etq, .metrica.destacada .delta, .metrica.destacada .sube, .metrica.destacada .baja, .metrica.destacada small { color: inherit; opacity: .85; }
.cascada > * { animation: subir calc(.5s * var(--t)) var(--ease) both; }
.cascada > *:nth-child(2) { animation-delay: calc(.06s * var(--t)); }
.cascada > *:nth-child(3) { animation-delay: calc(.12s * var(--t)); }
.cascada > *:nth-child(4) { animation-delay: calc(.18s * var(--t)); }
.cascada > *:nth-child(n+5) { animation-delay: calc(.24s * var(--t)); }
.sube { color: var(--ok); } .baja { color: var(--bad); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; position: relative; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  font: inherit; font-size: .92rem; font-weight: 500; background: none; border: 0; padding: 11px 14px; color: var(--ink-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s, border-color .2s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.activo { color: var(--ink); border-bottom-color: var(--stamp); font-weight: 650; }
#t, .tab-cuerpo { animation: fundido calc(.25s * var(--t)) ease both; }

/* Modal */
.modal-fondo {
  position: fixed; inset: 0; background: rgba(10, 13, 22, .42); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; z-index: 100; padding: 16px; animation: fundido calc(.2s * var(--t)) ease both;
}
.modal-fondo.cerrando { animation: fundido calc(.18s * var(--t)) ease reverse both; }
@media (max-width: 640px) { .modal-fondo { padding: 6px; } .modal-body { padding: 14px; } .modal .tabla td, .modal .tabla th { padding: 7px 8px; } }
.modal {
  background: var(--surface); border-radius: calc(var(--r-lg) + 2px); width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: var(--sombra-3); border: 1px solid var(--line); animation: modal-in calc(.32s * var(--t)) var(--ease) both;
}
.modal-fondo.cerrando .modal { animation: modal-out calc(.18s * var(--t)) ease both; }
.modal.ancho { width: min(1000px, 100%); }
.modal.xl { width: min(1180px, 100%); }
.modal.xl .modal-body { background: var(--surface-2); }
.modal.angosto { width: min(450px, 100%); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-head h2 { flex: 1; font-size: 1.15rem; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 calc(var(--r-lg) + 2px) calc(var(--r-lg) + 2px); }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: calc(var(--r) + 2px);
  font-size: .92rem; font-weight: 500; box-shadow: var(--sombra-2); animation: toast-in calc(.38s * var(--t)) var(--ease-spring) both;
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.sale { animation: toast-out .22s ease both; }
.toast.error { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
:root[data-theme="dark"] .toast:not(.ok):not(.error) { background: #f1f3f7; color: #151a24; }

.aviso { padding: 12px 14px; border-radius: var(--r); font-size: .9rem; border: 1px solid; }
.aviso.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.aviso.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.aviso.info { background: var(--stamp-soft); color: var(--stamp); border-color: transparent; }
.aviso.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
:root[data-theme="dark"] .aviso.info { color: color-mix(in oklab, var(--stamp), white 35%); }

.esqueleto { border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: brillo 1.2s linear infinite; min-height: 18px; }

/* ───────── Punto de venta ───────── */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 410px; height: calc(100vh - 62px); }
.pos-izq { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.pos-buscar { padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--surface); position: relative; }
.pos-buscar input { font-size: 1.12rem; padding: 12px 14px 12px 46px; min-height: 54px; border-radius: calc(var(--r) + 2px); background: var(--surface-2); }
.pos-buscar input:focus { background: var(--surface); }
.pos-buscar svg.lupa { position: absolute; left: 36px; top: 50%; transform: translateY(-50%); width: 20px; color: var(--ink-3); pointer-events: none; }
.pos-sugerencias {
  position: absolute; left: 20px; right: 20px; top: calc(100% - 10px); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: calc(var(--r) + 2px); box-shadow: var(--sombra-2); z-index: 30; max-height: 420px; overflow-y: auto; animation: aparecer calc(.18s * var(--t)) var(--ease);
}
.pos-sugerencias button {
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; width: 100%; text-align: left; font: inherit; background: none; border: 0;
  padding: 8px 14px; cursor: pointer; border-bottom: 1px solid var(--line); color: var(--ink); align-items: center;
}
.pos-sugerencias button:hover, .pos-sugerencias button.sel { background: var(--stamp-soft); }
.pos-sugerencias .mini-foto { grid-row: 1 / span 2; }
.pos-sugerencias small { grid-column: 2; }
.pos-sugerencias .precio { grid-row: 1 / span 2; grid-column: 3; align-self: center; font-weight: 700; font-family: var(--font-display); font-size: 1.02rem; }
.mini-foto { width: 40px; height: 40px; border-radius: var(--r); object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-3); flex: none; overflow: hidden; }
.mini-foto svg { width: 18px; height: 18px; }
.mini-foto.g { width: 52px; height: 52px; }
.pos-items { flex: 1; overflow-y: auto; background: var(--surface); }
.pos-items .tabla td { padding: 8px 12px; }
.pos-items .item-prod { display: flex; align-items: center; gap: 10px; }
.pos-items input.cant { width: 84px; text-align: right; min-height: 36px; padding: 5px 8px; }
.pos-items input.mini { width: 100px; text-align: right; min-height: 36px; padding: 5px 8px; }
.pos-items tr.ultima td { background: var(--stamp-soft); }
.pos-items tr.nueva td { animation: aparecer calc(.28s * var(--t)) var(--ease) both; }
.pos-atajos { padding: 10px 20px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); align-items: center; }

.pos-der { display: flex; flex-direction: column; background: var(--surface-2); min-height: 0; }
.pos-der .bloque { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pos-total {
  padding: 22px 20px 18px; color: var(--on-stamp); position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--stamp), white 14%) 0%, var(--stamp) 45%, color-mix(in oklab, var(--stamp), black 35%) 100%);
}
.pos-total::after { content: ''; position: absolute; right: -18px; bottom: -26px; width: 150px; height: 150px; background: url('/logo.svg') center / contain no-repeat; opacity: .12; pointer-events: none; }
.pos-total .etq { font-size: .85rem; opacity: .85; }
.pos-total .chip { background: rgba(255, 255, 255, .16); color: inherit; border-color: transparent; }
.pos-total .monto { font-family: var(--font-display); font-size: 3.1rem; font-weight: 750; letter-spacing: -0.04em; line-height: 1.05; margin-top: 4px; display: inline-block; transform-origin: left center; }
.pos-total .monto.bump { animation: latido calc(.35s * var(--t)) var(--ease); }
.pos-total .detalle { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: .86rem; opacity: .88; margin-top: 10px; }
.pos-pagos { flex: 1; overflow-y: auto; }
.pago-linea { display: grid; grid-template-columns: 1fr 120px 30px; gap: 8px; align-items: center; margin-bottom: 8px; animation: aparecer calc(.22s * var(--t)) var(--ease); }
.pago-linea input { text-align: right; }
.medios { display: flex; flex-wrap: wrap; gap: 6px; }
.medios button {
  font: inherit; font-size: .84rem; font-weight: 500; border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 6px 12px; cursor: pointer; color: var(--ink);
  transition: border-color .15s, color .15s, transform .12s var(--ease), background .15s;
}
.medios button:hover { border-color: var(--stamp); color: var(--stamp); }
.medios button:active { transform: scale(.95); }
.pos-cobrar { padding: 14px 18px 18px; background: var(--surface); border-top: 1px solid var(--line); }
.pos-cobrar .btn { width: 100%; }
.resta { display: flex; justify-content: space-between; font-weight: 650; margin-bottom: 10px; font-size: .95rem; }
.resta.ok { color: var(--ok); } .resta.falta { color: var(--bad); }
.listas-pos { display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  .pos-items th:nth-child(4), .pos-items td:nth-child(4) { display: none; }
  .pos-atajos > span:not(.grow) { display: none; }
  .pos-buscar { padding: 12px; } .pos-buscar svg.lupa { left: 28px; }
}
@media (max-width: 1050px) {
  .pos { grid-template-columns: 1fr; height: auto; }
  .pos-izq { border-right: 0; min-height: 50vh; }
}

/* Gráfico de barras SVG */
.barras { width: 100%; height: 190px; display: block; }
.barras rect.cero { fill: var(--line-2); }
.barras line.guia { stroke: var(--line); stroke-dasharray: 3 5; }
.barras rect.b { fill: url(#grad-barras); transform-box: fill-box; transform-origin: bottom; animation: crecer calc(.6s * var(--t)) var(--ease) both; transition: fill .15s; }
.barras rect.b:hover { fill: var(--stamp-hover); filter: drop-shadow(0 4px 8px color-mix(in oklab, var(--stamp) 40%, transparent)); }
.barras text { fill: var(--ink-3); font-size: 10px; font-family: var(--font); }
.barras line { stroke: var(--line); }

/* ───────── Productos ───────── */
.prod-celda { display: flex; align-items: center; gap: 12px; min-width: 0; }
.prod-celda b { display: block; }
.precios-listas { display: grid; grid-template-columns: repeat(3, auto); gap: 0 14px; justify-content: end; font-size: .86rem; }
.precios-listas span { color: var(--ink-3); font-size: .74rem; text-align: right; }
.precios-listas b { text-align: right; }
.tabla-listas { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px 12px; align-items: center; }
.tabla-listas .enc { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.tabla-listas .nombre-lista { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.tabla-listas .nombre-lista i { width: 10px; height: 10px; border-radius: 3px; background: var(--stamp); flex: none; }
.tabla-listas .l2 i { background: color-mix(in oklab, var(--stamp) 65%, var(--surface)); }
.tabla-listas .l3 i { background: color-mix(in oklab, var(--stamp) 35%, var(--surface)); }
.tabla-listas input { text-align: right; }
.tabla-listas input.precio { font-weight: 700; font-family: var(--font-display); font-size: 1.02rem; }
.galeria { display: flex; gap: 10px; flex-wrap: wrap; }
.galeria .foto { position: relative; width: 96px; height: 96px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); animation: aparecer calc(.25s * var(--t)) var(--ease); }
.galeria .foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeria .foto .acciones { position: absolute; inset: auto 4px 4px 4px; display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
.galeria .foto:hover .acciones, .galeria .foto:focus-within .acciones { opacity: 1; }
.galeria .foto .acciones button { border: 0; border-radius: 6px; background: rgba(10, 13, 22, .72); color: #fff; width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.galeria .foto .acciones svg { width: 14px; height: 14px; }
.galeria .foto.principal { box-shadow: 0 0 0 2px var(--stamp); }
.galeria .foto.principal::after { content: 'Principal'; position: absolute; top: 4px; left: 4px; font-size: .64rem; font-weight: 700; background: var(--stamp); color: var(--on-stamp); padding: 1px 6px; border-radius: 99px; }
.galeria .agregar {
  width: 96px; height: 96px; border-radius: var(--r); border: 1.5px dashed var(--line-2); display: grid; place-items: center; text-align: center; color: var(--ink-3);
  cursor: pointer; font-size: .76rem; font-weight: 600; transition: border-color .15s, color .15s, background .15s; background: none; font-family: inherit; padding: 6px;
}
.galeria .agregar:hover, .galeria .agregar.sobre { border-color: var(--stamp); color: var(--stamp); background: var(--stamp-soft); }
.galeria .agregar svg { width: 22px; height: 22px; display: block; margin: 0 auto 4px; }
.foto-grande { max-width: 100%; max-height: 70vh; border-radius: var(--r-lg); display: block; margin: 0 auto; }
.ubicacion { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--ink-2); }
.ubicacion svg { width: 13px; height: 13px; }

/* ───────── Apariencia ───────── */
.temas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tema-op {
  border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 0; background: var(--surface); cursor: pointer; overflow: hidden; text-align: left;
  font: inherit; color: var(--ink); transition: border-color .15s, transform .2s var(--ease), box-shadow .2s;
}
.tema-op:hover { transform: translateY(-2px); box-shadow: var(--sombra-2); }
.tema-op.activo { border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-soft); }
.tema-op .muestra { height: 64px; display: grid; grid-template-columns: 30% 1fr; }
.tema-op .muestra .m-side { background: var(--m-side); }
.tema-op .muestra .m-main { background: var(--m-paper); padding: 10px; display: flex; flex-direction: column; gap: 5px; }
.tema-op .muestra .m-main i { display: block; height: 7px; border-radius: 4px; background: var(--m-line); width: 70%; }
.tema-op .muestra .m-main i:last-child { background: var(--m-acento); width: 40%; height: 12px; }
.tema-op span { display: block; padding: 8px 11px; font-weight: 600; font-size: .86rem; }
.colores { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.color-op { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; transition: transform .18s var(--ease-spring), box-shadow .15s; }
.color-op:hover { transform: scale(1.12); }
.color-op.activo { box-shadow: 0 0 0 2px var(--ink); }
.opciones-ui { display: grid; grid-template-columns: 220px 1fr; gap: 16px 20px; align-items: center; }
.opciones-ui > label:not(.switch) { font-weight: 600; font-size: .9rem; }
@media (max-width: 760px) { .opciones-ui { grid-template-columns: 1fr; gap: 6px; } .opciones-ui > label { margin-top: 10px; } }

/* Copias de seguridad */
.estado-backup { display: flex; gap: 16px; align-items: center; }
.estado-backup .icono-grande { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); flex: none; }
.estado-backup .icono-grande.warn { background: var(--warn-soft); color: var(--warn); }
.estado-backup .icono-grande svg { width: 24px; height: 24px; }

/* ───────── Acceso ───────── */
.acceso {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden;
  background: radial-gradient(90% 70% at 15% 10%, color-mix(in oklab, var(--stamp) 55%, #0d1018) 0%, transparent 60%),
              radial-gradient(70% 60% at 90% 100%, color-mix(in oklab, var(--stamp) 35%, #0d1018) 0%, transparent 60%), #0d1018;
}
.acceso .caja-acceso { width: min(440px, 100%); background: var(--surface); border-radius: 20px; padding: 32px; box-shadow: var(--sombra-3); animation: subir calc(.5s * var(--t)) var(--ease) both; position: relative; z-index: 1; }
.acceso .caja-acceso.ancha { width: min(780px, 100%); }
.acceso h1 { font-size: 1.6rem; margin: 16px 0 4px; }
.acceso .powered { position: absolute; bottom: 18px; left: 0; right: 0; justify-content: center; color: rgba(255, 255, 255, .6); opacity: 1; }
.acceso .powered b { color: #fff; }
.pasos-setup { display: flex; gap: 6px; margin: 14px 0 18px; }
.pasos-setup span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background .3s; }
.pasos-setup span.hecho { background: var(--stamp); }

.oculto { display: none !important; }
.derecha { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.lista-def { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: .92rem; margin: 0; }
.lista-def dt { color: var(--ink-2); }
.lista-def dd { margin: 0; }
pre.csr { white-space: pre-wrap; word-break: break-all; font-family: var(--mono); font-size: .75rem; background: var(--surface-2); padding: 12px; border-radius: var(--r); max-height: 200px; overflow: auto; }
.offline-banner { background: var(--warn); color: #fff; text-align: center; font-size: .86rem; padding: 6px; font-weight: 600; }


/* ═════════ Nivel 2: detalles de producto profesional ═════════ */

/* Select con flecha propia */
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8598' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
::placeholder { color: var(--ink-3); opacity: .8; }

/* Campo con prefijo / sufijo ($, %) */
.afijo { position: relative; display: flex; align-items: stretch; }
.afijo input { flex: 1; }
.afijo > span { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; color: var(--ink-3); font-size: .88rem; font-weight: 600; pointer-events: none; }
.afijo .pre { left: 11px; } .afijo .pre + input { padding-left: 26px; }
.afijo .suf { right: 11px; } .afijo input:has(+ .suf) { padding-right: 30px; }

/* Select con acciones (+ crear / ✎ administrar) */
.campo-accion { display: flex; gap: 6px; }
.campo-accion select { flex: 1; min-width: 0; }
.campo-accion .btn { min-height: calc(40px * var(--d)); width: calc(40px * var(--d)); padding: 0; flex: none; box-shadow: none; }

/* Secciones de formulario estilo "ficha" */
.ficha { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.ficha-lateral { position: sticky; top: 0; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 900px) { .ficha { grid-template-columns: 1fr; } .ficha-lateral { position: static; } }
.seccion { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.seccion > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.seccion > header .ico-sec { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--stamp-soft); color: var(--stamp); flex: none; }
.seccion > header .ico-sec svg { width: 16px; height: 16px; }
.seccion > header h4 { font-size: .95rem; margin: 0; }
.seccion > header p { margin: 0; font-size: .78rem; color: var(--ink-3); }
.seccion > .cuerpo { padding: 16px; }
.modal .seccion + .seccion { margin-top: 14px; }

/* Tarjeta de vista previa (artículo / cliente) */
.previa { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); box-shadow: var(--sombra-1); }
.previa .foto-previa { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); position: relative; overflow: hidden; }
.previa .foto-previa img { width: 100%; height: 100%; object-fit: cover; animation: fundido .3s ease; }
.previa .foto-previa svg { width: 46px; height: 46px; opacity: .45; }
.previa .datos { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.previa .datos b { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.2; }
.previa .precios-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 4px; }
.previa .precios-chips div { background: var(--surface-2); border-radius: var(--r); padding: 6px 8px; text-align: center; }
.previa .precios-chips small { display: block; font-size: .68rem; color: var(--ink-3); }
.previa .precios-chips span { font-weight: 700; font-size: .84rem; font-variant-numeric: tabular-nums; }

/* Barra de progreso superior (actividad con el servidor) */
.progreso { position: fixed; top: 0; left: 0; height: 2.5px; width: 0; z-index: 300; pointer-events: none;
  background: linear-gradient(90deg, var(--stamp), color-mix(in oklab, var(--stamp), white 35%)); box-shadow: 0 0 10px var(--stamp);
  transition: width .4s var(--ease), opacity .3s; opacity: 0; }
.progreso.activo { opacity: 1; }

/* Salida de la vista anterior */
.content.sale { opacity: 0; transform: translateY(-4px); transition: opacity calc(.12s * var(--t)) ease, transform calc(.12s * var(--t)) ease; }

/* Grupos del menú y migas en la barra superior */
.nav .grupo { font-size: .7rem; font-weight: 600; color: var(--side-ink); opacity: .55; padding: 14px 12px 4px; letter-spacing: .02em; }
:root[data-compacto="si"] .nav .grupo { visibility: hidden; height: 10px; padding: 0; }
.migas { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; }
.migas span { color: var(--ink-3); font-size: .86rem; white-space: nowrap; }
.migas span::after { content: '/'; margin-left: 8px; opacity: .5; }
.topbar .migas h1 { flex: initial; }
.boton-buscar { display: inline-flex; align-items: center; gap: 8px; min-width: 230px; justify-content: flex-start; color: var(--ink-3); font-weight: 500; background: var(--surface-2); box-shadow: none; border-color: var(--line); }
.boton-buscar kbd { margin-left: auto; }
@media (max-width: 1000px) { .boton-buscar { min-width: 0; } .boton-buscar span, .boton-buscar kbd { display: none; } }

/* Paleta de comandos (Ctrl+K) */
.paleta-fondo { position: fixed; inset: 0; z-index: 150; background: rgba(8, 10, 16, .38); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; animation: fundido calc(.15s * var(--t)) ease; }
.paleta { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--sombra-3); overflow: hidden;
  animation: modal-in calc(.25s * var(--t)) var(--ease-spring); }
.paleta .entrada { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.paleta .entrada svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.paleta .entrada input { border: 0; box-shadow: none; background: transparent; font-size: 1.08rem; min-height: 58px; padding: 0; }
.paleta .resultados { max-height: 52vh; overflow-y: auto; padding: 6px; }
.paleta .grupo-res { font-size: .72rem; font-weight: 600; color: var(--ink-3); padding: 10px 12px 4px; }
.paleta .res { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.paleta .res .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); flex: none; overflow: hidden; }
.paleta .res .ic svg { width: 16px; height: 16px; }
.paleta .res .ic img { width: 100%; height: 100%; object-fit: cover; }
.paleta .res small { display: block; color: var(--ink-3); font-size: .78rem; }
.paleta .res .der { margin-left: auto; font-weight: 650; font-size: .88rem; white-space: nowrap; }
.paleta .res.sel { background: var(--stamp-soft); }
.paleta .res.sel .ic { background: var(--stamp); color: var(--on-stamp); }
.paleta .pie-paleta { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line); font-size: .76rem; color: var(--ink-3); background: var(--surface-2); }

/* Acciones de fila que aparecen al pasar el mouse */
.tabla .acciones-fila { opacity: .35; transition: opacity .15s; }
.tabla tr:hover .acciones-fila, .tabla tr:focus-within .acciones-fila { opacity: 1; }

/* Avisos con barra de tiempo */
.toast { position: relative; overflow: hidden; }
.toast::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; background: currentColor; opacity: .35; animation: tiempo var(--dur, 3.2s) linear forwards; }
@keyframes tiempo { from { width: 100%; } to { width: 0; } }

/* Tooltips simples */
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--ink); color: var(--surface); font-size: .74rem; font-weight: 500; padding: 4px 8px; border-radius: 6px; pointer-events: none; z-index: 50; animation: fundido .15s ease; }

/* Fondo animado del acceso (un solo momento de movimiento) */
.acceso::before, .acceso::after { content: ''; position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(70px); opacity: .5; pointer-events: none; }
.acceso::before { background: color-mix(in oklab, var(--stamp) 70%, #000); top: -25vmax; left: -15vmax; animation: deriva 18s ease-in-out infinite alternate; }
.acceso::after { background: color-mix(in oklab, var(--stamp) 40%, #0d1018); bottom: -30vmax; right: -20vmax; animation: deriva 22s ease-in-out infinite alternate-reverse; }
@keyframes deriva { from { transform: translate(0, 0) scale(1); } to { transform: translate(8vmax, 6vmax) scale(1.15); } }

/* Estados vacíos con ícono */
.vacio .vacio-ico { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--stamp-soft); color: var(--stamp); }
.vacio .vacio-ico svg { width: 26px; height: 26px; }

/* Lista de catálogo */
.cat-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.cat-item .btn.chico { padding: 4px 7px; }
.cat-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  transition: border-color .15s, transform .2s var(--ease), box-shadow .2s; animation: aparecer calc(.25s * var(--t)) var(--ease) both; }
.cat-item:hover { border-color: var(--stamp-line); box-shadow: var(--sombra-1); }
.cat-item .ini { width: 36px; height: 36px; border-radius: 10px; background: var(--stamp-soft); color: var(--stamp); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.cat-item .txt { flex: 1; min-width: 0; }
.cat-item .txt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-item .txt small { color: var(--ink-3); }

/* WhatsApp */
.wa-estado { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.wa-qr { width: 230px; height: 230px; border-radius: 16px; background: #fff; display: grid; place-items: center; border: 1px solid var(--line); overflow: hidden; }
.wa-qr img { width: 100%; height: 100%; animation: fundido .3s ease; }
.wa-ok { width: 64px; height: 64px; border-radius: 20px; background: color-mix(in oklab, #25d366 16%, var(--surface)); color: #1aa851; display: grid; place-items: center; }
.wa-ok svg { width: 30px; height: 30px; }
.chip.wa { background: color-mix(in oklab, #25d366 15%, var(--surface)); color: #128c4a; border-color: transparent; }
:root[data-theme="dark"] .chip.wa { color: #4fdc8a; }
.variables { display: flex; flex-wrap: wrap; gap: 6px; }
.variables button { font: inherit; font-size: .78rem; font-family: var(--mono); border: 1px dashed var(--line-2); background: var(--surface-2); color: var(--ink-2); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.variables button:hover { border-color: var(--stamp); color: var(--stamp); }
.burbuja { background: color-mix(in oklab, #25d366 12%, var(--surface)); border-radius: 12px 12px 12px 4px; padding: 10px 12px; white-space: pre-line; font-size: .9rem; max-width: 420px; position: relative; }
.burbuja .adj { display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, .06); border-radius: 8px; padding: 8px; margin-bottom: 8px; font-size: .82rem; font-weight: 600; }
.burbuja .adj svg { width: 18px; height: 18px; color: #d93025; }
@media (max-width: 640px) { .wa-estado { grid-template-columns: 1fr; } }

/* Transición de modo claro/oscuro (círculo que se expande desde el botón) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Cotización del dólar en la barra superior */
.dolar { display: inline-flex; gap: 4px; align-items: stretch; border: 1px solid var(--line); background: var(--surface-2); border-radius: calc(var(--r) + 2px); padding: 3px; cursor: pointer; font: inherit; color: var(--ink); animation: fundido .4s ease; }
.dolar span { display: flex; flex-direction: column; align-items: flex-start; padding: 2px 10px; border-radius: var(--r); line-height: 1.1; }
.dolar span + span { border-left: 1px solid var(--line); }
.dolar small { font-size: .66rem; color: var(--ink-3); font-weight: 600; }
.dolar b { font-size: .9rem; font-variant-numeric: tabular-nums; }
.dolar:hover { border-color: var(--stamp-line); }
.dolar.viejo b { color: var(--ink-3); }
@media (max-width: 1100px) { .dolar { display: none; } }

/* Listado de productos: orden */
.orden-sel { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.orden-sel select { width: auto; }
.tabla th.ordenable { cursor: pointer; user-select: none; white-space: nowrap; }
.tabla th.ordenable:hover, .tabla th.ordenable:focus-visible { color: var(--ink); }
.tabla th.ordenable .flecha { margin-left: 5px; opacity: .35; font-size: .95em; }
.tabla th.ordenable.activa { color: var(--stamp); }
.tabla th.ordenable.activa .flecha { opacity: 1; }
.tabla tr.fila-nueva > td { background: color-mix(in oklab, var(--stamp) 10%, transparent); }
.tabla tr.fila-nueva > td:first-child { box-shadow: inset 3px 0 0 var(--stamp); }
.chip-nuevo { display: inline-block; margin-bottom: 3px; font-size: .72rem; }

/* Proveedores: catálogo de consulta */
.segmento button svg { width: 16px; height: 16px; vertical-align: -3px; }
.cat-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; }
.cat-prov { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cat-prov h2 { margin: 0; font-size: 1.35rem; letter-spacing: .06em; }
.cat-items { display: flex; flex-direction: column; gap: 8px; }
.cat-seccion { margin: 16px 2px 2px; font-size: 1.02rem; display: flex; align-items: baseline; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.cat-seccion:first-child { margin-top: 0; }
.cat-item { display: grid; grid-template-columns: 76px 190px 1fr 150px; align-items: center; gap: 14px; padding: 8px 14px 8px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.cat-item:hover { border-color: var(--line-2); }
.cat-foto { width: 76px; height: 76px; border-radius: var(--r); border: 1px solid var(--line); background: #fff; padding: 3px; cursor: zoom-in;
  display: grid; place-items: center; position: relative; overflow: hidden; color: var(--ink-3); }
.cat-foto:disabled { cursor: default; background: var(--surface-2); }
.cat-foto img { width: 100%; height: 100%; object-fit: contain; }
.cat-foto.ref img { opacity: .55; }
.cat-foto small { position: absolute; bottom: 0; left: 0; right: 0; font-size: .6rem; line-height: 1.5; background: rgba(0,0,0,.55); color: #fff; text-align: center; }
.cat-cod { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cat-copiar { all: unset; cursor: copy; font-weight: 650; font-size: .92rem; overflow-wrap: anywhere; }
.cat-copiar:hover { color: var(--stamp); text-decoration: underline; }
.cat-copiar:focus-visible { outline: 2px solid var(--stamp); border-radius: 4px; }
.cat-desc { display: flex; flex-direction: column; gap: 3px; line-height: 1.35; }
.cat-pre { text-align: right; }
.cat-precio { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.cat-mas { display: flex; justify-content: center; padding: 10px; }
.cat-items.grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.cat-items.grilla .cat-seccion, .cat-items.grilla .cat-mas, .cat-items.grilla > .vacio { grid-column: 1 / -1; }
.cat-items.grilla .cat-item { grid-template-columns: 1fr; gap: 6px; padding: 10px; align-content: start; }
.cat-items.grilla .cat-foto { width: 100%; height: 150px; }
.cat-items.grilla .cat-pre { text-align: left; }
.cat-foto-grande { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto 10px; background: #fff; border-radius: var(--r); padding: 8px; }
@media (max-width: 760px) {
  .cat-item { grid-template-columns: 64px 1fr; }
  .cat-foto { width: 64px; height: 64px; grid-row: span 3; }
  .cat-pre { text-align: left; }
}

/* Catálogos sin fotos y con datos extra (marca, cantidad, listas de precios) */
.tabs[hidden] { display: none; }
.cat-items.sin-fotos .cat-item { grid-template-columns: 210px 1fr 190px; padding-left: 14px; }
.cat-items.grilla.sin-fotos .cat-item { grid-template-columns: 1fr; }
.cat-extra { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.cat-extra .chip { font-size: .72rem; }
.cat-pre { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.cat-items.grilla .cat-pre { align-items: flex-start; }
.cat-listas { display: flex; flex-direction: column; align-items: inherit; gap: 1px; font-size: .74rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cat-nota { display: block; margin-top: 2px; }
@media (max-width: 760px) { .cat-items.sin-fotos .cat-item { grid-template-columns: 1fr; } .cat-pre { align-items: flex-start; } }

/* ---- Productos: lista sin fin y Vista Estanterías (1.3.6) ---- */
.lista-mas { display: flex; justify-content: center; padding: 6px 0 14px; min-height: 36px; }
.lista-mas .btn svg { animation: girar 1.1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.est-saltos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.est-saltos .chip { cursor: pointer; font-size: .8rem; padding: 4px 10px; }
.est-saltos .chip:hover { background: var(--stamp-soft); color: var(--stamp); border-color: var(--stamp-line); }
.est-saltos .chip small { font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.est-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; align-items: start; }
.mueble { padding: 14px 14px 10px; scroll-margin-top: 80px; }
.mueble-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mueble-head h3 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .01em; }
.mueble-head small { display: block; }
.mueble-ico { width: 36px; height: 36px; border-radius: var(--r); background: var(--stamp-soft); color: var(--stamp); display: grid; place-items: center; flex: none; }
.mueble-ico svg { width: 20px; height: 20px; }
.mueble.sin-ubicacion .mueble-ico { background: var(--warn-soft); color: var(--warn); }
.estantes { display: flex; flex-direction: column; border-left: 4px solid var(--line-2, var(--line)); border-right: 4px solid var(--line-2, var(--line)); border-radius: 4px; }
.estante { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 66px 1fr auto; align-items: end; gap: 10px; padding: 10px 10px 6px; cursor: pointer;
  border-bottom: 5px solid color-mix(in oklab, var(--stamp) 22%, var(--line)); background: linear-gradient(to bottom, transparent 55%, color-mix(in oklab, var(--surface-2) 80%, transparent));
  transition: background .15s, border-color .15s; min-height: 58px; }
.estante:hover, .estante:focus-visible { background: var(--stamp-soft); border-bottom-color: var(--stamp); }
.estante:focus-visible { box-shadow: var(--focus); }
.estante-etq { font-family: var(--mono); font-weight: 700; font-size: .85rem; color: var(--ink-2); align-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.estante-fotos { display: flex; align-items: flex-end; min-width: 0; overflow: hidden; }
.estante-fotos .mini-foto { width: 32px; height: 32px; margin-right: -6px; border: 2px solid var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.estante-fotos .mini-foto svg { width: 14px; height: 14px; }
.est-mas { font-size: .75rem; font-weight: 700; color: var(--ink-3); margin-left: 12px; align-self: center; }
.estante-cant { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; align-self: center; }
.estante-cant b { font-size: 1.05rem; }
.estante-cant small { color: var(--ink-3); font-size: .75rem; }
.estante-cant .chip { align-self: center; margin-left: 4px; }
.est-pop { position: fixed; z-index: 60; width: 320px; max-width: calc(100vw - 16px); pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 12px 32px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.08); padding: 12px; display: flex; flex-direction: column; gap: 8px; animation: est-pop-in .12s var(--ease); }
@keyframes est-pop-in { from { opacity: 0; transform: translateY(4px); } }
.est-pop[hidden] { display: none; }
.est-pop-head { display: flex; flex-direction: column; gap: 1px; }
.est-pop ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.est-pop li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.est-pop li .mini-foto { width: 30px; height: 30px; }
.est-pop-nom { flex: 1; min-width: 0; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.est-modal .tabla-wrap { max-height: 62vh; }
.orden-sel[hidden], .lista-mas[hidden] { display: none; }
.estante-cant .chip svg { width: 12px; height: 12px; }

/* ---- Actividad en vivo (1.3.8) ---- */
.act-cabecera { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.act-estado { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.act-estado .punto { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); }
.act-estado.ok .punto { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); animation: latir 1.6s ease-in-out infinite; }
.act-estado.mal .punto { background: var(--warn); }
@keyframes latir { 50% { box-shadow: 0 0 0 7px transparent; } }
.act-ul { list-style: none; margin: 0; padding: 0; }
.act-item { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.act-item:last-child { border-bottom: 0; }
.act-item.nuevo { animation: act-nuevo 2.2s var(--ease); }
@keyframes act-nuevo { from { background: var(--stamp-soft); } }
.act-ico { width: 34px; height: 34px; border-radius: var(--r); display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.act-ico svg { width: 18px; height: 18px; }
.act-item.imp .act-ico { background: var(--stamp-soft); color: var(--stamp); }
.act-ventas .act-ico { background: var(--ok-soft); color: var(--ok); }
.act-stock.imp .act-ico { background: var(--warn-soft); color: var(--warn); }
.act-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.act-txt small { color: var(--ink-2); overflow-wrap: anywhere; }
.act-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
@media (max-width: 640px) { .act-item { grid-template-columns: 32px 1fr; } .act-meta { grid-column: 2; align-items: flex-start; flex-direction: row; gap: 8px; } }

/* ---- Calcular precios desde listas de proveedor (1.3.8) ---- */
.calc-boton { white-space: normal; text-align: left; }
.cat-acciones { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
/* Cargar catálogo de proveedor */
.carga-zona { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 18px; border: 2px dashed var(--line-2); border-radius: 12px; cursor: pointer; text-align: center; }
.carga-zona:hover, .carga-zona.sobre { border-color: var(--stamp); background: color-mix(in srgb, var(--stamp) 6%, transparent); }
.carga-zona svg { width: 34px; height: 34px; opacity: .7; }
.carga-listas { display: grid; gap: 6px; margin-bottom: 6px; }
.carga-lista { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; }
.carga-lista > span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.carga-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px 12px; }
.carga-tabla { overflow: auto; max-height: 300px; border: 1px solid var(--line); border-radius: 10px; }
.carga-tabla table { border-collapse: collapse; min-width: 100%; font-size: 12px; white-space: nowrap; }
.carga-tabla th, .carga-tabla td { padding: 4px 8px; border-bottom: 1px solid var(--line); max-width: 260px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.carga-tabla th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.carga-tabla th small { display: block; font-weight: 600; color: var(--stamp); }
.carga-tabla th.usada { box-shadow: inset 0 -2px 0 var(--stamp); }
.carga-tabla tr.titulos td { font-weight: 700; background: color-mix(in srgb, var(--stamp) 9%, transparent); }
.carga-tabla tr.antes td { opacity: .45; }
.calc-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.calc-cat { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer; background: var(--surface); }
.calc-cat:has(input:checked) { border-color: var(--stamp); background: var(--stamp-soft); }
.calc-cat span { display: flex; flex-direction: column; gap: 2px; }
.calc-tabla { max-height: 58vh; }
.calc-tabla tr.marcada > td { background: color-mix(in oklab, var(--ok) 6%, transparent); }
.calc-tabla td { vertical-align: top; }
.calc-tabla td small { display: block; }
.calc-prop { min-width: 320px; display: flex; flex-direction: column; gap: 4px; }
td.calc-prop { display: table-cell; }
.calc-prop > * + * { margin-top: 4px; }
.calc-nota { color: var(--warn); display: flex; gap: 4px; align-items: center; }
.calc-nota svg { width: 13px; height: 13px; }
.calc-alt { width: 100%; font-size: .8rem; }
.calc-busca { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.calc-busca[hidden] { display: none; }
.calc-res { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow: auto; }
.calc-op { all: unset; cursor: pointer; font-size: .82rem; padding: 6px 8px; border-radius: var(--r); display: block; }
.calc-op:hover { background: var(--stamp-soft); }
#calc-filtro small { font-weight: 500; color: var(--ink-3); margin-left: 3px; }

/* ───── Compras (facturas y remitos de proveedores leídos con IA) ───── */
.compra-barra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.compra-barra input { width: auto; }
.compra-subir { font-weight: 700; letter-spacing: .3px; }
.compra-zona { margin-top: 12px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 18px; text-align: center; color: var(--ink-3); display: flex; gap: 10px; align-items: center; justify-content: center; }
.compra-zona.sobre { border-color: var(--stamp); background: var(--stamp-soft); color: var(--stamp); }
.compra-cab { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; }
.compra-cab.imp { padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.compra-cab .campo:first-child { grid-column: span 2; } .compra-cab.imp .campo:first-child { grid-column: auto; }
.compra-items { overflow: auto; max-height: 46vh; border: 1px solid var(--line); border-radius: var(--r-lg); }
.compra-items thead th { position: sticky; top: 0; z-index: 1; }
.compra-res { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; } .compra-res .btn { justify-content: flex-start; text-align: left; white-space: normal; }
.compra-datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.compra-datos small { display: block; }
.modal.compra-modal { width: min(1320px, 100%); }
tr.tachada td { opacity: .55; text-decoration: line-through; }
.aviso > svg { width: 18px; height: 18px; flex: none; vertical-align: -4px; margin-right: 6px; float: left; }
.aviso > svg + span { display: block; overflow: hidden; }
.compra-zona > svg { width: 22px; height: 22px; flex: none; }
.compra-barra input[type="date"] { max-width: 150px; }
