:root {
  --olive-900: #1f3317;
  --olive-800: #2f4a22;
  --olive-700: #3d5f2c;
  --olive-600: #4f7a34;
  --olive-100: #eef3e6;
  --gold: #c9b458;
  --bg: #f5f5f0;
  --surface: #ffffff;
  --surface-2: #fafaf7;
  --border: #e1e0d9;
  --text: #1b1b18;
  --text-2: #52514e;
  --muted: #898781;
  --primary: #3d5f2c;
  --primary-hover: #2f4a22;
  --danger: #c0392b;
  --good: #0a7d0a;
  --good-bg: #e3f4e1;
  --warn: #8a5a00;
  --warn-bg: #fdf1d3;
  --bad: #b3261e;
  --bad-bg: #fbe3e1;
  --info: #1c5cab;
  --info-bg: #e3eefb;
  --gray-bg: #eeeeea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --sidebar-w: 248px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); font-size: 14px; line-height: 1.45; }
[hidden] { display: none !important; }
a { color: var(--olive-700); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Login ---------- */
.login-view {
  min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 10%, #4f7a34 0, #2f4a22 45%, #1f3317 100%);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); display: grid; gap: 14px; text-align: center;
}
.login-logo { width: 104px; height: 104px; margin: 0 auto; object-fit: contain; }
.login-card h1 { font-size: 15px; letter-spacing: .3px; color: var(--olive-800); margin: 0; }
.login-card label { text-align: left; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100%; }
.sidebar {
  width: var(--sidebar-w); background: var(--olive-900); color: #e9eedf; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand strong { display: block; font-size: 14px; }
.brand small { color: #b8c4a8; font-size: 12px; }
#menu { padding: 8px 0 24px; }
#menu .menu-group { padding: 14px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #8fa07e; }
#menu a {
  display: flex; gap: 10px; align-items: center; padding: 9px 18px; color: #e9eedf; text-decoration: none;
  border-left: 3px solid transparent;
}
#menu a:hover { background: rgba(255,255,255,.06); }
#menu a.active { background: rgba(255,255,255,.1); border-left-color: var(--gold); color: #fff; font-weight: 600; }
#menu .ico { width: 20px; text-align: center; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; gap: 12px; align-items: center; padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.user-box { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.user-name { font-weight: 600; }
.icon-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; padding: 4px 8px; }
.view { padding: 20px; max-width: 1400px; width: 100%; outline: none; }

/* ---------- Buscador rápido ---------- */
.quicksearch { position: relative; flex: 1; max-width: 560px; }
.quicksearch input { width: 100%; padding: 9px 12px 9px 34px; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23898781' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat 11px center; }
.qs-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; overflow-y: auto; z-index: 50;
  min-width: min(520px, calc(100vw - 32px));
}
.qs-results .qs-head { padding: 8px 12px 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.qs-results a { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 8px 12px; text-decoration: none; color: var(--text); }
.qs-results a:hover, .qs-results a.sel { background: var(--olive-100); }
.qs-results .empty { padding: 14px; color: var(--muted); }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.page-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--text-2); }
.page-head .flex select, .page-head .flex input { width: auto; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.btn {
  display: inline-flex; gap: 6px; align-items: center; justify-content: center; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: #c9c8bf; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-wa { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.btn-wa:hover { background: #17834a; }

label { display: grid; gap: 4px; font-weight: 500; color: var(--text-2); font-size: 13px; }
input, select, textarea {
  font: inherit; color: var(--text); padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(79,122,52,.35); border-color: var(--olive-600); }
textarea { resize: vertical; min-height: 64px; }
input[type=checkbox] { width: auto; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--text); }
.check input { flex-shrink: 0; width: 16px; height: 16px; margin: 0; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-error { color: var(--bad); min-height: 1em; font-size: 13px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { min-width: 130px; }
.filters .grow { flex: 1; min-width: 200px; }
/* Asterisco de obligatorio junto al texto de la etiqueta (no debajo del campo) */
label.req { grid-template-columns: max-content 1fr; }
label.req > input, label.req > select, label.req > textarea { grid-column: 1 / -1; }
label.req::after { content: '*'; color: var(--bad); grid-row: 1; grid-column: 2; justify-self: start; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tbl th { background: var(--surface-2); font-weight: 600; color: var(--text-2); position: sticky; top: 0; white-space: nowrap; }
.tbl tbody tr:hover { background: #fbfbf6; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); }
.tbl tr.row-anulado td { color: var(--muted); text-decoration: line-through; }
.tbl tr.row-anulado td .badge, .tbl tr.row-anulado td .btn { text-decoration: none; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.sel-row td { background: var(--olive-100); }
#cuotas .tbl tbody tr { cursor: pointer; }
.tbl .sub td { background: #fcfcf8; font-size: 12px; color: var(--text-2); }
.tbl-empty { padding: 28px; text-align: center; color: var(--muted); }
.tbl .actions { white-space: nowrap; text-align: right; }

/* ---------- Badges / estados ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gray-bg); color: var(--text-2); white-space: nowrap; }
.b-PAGADO, .b-AL_DIA, .b-VIGENTE, .b-ACTIVO { background: var(--good-bg); color: var(--good); }
.b-PARCIAL { background: var(--warn-bg); color: var(--warn); }
.b-PENDIENTE { background: var(--info-bg); color: var(--info); }
.b-VENCIDO, .b-DEUDA { background: var(--bad-bg); color: var(--bad); }
.b-ANULADO, .b-INACTIVO { background: var(--gray-bg); color: #6b6a65; }
.b-turno-DIURNO { background: #fdf1d3; color: #7a5200; }
.b-turno-NOCTURNO { background: #e4e6f7; color: #2d3478; }
.tbl tr.row-inactivo td { color: var(--muted); }
.situacion { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; padding: 8px 14px; border-radius: 10px; font-size: 15px; }
.situacion.AL_DIA { background: var(--good-bg); color: var(--good); }
.situacion.PARCIAL { background: var(--warn-bg); color: var(--warn); }
.situacion.DEUDA { background: var(--bad-bg); color: var(--bad); }

/* ---------- KPI ---------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k-label { color: var(--text-2); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.kpi .k-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi .k-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.progress { height: 6px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: var(--olive-600); border-radius: 99px; }
.chart-box { position: relative; height: 280px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Detalle vecino ---------- */
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--olive-100); color: var(--olive-800); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.mini-stats div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.mini-stats b { display: block; font-size: 17px; }
.mini-stats span { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 9px 14px; font: inherit; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--olive-800); border-bottom-color: var(--olive-600); font-weight: 600; }

/* Filas dinámicas (teléfonos, correos...) */
.rows-editor { display: grid; gap: 8px; }
.rows-editor .row { display: grid; gap: 8px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)) auto; align-items: center; }
.section-title { font-weight: 700; color: var(--olive-800); margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }

/* Autocomplete vecino */
.ac { position: relative; }
.ac-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; z-index: 40; }
.ac-list div { padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.ac-list div:hover, .ac-list div.sel { background: var(--olive-100); }
.selected-vecino { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--olive-100); border-radius: 8px; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,24,16,.5); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.lg { max-width: 860px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.close-x { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; }
.toast { background: #1f2a19; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; animation: tin .2s ease-out; }
.toast.error { background: var(--bad); }
.toast.ok { background: var(--olive-700); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Recibo (vista en pantalla e impresión) ---------- */
.recibo { background: #fff; color: #111; border: 1px solid #ccc; border-radius: 8px; padding: 22px; max-width: 720px; margin: 0 auto; font-size: 13px; }
.recibo-head { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid var(--olive-800); padding-bottom: 12px; }
.recibo-head img { width: 72px; height: 72px; object-fit: contain; }
.recibo-head .org { flex: 1; }
.recibo-head .org strong { display: block; font-size: 14px; color: var(--olive-800); }
.recibo-head .org span { font-size: 11px; color: #555; display: block; }
.recibo-num { border: 2px solid var(--olive-800); border-radius: 8px; padding: 8px 12px; text-align: center; min-width: 150px; }
.recibo-num b { display: block; font-size: 16px; }
.recibo-num small { font-size: 11px; font-weight: 700; color: var(--olive-800); letter-spacing: .5px; }
.recibo table.datos { width: 100%; margin: 14px 0; border-collapse: collapse; }
.recibo table.datos th { text-align: left; width: 150px; color: #555; font-weight: 600; padding: 3px 0; vertical-align: top; }
.recibo table.datos td { padding: 3px 0; }
.recibo table.det { width: 100%; border-collapse: collapse; margin: 8px 0; }
.recibo table.det th, .recibo table.det td { border: 1px solid #bbb; padding: 6px 8px; }
.recibo table.det th { background: #eef3e6; }
.recibo .total { font-size: 16px; font-weight: 700; text-align: right; margin-top: 6px; }
.recibo-foot { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; margin-top: 16px; }
.recibo-foot img { width: 100px; height: 100px; }
.recibo .sello-anulado { color: var(--bad); border: 3px solid var(--bad); font-size: 26px; font-weight: 800; padding: 4px 16px; transform: rotate(-8deg); display: inline-block; letter-spacing: 3px; }

/* ---------- Reportes ---------- */
.report-head { display: none; }
.summary-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 14px; }
.summary-box div { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.summary-box b { display: block; font-size: 18px; }
.summary-box span { color: var(--text-2); font-size: 12px; }
.cell-PAGADO { background: #eaf6e8; }
.cell-PARCIAL { background: #fdf4dc; }
.cell-VENCIDO { background: #fbe9e7; }
.cell-PENDIENTE { background: #f2f6fc; }

/* ---------- Consulta de vehículo ---------- */
.placa-input { font-size: 26px !important; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; text-align: center; padding: 12px; }
.veh-card { border-left: 6px solid var(--border); }
.veh-card.veh-AL_DIA { border-left-color: var(--good); }
.veh-card.veh-PARCIAL { border-left-color: #d99a00; }
.veh-card.veh-DEUDA { border-left-color: var(--bad); }
.veh-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.veh-placa { font-size: 22px; font-weight: 800; letter-spacing: 2px; border: 2px solid var(--text); border-radius: 6px; padding: 2px 12px; background: #fff; }
.veh-desc { color: var(--text-2); }
.veh-situacion { font-size: 20px; font-weight: 800; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--gray-bg); }
.veh-AL_DIA .veh-situacion { background: var(--good-bg); color: var(--good); }
.veh-PARCIAL .veh-situacion { background: var(--warn-bg); color: var(--warn); }
.veh-DEUDA .veh-situacion { background: var(--bad-bg); color: var(--bad); }
.veh-noreg { border-left: 6px solid var(--muted); }
.veh-info dd { font-size: 15px; }
.veh-linea { padding: 2px 0; white-space: nowrap; }
.veh-total { font-size: 20px; padding: 10px 14px; border-radius: 10px; background: var(--olive-100); margin-bottom: 12px; }
.veh-total b { font-size: 26px; }
@media (max-width: 640px) { .veh-linea { white-space: normal; text-align: right; } }

/* ---------- Impresión ---------- */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; }
  #print-area .recibo { border: 0; max-width: none; padding: 0; }
  #print-area table { page-break-inside: auto; }
  #print-area tr { page-break-inside: avoid; }
  .print-report h1 { font-size: 16px; }
  .print-report .ph { display: flex; gap: 12px; align-items: center; border-bottom: 2px solid #2f4a22; padding-bottom: 8px; margin-bottom: 10px; }
  .print-report .ph img { width: 56px; height: 56px; }
  .print-report .ph strong { display: block; color: #2f4a22; }
  .print-report table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
  .print-report th, .print-report td { border: 1px solid #999; padding: 3px 5px; }
  .print-report th { background: #eef3e6 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-report tfoot td { font-weight: 700; }
  .print-report .num { text-align: right; }
  .print-report .resumen { margin-top: 10px; display: flex; gap: 20px; flex-wrap: wrap; font-size: 11px; }
  .print-report .pie { margin-top: 10px; font-size: 9px; color: #666; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sidebar-foot { display: none; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; display: flex; flex-direction: column; width: min(290px, 85vw); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar.open ~ .main::after { content: ''; position: fixed; inset: 0; background: rgba(15,20,10,.45); z-index: 55; }
  #menu { flex: 1; }
  .sidebar-foot { display: grid; gap: 2px; padding: 12px 10px 20px; border-top: 1px solid rgba(255,255,255,.1); }
  .sidebar-foot .sf-user { padding: 4px 8px 8px; }
  .sidebar-foot .sf-user strong { display: block; font-size: 13px; }
  .sidebar-foot .sf-user small { color: #b8c4a8; }
  .sidebar-foot a, .sidebar-foot button { display: block; text-align: left; color: #e9eedf; text-decoration: none; background: none; border: 0; font: inherit; padding: 10px 8px; border-radius: 8px; cursor: pointer; }
  .sidebar-foot a:hover, .sidebar-foot button:hover { background: rgba(255,255,255,.08); }
  .icon-btn { display: block; }
  .user-box { display: none; }
  .quicksearch { max-width: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 16px; }
  .form-grid .span-2 { grid-column: 1 / -1; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .recibo-head { flex-wrap: wrap; }
}

/* ---------- Celular ---------- */
@media (max-width: 640px) {
  body { font-size: 14px; }
  input, select, textarea { font-size: 16px; } /* evita el zoom automático en iOS */
  h1 { font-size: 19px; }
  .view { padding: 12px 12px 32px; }
  .card { padding: 14px 12px; border-radius: 12px; }
  .card + .card { margin-top: 12px; }
  .page-head { margin-bottom: 12px; }
  .page-head > .flex, .page-head > div:last-child:not(:first-child) { width: 100%; }
  .page-head .flex .btn { flex: 1 1 auto; }
  .btn { padding: 10px 12px; }
  .btn-sm { padding: 7px 10px; }

  /* Indicadores en 2 columnas */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi .k-label { font-size: 12px; }
  .kpi .k-value { font-size: 18px; }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .chart-box { height: 230px; }
  .mini-stats, .summary-box { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mini-stats b, .summary-box b { font-size: 15px; }
  .situacion { font-size: 13px; padding: 6px 10px; }

  /* Filtros en 2 columnas */
  .filters { gap: 8px; }
  .filters label { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .filters .grow { flex-basis: 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }

  /* Tablas como tarjetas */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tfoot, .tbl.cards tr { display: block; width: 100%; }
  .tbl.cards tr { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
  .tbl.cards tbody tr:hover { background: var(--surface); }
  .tbl.cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 5px 0; text-align: right; white-space: normal; }
  .tbl.cards td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: 12px; text-align: left; flex-shrink: 0; max-width: 45%; }
  .tbl.cards td[data-label=""]::before { content: none; }
  .tbl.cards td[data-label=""] { justify-content: flex-end; }
  .tbl.cards td:empty { display: none; }
  .tbl.cards td:first-child { font-size: 15px; }
  .tbl.cards td.actions { justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
  .tbl.cards tfoot tr { display: flex; flex-wrap: wrap; gap: 4px 16px; background: var(--olive-100); }
  .tbl.cards tfoot td { display: block; padding: 2px 0; background: none; }
  .tbl.cards tfoot td:empty { display: none; }
  .tbl.cards tr.row-anulado { opacity: .75; }
  .tbl.cards td input[type=number] { max-width: 130px; }
  /* Registrar pago: tarjetas compactas */
  #cuotas .tbl.cards td[data-label="Concepto"], #cuotas .tbl.cards td[data-label="Importe"], #cuotas .tbl.cards td[data-label="Pagado"] { display: none; }
  .tbl.cards tr.sel-row { background: var(--olive-100); border-color: var(--olive-600); box-shadow: 0 0 0 1px var(--olive-600); }
  .tbl.cards tr.sel-row td { background: none; }
  /* Tablas especiales (meses en columnas): desplazamiento horizontal */
  .table-wrap:has(> .tbl:not(.cards)) { overflow-x: auto; border: 1px solid var(--border); background: var(--surface); }

  /* Ventanas a pantalla completa */
  .modal-backdrop { padding: 0; place-items: stretch; }
  .modal-backdrop { grid-template-rows: minmax(0, 1fr); }
  .modal, .modal.lg { max-width: none; height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .modal-body { padding: 14px 12px; flex: 1; min-height: 0; }
  .modal-foot { padding: 10px 12px; }
  .modal-foot .btn { flex: 1 1 calc(50% - 8px); }
  .modal-foot .spacer { display: none; }

  /* Recibo */
  .recibo { padding: 12px; border: 0; font-size: 12.5px; }
  .recibo-head { gap: 10px; }
  .recibo-head img { width: 56px; height: 56px; }
  .recibo-head .org { flex: 1 1 calc(100% - 70px); }
  .recibo-num { width: 100%; }
  .recibo table.datos th { width: 110px; }
  .recibo-foot { flex-direction: column; align-items: center; }

  /* Editores de filas (teléfonos, vehículos, viviendas) */
  .rows-editor .row { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; border: 1px dashed var(--border); border-radius: 8px; }
  .rows-editor .row > :nth-last-child(2):nth-child(odd) { grid-column: 1 / -1; }
  .rows-editor .row > button { grid-column: 1 / -1; justify-self: end; padding: 2px 10px; color: var(--bad); }
  .section-title { flex-wrap: wrap; }
  .selected-vecino { gap: 6px 10px; }
  .info-list { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .info-list dd { margin-bottom: 8px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs button { white-space: nowrap; padding: 9px 10px; }

  #toast-root { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  .qs-results { position: fixed; left: 8px; right: 8px; top: 58px; min-width: 0; }
  .login-card { padding: 24px 18px; }
}
