/* Page content of the loan system, dressed in the same look as the shell.
   casa.css + Bootstrap set the shell (sidebar, bars, colors, night mode); this file only maps the
   content classes of the templates onto the same palette (--marca, --accion, --tinta, --borde,
   --apagado), so day and night mode work with no extra rules. */

:root {
  --ok-fg: #0d5c33;   --ok-bg: #e2f3e8;
  --warn-fg: #8a4e06; --warn-bg: #fff1d1;
  --bad-fg: #a3241b;  --bad-bg: #fdeceb;
  --info-fg: #1d4a6b; --info-bg: #e4f0f8;
}
html[data-tema="noche"] {
  --ok-fg: #86e3a9;   --ok-bg: #12331f;
  --warn-fg: #f2c877; --warn-bg: #3a2a08;
  --bad-fg: #ffa59c;  --bad-bg: #3b1814;
  --info-fg: #9fd0f0; --info-bg: #14293a;
}

/* ---------- Layout ---------- */
.container > * + * { margin-top: 1rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head h1 { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--tinta); }
.page-head .actions, .cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.section-head h2, .card > h2, legend { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--tinta); }
.stack { display: grid; gap: 1rem; }
.stack-sm { display: grid; gap: .5rem; }
.inline { display: inline; margin: 0; }
.muted { color: var(--apagado); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center; }

.card {
  background: var(--bs-body-bg, #fff);
  border: 0; border-radius: 16px; padding: 1.1rem;
  box-shadow: 0 10px 30px rgba(20, 40, 90, .08);
}
.card > h2 { margin-bottom: .75rem; }
.card.pay-box { border: 2px solid var(--accion); }
.pay-box .due-now { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.pay-box .due-now strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }

/* ---------- Buttons: same as Bootstrap's .btn-primary / .btn-outline-primary of casa.css ---------- */
a.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; font-weight: 600; text-decoration: none; }
.btn { color: var(--marca-texto); background: transparent; border: 1px solid var(--marca-texto); border-radius: .5rem; padding: .5rem 1rem; }
.btn:hover { background: var(--marca); color: #fff; }
.btn.primary { color: #fff; background: var(--accion); border-color: var(--accion); }
.btn.primary:hover { background: var(--accion-oscura); border-color: var(--accion-oscura); color: #fff; }
.btn.danger { color: #fff; background: #b02a37; border-color: #b02a37; }
.btn.danger:hover { filter: brightness(.92); color: #fff; }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn.is-sent { opacity: .6; cursor: progress; }
button.link { background: none; border: 0; padding: 0; color: var(--enlace); text-decoration: underline; }

/* ---------- Forms: Bootstrap .form-control look for bare inputs ---------- */
label { display: grid; gap: .25rem; font-weight: 600; font-size: .9rem; color: var(--tinta); }
.hint { font-weight: 400; color: var(--apagado); font-size: .85rem; }
.container input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .container select, .container textarea {
  display: block; width: 100%; min-height: 44px; padding: .5rem .75rem;
  font: inherit; font-weight: 400; color: var(--bs-body-color); background: var(--bs-body-bg, #fff);
  border: 1px solid var(--borde); border-radius: .5rem;
}
.container textarea { min-height: 96px; }
.container input:focus, .container select:focus, .container textarea:focus {
  outline: 0; border-color: var(--accion); box-shadow: 0 0 0 .25rem rgba(255, 107, 0, .18);
}
.container input[type=checkbox], .container input[type=radio] { width: 22px; height: 22px; accent-color: var(--accion); }
.check { display: flex; align-items: center; gap: .75rem; min-height: 44px; }
input.amount { min-height: 60px !important; font-size: 1.6rem !important; font-weight: 700; padding-left: 2.2rem !important; font-variant-numeric: tabular-nums; }
.input-affix { position: relative; }
.input-affix .affix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; font-weight: 700; color: var(--apagado); pointer-events: none; }
.input-affix.suffix .affix { left: auto; right: 14px; }
.container .input-affix.suffix input { padding-left: .75rem !important; padding-right: 2.2rem !important; }
.fields { display: grid; gap: 1rem; }
@media (min-width: 560px) {
  .fields.two { grid-template-columns: 1fr 1fr; }
  .fields.three { grid-template-columns: 1fr 1fr 1fr; }
  .fields .span-all { grid-column: 1 / -1; }
}
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { min-height: 44px; padding: 0 1rem; font-weight: 600; color: var(--marca-texto); background: transparent; border: 1px solid var(--marca-texto); border-radius: 999px; }
.chip:hover { background: var(--marca); color: #fff; }
/* flex-direction: row on purpose: with .card Bootstrap makes it a column, and then the 180px basis
   of each label became its HEIGHT (a date field floating in a tall empty box). */
.filters { display: flex; flex-direction: row; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filters label { flex: 1 1 140px; min-width: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--borde); border-radius: 12px; }
.tabs a { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 .75rem; border-radius: 9px; color: var(--tinta); font-weight: 600; text-decoration: none; white-space: nowrap; }
.tabs a[aria-current="page"] { background: var(--bs-body-bg, #fff); color: var(--marca-texto); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 .65rem; font-size: .78rem; font-weight: 700; border-radius: 999px; background: var(--borde); color: var(--tinta); white-space: nowrap; }
.badge-late, .badge-voided { background: var(--bad-bg); color: var(--bad-fg); }
.badge-due, .badge-partial, .badge-inactive { background: var(--warn-bg); color: var(--warn-fg); }
.badge-ok, .badge-paid, .badge-open, .badge-closed { background: var(--ok-bg); color: var(--ok-fg); }
.badge-current { background: var(--info-bg); color: var(--info-fg); }
.badge-voided { text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Figures ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 0; }
.stat { background: var(--bs-body-bg, #fff); border-radius: 16px; padding: .8rem 1rem; box-shadow: 0 10px 30px rgba(20, 40, 90, .08); }
.stat dt { font-size: .8rem; color: var(--apagado); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat dd { margin: 0; font-size: 1.4rem; font-weight: 800; color: var(--marca-texto); font-variant-numeric: tabular-nums; }
.stat.alert-stat dd { color: var(--bad-fg); }
.stats.flat .stat { background: none; box-shadow: none; padding: 0; }
.details { display: grid; margin: 0; }
.details > div { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--borde); }
.details > div:first-child { border-top: 0; }
.details dt { color: var(--apagado); font-weight: 600; font-size: .9rem; }
.details dd { margin: 0; }

/* ---------- Lists: look of .list-group.libreta cards ---------- */
.rows { list-style: none; margin: 0; padding: 0; background: var(--bs-body-bg, #fff); border-radius: 16px; box-shadow: 0 10px 30px rgba(20, 40, 90, .08); overflow: hidden; }
.rows > li { display: flex; align-items: stretch; border-top: 1px solid var(--borde); }
.rows > li:first-child { border-top: 0; }
.row-link { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 64px; padding: .65rem 1rem; color: inherit; text-decoration: none; }
.row-link:hover { background: rgba(26, 54, 93, .05); color: inherit; }
.row-text { display: grid; gap: 2px; min-width: 0; }
.row-title { font-weight: 700; color: var(--tinta); }
.row-sub { font-size: .85rem; color: var(--apagado); }
.row-side { display: grid; gap: 4px; justify-items: end; text-align: right; flex-shrink: 0; }
.row-amount { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--marca-texto); }
.row-call { flex: 0 0 56px; display: flex; align-items: center; justify-content: center; border-left: 1px solid var(--borde); color: var(--accion); font-weight: 700; font-size: .85rem; text-decoration: none; }
.row-static { flex: 1; min-width: 0; padding: .65rem 1rem; display: flex; justify-content: space-between; gap: .75rem; }
.rows > li.row-block { display: block; }
.void-wrap { padding: 0 .75rem .75rem; }
.empty { padding: 1.5rem 1rem; text-align: center; color: var(--apagado); background: var(--bs-body-bg, #fff); border: 1px dashed var(--borde); border-radius: 16px; }
.is-voided .row-title, .is-voided .row-amount, .is-voided .row-sub, .is-voided td, .is-voided .strike, .strike { text-decoration: line-through; color: var(--apagado); }
.is-voided .badge { text-decoration: none; }
/* El desplazamiento de la tabla queda dentro de su tarjeta y no en la página. */
.tabla-scroll { overflow-x: auto; }
table.weeks { width: 100%; border-collapse: collapse; }
.weeks th, .weeks td { padding: .6rem .4rem; text-align: left; border-top: 1px solid var(--borde); vertical-align: middle; }
.weeks thead th { border-top: 0; font-size: .78rem; color: var(--apagado); font-weight: 700; text-transform: uppercase; }
.weeks .num { text-align: right; }
.weeks tr.is-late td:first-child { box-shadow: inset 4px 0 0 #dc3545; padding-left: .6rem; }
details.void-box { border: 1px solid var(--borde); border-radius: 12px; }
details.void-box > summary { min-height: 44px; display: flex; align-items: center; padding: 0 1rem; font-weight: 600; color: var(--bad-fg); cursor: pointer; }
details.void-box > form { padding: 0 1rem 1rem; }

/* ---------- Receipt ---------- */
.receipt { display: grid; gap: 1rem; }
.receipt-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.receipt-total { font-size: 2.2rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--marca-texto); }
.stamp { display: inline-block; padding: 4px 12px; border: 3px solid #dc3545; border-radius: 8px; color: #dc3545; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

/* Language switch inside the sidebar / account menu looks like a menu row. */
.lang-switch { display: flex; align-items: center; width: 100%; padding: .5rem 1rem; background: none; border: 0; font: inherit; font-weight: 600; color: inherit; text-align: left; border-radius: .5rem; }
.barra-lateral .lang-switch { color: rgba(255, 255, 255, .85); }
.barra-lateral .lang-switch:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.barra-lateral form.inline { display: block; }
.dropdown-menu .lang-switch { padding: .25rem 0; color: var(--tinta); }

@media print {
  .barra-lateral, .barra-superior, .barra-inferior, .no-print, .alert { display: none !important; }
  body { padding-left: 0 !important; }
}

/* ---------- Clients map ---------- */
.clients-map { height: 65vh; min-height: 320px; border-radius: 16px; border: 1px solid var(--borde); }
.map-legend { display: flex; flex-wrap: wrap; gap: 1rem; list-style: none; padding: 0; margin: 0; }
.map-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .4rem; }
.map-dot-late { background: var(--bad-fg); }
.map-dot-current { background: var(--ok-fg); }
.map-dot-none { background: var(--apagado); }
.map-popup-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .5rem; }
