/* CrediPremium — el talonario de cobro: blanco y dorado (o negro y dorado), con rojo de mora y verde de pagado.
   Pensado primero para el celular del cobrador; en pantallas grandes aparece el menú lateral.
   Lo único llamativo es el talonario (borde perforado, número en rojo y sello PAGADO), y solo en lo que tiene que ver con pagos. */

/* ---------- Colores y medidas ---------- */
/* Modo claro: blanco y dorado, con rojo (mora, atraso) y verde (pagado, al día).
   Modo oscuro: negro y dorado, con rojo y verde neón. El dorado de botones y fondos es brillante;
   el dorado para texto sobre blanco es más oscuro para que se lea bien. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --paper: #fbf8f1;
  --hover: #f8f2e2;
  --ink: #17130b;
  --muted: #5f5747;
  --faint: #6f6654;
  --line: #ece6d8;
  --line-strong: #d6ccb5;
  --focus: #b58612;

  /* Dorado: color principal (botones, selección, acentos). */
  --brand: #d4a42a;
  --brand-strong: #c29320;
  --on-brand: #17130b;
  --brand-soft: #fbf3dc;
  --brand-soft-2: #f2e2b3;
  --brand-text: #7a5805;
  --link: #865f06;
  --link-hover: #5b4103;

  --gold: #d4a42a;
  --gold-hover: #e0b443;
  --gold-soft: #fcf6e4;
  --gold-line: #ecd79c;
  --gold-text: #7a5805;
  --gold-glow: rgba(212, 164, 42, 0.18);
  --on-gold: #1d1604;

  /* Verde: pagado, al día, todo bien. */
  --ok: #16a34a;
  --ok-2: #65a30d;
  --ok-soft: #eaf8ef;
  --ok-line: #bfe6cb;
  --ok-text: #136b33;

  /* Sello de "Pagado". */
  --stamp: #15803d;
  --stamp-soft: #eaf8ef;

  /* Rojo: mora, atraso, peligro. */
  --red: #d32f2f;
  --red-soft: #fdeded;
  --red-line: #f4c4c4;
  --red-text: #9f1d1d;
  --amber: #8f6100;
  --amber-soft: #fdf3da;
  --amber-line: #ecd79c;
  --wa: #12803f;
  --wa-hover: #0e6a34;

  /* Marco de la página (menú, barra, portada, pie): blanco en modo claro, negro en modo oscuro. */
  --night: #ffffff;
  --night-2: #f8f2e2;
  --night-line: #ece6d8;
  --night-line-strong: #cdbf9c;
  --night-hover: rgba(212, 164, 42, 0.12);
  --on-night: #3a3224;
  --on-night-strong: #17130b;
  --on-night-muted: #675c48;
  --on-night-faint: #6f6654;

  /* Acentos negros con texto blanco (resúmenes, selección en botones segmentados). */
  --ink-bg: #17130b;
  --on-ink: #ffffff;
  --on-ink-muted: #cdbf9f;
  --on-ink-red: #ff8a7d;

  --age-1: #d9a33a;
  --age-2: #d2772d;
  --age-3: #c93a2c;
  --age-4: #8f1d16;

  --shadow-1: 0 1px 2px rgba(20, 16, 8, 0.05), 0 3px 10px rgba(20, 16, 8, 0.05);
  --shadow-pop: 0 20px 56px rgba(20, 16, 8, 0.22);
  --scrim: rgba(20, 16, 8, 0.5);

  --display: 'Archivo', 'Arial Narrow', 'Segoe UI', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;

  --r-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --r-lg: 20px;
  --sidebar: 256px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* Nombres anteriores, usados todavía en algunas vistas. */
  --green-950: var(--ink-bg);
  --green-900: var(--ink-bg);
  --green-800: var(--ok-text);
  --green-700: var(--ok);
  --green-500: var(--ok);
  --green-100: var(--ok-line);
  --green-50: var(--ok-soft);
  --gold-600: var(--gold-text);
  --gold-50: var(--gold-soft);
  --red-50: var(--red-soft);
  --amber-50: var(--amber-soft);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #0d0c09;
    --paper: #080705;
    --hover: #18150d;
    --ink: #f3ecdc;
    --muted: #b5ab92;
    --faint: #9c927b;
    --line: #241f15;
    --line-strong: #3b3323;
    --focus: #f2c55a;
    --brand: #e6b43c;
    --brand-strong: #f2c55a;
    --on-brand: #0a0804;
    --brand-soft: #1f190b;
    --brand-soft-2: #3a2e12;
    --brand-text: #f3cd6b;
    --link: #f0c55c;
    --link-hover: #ffdd8a;
    --gold: #e6b43c;
    --gold-hover: #f2c55a;
    --gold-soft: #1a1409;
    --gold-line: #4a3b17;
    --gold-text: #f3cd6b;
    --gold-glow: rgba(230, 180, 60, 0.16);
    --on-gold: #0a0804;
    --ok: #39ff88;
    --ok-2: #b4ff4f;
    --ok-soft: #04240f;
    --ok-line: #0d5a2b;
    --ok-text: #5cff9d;
    --stamp: #39ff88;
    --stamp-soft: #04240f;
    --red: #ff4d5e;
    --red-soft: #2c080d;
    --red-line: #5e1720;
    --red-text: #ff9aa3;
    --amber: #ffc04d;
    --amber-soft: #2a1f06;
    --amber-line: #533d10;
    --wa: #16a34a;
    --wa-hover: #1fb85a;
    --night: #000000;
    --night-2: #100d07;
    --night-line: rgba(230, 180, 60, 0.16);
    --night-line-strong: rgba(230, 180, 60, 0.45);
    --night-hover: rgba(230, 180, 60, 0.09);
    --on-night: #e9e1cc;
    --on-night-strong: #ffffff;
    --on-night-muted: #b2a88e;
    --on-night-faint: #958b74;
    --ink-bg: #231b0b;
    --on-ink: #ffffff;
    --on-ink-muted: #cfc29d;
    --on-ink-red: #ff6b78;
    --age-1: #ffc04d;
    --age-2: #ff8f3d;
    --age-3: #ff5a4f;
    --age-4: #ff9aa3;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 20px 56px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(230, 180, 60, 0.14);
    --scrim: rgba(0, 0, 0, 0.72);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #0d0c09;
  --paper: #080705;
  --hover: #18150d;
  --ink: #f3ecdc;
  --muted: #b5ab92;
  --faint: #9c927b;
  --line: #241f15;
  --line-strong: #3b3323;
  --focus: #f2c55a;
  --brand: #e6b43c;
  --brand-strong: #f2c55a;
  --on-brand: #0a0804;
  --brand-soft: #1f190b;
  --brand-soft-2: #3a2e12;
  --brand-text: #f3cd6b;
  --link: #f0c55c;
  --link-hover: #ffdd8a;
  --gold: #e6b43c;
  --gold-hover: #f2c55a;
  --gold-soft: #1a1409;
  --gold-line: #4a3b17;
  --gold-text: #f3cd6b;
  --gold-glow: rgba(230, 180, 60, 0.16);
  --on-gold: #0a0804;
  --ok: #39ff88;
  --ok-2: #b4ff4f;
  --ok-soft: #04240f;
  --ok-line: #0d5a2b;
  --ok-text: #5cff9d;
  --stamp: #39ff88;
  --stamp-soft: #04240f;
  --red: #ff4d5e;
  --red-soft: #2c080d;
  --red-line: #5e1720;
  --red-text: #ff9aa3;
  --amber: #ffc04d;
  --amber-soft: #2a1f06;
  --amber-line: #533d10;
  --wa: #16a34a;
  --wa-hover: #1fb85a;
  --night: #000000;
  --night-2: #100d07;
  --night-line: rgba(230, 180, 60, 0.16);
  --night-line-strong: rgba(230, 180, 60, 0.45);
  --night-hover: rgba(230, 180, 60, 0.09);
  --on-night: #e9e1cc;
  --on-night-strong: #ffffff;
  --on-night-muted: #b2a88e;
  --on-night-faint: #958b74;
  --ink-bg: #231b0b;
  --on-ink: #ffffff;
  --on-ink-muted: #cfc29d;
  --on-ink-red: #ff6b78;
  --age-1: #ffc04d;
  --age-2: #ff8f3d;
  --age-3: #ff5a4f;
  --age-4: #ff9aa3;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 20px 56px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(230, 180, 60, 0.14);
  --scrim: rgba(0, 0, 0, 0.72);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 72px;
}
body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  color: var(--link-hover);
}
h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-stretch: 108%;
  line-height: 1.12;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 {
  font-size: 1.75rem;
  font-weight: 800;
}
h2 {
  font-size: 1.3rem;
  font-weight: 750;
}
h3 {
  font-size: 1.08rem;
  font-weight: 700;
}
p {
  margin: 0 0 1em;
}
small,
.small {
  font-size: 0.875rem;
}
.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.num,
table {
  font-variant-numeric: tabular-nums;
}
.nowrap {
  white-space: nowrap;
}
.right {
  text-align: right;
}
.center {
  text-align: center;
}
.red {
  color: var(--red);
}
.hidden,
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--gold);
  color: var(--night);
  padding: 10px 14px;
  border-radius: var(--r-xs);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus {
  top: 10px;
}
.i {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.i-lg {
  width: 22px;
  height: 22px;
}
kbd {
  font: 600 0.75rem/1 var(--body);
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface);
}

/* Montos grandes: la letra ancha de los billetes. */
.money,
.k-value,
.collect-amount,
.done-amount,
.plan-amount,
.price-amount,
.owed b,
.today-tally b,
.cr-due b,
.closing-amounts b,
.fact b,
.sim-total b,
.score-dial b {
  font-family: var(--display);
  font-stretch: 110%;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: 700 0.95rem/1.2 var(--body);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.12s var(--ease);
}
.btn:active:not([disabled]) {
  transform: translateY(1px) scale(0.985);
}
.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}
.btn-primary:hover {
  background: var(--brand-strong);
  color: var(--on-brand);
}
.btn-gold {
  background: var(--gold);
  color: var(--on-gold);
}
.btn-gold:hover {
  background: var(--gold-hover);
  color: var(--on-gold);
}
.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand-text);
}
.btn-outline-light {
  background: transparent;
  border-color: var(--night-line-strong);
  color: var(--on-night-strong);
}
.btn-outline-light:hover {
  border-color: var(--on-night-strong);
  color: var(--on-night-strong);
  background: var(--night-hover);
}
.btn-quiet {
  background: transparent;
  color: var(--link);
  padding-inline: 10px;
}
.btn-quiet:hover {
  background: var(--brand-soft);
  color: var(--link-hover);
}
.btn-danger {
  background: var(--surface);
  border-color: var(--red-line);
  color: var(--red);
}
.btn-danger:hover {
  background: var(--red-soft);
  color: var(--red);
}
.btn-danger-solid {
  background: var(--red);
  color: #fff;
}
.btn-danger-solid:hover {
  background: var(--red-text);
  color: #fff;
}
.btn-wa {
  background: var(--wa);
  color: #fff;
}
.btn-wa:hover {
  background: var(--wa-hover);
  color: #fff;
}
.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.875rem;
}
.btn-lg {
  min-height: 54px;
  font-size: 1.05rem;
  border-radius: 12px;
}
.btn-block {
  width: 100%;
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn.danger-text {
  color: var(--red);
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
/* Mientras se envía un formulario, el botón muestra un círculo que gira. */
.btn.is-busy {
  color: transparent !important;
  pointer-events: none;
}
.btn.is-busy::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-color: var(--on-brand) var(--on-brand) transparent transparent;
  animation: spin 0.7s linear infinite;
}
.btn-ghost.is-busy::after,
.btn-quiet.is-busy::after,
.btn-danger.is-busy::after {
  border-color: var(--ink) var(--ink) transparent transparent;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Formularios ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  min-width: 0;
}
.field > label,
.label {
  font-weight: 700;
  font-size: 0.9rem;
}
.hint {
  font-size: 0.84rem;
  color: var(--muted);
}
input[type='text'],
input[type='email'],
input[type='password'],
input[type='tel'],
input[type='number'],
input[type='date'],
input[type='search'],
input[type='url'],
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: 500 1rem/1.3 var(--body);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}
input::placeholder,
textarea::placeholder {
  color: var(--faint);
  opacity: 1;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
input[aria-invalid='true'],
input.is-invalid {
  border-color: var(--red);
}
input[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent);
}
.input-prefix {
  position: relative;
}
.input-prefix > span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  pointer-events: none;
}
.input-prefix > input {
  padding-left: 48px;
}
.input-suffix {
  position: relative;
}
.input-suffix > span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}
.input-xl > input {
  font: 800 1.45rem/1.2 var(--display);
  font-stretch: 110%;
  min-height: 58px;
  font-variant-numeric: tabular-nums;
}
/* Aviso en vivo de teléfonos y cédulas. */
.live-hint {
  font-size: 0.84rem;
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 1.3em;
  color: var(--muted);
}
.live-hint.is-ok {
  color: var(--ok-text);
}
.live-hint.is-bad {
  color: var(--red);
}
.live-hint.is-warn {
  color: var(--amber);
}
.live-hint .i {
  width: 15px;
  height: 15px;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.95rem;
  cursor: pointer;
}
.check input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--brand);
  flex: none;
}
.check-legal {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  margin-bottom: 18px;
}
.check-legal:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 0 16px;
  grid-template-columns: minmax(0, 1fr);
}
.grid-2.keep {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  max-width: 100%;
}
.segmented label {
  position: relative;
  cursor: pointer;
}
.segmented input {
  position: absolute;
  opacity: 0;
}
.segmented span {
  display: block;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.segmented label + label span {
  border-left: 1px solid var(--line-strong);
}
.segmented input:checked + span {
  background: var(--ink-bg);
  color: var(--on-ink);
}
.segmented input:focus-visible + span {
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}
.segmented-lg {
  display: flex;
  width: 100%;
}
.segmented-lg label {
  flex: 1;
}
.segmented-lg span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 10px;
  font-size: 1rem;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.form-section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.form-section:first-child {
  border-top: 0;
  padding-top: 0;
}
.form-section > h3 {
  margin-bottom: 4px;
}
.form-section > p.muted {
  margin-bottom: 14px;
}
.errors {
  background: var(--red-soft);
  border: 1px solid var(--red-line);
  border-left: 4px solid var(--red);
  color: var(--red-text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  animation: nudge 0.32s var(--ease);
}
.errors ul {
  margin: 0;
  padding-left: 18px;
}
@keyframes nudge {
  0%,
  100% {
    transform: none;
  }
  30% {
    transform: translateX(-5px);
  }
  60% {
    transform: translateX(4px);
  }
}
.file-drop {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px;
  min-height: 52px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  font-size: 0.95rem;
  position: relative;
}
.file-drop:hover {
  border-color: var(--brand);
  color: var(--brand-text);
}
.file-drop input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.file-drop:focus-within {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.needs-file .file-drop {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red-text);
}

/* ---------- Avisos ---------- */
.toast-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.flash {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 1px solid;
  background: var(--surface);
}
.flash > span {
  flex: 1;
  min-width: 0;
}
.flash-success {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok-text);
}
.flash-error {
  background: var(--red-soft);
  border-color: var(--red-line);
  color: var(--red-text);
}
.flash .toast-close {
  display: none;
}
/* Con JavaScript, los mensajes flotan como avisos (toasts) y se pueden cerrar. */
.js .toast-stack {
  position: fixed;
  z-index: 80;
  left: 12px;
  right: 12px;
  top: calc(64px + env(safe-area-inset-top));
  margin: 0;
  pointer-events: none;
}
.js .flash {
  pointer-events: auto;
  box-shadow: var(--shadow-pop);
  border-left-width: 4px;
  animation: toast-in 0.32s var(--ease) both;
}
.js .flash-success {
  border-left-color: var(--ok);
}
.js .flash-error {
  border-left-color: var(--red);
}
.js .flash .toast-close {
  display: inline-grid;
  place-items: center;
  margin: -6px -6px -6px 0;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 8px;
  cursor: pointer;
}
.js .flash .toast-close:hover {
  background: rgba(0, 0, 0, 0.06);
}
.js .flash.is-leaving {
  animation: toast-out 0.22s ease-in both;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}
.notice {
  display: flex;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  margin-bottom: 18px;
  font-size: 0.95rem;
}
.notice-red {
  background: var(--red-soft);
  border-color: var(--red-line);
}
.notice-ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
}

/* ---------- Superficies ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.panel + .panel {
  margin-top: 16px;
}
.cols > .panel + .panel,
.cols-even > .panel + .panel {
  margin-top: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head h2,
.panel-head h3 {
  margin: 0;
}
.panel-flush {
  padding: 0;
  overflow: hidden;
}
.panel-flush > .panel-head {
  padding: 14px 16px 0;
}
.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.panel-title-row h2 {
  margin: 0;
}
.stack > * + * {
  margin-top: 16px;
}
.cols,
.cols-even {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 0;
}
.dl dt {
  color: var(--muted);
  font-size: 0.9rem;
}
.dl dd {
  margin: 0;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
  border: 0;
}
.disclosure {
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
  margin-top: 12px;
}
.disclosure summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--link);
  font-size: 0.95rem;
}
.disclosure-body {
  padding-top: 12px;
}

/* ---------- Etiquetas y sello ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--hover);
  color: var(--muted);
}
.badge-green {
  background: var(--ok-soft);
  color: var(--ok-text);
}
.badge-red {
  background: var(--red-soft);
  color: var(--red-text);
}
.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
}
.badge-gold {
  background: var(--gold-soft);
  color: var(--gold-text);
}
.badge-ink {
  background: var(--ink-bg);
  color: var(--on-ink);
}
.badge-blue {
  background: var(--stamp-soft);
  color: var(--stamp);
}
.badge-btn {
  border: 0;
  cursor: pointer;
  font-family: var(--body);
}

/* El sello de goma: solo para pagos. */
.stamp {
  display: inline-block;
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 900;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stamp);
  padding: 3px 8px;
  border: 2px solid currentColor;
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3.5px currentColor;
  transform: rotate(-9deg);
  opacity: 0.9;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.2 0 0 0 -0.75'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='40'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.2 0 0 0 -0.75'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stamp-red {
  color: var(--red);
}
.stamp-lg {
  font-size: 1.1rem;
  padding: 6px 14px;
  border-width: 3px;
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 5px currentColor;
}
/* El sello cae cuando se acaba de registrar un pago. */
.stamp-land {
  animation: stamp-land 0.46s var(--ease) 0.15s both;
}
@keyframes stamp-land {
  0% {
    transform: scale(2) rotate(-20deg);
    opacity: 0;
  }
  55% {
    transform: scale(0.93) rotate(-8deg);
    opacity: 0.95;
  }
  100% {
    transform: scale(1) rotate(-9deg);
    opacity: 0.9;
  }
}

/* ---------- Talonario: borde perforado y número en rojo ---------- */
.talon {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px 3px var(--radius) var(--radius);
  padding-top: 14px;
}
.talon::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 9px;
  background: radial-gradient(circle at 8px 0, var(--bg) 4.6px, transparent 5.2px) 0 0 / 16px 9px repeat-x;
  pointer-events: none;
}
.talon::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  border-top: 1.5px dashed var(--line-strong);
  pointer-events: none;
}
.serial {
  font-family: var(--display);
  font-stretch: 75%;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Tarjeta de cobro (calendario de cuotas) ---------- */
.ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--paper);
}
.ledger-cell {
  position: relative;
  min-height: 100px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
}
button.ledger-cell {
  cursor: pointer;
  border-top: 0;
  border-left: 0;
  transition: background-color 0.15s;
}
button.ledger-cell:hover {
  background: var(--brand-soft);
}
.ledger-cell .n {
  font-family: var(--display);
  font-stretch: 85%;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--faint);
}
.ledger-cell .d {
  font-size: 0.85rem;
  color: var(--muted);
}
.ledger-cell .a {
  margin-top: auto;
  font-family: var(--display);
  font-stretch: 105%;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ledger-cell .extra {
  font-size: 0.78rem;
  font-weight: 700;
}
.ledger-cell.is-paid .a,
.ledger-cell.is-paid .d {
  color: var(--faint);
}
.ledger-cell.is-paid .stamp {
  position: absolute;
  right: 8px;
  top: 30px;
}
.ledger-cell.is-overdue {
  box-shadow: inset 4px 0 0 var(--red);
}
.ledger-cell.is-overdue .d {
  color: var(--red);
  font-weight: 700;
}
.ledger-cell.is-today {
  box-shadow: inset 4px 0 0 var(--gold);
  background: var(--gold-soft);
}
.ledger-cell.is-partial .extra {
  color: var(--amber);
}

/* ---------- Tablas y listas ---------- */
.table-wrap {
  overflow-x: auto;
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.table th {
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--paper);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover td {
  background: var(--hover);
}
.table .num {
  text-align: right;
  white-space: nowrap;
}
.row-link {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}
.row-link:hover {
  color: var(--link);
  text-decoration: underline;
}
/* Tablas como tarjetas en el celular. */
table.table.stack-sm thead {
  display: none;
}
table.table.stack-sm,
table.table.stack-sm tbody,
table.table.stack-sm tr,
table.table.stack-sm td {
  display: block;
  width: 100%;
}
table.table.stack-sm tr {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
table.table.stack-sm td {
  border: 0;
  padding: 3px 0;
  text-align: left !important;
}
table.table.stack-sm td[data-label]::before {
  content: attr(data-label) ': ';
  color: var(--muted);
  font-size: 0.85rem;
}
.person {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font-family: var(--display);
  font-stretch: 100%;
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--brand-soft-2);
  color: var(--brand-text);
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.3rem;
}
.person .meta {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Lista de cobro */
.collect-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.collect-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.collect-item:last-child {
  border-bottom: 0;
}
.collect-item.is-overdue {
  box-shadow: inset 4px 0 0 var(--red);
}
.collect-item.is-today {
  box-shadow: inset 4px 0 0 var(--gold);
}
.collect-amount {
  font-weight: 800;
  font-size: 1.2rem;
}
.collect-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.collect-actions .btn {
  flex: 1 1 auto;
  min-height: 44px;
}

/* Pestañas */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs a {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 11px 14px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover {
  color: var(--ink);
}
.tabs a.active {
  color: var(--ink);
  border-bottom-color: var(--brand);
}
.tabs .count {
  font-size: 0.76rem;
  background: var(--hover);
  border-radius: 999px;
  padding: 1px 8px;
  color: var(--ink);
}
.tabs a.active .count {
  background: var(--ink-bg);
  color: var(--on-ink);
}
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty h3 {
  color: var(--ink);
}
.empty .btn {
  margin-top: 6px;
}

/* ---------- Inicio: indicadores y gráficas ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.kpi {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-width: 0;
}
.kpi .k-label {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 700;
}
.kpi .k-value {
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.15;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.kpi .k-sub {
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 4px;
}
.k-value.red {
  color: var(--red);
}
/* El primer indicador es la hoja del talonario de hoy. */
.kpi:first-child {
  grid-column: 1 / -1;
}
.kpi-hero {
  background: var(--ink-bg);
  color: var(--on-ink);
  border-color: var(--ink-bg);
  border-radius: 3px 3px var(--radius) var(--radius);
  position: relative;
  padding-top: 22px;
}
.kpi-hero::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 9px;
  background: radial-gradient(circle at 8px 0, var(--bg) 4.6px, transparent 5.2px) 0 0 / 16px 9px repeat-x;
}
.kpi-hero .k-label {
  color: var(--on-ink-muted);
}
.kpi-hero .k-value {
  color: var(--on-ink);
  font-size: 2.1rem;
}
.kpi-hero .k-sub {
  color: var(--on-ink-muted);
}
.kpi-hero .k-sub b {
  color: var(--gold);
}
.kpi-hero .serial {
  position: absolute;
  right: 14px;
  top: 16px;
  color: var(--on-ink-red);
  font-size: 0.82rem;
}
.kpis.kpis-3 .kpi:first-child {
  grid-column: 1 / -1;
}
/* Inicio: la hoja de hoy a la izquierda y cuatro indicadores a la derecha. */
.kpis-dash .kpi-hero .btn {
  align-self: flex-start;
}
@media (min-width: 600px) {
  .kpis.kpis-dash {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpis.kpis-dash .kpi-hero {
    grid-column: 1 / -1;
  }
}
@media (min-width: 1100px) {
  .kpis.kpis-dash {
    grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(0, 1fr));
  }
  .kpis.kpis-dash .kpi-hero {
    grid-column: 1;
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .kpis.kpis-dash .kpi-hero .k-value {
    font-size: clamp(1.9rem, 2.4vw, 2.6rem);
    white-space: nowrap;
  }
}

.chart-panel .panel-head {
  align-items: baseline;
}
.chart-total {
  font-size: 0.88rem;
  color: var(--muted);
}
/* Barras de cobros por semana */
.week-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  height: 150px;
  padding-top: 8px;
  border-bottom: 1px solid var(--line);
}
.week-bar {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  min-width: 0;
}
.week-bar .fill {
  width: 100%;
  max-width: 30px;
  min-height: 3px;
  background: var(--brand-soft-2);
  border-radius: 5px 5px 1px 1px;
  transform-origin: bottom;
}
.week-bar.current .fill {
  background: var(--brand);
}
.week-bar:hover .fill {
  background: var(--gold);
}
.week-labels {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
}
.week-labels span {
  white-space: nowrap;
  display: flex;
  justify-content: center;
}
.week-labels span:nth-child(odd) {
  visibility: hidden;
}
.week-labels span:last-child {
  visibility: visible;
  font-weight: 700;
  color: var(--ink);
}
.js .week-bars.is-pending .fill {
  transform: scaleY(0);
}
.week-bars .fill {
  transition: transform 0.6s var(--ease);
}
.week-bars .week-bar:nth-child(n) .fill {
  transition-delay: calc(var(--i, 0) * 30ms);
}
/* Mora por antigüedad */
.aging-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--hover);
  margin: 6px 0 14px;
}
.aging-bar span {
  display: block;
  height: 100%;
}
.age-1 {
  background: var(--age-1);
}
.age-2 {
  background: var(--age-2);
}
.age-3 {
  background: var(--age-3);
}
.age-4 {
  background: var(--age-4);
}
.aging-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.aging-list li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 0.92rem;
}
.aging-list .dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.aging-list b {
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
}
/* Barras por mes (gráfico anterior) */
.bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  align-items: end;
  height: 150px;
  padding-top: 10px;
}
.bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}
.bar-fill {
  width: 100%;
  max-width: 44px;
  background: var(--brand-soft-2);
  border-radius: 6px 6px 2px 2px;
  min-height: 3px;
}
.bar.current .bar-fill {
  background: var(--brand);
}
.bar-label {
  font-size: 0.8rem;
  color: var(--muted);
}
.progress {
  height: 8px;
  background: var(--hover);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--ok);
  border-radius: inherit;
}

/* Esqueletos mientras carga algo */
.skeleton {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--hover) 25%, var(--line) 40%, var(--hover) 60%);
  background-size: 300% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.sk-line {
  height: 12px;
  margin: 8px 0;
}
.sk-line.w-40 {
  width: 40%;
}
.sk-line.w-60 {
  width: 60%;
}
.sk-line.w-80 {
  width: 80%;
}
.sk-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
}
.sk-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

/* ---------- Reporte de crédito ---------- */
.score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.score-dial {
  --v: 0;
  --c: var(--faint);
  width: 112px;
  height: 112px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--hover) 0);
}
.score-dial > div {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--surface);
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1;
}
.score-dial b {
  font-size: 2rem;
  font-weight: 800;
}
.score-dial small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
}
.rating-excellent {
  --c: var(--green-500);
}
.rating-good {
  --c: #6aa84f;
}
.rating-fair {
  --c: var(--gold);
}
.rating-risk {
  --c: var(--red);
}
.rating-label {
  font-family: var(--display);
  font-stretch: 108%;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.fact {
  padding: 12px 14px;
  border-left: 1px solid var(--line);
}
.fact:nth-child(odd) {
  border-left: 0;
}
.fact:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}
.fact b {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
}
.fact span {
  font-size: 0.82rem;
  color: var(--muted);
}
.bl-entry {
  border: 1px solid var(--red-line);
  background: var(--red-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.bl-entry + .bl-entry {
  margin-top: 10px;
}
.bl-entry.resolved {
  border-color: var(--line);
  background: var(--paper);
}
.quick-check {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
}
.quick-check.risk {
  background: var(--red-soft);
  border-color: var(--red-line);
  color: var(--red-text);
}
.quick-check.ok {
  background: var(--ok-soft);
  border-color: var(--ok-line);
}
.sim-total {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.sim-total > div {
  padding: 10px 12px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.sim-total > div:first-child {
  border-left: 0;
  background: var(--ink-bg);
  color: var(--on-ink);
}
.sim-total > div:first-child .muted {
  color: var(--on-ink-muted);
}
.sim-total b {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.sticky {
  position: static;
}

/* ---------- Diálogos ---------- */
dialog {
  border: 0;
  padding: 0;
  border-radius: 18px;
  width: min(480px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(2px);
}
dialog[open] {
  animation: pop 0.2s var(--ease);
}
@keyframes pop {
  from {
    transform: translateY(10px) scale(0.97);
    opacity: 0;
  }
}
.dialog-head {
  padding: 18px 20px 6px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.dialog-head h2 {
  margin: 0;
}
.dialog-body {
  padding: 8px 20px 4px;
}
.dialog-foot {
  padding: 12px 20px 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.confirm-dialog {
  width: min(420px, calc(100vw - 24px));
}
.confirm-dialog .dialog-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding-top: 20px;
}
.confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--gold-soft);
  color: var(--gold-text);
}
.confirm-dialog.is-danger .confirm-icon {
  background: var(--red-soft);
  color: var(--red);
}
.confirm-dialog p {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}
.confirm-dialog .dialog-foot .btn {
  flex: 1 1 140px;
}
.icon-btn {
  background: none;
  border: 0;
  padding: 8px;
  min-width: 40px;
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  border-radius: 10px;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

/* ---------- Búsqueda rápida de clientes ---------- */
.search-palette {
  width: min(620px, calc(100vw - 16px));
  margin-top: 8px;
  max-height: calc(100dvh - 16px);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.search-palette[open] {
  display: flex;
}
.sp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 16px;
  border-bottom: 1px solid var(--line);
}
.sp-head .i {
  color: var(--muted);
}
.sp-head input[type='search'] {
  border: 0;
  box-shadow: none;
  font-size: 1.08rem;
  min-height: 48px;
  padding: 8px 4px;
  background: transparent;
}
.sp-head input[type='search']:focus {
  box-shadow: none;
}
.sp-body {
  overflow-y: auto;
  padding: 6px 0 10px;
  min-height: 120px;
}
.sp-hint {
  padding: 14px 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.sp-results {
  list-style: none;
  margin: 0;
  padding: 0 6px;
}
.sp-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
}
.sp-item:hover,
.sp-item[aria-selected='true'] {
  background: var(--brand-soft);
  color: inherit;
}
.sp-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-item .meta {
  font-size: 0.84rem;
  color: var(--muted);
}
.sp-item .owe {
  text-align: right;
  font-size: 0.85rem;
}
.sp-item .owe b {
  display: block;
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
}
.sp-foot {
  display: none;
  gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}
@media (hover: hover) and (pointer: fine) {
  .sp-foot {
    display: flex;
  }
}
.sp-head input[type='search']::-webkit-search-cancel-button {
  display: none;
}

/* ---------- Estructura del panel ---------- */
.app {
  min-height: 100vh;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}
.sidebar {
  background: var(--night);
  color: var(--on-night);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  width: min(296px, 86vw);
  z-index: 70;
  overflow-y: auto;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-102%);
  transition: transform 0.24s var(--ease);
  visibility: hidden;
}
.nav-open .sidebar {
  transform: none;
  visibility: visible;
}
.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 65;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.nav-open .scrim {
  opacity: 1;
  pointer-events: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  color: var(--on-night-strong);
  text-decoration: none;
  font-family: var(--display);
  font-stretch: 115%;
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}
.brand:hover {
  color: var(--on-night-strong);
}
.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
}
.brand em {
  font-style: normal;
  color: var(--gold);
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group {
  margin-top: 16px;
  padding: 0 10px 6px;
  font-size: 0.8rem;
  color: var(--on-night-faint);
  font-weight: 700;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px;
  min-height: 44px;
  border-radius: 10px;
  color: var(--on-night);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover {
  background: var(--night-hover);
  color: var(--on-night-strong);
}
.nav a.active {
  background: var(--gold-glow);
  color: var(--on-night-strong);
  box-shadow: inset 3px 0 0 var(--gold);
}
.nav a.active .i {
  color: var(--gold);
}
.nav .pill {
  margin-left: auto;
  background: var(--gold);
  color: var(--on-gold);
  font-size: 0.74rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 8px;
}
.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--night-line);
}
.me {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
}
.me .avatar {
  width: 36px;
  height: 36px;
  background: var(--night-2);
  color: var(--on-night-strong);
  border: 1px solid var(--night-line);
}
.me-name {
  font-weight: 700;
  color: var(--on-night-strong);
  font-size: 0.92rem;
  line-height: 1.2;
}
.me-plan {
  font-size: 0.8rem;
  color: var(--on-night-muted);
}
.logout {
  width: 100%;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--night-line);
  color: var(--on-night);
}
.logout:hover {
  background: var(--night-hover);
  color: var(--on-night-strong);
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
/* Barra de arriba: en el celular es oscura con la marca; en computadora es clara y lleva el buscador. */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 14px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--night);
  color: var(--on-night-strong);
  min-height: 56px;
}
.appbar .brand {
  padding: 0;
  font-size: 1.05rem;
  margin-right: auto;
}
.appbar .brand-mark {
  width: 30px;
  height: 30px;
}
.appbar .icon-btn {
  color: var(--on-night);
}
.appbar .icon-btn:hover {
  background: var(--night-hover);
  color: var(--on-night-strong);
}
.app-search {
  display: none;
}
.theme-toggle .i-sun {
  display: none;
}
:root[data-theme='dark'] .theme-toggle .i-sun {
  display: block;
}
:root[data-theme='dark'] .theme-toggle .i-moon {
  display: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .i-sun {
    display: block;
  }
  :root:not([data-theme='light']) .theme-toggle .i-moon {
    display: none;
  }
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.topbar h1 {
  margin: 0;
  font-size: 1.55rem;
}
.topbar .sub {
  color: var(--muted);
  margin: 2px 0 0;
}
.topbar .btn-row {
  width: 100%;
}
.topbar .btn-row .btn {
  flex: 1 1 auto;
}
.back {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--muted);
  margin-bottom: 6px;
  min-height: 32px;
}
.back::before {
  content: '';
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-right: 3px;
}
.back:hover {
  color: var(--link);
}
.content {
  padding: 16px 16px 32px;
  width: 100%;
  max-width: 1240px;
  flex: 1;
}
.trial-strip {
  background: var(--gold-soft);
  border-bottom: 1px solid var(--gold-line);
  padding: 9px 16px;
  font-size: 0.9rem;
  display: flex;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.trial-strip.urgent {
  background: var(--red-soft);
  border-color: var(--red-line);
}
.app-foot {
  padding: 16px 16px 24px;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  border-top: 1px solid var(--line);
  max-width: 1240px;
}
.app-foot a {
  color: var(--muted);
}
.app-foot a:hover {
  color: var(--link);
}
/* Barra de abajo en el celular */
.bottomnav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 18px rgba(20, 16, 8, 0.06);
}
.bottomnav a,
.bottomnav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  font: 700 0.72rem/1.2 var(--body);
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  position: relative;
  border-radius: 12px;
}
.bottomnav a:active,
.bottomnav button:active {
  background: var(--hover);
}
.bottomnav .active {
  color: var(--ink);
}
.bottomnav .active .i {
  color: var(--brand);
}
.bottomnav .active::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 30%;
  right: 30%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
}
.bottomnav .bn-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.68rem;
  line-height: 18px;
  text-align: center;
}

/* ---------- Páginas públicas ---------- */
.site-header {
  background: var(--night);
  position: relative;
  z-index: 5;
}
.site-nav {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.site-nav .brand {
  padding: 0;
}
.site-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-links a:not(.btn) {
  color: var(--on-night);
  text-decoration: none;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
}
.site-links a:not(.btn):hover {
  color: var(--on-night-strong);
  background: var(--night-hover);
}
.site-links .hide-sm {
  display: none;
}
.site-links .show-sm {
  display: inline;
}
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}
.hero {
  background: var(--night);
  color: var(--on-night);
  padding: 32px 0 0;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: end;
}
.hero-copy {
  padding-bottom: 8px;
}
.hero h1 {
  font-size: clamp(2.3rem, 9vw, 4.1rem);
  font-weight: 850;
  font-stretch: 116%;
  color: var(--on-night-strong);
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin-bottom: 18px;
  max-width: 13ch;
}
.hero p.lead {
  font-size: 1.1rem;
  color: var(--on-night);
  max-width: 46ch;
  margin-bottom: 24px;
}
.hero .fine {
  font-size: 0.88rem;
  color: var(--on-night-muted);
  margin-top: 14px;
}
.hero .btn-row .btn {
  flex: 1 1 auto;
}
.hero-card {
  background: var(--paper);
  color: var(--ink);
  border-radius: 3px 3px 0 0;
  padding: 24px 14px 0;
  position: relative;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
}
.hero-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 9px;
  background: radial-gradient(circle at 8px 0, var(--night) 4.6px, transparent 5.2px) 0 0 / 16px 9px repeat-x;
}
.hero-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
}
.hero-card .ledger {
  grid-template-columns: repeat(2, 1fr);
}
.hero-card .ledger-cell {
  min-height: 88px;
}
.hero-card .serial {
  font-size: 0.95rem;
}
/* El único momento animado de la portada: el sello cae sobre la cuota de hoy. */
.hero-card .hero-stamp {
  animation-delay: 0.9s;
}
.hero-card .ledger-cell.is-today .d {
  color: var(--gold-text);
  font-weight: 700;
}
.section {
  padding: 52px 0;
}
.section-tight {
  padding: 40px 0;
}
.section h2 {
  font-size: clamp(1.6rem, 5vw, 2.3rem);
  font-weight: 850;
  font-stretch: 112%;
  letter-spacing: -0.02em;
  max-width: 24ch;
}
.section .intro {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 60ch;
}
.features {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 28px;
  border-top: 3px solid var(--ink);
}
.feature {
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line-strong);
}
.feature h3 {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 1.1rem;
}
.feature h3 .i {
  color: var(--brand);
}
.feature p {
  color: var(--muted);
  margin: 0;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}
.band {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.price {
  background: var(--night);
  color: var(--on-night);
  border-radius: var(--r-lg);
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}
.price h2 {
  color: var(--on-night-strong);
}
.price-amount {
  font-weight: 900;
  font-size: clamp(3rem, 12vw, 4.4rem);
  color: var(--on-night-strong);
  line-height: 1;
  letter-spacing: -0.03em;
}
.price-amount small {
  font-family: var(--body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--on-night-muted);
  letter-spacing: 0;
}
.price ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.price li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.price li .i {
  color: var(--gold);
  margin-top: 3px;
}
.site-footer {
  background: var(--night);
  color: var(--on-night-muted);
  padding: 32px 0 calc(32px + env(safe-area-inset-bottom));
  font-size: 0.92rem;
}
.site-footer a {
  color: var(--on-night);
}
.site-footer a:hover {
  color: var(--on-night-strong);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.footer-legal {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--night-line);
  font-size: 0.84rem;
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.public-main {
  min-height: 60vh;
}
.page-head {
  background: var(--night);
  color: var(--on-night);
  padding: 28px 0 36px;
}
.page-head h1 {
  color: var(--on-night-strong);
  font-size: clamp(1.8rem, 6vw, 2.7rem);
  font-weight: 850;
  font-stretch: 112%;
  letter-spacing: -0.02em;
}
.page-head p {
  max-width: 60ch;
  margin: 0;
}
.lender-list {
  display: grid;
  gap: 12px;
}
.lender-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.lender-row .lender-cta {
  grid-column: 1 / -1;
}
.lender-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--brand-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--brand-text);
  border: 1px solid var(--line);
}
.lender-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lender-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 4px;
}
.search-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: -22px 0 22px;
  background: var(--surface);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  position: relative;
  box-shadow: var(--shadow-1);
}
.search-bar > * {
  flex: 1 1 180px;
}
.search-bar .btn {
  flex: 0 0 auto;
}

/* ---------- Páginas legales ---------- */
.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  padding: 28px 0 56px;
}
.legal-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 0 16px 4px;
}
.legal-nav a {
  flex: none;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
}
.legal-nav a[aria-current='page'] {
  background: var(--ink-bg);
  border-color: var(--ink-bg);
  color: var(--on-ink);
}
.legal {
  max-width: 72ch;
  font-size: 1.02rem;
}
.legal h2 {
  font-size: 1.25rem;
  margin-top: 2em;
  scroll-margin-top: 16px;
}
.legal h2:first-child {
  margin-top: 0;
}
.legal h3 {
  margin-top: 1.4em;
}
.legal ul,
.legal ol {
  padding-left: 1.3em;
}
.legal li + li {
  margin-top: 0.35em;
}
.legal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.6em 0 1.2em;
}
.legal th,
.legal td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.legal th {
  background: var(--paper);
}
.legal-meta {
  font-size: 0.92rem;
  color: var(--on-night-muted);
  margin-top: 6px;
}
.legal-callout {
  border-left: 4px solid var(--gold);
  background: var(--gold-soft);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1em 0 1.4em;
}
.legal-callout p:last-child {
  margin: 0;
}
mark.legal-todo {
  background: #ffe9a8;
  color: #4d3600;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px dashed #b78a14;
  font-weight: 700;
  white-space: nowrap;
}
.legal-table-wrap {
  overflow-x: auto;
}

/* ---------- Banner de cookies ---------- */
.cookie-banner {
  position: fixed;
  z-index: 90;
  left: 10px;
  right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  padding: 16px;
  animation: toast-in 0.3s var(--ease) both;
}
.cookie-banner p {
  margin: 0 0 12px;
  font-size: 0.95rem;
}
.cookie-banner .cb-title {
  font-family: var(--display);
  font-stretch: 108%;
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.cookie-banner .btn-row .btn {
  flex: 1 1 120px;
}

/* ---------- Registro e inicio de sesión ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}
.auth-side {
  background: var(--night);
  color: var(--on-night);
  padding: 16px 16px 18px;
  padding-top: calc(16px + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}
.auth-side .brand {
  padding: 0;
}
.auth-side .auth-extra {
  display: none;
}
.auth-side h2 {
  color: var(--on-night-strong);
  font-size: 2.2rem;
  font-weight: 850;
  font-stretch: 114%;
  letter-spacing: -0.02em;
  max-width: 15ch;
  line-height: 1.02;
}
.auth-main {
  display: grid;
  place-items: start center;
  padding: 24px 16px 32px;
}
.auth-box {
  width: min(460px, 100%);
}
.auth-box h1 {
  font-size: 1.9rem;
  font-weight: 850;
}
.auth-foot {
  margin-top: 28px;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.auth-foot a {
  color: var(--muted);
}

/* ---------- Seguridad y cuenta ---------- */
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.label-row label {
  font-weight: 700;
  font-size: 0.9rem;
}
.auth-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-text);
  margin-bottom: 16px;
}
.auth-icon .i {
  width: 26px;
  height: 26px;
}
.auth-icon-warn {
  background: var(--amber-soft);
  color: var(--amber);
}
input.code-input {
  font: 800 1.6rem/1 var(--display);
  letter-spacing: 0.32em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  min-height: 58px;
}
input.code-input-text {
  font-size: 1.2rem;
  letter-spacing: 0.12em;
}
.activity {
  list-style: none;
  margin: 0;
  padding: 6px 0 8px;
}
.activity li {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.activity li:last-child {
  border-bottom: 0;
}
.activity li.is-warn {
  box-shadow: inset 3px 0 0 var(--red);
}
/* Pasos: la lista sí es una secuencia, por eso lleva números. */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps[start='3'] {
  counter-reset: step 2;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 42px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 18px;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink-bg);
  color: var(--on-ink);
  font: 800 0.85rem/1 var(--display);
}
.qr-box {
  margin: 14px 0 6px;
  width: 210px;
  max-width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
.qr-box svg {
  display: block;
  width: 100%;
  height: auto;
}
.secret-key {
  display: block;
  font: 700 1rem/1.5 ui-monospace, Consolas, monospace;
  letter-spacing: 0.06em;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  word-break: break-all;
}
.recovery-codes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.recovery-codes code {
  display: block;
  text-align: center;
  font: 700 1.05rem/1 ui-monospace, Consolas, monospace;
  letter-spacing: 0.08em;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

/* ---------- Equipo ---------- */
.credentials {
  border: 2px solid var(--brand);
  background: var(--brand-soft);
  margin-bottom: 18px;
}
.credentials-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
  color: var(--brand-text);
}
.credentials-head h2 {
  margin: 0 0 2px;
  color: var(--ink);
}
.cred-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 0 0 14px;
}
.cred-list div {
  background: var(--surface);
  border: 1px solid var(--brand-soft-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 0;
}
.cred-list dt {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}
.cred-list dd {
  margin: 2px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.cred-list code {
  font: 700 1.1rem/1.3 ui-monospace, Consolas, monospace;
  color: var(--ink);
}
.count-chip {
  font: 700 0.84rem/1 var(--body);
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-text);
}
.count-chip.is-full {
  background: var(--gold-soft);
  color: var(--gold-text);
}
.member-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.member {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
.member.is-off .person {
  opacity: 0.6;
}
.member-name {
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.member-actions {
  gap: 2px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: var(--paper);
}
.perm-grid {
  display: grid;
  gap: 6px;
  margin: 4px 0 16px;
}
.perm-grid-2 {
  grid-template-columns: minmax(0, 1fr);
}
.perm-grid legend {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.perm {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.perm:hover {
  border-color: var(--line-strong);
}
.perm:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.perm input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--brand);
  flex: none;
}
.perm span {
  display: flex;
  flex-direction: column;
  font-size: 0.92rem;
  line-height: 1.3;
}
.perm small {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Portal del cobrador ---------- */
.today-tally {
  display: flex;
  align-items: center;
  gap: 8px 22px;
  flex-wrap: wrap;
  background: var(--ink-bg);
  color: var(--on-ink);
  border-radius: 3px 3px var(--radius) var(--radius);
  padding: 20px 16px 14px;
  margin-bottom: 14px;
  position: relative;
}
.today-tally::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 9px;
  background: radial-gradient(circle at 8px 0, var(--bg) 4.6px, transparent 5.2px) 0 0 / 16px 9px repeat-x;
}
.today-tally > div {
  display: flex;
  flex-direction: column;
}
.today-tally .muted {
  color: var(--on-ink-muted);
}
.today-tally b {
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1.2;
}
.today-tally .btn {
  color: var(--gold);
}
.today-tally .btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
}
.big-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 6px 6px 6px 10px;
  margin-bottom: 18px;
}
.big-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
.big-search .i {
  color: var(--muted);
  display: none;
}
.big-search input[type='search'] {
  border: 0;
  box-shadow: none;
  padding: 10px 4px;
  font-size: 1.08rem;
  min-height: 50px;
}
.big-search input[type='search']:focus {
  box-shadow: none;
}
.big-search .btn {
  min-height: 50px;
}
.client-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.client-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  min-height: 64px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.12s var(--ease);
}
.client-result:hover {
  border-color: var(--brand);
  color: inherit;
}
.client-result:active {
  transform: scale(0.99);
}
.client-result .avatar {
  display: none;
}
.cr-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cr-main strong {
  font-size: 1.04rem;
}
.cr-due {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.cr-due b {
  font-weight: 800;
  font-size: 1.1rem;
}
.collect-card + .collect-card {
  margin-top: 16px;
}
.owed {
  display: flex;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.owed > div {
  display: flex;
  flex-direction: column;
}
.owed b {
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.2;
}
.due-lines {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}
.due-lines li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.95rem;
}
.due-lines li .small {
  grid-column: 1;
  grid-row: 2;
}
.collect-form {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.method-pick legend {
  margin-bottom: 6px;
}
.done-card {
  max-width: 480px;
  margin: 10px auto 0;
  text-align: center;
  padding: 34px 18px 22px;
}
.done-card .stamp {
  margin-bottom: 16px;
}
.done-card .serial {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.done-amount {
  font-weight: 900;
  font-size: 2.3rem;
  line-height: 1.1;
}
.done-who {
  margin: 6px 0 16px;
  color: var(--muted);
}
.facts-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  text-align: left;
}
.facts-inline div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  min-width: 0;
}
.facts-inline dt {
  font-size: 0.8rem;
  color: var(--muted);
}
.facts-inline dd {
  margin: 0;
  font-weight: 700;
}

/* ---------- Cuadres ---------- */
.closing-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.closing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
.closing-amounts {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.closing-amounts > div {
  display: flex;
  flex-direction: column;
}
.closing-amounts b {
  font-weight: 800;
  font-size: 1.05rem;
}
.closing-state {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

/* ---------- Planes ---------- */
.plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.plan-grid .panel + .panel {
  margin-top: 0;
}
.plan-card.is-premium {
  border-color: var(--gold);
  box-shadow: inset 0 4px 0 var(--gold);
}
.plan-card.is-current {
  border-color: var(--brand);
  box-shadow: inset 0 4px 0 var(--brand);
}
.plan-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.plan-head h2 {
  margin: 0;
}
.plan-price {
  margin: 8px 0 14px;
}
.plan-amount {
  font-weight: 900;
  font-size: 2.3rem;
  line-height: 1;
}
.plan-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.plan-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 0.95rem;
}
.plan-list .i {
  color: var(--brand);
  margin-top: 2px;
}
.paypal-box {
  max-width: 420px;
}

/* ---------- Exportar ---------- */
.export-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Administración: visitas ---------- */
.stat-days {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  align-items: end;
  height: 110px;
  border-bottom: 1px solid var(--line);
}
.stat-days span {
  display: block;
  background: var(--brand-soft-2);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}
.stat-days span.reg {
  background: var(--gold);
}

/* ---------- Recibo imprimible ---------- */
.receipt-page {
  padding: 16px 12px 40px;
}
.receipt {
  max-width: 560px;
  margin: 12px auto;
  padding: 30px 20px 22px;
  position: relative;
  box-shadow: var(--shadow-1);
}
.receipt-head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 16px;
}
.receipt-head h2 {
  margin: 0;
}
.receipt-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.receipt .total {
  font-family: var(--display);
  font-stretch: 112%;
  font-size: 2.3rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
/* En el celular el sello va debajo del monto; en pantallas más anchas, a la derecha del monto. */
.receipt > .stamp {
  margin: 6px 0 4px 4px;
}
@media (min-width: 600px) {
  .receipt > .stamp {
    position: absolute;
    right: 36px;
    top: 176px;
    margin: 0;
  }
}
.receipt-sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 34px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}
.receipt-sign span {
  border-top: 1px solid var(--line-strong);
  padding-top: 6px;
}

/* ---------- Pantallas medianas (tabletas) ---------- */
@media (min-width: 600px) {
  .content {
    padding: 20px 24px 40px;
  }
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .topbar .btn-row {
    width: auto;
  }
  .topbar .btn-row .btn {
    flex: 0 0 auto;
  }
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi .k-value {
    font-size: 1.5rem;
  }
  .ledger {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }
  .hero-card .ledger {
    grid-template-columns: repeat(4, 1fr);
  }
  .facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .fact:nth-child(odd) {
    border-left: 1px solid var(--line);
  }
  .fact:first-child {
    border-left: 0;
  }
  .fact:nth-child(n + 3) {
    border-top: 0;
  }
  .score {
    flex-direction: row;
    align-items: center;
  }
  .recovery-codes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .client-result {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .client-result .avatar {
    display: grid;
  }
  .big-search .i {
    display: block;
  }
  .due-lines li {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .due-lines li .small {
    grid-column: auto;
    grid-row: auto;
  }
  .done-amount {
    font-size: 2.7rem;
  }
  .lender-row {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    padding: 18px;
  }
  .lender-row .lender-cta {
    grid-column: auto;
  }
  .lender-logo {
    width: 72px;
    height: 72px;
  }
  .site-links .hide-sm {
    display: inline-flex;
  }
  .site-links .show-sm {
    display: none;
  }
  .hero .btn-row .btn {
    flex: 0 0 auto;
  }
  .cookie-banner {
    left: auto;
    right: 20px;
    bottom: 20px;
    width: 420px;
  }
  .js .toast-stack {
    left: auto;
    right: 20px;
    width: 400px;
  }
  .receipt {
    padding: 34px 32px 26px;
  }
  .stat-days {
    gap: 4px;
  }
}

/* ---------- Computadora: menú lateral fijo ---------- */
@media (min-width: 860px) {
  .app {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    padding-bottom: 0;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    width: auto;
    transform: none;
    visibility: visible;
    transition: none;
  }
  .scrim,
  .bottomnav,
  .appbar .brand,
  .appbar-menu {
    display: none !important;
  }
  .appbar {
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding: 10px 32px;
    gap: 8px;
  }
  .appbar .icon-btn {
    color: var(--muted);
  }
  .appbar .icon-btn:hover {
    background: var(--hover);
    color: var(--ink);
  }
  .app-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 460px;
    margin-right: auto;
    min-height: 42px;
    padding: 0 10px 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surface);
    color: var(--muted);
    font: 500 0.95rem/1 var(--body);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
  }
  .app-search span {
    flex: 1;
  }
  .app-search:hover {
    border-color: var(--brand);
    color: var(--ink);
  }
  .appbar-search-btn {
    display: none !important;
  }
  .content {
    padding: 26px 32px 48px;
  }
  .app-foot {
    padding: 16px 32px 28px;
  }
  .trial-strip {
    padding: 9px 32px;
  }
  .js .toast-stack {
    top: 74px;
  }
  .topbar {
    margin-bottom: 22px;
  }
  .topbar h1 {
    font-size: 1.85rem;
  }
  .panel {
    padding: 20px;
  }
  .panel-flush > .panel-head {
    padding: 16px 20px 0;
  }
  .cols {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 18px;
  }
  .cols-even {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  .sticky {
    position: sticky;
    top: 84px;
  }
  .collect-item {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
    gap: 14px;
    padding: 14px 20px;
  }
  .collect-actions {
    justify-content: flex-end;
  }
  .collect-actions .btn {
    flex: 0 0 auto;
    min-height: 36px;
  }
  /* Tablas normales en computadora */
  table.table.stack-sm thead {
    display: table-header-group;
  }
  table.table.stack-sm {
    display: table;
  }
  table.table.stack-sm tbody {
    display: table-row-group;
  }
  table.table.stack-sm tr {
    display: table-row;
    padding: 0;
    border: 0;
  }
  table.table.stack-sm td {
    display: table-cell;
    width: auto;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  table.table.stack-sm td.num {
    text-align: right !important;
  }
  table.table.stack-sm td[data-label]::before {
    content: none;
  }
  .kpis {
    grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
  .kpi:first-child {
    grid-column: auto;
  }
  .kpis.kpis-3 {
    grid-template-columns: 1.5fr repeat(2, minmax(0, 1fr));
  }
  .kpis.kpis-3 .kpi:first-child {
    grid-column: auto;
  }
  .kpi {
    padding: 18px 20px;
  }
  .kpi-hero {
    padding-top: 24px;
  }
  .kpi-hero .k-value {
    font-size: 2.2rem;
  }
  .member {
    padding: 14px 20px;
  }
  .closing-row {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr) auto;
    gap: 14px;
    padding: 14px 20px;
  }
  .closing-state {
    justify-content: flex-end;
  }
  .plan-grid,
  .perm-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cred-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .activity li {
    padding: 9px 20px;
  }
  .today-tally {
    padding: 22px 20px 14px;
  }
  .today-tally .btn {
    margin-left: auto;
  }
  /* Públicas */
  .site-nav {
    padding: 16px 20px;
  }
  .wrap {
    padding: 0 20px;
  }
  .hero {
    padding-top: 56px;
  }
  .hero-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 48px;
  }
  .hero-copy {
    padding-bottom: 72px;
  }
  .hero-card {
    padding: 26px 20px 0;
  }
  .section {
    padding: 80px 0;
  }
  .section-tight {
    padding: 48px 0;
  }
  .features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .feature {
    padding: 22px 22px 26px;
    border-left: 1px solid var(--line-strong);
  }
  .feature:nth-child(3n + 1) {
    padding-left: 0;
    border-left: 0;
  }
  .split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 56px;
  }
  .price {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
    padding: 40px;
  }
  .page-head {
    padding: 40px 0 48px;
  }
  .legal-layout {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 48px;
    padding: 40px 0 72px;
  }
  .legal-nav {
    flex-direction: column;
    position: sticky;
    top: 20px;
    align-self: start;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .legal-nav a {
    border-radius: 10px;
    border-color: transparent;
    background: transparent;
  }
  .legal-nav a:hover {
    background: var(--hover);
  }
  .auth-shell {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-rows: none;
  }
  .auth-side {
    padding: 40px;
  }
  .auth-side .auth-extra {
    display: block;
  }
  .auth-main {
    place-items: center;
    padding: 40px 20px;
  }
  .confirm-dialog .dialog-foot .btn {
    flex: 0 0 auto;
  }
  .search-palette {
    margin-top: 10vh;
  }
}

/* ---------- Opciones del préstamo: tarjetas con explicación y ejemplo ---------- */
.choice-cards {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 6px;
}
.choice {
  position: relative;
  display: block;
  cursor: pointer;
}
.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
}
.choice-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  height: 100%;
  padding: 14px 16px 14px 44px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.choice-body::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 17px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.choice:hover .choice-body {
  border-color: var(--gold);
}
.choice input:checked + .choice-body {
  border-color: var(--gold);
  background: var(--gold-soft);
  box-shadow: inset 0 0 0 1px var(--gold);
}
.choice input:checked + .choice-body::before {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 8px var(--gold);
}
.choice input:focus-visible + .choice-body {
  outline: 3px solid var(--focus, var(--gold));
  outline-offset: 2px;
}
.choice-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
}
.choice-sub {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--gold-text);
}
.choice-text {
  font-size: 0.88rem;
  color: var(--muted);
}
.choice-example {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-strong);
  font-size: 0.84rem;
  color: var(--ink);
}
.choice-example::before {
  content: 'Ejemplo: ';
  font-weight: 700;
}
.explain {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: var(--paper);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  font-size: 0.86rem;
  color: var(--muted);
}
.field-warn {
  margin: 8px 0 0;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--red-text);
}
.template-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
}
.template-pick label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
  font-size: 0.92rem;
}
.template-pick select {
  flex: 1 1 200px;
  width: auto;
}
.save-template {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.sim-notes {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.sim-notes li {
  position: relative;
  padding-left: 18px;
  font-size: 0.88rem;
  line-height: 1.45;
}
.sim-notes li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.5em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--gold);
  transform: rotate(45deg);
}
.sim-table {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.template-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.template-item {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.template-item.is-default {
  border-color: var(--gold);
  box-shadow: inset 4px 0 0 var(--gold);
}
.template-main {
  min-width: 0;
  flex: 1 1 260px;
}
.template-name {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}
/* Franja de "adelantar": abono a capital y saldar. */
.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-color: var(--gold-line);
  background: linear-gradient(90deg, var(--gold-soft), var(--surface) 70%);
}
.ledger-cell.is-rolled {
  background: repeating-linear-gradient(-45deg, transparent 0 8px, color-mix(in srgb, var(--gold) 9%, transparent) 8px 16px);
}
.ledger-cell.is-rolled .a {
  color: var(--faint);
}
.ledger-cell.is-rolled .extra {
  color: var(--gold-text);
}
.ledger-cell.is-capital {
  background: var(--gold-soft);
  box-shadow: inset 4px 0 0 var(--gold);
}
.stamp-roll {
  position: absolute;
  right: 8px;
  top: 30px;
  color: var(--gold-text);
  border-color: currentColor;
}
.roll-box {
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
}
/* Cotización para saldar. */
.quote {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.quote > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
}
.quote > div:first-child {
  border-top: 0;
}
.quote dt {
  font-size: 0.9rem;
  color: var(--muted);
}
.quote dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.quote-save dd {
  color: var(--green-text, var(--ok-text));
}
.quote-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: var(--ink-bg);
  color: var(--on-ink);
}
.quote-total b {
  font-family: var(--display);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

/* ---------- Ajustes de la paleta blanco/negro y dorado ---------- */
/* En modo claro el menú, la barra y la portada son blancos: una línea dorada suave los separa del contenido. */
.sidebar {
  border-right: 1px solid var(--night-line);
}
.appbar,
.site-header {
  border-bottom: 1px solid var(--night-line);
}
.site-footer {
  border-top: 1px solid var(--night-line);
}
.hero {
  background:
    radial-gradient(ellipse 60% 70% at 85% 10%, var(--gold-glow), transparent 70%),
    radial-gradient(ellipse 40% 50% at 0% 100%, color-mix(in srgb, var(--ok) 7%, transparent), transparent 70%),
    var(--night);
}
.segmented input:checked + span {
  box-shadow: inset 0 -3px 0 var(--gold);
}
.price {
  border: 1px solid var(--night-line);
  box-shadow: inset 0 4px 0 var(--gold), var(--shadow-1);
}
.page-head {
  border-bottom: 1px solid var(--night-line);
}
.auth-side {
  border-right: 1px solid var(--night-line);
}
.choice-cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

/* ---------- Bot de ayuda ---------- */
.help-bot {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.help-bot > * {
  pointer-events: auto;
}
/* Dentro del panel, en el celular, va encima de la barra de abajo. */
.app .help-bot,
.help-bot[data-context='app'] {
  bottom: calc(78px + env(safe-area-inset-bottom));
}
.help-bot.above-banner {
  bottom: calc(200px + env(safe-area-inset-bottom));
}
.help-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 18px 0 15px;
  border: 0;
  border-radius: 999px;
  background: var(--ink-bg);
  color: var(--gold);
  font: 800 0.95rem/1 var(--display);
  box-shadow: 0 0 0 2px var(--gold), var(--shadow-pop);
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s;
}
.help-fab:hover {
  transform: translateY(-2px);
}
.help-fab:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.help-fab-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--on-gold);
  font: 900 1rem/1 var(--display);
}
.help-panel {
  order: -1;
}
.help-bot.is-open .help-fab-label {
  display: none;
}
.help-bot.is-open .help-fab {
  padding: 0 14px;
}
.help-panel {
  width: min(390px, calc(100vw - 28px));
  height: min(580px, calc(100vh - 170px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}
.help-bot.is-open .help-panel {
  opacity: 1;
  transform: none;
}
.help-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 12px 14px;
  background: var(--ink-bg);
  color: var(--on-ink);
  border-bottom: 2px solid var(--gold);
}
.help-head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--on-ink);
}
.help-head p {
  margin: 0;
  color: var(--on-ink-muted);
}
.help-head .icon-btn {
  margin-left: auto;
  color: var(--on-ink);
}
.help-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--gold);
  color: var(--on-gold);
  font: 900 1.1rem/1 var(--display);
}
.help-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--paper);
}
.help-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  animation: help-in 0.2s var(--ease) both;
}
.help-msg p {
  margin: 0;
}
.help-msg-bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.help-msg-user {
  align-self: flex-end;
  background: var(--gold);
  color: var(--on-gold);
  border-bottom-right-radius: 4px;
  font-weight: 700;
}
.help-q {
  display: block;
  margin-bottom: 4px;
  font-family: var(--display);
  font-size: 0.95rem;
}
.help-link {
  display: inline-block;
  margin-top: 8px;
  margin-right: 12px;
  font-weight: 700;
}
.help-related {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.help-related-label {
  width: 100%;
  font-size: 0.8rem;
  color: var(--muted);
}
.help-chips {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}
.help-chips:empty {
  display: none;
}
.help-chips .chip,
.help-related .chip {
  flex: none;
  padding: 6px 11px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  white-space: normal;
}
.help-chips .chip {
  white-space: nowrap;
}
.help-chips .chip:hover,
.help-related .chip:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.help-form {
  display: flex;
  gap: 6px;
  padding: 10px 10px 6px;
  border-top: 1px solid var(--line);
}
.help-form input {
  min-height: 44px;
  font-size: 0.95rem;
}
.help-send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gold);
  color: var(--on-gold);
}
.help-send:hover {
  background: var(--gold-hover);
  color: var(--on-gold);
}
.help-foot {
  margin: 0;
  padding: 0 14px 10px;
  text-align: center;
}
@keyframes help-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@media (min-width: 860px) {
  .app .help-bot,
  .help-bot[data-context='app'] {
    bottom: 22px;
  }
  .help-bot {
    right: 22px;
    bottom: 22px;
  }
}
/* Página de preguntas frecuentes. */
.help-page {
  display: grid;
  gap: 24px;
}
.help-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.help-topics a {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--ink);
}
.help-topics a:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.help-topic {
  margin-bottom: 26px;
  scroll-margin-top: 80px;
}
.help-topic h2 {
  margin-bottom: 10px;
}
.help-item {
  margin-bottom: 8px;
}
.help-item:target {
  border-color: var(--gold);
  box-shadow: inset 3px 0 0 var(--gold);
}
.help-contact h2 {
  margin-bottom: 6px;
}
@media (min-width: 900px) {
  .help-page {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
  }
  .help-topics {
    position: sticky;
    top: 20px;
    flex-direction: column;
  }
}

/* ---------- Impresión ---------- */
@media print {
  .sidebar,
  .appbar,
  .bottomnav,
  .trial-strip,
  .app-foot,
  .toast-stack,
  .cookie-banner,
  .no-print,
  .btn {
    display: none !important;
  }
  .app {
    display: block;
    padding: 0;
  }
  body,
  .receipt-page {
    background: #fff;
    color: #000;
    padding: 0;
  }
  .panel,
  .receipt {
    border: 0;
    padding: 0;
    box-shadow: none;
  }
  .talon::before,
  .talon::after {
    display: none;
  }
  .stamp {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---------- Menos movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .js .week-bars.is-pending .fill {
    transform: none;
  }
}
