/* Lumina Contable — estilos. Tema: Vidrio glacial.
   Paneles de vidrio esmerilado sobre luces de color. Cada color significa una cosa
   en toda la app (los nombres de variable se conservan para no tocar el código):
   --cyan = ventas e ingresos (y color principal), --lime = utilidad, --magenta = gastos,
   --violet = compras, --amber = alertas e inventario, --red = negativo. */

:root {
  --bg: #041014;
  --bg-solid: #071A1F;
  --bg-2: rgba(2, 14, 18, .55);
  --surface: rgba(170, 235, 255, .045);
  --surface-2: rgba(170, 235, 255, .08);
  --line: rgba(150, 235, 255, .18);
  --line-soft: rgba(150, 235, 255, .10);
  --text: #E8FCFF;
  --muted: #8FB1B8;
  --faint: #5F848C;

  --cyan: #3FF5E0;
  --lime: #C9FFF8;
  --magenta: #6FA3C7;
  --violet: #8FA8FF;
  --amber: #FFC870;
  --red: #FF6B86;
  --c6: #2FB5D0;
  --c7: #B5CDD6;
  --c8: #4D8A99;

  --aura-1: color-mix(in srgb, var(--cyan) 22%, transparent);
  --aura-2: rgba(0, 120, 170, .24);
  --aura-3: color-mix(in srgb, var(--cyan) 6%, transparent);
  --glass: linear-gradient(160deg, rgba(190, 245, 255, .075), rgba(190, 245, 255, .022));
  --glass-strong: rgba(8, 30, 36, .9);
  --glass-hi: rgba(255, 255, 255, .08);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, .42);
  --blur: blur(14px) saturate(140%);
  --ink-on-accent: #E9FFFC;

  --glow: 1;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
  --pad: 22px;
  --gap: 22px;
  --cell: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", "Manrope", system-ui, sans-serif;
  color-scheme: dark;
}

/* Colores principales a elegir */
:root[data-accent="oceano"] { --cyan: #4CC9FF; --lime: #D6F1FF; --c6: #2F8FD0; --aura-2: rgba(30, 70, 190, .26); }
:root[data-accent="violeta"] { --cyan: #A78BFA; --lime: #EDE6FF; --c6: #7C6BF0; --magenta: #6FA3C7; --violet: #5EC8F2; --aura-2: rgba(90, 40, 170, .26); }
:root[data-accent="esmeralda"] { --cyan: #34E39A; --lime: #D7FFE9; --c6: #1FB57A; --aura-2: rgba(0, 120, 90, .26); }
:root[data-accent="oro"] { --cyan: #FFC857; --lime: #FFF1CC; --c6: #E09A2D; --amber: #FF9F7A; --aura-2: rgba(150, 90, 0, .22); }
:root[data-accent="rosa"] { --cyan: #FF7AC8; --lime: #FFE3F3; --c6: #E0559F; --magenta: #8FA8C7; --aura-2: rgba(150, 30, 110, .24); }

:root[data-theme="light"] {
  --bg: #E3F2F5;
  --bg-solid: #F4FAFB;
  --bg-2: rgba(255, 255, 255, .7);
  --surface: rgba(255, 255, 255, .55);
  --surface-2: rgba(255, 255, 255, .8);
  --line: rgba(10, 80, 95, .16);
  --line-soft: rgba(10, 80, 95, .09);
  --text: #072328;
  --muted: #3F646B;
  --faint: #6F8F95;

  --cyan: #008E9B;
  --lime: #0B4F6C;
  --magenta: #5B7F95;
  --violet: #4E63D9;
  --amber: #A86A00;
  --red: #C8243F;
  --c6: #1C7FA8;
  --c7: #8FAAB3;
  --c8: #2F5D6A;

  --aura-1: color-mix(in srgb, var(--cyan) 20%, transparent);
  --aura-2: rgba(80, 160, 220, .18);
  --aura-3: color-mix(in srgb, var(--cyan) 7%, transparent);
  --glass: linear-gradient(160deg, rgba(255, 255, 255, .8), rgba(255, 255, 255, .52));
  --glass-strong: rgba(255, 255, 255, .94);
  --glass-hi: rgba(255, 255, 255, .9);
  --glass-shadow: 0 12px 34px rgba(10, 70, 90, .12);
  --ink-on-accent: #fff;
  --glow: 0;
  --shadow: 0 14px 40px rgba(10, 70, 90, .16);
  color-scheme: light;
}
:root[data-theme="light"][data-accent="oceano"] { --cyan: #0B6FB0; --lime: #0A3D66; --c6: #2F8FD0; }
:root[data-theme="light"][data-accent="violeta"] { --cyan: #6D4FD8; --lime: #3B2A86; --c6: #8B6CF0; --violet: #1C7FA8; }
:root[data-theme="light"][data-accent="esmeralda"] { --cyan: #0C8A5A; --lime: #0B4F3A; --c6: #1FB57A; }
:root[data-theme="light"][data-accent="oro"] { --cyan: #A86A00; --lime: #6B3F00; --c6: #D08A1D; --amber: #C2410C; }
:root[data-theme="light"][data-accent="rosa"] { --cyan: #C0267F; --lime: #6E1446; --c6: #E0559F; }

/* Espaciado compacto y letra grande */
:root[data-density="compacta"] { --pad: 16px; --gap: 14px; --cell: 8px; }
:root[data-font="grande"] #app, :root[data-font="grande"] #modal-root { zoom: 1.12; }

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(55% 45% at 88% 6%, var(--aura-1), transparent 70%),
    radial-gradient(45% 45% at 6% 94%, var(--aura-2), transparent 70%),
    radial-gradient(35% 30% at 48% 55%, var(--aura-3), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
kbd { font-family: var(--font-ui); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Vidrio ---------- */
.panel, .kpi, .acc-card, .age, .tabs, .month-nav {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--glass-hi), var(--glass-shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
:root[data-glass="off"] { --blur: none; --glass: var(--bg-solid); }
:root[data-glass="off"] .side, :root[data-glass="off"] .top { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: var(--bg-solid) !important; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; overflow: hidden;
  display: grid; place-items: center; flex: none;
  background: var(--glass); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 calc(16px * var(--glow)) color-mix(in srgb, var(--cyan) 30%, transparent);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.brand-biz { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-g { font-size: 11.5px; font-weight: 700; color: var(--faint); padding: 14px 12px 5px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent;
}
.nav a span:not(.pill) { flex: 1; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="page"] {
  color: var(--text); background: var(--surface-2); border-color: var(--line);
  box-shadow: inset 0 1px 0 var(--glass-hi), inset 3px 0 0 var(--nav-c, var(--cyan));
}
.nav a[aria-current="page"] .ic { color: var(--nav-c, var(--cyan)); filter: drop-shadow(0 0 calc(6px * var(--glow)) var(--nav-c, var(--cyan))); }
.pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; background: color-mix(in srgb, var(--amber) 20%, transparent); color: var(--amber); }
.pill.bad { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }
.side-foot { margin-top: auto; padding: 10px 10px 0; font-size: 12px; color: var(--faint); display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line-soft); }
.side-foot .ic { width: 15px; height: 15px; color: var(--lime); }
.lic-foot { margin: auto 0 0; display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); background: color-mix(in srgb, var(--amber) 8%, transparent); color: inherit; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.lic-foot + .side-foot { margin-top: 10px; }
.lic-foot .ic { width: 15px; height: 15px; color: var(--amber); flex: none; }
.lic-foot.ok { border-color: var(--line-soft); background: transparent; color: var(--faint); }
.lic-foot.ok .ic { color: var(--lime); }
.banner.lic-banner { border-color: color-mix(in srgb, var(--cyan) 40%, transparent); background: color-mix(in srgb, var(--cyan) 8%, transparent); }
.banner.lic-banner > .ic { color: var(--cyan); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 32px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}
.top h1 { font-family: var(--font-display); font-weight: 600; font-size: 21px; letter-spacing: -.01em; white-space: nowrap; }
.top .grow { flex: 1; }
.search-btn { display: flex; align-items: center; gap: 10px; margin-left: 18px; height: 38px; padding: 0 10px 0 12px; min-width: 250px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--faint); cursor: pointer; font-size: 14px; }
.search-btn span { flex: 1; text-align: left; }
.search-btn:hover { border-color: var(--cyan); color: var(--muted); }
.icon-btn.menu-btn { display: none; }
.banner { margin: 16px 32px 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); background: color-mix(in srgb, var(--amber) 9%, transparent); font-size: 14px; }
.banner > .ic { color: var(--amber); }
.banner span { flex: 1; }

.view { padding: 26px 32px 64px; display: flex; flex-direction: column; gap: var(--gap); max-width: 1500px; width: 100%; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.eyebrow-date { color: var(--muted); font-size: 14px; }
.greet { font-family: var(--font-display); font-weight: 600; font-size: clamp(20px, 2.2vw, 27px); letter-spacing: -.02em; margin-top: 4px; }
.big-num { font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 3vw, 36px); letter-spacing: -.02em; }

/* ---------- Paneles ---------- */
.panel { border-radius: var(--radius-lg); padding: var(--pad); min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.panel-head p { color: var(--muted); font-size: 13px; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--gap); }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; }
.kpi { border-radius: var(--radius-lg); padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; min-width: 0; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--k); box-shadow: 0 0 calc(14px * var(--glow)) var(--k); opacity: .9; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 6px 8px; flex-wrap: wrap; }
.kpi-l { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-l i { width: 8px; height: 8px; border-radius: 50%; background: var(--k); box-shadow: 0 0 calc(8px * var(--glow)) var(--k); }
.kpi-v { font-family: var(--font-ui); font-weight: 800; font-size: clamp(19px, 1.6vw, 25px); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-b { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; min-height: 34px; }
.kpi-b small { color: var(--faint); font-size: 12px; line-height: 1.35; }
.kpi .spark { flex: none; max-width: 48%; height: auto; }
.delta { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.delta.up { color: var(--cyan); background: color-mix(in srgb, var(--cyan) 13%, transparent); }
.delta.down { color: var(--red); background: color-mix(in srgb, var(--red) 13%, transparent); }

/* Panel principal */
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); gap: var(--gap); }
.dash.single { grid-template-columns: 1fr; }
.widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }
.hero { position: relative; overflow: hidden; }
.hero-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.hero-label { color: var(--muted); font-weight: 600; }
.hero-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 5vw, 56px); letter-spacing: -.03em; line-height: 1.05;
  margin: 6px 0 8px; color: var(--lime);
  text-shadow: 0 0 calc(30px * var(--glow)) color-mix(in srgb, var(--lime) 45%, transparent);
}
.hero-num.neg { color: var(--red); text-shadow: 0 0 calc(28px * var(--glow)) color-mix(in srgb, var(--red) 55%, transparent); }
.hero-sub { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; }
.month-nav { display: flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px; }
.month-nav span { min-width: 140px; text-align: center; font-weight: 700; font-size: 14px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 18px 0 4px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; background: var(--c); box-shadow: 0 0 calc(8px * var(--glow)) var(--c); }
.facts { display: flex; flex-direction: column; }
.fact { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.fact:last-child { border-bottom: 0; }
.fact-l { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 14px; }
.fact-l i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 calc(8px * var(--glow)) var(--c); flex: none; }
.fact-v { font-weight: 800; font-size: 16px; text-align: right; }
.fact-v small { display: block; text-align: right; font-weight: 600; color: var(--faint); font-size: 12px; }

.chart { width: 100%; min-height: 120px; position: relative; }
.chart svg { display: block; overflow: visible; }
.chart text, #ch-pareto text { font-family: var(--font-ui); font-size: 11px; fill: var(--faint); }

.donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: center; }
.donut-wrap.stacked { grid-template-columns: 1fr; justify-items: center; }
.donut-wrap.stacked .donut-legend { width: 100%; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; min-width: 0; }
.donut-legend div { display: flex; justify-content: space-between; gap: 10px; }
.donut-legend span { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.donut-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); flex: none; }
.donut-legend b { font-weight: 700; white-space: nowrap; }

.rank { display: flex; flex-direction: column; gap: 13px; }
.rank-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.rank-item span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank-item em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--faint); width: 16px; }
.rank-item b { font-weight: 700; }
.rank-item .meter { grid-column: 1 / -1; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--cyan)); box-shadow: 0 0 calc(10px * var(--glow)) var(--c, var(--cyan)); }

.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: color-mix(in srgb, var(--amber) 8%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); }
.alert-item.out { background: color-mix(in srgb, var(--red) 9%, transparent); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.alert-item p { font-weight: 700; font-size: 14px; }
.alert-item small { color: var(--muted); font-size: 12px; }

.goal { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 16px; align-items: center; }
.goal-info { display: flex; flex-direction: column; gap: 8px; }
.goal-info p { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0 10px; font-size: 13.5px; }
.goal-info p.hint { display: block; }
.acc-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.acc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.acc-n { flex: 1; color: var(--muted); font-weight: 600; }
.acc-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--ac, var(--cyan)) 14%, transparent); color: var(--ac, var(--cyan)); }
.acc-ic .ic { width: 16px; height: 16px; }
.t-efectivo { --ac: var(--lime); }
.t-banco { --ac: var(--cyan); }
.t-digital { --ac: var(--violet); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--faint); }
.btn.primary, .btn.violet, .btn.magenta {
  --b: var(--cyan);
  background: color-mix(in srgb, var(--b) 17%, transparent);
  border-color: color-mix(in srgb, var(--b) 65%, transparent);
  color: var(--ink-on-accent);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 calc(18px * var(--glow)) color-mix(in srgb, var(--b) 30%, transparent);
}
.btn.violet { --b: var(--violet); }
.btn.magenta { --b: var(--magenta); }
.btn.primary:hover, .btn.violet:hover, .btn.magenta:hover {
  background: color-mix(in srgb, var(--b) 27%, transparent);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 calc(28px * var(--glow)) color-mix(in srgb, var(--b) 45%, transparent);
}
:root[data-theme="light"] .btn.primary, :root[data-theme="light"] .btn.violet, :root[data-theme="light"] .btn.magenta { background: var(--b); border-color: var(--b); color: #fff; }
:root[data-theme="light"] .btn.primary:hover, :root[data-theme="light"] .btn.violet:hover, :root[data-theme="light"] .btn.magenta:hover { background: color-mix(in srgb, var(--b) 85%, #000); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); background: transparent; box-shadow: none; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.big { height: 52px; font-size: 16px; padding: 0 20px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none;
  border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.icon-btn.danger:hover { color: var(--red); }
.icon-btn.inline { width: 28px; height: 28px; vertical-align: middle; color: var(--lime); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.link-btn { border: 0; background: none; padding: 0; color: var(--text); font-weight: 700; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--cyan); text-decoration: underline; }

/* ---------- Formularios ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 220px; flex: 1; max-width: 380px; }
.search > .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 38px; }
.search.big { max-width: none; }
.search.big input { height: 50px; font-size: 16px; padding-left: 44px; border-radius: 12px; }
.search.big > .ic { left: 15px; width: 20px; height: 20px; }
input, select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text);
}
textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 22%, transparent); }
select option { background: var(--bg-solid); color: var(--text); }
.toolbar select { width: auto; min-width: 150px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--cyan); }
input[type="file"] { padding: 8px; height: auto; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 40px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); position: relative; flex: none; transition: background .15s; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + .switch-ui { background: color-mix(in srgb, var(--cyan) 30%, transparent); border-color: var(--cyan); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: var(--cyan); box-shadow: 0 0 calc(8px * var(--glow)) var(--cyan); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--cyan); outline-offset: 2px; }
.toggle-list { display: flex; flex-direction: column; gap: 14px; }

.period .presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets .btn[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); background: color-mix(in srgb, var(--cyan) 10%, transparent); }
.date-range { display: flex; gap: 8px; align-items: center; }
.date-range input { width: 160px; }

.strip { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 14px; }
.strip div p { color: var(--muted); font-size: 13px; font-weight: 600; }
.strip div b { font-size: 21px; font-weight: 800; color: var(--c, var(--text)); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: color-mix(in srgb, var(--bg) 25%, transparent); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 700; color: var(--muted); font-size: 12.5px; padding: var(--cell) 14px; background: var(--surface-2); white-space: nowrap; }
td { padding: var(--cell) 14px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.r { text-align: right; }
.c { text-align: center; }
td.r, th.r { white-space: nowrap; }
.acts { display: flex; gap: 2px; justify-content: flex-end; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.strong { font-weight: 700; }
.neg-t { color: var(--red); }
.pos-t { color: var(--cyan); }
.warn-t { color: var(--amber); }
tfoot td { font-weight: 800; background: var(--surface-2); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--cyan); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 40%, transparent); background: color-mix(in srgb, var(--cyan) 10%, transparent); }
.b-warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: color-mix(in srgb, var(--amber) 10%, transparent); }
.b-bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: color-mix(in srgb, var(--red) 10%, transparent); }
.b-info { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 40%, transparent); background: color-mix(in srgb, var(--violet) 10%, transparent); }
.b-mute { color: var(--muted); border-color: var(--line); background: var(--surface); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-soft); vertical-align: 1px; }

.stock-cell { display: flex; flex-direction: column; gap: 5px; min-width: 90px; }
.more { display: flex; justify-content: center; margin-top: 14px; }
.empty { padding: 38px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty > .ic { width: 26px; height: 26px; color: var(--faint); }
.empty b { color: var(--text); font-size: 16px; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; font-size: 14px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: color-mix(in srgb, var(--cyan) 14%, transparent); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cyan) 45%, transparent); }

/* ---------- Ventanas ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: rgba(1, 8, 10, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: fade .16s ease-out;
}
.modal {
  width: min(580px, 100%); max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--glass-strong); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
  border-radius: var(--radius-lg); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow);
  animation: pop .18s ease-out;
}
.modal.narrow { width: min(460px, 100%); }
.modal.wide { width: min(860px, 100%); }
.modal.xl { width: min(1080px, 100%); }
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { font-size: 18px; font-weight: 800; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.modal-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.field small { color: var(--faint); font-size: 12px; }
.field small a { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; text-decoration: none; }
.field small a .ic { width: 14px; height: 14px; }
.hint { font-size: 13px; color: var(--muted); }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.inline-new { padding: 14px; border-radius: var(--radius); border: 1px dashed color-mix(in srgb, var(--cyan) 45%, transparent); background: color-mix(in srgb, var(--cyan) 5%, transparent); }
.form-bottom { align-items: start; }

/* Líneas de productos */
.items { display: flex; flex-direction: column; gap: 8px; }
.items-head, .item-row { display: grid; grid-template-columns: minmax(0, 3fr) 84px 124px 76px 84px 120px 34px; gap: 8px; align-items: center; }
.items[data-kind="purchase"] .items-head, .items[data-kind="purchase"] .item-row { grid-template-columns: minmax(0, 3fr) 90px 150px 140px 34px; }
.items-head span { font-size: 12px; font-weight: 700; color: var(--muted); }
.pick { min-width: 0; }
.item-total { text-align: right; font-weight: 700; }
.item-warn { grid-column: 1 / -1; font-size: 12px; color: var(--amber); margin-top: -4px; }
.items .add-line { align-self: flex-start; }
.totals { margin-left: auto; width: min(330px, 100%); display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; color: var(--muted); }
.totals .grand { font-size: 20px; font-weight: 800; color: var(--text); padding-top: 8px; border-top: 1px solid var(--line); }

.doc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.doc-meta div p { font-size: 12px; color: var(--muted); font-weight: 600; }
.doc-meta div b { font-weight: 700; }
.ret-lines { display: flex; flex-direction: column; gap: 8px; }
.ret-line { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--surface); }
.ret-line small { display: block; }
.ret-sum, .margin-box, .arq { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.ret-sum:empty, .margin-box:empty { display: none; }
.ret-sum > div, .margin-box > div, .arq > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.margin-box { flex-direction: row; flex-wrap: wrap; gap: 18px; }
.margin-box > div { flex-direction: column; gap: 2px; }
.margin-box span { color: var(--muted); font-size: 12px; font-weight: 600; }
.arq b { font-size: 18px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }
.done { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 8px 0; }
.done-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--cyan) 16%, transparent); color: var(--cyan); box-shadow: 0 0 calc(24px * var(--glow)) color-mix(in srgb, var(--cyan) 40%, transparent); }
.done-ic .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.done-total { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.done-change { margin-top: 8px; padding: 12px 20px; border-radius: var(--radius); background: color-mix(in srgb, var(--lime) 10%, transparent); border: 1px solid color-mix(in srgb, var(--lime) 35%, transparent); display: flex; flex-direction: column; }
.done-change span { color: var(--muted); font-size: 13px; }
.done-change b { font-size: 26px; color: var(--lime); }

/* ---------- Punto de venta ---------- */
.view-pos { max-width: none; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--gap); align-items: start; }
.pos-left { display: flex; flex-direction: column; gap: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 14%, transparent); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: calc(100vh - 290px); overflow-y: auto; padding: 2px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  min-height: 110px; padding: 12px; border-radius: 14px; cursor: pointer; color: var(--text);
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: border-color .12s, transform .08s, background .12s;
}
.tile:hover { border-color: color-mix(in srgb, var(--cyan) 60%, transparent); background: var(--surface-2); }
.tile:active { transform: scale(.97); }
.tile.in { border-color: var(--cyan); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 calc(14px * var(--glow)) color-mix(in srgb, var(--cyan) 30%, transparent); }
.tile-n { font-weight: 700; font-size: 14px; line-height: 1.3; flex: 1; }
.tile-p { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--cyan); }
.tile-st { font-size: 11.5px; color: var(--faint); font-weight: 600; }
.tile-st.low { color: var(--amber); }
.tile-st.out { color: var(--red); }
.tile-q { position: absolute; top: 8px; right: 8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--cyan); color: var(--bg-solid); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.kbd-hint { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kbd-hint .ic { width: 16px; height: 16px; }
.pos-ticket { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 104px); overflow-y: auto; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; }
.ticket-head h2 { font-size: 17px; font-weight: 800; }
.ticket-lines { display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.ticket-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--faint); text-align: center; padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px; }
.ticket-empty .ic { width: 28px; height: 28px; }
.tl { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 30px; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-soft); }
.tl-n { min-width: 0; }
.tl-n b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-n small { color: var(--faint); font-size: 11.5px; }
.tl-t { font-size: 14px; white-space: nowrap; }
.tl .icon-btn { width: 28px; height: 28px; }
.qty { display: flex; align-items: center; gap: 2px; }
.qty input { width: 48px; height: 30px; padding: 0 4px; text-align: center; border-radius: 8px; }
.ticket-tot { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line); }
.ticket-tot div { display: flex; justify-content: space-between; }
.ticket-tot .grand { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 6px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 12.5px; line-height: 1.15; cursor: pointer; text-align: center; }
.seg button .ic { width: 16px; height: 16px; }
.seg button[aria-pressed="true"] { color: var(--text); border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 14%, transparent); }
.cash-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.change { display: flex; flex-direction: column; align-items: flex-end; padding-bottom: 4px; }
.change span { font-size: 13px; font-weight: 700; color: var(--muted); }
.change b { font-family: var(--font-display); font-size: 22px; color: var(--lime); }
.quick { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.ticket-actions { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.ticket-actions .btn.ghost { height: 52px; }

/* ---------- Gastos ---------- */
.split-bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.split-bar i { display: block; height: 100%; background: var(--magenta); box-shadow: 0 0 calc(10px * var(--glow)) var(--magenta); }
.budgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 24px; }
.budget { display: flex; flex-direction: column; gap: 6px; }
.hbars { display: flex; flex-direction: column; gap: 14px; }
.hbar { display: flex; flex-direction: column; gap: 5px; }
.hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.hbar-top span { color: var(--muted); font-weight: 600; }
.hbar small { color: var(--faint); font-size: 12px; }

/* ---------- Análisis ---------- */
.insights ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; }
.ins { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-soft); font-size: 14px; line-height: 1.45; }
.ins > .ic { width: 20px; height: 20px; margin-top: 1px; color: var(--t, var(--cyan)); filter: drop-shadow(0 0 calc(5px * var(--glow)) var(--t, var(--cyan))); }
.ins.good { --t: var(--cyan); }
.ins.warn { --t: var(--amber); }
.ins.bad { --t: var(--red); }
.ins.info { --t: var(--violet); }
.ins b { color: var(--text); }
.rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.rep-grid.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.heat { display: grid; gap: 3px; align-items: center; }
.heat-h { font-size: 10.5px; color: var(--faint); text-align: center; }
.heat-r { font-size: 12px; color: var(--muted); font-weight: 600; }
.heat-c { height: 26px; border-radius: 5px; background: color-mix(in srgb, var(--cyan) var(--a), var(--surface)); border: 1px solid var(--line-soft); cursor: default; }
.heat-c:hover { outline: 2px solid var(--cyan); }
.heat-scale { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 10px; font-size: 12px; color: var(--faint); }
.heat-scale i { width: 120px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--surface), var(--cyan)); }
.abc { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.abc-cards { display: flex; flex-direction: column; gap: 10px; }
.abc-c { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: 12px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.abc-c b { grid-row: span 2; display: grid; place-items: center; font-family: var(--font-display); font-size: 20px; border-radius: 10px; color: var(--x); background: color-mix(in srgb, var(--x) 14%, transparent); }
.abc-c span { font-weight: 700; font-size: 14px; }
.abc-c small { color: var(--muted); font-size: 12px; }
.abc-c.ka { --x: var(--cyan); }
.abc-c.kb { --x: var(--violet); }
.abc-c.kc { --x: var(--faint); }

/* ---------- Cartera y bancos ---------- */
.aging { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.age { border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.age p { font-size: 13px; color: var(--muted); font-weight: 600; }
.age b { font-size: 19px; font-weight: 800; }
.age small { color: var(--faint); font-size: 12px; }
.age .meter i { --c: var(--x); }
.age.a0 { --x: var(--cyan); }
.age.a1 { --x: var(--amber); }
.age.a2 { --x: #FF9A6B; }
.age.a3, .age.a4 { --x: var(--red); }
.age b { color: var(--x); }
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--gap); }
.acc-card { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-radius: var(--radius-lg); text-align: left; cursor: pointer; color: var(--text); }
.acc-card:hover { border-color: color-mix(in srgb, var(--ac) 60%, transparent); }
.acc-card.sel { border-color: var(--ac); box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 calc(18px * var(--glow)) color-mix(in srgb, var(--ac) 30%, transparent); }
.acc-top { display: flex; align-items: center; gap: 10px; }
.acc-t { font-size: 12px; color: var(--muted); font-weight: 700; }
.acc-name { font-weight: 700; font-size: 15px; }
.acc-bal { font-family: var(--font-display); font-weight: 700; font-size: 23px; letter-spacing: -.02em; }
.acc-card .spark { width: 100%; height: 34px; }

/* ---------- Contabilidad ---------- */
.journal td { padding-top: 7px; padding-bottom: 7px; }
.journal .je-h td { background: var(--surface); border-top: 1px solid var(--line); font-size: 13px; }
.journal .je-l td { border-top: 0; font-size: 13.5px; }
.journal .je-l td.cr { padding-left: 42px; }
.bs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.bs-col { display: flex; flex-direction: column; }
.bs-col h3 { font-size: 13px; font-weight: 800; color: var(--muted); margin: 14px 0 6px; }
.bs-col h3:first-child { margin-top: 0; }
.bs-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.bs-row.total { font-weight: 800; border-bottom-color: var(--line); }
.bs-row.big { font-size: 16px; color: var(--cyan); border-bottom: 0; }
h3.grp { font-size: 14px; font-weight: 800; margin: 18px 0 8px; color: var(--muted); }

/* ---------- Ajustes ---------- */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.danger-zone { border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.logo-row { display: flex; gap: 16px; align-items: center; }
.logo-prev { width: 84px; height: 84px; border-radius: 16px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); flex: none; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.logo-prev svg { width: 44px; height: 44px; }
.opt-group { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.opt-group:first-of-type { border-top: 0; padding-top: 0; }
.opt-group .tabs { align-self: flex-start; }
.opt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.opt-card { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; color: var(--text); }
.opt-card small { color: var(--muted); font-size: 12px; }
.opt-card.sel { border-color: var(--cyan); box-shadow: 0 0 calc(14px * var(--glow)) color-mix(in srgb, var(--cyan) 30%, transparent); }
.opt-prev { height: 56px; border-radius: 8px; margin-bottom: 6px; border: 1px solid var(--line); }
.opt-prev.dark { background: radial-gradient(60% 80% at 80% 20%, color-mix(in srgb, var(--cyan) 45%, transparent), transparent 70%), #041014; }
.opt-prev.light { background: radial-gradient(60% 80% at 80% 20%, color-mix(in srgb, var(--cyan) 30%, transparent), transparent 70%), #E3F2F5; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; }
.swatch i { width: 22px; height: 22px; border-radius: 50%; }
.swatch.sel { color: var(--text); border-color: var(--cyan); }

/* ---------- Buscador rápido ---------- */
.pal-back { place-items: start center; padding-top: 12vh; }
.palette { width: min(620px, 100%); border-radius: var(--radius-lg); background: var(--glass-strong); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); overflow: hidden; animation: pop .16s ease-out; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line-soft); }
.pal-in input { border: 0; background: transparent; height: 56px; font-size: 16px; padding: 0; box-shadow: none; }
.pal-in input:focus { box-shadow: none; }
.pal-in > .ic { color: var(--cyan); }
.pal-list { max-height: 56vh; overflow-y: auto; padding: 8px; }
.pal-g { font-size: 11.5px; font-weight: 800; color: var(--faint); padding: 8px 10px 4px; }
.pal-it { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; border: 0; background: transparent; color: var(--text); cursor: pointer; text-align: left; font-size: 14px; }
.pal-it span { flex: 1; font-weight: 600; }
.pal-it small { color: var(--faint); font-size: 12.5px; }
.pal-it .ic { color: var(--muted); }
.pal-it.sel, .pal-it:hover { background: color-mix(in srgb, var(--cyan) 13%, transparent); }
.pal-it.sel .ic { color: var(--cyan); }
.pal-empty { padding: 24px; text-align: center; color: var(--faint); }

/* ---------- Bienvenida ---------- */
.welcome { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.welcome-art { position: relative; overflow: hidden; background: color-mix(in srgb, var(--bg) 45%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-right: 1px solid var(--line-soft); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.welcome-art h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 4.2vw, 58px); letter-spacing: -.03em; line-height: 1.05; max-width: 12ch; }
.welcome-art p.lead { color: var(--muted); font-size: 17px; max-width: 46ch; margin-top: 18px; }
.welcome-art svg.trace { width: 100%; height: auto; margin: 32px 0 0; }
.trace path { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trace .draw { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.2s .2s cubic-bezier(.6,.1,.2,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.welcome-feats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; color: var(--muted); font-size: 14px; }
.welcome-feats li { display: flex; gap: 10px; align-items: center; }
.welcome-feats .ic { color: var(--cyan); }
.welcome-form { padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; max-width: 520px; }
.welcome-form h2 { font-size: 24px; font-weight: 800; }

/* ---------- Avisos ---------- */
#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; background: var(--glass-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; max-width: 380px; border-left: 3px solid var(--cyan); animation: pop .18s ease-out; }
.toast .ic { color: var(--cyan); margin-top: 1px; }
.toast.err { border-left-color: var(--red); }
.toast.err .ic { color: var(--red); }
.tip { position: fixed; z-index: 300; pointer-events: none; padding: 10px 12px; border-radius: 10px; background: var(--glass-strong); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; min-width: 160px; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); }
.tip div span:last-child { color: var(--text); font-weight: 700; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }

/* ---------- Pantallas medianas y pequeñas ---------- */
@media (max-width: 1280px) {
  .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
  .items-head, .item-row { grid-template-columns: minmax(0, 2.4fr) 70px 110px 64px 76px 104px 34px; }
}
@media (max-width: 1180px) {
  .dash { grid-template-columns: 1fr; }
  .rep-grid, .rep-grid.wide-left, .settings { grid-template-columns: 1fr; }
  .aging { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .abc { grid-template-columns: 1fr; }
  .abc-cards { flex-direction: row; flex-wrap: wrap; }
  .abc-c { flex: 1; min-width: 200px; }
}
@media (max-width: 980px) {
  .pos { grid-template-columns: 1fr; }
  .pos-ticket { position: static; max-height: none; }
  .pos-grid { max-height: 52vh; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 90; left: 0; top: 0; width: 268px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); background: var(--glass-strong); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 80; background: rgba(1, 8, 10, .6); }
  .icon-btn.menu-btn { display: inline-grid; }
  .top { padding: 12px 16px; }
  .top h1 { font-size: 17px; }
  .search-btn { min-width: 0; margin-left: 0; width: 34px; height: 34px; padding: 0; justify-content: center; flex: none; border-radius: 9px; }
  .search-btn span, .search-btn kbd { display: none; }
  .banner { margin: 12px 16px 0; flex-wrap: wrap; }
  .view { padding: 18px 16px 48px; }
  .welcome { grid-template-columns: 1fr; }
  .welcome-art, .welcome-form { padding: 32px 20px; }
  .bs { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .kpis, .kpis.k4, .kpis.k3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .spark { display: none; }
  .widgets { grid-template-columns: 1fr; }
  .grid, .grid.g3, .grid.g4 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .donut-legend { width: 100%; }
  .goal { grid-template-columns: 1fr; justify-items: center; }
  .goal-info { width: 100%; }
  .top .btn .lbl { display: none; }
  .top .btn { padding: 0 12px; }
  .search { max-width: none; min-width: 100%; }
  .toolbar select { flex: 1; }
  .date-range { flex-wrap: wrap; width: 100%; }
  .date-range input { width: auto; flex: 1; }
  .aging { grid-template-columns: 1fr 1fr; }
  .welcome-feats { grid-template-columns: 1fr; }
  .modal-back { padding: 10px; }
  .modal-body { padding: 16px; }
  .ret-line { grid-template-columns: 1fr 90px; }
  .cash-box { grid-template-columns: 1fr; }
  .change { align-items: flex-start; }
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { min-height: 92px; padding: 10px; }
  .banner { font-size: 13px; }
  .kbd-hint { display: none; }
  .tl { grid-template-columns: 1fr auto 30px; }
  .tl-n { grid-column: 1 / -1; }
  .tl-n b { white-space: normal; }

  /* Tablas como tarjetas */
  .table-wrap { border: 0; background: none; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border: 1px solid var(--line-soft); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 0; background: var(--surface); }
  table.cards td { border: 0; padding: 6px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: 13px; text-align: left; }
  table.cards td.acts-cell::before { content: none; }
  table.cards tfoot { display: block; }
  table.cards .acts { width: 100%; }

  .items-head { display: none; }
  .item-row, .items[data-kind="purchase"] .item-row { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius); }
  .item-row > .pick { grid-column: 1 / -1; }
  .item-total { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .trace .draw { stroke-dashoffset: 0; }
}

/* ---------- Impresión ---------- */
@media print {
  .side, .top, .toolbar, .acts, .btn, .presets, .date-range, .banner, .period { display: none !important; }
  body { background: #fff; color: #000; }
  .shell { display: block; }
  .panel, .kpi { border: 1px solid #ccc; break-inside: avoid; box-shadow: none; background: #fff; }
}
