/* ==========================================================================
   Agustina — sistema de diseño
   Móvil primero. Objetivos táctiles ≥ 44px. Sin dependencias.
   ========================================================================== */

:root {
  --ground: #F6F5F2;
  --surface: #FFFFFF;
  --surface-2: #FAF9F7;
  --ink: #1B1D1F;
  --ink-2: #3F4448;
  --muted: #5B6066;
  --line: #E2E0DA;
  --line-2: #CFCCC4;
  --accent: #0E6B5C;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3F2EE;
  --accent-dark: #09493F;
  --nav: #13211E;
  --nav-ink: #D5E2DE;
  --danger: #8C2F24;
  --danger-soft: #FBEAE7;
  --warning: #6B3A00;
  --warning-soft: #FFF4E0;
  --info: #1F4FA3;
  --info-soft: #E8EFFB;
  --success: #0E6B5C;
  --success-soft: #E3F2EE;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 10px 28px rgba(27, 29, 31, .12);
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --sidebar: 264px;
  --bottombar: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.45;
}
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Estructura ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  background: var(--nav); color: var(--nav-ink);
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .2s ease;
}
.sidebar.open { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
.main { min-width: 0; padding-bottom: calc(var(--bottombar) + env(safe-area-inset-bottom)); }

@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .scrim { display: none !important; }
  .main { margin-left: var(--sidebar); padding-bottom: 0; }
  .bottombar, .menu-btn { display: none !important; }
}

.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 600; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 12px; color: #9DB3AD; }

.nav-search { padding: 4px 14px 10px; }
.nav-search input {
  width: 100%; height: 40px; border-radius: 8px; border: 1px solid #2C3B37;
  background: #1B2C28; color: #fff; padding: 0 12px; font: inherit;
}
.nav-search input::placeholder { color: #8DA39D; }
.nav { flex: 1; overflow-y: auto; padding: 0 10px 16px; }
.nav-group { margin-top: 10px; }
.nav-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #8DA39D; padding: 8px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px;
  color: var(--nav-ink); text-decoration: none; border-radius: 8px;
}
.nav a:hover { background: #1F302C; color: #fff; }
.nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav .soon { margin-left: auto; font-size: 11px; color: #8DA39D; }
.sidebar-foot { padding: 12px 18px 18px; border-top: 1px solid #23332F; font-size: 13px; }
.sidebar-foot strong { display: block; color: #fff; font-weight: 500; }

.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 64px;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title strong { display: block; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-badge { font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 4px 8px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); border: 1px solid #F0CF95; }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 2px 6px 2px 2px; border-radius: 999px; border: 1px solid var(--line); }
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.user-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(320px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 16px; display: grid; gap: 14px; z-index: 50;
}

.page { max-width: 1320px; margin: 0 auto; padding: 20px 16px 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 768px) { .page { padding: 24px 24px 40px; } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.page-head > div:first-child { flex: 1 1 260px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }

/* Barra inferior (móvil) */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--bottombar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
}
.bottombar a, .bottombar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font: inherit; font-size: 12px; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer;
}
.bottombar svg { width: 22px; height: 22px; }
.bottombar .active { color: var(--accent); font-weight: 600; }
.bottombar .primary span.icon { background: var(--accent); color: #fff; width: 44px; height: 32px; border-radius: 16px; display: grid; place-items: center; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
@media (min-width: 768px) { .card { padding: 20px; } }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { flex: 1; }
.step { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-lg { min-height: 56px; font-size: 17px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--line); border-color: var(--line); color: #6B7075; cursor: not-allowed; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .label { font-size: 13px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-width: 0; max-width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line-2);
  border-radius: var(--radius); background: var(--surface); font: inherit; font-size: 16px; color: var(--ink);
}
.textarea { padding: 10px 12px; min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.is-invalid, .select.is-invalid { border-color: var(--danger); }
.error { color: var(--danger); font-size: 13px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }

.alert { border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; border: 1px solid transparent; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-soft); border-color: #A9D5CA; color: #0A4A40; }
.alert-warning { background: var(--warning-soft); border-color: #F0CF95; color: var(--warning); }
.alert-danger { background: var(--danger-soft); border-color: #EDBFB7; color: var(--danger); }
.alert-info { background: var(--info-soft); border-color: #C3D3F0; color: var(--info); }
.alert a { color: inherit; font-weight: 600; }

.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: #0A4A40; }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #ECEAE5; color: var(--ink-2); }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; display: grid; gap: 4px; }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat .value { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.stat .sub { font-size: 13px; color: var(--muted); }
.stat-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat-dark .label, .stat-dark .sub { color: #BFC4C9; }

/* Listas que se vuelven tarjetas en móvil */
.list { display: grid; }
.list-row {
  display: grid; gap: 4px 12px; padding: 14px 4px; border-top: 1px solid var(--line);
  grid-template-columns: 1fr auto; align-items: center; text-decoration: none; color: inherit;
}
.list-row:first-child { border-top: 0; }
a.list-row:hover { background: var(--surface-2); color: inherit; }
.list-row .title { font-weight: 600; overflow-wrap: anywhere; }
.list-row .meta { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: 10px 12px; white-space: nowrap; }
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr.link:hover td { background: var(--surface-2); cursor: pointer; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.toolbar .field { flex: 1 1 160px; }
.toolbar .grow { flex: 3 1 240px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 14px; cursor: pointer; font: inherit; font-size: 14px; }
.chip.active, .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.empty { border: 2px dashed #DAD7CF; border-radius: var(--radius); padding: 32px 16px; text-align: center; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty strong { color: var(--ink); }
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.kv span:first-child { color: var(--ink-2); }

dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(480px, calc(100vw - 24px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-body { padding: 20px; display: grid; gap: 14px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Facturación ---------- */
.invoice-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.invoice-main { flex: 999 1 600px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.invoice-side { flex: 1 1 340px; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1024px) { .invoice-side { position: sticky; top: 84px; } }

.search-box { position: relative; }
.search-input {
  display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 14px;
  border: 2px solid var(--accent); border-radius: 12px; background: var(--surface);
}
.search-input svg { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.search-input input { flex: 1; min-width: 0; border: 0; outline: none; font: inherit; font-size: 16px; background: transparent; }
.results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; max-height: 360px; overflow-y: auto;
}
.result { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font: inherit; cursor: pointer; color: inherit; }
.result:hover, .result.active { background: var(--accent-soft); }
.result .r-main { flex: 1; min-width: 0; display: grid; }
.result .r-meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.result .r-add { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.result .r-add svg { width: 18px; height: 18px; }
.stock-low { color: var(--danger); }

.selected-customer { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.selected-customer .info { flex: 1; min-width: 0; }
.selected-customer .name { font-weight: 600; overflow-wrap: anywhere; }

.line-items { display: grid; gap: 10px; }
.line {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface);
  display: grid; gap: 12px;
}
.line.flash { animation: flash 1s ease; }
@keyframes flash { from { background: var(--accent-soft); } to { background: var(--surface); } }
.line-top { display: flex; align-items: flex-start; gap: 10px; }
.line-top .info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.line-top .name { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.line-top .name input { width: 100%; font: inherit; font-weight: 600; border: 1px solid var(--line-2); border-radius: 8px; min-height: 40px; padding: 0 10px; }
.line-top .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.line-remove { width: 44px; height: 44px; margin: -6px -8px 0 0; border: 0; border-radius: 8px; background: none; color: var(--danger); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.line-remove svg { width: 20px; height: 20px; }
.line-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.line-controls .f-qty { flex: 1 1 160px; min-width: 0; }
.line-controls .f-price { flex: 1 1 130px; min-width: 0; }
.line-controls .f-end { flex: 1 1 260px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.mini-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: block; margin-bottom: 4px; }
.stepper { display: flex; align-items: center; height: 48px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.stepper button { width: 48px; height: 48px; border: 0; background: #F1EFEA; font-size: 22px; cursor: pointer; flex-shrink: 0; color: var(--ink); }
.stepper button:active { background: #E2E0DA; }
.stepper input { flex: 1; min-width: 0; width: 100%; height: 48px; border: 0; text-align: center; font-family: var(--mono); font-size: 18px; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.price-input { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; font-family: var(--mono); font-size: 16px; text-align: right; }
.tax-select { height: 44px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 14px; background: var(--surface); }
.line-amount { text-align: right; }
.line-amount small { display: block; font-size: 12px; color: var(--muted); }
.line-amount strong { font-family: var(--mono); font-size: 17px; }

.totals .kv span:last-child { font-family: var(--mono); }
.grand-total { background: var(--ink); color: #fff; border-radius: 12px; padding: 16px 18px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.grand-total span:first-child { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.grand-total strong { font-family: var(--mono); font-size: 30px; letter-spacing: -.02em; }
.methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.methods label { position: relative; }
.methods input { position: absolute; opacity: 0; inset: 0; }
.methods span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px solid var(--line-2); border-radius: 10px; font-weight: 600; cursor: pointer; background: var(--surface); }
.methods input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.methods input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.cash-box { background: var(--surface-2); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }

.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 46px; font-weight: 600; cursor: pointer; }
.segmented input:checked + span { background: var(--ink); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: -3px; }

details.more > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; color: var(--accent); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: '+'; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 15px; line-height: 1; }
details.more[open] > summary::before { content: '−'; }

/* Barra fija de total (móvil) */
.mobile-total {
  position: fixed; left: 0; right: 0; bottom: calc(var(--bottombar) + env(safe-area-inset-bottom)); z-index: 25;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(27,29,31,.08);
  padding: 10px 16px; display: flex; align-items: center; gap: 12px;
}
.mobile-total .t { flex: 1; min-width: 0; }
.mobile-total small { display: block; font-size: 12px; color: var(--muted); }
.mobile-total strong { font-family: var(--mono); font-size: 20px; }
.has-mobile-total .page { padding-bottom: 96px; }
@media (min-width: 1024px) { .mobile-total { display: none; } .has-mobile-total .page { padding-bottom: 40px; } }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--nav) 0 38%, var(--ground) 38% 100%); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 24px; display: grid; gap: 18px; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 52px; }
.pass-wrap button { position: absolute; right: 2px; top: 1px; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.pass-wrap svg { width: 20px; height: 20px; }

@media print {
  .sidebar, .topbar, .bottombar, .mobile-total, .no-print { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
}

/* ---------- Gráfica de barras (una serie) ---------- */
.barchart-plot { position: relative; padding-left: 52px; }
.barchart-grid { position: absolute; left: 52px; right: 0; border-top: 1px dashed var(--line); }
.barchart-grid span { position: absolute; left: -52px; top: -8px; width: 46px; white-space: nowrap; letter-spacing: -.02em; text-align: right; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.barchart-bars { position: absolute; left: 52px; right: 0; top: 0; bottom: 0; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line-2); }
.barchart-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; position: relative; cursor: default; outline: none; }
.barchart-bar { width: 100%; max-width: 36px; margin: 0 auto; background: var(--accent); border-radius: 4px 4px 0 0; transition: opacity .15s; }
.barchart-col:hover .barchart-bar, .barchart-col:focus .barchart-bar { background: var(--accent-dark); }
.barchart-tip { display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 12px; padding: 6px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none; }
.barchart-col:hover .barchart-tip, .barchart-col:focus .barchart-tip { display: block; }
.barchart-col .barchart-tip { bottom: auto; top: -8px; transform: translate(-50%, -100%); }
.barchart-labels { display: flex; gap: 2px; padding-left: 52px; margin-top: 6px; }
.barchart-labels span { flex: 1 1 0; min-width: 0; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; }
.hbar { display: grid; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.hbar-track { grid-column: 1 / -1; height: 10px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.delta-up { color: var(--accent); font-weight: 600; }
.delta-down { color: var(--danger); font-weight: 600; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .ok { color: var(--accent); }
.checklist .no { color: var(--danger); }
.checklist .later { color: var(--muted, #8a877f); }
.url-box { font-family: var(--mono); font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; word-break: break-all; }

/* ---------- Caja rápida (punto de venta) ---------- */
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 1px solid currentColor; opacity: .75; margin-left: 4px; }
.pos-mode .bottombar { display: none; }
.pos-mode .main { padding-bottom: 0; }
.pos-mode .page { max-width: none; padding: 12px; gap: 12px; }
@media (min-width: 1024px) {
  .pos-mode .sidebar { transform: translateX(-100%); }
  .pos-mode .sidebar.open { transform: none; }
  .pos-mode .main { margin-left: 0; }
  .pos-mode .menu-btn { display: inline-flex !important; }
}
.pos { display: grid; gap: 12px; }
@media (min-width: 900px) {
  .pos { grid-template-columns: minmax(0, 1fr) 420px; height: calc(100vh - 92px); }
  .pos-catalog { overflow: auto; }
  .pos-cart { position: static !important; height: 100%; }
}
.pos-catalog { display: grid; gap: 12px; align-content: start; min-width: 0; }
.pos-top { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pos-search { flex: 1 1 320px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--accent); border-radius: 12px; padding: 0 8px 0 16px; min-height: 60px; }
.pos-search svg { color: var(--accent); flex: none; }
.pos-search input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 19px; background: transparent; min-width: 0; height: 54px; }
.pos-search-kbd { flex: none; font-size: 12px; color: var(--muted); }
.pos-status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pos-cash { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.pos-cash.is-open { background: var(--nav); color: var(--nav-ink); }
.pos-cash-dot { width: 8px; height: 8px; border-radius: 50%; background: #3DD68C; }
.pos-cash.is-closed { background: var(--danger-soft); color: var(--danger); }
.pos-cash.is-info { background: var(--info-soft); color: var(--info); }
.pos-cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.pos-cats .chip { flex: none; min-height: 40px; padding: 0 16px; font-size: 15px; }
.pos-cats .chip.active { background: var(--nav); border-color: var(--nav); color: #fff; }
.pos-out-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; justify-self: start; color: var(--ink-2); position: relative; }
.pos-out-toggle[hidden] { display: none; }
.pos-out-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pos-switch { width: 40px; height: 24px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.pos-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.pos-out-toggle input:checked + .pos-switch { background: var(--accent); }
.pos-out-toggle input:checked + .pos-switch::after { transform: translateX(16px); }
.pos-out-toggle input:focus-visible + .pos-switch { outline: 3px solid var(--accent); outline-offset: 2px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.pos-tile { position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: 4px; text-align: left; min-height: 150px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); transition: border-color .12s, transform .06s; }
.pos-tile:hover { border-color: var(--accent); }
.pos-tile:active { transform: scale(.98); }
.pos-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pos-tile.in-cart { border: 2px solid var(--accent); padding: 13px 15px; }
.pos-tile.is-out { opacity: .6; }
.pos-tile-incart { position: absolute; top: -10px; right: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.pos-tile-incart[hidden] { display: none; }
.pos-tile-name { font-weight: 600; font-size: 16px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-tile-code { font-size: 13px; color: var(--muted); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-tile-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; align-self: end; }
.pos-tile-price { font-size: 18px; font-weight: 700; color: var(--ink); font-family: var(--font); }
.pos-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.pos-tag.is-service { background: var(--info-soft); color: var(--info); }
.pos-tag.is-stock { background: var(--success-soft); color: #0A4A40; }
.pos-tag.is-last { background: var(--warning-soft); color: var(--warning); }
.pos-tag.is-out { background: var(--danger-soft); color: var(--danger); }
.pos-grid-foot { margin: 0; color: var(--muted); font-size: 14px; }
.pos-grid-foot:empty { display: none; }
.pos-cart { display: grid; grid-template-rows: auto 1fr auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; min-height: 0; }
.pos-cart-head { display: grid; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.pos-cart-title { display: flex; align-items: baseline; gap: 8px; }
.pos-cart-title h2 { margin: 0; font-size: 20px; flex: 1; }
.pos-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pos-picker { display: grid; gap: 1px; text-align: left; min-width: 0; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); min-height: 52px; align-content: center; }
.pos-picker:hover { border-color: var(--accent); }
.pos-picker small { color: var(--muted); font-size: 12px; }
.pos-picker small kbd { font-size: 10px; }
.pos-picker strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-picker-select select { border: 0; padding: 0; font: inherit; font-weight: 600; background: transparent; color: var(--ink); width: 100%; cursor: pointer; outline: 0; }
.pos-picker-select:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.pos-ncf-hint { margin: 0; font-size: 13px; color: var(--muted); }
.pos-ncf-hint[hidden] { display: none; }
.pos-close-cart { display: none; }
.pos-lines { list-style: none; margin: 0; padding: 0 16px; overflow: auto; min-height: 0; }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pos-line-main { display: grid; min-width: 0; }
.pos-line-main strong { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.pos-line-meta { font-size: 13px; color: var(--muted); }
.pos-qty { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.pos-qty button { width: 34px; height: 38px; border: 0; background: var(--surface); font: inherit; font-size: 18px; color: var(--ink-2); cursor: pointer; }
.pos-qty button:hover { background: var(--surface-2); }
.pos-qty button:disabled { color: var(--line-2); cursor: default; }
.pos-qty input { width: 40px; height: 38px; border: 0; text-align: center; font-size: 15px; font-weight: 600; background: transparent; padding: 0; }
.pos-line-total { font-weight: 700; min-width: 86px; text-align: right; font-family: var(--font); }
.pos-line-links { grid-column: 1 / -1; display: flex; gap: 14px; }
.pos-line-links button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.pos-line-links button:hover { color: var(--accent); text-decoration: underline; }
.pos-line-links button[data-act="remove"]:hover { color: var(--danger); }
.pos-empty { display: grid; gap: 6px; place-content: center; text-align: center; color: var(--muted); padding: 24px; }
.pos-empty[hidden] { display: none; }
.pos-totals { border-top: 1px solid var(--line); padding: 14px 16px 12px; display: grid; gap: 4px; background: var(--surface-2); }
.pos-totals .kv { padding: 2px 0; color: var(--ink-2); }
.pos-grand { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; font-weight: 600; padding: 6px 0 8px; }
.pos-grand strong { font-size: 34px; font-family: var(--font); letter-spacing: -.01em; }
.pos-pay { min-height: 60px; font-size: 19px; border-radius: 12px; gap: 10px; }
.pos-pay kbd, .pos-actions kbd { font-size: 11px; }
.pos-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.pos-actions .btn { min-height: 46px; }
.pos-clear { color: var(--danger); }
.pos-help { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.pos-help kbd { font-size: 10px; }
.pos-mobilebar { display: none; }
.pos-flash { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; max-width: calc(100vw - 32px); }
.pos-flash.show { opacity: 1; transform: translate(-50%, 0); }
.pos-dialog { width: min(520px, calc(100vw - 24px)); }
.pos-pay-total { display: flex; justify-content: space-between; align-items: baseline; }
.pos-pay-total strong { font-size: 30px; }
.pos-pay-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.pos-pay-row .input { font-size: 18px; }
.pos-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pos-change { font-size: 18px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-top: 10px; }
.pos-change.ok { background: var(--success-soft); color: #0A4A40; }
.pos-change.bad { background: var(--danger-soft); color: var(--danger); }
.pos-change.big { font-size: 26px; }
.pos-change:empty { display: none; }
@media (max-width: 899px) {
  .pos-cart { position: fixed; inset: 0; z-index: 40; border-radius: 0; transform: translateY(100%); transition: transform .2s; }
  .pos.cart-open .pos-cart { transform: none; }
  .pos-close-cart { display: inline-flex; }
  .pos-mobilebar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); z-index: 30; }
  .pos-mobilebar .btn-primary { flex: 1; }
  .pos-catalog { padding-bottom: 84px; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .pos-tile { min-height: 130px; padding: 12px; }
  .pos-tile.in-cart { padding: 11px; }
  .pos-tile-foot { flex-wrap: wrap; }
  .pos-help { display: none; }
  .pos-pay-row { grid-template-columns: 1fr 1fr; }
  .pos-pay-row .select { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { .pos-cart, .pos-flash, .pos-tile { transition: none; } }

/* ---------- Estados financieros ---------- */
.fin-report h2 { margin: 14px 0 6px; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.fin-report h2:first-child { margin-top: 0; }
.fin-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.fin-row.lvl-1, .fin-row.lvl-2 { font-weight: 700; }
.fin-row.lvl-4 { padding-left: 16px; }
.fin-total { font-weight: 700; border-bottom: 0; border-top: 1.5px solid var(--ink); }
.fin-grand { font-weight: 700; font-size: 16px; border-bottom: 3px double var(--ink); border-top: 1.5px solid var(--ink); margin-top: 8px; }
@media print { .fin-report { box-shadow: none; border: 0; } }

/* ---------------- Inicio de sesión (pantalla dividida) — colores de Agustina Soft ---------------- */
.auth-body { --brand-navy: #002060; --brand-cyan: #00B0F0; --accent: #0A2A6E; --accent-dark: #001A4D; --accent-soft: #E6F6FD; background: var(--ground); }
.auth-body a { color: #0077B6; }
.auth-body a.btn { color: var(--ink); }
.auth-body .input:focus { border-color: var(--brand-cyan); box-shadow: 0 0 0 4px rgba(0, 176, 240, .16); }
.auth-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 24px;
  background: radial-gradient(900px 600px at 15% 10%, #E3EEFB 0%, transparent 60%), radial-gradient(900px 600px at 90% 90%, #E0F5FD 0%, transparent 60%), #EEF2F7; }
.auth2 { width: min(860px, 100%); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  border-radius: 20px; overflow: hidden; background: var(--surface); box-shadow: 0 24px 60px rgba(0, 32, 96, .18), 0 2px 6px rgba(0, 32, 96, .06); }
.auth2-brand {
  position: relative; overflow: hidden; color: #E6EEFA; padding: 32px 34px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  background: radial-gradient(900px 520px at 110% 105%, rgba(0, 176, 240, .32), transparent 60%),
              radial-gradient(700px 500px at -10% -20%, rgba(0, 96, 200, .35), transparent 60%),
              linear-gradient(155deg, #00123A 0%, #002060 50%, #003680 100%);
}
.auth2-brand::after {
  content: ""; position: absolute; right: -180px; bottom: -180px; width: 380px; height: 380px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 0 0 70px rgba(255, 255, 255, .025), 0 0 0 150px rgba(255, 255, 255, .015);
  pointer-events: none;
}
.auth2-logo { display: grid; gap: 10px; justify-items: start; position: relative; z-index: 1; }
.auth2-wordmark { display: block; height: 38px; width: auto; max-width: 100%; }
.auth2-tag { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: #9FC4EA; }
.auth2-pitch { position: relative; z-index: 1; max-width: 520px; }
.auth2-pitch h2 { font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; color: #fff; margin: 0 0 10px; }
.auth2-pitch p { font-size: 14px; line-height: 1.5; color: #B9CDEA; margin: 0 0 18px; }
.auth2-pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.auth2-pitch li { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: #E6EEFA; }
.auth2-check { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: rgba(0, 176, 240, .14); border: 1px solid rgba(0, 176, 240, .4); color: var(--brand-cyan); }
.auth2-check svg { width: 12px; height: 12px; }
.auth2-foot { font-size: 11px; color: #8FAAD3; position: relative; z-index: 1; }
.auth2-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 34px calc(32px + env(safe-area-inset-bottom)); background: var(--surface); }
.auth2-form { width: min(360px, 100%); }
.auth2-stack { display: grid; gap: 14px; }
.auth2-stack h1 { font-size: 24px; letter-spacing: -.02em; color: var(--brand-navy); }
.auth2-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #0090C8; margin-bottom: 8px; }
.auth2-input { min-height: 44px; font-size: 16px; }
.auth2-submit { min-height: 46px; font-size: 15px; background: linear-gradient(135deg, #002060, #0A3C96); border-color: #002060; box-shadow: 0 8px 22px rgba(0, 32, 96, .30); }
.auth2-submit:hover { background: linear-gradient(135deg, #001A4D, #00307A); }
.auth2-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.auth2-divider::before, .auth2-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth2-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin: 0; }
.auth2-note svg { flex-shrink: 0; margin-top: 2px; }
.auth2-mobile-logo { display: none; margin-bottom: 28px; width: min(420px, 100%); }
.auth2-mobile-logo .auth2-wordmark { height: 40px; }
@media (max-width: 900px) {
  .auth-body { padding: 0; place-items: stretch; background: var(--surface); }
  .auth2 { grid-template-columns: 1fr; width: 100%; min-height: 100dvh; border-radius: 0; box-shadow: none; }
  .auth2-brand { display: none; }
  .auth2-mobile-logo { display: block; }
  .auth2-panel { justify-content: flex-start; padding: 48px 24px calc(32px + env(safe-area-inset-bottom)); }
  .auth2-form { width: min(420px, 100%); }
  .auth2-input { min-height: 50px; }
  .auth2-submit { min-height: 52px; font-size: 16px; }
}

/* ---------------- Facturación y caja separadas ---------------- */
.order-done { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-color: var(--accent); background: var(--accent-soft, #E8F3F0); }
.order-change { display: grid; justify-items: end; gap: 2px; }
.order-change span { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.order-change strong { font-family: var(--mono); font-size: 34px; letter-spacing: -.02em; color: var(--accent); }
.dest-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dest-switch label { position: relative; }
.dest-switch input { position: absolute; opacity: 0; inset: 0; }
.dest-switch span { display: grid; gap: 2px; padding: 10px 12px; min-height: 58px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; background: var(--surface); }
.dest-switch span strong { font-size: 14px; }
.dest-switch span small { font-size: 12px; color: var(--muted); }
.dest-switch input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft, #E8F3F0); }
.dest-switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------------- Toma de inventario ---------------- */
.count-bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.count-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.count-bar.dark { background: rgba(255, 255, 255, .18); margin: 4px 0 2px; }
.count-bar.dark span { background: #fff; }
.count-actions { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.count-table th.num, .count-table td.num { text-align: right; }
.count-table tr.is-pending td:not(:last-child) { }
.count-input { text-align: right; min-height: 40px; max-width: 140px; margin-left: auto; }
.count-input.is-saving { border-color: var(--warning); }
.count-input.is-saved { border-color: var(--accent); background: var(--accent-soft); }
.count-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); }
/* Pantalla de conteo con el celular */
.scan-wrap { max-width: 640px; margin: 0 auto; display: grid; gap: 14px; }
.scan-box { position: sticky; top: 0; z-index: 3; background: var(--ground, var(--bg)); padding: 4px 0 8px; }
.scan-input { font-size: 20px; min-height: 58px; }
.scan-last { border: 2px solid var(--accent); }
.scan-last.bad { border-color: var(--danger); }
.scan-last .name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.scan-last .total { font-family: var(--mono); font-size: 44px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.scan-qty { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; align-items: center; }
.scan-qty button { min-height: 52px; font-size: 22px; font-weight: 700; }
.scan-qty input { text-align: center; font-size: 22px; min-height: 52px; }

/* ---------------- Menú lateral desplegable ---------------- */
.nav-toggle { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; cursor: pointer; font: inherit;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #8DA39D; padding: 9px 10px; border-radius: 8px; text-align: left; }
.nav-toggle:hover { color: #fff; background: #1A2925; }
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav-toggle > span:first-child { flex: 1; }
.nav-toggle svg { width: 16px; height: 16px; transition: transform .2s; }
.nav-count { font-size: 10px; letter-spacing: 0; background: #23332F; color: #B9C9C4; border-radius: 99px; padding: 1px 7px; opacity: 0; transition: opacity .2s; }
.nav-group.collapsed .nav-count { opacity: 1; }
.nav-group.collapsed .nav-toggle svg { transform: rotate(-90deg); }
.nav-items { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .22s ease; }
.nav-items-in { overflow: hidden; min-height: 0; }
.nav-group.collapsed .nav-items { grid-template-rows: 0fr; }
.nav-group.collapsed.searching .nav-items { grid-template-rows: 1fr; }
.nav-group.collapsed.searching .nav-toggle svg { transform: none; }
.nav-group { margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .nav-items, .nav-toggle svg { transition: none; } }

/* ---------------- Elegir menú (Mi cuenta) ---------------- */
.layout-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.layout-pick label { position: relative; }
.layout-pick input { position: absolute; opacity: 0; inset: 0; }
.layout-pick span { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; background: var(--surface); height: 100%; }
.layout-pick svg { width: 100%; height: auto; border-radius: 6px; }
.layout-pick small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.layout-pick input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.layout-pick input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------------- Menú superior (opcional por usuario) ---------------- */
.topnav { display: none; }
@media (min-width: 1024px) {
  .nav-top .sidebar { display: none; }
  .nav-top .main { margin-left: 0; }
  .nav-top .topbar { display: none; }
  .nav-top .topnav { display: block; position: sticky; top: 0; z-index: 30; }
  .nav-top .page { max-width: 1440px; padding-left: 24px; padding-right: 24px; }
}
.tn-row { display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 20px; background: var(--nav); color: var(--nav-ink); }
.tn-brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; flex-shrink: 0; }
.tn-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; overflow: hidden; flex-shrink: 0; }
.tn-mark img { width: 100%; height: 100%; object-fit: cover; }
.tn-brand-text strong { display: block; font-size: 14px; color: #fff; line-height: 1.15; white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.tn-brand-text small { display: block; font-size: 12px; color: #8DA39D; white-space: nowrap; }
.tn-menu { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.tn-link, .tn-item > button { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 11px; border-radius: 8px; color: #C9D6D2; font: inherit; font-size: 14px; font-weight: 500; background: none; border: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
.tn-link svg { width: 18px; height: 18px; }
.tn-item > button svg { width: 14px; height: 14px; transition: transform .15s; }
.tn-link:hover, .tn-item > button:hover, .tn-item.open > button { background: #1F302C; color: #fff; }
.tn-link.active, .tn-item.active > button { background: var(--accent); color: #fff; }
.tn-item.open > button svg { transform: rotate(180deg); }
.tn-item { position: relative; }
.tn-drop { display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 260px; z-index: 50; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.06); }
.tn-item.open .tn-drop { display: grid; }
.tn-drop a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; }
.tn-drop a:hover { background: var(--surface-2); }
.tn-drop a svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.tn-drop a.cur { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.tn-drop a.cur svg { color: var(--accent); }
.tn-user { margin-left: auto; flex-shrink: 0; }
.tn-user .user-menu > summary { border-color: #2C3B37; color: #C9D6D2; }
.tn-user .user-panel { color: var(--ink); }
.tn-sub { background: var(--surface); border-bottom: 1px solid var(--line); }
.tn-sub-row { display: flex; gap: 2px; padding: 0 20px; overflow-x: auto; scrollbar-width: none; }
.tn-sub a { display: inline-flex; align-items: center; gap: 7px; padding: 12px 11px; color: var(--ink-2); text-decoration: none; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tn-sub a svg { width: 16px; height: 16px; }
.tn-sub a:hover { color: var(--ink); }
.tn-sub a.cur { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* Cliente encontrado en el padrón de la DGII (no registrado) */
.result-dgii { border-top: 1px dashed var(--line, #ddd); border-radius: 0 0 8px 8px; }
.result .r-tag { flex-shrink: 0; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.dgii-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; }
.dgii-note .ok { color: var(--success, #0A7A5A); }
.dgii-note .warn { color: var(--warning, #9A6200); }
.dgii-note .bad { color: var(--danger, #B42318); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:disabled { opacity: .5; cursor: wait; }

/* Simulación de certificación DGII */
.sim-log { margin: 0 0 12px; padding: 10px 14px 10px 30px; background: var(--surface-2, #F6F4EF); border-radius: 10px; font-size: 13px; font-family: var(--mono); display: grid; gap: 2px; }
.sim-doc { display: inline-flex; align-items: center; gap: 4px; margin: 2px 8px 2px 0; }
.sim-doc a { font-size: 12px; font-weight: 600; }
.text-success { color: var(--success); }

/* Tablas anchas (606/607/608): se desplazan dentro de su recuadro, con la barra
   horizontal siempre visible dentro de la ventana y el encabezado fijo */
.table-scroll { overflow: auto; max-height: calc(100vh - 220px); min-height: 240px; }
.table-scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2, #F7F6F2); }

/* Mis empresas (contador con varias empresas) */
.companies-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.company-card { display: grid; gap: 6px; align-content: start; }
.company-card header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.company-card.is-current { box-shadow: inset 0 0 0 2px var(--accent); }
.company-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------------- Avisos: campanita y ventanitas ---------------- */
.notif-menu { position: relative; }
.notif-menu > summary { list-style: none; cursor: pointer; position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--ink-2); }
.notif-menu > summary::-webkit-details-marker { display: none; }
.notif-menu > summary svg { width: 22px; height: 22px; }
.notif-menu[open] > summary, .notif-menu > summary:hover { background: var(--surface-2); color: var(--ink); }
.notif-count { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.notif-count[hidden] { display: none; }
.notif-panel { position: absolute; right: -52px; top: calc(100% + 8px); width: min(380px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); z-index: 50; display: grid; }
@media (min-width: 768px) { .notif-panel { right: 0; } }
.notif-head, .notif-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; }
.notif-head { border-bottom: 1px solid var(--line); }
.notif-foot { border-top: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.notif-head .btn, .notif-foot .btn { min-height: 34px; padding: 4px 8px; font-size: 13px; }
.notif-list { max-height: min(60vh, 440px); overflow-y: auto; padding: 6px; display: grid; gap: 2px; }
.notif-empty { margin: 0; padding: 18px 10px; text-align: center; }
.notif-item { display: grid; gap: 2px; padding: 10px 12px 10px 16px; border-radius: 10px; color: var(--ink); text-decoration: none; position: relative; font-size: 14px; }
.notif-item:hover { background: var(--surface-2); color: var(--ink); }
.notif-item strong { font-size: 14px; }
.notif-item span { color: var(--ink-2); overflow-wrap: anywhere; }
.notif-item small { color: var(--muted); font-size: 12px; }
.notif-item.unread { background: var(--accent-soft); }
.notif-item.unread::before { content: ""; position: absolute; left: 6px; top: 16px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.notif-item.tone-danger.unread { background: var(--danger-soft); }
.notif-item.tone-danger.unread::before { background: var(--danger); }
.card > .notif-item + .notif-item { margin-top: 4px; }
.tn-user { display: flex; align-items: center; gap: 10px; }
.tn-user .notif-menu > summary { border-color: #2C3B37; color: #C9D6D2; }
.tn-user .notif-menu > summary:hover, .tn-user .notif-menu[open] > summary { background: #1F302C; color: #fff; }
.tn-user .notif-count { box-shadow: 0 0 0 2px var(--nav); }

.toasts { position: fixed; z-index: 80; top: 72px; right: 16px; left: 16px; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
@media (min-width: 768px) { .toasts { left: auto; width: 380px; } }
.toast { pointer-events: auto; width: 100%; max-width: 380px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 12px 12px 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 5px solid var(--info); border-radius: 12px; box-shadow: 0 16px 40px rgba(27, 29, 31, .18); cursor: pointer; animation: toast-in .22s ease-out; }
.toast.tone-success { border-left-color: var(--success); }
.toast.tone-warning { border-left-color: #C77A00; }
.toast.tone-danger { border-left-color: var(--danger); }
.toast strong { font-size: 14px; }
.toast span { grid-column: 1; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.toast button { grid-row: 1 / span 2; grid-column: 2; align-self: start; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.toast button:hover { background: var(--surface-2); color: var(--ink); }
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .toast.leaving { transition: none; } }

/* Elegir plan al crear una empresa */
.plan-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.plan-option { position: relative; cursor: pointer; }
.plan-option input { position: absolute; opacity: 0; }
.plan-option > span { display: grid; gap: 3px; height: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.plan-option input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.plan-option input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.plan-option .mono { font-size: 18px; font-weight: 600; }

/* Mi plan: funciones incluidas */
.plan-feature { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); }
.plan-feature svg { width: 20px; height: 20px; margin-top: 1px; }
.plan-feature span { display: grid; gap: 2px; }
.plan-feature small { color: var(--muted); font-size: 13px; }
.plan-feature.on svg { color: var(--accent); }
.plan-feature.off { background: var(--surface-2); }
.plan-feature.off strong { color: var(--ink-2); }
.plan-feature.off svg { color: var(--muted); }
.plan-feature.is-locked { border-color: #E3B65E; background: var(--warning-soft); }
.plan-limits { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.plan-mods { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.plan-mods .check { min-height: 36px; }
.plan-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
.price-card { border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: grid; gap: 16px; background: var(--surface); box-shadow: 0 1px 2px rgba(27, 29, 31, .04); }
.price-card.is-off { background: var(--surface-2); }
.price-card.is-off .pc-price strong { color: var(--muted); }
.price-card header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.price-card h3 { margin: 0; font-size: 18px; }
.price-card header .muted { font-size: 13px; }
.pc-price { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 8px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pc-price strong { font-family: "IBM Plex Mono", monospace; font-size: 26px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.pc-price small { color: var(--muted); font-size: 14px; }
.pc-price span { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }
.pc-limits { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-limits span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 13px; font-weight: 600; }
.pc-limits svg { width: 15px; height: 15px; }
.pc-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 14px; }
.pc-feats li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; }
.pc-feats li::before { content: "✓"; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); margin-top: 1px; }
.pc-feats li.off { color: var(--muted); }
.pc-feats li.off::before { content: "–"; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pc-edit > summary { list-style: none; cursor: pointer; }
.pc-edit > summary::-webkit-details-marker { display: none; }
.pc-edit[open] > summary.btn { display: none; }
.pc-form { display: grid; gap: 12px; padding-top: 4px; }
.pc-form .field { margin: 0; }
.pc-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.pc-grid-3 { grid-template-columns: repeat(3, 1fr); }
.pc-mods { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 14px; }
.pc-mods legend { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.pc-mods .check { min-height: 36px; font-size: 14px; }
.pc-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pc-actions .check { font-size: 14px; }
.price-card.is-new { border-style: dashed; background: transparent; box-shadow: none; padding: 0; }
.price-card.is-new .pc-edit[open] { padding: 20px; }
.pc-add { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 34px 20px; border-radius: 16px; color: var(--accent); }
.pc-add svg { width: 26px; height: 26px; }
.pc-add .muted { font-size: 13px; }
.pc-add:hover { background: var(--surface-2); }
.pc-edit[open] > .pc-add { padding: 0 0 12px; justify-items: start; text-align: left; }
.pc-edit[open] > .pc-add svg, .pc-edit[open] > .pc-add .muted { display: none; }
.preset { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.preset > summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.preset > summary::-webkit-details-marker { display: none; }
.preset > summary svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.preset > summary span { display: grid; }
.preset > summary small { font-size: 13px; }
.preset-form { display: grid; gap: 12px; padding: 0 16px 16px; }
@media (max-width: 520px) { .pc-grid-3 { grid-template-columns: 1fr 1fr; } }

/* Registro en línea */
.signup-set { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; }
.signup-set legend { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.signup-set .field { margin: 0; }
.signup-two { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .signup-two { grid-template-columns: 1fr; } }
.signup-plans { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.signup-plans .plan-option > span { padding: 10px 12px; }
.signup-plans .plan-option .mono { font-size: 16px; }
.signup-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.trial-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.signup-two { align-items: start; }
.reminder-preview { white-space: pre-wrap; font: 14px/1.5 inherit; font-family: inherit; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 8px 0 0; }

/* Presentaciones del producto (caja, docena, rollo…) */
.unit-rows { display: grid; gap: 10px; }
.unit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; position: relative; }
.unit-row .field { margin: 0; }
.unit-row .line-remove { position: absolute; top: 6px; right: 6px; margin: 0; }
.unit-row { padding-right: 52px; }
.unit-head { display: none; }
@media (min-width: 860px) {
    .unit-row { grid-template-columns: 1.3fr .8fr 1.3fr 1fr 44px; padding: 0; border: 0; align-items: center; }
    .unit-row .mini-label { display: none; }
    .unit-row .line-remove { position: static; }
    .unit-head:not([hidden]) { display: grid; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
}
.unit-select { min-height: 32px; padding: 2px 28px 2px 8px; font-size: 13px; border-radius: 8px; max-width: 100%; }
.line .meta .unit-select, .pos-line .unit-select { width: auto; display: inline-block; margin: 2px 0 0 4px; vertical-align: middle; font-family: inherit; }

/* Piezas de un kit */
.kit-rows { display: grid; gap: 10px; }
.kit-row { display: grid; grid-template-columns: 1fr 110px 44px; gap: 10px; align-items: start; }
.kit-row .field { margin: 0; }
.kit-row .line-remove { margin: 22px 0 0; }
.kit-row [data-kit-name]:empty { display: none; }

/* Ofertas */
.promo-rows { display: grid; gap: 10px; }
.promo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-items: start; padding: 12px 52px 12px 12px; border: 1px solid var(--line); border-radius: 12px; position: relative; }
.promo-row .field { margin: 0; }
.promo-row .field:first-child { grid-column: 1 / -1; }
.promo-row .line-remove { position: absolute; top: 6px; right: 6px; margin: 0; }
.promo-row [data-promo-name]:empty { display: none; }
@media (min-width: 860px) {
    .promo-row { grid-template-columns: 1fr 160px 120px 44px; padding: 0; border: 0; }
    .promo-row .field:first-child { grid-column: auto; }
    .promo-row .line-remove { position: static; margin-top: 22px; }
}
.promo-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 11px; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }
.promo-was { text-decoration: line-through; color: var(--muted); font-size: 12px; }

/* Caja: turno y acciones */
.cash-turn { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin-bottom: 16px; }
@media (min-width: 900px) { .cash-turn { grid-template-columns: minmax(280px, 1fr) minmax(0, 1.6fr); } }
.cash-expected { background: var(--ink); color: #fff; border-radius: var(--radius-lg); padding: 18px 20px; display: grid; gap: 4px; align-content: start; }
.cash-expected .label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #BFC4C9; }
.cash-expected > strong { font-size: 30px; font-family: var(--mono); }
.cash-expected small { color: #BFC4C9; font-size: 13px; }
.cash-methods { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.15); font-size: 13px; color: #D9DDE0; }
.cash-methods strong { color: #fff; }
.cash-actions { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) {
    .cash-actions { gap: 8px; }
    .cash-action { flex-direction: column; justify-content: center; text-align: center; gap: 6px; padding: 12px 6px; min-height: 84px; }
    .cash-action span, .cash-action strong { justify-items: center; text-align: center; }
    .cash-action strong { font-size: 14px; line-height: 1.2; }
    .cash-action small { display: none; }
}
.cash-action { display: flex; align-items: center; gap: 12px; padding: 16px; min-height: 76px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); text-decoration: none; font: inherit; text-align: left; cursor: pointer; }
.cash-action:hover { border-color: var(--accent); }
.cash-action svg { width: 26px; height: 26px; flex-shrink: 0; color: var(--accent); }
.cash-action span { display: grid; gap: 2px; min-width: 0; }
.cash-action strong { font-size: 16px; }
.cash-action small { color: var(--muted); font-size: 13px; }
.cash-action.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.cash-action.primary svg, .cash-action.primary small { color: #D7EEE8; }
details.more-card > summary { cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: center; min-height: 28px; }
details.more-card > summary::-webkit-details-marker { display: none; }
details.more-card > summary::before { content: '+'; display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 14px; color: var(--accent); }
details.more-card[open] > summary::before { content: '−'; }
dialog.dialog-wide { width: min(560px, calc(100vw - 24px)); }
.bills { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.bill { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.bill .input { min-height: 42px; text-align: right; }
.close-summary { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.close-diff { font-weight: 700; }
.close-diff.ok { color: var(--accent); }
.close-diff.bad { color: var(--danger); }
@media (max-width: 560px) {
    .sale-done .order-change { order: -1; justify-items: start; width: 100%; padding-bottom: 10px; border-bottom: 1px solid rgba(14,107,92,.2); }
}

/* Comisiones */
details.commission-row > summary { list-style: none; cursor: pointer; }
details.commission-row > summary::-webkit-details-marker { display: none; }
details.commission-row[open] > summary { background: var(--surface-2); }
.commission-detail { padding: 6px 4px 14px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.rate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 8px 16px; }
.rate-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.rate-input { display: flex; align-items: center; gap: 6px; }
.rate-input .input { width: 90px; text-align: right; min-height: 40px; }

/* Línea libre: precio con ITBIS incluido */
.incl-tax { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.incl-tax input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Cómo pagar la suscripción */
.pay-info { display: grid; gap: 14px; }
.pay-info-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.pay-info-head h2 { margin: 0 0 4px; }
.pay-info-head p { margin: 0; font-size: 14px; }
.pay-accounts-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pay-account { display: grid; gap: 3px; padding: 12px 14px; border: 1px solid var(--line, #E3E6EA); border-radius: var(--radius); background: var(--surface-2, #F8F9FA); font-size: 14px; }
.pay-number { display: inline-flex; align-items: center; gap: 6px; justify-self: start; margin: 4px 0; padding: 4px 8px; border: 1px dashed currentColor; border-radius: 6px; background: transparent; color: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.pay-number svg { width: 14px; height: 14px; opacity: .6; }
.pay-number.copied { color: var(--success, #0A7A66); }
.pay-number.copied::after { content: 'Copiado'; font: 600 11px/1 system-ui, sans-serif; }
.pay-note { margin: 0; font-size: 14px; padding: 10px 12px; border-left: 3px solid var(--info, #2F5FB3); background: var(--info-soft, #EEF3FC); border-radius: 0 6px 6px 0; }
.pay-accounts td { padding: 6px 4px; vertical-align: top; }
.pay-accounts .input, .pay-accounts .select { min-width: 110px; }

/* ---- Búsqueda global (Ctrl+K) ---- */
.gs-open { gap: 8px; color: var(--muted); min-width: 0; }
.gs-open .gs-kbd { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 5px; color: var(--muted); background: var(--surface-2); }
@media (max-width: 720px) { .gs-open .gs-label, .gs-open .gs-kbd { display: none; } }
.gs-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(19, 33, 30, .45); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.gs-backdrop[hidden] { display: none; }
body.gs-lock { overflow: hidden; }
.gs-panel { width: min(640px, 100%); max-height: 76vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.gs-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
.gs-input-row input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 17px; background: transparent; color: var(--ink); }
.gs-results { overflow-y: auto; padding: 6px 0 10px; }
.gs-hint { margin: 14px 16px; color: var(--muted); }
.gs-group-label { font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 16px 4px; }
.gs-item { display: grid; gap: 2px; padding: 9px 16px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.gs-item:hover, .gs-item.on { background: var(--accent-soft); border-left-color: var(--accent); }
.gs-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-sub { font-size: 13px; color: var(--muted); }
@media (max-width: 720px) { .gs-backdrop { padding: 0; align-items: stretch; } .gs-panel { max-height: none; height: 100%; border-radius: 0; width: 100%; } }

/* ---- Primeros pasos ---- */
.ob-bar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: 14px 0 6px; }
.ob-bar span { display: block; height: 100%; background: var(--accent); }
.ob-list { list-style: none; margin: 0; padding: 0; }
.ob-step { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ob-step:last-child { border-bottom: 0; }
.ob-mark { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: var(--accent-ink); }
.ob-step.is-done .ob-mark { background: var(--accent); border-color: var(--accent); }
.ob-step.is-done .ob-body strong { color: var(--muted); }
.ob-body { flex: 1; min-width: 0; display: grid; gap: 2px; }

/* ---- Cierre del mes ---- */
.mc { display: grid; gap: 18px; }
.mc-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.mc-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mc-kpis-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mc-kpi { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.mc-kpi span { font-size: 12px; color: var(--muted); }
.mc-kpi strong { font: 700 20px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.mc-kpi small { font-size: 12px; color: var(--muted); }
.mc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .mc-kpis, .mc-kpis-sm, .mc-grid { grid-template-columns: 1fr 1fr; } .mc-grid { grid-template-columns: 1fr; } .mc-head { flex-direction: column; align-items: flex-start; } }
@media print { .mc-kpis { grid-template-columns: repeat(4, 1fr); } .mc-kpis-sm { grid-template-columns: repeat(3, 1fr); } .mc-grid { grid-template-columns: 1fr 1fr; } .mc-kpi { break-inside: avoid; } .print-only { display: flex !important; } }

/* ---- Diseño de la factura (configuración) ---- */
.dz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; margin-top: 14px; align-items: start; }
@media (max-width: 860px) { .dz-layout { grid-template-columns: 1fr; } }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.dz-styles { display: grid; gap: 8px; }
.dz-style { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.dz-style:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dz-style span { display: grid; gap: 2px; }
.dz-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.dz-swatch { position: relative; cursor: pointer; }
.dz-swatch input[type=radio] { position: absolute; opacity: 0; inset: 0; }
.dz-swatch > span:not(.sr-only) { display: block; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.dz-swatch input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.dz-swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-custom input[type=color] { width: 36px; height: 36px; border: 1px solid var(--line-2); border-radius: 50%; padding: 2px; background: var(--surface); cursor: pointer; }
.dz-custom:has(input[type=radio]:checked) input[type=color] { box-shadow: 0 0 0 2px var(--ink); }
.dz-preview { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.dz-sheet { background: #fff; aspect-ratio: 8.5 / 11; padding: 14px; font-size: 8px; color: #111; box-shadow: var(--shadow); display: grid; align-content: start; gap: 10px; }
.dz-top { display: flex; justify-content: space-between; gap: 8px; }
.dz-name { font-weight: 700; font-size: 10px; }
.dz-logo { display: block; max-width: 90px; margin-bottom: 4px; }
.dz-line { height: 4px; background: #DDD; border-radius: 2px; margin-top: 4px; }
.dz-line.short { width: 60%; }
.dz-box { border: 1px solid #111; padding: 5px; min-width: 42%; font-size: 6.5px; }
.dz-client { border: 1px solid #111; padding: 5px; }
.dz-th { height: 9px; border-bottom: 1.5px solid #111; }
.dz-tr { height: 10px; border-bottom: 1px solid #DDD; }
.dz-total { justify-self: end; display: flex; gap: 8px; align-items: baseline; border-top: 1.5px solid #111; padding-top: 3px; }
.dz-total b { font-size: 10px; }
.dz-sheet.inv-classic .dz-name, .dz-sheet.inv-classic .dz-total b { color: var(--brand); }
.dz-sheet.inv-modern .dz-top { background: var(--brand); color: var(--brand-ink); margin: -14px -14px 0; padding: 12px 14px; }
.dz-sheet.inv-modern .dz-box { border-color: currentColor; }
.dz-sheet.inv-modern .dz-line { background: currentColor; opacity: .35; }
.dz-sheet.inv-modern .dz-client { border: 0; background: var(--brand-soft); }
.dz-sheet.inv-modern .dz-th { background: var(--brand); border: 0; }
.dz-sheet.inv-modern .dz-total { background: var(--brand); color: var(--brand-ink); border: 0; padding: 4px 8px; border-radius: 3px; }
.dz-sheet.inv-minimal .dz-box, .dz-sheet.inv-minimal .dz-client { border: 0; padding: 0; }
.dz-sheet.inv-minimal .dz-name, .dz-sheet.inv-minimal .dz-total b { color: var(--brand); }
.dz-sheet.inv-minimal .dz-th { border-bottom: 1px solid var(--brand); }
.dz-sheet.inv-minimal .dz-total { border-top: 1px solid var(--brand); }

/* ---- Presupuesto ---- */
.bud td { vertical-align: middle; }
.bud-in { width: 140px; text-align: right; margin-left: auto; }
.bud-bar { height: 6px; width: 90px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.bud-bar span { display: block; height: 100%; }
.bud-bar.ok span { background: var(--success); }
.bud-bar.mid span { background: #C98A12; }
.bud-bar.low span { background: var(--danger); }

/* ---- Alertas agrupadas en el inicio ---- */
.alert-group { display: block; }
.alert-group summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.alert-group summary::-webkit-details-marker { display: none; }
.alert-group summary > span:nth-child(2) { flex: 1; }
.alert-group-toggle { font-weight: 600; text-decoration: underline; }
.alert-group[open] .alert-group-toggle { visibility: hidden; }
.alert-group ul { margin: 10px 0 2px; padding: 0 0 0 30px; display: grid; gap: 8px; }
.alert-group li { padding-left: 2px; }
.alert-group li.tone-warning { color: var(--warning); }
.settings-pane[hidden] { display: none !important; }
.settings-tabs { position: sticky; top: 0; z-index: 5; background: var(--ground); }
@media (max-width: 720px) { .settings-tabs { flex-wrap: nowrap; overflow-x: auto; } .settings-tabs a { white-space: nowrap; } }

/* Roles y permisos */
.perm-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.perm-head h2 { margin-bottom: 4px; }
.perm-head p { margin: 0; font-size: 14px; max-width: 70ch; }
.perm-card { display: grid; gap: 14px; margin-top: 18px; scroll-margin-top: 16px; }
.perm-group { border: 0; padding: 0; margin: 0; display: grid; gap: 2px; }
.perm-group legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.perm-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.perm-row:hover { background: var(--surface-2); }
.perm-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.perm-text { display: grid; gap: 1px; }
.perm-text small { color: var(--muted); font-size: 13px; }
.perm-tag { font-size: 12px; font-weight: 600; color: var(--info); white-space: nowrap; }
.perm-row.is-custom { background: var(--info-soft); }
.perm-row.is-locked { opacity: .55; cursor: not-allowed; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 16px; }
.role-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 4px; align-content: start; }
.role-card span { font-size: 13px; color: var(--ink-2); }
.role-card small { color: var(--muted); font-size: 12px; }
.perm-matrix th.center, .perm-matrix td.center { text-align: center; width: 104px; }
.perm-matrix .perm-matrix-group th { background: var(--surface-2); font-size: 13px; color: var(--muted); text-align: left; }
.perm-yes { color: var(--success); font-weight: 700; }
.perm-no { color: var(--line-2); }
@media (max-width: 720px) { .perm-row { grid-template-columns: auto 1fr; } .perm-tag { grid-column: 2; } }
@media (min-width: 960px) { .perm-group { grid-template-columns: 1fr 1fr; column-gap: 12px; } }

/* ---------- Resumen (inicio) ---------- */
/* Tarjetas de indicadores (las usa la pantalla del chatbot) */
.db-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.db-card { display: grid; gap: 4px; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; color: var(--ink); text-decoration: none; }
a.db-card:hover { border-color: var(--line-2); color: var(--ink); }
.db-card-label { color: var(--ink-2); font-size: 14px; }
.db-card-value { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.db-card-sub { color: var(--muted); font-size: 13px; }
@media (max-width: 1100px) { .db-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .db-cards { grid-template-columns: 1fr 1fr; gap: 8px; } .db-card { padding: 12px; } .db-card-value { font-size: 19px; } }
/* Inicio (computadora y tableta) */
.db-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.db-dot.tone-danger { background: #B3392B; }
.db-dot.tone-warning { background: #C27A12; }
.db-dot.tone-info { background: var(--muted); }
.db-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dk-head { align-items: flex-end; margin-bottom: 20px; }
.dk-head h1 { font-size: 30px; letter-spacing: -.015em; margin: 2px 0 0; }
.dk-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dk-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dk-actions .btn { gap: 8px; }
.dk-row { display: grid; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.dk-row-1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.dk-row-2 { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.dk-row-2.is-single { grid-template-columns: minmax(0, 1fr); }
.dk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; min-width: 0; }
.dk-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.dk-card-head h2 { margin: 0; font-size: 17px; }
.dk-card-head h2 a { color: inherit; text-decoration: none; }
.dk-card-head > span, .dk-card-head > a { font-size: 13px; color: var(--muted); white-space: nowrap; }
.dk-card-head a { font-weight: 600; color: var(--accent); text-decoration: none; }
.dk-empty { margin: 0; color: var(--muted); }
.dk-ob { margin-bottom: 16px; }
/* Para atender hoy */
.dk-today { padding-bottom: 6px; }
.dk-list { list-style: none; margin: 0 -20px; padding: 0; }
.dk-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto minmax(140px, auto); gap: 14px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.dk-item:first-child { border-top: 0; }
.dk-item-text { display: grid; gap: 1px; min-width: 0; }
.dk-item-text strong { font-size: 15px; line-height: 1.3; }
.dk-item-text strong.dk-alert { white-space: normal; font-weight: 600; }
.dk-item-text span { font-size: 13px; color: var(--muted); }
.dk-item-amount { font-size: 15px; text-align: right; }
.dk-item .btn { width: 100%; justify-content: center; }
/* El mes */
.dk-month { display: flex; flex-direction: column; container-type: inline-size; }
.dk-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 4px 0 14px; }
.dk-fig { display: grid; gap: 2px; align-content: start; padding: 2px 16px; border-left: 1px solid var(--line); color: var(--ink); text-decoration: none; min-width: 0; }
.dk-fig:first-child { padding-left: 0; border-left: 0; }
a.dk-fig:hover .dk-fig-label { color: var(--accent); }
.dk-fig-label { font-size: 13px; color: var(--muted); }
.dk-fig-value { font-size: clamp(16px, 5cqi, 27px); font-weight: 600; letter-spacing: -.03em; }
.dk-fig-value.is-good { color: var(--accent); }
.dk-fig-value.is-bad { color: #B3392B; }
.dk-fig-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.dk-compare { margin: auto 0 0; padding: 11px 14px; background: #F2F1EE; border-radius: 12px; font-size: 14px; color: var(--ink-2); }
.dk-compare strong { color: var(--ink); }
/* Ventas por semana */
.dk-weeks { display: flex; flex-direction: column; }
.dk-bars { flex: 1; display: flex; align-items: stretch; gap: 14px; min-height: 240px; padding-top: 8px; border-bottom: 1px solid var(--line-2); }
.dk-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; padding-bottom: 24px; }
.dk-bar-fill { width: 100%; max-width: 56px; background: #9FCABE; border-radius: 6px 6px 0 0; min-height: 3px; }
.dk-bar.is-best .dk-bar-fill { background: var(--accent); }
.dk-bar-value { font-size: 12px; color: var(--muted); margin-bottom: 6px; white-space: nowrap; }
.dk-bar.is-best .dk-bar-value { color: var(--ink); font-weight: 700; font-size: 13px; }
.dk-bar-label { position: absolute; bottom: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; }
/* Barras de avance (más vendido y comprobantes) */
.dk-meter { margin-bottom: 14px; }
.dk-meter:last-of-type { margin-bottom: 0; }
.dk-meter-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.dk-meter-row > span:last-child { white-space: nowrap; }
.dk-meter-row .num { font-size: 14px; }
.dk-seq .dk-meter-row > span:last-child { color: var(--muted); font-size: 13px; }
.dk-meter-bar { height: 5px; border-radius: 999px; background: #EDECE8; overflow: hidden; }
.dk-meter-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.dk-meter.is-low .dk-meter-bar span { background: #C27A12; }
.dk-meter.is-low strong { color: var(--warning); }
.dk-foot { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
/* Últimas facturas */
.dk-recent { padding-bottom: 8px; }
.dk-table { width: calc(100% + 40px); margin: 0 -20px; border-collapse: collapse; font-size: 14px; }
.dk-table td { padding: 11px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.dk-table tr:first-child td { border-top: 0; }
.dk-table td:first-child { padding-left: 20px; }
.dk-table td:last-child { padding-right: 20px; text-align: right; }
.dk-t-name { max-width: 0; width: 40%; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.dk-t-name a { color: var(--ink); text-decoration: none; }
.dk-t-name a:hover { color: var(--accent); }
.dk-t-ncf, .dk-t-date { color: var(--muted); }
.dk-t-total { text-align: right; }
@media (max-width: 1240px) {
  .dk-item { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .dk-item .btn { grid-column: 2 / -1; width: auto; justify-self: start; }
  .dk-t-ncf { display: none; }
}
@media (max-width: 1100px) {
  .dk-row-1, .dk-row-2 { grid-template-columns: minmax(0, 1fr); }
  .dk-item { grid-template-columns: 10px minmax(0, 1fr) auto minmax(140px, auto); }
  .dk-item .btn { grid-column: auto; width: 100%; justify-self: stretch; }
  .dk-t-ncf { display: table-cell; }
}
@media (max-width: 640px) {
  .dk-head h1 { font-size: 24px; }
  .dk-item { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .dk-item .btn { grid-column: 2 / -1; width: auto; justify-self: start; }
  .dk-figs { grid-template-columns: 1fr; gap: 10px; }
  .dk-fig { padding: 0; border-left: 0; }
  .dk-bars { gap: 6px; } .dk-bar-value { font-size: 10px; } .dk-bar-label { font-size: 10px; }
  .dk-t-ncf, .dk-t-date { display: none; }
}
.pos-totals .num, .pos-pay .num, .pos-mobilebar .num { font-family: var(--font); }
.pos-search { min-width: 0; }
@media (max-width: 899px) { .pos-search-kbd { display: none; } .pos-top > * { min-width: 0; max-width: 100%; } }
.pos-catalog { grid-auto-rows: max-content; }

/* ---------- Empresa · Datos ---------- */
.co-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.co-layout[hidden] { display: none; }
.co-form { display: grid; gap: 16px; min-width: 0; }
.co-card { display: grid; gap: 14px; padding: 22px 24px; }
.co-card h2 { margin: 0; }
.co-lead { margin: -10px 0 0; color: var(--muted); font-size: 14px; }
.co-card .field { display: grid; gap: 6px; margin: 0; }
.co-card .field > label { font-weight: 600; font-size: 14px; }
.co-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.co-inline { display: flex; gap: 10px; }
.co-inline .input { flex: 1; min-width: 0; }
.co-inline .btn { flex: none; }
.co-hint { color: var(--muted); font-size: 13px; }
.co-status { font-size: 13px; font-weight: 500; color: var(--muted); min-height: 1em; }
.co-status:empty { display: none; }
.co-status.is-ok { color: var(--success); }
.co-status.is-warn { color: var(--warning); }
.co-status.is-bad { color: var(--danger); }
.co-link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.co-logo-row { display: flex; gap: 18px; align-items: center; }
.co-logo-box { width: 96px; height: 96px; flex: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.co-logo-box img { max-width: 84px; max-height: 84px; object-fit: contain; }
.co-initial { font-size: 40px; font-weight: 700; color: var(--accent-dark); }
.co-logo-text { display: grid; gap: 4px; min-width: 0; }
.co-logo-actions { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.co-logo-actions label.btn { cursor: pointer; }
.co-logo-actions input[type=file]:focus-visible + .co-remove, .co-logo-actions label.btn:focus-within { outline: 3px solid var(--accent); }
.co-remove { border: 0; background: none; color: var(--danger); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 4px; }
.co-remove[hidden] { display: none; }
.co-savebar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 20px; background: var(--nav); color: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.co-savebar[hidden] { display: none; }
.co-savebar span { flex: 1; min-width: 0; }
.co-discard { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.co-discard:hover { background: rgba(255,255,255,.08); color: #fff; }
.co-moved { margin: 0; color: var(--muted); font-size: 14px; }
.co-aside { position: sticky; top: 16px; display: grid; gap: 10px; }
.co-aside-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.co-preview { background: #fff; color: #1B1D1F; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: 0 4px 16px rgba(27,29,31,.06); }
.co-pv-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid #E2E0DA; }
.co-pv-logo { width: 46px; height: 46px; border-radius: 8px; background: #F6F5F2; display: grid; place-items: center; overflow: hidden; }
.co-pv-logo img { max-width: 44px; max-height: 44px; object-fit: contain; }
.co-pv-logo span { font-weight: 700; font-size: 20px; color: var(--accent-dark); }
.co-pv-company { display: grid; gap: 1px; font-size: 11.5px; color: #3F4448; min-width: 0; }
.co-pv-company strong { font-size: 16px; color: #1B1D1F; }
.co-pv-company span { overflow-wrap: anywhere; }
.co-pv-company .is-placeholder { color: #9A9FA5; }
.co-pv-doc { display: grid; gap: 1px; text-align: right; font-size: 11.5px; color: #3F4448; align-content: start; }
.co-pv-doc strong { font-size: 13px; color: #1B1D1F; }
.co-pv-lines { display: grid; gap: 7px; padding: 16px 0; border-bottom: 1px solid #E2E0DA; }
.co-pv-lines i { display: block; height: 7px; border-radius: 4px; background: #EFEDE8; }
.co-pv-footer { margin: 12px 0 0; text-align: center; font-style: italic; font-size: 12px; color: #5B6066; }
.co-pv-footer[hidden] { display: none; }
@media (max-width: 1100px) { .co-layout { grid-template-columns: 1fr; } .co-aside { position: static; } }
@media (max-width: 640px) {
  .co-two { grid-template-columns: 1fr; }
  .co-inline { flex-direction: column; }
  .co-card { padding: 18px 16px; }
  .co-savebar { flex-wrap: wrap; bottom: 76px; }
  .co-savebar span { flex-basis: 100%; }
  .co-savebar .btn { flex: 1; }
  .co-pv-head { grid-template-columns: auto minmax(0, 1fr); }
  .co-pv-doc { grid-column: 1 / -1; text-align: left; }
}
.co-two { align-items: start; }
.co-card .field { align-content: start; }
.co-card .field .select, .co-card .field .input { min-height: 48px; height: 48px; }
@media (min-width: 1101px) { .co-layout { grid-template-columns: minmax(0, 1fr) minmax(360px, 34%); } }
.co-pv-doc { white-space: nowrap; }
@media (min-width: 1101px) { .co-aside { top: 132px; } }

/* ---------- Chatbot y prospectos ---------- */
.cb-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cb-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 38%); gap: 20px; align-items: start; }
.cb-form { display: grid; gap: 16px; min-width: 0; }
.cb-aside { position: sticky; top: 76px; }
.cb-color { width: 56px; height: 48px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); flex: none; }
.cb-cats { border: 0; padding: 0; margin: 0; }
.cb-cats legend { font-weight: 600; font-size: 14px; padding: 0; }
.cb-cat-list { display: flex; flex-wrap: wrap; gap: 0 18px; }
.cb-details { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: grid; gap: 12px; }
.cb-details[open] { padding-bottom: 14px; }
.cb-details summary { cursor: pointer; font-weight: 600; }
.cb-template { margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 13px; white-space: pre-wrap; }
.cb-embed { display: flex; gap: 10px; align-items: stretch; }
.cb-embed code { flex: 1; min-width: 0; padding: 12px; background: var(--nav); color: #DDE7E3; border-radius: 8px; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.cb-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; }
.cb-test { display: grid; gap: 10px; grid-template-rows: auto auto minmax(0, 1fr) auto; height: min(640px, calc(100vh - 110px)); }
.cb-test-head { display: flex; justify-content: space-between; align-items: center; }
.cb-test-head h2 { margin: 0; }
.cb-test-log { overflow-y: auto; background: var(--surface-2); border-radius: var(--radius); padding: 12px; margin: 0; }
.cb-test-form { display: flex; gap: 8px; }
.cb-test-form .input { flex: 1; min-width: 0; }
.chat-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: grid; gap: 2px; max-width: 85%; }
.chat-msg.is-user { align-self: flex-end; justify-items: end; }
.chat-msg.is-assistant { align-self: flex-start; }
.chat-msg.is-system { align-self: center; max-width: 100%; }
.chat-bubble { padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.is-user .chat-bubble { background: var(--bot, var(--accent)); color: #fff; border-color: transparent; border-radius: 14px 14px 4px 14px; }
.chat-msg.is-system .chat-bubble { background: var(--success-soft); color: #0A4A40; border: 0; border-radius: 8px; font-size: 13px; }
.chat-bubble.is-typing { color: var(--muted); font-style: italic; }
.chat-bubble.is-error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chat-time { font-size: 11.5px; color: var(--muted); }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.lead-grid h2 { margin: 0; }
.lead-interest { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
@media (max-width: 1100px) { .cb-layout, .lead-grid { grid-template-columns: 1fr; } .cb-aside { position: static; } }
@media (max-width: 640px) { .cb-stats { grid-template-columns: 1fr; } .cb-embed { flex-direction: column; } .cb-test { height: 520px; } }
.text-warning { color: var(--warning); } .text-danger { color: var(--danger); }

/* Descuento general: % o monto */
.disc-field { display: flex; gap: 6px; align-items: stretch; }
.disc-field .input { flex: 1; min-width: 0; }
.disc-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; flex: none; }
.disc-toggle label { position: relative; display: grid; }
.disc-toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.disc-toggle span { display: grid; place-items: center; min-width: 44px; padding: 0 10px; font-weight: 600; font-size: 14px; color: var(--ink-2); background: var(--surface); }
.disc-toggle label + label span { border-left: 1px solid var(--line-2); }
.disc-toggle input:checked + span { background: var(--accent); color: #fff; }
.disc-toggle input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: -3px; }

/* Factura: líneas con descuento por línea */
.line-controls { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(130px, 1fr) minmax(190px, 1.3fr) minmax(96px, .7fr) minmax(150px, 1.1fr); gap: 12px 14px; align-items: start; }
.line-controls > * { min-width: 0; }
.line-controls .f-qty, .line-controls .f-price { flex: none; }
.f-disc, .f-tax, .f-amount { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
.disc-line { min-width: 0; }
.disc-line .disc-toggle { flex: none; }
.disc-line { display: flex; gap: 6px; height: 48px; }
.disc-line .disc-toggle { border-radius: 10px; }
.disc-toggle button { min-width: 44px; padding: 0 10px; border: 0; background: var(--surface); color: var(--ink-2); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.disc-toggle button + button { border-left: 1px solid var(--line-2); }
.disc-toggle button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.disc-toggle button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.disc-input { flex: 1; min-width: 0; height: 48px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 10px; font-family: var(--mono); font-size: 16px; text-align: right; }
.disc-note { margin-top: 4px; font-size: 12.5px; font-weight: 500; }
.disc-note.is-ok { color: var(--success); }
.disc-note.is-over { color: var(--danger); }
.line.over-limit .disc-input { border-color: var(--danger); background: var(--danger-soft); }
.f-tax .tax-select { height: 48px; width: 100%; border-radius: 10px; }
.amount-box { display: flex; align-items: center; justify-content: flex-end; height: 48px; padding: 0 12px; border-radius: 10px; background: #F1EFEA; font-family: var(--mono); font-size: 17px; }
.disc-off { margin-top: 4px; text-align: right; font-family: var(--mono); font-size: 12.5px; color: #A1460A; }
.totals .t-disc span { color: #A1460A; font-weight: 600; }
.grand-total { display: grid; grid-template-columns: 1fr; gap: 2px; align-items: start; }
.grand-total #t-savings { font-size: 13px; color: rgba(255,255,255,.82); font-weight: 400; letter-spacing: 0; text-transform: none; }
@media (max-width: 1280px) { .line-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .line-controls { grid-template-columns: 1fr 1fr; } .line-controls .f-disc { grid-column: 1 / -1; } }
.amount-box, .disc-off { white-space: nowrap; }
@media (max-width: 640px) { .amount-box { font-size: 15px; padding: 0 8px; } }

/* Facturas recibidas de proveedores: configuración, estado y registro */
.rx-form { display: grid; gap: 16px; max-width: 760px; }
.rx-card { display: grid; gap: 12px; padding: 22px 24px; }
.rx-card h2 { margin: 0; }
.rx-opt { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.rx-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.rx-opt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.rx-opt strong { display: block; font-size: 15px; }
.rx-opt small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; line-height: 1.45; }
.rx-sub { display: grid; gap: 14px; margin: -2px 0 2px 34px; padding: 4px 0 4px 16px; border-left: 2px solid var(--line); }
.rx-sub[hidden] { display: none; }
.rx-sub .field { display: grid; gap: 2px; margin: 0; }
.rx-sub .field > label:first-child { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.rx-sub .check { min-height: 36px; }
.rx-actions { display: flex; gap: 8px; }
.rx-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.rx-bar-text { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; min-width: 0; flex: 1 1 320px; }
.rx-bar-text svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.rx-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rx-status { display: flex; gap: 6px; align-items: flex-start; font-size: 13.5px; margin-top: 6px; color: var(--muted); }
.rx-status svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.rx-ok { color: var(--success); } .rx-ok span { color: var(--ink); }
.rx-ask { color: var(--info); } .rx-err { color: var(--danger); }
.rx-route { flex: 1 1 100%; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 8px; border-top: 1px dashed var(--line); }
.rx-route-label { font-size: 13.5px; font-weight: 600; margin-right: 4px; }
.rx-stock { display: grid; gap: 12px; border-left: 4px solid var(--warning); }
.rx-stock-head { display: flex; gap: 12px; align-items: flex-start; }
.rx-stock-head svg { width: 24px; height: 24px; color: var(--warning); flex-shrink: 0; margin-top: 2px; }
.rx-stock-head h2 { margin: 0 0 2px; }
.rx-stock-head p { margin: 0; }
.rx-stock-form { display: grid; gap: 10px; justify-items: start; }
.rx-stock-form .field { width: 100%; max-width: 520px; display: grid; gap: 4px; }

/* Pendientes de precio */
.pr-margin { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pr-margin label { font-weight: 600; font-size: 14px; }
.pr-margin .input { width: 80px; text-align: right; }
.pr-margin small { flex-basis: 100%; }
.pr-list { list-style: none; margin: 0; padding: 0; }
.pr-row { display: grid; grid-template-columns: minmax(0, 1fr) 210px 300px; gap: 18px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--line); }
.pr-row:first-child { border-top: 0; }
.pr-name { font-weight: 600; color: var(--ink); }
.pr-note { font-size: 13px; color: var(--warning); margin-top: 4px; }
.pr-nums { display: flex; gap: 18px; margin: 0; }
.pr-nums div { display: grid; gap: 2px; text-align: right; }
.pr-nums dt { font-size: 12px; color: var(--muted); }
.pr-nums dd { margin: 0; font-weight: 600; }
.pr-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.pr-field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.pr-field .input { max-width: 200px; text-align: right; font-size: 16px; }
.pr-calc { font-size: 13px; color: var(--muted); min-height: 18px; }
.pr-calc.pr-loss { color: var(--danger); font-weight: 600; }
.pr-btns { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 860px) { .pr-row { grid-template-columns: minmax(0, 1fr); gap: 10px; } .pr-nums div { text-align: left; } }

/* ---------- Nueva factura (computadora y tableta, nov 2026) ---------- */
.inv-head, .kbd-desk, .ncf-cards, .mo-desk, .ic-desk, .line-head, .inv-free-btn { display: none; }
.ic-phone { display: contents; }
.ncf-auto { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 13.5px; color: var(--success); }
.ncf-auto svg { width: 15px; height: 15px; flex: none; }
.ncf-next { margin: 0; font-size: 13.5px; color: var(--muted); }
.ncf-next b { color: var(--ink); font-weight: 700; }
.inv-actions { display: grid; gap: 10px; }
.inv-secondary { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 10px; }
.btn-muted { color: var(--muted); }
.submit-amount:not(:empty) { margin-left: 4px; }
.cash-closed { display: grid; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--warning-soft); border: 1px solid #F0CF95; }
.cash-closed p { display: flex; gap: 8px; align-items: flex-start; margin: 0; color: #6B3A00; font-size: 14.5px; line-height: 1.45; }
.cash-closed p svg { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.cash-closed .btn { background: var(--surface); border-color: #E5B66A; color: #A1460A; }
@media (min-width: 768px) {
  .inv-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
  .inv-head h1 { margin: 0; font-size: 28px; letter-spacing: -.015em; }
  .inv-crumb { color: var(--muted); font-size: 15px; }
  .kbd-desk { display: inline-block; font-family: var(--mono); font-size: 11px; line-height: 1; padding: 4px 6px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--muted); background: var(--surface); opacity: 1; margin-left: 6px; }
  .ic-desk { display: contents; } .ic-phone { display: none; }
  /* Cliente y comprobante */
  .inv-who { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: stretch; }
  .inv-who.no-ncf { grid-template-columns: minmax(0, 1fr); }
  .inv-who > :not(.ncf-cards) { grid-column: 1; }
  .ncf-cards { display: grid; grid-column: 2; grid-row: 1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-self: start; }
  .ncf-field { display: none; }
  .selected-customer { min-height: 86px; padding: 12px 16px; border-color: var(--line-2); }
  .selected-customer .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #customer-change { border: 0; background: none; color: var(--accent); padding: 0 4px; min-height: 36px; white-space: nowrap; }
  #customer-change:hover { color: var(--accent-dark); }
  .ncf-card { display: grid; gap: 2px; align-content: center; width: 100%; min-height: 86px; padding: 10px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
  .ncf-card strong { font-size: 16px; }
  .ncf-card span { font-size: 13px; color: var(--muted); line-height: 1.35; }
  .ncf-card:hover:not(:disabled) { border-color: var(--accent); }
  .ncf-card.is-on { border: 2px solid var(--accent); background: var(--accent-soft); padding: 9px 15px; }
  .ncf-card:disabled { opacity: .55; cursor: not-allowed; }
  .ncf-other { position: relative; }
  .ncf-menu { position: absolute; z-index: 30; right: 0; top: calc(100% + 6px); width: 290px; padding: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); display: grid; }
  .ncf-menu button { display: grid; gap: 1px; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px; background: none; font: inherit; color: var(--ink); cursor: pointer; }
  .ncf-menu button:hover:not(:disabled) { background: var(--accent-soft); }
  .ncf-menu button span { font-size: 12.5px; color: var(--muted); }
  .ncf-menu button:disabled { opacity: .5; cursor: not-allowed; }
  /* Productos */
  .inv-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: stretch; }
  .inv-free-btn { display: inline-flex; min-height: 56px; padding: 0 20px; font-size: 16px; }
  #add-free-line { display: none; }
  .inv-search-row .search-input svg { color: var(--ink-2); }
  #frequent .chip { border-style: dashed; border-color: #9FCABE; color: var(--accent); background: transparent; }
  #frequent .chip:hover { background: var(--accent-soft); }
  #frequent .freq-label { display: none; }
  .invoice-main { --cols: minmax(0, 1fr) 150px 170px 150px 160px 32px; }
  .line-head { display: grid; grid-template-columns: var(--cols); column-gap: 18px; margin: 18px 0 0; padding: 0 0 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  .line-head[hidden] { display: none; }
  .line-head span:nth-child(n+3) { text-align: right; }
  .line-head span:nth-child(2) { text-align: center; }
  #lines.line-items { gap: 0; margin-top: 0 !important; }
  .line { grid-template-columns: var(--cols); column-gap: 18px; row-gap: 6px; align-items: center; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 0; background: none; }
  .line-top, .line-controls { display: contents; }
  .line-top .info { grid-column: 1; grid-row: 1; }
  .line-top .name { font-size: 17px; }
  .line-top .meta { font-family: var(--font); font-size: 13px; }
  .line-remove { grid-column: 6; grid-row: 1; margin: 0; width: 32px; height: 32px; color: var(--muted); }
  .line-remove:hover { color: var(--danger); background: var(--danger-soft); }
  .line-remove svg { width: 18px; height: 18px; }
  .line .mini-label { display: none; }
  .line .f-qty { grid-column: 2; grid-row: 1; }
  .line .f-price { grid-column: 3; grid-row: 1; }
  .line .f-disc { grid-column: 4; grid-row: 1; }
  .line .f-amount { grid-column: 5; grid-row: 1; }
  .line .f-tax { display: none; }
  .line.is-free .f-tax { display: flex; grid-column: 1; grid-row: 2; align-items: center; gap: 8px; }
  .line.is-free .f-tax .tax-select { height: 36px; width: auto; }
  .line.is-free .f-tax .mini-label { display: inline; margin: 0; }
  .line > .error, .line > .field, .line > .m-line-more { grid-column: 1 / -1; }
  .stepper { height: 46px; }
  .stepper button { width: 42px; height: 46px; background: none; font-size: 20px; }
  .stepper input { height: 46px; font-size: 17px; }
  .price-input { height: 46px; font-size: 16px; }
  .disc-line { height: 46px; gap: 4px; }
  .disc-line .disc-toggle { border-style: dashed; }
  .disc-toggle button { min-width: 30px; padding: 0 6px; font-size: 12px; }
  .disc-toggle button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-dark); }
  .invoice-side .t-disc:not(.has-disc) span { color: inherit; font-weight: 400; }
  .invoice-side .t-disc:not(.has-disc) span:first-child { color: var(--muted); }
  #customer-id { font-family: var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .disc-input { height: 46px; border-style: dashed; }
  .amount-box { height: 46px; font-size: 17px; font-weight: 700; background: #F1F0ED; }
  /* Más opciones en una barra */
  .card:has(> details.more) { padding: 12px 22px; }
  details.more > summary .mo-phone { display: none; }
  details.more > summary::before { display: none; }
  details.more > summary .mo-desk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 30px; width: 100%; color: var(--ink); font-weight: 400; font-size: 15px; }
  .mo-desk b { font-weight: 700; }
  .mo-title { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .mo-note { margin-left: auto; color: var(--accent); font-weight: 600; }
  /* Cobro */
  .invoice-side .segmented { border: 0; padding: 4px; border-radius: 12px; background: #EFEEEA; gap: 4px; }
  .invoice-side .segmented span { min-height: 44px; border-radius: 9px; color: var(--muted); }
  .invoice-side .segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
  .invoice-side .totals .kv span:first-child { color: var(--muted); }
  .invoice-side .totals .num { font-size: 15px; }
  .invoice-side #t-net-row { display: none; }
  .invoice-side .grand-total strong { font-size: 36px; }
}
@media (min-width: 1200px) { .invoice-side { flex-basis: 380px; } }
.invoice-main { container: invmain / inline-size; }
@media (min-width: 768px) {
  .has-mobile-total .page { max-width: 1680px; }
  @container invmain (min-width: 881px) and (max-width: 1080px) { .line, .line-head { --cols: minmax(0, 1fr) 128px 132px 128px 136px 28px; column-gap: 14px; } }
}
@media (min-width: 768px) {
@container invmain (max-width: 880px) {
  .inv-who { grid-template-columns: minmax(0, 1fr); }
  .inv-who > .ncf-cards { grid-column: 1; grid-row: auto; }
  .line-head { display: none !important; }
  .line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 32px; }
  .line-top .info { grid-column: 1 / 5; }
  .line-remove { grid-column: 5; }
  .line .f-qty, .line .f-price, .line .f-disc, .line .f-amount { grid-row: 2; }
  .line .f-qty { grid-column: 1; } .line .f-price { grid-column: 2; } .line .f-disc { grid-column: 3; } .line .f-amount { grid-column: 4; }
  .line.is-free .f-tax { grid-row: 3; }
}
}


/* ---------- Punto de venta (computadora, nov 2026) ---------- */
.pos-info, .pos-cash-banner, .pos-ncf-seg, .pos-pm, .pos-recv, .pos-cust-ic, .pos-cust-kbd, .pos-held-link, .pos-cat-more { display: none; }
.pos-tag.is-plan { background: #F1EAFB; color: #5B2E91; }
.pos-tag.is-check { background: var(--danger-soft); color: var(--danger); }
.pos-tile-price.is-check { color: #B3392B; }
.pos-tile-price small { font-size: 13px; font-weight: 400; color: var(--muted); }
.pos-link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer; }
@media (min-width: 900px) {
  .pos { grid-template-columns: minmax(0, 1fr) 440px; gap: 20px; }
  .pos-status, .pos-out-toggle, .pos-grid-foot, .pos-help, .pos-ncf-hint, .pos-picker-select { display: none !important; }
  .pos-search { min-height: 62px; }
  .pos-cats { align-items: center; overflow: visible; flex-wrap: wrap; gap: 8px; }
  .pos-cats .chip { min-height: 44px; padding: 0 20px; font-weight: 600; font-size: 15.5px; }
  .pos-cats .chip.active { background: var(--ink); border-color: var(--ink); }
  .pos-cat-more { display: block; position: relative; }
  .pos-cat-more-btn { min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font: inherit; font-weight: 600; font-size: 15.5px; color: var(--ink); cursor: pointer; }
  .pos-cat-more-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }
  .pos-cat-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 220px; padding: 8px; display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); }
  .pos-cat-menu[hidden] { display: none; }
  .pos-cat-menu .chip { justify-content: flex-start; }
  .pos-info { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); margin-top: -2px; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
  .pos-tile { min-height: 160px; padding: 16px 18px; border-radius: 14px; }
  .pos-tile.in-cart { padding: 15px 17px; }
  .pos-tile-name { font-size: 17px; }
  .pos-tile-price { font-family: var(--mono); font-size: 19px; letter-spacing: -.02em; }
  .pos-tile-incart { top: -11px; right: 12px; font-size: 13px; padding: 3px 10px; font-family: var(--mono); }
  .pos-tag { font-size: 13px; padding: 3px 9px; border-radius: 7px; }
  /* Carrito */
  .pos-cart { border-radius: 16px; border-color: var(--line); }
  .pos-cart-head { gap: 12px; padding: 16px 18px 12px; border-bottom: 0; }
  .pos-cash-banner { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 12px; background: var(--warning-soft); border: 1px solid #F0CF95; color: #8A4B00; }
  .pos-cash-banner[hidden] { display: none; }
  .pos-cash-banner svg { width: 20px; height: 20px; flex: none; }
  .pos-cash-banner strong { flex: 1; font-size: 15.5px; }
  .pos-cash-banner .btn { background: #C2700B; border-color: #C2700B; color: #fff; min-height: 40px; }
  .pos-cart-title h2 { font-size: 24px; letter-spacing: -.01em; }
  .pos-held-link { display: inline; border: 0; background: var(--warning-soft); color: var(--warning); font: inherit; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; cursor: pointer; }
  .pos-held-link[hidden] { display: none; }
  .pos-pickers { grid-template-columns: 1fr; }
  #pos-customer-btn { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 14px; border-radius: 12px; }
  #pos-customer-btn small { display: none; }
  #pos-customer-btn strong { flex: 1; font-size: 16px; }
  .pos-cust-ic { display: inline-flex; color: var(--accent); }
  .pos-cust-ic svg { width: 22px; height: 22px; }
  .pos-cust-kbd { display: inline-block; font-family: var(--mono); font-size: 11px; padding: 3px 6px; border: 1px solid var(--line-2); border-radius: 5px; color: var(--muted); opacity: 1; }
  .pos-ncf-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: #EFEEEA; border-radius: 12px; }
  .pos-ncf-seg button { min-height: 42px; border: 0; border-radius: 9px; background: none; font: inherit; font-weight: 600; font-size: 14.5px; color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; width: 100%; }
  .pos-ncf-seg button small { font-size: 13px; font-weight: 600; }
  .pos-ncf-seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
  .pos-ncf-other { position: relative; }
  .pos-ncf-menu { position: absolute; z-index: 30; right: 0; top: calc(100% + 6px); width: 260px; padding: 6px; display: grid; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); }
  .pos-ncf-menu[hidden] { display: none; }
  .pos-ncf-menu button { text-align: left; color: var(--ink); font-weight: 500; min-height: 38px; }
  .pos-ncf-menu button:hover { background: var(--accent-soft); }
  .pos-lines { padding: 0 18px; border-top: 1px solid var(--line); }
  .pos-line { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 6px 12px; padding: 16px 0; }
  .pos-line-main { display: contents; }
  .pos-line-main > strong { grid-column: 1; grid-row: 1; font-size: 17px; }
  .pos-line-meta { grid-column: 1; grid-row: 2; align-self: center; font-size: 13.5px; }
  .pos-line-main .stock-low, .pos-line-main .unit-select, .pos-line-main .promo-tag { grid-column: 1 / -1; }
  .pos-line-total { grid-column: 2; grid-row: 1; font-family: var(--mono); font-weight: 500; font-size: 17px; }
  .pos-qty { grid-column: 2; grid-row: 2; justify-self: end; border-radius: 10px; }
  .pos-qty button { width: 38px; height: 42px; font-size: 20px; }
  .pos-qty input { height: 42px; width: 44px; font-size: 17px; }
  .pos-line-links { display: none; }
  .pos-disc-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; }
  .pos-totals { background: var(--surface); padding: 14px 18px 16px; gap: 2px; }
  .pos-totals .kv { color: var(--muted); }
  .pos-totals .kv .num { font-family: var(--mono); }
  .pos-grand { padding: 6px 0 12px; font-size: 18px; }
  .pos-grand strong { font-family: var(--mono); font-size: 40px; letter-spacing: -.03em; }
  .pos-pm { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .pos-pm button { min-height: 50px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); font: inherit; font-weight: 600; font-size: 15px; color: var(--ink); cursor: pointer; }
  .pos-pm button.on { border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
  .pos-pm button:disabled { opacity: .45; cursor: not-allowed; }
  .pos-recv { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14.5px; color: var(--muted); margin: 6px 0 8px; }
  .pos-recv[hidden] { display: none; }
  .pos-recv label { display: flex; align-items: center; gap: 8px; }
  .pos-recv input { width: 120px; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 8px; font-size: 15px; font-weight: 600; color: var(--ink); text-align: right; }
  .pos-recv b { color: var(--ink); font-size: 15px; }
  .pos-recv b.is-bad { color: var(--danger); }
  .pos-pay { min-height: 64px; font-size: 20px; border-radius: 14px; margin-top: 4px; }
  .pos-pay #pos-pay-amount { font-family: var(--mono); }
  .pos-actions .btn { min-height: 52px; border-radius: 12px; }
  .pos-clear { color: var(--muted); }
}
@media (min-width: 900px) {
  .pos .pos-totals .num, .pos .pos-pay .num { font-family: var(--mono); }
  .pos-tile-foot { flex-wrap: wrap; row-gap: 6px; }
  .pos-tile-price { font-size: 18px; margin-left: auto; }
  .pos-ncf-seg { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, .75fr); }
  .pos-ncf-seg button { font-size: 14px; padding: 0 4px; }
}

/* ---------- Ficha de producto (nov 2026) ---------- */
.pf-head { align-items: flex-end; margin-bottom: 18px; }
.pf-back { display: inline-block; color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none; margin-bottom: 2px; }
.pf-back:hover { color: var(--accent); }
.pf-head h1 { margin: 0; font-size: 30px; letter-spacing: -.015em; }
.pf-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pf-actions .btn { min-height: 46px; padding: 0 20px; border-radius: 12px; }
.pf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.pf-main { display: grid; gap: 16px; min-width: 0; }
.pf-card { display: grid; gap: 16px; padding: 22px 24px; border-radius: 16px; }
.pf-card-head { display: flex; align-items: center; gap: 12px; }
.pf-card-head h2 { margin: 0; font-size: 20px; }
.pf-card-hint { margin-left: auto; color: var(--muted); font-size: 13.5px; text-align: right; }
.step-outline { background: none; color: var(--ink); border: 1.5px solid var(--ink-2); }
.pf-active { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.req { color: #B3392B; font-weight: 700; }
.pf-row { display: grid; gap: 16px 20px; }
.pf-row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pf-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pf-row-2 > [hidden], .pf-row-3 > [hidden] { display: none; }
.pf-row:empty { display: none; }
.pf-name { font-size: 17px; min-height: 52px; }
.pf-link { justify-self: start; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: none; }
.pf-link:hover { color: var(--accent-dark); }
.pf-link-lg { font-size: 15.5px; margin-top: 18px; }
.pf-icon-input { position: relative; display: block; }
.pf-icon-input > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-2); pointer-events: none; }
.pf-icon-input .input { padding-left: 40px; width: 100%; }
/* Tipo */
.pf-types, .pf-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pf-type, .pf-toggle { position: relative; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 18px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); cursor: pointer; }
.pf-type > input[type=radio], .pf-toggle > input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.pf-type-ic { display: inline-flex; color: var(--accent); }
.pf-type-ic svg { width: 24px; height: 24px; }
.pf-type-txt { display: grid; gap: 1px; flex: 1; min-width: 0; text-align: left; }
.pf-type-txt strong { font-size: 16px; }
.pf-type-txt small { font-size: 13.5px; color: var(--ink-2); }
.pf-radio { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; }
.pf-type:has(input:checked), .pf-toggle:has(input[type=checkbox]:checked) { border: 2px solid var(--accent); background: var(--accent-soft); padding: 9px 17px; }
.pf-type:has(input:checked) .pf-radio { border-color: var(--accent); box-shadow: inset 0 0 0 5px var(--surface), inset 0 0 0 12px var(--accent); }
.pf-type:has(input:focus-visible), .pf-toggle:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pf-switch { position: relative; width: 52px; height: 30px; border-radius: 999px; background: #D5D4D0; flex: none; transition: background .15s; }
.pf-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.pf-toggle:has(input[type=checkbox]:checked) .pf-switch { background: var(--accent); }
.pf-toggle:has(input[type=checkbox]:checked) .pf-switch::after { transform: translateX(22px); }
/* Precio en cadena */
.pf-chain { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) 22px minmax(0, 1fr) 22px minmax(0, 1fr); gap: 0 10px; align-items: start; }
.pf-arrow { align-self: start; margin-top: 40px; color: var(--muted); font-size: 20px; text-align: center; }
.pf-num { text-align: right; font-size: 20px; min-height: 54px; }
.pf-main-price { border: 2px solid var(--accent); background: var(--accent-soft); font-weight: 700; }
.pf-gross { border-style: dashed; background: #F4F3F0; }
.pf-suffix { position: relative; display: block; }
.pf-suffix .input { width: 100%; padding-right: 34px; }
.pf-suffix i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-style: normal; font-family: var(--mono); font-size: 18px; color: var(--ink-2); pointer-events: none; }
.pf-suffix-word .input { padding-right: 70px; text-align: left; }
.pf-suffix-word i { font-family: var(--font); font-size: 15px; }
.pf-margin-default { font-size: 14px; }
/* Avanzadas */
.pf-adv { padding: 14px 24px; }
.pf-adv-head { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; background: none; padding: 4px 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.pf-adv-head .step { width: 34px; height: 34px; font-size: 14px; }
.pf-adv-more { color: var(--accent); font-weight: 700; font-size: 15.5px; white-space: nowrap; }
.pf-adv-body { display: grid; gap: 22px; padding: 8px 0 8px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 18px; }
.pf-sub { margin: 0 0 4px; font-size: 16px; }
.pf-bottom { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
/* Al lado */
.pf-side { display: grid; gap: 16px; position: sticky; top: 16px; }
.pf-side-card { padding: 20px 22px; border-radius: 16px; display: grid; gap: 10px; }
.pf-side-title { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.pf-tile { display: grid; gap: 2px; padding: 16px 18px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); }
.pf-tile strong { font-size: 16.5px; line-height: 1.3; }
.pf-tile small { color: var(--muted); font-size: 13px; }
.pf-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; }
.pf-tile-foot b { font-size: 19px; }
.pf-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.pf-kv b { font-weight: 500; }
.pf-kv-strong span { font-weight: 700; }
.pf-kv-strong b, #g-margin { color: var(--accent); font-weight: 700; }
.pf-kv b.is-bad { color: var(--danger); }
.pf-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pf-check li { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.pf-check li::before { content: ''; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; box-sizing: border-box; }
.pf-check li.ok::before { border: 0; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 14px no-repeat; }
@media (max-width: 1180px) {
  .pf-layout { grid-template-columns: minmax(0, 1fr); }
  .pf-side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); order: -1; }
  .pf-side-card:nth-child(3) { display: none; }
}
@media (max-width: 900px) {
  .pf-chain { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 14px; }
  .pf-arrow { display: none; }
}
@media (max-width: 767.98px) {
  .pf-head h1 { font-size: 22px; }
  .pf-back { display: none; }
  .pf-card { padding: 16px; }
  .pf-row-2, .pf-row-3, .pf-types, .pf-toggles { grid-template-columns: minmax(0, 1fr); }
  .pf-card-hint { display: none; }
  .pf-side { display: none; }
  .pf-bottom .btn:not(.btn-danger) { display: none; }
  .pf-actions { display: flex; }
}
.pf-icon-input, .pf-suffix { font-size: 16px; font-weight: 400; }
.pf-icon-input .input, .pf-suffix .input { display: block; }
.pf-card .input, .pf-card .select { min-height: 48px; }
.pf-card .pf-num { min-height: 54px; }
.pf-card .field > span:first-child { font-size: 14.5px; font-weight: 600; }
.pf-card .field .hint { font-size: 13px; }
.pf-card .field { align-content: start; }

/* ---------- Carga rápida de productos ---------- */
.qk-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.qk-tabs button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.qk-tabs button svg { width: 18px; height: 18px; }
.qk-tabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.qk-badge { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--warning-soft); color: var(--warning); font-size: 12.5px; }
.qk-pane { display: grid; gap: 14px; }
.qk-scan { font-size: 20px; min-height: 56px; }
.qk-found { display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); border: 1px solid #9FCABE; }
.qk-found-t { margin: 0; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-dark); }
.qk-found span { color: var(--ink-2); font-size: 14px; }
.qk-form { display: grid; gap: 12px; padding: 16px; border: 2px solid var(--accent); border-radius: 14px; }
.qk-new-title { margin: 0; font-weight: 700; }
.qk-new-title span { font-weight: 400; color: var(--muted); }
.qk-price { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.qk-calc { margin: -4px 0 0; }
.qk-form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.qk-form-actions .btn { min-height: 48px; }
.qk-recent ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14.5px; }
.qk-recent small { color: var(--muted); }
.qk-recent .ok, .qk-st .ok { color: var(--success); font-weight: 700; }
.qk-defaults { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; }
.qk-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.qk-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 980px; }
.qk-table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); background: #F6F5F2; position: sticky; top: 0; }
.qk-table td { border-bottom: 1px solid var(--line); padding: 0; }
.qk-table td.qk-n { width: 34px; text-align: center; color: var(--muted); font-size: 12px; }
.qk-table td.qk-st { padding: 0 8px; font-size: 12.5px; color: var(--danger); max-width: 220px; }
.qk-in { width: 100%; min-width: 70px; height: 40px; border: 0; padding: 0 8px; background: transparent; font: inherit; color: var(--ink); }
.qk-in.num { text-align: right; }
.qk-in:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.qk-table td:nth-child(2) { min-width: 240px; }
.qk-gross { font-weight: 700; }
.qk-table tr.is-saved { background: #EEF7F3; }
.qk-table tr.is-saved .qk-in { color: var(--ink-2); }
.qk-table tr.is-err { background: var(--danger-soft); }
.qk-table-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qk-missing { list-style: none; margin: 0; padding: 0; display: grid; }
.qk-missing li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 260px); gap: 12px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.qk-missing li[hidden] { display: none; }
.qk-m-txt { display: grid; min-width: 0; }
.qk-m-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qk-m-txt small { color: var(--muted); }
.qk-missing li.is-saved { opacity: .6; }
.qk-missing li.is-saved .qk-m-in { border-color: var(--success); background: #EEF7F3; }
.qk-m-empty { color: var(--muted); }
@media (max-width: 767.98px) {
  .qk-defaults { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .qk-defaults .field:first-child { grid-column: 1 / -1; }
  .qk-missing li { grid-template-columns: minmax(0, 1fr); }
  .qk-price { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .qk-price .field:last-child { grid-column: 1 / -1; }
}

/* ==========================================================================
   Aspecto claro (nov. 2026): menú blanco, el verde solo para lo activo y los
   botones principales, bordes finos, más aire y cifras en la letra normal.
   Va al final para que mande sobre lo de arriba; para volver atrás basta quitar este bloque.
   ========================================================================== */
:root {
  --ground: #F7F7F4;
  --surface-2: #FAFAF8;
  --line: #E7E5E0;
  --line-2: #D5D2CB;
  --accent-soft: #E9F4F1;
  --success-soft: #E9F4F1;
  --shadow: 0 12px 32px rgba(27, 29, 31, .10);
  --side: #FFFFFF;
  --side-ink: #3C4146;
  --side-label: #6B7076;
  --side-hover: #F2F1EE;
}
h1 { font-weight: 600; letter-spacing: -.015em; }
.num { font-family: var(--font); }
.stat .value { font-family: var(--font); letter-spacing: -.02em; }

/* Menú lateral */
.sidebar { background: var(--side); color: var(--side-ink); border-right: 1px solid var(--line); }
.brand-name { color: var(--ink); }
.brand-sub { color: var(--muted); }
.nav-search input { border-color: var(--line); background: var(--ground); color: var(--ink); }
.nav-search input::placeholder { color: var(--muted); }
.nav-label { color: var(--side-label); font-weight: 600; }
.nav a { color: var(--side-ink); min-height: 40px; font-weight: 500; }
.nav a:hover { background: var(--side-hover); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active svg { color: var(--accent); }
.nav .soon { color: var(--side-label); }
.sidebar-foot { border-top-color: var(--line); color: var(--muted); }
.sidebar-foot strong { color: var(--ink); }
@media (max-width: 1023px) { .sidebar { box-shadow: var(--shadow); } }

/* Menú superior (quien lo prefiera arriba) */
.tn-row { background: var(--side); color: var(--side-ink); border-bottom: 1px solid var(--line); }
.tn-brand-text strong { color: var(--ink); }
.tn-brand-text small { color: var(--muted); }
.tn-link, .tn-item > button { color: var(--side-ink); }
.tn-link:hover, .tn-item > button:hover, .tn-item.open > button { background: var(--side-hover); color: var(--ink); }
.tn-link.active, .tn-item.active > button { background: var(--accent-soft); color: var(--accent); }
.tn-user .user-menu > summary, .tn-user .notif-menu > summary { border-color: var(--line); color: var(--ink-2); }
.tn-user .notif-menu > summary:hover, .tn-user .notif-menu[open] > summary { background: var(--side-hover); color: var(--ink); }
.tn-user .notif-count { box-shadow: 0 0 0 2px var(--side); }

/* Barra de arriba, páginas y tarjetas */
.topbar { min-height: 60px; }
.page { gap: 24px; }
@media (min-width: 768px) { .page { padding: 28px 32px 48px; } }
.card { border-color: var(--line); }
.btn { border-color: var(--line-2); font-weight: 500; }
.btn-primary { font-weight: 600; }
.input, .select, .textarea { border-color: var(--line-2); }
.table th { color: var(--muted); font-weight: 500; }
.nav-toggle { color: var(--side-label); }
.nav-toggle:hover { color: var(--ink); background: var(--side-hover); }
.nav-count { background: var(--side-hover); color: var(--side-label); font-weight: 600; }

/* ===== Textos y códigos largos: nunca ensanchan la pantalla =====
   Un nombre sin espacios o un código GS1 largo se parte en varias líneas
   en vez de empujar la página hacia los lados (sobre todo en el teléfono). */
.main, .page { min-width: 0; }
.page :is(.card, .field, .grid > *, .stats > *, .stat, .list-row > *, .page-head > *, .toolbar > *, form > *, section) { min-width: 0; }
.page :is(.meta, h3, h4, p, strong, b, .hint, .muted, .error, .alert span, label > span, dd, dt, li, td, th, .sub, .value) { overflow-wrap: break-word; }
.page :is(.mono, code, h1, h2, .title, .list-row strong, .pf-tile strong, .qk-found strong, .stat .value) { overflow-wrap: anywhere; }
.page .btn, .page .btn * { overflow-wrap: normal; }
.page :is(.input, .select, .textarea) { min-width: 0; max-width: 100%; }
/* Rejillas escritas en la propia pantalla (style="display: grid"): sus columnas tampoco se ensanchan */
.page :is([style*="display: grid"], [style*="display:grid"]) > * { min-width: 0; }
.page img, .page svg, .page canvas, .page video { max-width: 100%; }
/* En tablas los números no se parten: la tabla se desplaza dentro de su recuadro */
.page :is(td, th).num, .page td .num, .page .num { overflow-wrap: normal; }
.topbar-title :is(small, strong) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* ===== Avisos en el teléfono: panel a lo ancho, dentro de la pantalla, textos largos recortados ===== */
.notif-panel .notif-item span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 767.98px) {
  .notif-panel {
    position: fixed; left: 10px; right: 10px; width: auto;
    top: calc(env(safe-area-inset-top, 0px) + 64px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 64px - 96px);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .notif-list { max-height: none; overflow-y: auto; overscroll-behavior: contain; }
  .notif-head .btn { white-space: nowrap; }
}

/* ===== Inicio (computadora y tableta), diseño 2026-11: saludo, «Para empezar», resumen del negocio y ventas por día ===== */
.dz { --dz-line: var(--line); }
.dz-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.dz-mark { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.dz-hello { flex: 1; min-width: 0; }
.dz-hello h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.dz-hello p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.dz-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.dz-actions .btn { height: 42px; font-weight: 600; }
.dz-menu { position: relative; }
.dz-menu > summary { list-style: none; cursor: pointer; gap: 6px; }
.dz-menu > summary::-webkit-details-marker { display: none; }
.dz-menu > summary svg { opacity: .7; }
.dz-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px; max-height: 360px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(20, 30, 25, .14); padding: 6px; display: grid; }
.dz-pop a { padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; }
.dz-pop a:hover { background: var(--ground); }
.dz-pop a.is-on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.dz-add .dz-pop { min-width: 280px; padding: 12px 14px; gap: 6px; }
.dz-add .dz-pop p { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.dz-add .check { min-height: 34px; font-size: 14px; }
.dz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.dz-muted { color: var(--muted); font-size: 13px; }
.dz-textbtn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 4px; }
.dz-textbtn:hover { color: var(--ink); }

/* Configuración completa */
.dz-done { display: flex; align-items: center; gap: 10px; padding: 12px 18px; margin-bottom: 26px; flex-wrap: wrap; }
.dz-done strong { font-size: 14px; }
.dz-done form { margin-left: auto; }
.dz-ok { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }

/* Para empezar */
.dz-setup { display: grid; grid-template-columns: minmax(240px, 280px) minmax(0, 1fr); margin-bottom: 26px; overflow: hidden; }
.dz-steps { padding: 16px 12px 18px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.dz-steps-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 12px 8px; }
.dz-steps-head strong { font-size: 14px; }
.dz-steps-head span { font-size: 12px; color: var(--muted); }
.dz-steps ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.dz-step { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.dz-step:hover { background: var(--ground); }
.dz-step.is-on { background: var(--accent-soft); }
.dz-step-mark { width: 20px; height: 20px; border-radius: 50%; border: 1.5px dashed #B9BDB8; flex: none; display: grid; place-items: center; }
.dz-step.is-on .dz-step-mark { border: 2px solid var(--accent); background: radial-gradient(circle, var(--accent) 0 4px, transparent 4.5px); }
.dz-step.is-done .dz-step-mark { border: 0; background: var(--accent); color: #fff; }
.dz-step-text { display: grid; min-width: 0; }
.dz-step-text strong { font-size: 14px; font-weight: 600; }
.dz-step.is-done .dz-step-text strong { color: var(--muted); text-decoration: line-through; text-decoration-color: #0002; }
.dz-step-text small { font-size: 12px; color: var(--muted); }
.dz-step.is-on .dz-step-text small { color: var(--accent-dark); }
.dz-progress { height: 4px; border-radius: 4px; background: var(--ground); margin: 14px 12px 0; overflow: hidden; }
.dz-progress span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.dz-panel { position: relative; padding: 26px 32px; }
.dz-hide { position: absolute; top: 14px; right: 16px; }
.dz-pane-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; margin-bottom: 18px; }
.dz-pane h2 { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.dz-pane p { margin: 0; max-width: 520px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.dz-checks { list-style: none; margin: 16px 0 0; padding: 0; display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; }
.dz-checks li { display: flex; align-items: center; gap: 8px; }
.dz-checks li > span:first-child { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid #A9AEA9; display: grid; place-items: center; flex: none; }
.dz-checks li.is-done > span:first-child { border: 0; background: var(--accent); color: #fff; }
.dz-pane-done { display: flex; align-items: center; gap: 6px; color: var(--accent-dark) !important; font-weight: 600; margin-top: 12px !important; }
.dz-pane-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.dz-pane-actions .btn { height: 40px; font-weight: 600; }

/* Avisos */
.dz-alerts { padding: 6px 18px; margin-bottom: 26px; }
.dz-alert { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 14px; }
.dz-alert + .dz-alert { border-top: 1px solid var(--line); }
.dz-alert > span:nth-child(2) { flex: 1; min-width: 0; }
.dz-alert a { font-weight: 600; font-size: 13px; white-space: nowrap; }

/* Resumen del negocio */
.dz-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.dz-section-head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.dz-section-head span { font-size: 13px; color: var(--muted); }
.dz-biz { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, .74fr) minmax(0, .74fr); grid-template-rows: auto auto; gap: 14px; margin-bottom: 14px; }
.dz-big { grid-row: span 2; padding: 18px 20px; display: flex; flex-direction: column; }
.dz-big-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dz-big h3, .dz-small h3 { margin: 0; font-size: 14px; font-weight: 600; }
.dz-big-head a { font-size: 13px; font-weight: 600; text-decoration: none; }
.dz-amount { font-size: 26px; font-weight: 700; letter-spacing: -.01em; margin: 6px 0 2px; overflow-wrap: anywhere; }
.dz-big .dz-muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: auto; padding-top: 16px; }
.dz-split > div { display: grid; padding-left: 12px; border-left: 3px solid var(--accent); min-width: 0; }
.dz-split > .is-late { border-left-color: #C0392B; }
.dz-split span { font-size: 13px; color: var(--muted); }
.dz-split strong { font-size: 17px; font-weight: 700; }
.dz-split small { font-size: 12px; color: var(--muted); }
.dz-small { padding: 14px 16px; display: grid; align-content: start; gap: 2px; }
.dz-small h3 { font-size: 13px; }
.dz-figure { font-size: 20px; font-weight: 700; margin-top: 4px; overflow-wrap: anywhere; }
.dz-small small { font-size: 12px; color: var(--muted); }

/* Ventas por día */
.dz-chart { padding: 18px 22px 14px; margin-bottom: 16px; }
.dz-chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.dz-chart-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.dz-chart-head small { font-size: 12px; color: var(--muted); }
.dz-chart-total { text-align: right; display: grid; }
.dz-chart-total strong { font-size: 22px; font-weight: 700; }
.dz-bars-wrap { position: relative; }
.dz-bars { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); gap: clamp(3px, 1.2vw, 18px); align-items: end; height: 220px; padding-top: 22px; border-bottom: 1px solid var(--line); }
.dz-bar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.dz-bar-fill { display: block; height: var(--h); background: var(--accent); border-radius: 3px 3px 0 0; }
.dz-bar.is-zero::after { content: ""; display: block; height: 2px; background: #E2E4E1; border-radius: 2px; }
.dz-bar-val { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 600; color: var(--ink); opacity: 0; pointer-events: none; }
.dz-bar:hover .dz-bar-val, .dz-bar.is-max .dz-bar-val { opacity: 1; }
.dz-bar .dz-bar-val { bottom: calc(var(--h, 0%) + 4px); }
.dz-bar:hover .dz-bar-fill { filter: brightness(1.15); }
.dz-days { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); gap: clamp(3px, 1.2vw, 18px); padding-top: 6px; }
.dz-days span { text-align: center; font-size: 11px; color: var(--muted); }
.dz-days span.is-today { color: var(--ink); font-weight: 700; }
.dz-chart-empty { position: absolute; inset: 0 0 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.dz-chart-empty strong { font-size: 15px; }
.dz-widgets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dz-widgets .dk-today { grid-column: 1 / -1; }
@media (max-width: 1180px) {
  .dz-biz { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dz-big { grid-row: auto; }
}
@media (max-width: 900px) {
  .dz-head { flex-wrap: wrap; }
  .dz-actions { width: 100%; justify-content: flex-start; }
  .dz-setup { grid-template-columns: 1fr; }
  .dz-steps { border-right: 0; border-bottom: 1px solid var(--line); }
  .dz-widgets { grid-template-columns: 1fr; }
  .dz-days span:nth-child(even) { visibility: hidden; }
}

/* Inicio: «Comprobantes disponibles» */
.dz-widgets .dz-ncf { grid-column: 1 / -1; }
.dz-ncf { padding: 22px 24px 18px; }
.dz-ncf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.dz-ncf-head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.dz-ncf-head p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.dz-ncf-head a { font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.dz-ncf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .dz-ncf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dz-ncf-tile { --c: var(--accent); display: flex; flex-direction: column; padding: 14px 16px 16px; border-radius: 14px; border: 1.5px solid var(--c); background: var(--surface); min-width: 0; }
.dz-ncf-tile.is-low { --c: #B5650F; }
.dz-ncf-tile.is-out { --c: #B3392B; }
.dz-ncf-tile.is-idle { --c: #9AA19C; border-color: transparent; background: #F1F3F2; }
.dz-ncf-code { display: flex; justify-content: space-between; align-items: center; }
.dz-ncf-code strong { font-size: 16px; font-weight: 700; color: var(--ink); }
.dz-ncf-tile.is-idle .dz-ncf-code strong { color: #4B524E; }
.dz-ncf-code i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.dz-ncf-num { font-size: 34px; font-weight: 700; line-height: 1.1; margin-top: 8px; color: var(--c); }
.dz-ncf-of { font-size: 13px; color: var(--muted); }
.dz-ncf-name { font-size: 14px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-ncf-tile.is-idle .dz-ncf-name { font-weight: 400; color: #4B524E; }
.dz-ncf-bar { display: block; height: 6px; border-radius: 6px; background: #ECEEEC; margin-top: 10px; overflow: hidden; }
.dz-ncf-bar span { display: block; height: 100%; background: var(--c); border-radius: 6px; }
.dz-ncf-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; color: var(--muted); }
.dz-ncf-legend { display: flex; gap: 16px; }
.dz-ncf-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dz-ncf-legend i { width: 7px; height: 7px; border-radius: 50%; background: #B7BDB9; }
.dz-ncf-legend i.is-use { background: #4B524E; }
.dz-ncf-legend span:first-child { color: var(--ink); }
