/* Fuente del 8082 (Plus Jakarta Sans) AUTO-HOSPEDADA: la CSP de la 8091 es
   font-src 'self' y el cobrador anda en la calle con datos — nada de CDN. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('./fonts/PlusJakartaSans-var.woff2') format('woff2');
}
:root {
  color-scheme: light;
  /* Tokens alineados al 8082 (Tailwind gray/blue + brand #2563eb) */
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-soft: #f3f4f6;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --soft: #eff6ff;
  --danger: #dc2626;
  --ok: #16a34a;
  --warning: #d97706;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
/* Íconos SVG inline estilo Material Symbols (mismo lenguaje visual del 8082) */
.mi { width: 1.25em; height: 1.25em; fill: currentColor; display: block; flex-shrink: 0; }
.app {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 18px;
}
.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px 10px;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(2rem, 8vw, 3.2rem); line-height: 1; }
h2 { margin-bottom: 14px; font-size: 1.2rem; }
.eyebrow { margin-bottom: 6px; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.version { margin: 8px 0 0; color: var(--ok); font-weight: 800; font-size: .9rem; }
.muted, .hint { color: var(--muted); }
.hint { margin: 10px 0 0; font-size: .9rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: 0 8px 24px rgba(23, 32, 51, .06);
}
.grid { display: grid; gap: 12px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: 7px; font-weight: 650; margin-bottom: 12px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(27, 110, 243, .15); border-color: var(--primary); }
button {
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font: inherit;
  font-weight: 800;
  background: var(--primary);
  color: white;
  cursor: pointer;
}
button:hover { background: var(--primary-dark); }
button:disabled { opacity: .55; cursor: not-allowed; }
.secondary { background: var(--soft); color: var(--primary); }
.secondary:hover { background: #dce9ff; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.92); padding-top: 10px; backdrop-filter: blur(8px); }
.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff1f0;
  color: var(--danger);
  font-weight: 800;
  border: 1px solid #ffd6d3;
}
.badge.ok { background: #ecfdf3; color: var(--ok); border-color: #abefc6; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.summary {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  margin: 8px 0 14px;
  background: #fbfcff;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.dashboard-grid.single { grid-template-columns: 1fr; }
h3 { margin: 0 0 8px; font-size: 1rem; }
.client-list {
  display: grid;
  gap: 8px;
}
.client-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfcff;
}
.client-card strong { display: block; margin-bottom: 4px; }
.client-card .meta { color: var(--muted); font-size: .9rem; line-height: 1.35; }
.client-card button { margin-top: 8px; width: 100%; padding: 10px 12px; }
.client-card.due { border-color: #84caff; background: #eff8ff; }
.client-card.overdue { border-color: #fda29b; background: #fff1f3; }
.client-card.paid { border-color: #abefc6; background: #ecfdf3; }
.cash-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.cash-summary > div,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fbfcff;
}
.cash-summary span,
.field-title {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: .9rem;
  margin: 0 0 6px;
}
.cash-summary strong { font-size: 1.35rem; }
.detail-panel { margin: 8px 0 12px; line-height: 1.45; }
.commission-panel { border-color: #abefc6; background: #ecfdf3; font-weight: 700; }
.detail-panel h3 { margin: 0 0 8px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.detail-table th,
.detail-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.detail-table th { color: var(--muted); font-size: .82rem; }
.specs-table th { width: 44%; }
.loan-pill {
  display: block;
  width: 100%;
  text-align: left;
  margin: 8px 0;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
.loan-pill.active { border-color: var(--primary); background: var(--soft); color: var(--primary); }
.payment-type-panel { margin: 10px 0 14px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice-button.active { background: var(--primary); color: white; }
.warnings {
  border: 1px solid #fedf89;
  border-radius: 14px;
  padding: 12px;
  margin: 8px 0 14px;
  background: #fffaeb;
  color: #93370d;
  font-weight: 650;
}
.receipt, .log {
  white-space: pre-wrap;
  background: #101828;
  color: #e4e7ec;
  border-radius: 14px;
  padding: 14px;
  min-height: 120px;
  overflow: auto;
}
.log { min-height: 90px; max-height: 220px; font-size: .9rem; }
.log-card { margin-bottom: 32px; }
@media (max-width: 720px) {
  .hero { display: block; }
  .badge { display: inline-block; margin-top: 10px; }
  .two, .three, .dashboard-grid, .cash-summary, .choice-grid { grid-template-columns: 1fr; }
  .section-title { align-items: flex-start; flex-direction: column; }
  button { width: 100%; }
}

/* Rediseño móvil tipo app */
.mobile-shell {
  width: min(520px, 100%);
  padding-bottom: 94px;
}
.mobile-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px 10px;
  background: rgba(246, 247, 251, .94);
  backdrop-filter: blur(12px);
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.app-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--primary), #6c5ce7);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(27, 110, 243, .28);
}
.mobile-header h1 { margin: 0 0 2px; font-size: 1.45rem; }
.mobile-header .eyebrow { margin: 0 0 2px; font-size: .72rem; }
.mobile-header .muted { margin: 0; font-size: .86rem; }
.screen { display: none; animation: fadeIn .18s ease-out; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 14px;
}
.stat-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--card);
  box-shadow: 0 8px 20px rgba(23, 32, 51, .06);
}
.stat-card span { display: block; color: var(--muted); font-weight: 750; font-size: .84rem; margin-bottom: 8px; }
.stat-card strong { display: block; font-size: 1.45rem; line-height: 1.1; }
.stat-card.blue { border-color: #b2ccff; background: #eff4ff; }
.stat-card.orange { border-color: #fedf89; background: #fffaeb; }
.stat-card.green { border-color: #abefc6; background: #ecfdf3; }
.stat-card.purple { border-color: #d9d6fe; background: #f4f3ff; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compact-title { align-items: center; flex-direction: row; }
.small-btn { width: auto; padding: 9px 12px; font-size: .9rem; }
.search-label { margin-bottom: 14px; }
.preview-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fbfcff;
  margin-top: 12px;
}
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 50;
  width: min(520px, calc(100% - 18px));
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 38px rgba(23, 32, 51, .18);
  backdrop-filter: blur(14px);
}
.nav-item {
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 4px;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
}
.nav-item span { font-size: 1.05rem; line-height: 1; }
.nav-item:hover { background: var(--soft); color: var(--primary); }
.nav-item.active { background: var(--soft); color: var(--primary); }
.nav-primary {
  transform: translateY(-16px);
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 20px rgba(27, 110, 243, .28);
}
.nav-primary.active, .nav-primary:hover { background: var(--primary); color: white; }
.nav-primary span { font-size: 1.45rem; }
.client-card .actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
@media (min-width: 721px) {
  .mobile-shell { width: min(720px, 100%); }
  .bottom-nav { width: min(720px, calc(100% - 18px)); }
}
@media (max-width: 420px) {
  .stat-grid, .quick-actions { grid-template-columns: 1fr; }
  .nav-item { font-size: .66rem; }
}

/* Clientes como historial de actividad */
.compact-client-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}
.compact-client-card:hover { background: #f8fbff; }
.compact-client-card.selected { outline: 3px solid rgba(27, 110, 243, .16); border-color: var(--primary); }
.compact-client-card .client-card-title { font-weight: 900; }
.compact-client-card .client-status {
  align-self: start;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(255,255,255,.7);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.compact-client-card .meta {
  grid-column: 1 / -1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.client-activity-detail h3 { margin-top: 12px; }
.client-detail-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.client-detail-header p { margin: 0; }
.client-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}
.active-loans-list { display: grid; gap: 8px; margin-bottom: 10px; }
.activity-timeline { display: grid; gap: 8px; }
.activity-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
}
.activity-item strong { display: block; margin-bottom: 3px; }
.activity-item span { color: var(--muted); font-size: .9rem; line-height: 1.35; }
.activity-item.payment { border-left: 4px solid var(--ok); }
.activity-item.loan { border-left: 4px solid var(--primary); }
@media (max-width: 420px) {
  .client-detail-actions { grid-template-columns: 1fr; }
}

/* Registrar: selector Pago / Préstamo */
.register-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 16px;
}
.register-mode-card {
  min-height: 74px;
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 1rem;
}
.register-mode-card span { font-size: 1.45rem; line-height: 1; }
.register-mode-card.active { background: var(--primary); color: #fff; }
.new-loan-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fbfcff;
}
.new-loan-panel button { margin-top: 8px; }
@media (max-width: 420px) {
  .register-mode-grid { grid-template-columns: 1fr; }
}

/* Nuevo borrador corregido: Inicio + + + Ajustes */
.compact-bottom-nav {
  grid-template-columns: 1fr 1.1fr 1fr;
}
.home-screen.active {
  min-height: calc(100dvh - 126px);
  max-height: calc(100dvh - 126px);
  overflow: hidden;
}
.home-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.home-stat-grid .stat-card {
  padding: 10px;
  border-radius: 15px;
}
.home-stat-grid .stat-card span {
  font-size: .74rem;
  margin-bottom: 5px;
}
.home-stat-grid .stat-card strong {
  font-size: 1.05rem;
}
.compact-home-card {
  margin: 8px 0 0;
  padding: 12px;
}
.compact-history {
  display: grid;
  gap: 6px;
  max-height: 42dvh;
  overflow-y: auto;
  padding-bottom: 4px;
  overscroll-behavior: contain;
}
.compact-movement {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  font-size: .88rem;
}
.compact-movement strong { color: var(--primary); }
.compact-movement span {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.historial-row span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.35;
}
.flow-panel { margin-top: 10px; }
.scroll-client-list {
  display: grid;
  gap: 8px;
  max-height: 42dvh;
  overflow-y: auto;
  padding: 2px 2px 88px;
  overscroll-behavior: contain;
}
.client-row-button {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  background: #fbfcff;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 11px 12px;
}
.client-row-button:hover { background: var(--soft); color: var(--text); }
.client-row-button span {
  color: var(--muted);
  font-size: .86rem;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.summary-grid > div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px;
  background: #fff;
}
.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.summary-grid strong { font-size: .95rem; }
@media (max-width: 420px) {
  .home-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-stat-grid .stat-card { padding: 8px 6px; }
  .home-stat-grid .stat-card span { font-size: .68rem; }
  .home-stat-grid .stat-card strong { font-size: .92rem; }
  .summary-grid { grid-template-columns: 1fr; }
}

/* Borrador 2: flujo por pantallas */
.step-header {
  margin: 0 0 10px;
}
.step-panel[hidden] { display: none !important; }
.step-panel h2 { margin-bottom: 12px; }

/* Borrador 3: pago compacto sin scroll */
#paymentLoanStep.active-compact,
#paymentFormPanel.active-compact { overflow: hidden; }
#paymentLoanStep .detail-panel,
#paymentFormPanel {
  margin-top: 4px;
}
.compact-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.compact-summary-grid > div {
  padding: 7px 8px;
}
.compact-summary-grid span {
  font-size: .68rem;
  margin-bottom: 2px;
}
.compact-summary-grid strong {
  font-size: .86rem;
  line-height: 1.05;
}
#paymentLoanStep h2,
#paymentFormPanel h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}
#paymentLoanStep h3 {
  margin-bottom: 7px;
  font-size: .98rem;
}
#paymentFormPanel .payment-type-panel {
  margin: 4px 0 8px;
}
#paymentFormPanel .field-title,
#paymentFormPanel .hint {
  display: none;
}
#paymentFormPanel .choice-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
#paymentFormPanel .choice-button {
  min-height: auto;
  padding: 8px 5px;
  border-radius: 10px;
  font-size: .75rem;
  line-height: 1.05;
}
#paymentFormPanel label {
  gap: 4px;
  margin-bottom: 7px;
  font-size: .78rem;
}
#paymentFormPanel input,
#paymentFormPanel select,
#paymentFormPanel textarea {
  padding: 9px 9px;
  border-radius: 10px;
  font-size: .9rem;
}
#paymentFormPanel .grid {
  gap: 7px;
}
#paymentFormPanel .warnings {
  padding: 8px;
  margin: 6px 0;
  font-size: .82rem;
}
#paymentFormPanel .sticky-actions {
  padding-top: 5px;
}
#paymentFormPanel .sticky-actions button,
#showPaymentFormBtn {
  padding: 10px 12px;
}
.compact-client-row {
  padding: 9px 10px;
}
.compact-client-row span {
  font-size: .78rem;
}
.compact-client-row.paid {
  border-color: #abefc6;
  background: #f0fdf4;
}
.compact-client-row.pending {
  border-color: #fedf89;
  background: #fffbeb;
}
@media (max-width: 420px) {
  #paymentFormPanel .three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #paymentFormPanel .two {
    grid-template-columns: 1fr 1fr;
  }
  #paymentFormPanel textarea {
    min-height: 38px;
  }
}

/* Borrador 3: préstamo compacto sin scroll */
#loanFormPanel,
#clientFormPanel {
  overflow: hidden;
}
#loanFormPanel h2,
#clientFormPanel h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  line-height: 1.15;
}
#loanFormPanel label,
#clientFormPanel label {
  gap: 4px;
  margin-bottom: 7px;
  font-size: .78rem;
}
#loanFormPanel input,
#clientFormPanel input,
#clientFormPanel select,
#clientFormPanel textarea {
  padding: 9px 9px;
  border-radius: 10px;
  font-size: .9rem;
}
#loanFormPanel .grid,
#clientFormPanel .grid {
  gap: 7px;
}
#loanFormPanel button,
#clientFormPanel button {
  margin-top: 2px;
  padding: 10px 12px;
}
#loanFormPanel .three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
#loanFormPanel .two,
#clientFormPanel .two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#clientFormPanel textarea {
  min-height: 38px;
}
@media (max-width: 420px) {
  #loanFormPanel .three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #loanFormPanel .two,
  #clientFormPanel .two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #loanFormPanel input,
  #clientFormPanel input,
  #clientFormPanel select,
  #clientFormPanel textarea {
    font-size: .82rem;
    padding: 8px 7px;
  }
}

/* Borrador 3 app-only: modalidad préstamo y eliminar del app */
.loan-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  margin: 2px 0 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
.loan-mode-button {
  padding: 8px 6px;
  border-radius: 10px;
  font-size: .82rem;
}
.loan-mode-button.active {
  background: var(--primary);
  color: #fff;
}
.compact-loan-grid {
  margin-bottom: 2px;
}
.compact-movement {
  width: 100%;
  text-align: left;
  color: var(--text);
}
.compact-movement.selected {
  border-color: var(--danger);
  background: #fff1f0;
  outline: 2px solid rgba(180, 35, 24, .12);
}
.danger-action {
  width: 100%;
  margin-top: 8px;
  background: #fff1f0;
  color: var(--danger);
  border: 1px solid #fda29b;
}
.danger-action:hover {
  background: #fee4e2;
  color: var(--danger);
}

/* Borrador 4: basurero al lado y métricas revertidas */
.compact-movement-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: stretch;
}
.compact-movement-row.selected .compact-movement {
  border-color: var(--danger);
  background: #fff1f0;
  outline: 2px solid rgba(180, 35, 24, .12);
}
.movement-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px;
}
.movement-edit,
.movement-trash {
  min-width: 42px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: .9rem;
}
.movement-edit {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}
.movement-trash {
  border: 1px solid #fda29b;
  background: #fff1f0;
  color: var(--danger);
}
.movement-edit:hover { background: #f9fafb; }
.movement-trash:hover {
  background: #fee4e2;
  color: var(--danger);
}

/* Edición/eliminación rápida desde la app */
.client-manage-row,
.manage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  background: #fff;
}
.client-manage-row .client-row-button {
  border: 0;
  padding: 4px;
  background: transparent;
}
.management-panel {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}
.management-panel h4 {
  margin: 8px 0 0;
  font-size: .9rem;
}
.manage-row.active { border-color: var(--primary); background: var(--soft); }
.manage-row.payment { border-left: 4px solid var(--ok); }
.manage-row strong { display: block; font-size: .9rem; }
.manage-row span { display: block; color: var(--muted); font-size: .78rem; line-height: 1.25; }
.manage-actions { display: flex; gap: 6px; align-items: center; }
.danger-mini {
  width: auto;
  padding: 9px 10px;
  border: 1px solid #fda29b;
  background: #fff1f0;
  color: var(--danger);
  font-size: .86rem;
}
.danger-mini:hover { background: #fee4e2; color: var(--danger); }
.manage-empty { margin: 0; font-size: .86rem; }
@media (max-width: 420px) {
  .client-manage-row,
  .manage-row { grid-template-columns: 1fr; }
  .manage-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .manage-actions .small-btn,
  .manage-actions .danger-mini { width: 100%; }
}


/* Implementación borrador 2026-05-27 */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; }
.locked-field,
input[readonly] {
  background: #f8fafc;
  color: #667085;
}
.loan-preset-panel {
  display: grid;
  gap: 7px;
  margin: 0 0 8px;
}
.loan-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.loan-preset-button {
  min-height: auto;
  padding: 8px 6px;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
.loan-preset-button strong,
.loan-preset-button span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loan-preset-button strong { color: var(--primary); font-size: .86rem; }
.loan-preset-button span { color: var(--muted); font-size: .68rem; margin-top: 2px; }
#loanValidationMessage {
  padding: 8px 10px;
  margin: 4px 0 8px;
  border-radius: 12px;
  border: 1px solid #fda29b;
  background: #fff1f0;
  color: var(--danger);
  font-size: .84rem;
  font-weight: 800;
}
.client-row-button,
.compact-movement,
.manage-row > div,
.client-manage-row > div { min-width: 0; }
.client-row-button strong,
.client-row-button span,
.compact-movement strong,
.compact-movement span,
.manage-row strong,
.manage-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 420px) {
  .loan-preset-grid { grid-template-columns: 1fr; }
}

/* Pantalla de detalle desde historial */
.home-detail-header { padding: 4px 0 8px; }
.detail-card { padding: 12px !important; }
.detail-card h2 { font-size: .95rem; margin-bottom: 8px; }
.detail-view-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin-bottom: 10px;
}
.detail-view-field { display: grid; gap: 2px; min-width: 0; }
.detail-view-field span { color: var(--muted); font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.detail-view-field strong { font-size: .84rem; word-break: break-word; overflow-wrap: anywhere; }
.detail-view-field.readonly strong { color: var(--muted); }
.detail-error { border: 1px solid #fda29b; border-radius: 12px; padding: 10px 12px; background: #fff1f0; color: var(--danger); font-size: .86rem; font-weight: 700; margin-bottom: 12px; }
.detail-delete-confirm { border: 1px solid #fda29b; border-radius: 16px; padding: 14px; background: #fff8f7; }
.detail-delete-confirm p { margin: 0 0 12px; font-weight: 700; color: var(--danger); font-size: .9rem; }
.btn-danger { background: #fff1f0; border: 1px solid #fda29b; color: var(--danger); }
.btn-danger:hover { background: #fee4e2; color: var(--danger); }
.detail-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.detail-card-header h2 { margin: 0; }
.btn-danger-mini { width: auto; padding: 5px 10px; font-size: .78rem; font-weight: 700; border-radius: 10px; background: #fff1f0; border: 1px solid #fda29b; color: var(--danger); white-space: nowrap; flex-shrink: 0; }
.btn-danger-mini:hover { background: #fee4e2; color: var(--danger); }

/* §12 borrador 2026-05-27: nombres largos no deben sobresalir del contenedor */
.detail-panel,
.summary-grid,
#paymentLoanSummary,
#selectedLoanClientName { min-width: 0; }
#paymentLoanSummary h3,
.detail-panel h3,
#selectedLoanClientName {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.summary-grid > div { min-width: 0; }
.summary-grid strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Job #53 (Agente 5, job 5a): login + sesión de la app de Cobradores (8091). */
.auth-shell[hidden] { display: none; }
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card { width: min(420px, 100%); }
.auth-brand { margin-bottom: 18px; }
.session-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--warning);
  color: #fff;
  font-weight: 650;
  font-size: .9rem;
}
.session-banner .secondary { background: #fff; color: var(--warning); }

/* Job #57 (Agente 5, job 5b): "Olvidé mi clave". */
.link-btn {
  background: none;
  border: none;
  color: var(--accent, #2563eb);
  font-size: .9rem;
  padding: 4px 0;
  margin-top: 6px;
  text-align: center;
  width: 100%;
  cursor: pointer;
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════
   REDISEÑO 14-jul-2026 — cara CrediJim (alineado al 8082)
   Va al FINAL a propósito: el cascade pisa las reglas viejas de arriba.
   Backup: styles.css.bak-diseno-8082-20260714
   ═══════════════════════════════════════════════════════════════════════ */

/* — Tarjetas: blancas, borde gris fino, sombra sutil (como el 8082) — */
.card {
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  box-shadow: 0 1px 2px rgba(17, 24, 39, .05);
}

/* — Header: barra blanca con borde, marca CrediJim — */
.mobile-header {
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 6px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .05);
}
.app-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary);
  box-shadow: none;
}
.app-icon .mi { width: 20px; height: 20px; color: #fff; }
.mobile-header h1 { font-size: 1.25rem; font-weight: 800; }
.badge { padding: 5px 10px; font-size: .78rem; font-weight: 700; }

/* — Banner de sesión: EMPUJA el contenido, ya no tapa el header — */
.session-banner {
  position: sticky;
  border-radius: 0 0 12px 12px;
}

/* — Tarjetas de métricas estilo 8082: blancas + ícono en círculo de color — */
.stat-card,
.home-stat-grid .stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 12px 10px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .05);
}
.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-icon .mi { width: 17px; height: 17px; }
.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-card > div { min-width: 0; }
.stat-card span,
.home-stat-grid .stat-card span { font-size: .72rem; margin-bottom: 2px; color: var(--muted); font-weight: 600; }
.stat-card strong,
.home-stat-grid .stat-card strong { font-size: 1.02rem; font-weight: 800; color: var(--text); }
/* En móvil (el mundo real de la 8091) las 3 tarjetas van ícono-arriba para
   que el monto nunca se corte contra el borde. */
@media (max-width: 560px) {
  .stat-card, .home-stat-grid .stat-card { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-icon .mi { width: 15px; height: 15px; }
  .stat-card strong, .home-stat-grid .stat-card strong { font-size: .98rem; }
}

/* — Chips de filtro (Por cobrar / Movimientos) estilo 8082 — */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  width: auto;
  padding: 6px 13px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}
.chip:hover { background: var(--soft); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active:hover { background: var(--primary-dark); color: #fff; }

/* — Barra inferior: 5 posiciones + botón central elevado (patrón app móvil) — */
.bottom-nav {
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border-radius: 20px;
  border: 1px solid var(--line-soft);
  align-items: end;
}
.nav-item {
  padding: 7px 2px 5px;
  gap: 3px;
  font-size: .66rem;
  font-weight: 700;
  border-radius: 12px;
}
.nav-item .mi { width: 21px; height: 21px; }
.nav-primary {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 999px;
  margin: 0 auto;
  transform: translateY(-20px);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .35);
}
.nav-primary .mi { width: 26px; height: 26px; }
.mobile-shell { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.home-screen.active {
  min-height: calc(100dvh - 140px);
  max-height: calc(100dvh - 140px);
}

/* — Pantalla "Más": menú de filas con ícono + descripción — */
.menu-card { padding: 6px 8px; }
.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  padding: 13px 6px;
  text-align: left;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row:hover { background: var(--soft); border-radius: 10px; }
.menu-ico {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--primary);
  flex-shrink: 0;
}
.menu-ico .mi { width: 19px; height: 19px; }
.menu-text { flex: 1; display: grid; gap: 1px; min-width: 0; }
.menu-text strong { font-size: .95rem; font-weight: 700; }
.menu-text span { color: var(--muted); font-size: .78rem; font-weight: 500; line-height: 1.3; }
.menu-row .chev { color: #9ca3af; font-size: 1.3rem; font-weight: 400; }

/* — Formularios compactos como los modales del 8082 — */
label { font-size: .8rem; font-weight: 600; color: #374151; gap: 5px; margin-bottom: 10px; }
input, select, textarea { padding: 10px 12px; border-radius: 10px; font-size: .92rem; }
button { border-radius: 10px; font-weight: 700; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(37, 99, 235, .15); border-color: var(--primary); }

/* — Estados vacíos centrados con aire (en vez de texto suelto) — */
.compact-history.muted,
.scroll-client-list.muted,
#paymentClientList.muted {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 30px 14px;
  font-size: .88rem;
}

/* — Filas de la lista "Por cobrar" de la home — */
.due-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: center;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
}
.due-row:hover { background: var(--soft); color: var(--text); }
.due-row strong { font-size: .9rem; font-weight: 700; }
.due-row .due-meta { grid-column: 1; color: var(--muted); font-size: .78rem; font-weight: 500; }
.due-row .estado-chip {
  grid-row: 1 / span 2;
  grid-column: 2;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.estado-chip.pendiente { background: #fff7ed; color: #c2410c; }
.estado-chip.pagado { background: #f0fdf4; color: #15803d; }
.estado-chip.atrasado { background: #fef2f2; color: #b91c1c; }

/* — Fixes de visibilidad (14-jul): display:grid/flex pisaba el atributo hidden —
   La nav y el banner se veían hasta en el login. */
.bottom-nav[hidden] { display: none; }
.session-banner[hidden] { display: none; }

/* — El botón sticky de los formularios se pega ARRIBA de la nav flotante,
   no debajo (antes quedaba tapado al hacer scroll) — */
.mobile-shell .sticky-actions {
  bottom: calc(84px + env(safe-area-inset-bottom));
  border-radius: 12px;
}

/* — Fase 2 calle (14-jul): PIN, hoja de cobro y cola offline — */
.pin-input {
  font-size: 1.6rem;
  letter-spacing: .55em;
  text-align: center;
  font-weight: 800;
}
.sheet-progress {
  display: grid;
  gap: 6px;
  padding: 4px 2px 8px;
}
.sheet-progress span { color: var(--muted); font-size: .82rem; font-weight: 600; }
.sheet-progress span strong { color: var(--text); font-weight: 800; }
.sheet-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}
.sheet-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--ok);
  transition: width .3s ease;
}
.cola-aviso {
  width: 100%;
  text-align: left;
  font-size: .85rem;
  cursor: pointer;
  margin: 0 0 8px;
}

/* ═══ Pulido profesional 14-jul (noche): sin scroll lateral + modales 8082 ═══ */

/* — FIX scroll lateral en las listas de la home: una palabra larga (nombres
   sin espacios) forzaba la fila a más ancho que la tarjeta. Candado triple:
   partir palabras, min-width 0, y jamás scroll-x en las listas. — */
.compact-history { overflow-x: hidden; }
.compact-history > * { min-width: 0; max-width: 100%; }
.due-row strong,
.due-row .due-meta,
.compact-movement strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sheet-progress, .sheet-progress span { min-width: 0; max-width: 100%; }

/* — Letras más pequeñas en el inicio (pedido de Eddy) — */
.mobile-header h1 { font-size: 1.1rem; }
.mobile-header .eyebrow { font-size: .66rem; }
.mobile-header .muted { font-size: .78rem; }
.badge { padding: 4px 9px; font-size: .72rem; }
.home-stat-grid .stat-card span { font-size: .66rem; }
.home-stat-grid .stat-card strong { font-size: .92rem; }
.chip { padding: 5px 11px; font-size: .74rem; }
.due-row { padding: 9px 11px; }
.due-row strong { font-size: .85rem; }
.due-row .due-meta { font-size: .72rem; }
.due-row .estado-chip { padding: 3px 8px; font-size: .64rem; }
.sheet-progress span { font-size: .76rem; }
.compact-home-card .section-title h2 { font-size: 1rem; }

/* — Modal de confirmación estilo 8082 (overlay rgba(15,23,42,.16) + blur(3px),
   tarjeta blanca rounded-2xl border gray-100, animación fade+scale) — */
.cj-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .16);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .15s ease;
}
.cj-modal[hidden] { display: none; }
.cj-modal.abierto { opacity: 1; }
.cj-modal-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  transform: translateY(8px) scale(.97);
  transition: transform .18s ease-out;
}
.cj-modal.abierto .cj-modal-card { transform: none; }
.cj-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.cj-modal-head h2 { margin: 0; font-size: .92rem; font-weight: 800; color: var(--text); }
.cj-modal-x {
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  color: #9ca3af;
}
.cj-modal-x:hover { background: var(--line-soft); color: var(--muted); }
.cj-modal-x .mi { width: 17px; height: 17px; }
.cj-modal-msg {
  margin: 0;
  padding: 14px 16px;
  font-size: .88rem;
  line-height: 1.5;
  color: #374151;
  white-space: pre-line;
  overflow-wrap: anywhere;
  max-height: 50dvh;
  overflow-y: auto;
}
.cj-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 16px 14px;
}
.cj-modal-actions button {
  width: auto;
  padding: 9px 18px;
  font-size: .86rem;
}
.cj-modal-actions .btn-rojo {
  background: var(--danger);
  color: #fff;
}
.cj-modal-actions .btn-rojo:hover { background: #b91c1c; }
@media (max-width: 720px) {
  .cj-modal-actions button { width: auto; }
}

/* ═══════════════════════════════════════════════════════════════════════
   UX PRO 14-jul (noche 3) — jerarquía, componentes y consistencia.
   Escala de espacios: 4/8/12/16/24/32. Radios: 12-16 tarjetas, 999 chips.
   Táctil mínimo 44px. Sin scroll anidado. Backup: .bak-uxpro-20260714
   ═══════════════════════════════════════════════════════════════════════ */

/* — Tarjetas: menos sombra, borde limpio, respiración uniforme — */
.card { box-shadow: none; border-radius: 14px; padding: 16px; margin: 8px 0; }
.compact-home-card { padding: 12px; margin: 8px 0 0; }
.stat-card, .home-stat-grid .stat-card { box-shadow: none; }

/* — AppHeader: UNA línea de altura, título dominante, punto de conexión — */
.mobile-header {
  box-shadow: none;
  padding: 8px 12px;
  border-radius: 12px;
  min-height: 56px;
}
.head-brand { min-width: 0; flex: 1; }
.head-text { min-width: 0; flex: 1; }
.mobile-header h1 {
  font-size: 1.05rem;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mobile-header .muted {
  font-size: .72rem;
  margin: 1px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-icon { width: 36px; height: 36px; border-radius: 10px; }
.app-icon .mi { width: 18px; height: 18px; }
.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d1d5db;
  flex-shrink: 0;
  margin-right: 2px;
}
.conn-dot.ok { background: var(--ok); }

/* — StatusBadge: estados SIEMPRE con texto, no solo color — */
.badge-estado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.badge-estado.ok    { background: #f0fdf4; color: #15803d; }
.badge-estado.warn  { background: #fff7ed; color: #c2410c; }
.badge-estado.bad   { background: #fef2f2; color: #b91c1c; }
.badge-estado.neutro{ background: var(--line-soft); color: var(--muted); }

/* — ClientRow: avatar + nombre + datos + saldo + estado + flecha — */
.crow {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 4px 10px;
  align-items: center;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 56px;
}
.crow:hover { background: var(--soft); color: var(--text); }
.crow .avatar {
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--primary);
  font-size: .78rem;
  font-weight: 800;
  flex-shrink: 0;
}
/* Una sola línea con puntos suspensivos (CHG-2026-0306): el .crow es un
   <button> de 56px y un nombre de 3 líneas desbordaba en silencio, dejando
   fuera el meta y el badge de estado. El nombre completo se ve en la ficha. */
.crow .crow-nombre {
  grid-column: 2;
  font-size: .86rem;
  font-weight: 700;
  min-width: 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crow .crow-meta {
  grid-column: 2;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
  min-width: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crow .crow-monto {
  grid-column: 3;
  grid-row: 1;
  font-size: .84rem;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}
.crow .crow-badge { grid-column: 3; grid-row: 2; justify-self: end; }
.crow .chev {
  grid-column: 4;
  grid-row: 1 / span 2;
  color: #c2c6d4;
  font-size: 1.2rem;
  font-weight: 400;
}
.crow .crow-atraso { color: #b91c1c; font-weight: 700; }

/* — PaymentRow / CommissionRow: nombre+fecha | monto+comisión — */
.prow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.prow .prow-nombre { font-size: .85rem; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
/* Ancho completo (CHG-2026-0306): en 360px el detalle se partía en 3 líneas
   apretadas contra el badge de al lado. Con la fila entera para él, respira. */
.prow .prow-fecha {
  grid-column: 1 / -1;
  grid-row: 2;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.35;
}
.prow .prow-badge { grid-row: 3; }
.prow .prow-monto { grid-column: 2; grid-row: 1; font-size: .88rem; font-weight: 800; text-align: right; white-space: nowrap; }
.prow .prow-badge { grid-column: 2; grid-row: 2; justify-self: end; }
.prow .prow-comision {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-soft);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}

/* — EmptyState — */
.empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 16px;
  text-align: center;
}
.empty-state .mi { width: 30px; height: 30px; color: #c2c6d4; }
.empty-state strong { font-size: .88rem; color: var(--text); }
.empty-state span { font-size: .76rem; color: var(--muted); }

/* — Scroll interno restaurado (15-jul, pedido de Eddy): la home, Mi historial
   y Comisión por pago scrollean POR DENTRO de su tarjeta; lo de arriba
   (métricas, chips, títulos) queda fijo. — */
.compact-history { max-height: none; overflow-y: visible; }
#miHistorialList,
#miGananciaLista {
  max-height: calc(100dvh - 320px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-bottom: 4px;
}
/* Ganancia lleva las 3 métricas arriba: la lista es un poco más corta */
#miGananciaLista { max-height: calc(100dvh - 360px); }
.scroll-client-list { max-height: 42dvh; overflow-y: auto; }
.home-screen.active {
  display: flex;
  flex-direction: column;
  /* 100dvh − header(~76) − paddings del shell(~26) − nav flotante(~100) */
  height: calc(100dvh - 202px);
  min-height: 0;
  max-height: none;
  overflow: hidden;
}
.home-screen.active .home-stat-grid { flex-shrink: 0; }
#homeHistoryList {
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
  padding-bottom: 4px;
}
/* la tarjeta de la home reparte el alto: chips fijos arriba, lista scrolleable */
#homeMainCard {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#homeMainCard .section-title { flex-shrink: 0; margin-bottom: 8px; }

/* — Formulario de pago: 3 secciones numeradas, campos calculados claros — */
.form-sec {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 10px;
  background: #fff;
}
.form-sec h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: .82rem;
  font-weight: 800;
  color: var(--text);
}
.form-sec-num {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--primary);
  font-size: .7rem;
  font-weight: 800;
}
.form-sec label:last-child { margin-bottom: 0; }
#paymentFormPanel .field-title, #paymentFormPanel .hint { display: block; }
#paymentFormPanel .hint { font-size: .72rem; margin-top: 6px; }
.campo-calculado { position: relative; }
.campo-calculado input[readonly] {
  background: var(--line-soft);
  color: var(--muted);
  font-weight: 700;
  border-style: dashed;
}
.tag-auto {
  font-size: .64rem;
  font-weight: 600;
  color: var(--muted);
  font-style: italic;
}

/* — Recibo estructurado (etiqueta | valor) + jerarquía de acciones — */
.recibo-view {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
  padding: 4px 14px;
  margin: 0 0 10px;
}
.recibo-view .rv-fila {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: .82rem;
}
.recibo-view .rv-fila:last-child { border-bottom: 0; }
.recibo-view .rv-fila span { color: var(--muted); font-weight: 500; }
.recibo-view .rv-fila strong { text-align: right; overflow-wrap: anywhere; }
.recibo-view .rv-total { font-size: .95rem; }
.recibo-view .rv-total strong { color: var(--primary); font-size: 1.05rem; }
.recibo-acciones { gap: 8px; }
.recibo-acciones button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}
.recibo-acciones .mi { width: 18px; height: 18px; }
#receiptPanel .form-sec h3 { color: var(--muted); }
#receiptPanel .receipt { min-height: 0; max-height: none; overflow: visible; font-size: .74rem; }

/* — Menú Más: fila de salir en rojo suave — */
.menu-ico.rojo { background: #fef2f2; color: var(--danger); }
.menu-row-salir strong { color: var(--danger); }

/* — Táctil: mínimo 44px en botones de acción — */
button { min-height: 44px; }
.small-btn, .chip, .cj-modal-x, .movement-edit, .movement-trash, .nav-item { min-height: 0; }
.choice-button { min-height: 44px; }

/* (la hoja de cobro y las listas ahora renderizan .crow/.prow desde el JS) */


/* ── Refinamiento Cobradores 31-jul-2026 (CHG-2026-0304) ─────────────────── */

/* Filtro de período del Historial: los dos selects en una fila que respira.
   :not([hidden]) a propósito — un `display:flex` pelado le gana al atributo
   hidden y el filtro se quedaba visible en las otras dos pestañas (misma
   trampa que ya se cazó el 14-jul con .bottom-nav y .session-banner). */
.hist-filtro:not([hidden]) {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}
.hist-filtro label {
  flex: 1 1 140px;
  margin: 0;
}
/* El `label { display: ... }` general de la app también le gana al atributo
   hidden: sin esto el selector de Mes se quedaba en pantalla con el filtro en
   "Últimos 7/15 días". */
.hist-filtro label[hidden] { display: none; }

/* Método fijo en el formulario de pago: informa, no se puede cambiar. */
.hint.metodo-fijo {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 10px;
}

/* Botón Editar de cada fila de pago del Historial. */
.prow-acciones {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}
.prow-acciones .small-btn { padding: 4px 12px; font-size: 13px; }

/* Ficha del cliente: la cabecera de la tarjeta lleva su badge de estado. */
#screen-cliente .section-title.compact-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#screen-cliente .detail-view-grid { margin-top: 4px; }

/* Cabecera de "Por cobrar": título a la izquierda, botón Clientes a la derecha. */
#homeMainCard .section-title.compact-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}


/* ── Que todo encaje y se pueda tocar en un teléfono (CHG-2026-0306) ───────
   Medido en 360x800 (Galaxy S21) con la app real, no a ojo. */

/* Los <select> salían de 23px de alto: imposibles de tocar y se veían rotos
   al lado de los demás campos. El `padding` y el `min-height` NO les hacían
   nada porque WebKit dibuja el select como control nativo y se come esas dos
   propiedades: hay que apagar el control nativo con appearance:none y ponerle
   nosotros la flechita. */
select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  padding: 11px 38px 11px 12px;
  font-size: .9rem;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px 20px;
}

/* Pestañas del Historial: 27px es muy poco para el dedo. */
.chip {
  min-height: 44px;
  padding: 10px 16px;
}

/* El botón "Editar" de cada pago: 24px de alto no se acierta caminando. */
.prow-acciones .small-btn,
.small-btn {
  min-height: 44px;
  padding: 10px 16px;
}

/* "Período" quedaba pegado a las pestañas. */
.hist-filtro { margin-top: 12px; }

/* El botón sticky "Registrar pago" se montaba encima del campo Nota y del
   aviso de ubicación: sin este colchón el último campo del formulario queda
   debajo del botón y no se puede ni ver ni escribir. */
#paymentFormPanel { padding-bottom: 64px; }
#paymentFormPanel .sticky-actions {
  margin-top: 4px;
  padding-bottom: 6px;
}

/* Los 3 tipos de pago: en 360px "Pago completo" se partía en dos líneas. */
#paymentFormPanel .choice-grid { gap: 6px; }
#paymentFormPanel .choice-button {
  min-height: 46px;
  padding: 8px 6px;
  font-size: .8rem;
  line-height: 1.2;
}


/* Letra mínima legible en la calle (CHG-2026-0306): el barrido en 360x800
   encontró badges a 10.2px y textos de apoyo a 11.2px. Con sol y a pie eso no
   se lee; se sube lo justo para que se lean sin desarmar la jerarquía. */
.badge-estado { font-size: .72rem; padding: 4px 10px; }
.crow .crow-meta { font-size: .75rem; }
.prow .prow-fecha,
.prow .prow-comision { font-size: .75rem; }
.tag-auto { font-size: .72rem; }
.empty-state span { font-size: .8rem; }
.sheet-progress { font-size: .8rem; }

/* Las etiquetas de dato ("Monto prestado", "Saldo pendiente", "Teléfono"...)
   quedaban en 10.9px: son lo que el cobrador lee para saber qué mira. */
.summary-grid span,
.detail-view-field span { font-size: .78rem; }
.detail-view-field strong { font-size: .92rem; }

/* El badge se montaba ENCIMA del detalle de la quincena: la regla que lo
   bajaba a la fila 3 estaba antes que la original y perdia. Aqui gana. */
.prow .prow-badge {
  grid-column: 1 / -1;
  grid-row: 3;
  justify-self: end;
  margin-top: 4px;
}
/* Editar en la misma linea que el estado de la comision: antes se llevaba una
   fila entera para el solo y la tarjeta quedaba enorme y vacia. */
.prow .prow-comision {
  flex-wrap: wrap;
  row-gap: 6px;
}
.prow .prow-comision-fin {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.prow .prow-comision-fin .small-btn { min-height: 44px; padding: 10px 16px; }

/* ── Las 3 tarjetas de arriba (Inicio y Ganancia) — CHG-2026-0307 ──────────
   Medido en 360x800: "Faltan por cobrar" era la unica etiqueta de 2 lineas y
   empujaba su numero 13px mas abajo que los otros dos; y las mismas tarjetas
   median 104px en Inicio y 91px en Ganancia.

   El truco para que los numeros SIEMPRE queden a la misma altura, tenga la
   etiqueta una linea o dos: la tarjeta es un grid de 3 filas (icono | etiqueta
   | numero) y la fila de la etiqueta es la elastica (1fr). El numero vive
   SIEMPRE en la ultima fila, asi que arranca a la misma altura en las tres.
   `display: contents` en el div de dentro sube la etiqueta y el numero a ser
   filas de la tarjeta sin tocar el HTML. */
.home-stat-grid .stat-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 8px;
  min-height: 100px;
}
.home-stat-grid .stat-card > div { display: contents; }
.home-stat-grid .stat-card span {
  font-size: .76rem;
  line-height: 1.25;
  font-weight: 600;
  margin-bottom: 0;
  align-self: center;
}
.home-stat-grid .stat-card strong {
  font-size: 1.06rem;
  line-height: 1.15;
  align-self: end;
}

/* La comisión del cobrador en verde: es plata a favor suyo. */
.prow .prow-comision-monto { color: var(--ok, #047857); font-weight: 700; }
.prow .prow-comision-monto.anulada { color: var(--muted); font-weight: 600; text-decoration: line-through; }

/* ── Avisos y ruta del día (CHG-2026-0313) ─────────────────────────────────
   Va al FINAL del archivo a propósito: la cascada pisa lo anterior, que es el
   patrón de esta hoja desde el rediseño del 14-jul. */

.head-acciones { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--texto, #0f172a);
  cursor: pointer;
}
.icon-btn:active { background: rgba(15, 23, 42, .06); }
.icon-btn .mi { width: 22px; height: 22px; fill: currentColor; }

/* El puntito rojo. Con `hidden` puesto NO se ve: el display de aquí no puede
   pisarlo (trampa vivida 4 veces en esta app — ver [hidden] al inicio). */
.aviso-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: #dc2626; color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 17px; text-align: center;
}

.avisos-panel { position: fixed; inset: 0; z-index: 70; }
.avisos-fondo { position: absolute; inset: 0; background: rgba(15, 23, 42, .16); backdrop-filter: blur(3px); }
.avisos-caja {
  position: absolute; top: 0; right: 0; left: 0;
  max-height: 78vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 0 0 16px 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
  padding-top: env(safe-area-inset-top);
  animation: avisosEntra .18s ease;
}
@keyframes avisosEntra { from { transform: translateY(-8px); opacity: .6; } to { transform: none; opacity: 1; } }
.avisos-cab {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--linea, #e5e7eb);
}
.avisos-cab h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.avisos-cab-acciones { display: flex; align-items: center; gap: 6px; }
.link-btn {
  border: 0; background: transparent; color: var(--brand, #2563eb);
  font-size: .8rem; font-weight: 600; cursor: pointer; padding: 6px 4px;
}
.avisos-lista { overflow-y: auto; padding: 6px 0 10px; }

.aviso-fila {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  width: 100%; text-align: left; border: 0; background: transparent;
  padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--linea, #f1f5f9);
}
.aviso-fila:active { background: rgba(15, 23, 42, .04); }
.aviso-titulo { font-size: .88rem; font-weight: 600; overflow-wrap: anywhere; }
.aviso-detalle {
  grid-column: 1 / -1;
  font-size: .78rem; color: var(--muted, #64748b); overflow-wrap: anywhere;
}
.aviso-fecha { font-size: .72rem; color: var(--muted, #64748b); white-space: nowrap; }
.aviso-veces {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border-radius: 8px; background: var(--brand, #2563eb); color: #fff;
  font-size: .68rem; font-weight: 700;
}

/* Los dos grupos de la home: "Para hoy" primero, el resto debajo. */
.grupo-ruta + .grupo-ruta { margin-top: 14px; }
.grupo-ruta-titulo {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px; padding: 0 2px;
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted, #64748b);
}
.grupo-ruta-num {
  min-width: 20px; padding: 1px 6px; border-radius: 9px;
  background: var(--brand, #2563eb); color: #fff;
  font-size: .72rem; font-weight: 700; text-align: center; letter-spacing: 0;
}
.grupo-ruta-nota { font-size: .7rem; font-weight: 600; color: #b45309; text-transform: none; letter-spacing: 0; }
.grupo-ruta-vacio {
  margin: 0; padding: 12px 14px;
  font-size: .82rem; color: var(--muted, #64748b); line-height: 1.45;
  background: var(--fondo-suave, #f8fafc); border-radius: 12px;
}

/* TRAMPA VIVIDA 4 VECES en esta app: cualquier `display:` del CSS pisa el
   atributo `hidden`, y el elemento se queda visible aunque el JS lo esconda —
   con el agravante de que un test que comprueba "aparece al hacer X" da verde
   porque YA estaba visible. Ninguna de las reglas de arriba declara `display`,
   así que hoy no pasa; esto lo deja blindado por si alguien agrega una. */
.avisos-panel[hidden], .aviso-badge[hidden] { display: none !important; }

/* ARREGLO tras la prueba visual (CHG-2026-0313). La captura a 360px mostró el
   título del aviso invisible y "Marcar leídos" azul sobre azul: la regla global
   `button { background: var(--primary); color: white }` de esta hoja pisaba mis
   estilos, porque yo declaraba `background: transparent` pero NO el color, y en
   `.link-btn` el fondo azul del button ganaba por orden.
   Se corrige declarando las dos cosas explícitamente. Esto solo se ve MIRANDO
   la captura: los selectores existían y el test los encontraba con su texto. */
.aviso-fila, .aviso-fila:hover {
  background: transparent;
  color: var(--texto, #0f172a);
  font-weight: 400;
  padding: 11px 14px;
  border-radius: 0;
}
.aviso-fila:active { background: rgba(15, 23, 42, .04); }
.aviso-titulo { color: var(--texto, #0f172a); }
.aviso-detalle, .aviso-fecha { color: var(--muted, #64748b); }

.link-btn, .link-btn:hover {
  background: transparent;
  color: var(--primary, #2563eb);
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  min-height: 0;
}
.link-btn:active { background: rgba(37, 99, 235, .08); }

.icon-btn, .icon-btn:hover {
  background: transparent;
  color: var(--texto, #0f172a);
  padding: 0;
  min-height: 0;
}
.icon-btn:active { background: rgba(15, 23, 42, .06); }
