/* berry.Glow_py — mockup del sistema de gestión
   Paleta: berry (frambuesa) + ciruela profunda + brillo dorado. Manrope para la interfaz,
   Bodoni Moda solo para la marca y los títulos de página. */

:root {
  color-scheme: light;
  --bg: #FAF6F8;
  --surface: #FFFFFF;
  --surface-2: #F6EFF3;
  --surface-3: #EFE4EA;
  --ink: #2B1624;
  --ink-2: #4A3743;
  --muted: #66535F;
  --line: #EADFE5;
  --line-strong: #D9C8D1;
  --berry: #A3195B;
  --berry-strong: #86124A;
  --berry-soft: #F9E6EF;
  --on-berry: #FFFFFF;
  --glow: #E2A94F;
  --glow-soft: #FBF0DC;
  --plum: #2B1624;
  --plum-2: #3C2335;
  --on-plum: #F6EAF0;
  --on-plum-muted: #C9B3C1;
  --good: #1E7A4C;
  --good-soft: #E4F3EA;
  --warn: #955A00;
  --warn-soft: #FCEFD6;
  --bad: #B42A2A;
  --bad-soft: #FBE6E4;
  --focus: #A3195B;
  --chart-bar: #A3195B;
  --chart-grid: #EFE6EB;
  --chart-axis: #D9C8D1;
  --backdrop: rgba(43, 22, 36, 0.42);
  --shadow-1: 0 1px 2px rgba(43, 22, 36, 0.06);
  --shadow-2: 0 10px 32px rgba(43, 22, 36, 0.14);

  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-brand: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --radius-card: 14px;
  --radius-ctl: 8px;
  --sidebar-w: 248px;
  --tabbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #140E13;
    --surface: #1E161D;
    --surface-2: #271D26;
    --surface-3: #31252F;
    --ink: #F5EAF0;
    --ink-2: #D2BFCA;
    --muted: #A8939F;
    --line: #372A34;
    --line-strong: #4A3945;
    --berry: #F071A9;
    --berry-strong: #F590BD;
    --berry-soft: #3A1A2B;
    --on-berry: #230A17;
    --glow: #EFC07A;
    --glow-soft: #342816;
    --plum: #0F0A0E;
    --plum-2: #231822;
    --on-plum: #F5EAF0;
    --on-plum-muted: #B9A3B1;
    --good: #5CCB8E;
    --good-soft: #15301F;
    --warn: #F0B455;
    --warn-soft: #36270F;
    --bad: #F28B84;
    --bad-soft: #3A1917;
    --focus: #F071A9;
    --chart-bar: #F071A9;
    --chart-grid: #2E232C;
    --chart-axis: #4A3945;
    --backdrop: rgba(0, 0, 0, 0.6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 10px 32px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #140E13;
  --surface: #1E161D;
  --surface-2: #271D26;
  --surface-3: #31252F;
  --ink: #F5EAF0;
  --ink-2: #D2BFCA;
  --muted: #A8939F;
  --line: #372A34;
  --line-strong: #4A3945;
  --berry: #F071A9;
  --berry-strong: #F590BD;
  --berry-soft: #3A1A2B;
  --on-berry: #230A17;
  --glow: #EFC07A;
  --glow-soft: #342816;
  --plum: #0F0A0E;
  --plum-2: #231822;
  --on-plum: #F5EAF0;
  --on-plum-muted: #B9A3B1;
  --good: #5CCB8E;
  --good-soft: #15301F;
  --warn: #F0B455;
  --warn-soft: #36270F;
  --bad: #F28B84;
  --bad-soft: #3A1917;
  --focus: #F071A9;
  --chart-bar: #F071A9;
  --chart-grid: #2E232C;
  --chart-axis: #4A3945;
  --backdrop: rgba(0, 0, 0, 0.6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 10px 32px rgba(0, 0, 0, 0.55);
}

/* ── Base ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-ui);
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: var(--berry); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
mark { background: var(--glow-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .table td.num, .table th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strike { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.grow { flex: 1 1 auto; min-width: 0; }
.nowrap { white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Marca ────────────────────────────────────────────────────────────── */

.logo { display: block; height: auto; }
.logo-word { font-family: var(--font-brand); }
.brand { display: block; padding: 4px 8px 10px; color: var(--on-plum); }
.brand .logo { width: 184px; }
.brand-mini { display: none; color: var(--berry); }
.brand-mini .mark { width: 34px; height: 34px; }

/* ── Estructura ───────────────────────────────────────────────────────── */

.app { min-height: 100%; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 14px 18px;
  background: var(--plum); color: var(--on-plum);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--on-plum-muted); font-weight: 600; font-size: 14.5px;
}
.nav-item:hover { background: var(--plum-2); color: var(--on-plum); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--plum-2); color: var(--on-plum); }
.nav-item[aria-current="page"]::after {
  content: ""; margin-left: auto; width: 7px; height: 7px; border-radius: 50%;
  background: var(--glow); box-shadow: 0 0 0 4px rgba(226, 169, 79, 0.18);
}
.nav-sep { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 8px 12px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.params { display: grid; gap: 2px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); font-size: 13px; }
.params-row { display: flex; justify-content: space-between; gap: 8px; color: var(--on-plum-muted); }
.params-row strong { color: var(--on-plum); font-weight: 700; font-variant-numeric: tabular-nums; }
.params a { color: var(--glow); font-weight: 600; margin-top: 4px; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 8px 6px; font-size: 13.5px; }
.user-box .avatar { background: var(--plum-2); color: var(--on-plum); }
.user-box .grow { line-height: 1.3; }
.user-box small { color: var(--on-plum-muted); display: block; }
.sidebar .btn-icon { color: var(--on-plum-muted); }
.sidebar .btn-icon:hover { color: var(--on-plum); background: var(--plum-2); }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.mock-strip {
  display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; align-items: center;
  padding: 6px 16px; font-size: 12.5px; text-align: center;
  background: var(--glow-soft); color: var(--ink-2); border-bottom: 1px solid var(--line);
}
.mock-strip strong { color: var(--ink); }
.linkish { background: none; border: 0; padding: 0; color: var(--berry); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 28px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.view { width: 100%; max-width: 1240px; margin: 0 auto; padding: 26px 28px 56px; }
.view:focus { outline: none; }

.tabbar { display: none; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 700; background: none; border: 0; padding: 6px 2px;
}
.tab:hover { text-decoration: none; }
.tab[aria-current="page"] { color: var(--berry); }
.tab-main .tab-bubble {
  width: 46px; height: 46px; border-radius: 50%; margin-top: -18px;
  display: grid; place-items: center;
  background: var(--berry); color: var(--on-berry);
  box-shadow: 0 6px 16px rgba(163, 25, 91, 0.35), 0 0 0 5px var(--surface);
}
.tab-main { color: var(--ink); }

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .brand-mini { display: block; }
  .topbar { padding: 8px 16px; gap: 10px; }
  .topbar-actions .hide-mobile { display: none; }
  .view { padding: 18px 16px calc(var(--tabbar-h) + 36px + env(safe-area-inset-bottom, 0px)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .mock-strip { font-size: 12px; padding: 5px 12px; }
}

/* ── Buscador global y combobox ───────────────────────────────────────── */

.search { position: relative; flex: 1 1 auto; max-width: 620px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  color: var(--muted);
}
.search-box:focus-within { border-color: var(--berry); box-shadow: 0 0 0 3px var(--berry-soft); }
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font-size: 16px; color: var(--ink); }
.search-input::placeholder { color: var(--muted); }
.search-input::-webkit-search-cancel-button { display: none; }
.kbd { font: 600 11px/1 var(--font-ui); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--muted); }
@media (max-width: 899px) { .kbd { display: none; } }

.cb-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40;
  max-height: min(430px, 70vh); overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2);
}
.cb-group { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cb-option { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.cb-option.is-active { background: var(--berry-soft); }
.cb-option .row-title { font-weight: 700; }
.cb-option .row-sub { font-size: 13px; color: var(--muted); }
.cb-option .row-end { margin-left: auto; text-align: right; }
.cb-empty { padding: 12px 10px; color: var(--muted); font-size: 14px; }
.cb-new { color: var(--berry); font-weight: 700; }

/* ── Página ───────────────────────────────────────────────────────────── */

.page { display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.page-title { font-family: var(--font-ui); font-weight: 800; font-size: 29px; letter-spacing: -0.02em; line-height: 1.15; }
.page-sub { color: var(--muted); margin-top: 4px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; color: var(--muted); margin-bottom: -8px; }
.section-title { font-size: 16px; font-weight: 800; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-form { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sticky-col { position: sticky; top: 84px; }
@media (max-width: 1020px) {
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .sticky-col { position: static; }
}
@media (max-width: 760px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 27px; }
}

/* ── Tarjetas ─────────────────────────────────────────────────────────── */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 18px 20px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-title { font-size: 16px; font-weight: 800; }
.card-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.card-tint { background: var(--berry-soft); border-color: transparent; }
.note-mock {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px;
  font-size: 13px; color: var(--ink-2); background: var(--surface);
}
.note-mock .i { color: var(--muted); margin-top: 1px; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: 14px; background: var(--surface-2); color: var(--ink-2); }
.callout-warn { background: var(--warn-soft); color: var(--warn); }
.callout-bad { background: var(--bad-soft); color: var(--bad); }
.callout-good { background: var(--good-soft); color: var(--good); }
/* El mes que recién empieza: el texto toma el ancho y el botón baja a su propia línea si no entra (celular). */
/* Términos y condiciones editables (Ajustes) y su bloque en el comprobante. */
.terminos-lista { display: flex; flex-direction: column; gap: 8px; }
.termino { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.termino > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; list-style: none; }
.termino > summary::-webkit-details-marker { display: none; }
.termino[open] > summary { margin-bottom: 10px; }
.r-legales { margin-bottom: 12px; }
.r-legales .r-terminos { margin-bottom: 6px; }
/* Corregir una compra: cada artículo en su recuadro, con cantidad / precio / costo en una fila. */
.corr-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.corr-fila { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .corr-fila { grid-template-columns: minmax(0, 1fr); } }
.ticket-anterior { margin-top: 6px; }
.ticket-anterior > summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--berry); }
.r-corregida { margin: -2px 0 6px; font-style: italic; }
.callout-mes { flex-wrap: wrap; }
.callout-mes > .grow { flex: 1 1 240px; min-width: 0; }
.callout-mes > .btn { margin-left: auto; align-self: center; }
.callout strong { color: inherit; }

/* ── Cifras (stat tiles) ──────────────────────────────────────────────── */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tile-value { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.tile-sub { font-size: 13px; color: var(--muted); }
.tile-sub .ok { color: var(--good); font-weight: 700; }
.hero-figure { font-size: 48px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; overflow-wrap: anywhere; }
@media (max-width: 520px) { .hero-figure { font-size: 40px; } .tile-value { font-size: 24px; } }

/* ── Botones ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 15px; border-radius: var(--radius-ctl);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 14.5px; line-height: 1.2; white-space: nowrap; text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--berry); border-color: var(--berry); color: var(--on-berry); }
.btn-primary:hover { background: var(--berry-strong); border-color: var(--berry-strong); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 13.5px; }
.btn-lg { min-height: 48px; padding: 12px 20px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 9px; border: 0; background: transparent; color: var(--ink-2);
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn-link { background: none; border: 0; padding: 4px 0; color: var(--berry); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.btn-link:hover { text-decoration: underline; }

.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick-btn {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px;
  border-radius: var(--radius-card); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-weight: 700; font-size: 15px;
}
.quick-btn:hover { text-decoration: none; border-color: var(--berry); }
.quick-btn .qi { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--berry-soft); color: var(--berry); flex: none; }
.quick-btn small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.quick-btn.is-main { background: var(--berry); border-color: var(--berry); color: var(--on-berry); }
.quick-btn.is-main .qi { background: rgba(255, 255, 255, 0.18); color: var(--on-berry); }
.quick-btn.is-main small { color: var(--on-berry); opacity: 0.85; }
@media (max-width: 1020px) { .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Chips, pastillas, segmentados ────────────────────────────────────── */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 12px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 700; font-size: 13.5px; color: var(--ink-2);
}
.chip:hover { border-color: var(--berry); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .count { font-weight: 600; opacity: 0.7; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap; line-height: 1.3;
}
.pill .i { width: 14px; height: 14px; stroke-width: 2.2; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-muted { background: var(--surface-3); color: var(--ink-2); }
.pill-berry { background: var(--berry-soft); color: var(--berry); }

.age { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.age-warn { color: var(--warn); }
.age-bad { color: var(--bad); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg label, .seg button {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 5px 12px; border-radius: 7px; border: 0; background: transparent;
  font-weight: 700; font-size: 13.5px; color: var(--ink-2); cursor: pointer;
}
.seg input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg label:has(input[type="radio"]:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ── Formularios ──────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.field .req { color: var(--berry); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.fields .span-2 { grid-column: 1 / -1; }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 620px) {
  .fields, .fields-3 { grid-template-columns: minmax(0, 1fr); }
}
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-ctl);
  background: var(--surface); color: var(--ink); font-size: 16px;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 3px var(--berry-soft); }
.input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.input.num-input { text-align: right; font-variant-numeric: tabular-nums; }
.money { position: relative; display: flex; align-items: center; }
.money .input { padding-left: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.money-sym { position: absolute; left: 12px; color: var(--muted); font-weight: 700; pointer-events: none; }
.suffix-wrap { position: relative; display: flex; align-items: center; }
.suffix-wrap .input { padding-right: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.suffix { position: absolute; right: 12px; color: var(--muted); font-weight: 700; font-size: 14px; pointer-events: none; }
.hint { font-size: 13px; color: var(--muted); }
.error-text { font-size: 13px; color: var(--bad); font-weight: 600; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-ctl); background: var(--surface); }
.stepper button { width: 38px; height: 40px; border: 0; background: transparent; font-size: 18px; font-weight: 700; color: var(--ink-2); }
.stepper button:hover { background: var(--surface-2); }
.stepper input { width: 52px; height: 40px; border: 0; text-align: center; background: transparent; font-weight: 700; font-size: 16px; -moz-appearance: textfield; }
.stepper input:focus { outline: none; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ── Listas y tablas ──────────────────────────────────────────────────── */

.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: var(--ink); min-height: 62px; }
a.list-row:hover { background: var(--surface-2); text-decoration: none; }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.row-title { font-weight: 700; overflow-wrap: anywhere; }
.row-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; flex: none; }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-zero { color: var(--muted); font-weight: 600; }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: var(--berry-soft); color: var(--berry); font-weight: 800; font-size: 13.5px; letter-spacing: 0.02em;
}
.avatar-lg { width: 60px; height: 60px; font-size: 20px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-link { cursor: pointer; }
.table tbody tr.is-link:hover td { background: var(--surface-2); }
.table tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--line-strong); border-bottom: 0; }
.table .t-title { font-weight: 700; }
.table .t-sub { font-size: 12.5px; color: var(--muted); }
.table-compact td, .table-compact th { padding: 8px 10px; }
.table input.input { min-height: 36px; padding: 6px 8px; font-size: 14.5px; }
.row-error td { background: var(--bad-soft); }
.row-warn td { background: var(--warn-soft); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Cliente ──────────────────────────────────────────────────────────── */

.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.meta { color: var(--ink-2); font-size: 14px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
/* El saldo y sus botones se reparten el ancho de la sección (no el de la pantalla): con el menú lateral a 900 px la
   grilla anterior le dejaba 110 px al monto. El texto nunca baja de 260 px; si no entran los dos, los botones van abajo. */
.balance {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  padding: 22px 24px; border-radius: 18px; background: var(--berry-soft); color: var(--ink);
}
.balance > div:first-child { flex: 1 1 260px; min-width: 0; }
.balance-label { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--berry); }
.balance-sub { color: var(--ink-2); margin-top: 6px; }
.balance-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 420px; }
.balance > .balance-actions { flex: 1 1 300px; margin-left: auto; }
.balance.is-clear { background: var(--good-soft); }
.balance.is-clear .balance-label { color: var(--good); }
@media (max-width: 760px) {
  .balance { padding: 18px; }
  .balance-actions { justify-content: flex-start; }
  .balance > .balance-actions { flex-basis: 100%; max-width: none; }
  .balance-actions .btn { flex: 1 1 calc(50% - 8px); }
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab-btn { padding: 10px 14px; border: 0; background: none; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab-btn[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--berry); }

.sale-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 14px 16px; color: var(--ink); }
a.sale-row:hover { background: var(--surface-2); text-decoration: none; }
.sale-date { font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.sale-date small { display: block; font-weight: 600; font-size: 12px; color: var(--muted); }
.sale-desc { min-width: 0; }
.sale-desc .row-sub { margin-top: 2px; }
.sale-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (max-width: 560px) {
  .sale-row { grid-template-columns: minmax(0, 1fr) auto; }
  .sale-date { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; }
  .sale-date small { display: inline; }
}

/* ── Calculadora (Módulo 2) ───────────────────────────────────────────── */

.params-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.param-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2);
}
.param-chip strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.param-chip button { border: 0; background: none; color: var(--berry); font-weight: 700; padding: 0 0 0 4px; }

.trail { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 14px; align-items: baseline; font-size: 14px; }
.trail .t-label { font-weight: 700; color: var(--ink-2); }
.trail .formula { color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.trail .t-val { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.trail .total { border-top: 1px solid var(--line); padding-top: 8px; }
.trail .t-val.total { font-size: 18px; color: var(--berry); }
@media (max-width: 460px) {
  /* En celular: etiqueta y valor en un renglón, la fórmula debajo a todo el ancho. */
  .trail { grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: row dense; }
  .trail .t-label { grid-column: 1; }
  .trail .t-val { grid-column: 2; }
  .trail .formula { grid-column: 1 / -1; font-size: 13px; margin-top: -6px; }
  .trail .formula.total { border-top: 0; padding-top: 0; }
}

.ladder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .modal-wide .ladder { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rung {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 26px 12px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
  cursor: pointer; min-width: 0;
}
/* ojal de etiqueta colgante */
.rung::before {
  content: ""; position: absolute; top: 10px; left: 12px; width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--bg);
}
.rung > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.rung:hover { border-color: var(--berry); }
.rung:has(> input:checked) { border-color: var(--berry); background: var(--berry-soft); }
.rung:has(> input:checked)::before { border-color: var(--berry); background: var(--berry); }
.rung:has(> input[type="radio"]:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.rung-m { position: absolute; top: 6px; right: 10px; font-size: 12.5px; font-weight: 800; color: var(--berry); }
.rung-price { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.rung-exact, .rung-gain { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rung-gain { color: var(--good); font-weight: 700; }
.rung-custom { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 12px 12px 30px; }
.rung-custom::before { top: 50%; margin-top: -5px; }
.rung-custom .money { flex: 1 1 180px; }

.lot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lot div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.lot span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.lot strong { font-size: 16px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 460px) { .lot { grid-template-columns: minmax(0, 1fr); } }

.calc-placeholder { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; color: var(--ink-2); }

/* ── Venta y cobro ────────────────────────────────────────────────────── */

.picked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.picked .grow .row-sub span + span::before { content: " · "; }
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.line-top { display: flex; align-items: flex-start; gap: 10px; }
.line-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.price-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.price-opt {
  display: inline-flex; flex-direction: column; align-items: flex-start; padding: 5px 10px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; line-height: 1.25; cursor: pointer;
}
.price-opt small { font-size: 11px; font-weight: 800; color: var(--berry); }
.price-opt strong { font-variant-numeric: tabular-nums; }
.price-opt > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.price-opt:has(input:checked) { border-color: var(--berry); background: var(--berry-soft); }
.price-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.pay-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.pay-line .seg { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pay-line .seg label { padding: 5px 4px; }
.pay-line + .pay-line { padding-top: 10px; border-top: 1px dashed var(--line); }
.summary { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14.5px; }
.summary dt { color: var(--ink-2); }
.summary dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary .big { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.summary .sep { grid-column: 1 / -1; height: 1px; background: var(--line); margin: 4px 0; }
.summary .due { color: var(--warn); }
.summary .clear { color: var(--good); }
.sticky-submit { display: none; }
@media (max-width: 1020px) {
  .sticky-submit {
    display: flex; align-items: center; gap: 12px; justify-content: space-between;
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); z-index: 25;
    padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(43, 22, 36, 0.08);
  }
  .sticky-submit .amount { font-size: 18px; }
  .has-sticky { padding-bottom: 70px; }
}
@media (min-width: 900px) and (max-width: 1020px) {
  .sticky-submit { bottom: 0; left: var(--sidebar-w); }
}
.success {
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
  padding: 20px 22px; border-radius: 16px; background: var(--good-soft); color: var(--ink);
}
.success h2 { font-size: 20px; color: var(--good); display: flex; align-items: center; gap: 8px; }

/* ── Importación ──────────────────────────────────────────────────────── */

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; counter-reset: paso; }
@media (max-width: 900px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.step { counter-increment: paso; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.step-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 13px; }
.step-n::before { content: counter(paso); }
.step h2 { font-size: 16px; font-weight: 800; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 132px; padding: 16px; border: 2px dashed var(--line-strong); border-radius: 12px; color: var(--ink-2); cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--berry); background: var(--berry-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ── Gráfico ──────────────────────────────────────────────────────────── */

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--chart-axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 600 11px var(--font-ui); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--chart-bar); transition: opacity 0.12s; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:focus { outline: none; }
.chart .hit:focus + .bar, .chart .hit:hover + .bar { opacity: 0.72; }
.chart-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 10px));
  background: var(--ink); color: var(--bg); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; white-space: nowrap; box-shadow: var(--shadow-2);
}
.chart-tip strong { display: block; font-size: 14px; }

/* ── Diálogos, hojas, avisos ──────────────────────────────────────────── */

dialog { color: var(--ink); }
.modal {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-2);
}
.modal-wide { width: min(860px, calc(100vw - 24px)); }
.modal::backdrop, .sheet::backdrop { background: var(--backdrop); }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px 20px; }
.modal-head h2 { font-size: 18px; font-weight: 800; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.sheet {
  margin: auto 0 0; width: 100%; max-width: 100%; padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px));
  border: 0; border-radius: 18px 18px 0 0; background: var(--surface);
}
.sheet-grip { width: 42px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 4px auto 10px; }
.sheet-list { display: flex; flex-direction: column; }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 13px 10px; border-radius: 10px; color: var(--ink); font-weight: 700; background: none; border: 0; text-align: left; width: 100%; }
.sheet-item:hover { background: var(--surface-2); text-decoration: none; }
.sheet-sep { height: 1px; background: var(--line); margin: 6px 4px; }

.toast-host { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14.5px; box-shadow: var(--shadow-2);
  animation: toast-in 0.2s ease-out;
}
.toast-error { background: var(--bad); color: #fff; }
.toast.is-leaving { opacity: 0; transition: opacity 0.3s; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 899px) { .toast-host { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)); } }

/* ── Guía de prueba ───────────────────────────────────────────────────── */

.guide {
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-2);
  padding: 18px 20px 32px; display: flex; flex-direction: column; gap: 18px;
}
.guide-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.guide-head h2 { font-family: var(--font-ui); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.guide h3 { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--berry); }
.check .check-title { font-weight: 700; }
.check .check-how { grid-column: 2; font-size: 13.5px; color: var(--ink-2); }
.check .check-go { grid-column: 2; justify-self: start; }
.check.is-done { background: var(--good-soft); border-color: transparent; }
.check.is-done .check-title { text-decoration: line-through; text-decoration-color: var(--good); }
/* Primeros pasos del sistema nuevo: lista numerada. */
.pasos { display: flex; flex-direction: column; gap: 10px; counter-reset: paso; font-size: 14px; color: var(--ink-2); }
.pasos li { position: relative; padding-left: 34px; counter-increment: paso; }
.pasos li::before {
  content: counter(paso); position: absolute; left: 0; top: 0;
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--berry-soft); color: var(--berry); font-weight: 800; font-size: 13px;
}
.pasos strong { color: var(--ink); }
/* «Lo que hay»: el stock a la vista al vender, para no depender de la memoria. */
.hay { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface-2); }
.hay-tit { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.hay-lista { display: flex; flex-direction: column; gap: 6px; }
.hay-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; font: inherit;
}
.hay-item:hover { border-color: var(--berry); background: var(--berry-soft); }
.hay-item .grow { display: flex; flex-direction: column; min-width: 0; }
/* En «Cobrar»: un tono apenas marcado para diferenciar al que debe del que está al día. */
.hay-item.debe { background: var(--warn-soft); border-color: transparent; }
.hay-item.debe.atrasado { background: var(--bad-soft); }
.hay-item.debe .amount { color: var(--bad); }
.hay-item.debe:hover { border-color: var(--berry); }
.hay-item .row-title { font-size: 14px; }
.hay-todo { border-top: 1px solid var(--line); padding-top: 8px; }
.hay-todo summary { font-weight: 700; font-size: 13.5px; color: var(--berry); cursor: pointer; }
.hay-todo > .hay-lista { margin-top: 8px; }
.hay-todo[open] { max-height: 360px; overflow-y: auto; }
.hay-cat { margin-top: 10px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.terminos summary { font-weight: 700; color: var(--berry); cursor: pointer; }
.terminos p { margin-top: 6px; font-size: 13px; color: var(--ink-2); }

/* Motivos de anulación (lista elegible) y lo que va a pasar al anular. */
.motivos { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.motivo { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.motivo:hover { border-color: var(--berry); background: var(--berry-soft); }
.motivo input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--berry); flex: 0 0 auto; }
.motivo .row-title { font-size: 14.5px; font-weight: 700; display: block; }
.motivo .row-sub { font-size: 12.5px; color: var(--muted); display: block; }
.motivo:has(input:checked) { border-color: var(--berry); background: var(--berry-soft); }
.efecto { margin-top: 10px; }
.efecto-lista { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }

/* Borrar un artículo cargado por error. */
.col-del { width: 44px; text-align: center; }
.btn-del { color: var(--bad); }
.btn-del:hover { background: var(--bad-soft); }
.list-del { display: flex; align-items: center; gap: 4px; }
.list-del .list-btn { flex: 1 1 auto; min-width: 0; }
.list-del .btn-del { flex: 0 0 auto; margin-right: 8px; }

/* Tarjeta de puntos de la clienta. */
.card-puntos .puntos-cifra { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; justify-content: space-between; }
.card-puntos .hero-figure { color: var(--berry); }
.card-puntos .hero-figure small { font-family: var(--font-ui); font-size: 15px; font-weight: 700; color: var(--ink-2); }
.card-puntos .balance-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bullets { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--ink-2); }
.bullets li { padding-left: 14px; position: relative; }
.bullets li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--glow); }
.bullets strong { color: var(--ink); }

/* ── Ingreso ──────────────────────────────────────────────────────────── */

.login {
  min-height: 100%; display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(226, 169, 79, 0.22), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, rgba(163, 25, 91, 0.35), transparent 60%),
    var(--plum);
}
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 20px; padding: 28px 26px; box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 18px; }
.login-card .logo { width: 220px; color: var(--ink); }
.login-card h1 { font-size: 15px; font-weight: 700; color: var(--muted); }
.demo-hint { font-size: 13.5px; color: var(--ink-2); background: var(--glow-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.demo-hint .row { gap: 8px; }
.btn-perfil {
  justify-content: flex-start; gap: 12px; padding: 12px 16px; min-height: 64px;
  white-space: normal; text-align: left; border-radius: var(--radius-card);
}
.btn-perfil:hover { border-color: var(--berry); background: var(--berry-soft); }
.btn-perfil .avatar { width: 42px; height: 42px; font-size: 15px; }
.btn-perfil .grow { min-width: 0; }
.btn-perfil strong { display: block; font-size: 16px; }
.btn-perfil small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

/* ── Complementos de pantallas ────────────────────────────────────────── */

.show-mobile { display: none; }
@media (max-width: 899px) { .show-mobile { display: inline-grid; } }
.sidebar { --mark-berry: #F071A9; }
.mark { display: block; }
.logo-img { display: block; max-height: 64px; width: auto; max-width: 100%; }
.brand .logo-img { max-height: 48px; }
.login-brand .logo { width: 230px; color: var(--ink); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .search-box { min-width: min(260px, 100%); }
.select-auto { width: auto; }
.card-flush .card-head.pad { padding: 16px 20px 0; margin-bottom: 0; }
.card-flush > .empty { padding-top: 16px; }
.list-plain { border: 0; border-radius: 0; margin-top: 12px; border-top: 1px solid var(--line); background: transparent; }
.list-top { margin-top: 12px; }
.pad-x { padding: 0 16px 10px 68px; }
.list-btn { width: 100%; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.list-btn:hover { background: var(--surface-2); }
.table-bare { border: 0; border-radius: 0; background: transparent; }
.price-opt { position: relative; }
.summary .span { grid-column: 1 / -1; text-align: left; font-weight: 500; }
.check-inline { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.check-inline input { width: 18px; height: 18px; flex: none; accent-color: var(--berry); }
.dests { display: flex; flex-direction: column; gap: 8px; }
.dest { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.dest:hover { border-color: var(--berry); }
.dest:has(input:checked) { border-color: var(--berry); background: var(--berry-soft); }
.dest input { width: 18px; height: 18px; flex: none; accent-color: var(--berry); }
.dest .row-title, .dest .row-sub { display: block; }
.input-date { width: auto; max-width: 100%; }
.money .input.input-usd { padding-left: 50px; }
.static { min-height: 42px; display: flex; align-items: center; gap: 6px; font-weight: 600; }
.show-narrow { display: none; }
@media (max-width: 760px) {
  .hide-narrow { display: none; }
  .show-narrow { display: flex; }
}
.w-xs { width: 70px; }
.w-sm { width: 100px; }
.table-edit td { padding: 6px; }
.table-edit .input, .table-edit .select { min-height: 36px; font-size: 14.5px; padding: 6px 8px; }
.table-edit td:first-child .input { min-width: 190px; }
.grid-form-wide { grid-template-columns: minmax(0, 1.8fr) minmax(290px, 1fr); }
@media (max-width: 1020px) { .grid-form-wide { grid-template-columns: minmax(0, 1fr); } }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline .input { width: auto; min-width: 0; }
.hist { display: flex; flex-direction: column; font-size: 13.5px; }
.hist li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting-value { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.brand-preview { padding: 18px; border-radius: 12px; background: #FFFFFF; color: #2B1624; border: 1px solid var(--line); }
.brand-preview .logo { width: 250px; max-width: 100%; }
.color-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
.color-field input { width: 44px; height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 2px; background: var(--surface); cursor: pointer; }
.table-toggle { margin-top: 10px; }
.table-toggle summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--ink-2); padding: 4px 0; }
.table-toggle .table-wrap { margin-top: 8px; max-height: 320px; overflow-y: auto; }
.summary-line { min-height: 28px; }
.chart .bar { pointer-events: none; }
.r-sub { margin-top: 12px; }
/* Objetivos táctiles cómodos para los enlaces de texto que se usan con el dedo */
.back-link { padding: 10px 0; margin: -10px 0 -18px; }
.param-chip button { min-height: 32px; padding: 6px 4px 6px 8px; margin: -6px -4px -6px 0; }
.card-head > a, .card-head > .small { padding: 10px 0; margin: -10px 0; }
.linkish { padding: 6px 0; }
.sale-desc .row-title, .sale-desc .row-sub { display: block; }
.mock-corto { display: none; }
@media (min-width: 900px) {
  /* La columna del menú lateral conserva su color aunque la página sea más alta que la ventana */
  .app { background: linear-gradient(90deg, var(--plum) 0 var(--sidebar-w), var(--bg) var(--sidebar-w)); }
}
@media (max-width: 1020px) { .hide-sticky { display: none; } }
@media (max-width: 899px) {
  .mock-largo { display: none; }
  .mock-corto { display: inline; }
}
@media (max-width: 560px) {
  .quick-btn { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; min-height: 0; }
  .quick-btn small { display: none; }
  .profile-head .avatar-lg { display: none; }
  .profile-head { gap: 8px; }
}

/* ── Gráficos del resumen (dos series validadas para daltonismo, claro y oscuro) ── */

:root { --serie-1: #A3195B; --serie-2: #2A78D6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --serie-1: #D9528F; --serie-2: #3987E5; --chart-bar: #D9528F; }
}
:root[data-theme="dark"] { --serie-1: #D9528F; --serie-2: #3987E5; --chart-bar: #D9528F; }

.chart .bar.s1 { fill: var(--serie-1); }
.chart .bar.s2 { fill: var(--serie-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; }
.legend-swatch.s1, .tip-key.s1 { background: var(--serie-1); }
.legend-swatch.s2, .tip-key.s2 { background: var(--serie-2); }
.chart-tip .tip-title { display: block; font-weight: 800; margin-bottom: 3px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip .tip-row strong { display: inline; font-size: 13.5px; }
.tip-key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 14px; }
.hbar-label { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.hbar-label small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.hbar-track { height: 14px; background: var(--chart-grid); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--chart-bar); border-radius: 0 4px 4px 0; }
.hbar-value { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
@media (max-width: 480px) {
  .hbar { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; }
}
.grid-charts > .card { min-width: 0; }

/* ── Envíos ───────────────────────────────────────────────────────────── */

.tiles-5 { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.tiles-5 .tile-value { font-size: 24px; }
/* En el celular, de a dos por fila: el monto se achica con la pantalla para no partirse en dos renglones. */
@media (max-width: 559px) {
  .tiles-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tiles-compact .tile { padding: 14px; }
  .tiles-compact .tile-value { font-size: clamp(18px, 5.4vw, 24px); }
  .tiles-compact > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* Un monto de tarjeta nunca se parte en dos renglones (pasó «₲ 2.520.00» / «0» entre 600 y 1024 px): la letra se
   achica con el ancho de LA TARJETA (no de la pantalla), hasta el tamaño de cada lugar. Sin container queries, a lo
   sumo corta en el espacio después del ₲, nunca dentro del número. */
.tile-value { overflow-wrap: normal; --tv-max: 27px; }
@media (max-width: 520px) { .tile-value { --tv-max: 24px; } }
.tiles-5 .tile-value { --tv-max: 24px; }
@media (max-width: 559px) { .tiles-compact .tile-value { --tv-max: 24px; } }
@supports (width: 1cqi) {
  .tile { container-type: inline-size; }
  .tile-value, .tiles-5 .tile-value, .tiles-compact .tile-value { white-space: nowrap; font-size: min(var(--tv-max), max(15px, 15cqi)); }
}
/* El saldo grande (ficha de la clienta, cuenta de ahorro) tampoco se parte: se achica con su columna, que la pone la
   grilla (no el texto), así que puede ser contenedor sin achicarse a cero. */
.balance .hero-figure { overflow-wrap: normal; }
@supports (width: 1cqi) {
  .balance > div:first-child { container-type: inline-size; }
  .balance .hero-figure { white-space: nowrap; font-size: min(48px, max(26px, 13cqi)); }
}
@media (max-width: 520px) { @supports (width: 1cqi) { .balance .hero-figure { font-size: min(40px, max(26px, 13cqi)); } } }

.actividad { list-style: none; margin: 0; padding: 0; }
.actividad > li { display: grid; gap: 8px; padding: 12px 0; }
.actividad > li:first-child { padding-top: 0; }
.actividad > li + li { border-top: 1px solid var(--line); }
.act-quien { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.act-quien strong { font-size: 16px; }
.act-nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; margin: 0; }
.act-nums > div { min-width: 0; }
.act-nums dt { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.act-nums dd { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.act-monto { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
@media (max-width: 520px) { .act-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Precios especiales ───────────────────────────────────────────────── */

.precio-lista { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; }
.especial { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1.5px dashed var(--berry); border-radius: 12px; }
.precio-info { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-size: 13.5px; }
.precio-info:empty { display: none; }
.precio-info .pill { white-space: nowrap; }
.card-sub { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.t-especial { color: var(--berry); font-weight: 700; }
/* Artículos de una venta en el celular: las cuatro columnas entran sin deslizar. */
@media (max-width: 520px) {
  .table-venta { font-size: 13px; }
  .table-venta th, .table-venta td { padding-left: 6px; padding-right: 6px; }
  .table-venta th { letter-spacing: 0.02em; }
}
a.callout-link { color: inherit; }
a.callout-link:hover { text-decoration: none; background: var(--berry-soft); }
.tile-link { color: inherit; }
.tile-link:hover { text-decoration: none; border-color: var(--berry); }
.kv-left dd { text-align: left; font-weight: 600; overflow-wrap: anywhere; }
.checks-list { display: flex; flex-direction: column; gap: 10px; }
.check-block { align-items: flex-start; font-weight: 500; line-height: 1.35; }
.check-block input { margin-top: 1px; }
.steps-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.track { position: relative; display: flex; flex-direction: column; gap: 3px; padding-top: 22px; min-width: 0; }
.track::before { content: ""; position: absolute; top: 6px; left: 0; right: -10px; height: 2px; background: var(--line); }
.track:last-child::before { right: 0; }
.track-dot { position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.track.is-done::before, .track.is-now::before { background: var(--berry); }
.track.is-done .track-dot { background: var(--berry); border-color: var(--berry); }
.track.is-now .track-dot { border-color: var(--berry); box-shadow: 0 0 0 4px var(--berry-soft); }
.track-name { font-weight: 800; font-size: 14px; }
.track-when { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 620px) { .steps-track { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; } }

/* Permisos */
.perm-list { display: flex; flex-direction: column; }
.perm { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm:last-child { border-bottom: 0; }
.perm input { grid-row: span 2; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--berry); }
.perm strong { font-size: 14.5px; }
.perm span { font-size: 13px; color: var(--muted); }
.perm.is-fixed { cursor: default; opacity: 0.85; }

/* Etiqueta de envío: 10 × 15 cm, pensada también para impresoras en blanco y negro */
.labels-stage { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; padding: 18px; border-radius: 18px; background: var(--surface-3); overflow-x: auto; }
.label {
  width: 100mm; height: 150mm; padding: 5mm; background: #FFFFFF; color: #111111; color-scheme: light;
  display: flex; flex-direction: column; gap: 3mm; border: 0.6mm solid #111111; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  font-family: var(--font-ui); overflow: hidden;
}
.label p { margin: 0; }
/* Franja de la marca: el logo en un recuadro blanco (sirve con cualquier logo) y «te lo envía» bien visible. */
.lb-head { display: flex; justify-content: space-between; align-items: center; gap: 3mm; margin: -5mm -5mm 0; padding: 3mm 4mm; border-bottom: 0.8mm solid #111111; }
.label.cab-color .lb-head { background: var(--lb-brand, #A3195B); color: #FFFFFF; border-bottom-color: var(--lb-accent, #E2A94F); }
.lb-brand { flex: 0 1 auto; min-width: 0; }
.label.cab-color .lb-brand { background: #FFFFFF; border-radius: 1.5mm; padding: 1.5mm 2mm; }
.lb-brand .logo { width: calc(38mm * var(--logo-escala, 1)); max-width: 52mm; color: #111111; }
.lb-brand .logo-img { max-height: calc(14mm * var(--logo-escala, 1)); max-width: 52mm; width: auto; }
.lb-de { text-align: right; line-height: 1.15; flex: 0 0 auto; }
.lb-de-k { font-size: 6.5pt; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }
.lb-de-n { font-size: 12pt; font-weight: 800; }
.lb-de-w { font-size: 9pt; font-weight: 700; display: flex; align-items: center; gap: 1mm; justify-content: flex-end; }
.lb-de-w .i { width: 3.5mm; height: 3.5mm; }
.lb-num2 { display: flex; justify-content: space-between; font-size: 9pt; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; border-bottom: 0.3mm dashed #111111; padding-bottom: 1.5mm; }
.lb-k { font-size: 7pt; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #444444; }
.lb-name { font-size: 15pt; font-weight: 800; line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; }
.lb-line { font-size: 10pt; }
.lb-dest { border: 0.6mm solid #111111; padding: 2.5mm 3mm; }
.lb-city { font-size: 22pt; font-weight: 800; line-height: 1.05; text-transform: uppercase; letter-spacing: -0.01em; overflow-wrap: anywhere; margin-top: 1.5mm !important; }
.lb-depto { font-weight: 700; }
.lb-mode { font-size: 9.5pt; margin-top: 1.5mm !important; line-height: 1.3; border-top: 0.3mm solid #CCCCCC; padding-top: 1.5mm; }
.lb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2mm 4mm; font-size: 9.5pt; }
.lb-guia { border-bottom: 0.4mm solid #111111; min-height: 5mm; font-weight: 800; }
.lb-pay { font-size: 9.5pt; font-weight: 800; text-transform: uppercase; }
.lb-cod { font-size: 12pt; font-weight: 800; padding: 2mm 3mm; background: #111111; color: #FFFFFF; text-transform: uppercase; }
.lb-flags { display: flex; gap: 2mm; }
.lb-flags span { border: 0.5mm solid #111111; padding: 0.5mm 2mm; font-size: 9pt; font-weight: 800; text-transform: uppercase; }
.lb-from { margin-top: auto; border-top: 0.4mm dashed #111111; padding-top: 2mm; font-size: 8.5pt; line-height: 1.35; }
@media screen and (max-width: 520px) {
  .labels-stage { padding: 10px; }
  .label { width: 100%; height: auto; min-height: 0; }
}
@media print {
  body.route-print .labels-stage { display: block; padding: 0; background: none; border-radius: 0; }
  body.route-print .label { box-shadow: none; width: 100mm; height: 150mm; margin: 0 auto; }
  body.route-print .label + .label { break-before: page; }
  .label, .label * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Recibo ───────────────────────────────────────────────────────────── */

.receipt-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.privacy { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; padding: 8px 12px; border-radius: 10px; }
.privacy-ok { background: var(--good-soft); color: var(--good); }
.privacy-bad { background: var(--bad-soft); color: var(--bad); }
.receipt-stage { display: flex; justify-content: center; padding: 22px 12px; border-radius: 18px; background: var(--surface-3); overflow-x: auto; }

.receipt {
  --r-brand: #A3195B;
  --r-accent: #E2A94F;
  --r-ink: #2B1624;
  --r-muted: #7A6673;
  --r-line: #EADFE5;
  --r-soft: #FBF3F7;
  width: 100%; max-width: calc(720px / var(--r-zoom, 1)); background: #fff; color: var(--r-ink);
  border-radius: 6px; box-shadow: 0 12px 36px rgba(43, 22, 36, 0.18);
  padding: 34px 38px; font-size: 13.5px; line-height: 1.45;
  color-scheme: light;
  /* Tamaño elegido (50 a 110 %): todo el comprobante se achica parejo, así en la hoja o el ticket entra más. */
  zoom: var(--r-zoom, 1);
}
.receipt * { border-color: var(--r-line); }
.r-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-bottom: 16px; border-bottom: 2px solid var(--r-accent); }
/* Encabezado con un fondo suave del color de la marca: resalta el logo sin gritar (se apaga en Ajustes). */
.receipt.cab-color .r-head {
  background: var(--r-soft);
  background: color-mix(in srgb, var(--r-brand) 9%, #FFFFFF);
  margin: -34px -38px 0; padding: 22px 38px 18px; border-bottom: 2px solid var(--r-accent);
}
.r-logo { width: calc(200px * var(--logo-escala, 1)); max-width: 62%; color: var(--r-ink); }
.r-logo img { max-height: calc(70px * var(--logo-escala, 1)); width: auto; max-width: 100%; }
.r-doc { text-align: right; }
.r-doc h1 { font-family: var(--font-brand); font-weight: 600; font-size: 26px; color: var(--r-brand); letter-spacing: 0.02em; }
.r-doc p { color: var(--r-muted); font-size: 12.5px; }
.r-doc .r-num { color: var(--r-ink); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.r-contact { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--r-muted); font-size: 12px; padding: 10px 0 16px; }
.r-client { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--r-soft); margin-bottom: 18px; }
.r-client span { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--r-muted); }
.r-client strong { font-size: 14px; }
.r-section { margin-bottom: 18px; }
.r-section h2 { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--r-brand); margin-bottom: 6px; display: flex; justify-content: space-between; gap: 10px; }
.r-section h2 span { color: var(--r-muted); letter-spacing: 0; text-transform: none; font-weight: 700; }
.r-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.r-table th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--r-muted); padding: 6px 4px; border-bottom: 1px solid var(--r-line); }
.r-table td { padding: 7px 4px; border-bottom: 1px solid var(--r-line); vertical-align: top; }
.r-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-table tfoot td { border-bottom: 0; padding-top: 6px; font-weight: 700; }
.r-table tr.is-new td { background: #FFF7E8; }
.r-table .r-forms { color: var(--r-muted); font-size: 12px; }
.r-saldo {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 18px; border-radius: 10px; background: var(--r-brand); color: #fff; margin: 8px 0 14px;
}
.r-saldo span { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.9; }
.r-saldo strong { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.r-saldo.is-paid { background: #1E7A4C; }
.r-account { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--r-muted); padding: 0 4px 10px; }
.r-account strong { color: var(--r-ink); }
.r-puntos strong { color: var(--r-brand); }
/* Condiciones del programa de puntos: letra chica, al pie, como en cualquier comprobante. */
.r-terminos { font-size: 10.5px; line-height: 1.45; color: var(--r-muted); padding: 8px 10px; margin-bottom: 12px; border-radius: 6px; background: var(--r-soft); }
.r-terminos strong { color: var(--r-ink); }
/* Recibos largos (muchos artículos o muchos pagos): todo más junto, para que no se vaya de hoja. */
.receipt.is-largo { font-size: 12.5px; }
.receipt.is-largo .r-table { font-size: 12px; }
.receipt.is-largo .r-table td { padding: 4px 4px; }
.receipt.is-largo .r-table th { padding: 4px 4px; }
.receipt.is-largo .r-section { margin-bottom: 12px; }
.receipt.is-largo .r-client { padding: 8px 12px; margin-bottom: 12px; }
.receipt.is-largo .r-saldo strong { font-size: 22px; }
/* Comprobante de puntos y letra chica de los puntos en el recibo. */
/* Letra del comprobante: «chica» (la que viene) y «muy chica», para que entre lo máximo posible en una hoja o
   en un ticket. Se elige arriba del comprobante y queda guardada en el aparato. */
/* Estado de cuenta compacto: una fila por compra. */
.r-subt { color: var(--r-ink) !important; font-weight: 700; }
.r-fecha { font-weight: 700; white-space: nowrap; }
.r-hist td:first-child { width: 100%; }
.receipt.is-ticket .r-hist .col-pagado { display: none; }
.receipt.is-ticket .r-hist .r-fecha { display: block; }
.r-nro { font-weight: 600; color: var(--r-muted); }
.r-sub-puntos { margin-top: 14px; }
/* Lista de pagos del estado de cuenta: un renglón por pago; en hoja A4 (pantalla ancha e impresión), dos columnas.
   Medido al imprimir: 25 compras con 38 pagos, letra muy chica, 1,25 hojas en dos columnas y 1,54 en una. */
.r-pagos { list-style: none; margin: 0; padding: 0; font-size: 0.95em; }
.r-pagos li { display: flex; gap: 8px; justify-content: space-between; align-items: baseline; padding: 3px 2px; border-bottom: 1px solid var(--r-line); break-inside: avoid; page-break-inside: avoid; }
.r-pagos .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-pagos .r-forms { color: var(--r-muted); }
@media (min-width: 700px), print {
  .receipt:not(.is-ticket) .r-pagos { columns: 2; column-gap: 22px; }
}
.receipt-opciones { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 4px 0 2px; }
.r-tamano { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.r-tamano input[type="range"] { width: 150px; accent-color: var(--berry); }
.r-tamano output { min-width: 3.2em; font-weight: 800; font-variant-numeric: tabular-nums; }
.seg-label { align-self: center; padding: 0 8px 0 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.r-chica { font-size: 11px; color: var(--r-muted); line-height: 1.4; margin-top: 4px; }
.r-puntos-gran { font-family: var(--font-brand); font-size: 44px; font-weight: 600; color: var(--r-brand); line-height: 1.05; margin: 6px 0 10px; }
.r-puntos-gran small { font-family: var(--font-ui); font-size: 15px; font-weight: 700; color: var(--r-ink); }
.r-foot { text-align: center; padding-top: 14px; border-top: 1px solid var(--r-line); display: flex; flex-direction: column; gap: 4px; }
.r-thanks { font-family: var(--font-brand); font-style: italic; font-size: 18px; color: var(--r-brand); }
.r-legal { font-size: 11px; color: var(--r-muted); }

.receipt.is-ticket { max-width: calc(302px / var(--r-zoom, 1)); padding: 16px 14px; font-size: 12px; border-radius: 2px; }
.receipt.is-ticket .r-head { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.receipt.is-ticket .r-logo { width: calc(170px * var(--logo-escala, 1)); max-width: 100%; }
.receipt.is-ticket.cab-color .r-head { margin: -16px -14px 0; padding: 14px 14px 12px; }
.receipt.is-ticket .r-doc { text-align: center; }
.receipt.is-ticket .r-doc h1 { font-size: 20px; }
.receipt.is-ticket .r-contact { justify-content: center; text-align: center; }
.receipt.is-ticket .r-client { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 8px 10px; }
.receipt.is-ticket .r-table { font-size: 11.5px; }
.receipt.is-ticket .r-saldo strong { font-size: 20px; }
@media (max-width: 560px) {
  .receipt:not(.is-ticket) { padding: 22px 18px; }
  .receipt:not(.is-ticket) .r-head { flex-direction: column; align-items: flex-start; }
  .receipt:not(.is-ticket).cab-color .r-head { margin: -22px -18px 0; padding: 18px 18px 14px; }
  .receipt:not(.is-ticket) .r-doc { text-align: left; }
  .receipt:not(.is-ticket) .r-client { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  body.route-print { background: #fff; }
  body.route-print .sidebar,
  body.route-print .topbar,
  body.route-print .mock-strip,
  body.route-print .tabbar,
  body.route-print .no-print,
  body.route-print .toast-host,
  body.route-print .guide { display: none !important; }
  body.route-print .app { display: block; }
  body.route-print .view { padding: 0; max-width: none; }
  body.route-print .page { gap: 0; }
  body.route-print .receipt-stage { padding: 0; background: none; border-radius: 0; }
  body.route-print .receipt { box-shadow: none; max-width: none; border-radius: 0; padding: 0; }
  body.route-print .receipt.is-ticket { max-width: none; }
  /* Impreso el recibo no tiene margen propio: la franja de color va pegada al borde útil de la hoja. */
  body.route-print .receipt.cab-color .r-head { margin: 0; padding: 12px 14px; }
  .receipt, .receipt * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Muchos artículos = varias hojas: que nada se parta al medio y que el encabezado se repita. */
  .receipt .r-table thead { display: table-header-group; }
  .receipt .r-table tfoot { display: table-row-group; }
  .receipt .r-table tr,
  .receipt .r-client,
  .receipt .r-saldo,
  .receipt .r-favor,
  .receipt .r-terminos,
  .receipt .r-foot { break-inside: avoid; page-break-inside: avoid; }
  .receipt .r-head,
  .receipt .r-section h2,
  .receipt .r-sub { break-after: avoid; page-break-after: avoid; }
  .receipt .r-foot { break-before: avoid; page-break-before: avoid; }
}

/* ── Tema, saldo a favor, cuotas, devoluciones, meta y rotación ───────── */

:root { --favor: #7A4F00; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --favor: #F2C879; }
}
:root[data-theme="dark"] { --favor: #F2C879; }

.btn-tema { color: var(--ink-2); }
.seg-tema button .i { width: 16px; height: 16px; }
.sheet-tema { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px 10px 12px; }
.login-tema { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

.pill-favor { background: var(--glow-soft); color: var(--favor); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--glow) 70%, transparent); }
.t-favor { color: var(--favor); font-weight: 700; }
.t-devuelto { color: var(--warn); font-weight: 700; }
.favor-banner {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px 18px; align-items: center;
  padding: 16px 20px; border-radius: 16px; background: var(--glow-soft); color: var(--ink);
  border: 1.5px solid color-mix(in srgb, var(--glow) 55%, transparent); border-left: 6px solid var(--glow);
}
.favor-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--glow); color: #2B1624; }
.favor-ic .i { width: 24px; height: 24px; }
.favor-label { font-size: 12.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--favor); }
.favor-monto { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--favor); font-variant-numeric: tabular-nums; }
.favor-banner .small { color: var(--ink-2); }
.favor-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 440px; }
.favor-banner-sm { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px 14px; gap: 10px 12px; border-radius: 12px; border-left-width: 5px; }
.favor-banner-sm .favor-ic { width: 36px; height: 36px; }
.favor-banner-sm .favor-ic .i { width: 20px; height: 20px; }
.favor-banner-sm .grow { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 760px) {
  .favor-banner { grid-template-columns: auto minmax(0, 1fr); padding: 14px 16px; }
  .favor-actions { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
  .favor-actions .btn { flex: 1 1 calc(50% - 8px); }
  .favor-banner-sm > .btn { grid-column: 1 / -1; justify-self: start; }
}
.tile-favor { background: var(--glow-soft); border-color: color-mix(in srgb, var(--glow) 60%, transparent); }
.tile-favor .tile-value { color: var(--favor); }
.tile-favor .tile-label { display: inline-flex; align-items: center; gap: 6px; }
.tile-bad .tile-value { color: var(--bad); }
.card-favor { border-color: color-mix(in srgb, var(--glow) 55%, transparent); }
.card-head h2 { display: inline-flex; align-items: center; gap: 8px; }
.card-head-wrap { flex-wrap: wrap; }
.pad-top { padding: 10px 20px 0; }
.pad-x-card { margin: 10px 20px 0; }
.favor-total strong { font-size: 22px; color: var(--favor); font-variant-numeric: tabular-nums; }
.line-favor { background: var(--glow-soft); border-color: transparent; }
.row-nowrap { flex-wrap: nowrap; }
.row-nowrap .money { flex: 1 1 auto; min-width: 0; }
/* «Lo que llevó antes del sistema»: artículo a lo ancho, cantidad y precio con ancho fijo. */
.ca-fila.row-nowrap .money, .ca-cab .ca-c-precio { flex: 0 0 150px; width: 150px; }
.ca-fila .input-cant, .ca-cab .ca-c-cant { flex: 0 0 62px; width: 62px; text-align: center; }
.ca-cab { font-size: 12px; font-weight: 700; color: var(--muted); }
@media (max-width: 420px) {
  .ca-fila.row-nowrap .money, .ca-cab .ca-c-precio { flex-basis: 132px; width: 132px; }
  .ca-fila .input-cant, .ca-cab .ca-c-cant { flex-basis: 44px; width: 44px; padding-left: 4px; padding-right: 4px; }
}
/* Cantidad con − y + (agregar artículos a una compra). */
.qty { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: var(--surface); }
.qty .btn-icon { width: 32px; height: 32px; font-size: 18px; font-weight: 800; }
.qty-n { min-width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.pill-quieto { margin-top: 4px; }

/* Meta y comisión */
.meta-box { display: flex; flex-direction: column; gap: 10px; }
.meta-top { display: flex; align-items: center; gap: 12px; }
.meta-top .grow { display: flex; flex-direction: column; }
.meta-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--berry-soft); color: var(--berry); flex: none; }
.meta-pct { font-size: 22px; font-weight: 800; color: var(--berry); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 10px; border-radius: 999px; background: var(--chart-grid); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--berry), var(--glow)); }
.meta-nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; }
.meta-nums dt { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.meta-nums dd { margin: 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Cuotas */
.plan-editor { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1.5px dashed var(--line-strong); border-radius: 12px; }
.plan-preview { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.plan-preview li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px dashed var(--line); }
.plan-preview li strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cuotas { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.cuota { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.cuota:first-child { border-top: 0; padding-top: 0; }
.cuota .grow { display: flex; flex-direction: column; min-width: 0; }
.cuota-n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); font-weight: 800; flex: none; }
.cuota-pagada .cuota-n { background: var(--good-soft); color: var(--good); }
.cuota-vencida .cuota-n { background: var(--bad-soft); color: var(--bad); }
.cuota-hoy .cuota-n, .cuota-semana .cuota-n { background: var(--warn-soft); color: var(--warn); }
.cuota-sinCargo .row-title { text-decoration: line-through; color: var(--muted); }
.cuota-aviso { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.cuota-aviso > .i { color: var(--berry); }
.cuota-fila { align-items: flex-start; }
.cuota-fila .row-end { gap: 6px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 560px) {
  .cuota-fila { flex-wrap: wrap; }
  .cuota-fila .row-main { flex: 1 1 calc(100% - 60px); }
  .cuota-fila .row-end { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; padding-left: 52px; }
  .cuota-fila .row-actions { justify-content: flex-start; }
}

/* Recibo: saldo a favor y cuotas atrasadas */
.r-favor {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 16px; border-radius: 10px; margin: 0 0 12px;
  background: #FBF0DC; color: #6B4600; border: 1.5px solid #E2A94F;
}
.r-favor span { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.r-favor strong { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.r-table tr.is-late td { color: #B42A2A; font-weight: 700; }
/* La barra de arriba entra en 360 px aunque tenga el botón de tema: el buscador es el que se achica. */
.topbar .search, .topbar .search-box { min-width: 0; }
@media (max-width: 899px) { .topbar-actions { gap: 2px; } }
/* Tablas de reportes en el celular: se ocultan las columnas secundarias para que entren sin deslizar tanto. */
@media (max-width: 560px) { .col-sm-hide { display: none; } }

/* ── Perfil del dueño: gastos, conteo, pedidos, crédito y clientas frecuentes ── */

/* Avisos cortos al vender (lo único que ve la vendedora de estos temas) */
.avisos:empty { display: none; }
.aviso { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: var(--surface-2); color: var(--ink); }
.aviso > .i { flex: none; }
.aviso .grow { min-width: 0; }
.aviso-warn { background: var(--warn-soft); color: var(--warn); }
.aviso-warn strong { color: inherit; }
.aviso-regalo { background: var(--berry-soft); }
.aviso-regalo > .i { color: var(--berry); }
.aviso-puntos { background: var(--glow-soft); }
.aviso-puntos > .i { color: var(--favor); }

/* Estado de resultados */
.pyl { display: flex; flex-direction: column; margin: 0; }
.pyl-fila { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.pyl-fila:first-child { border-top: 0; }
.pyl-fila dt { font-size: 14px; color: var(--ink-2); }
.pyl-fila dt small { display: block; font-size: 12px; color: var(--muted); }
.pyl-fila dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pyl-sub dt, .pyl-sub dd { color: var(--ink); font-weight: 800; }
.pyl-total { border-top: 2px solid var(--line-strong); margin-top: 4px; padding-top: 10px; }
.pyl-total dt { color: var(--ink); font-weight: 800; font-size: 15px; }
.pyl-total dd { font-size: 20px; font-weight: 800; color: var(--good); }
.pyl-neg dd { color: var(--bad); }
.tile-good .tile-value { color: var(--good); }

/* Conteo de inventario */
.conteo-fila { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.conteo-fila:first-child { border-top: 0; }
.conteo-fila .grow { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.conteo-fin { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.conteo-input { width: 76px; min-height: 40px; text-align: center; }
.conteo-motivo { max-width: 260px; min-height: 36px; font-size: 14px; padding: 6px 8px; }
.conteo .empty { border-top: 0; }

/* Pedidos: tres pasos */
.steps-track.steps-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 620px) { .steps-track.steps-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; } }

/* Ficha: crédito y beneficios */
.grid-mini { gap: 14px 22px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stack-sm p .i { vertical-align: -3px; color: var(--muted); }
.progress-warn > span { background: var(--warn); }
.progress-bad > span { background: var(--bad); }

/* Tablas para cargar artículos: en el celular cada fila es una tarjeta con sus etiquetas. */
@media (max-width: 620px) {
  .table-tarjetas thead { display: none; }
  .table-tarjetas, .table-tarjetas tbody { display: block; }
  .table-tarjetas tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 12px; border-bottom: 1px solid var(--line); position: relative; }
  .table-tarjetas td { display: flex; flex-direction: column; gap: 4px; padding: 0 !important; border: 0 !important; text-align: left; min-width: 0; }
  .table-tarjetas td::before { content: attr(data-label); font-size: 12px; font-weight: 700; color: var(--muted); }
  .table-tarjetas td.te-desc { grid-column: 1 / -1; padding-right: 44px !important; }
  .table-tarjetas td.te-desc .input { min-width: 0 !important; }
  .table-tarjetas td.te-nota { grid-column: 1 / -1; }
  .table-tarjetas td.te-quitar { position: absolute; top: 12px; right: 8px; }
  .table-tarjetas td.num { text-align: left; font-weight: 700; }
  .table-tarjetas .w-xs, .table-tarjetas .w-sm { width: 100%; }
}

/* Legibilidad: suavizado fino solo en modo oscuro (en claro la letra queda más firme) y tamaños mínimos cómodos. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { -webkit-font-smoothing: antialiased; } }
:root[data-theme="dark"] body { -webkit-font-smoothing: antialiased; }
@media (max-width: 760px) { .page-title { font-size: 25px; } }
.row-sub, .tile-sub, .small { font-size: 13.5px; }
.eyebrow { letter-spacing: 0.06em; }

/* Celulares angostos (360 px): celdas más justas para que las tablas cortas entren enteras y no se corte la última columna (el monto). */
@media (max-width: 380px) {
  .table:not(.table-edit):not(.table-venta) { font-size: 13.5px; }
  .table:not(.table-edit):not(.table-venta) th, .table:not(.table-edit):not(.table-venta) td { padding-left: 8px; padding-right: 8px; }
  .table th { letter-spacing: 0.02em; }
}
@media (max-width: 380px) {
  /* En las tablas compactas lo que ensancha las columnas de números es el título en mayúsculas, no el dato. */
  .table-venta th { font-size: 11px; letter-spacing: 0; padding-left: 5px; padding-right: 5px; }
  .table-venta td { padding-left: 5px; padding-right: 5px; }
}

/* Datos reales traídos del Excel: la franja cambia de color para que nunca se confundan con los de ejemplo. */
.mock-strip-mios { background: var(--good-soft); color: var(--good); }
/* Aviso de versión nueva: el navegador puede estar corriendo la de ayer. */
.version-nueva {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  padding: 10px 16px; font-size: 14px; font-weight: 700;
  background: var(--berry); color: var(--on-berry); box-shadow: var(--shadow-2);
}
.version-nueva .btn { background: var(--surface); color: var(--berry); border-color: var(--surface); }
/* Estado de guardado en la nube: la persona tiene que ver de un vistazo si lo suyo ya subió. */
.nube-estado { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.nube-sin-conexion, .nube-conflicto, .nube-version-nueva { color: var(--bad); }
.nube-guardando, .nube-conectando { color: var(--ink-2); }
.mock-strip-mios strong { color: var(--good); }

/* Traer mis datos del Excel */
.mx-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mx-item { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.mx-item .i { flex: none; margin-top: 2px; }
.mx-bad .i { color: var(--bad); }
.mx-warn .i { color: var(--warn); }
.mx-info .i { color: var(--muted); }
.mx-hojas .list-row { gap: 12px; }
.mx-hoja.is-off .row-main { opacity: 0.55; }
.mx-check { width: 20px; height: 20px; flex: none; accent-color: var(--berry); }
.mx-fecha { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.mx-fecha .input { width: 152px; min-height: 38px; padding: 6px 8px; }
.mx-grupo { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.mx-variantes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mx-variantes label { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.mx-variantes input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--berry); }
@media (max-width: 560px) {
  .mx-hoja { flex-wrap: wrap; }
  .mx-hoja .row-main { flex-basis: calc(100% - 40px); }
  .mx-fecha { flex-direction: row; align-items: center; gap: 8px; margin-left: 32px; }
}
.mx-archivo { overflow-wrap: anywhere; }
.callout span { min-width: 0; overflow-wrap: anywhere; }

/* ── Cobranza, apartados, lo que piden y el resumen del día ──────────────── */
.practica { border-top: 1px solid var(--line); padding-top: 10px; }
.practica summary { cursor: pointer; }
.practica[open] summary { margin-bottom: 8px; }
.cuota-fila .row-end .pill { white-space: normal; }

/* ── Dar puntos a mano: cantidad de 10 en 10 ─────────────────────────────── */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper .input { max-width: 120px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.stepper .btn-icon { width: 44px; height: 44px; font-size: 22px; font-weight: 800; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.stepper .btn-icon:disabled { opacity: .4; }

/* Ajustes → Clientas frecuentes: cuánto cuesta el programa de puntos */
.costo-puntos { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.costo-titulo { font-size: 15px; font-weight: 700; color: var(--ink); }
.table tr.is-late td { color: var(--bad); font-weight: 700; }

/* ── Estado de cuenta como ficha y recibo de un pago (HANDOFF §28) ── */
.r-resumen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.r-resumen > div { padding: 10px 12px; border-radius: 8px; background: var(--r-soft); border: 1px solid var(--r-line); }
.r-resumen span { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--r-muted); }
.r-resumen strong { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-resumen .r-res-falta { background: var(--r-brand); border-color: var(--r-brand); }
.r-resumen .r-res-falta span, .r-resumen .r-res-falta strong { color: #fff; }
.r-det-tit { margin: 18px 0 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--r-brand); }
.r-libro td { vertical-align: top; }
/* Verde = lo que ya se pagó (fondo suave y una barra al costado). Solo refuerza: cada cosa también lo dice con palabras y tildes,
   porque el ticket de 80 mm sale en blanco y negro. El rosa de la marca queda para lo que falta. */
.receipt { --r-ok: #1E7A4C; --r-ok-soft: #EDF7F1; --r-ok-line: #BFE0CC; }
.r-resumen .r-res-pagado { background: var(--r-ok-soft); border-color: var(--r-ok-line); box-shadow: inset 4px 0 0 var(--r-ok); }
.r-resumen .r-res-pagado span, .r-resumen .r-res-pagado strong { color: var(--r-ok); }
.r-libro tr.l-pago td { background: var(--r-ok-soft); border-bottom-color: var(--r-ok-line); }
.r-libro tr.l-pago td.l-fecha { box-shadow: inset 4px 0 0 var(--r-ok); padding-left: 10px; }
.r-libro tr.l-pago .l-abono, .r-libro tr.l-pago .l-imp { color: var(--r-ok); font-weight: 700; }
.r-aplic tr.is-saldada td, .r-aplic tr.is-parcial td { background: var(--r-ok-soft); border-bottom-color: var(--r-ok-line); }
.r-aplic tr.is-saldada td:first-child, .r-aplic tr.is-parcial td:first-child { box-shadow: inset 4px 0 0 var(--r-ok); padding-left: 10px; }
.r-aplic tr.is-saldada td:last-child { color: var(--r-ok); }
.r-aplic tr.is-parcial td:last-child { color: var(--r-brand); }
.r-table tr.r-pagada td { background: var(--r-ok-soft); border-bottom-color: var(--r-ok-line); }
.r-table tr.r-pagada td:first-child { box-shadow: inset 4px 0 0 var(--r-ok); padding-left: 10px; }
.r-table tr.r-pagada.is-new td { background: #DBEFE3; }
.r-table td.is-ok { background: var(--r-ok-soft); color: var(--r-ok); font-weight: 700; }
.r-hist tr.is-saldada td { background: var(--r-ok-soft); border-bottom-color: var(--r-ok-line); }
.r-hist tr.is-saldada td:first-child { box-shadow: inset 4px 0 0 var(--r-ok); padding-left: 10px; }
.r-pagos li { background: var(--r-ok-soft); border-bottom-color: var(--r-ok-line); box-shadow: inset 4px 0 0 var(--r-ok); padding-left: 10px; }
.r-libro .l-imp, .r-libro .l-fechat { display: none; }
.r-libro .l-fecha { white-space: nowrap; }
.r-debe .col-pagado { white-space: nowrap; }
.r-cobro { margin-top: 2px; }
/* Recibo de un pago: lo entregado, bien grande, y debajo a qué compras se aplicó. */
.r-pago-caja { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; border-radius: 10px; border: 2px solid var(--r-ok); background: var(--r-ok-soft); }
.r-pago-caja span { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--r-ok); }
.r-pago-caja strong { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--r-ok); }
.r-pago-sub { margin-top: 6px; font-size: 13px; color: var(--r-muted); }
.r-aplic .i { width: 13px; height: 13px; stroke-width: 3; vertical-align: -1px; }
.r-aplic tbody td { vertical-align: top; }
/* Ticket de 80 mm: la fecha va dentro del texto, una sola columna de importe y el resumen en renglones. */
.receipt.is-ticket .r-libro .l-fecha, .receipt.is-ticket .r-libro .l-cargo, .receipt.is-ticket .r-libro .l-abono { display: none; }
.receipt.is-ticket .r-libro .l-imp, .receipt.is-ticket .r-libro .l-fechat { display: table-cell; }
.receipt.is-ticket .r-libro .l-fechat { display: block; }
.receipt.is-ticket .r-libro tr.l-pago td.l-que { box-shadow: inset 3px 0 0 var(--r-ok); padding-left: 8px; }
.receipt.is-ticket .r-resumen { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.receipt.is-ticket .r-resumen > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 6px 10px; }
.receipt.is-ticket .r-resumen strong { font-size: 15px; }
.receipt.is-ticket .r-pago-caja { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; }
.receipt.is-ticket .r-pago-caja strong { font-size: 22px; }
.receipt.is-ticket .r-debe .col-pagado { display: none; }
@media (max-width: 560px) {
  .receipt:not(.is-ticket) .r-resumen { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .receipt:not(.is-ticket) .r-resumen > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  .receipt:not(.is-ticket) .r-libro .l-fecha, .receipt:not(.is-ticket) .r-libro .l-cargo, .receipt:not(.is-ticket) .r-libro .l-abono { display: none; }
  .receipt:not(.is-ticket) .r-libro .l-imp { display: table-cell; }
  .receipt:not(.is-ticket) .r-libro .l-fechat { display: block; }
  .receipt:not(.is-ticket) .r-libro tr.l-pago td.l-que { box-shadow: inset 4px 0 0 var(--r-ok); padding-left: 10px; }
  .receipt:not(.is-ticket) .r-pago-caja strong { font-size: 24px; }
}
@media print {
  .receipt .r-resumen > div,
  .receipt .r-pago-caja { break-inside: avoid; page-break-inside: avoid; }
}
/* Un botón con texto largo dentro de un aviso (por ejemplo «Sumar los puntos de lo ya pagado») pasa a dos renglones en vez de salirse en celulares angostos. */
.callout > div { min-width: 0; }
.callout .btn { white-space: normal; text-align: left; max-width: 100%; height: auto; min-height: 36px; }

/* ── Lo anulado en los comprobantes (HANDOFF §29) ──
   Se dice con palabras («COMPRA ANULADA», «PAGO ANULADO»): el ticket sale en blanco y negro. El gris, el borde punteado y el importe tachado solo refuerzan. */
.r-anulada { margin: 0 0 10px; padding: 9px 12px; border: 2px dashed var(--r-muted); border-radius: 8px; font-size: 13px; }
.r-pago-caja.is-anulado { border: 2px dashed var(--r-muted); background: #fff; }
.r-pago-caja.is-anulado span, .r-pago-caja.is-anulado strong { color: var(--r-muted); }
.r-pago-caja.is-anulado strong { text-decoration: line-through; }
.r-saldo.is-anulada { background: var(--r-muted); }
.r-pago-anulado td { color: var(--r-muted); }
.r-pago-anulado .num { text-decoration: line-through; }

/* Ajustes → Usuarios y permisos: los permisos agrupados por tarea (HANDOFF §29). */
.perm-grupo { margin: 16px 0 4px; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
