:root {
  --text: #e5e7eb;
  --muted: #94a3b8;
  --bg1: #0f172a;
  --bg2: #111827;
  --panel: #172033;
  --border: #334155;
  --ok: #10b981;
  --warn: #f59e0b;
  --late: #ef4444;
  --primary: #3b82f6;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.28s;
  --app-fixed-brand-h: 76px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(150deg, #0b1220, #0f172a);
  min-height: 100vh;
}
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  animation: loginScreenIn 0.5s var(--ease-out) both;
}
@keyframes loginScreenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.login-card {
  width: 100%;
  max-width: 430px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.login-card:focus-within {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.login-card--shake {
  animation: loginShake 0.45s ease;
}
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.login-card h1 { margin: 0 0 10px; font-size: 24px; }
.login-help { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.super-billing-summary-line {
  color: var(--muted);
  display: inline-block;
}

.super-tenant-actions {
  white-space: normal;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.super-tenant-detail-row td {
  padding-top: 0;
  border-top: none;
  background: rgba(0, 0, 0, 0.12);
}

.super-tenant-detail-inner {
  padding: 12px 14px 14px;
  border-radius: 0 0 8px 8px;
}

.super-tenant-detail-title {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 14px;
}

.super-paid-months-list {
  margin: 0 0 12px;
  padding-left: 1.25rem;
  font-size: 13px;
  line-height: 1.5;
}

.super-paid-month-key {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  opacity: 0.9;
}

.super-tenant-detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.super-tenant-detail-hint {
  font-size: 12px;
  margin: 10px 0 0;
  line-height: 1.4;
}

.login-success-banner {
  color: #86efac;
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(6, 78, 59, 0.35);
}
.login-callback-error-banner {
  color: #fecaca;
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(127, 29, 29, 0.25);
}
.login-forgot-wrap {
  margin: 10px 0 0;
  text-align: center;
}
.login-forgot-under-pass {
  margin-top: 6px;
  text-align: left;
}
.login-forgot-link {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.login-forgot-link:hover {
  color: var(--text);
}
.login-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.error-banner {
  flex: 1 1 100%;
  color: #fecaca;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.35);
  border: 1px solid rgba(248, 113, 113, 0.35);
  animation: errorBannerIn 0.3s var(--ease-out) both;
}
@keyframes errorBannerIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.danger-zone {
  border: 1px solid #7f1d1d;
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.2);
  padding: 10px;
  margin-top: 10px;
}
.danger-zone p { color: #fecaca; font-size: 13px; margin-bottom: 8px; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), visibility 0.3s;
}
.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.modal-card {
  width: 100%;
  max-width: 520px;
  border: 1px solid #7f1d1d;
  background: #2b0d0d;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.94) translateY(12px);
  opacity: 0;
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}
.modal-backdrop.is-open .modal-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.modal-card h3 { margin: 0 0 10px; color: #fecaca; font-size: 18px; }
.modal-card p { color: #fecaca; font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.modal-card p:last-of-type { margin-bottom: 0; }
.modal-question { margin-top: 12px !important; margin-bottom: 4px !important; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.app-shell {
  min-height: 100vh;
  position: relative;
}
.app {
  min-height: 100vh;
}
aside {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 55;
  width: 250px;
  height: 100vh;
  max-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 18px;
  padding-bottom: calc(18px + var(--app-fixed-brand-h, 76px));
  background: rgba(15, 23, 42, 0.95);
  border-right: 1px solid var(--border);
  transition: border-color var(--dur) ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.app-fixed-brand {
  position: fixed;
  z-index: 60;
  bottom: 0;
  left: 0;
  width: 250px;
  box-sizing: border-box;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(51, 65, 85, 0.55);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.app-fixed-brand__inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.app-fixed-brand .app-version-label {
  margin-top: 0;
}
.app-brand-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(51, 65, 85, 0.45);
}
.app-brand-footer__text {
  display: block;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.72);
  letter-spacing: 0.03em;
  line-height: 1.35;
}
.micronics-logo {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-family: Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
.micronics-logo__by {
  text-transform: lowercase;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.8);
}
.micronics-logo__word {
  text-transform: uppercase;
  letter-spacing: 0.28em; /* igual a SYSTEMS para que se vea unificada */
  font-size: 10px;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.72); /* base igual a SYSTEMS */
}
.micronics-logo__systems {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 10px;
  color: rgba(148, 163, 184, 0.72);
  margin-left: 2px;
  transform: translateY(0);
  white-space: nowrap;
}
.micronics-logo__m {
  color: #ef4444;
  font-weight: 700;
}
.micronics-logo__rest {
  color: rgba(148, 163, 184, 0.72);
  font-weight: 700;
}
.micronics-logo__s {
  color: #22c55e;
  font-weight: 700;
}
.app-reg-mark {
  font-size: 0.72em;
  font-weight: 600;
  vertical-align: super;
  margin-left: 2px;
  color: rgba(148, 163, 184, 0.9);
}
.app-version-label {
  display: block;
  margin-top: 8px;
  font-size: 10px;
  color: rgba(148, 163, 184, 0.55);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.login-card-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(51, 65, 85, 0.45);
  text-align: center;
}
.login-brand-line {
  margin: 0 0 6px;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.72);
  letter-spacing: 0.03em;
  line-height: 1.35;
}
.login-app-version {
  margin: 0;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.6);
  letter-spacing: 0.05em;
}
.brand { font-weight: 700; font-size: 18px; margin-bottom: 6px; }
.subtitle { color: var(--muted); margin: 0 0 18px; font-size: 12px; }
.session-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
  background: rgba(23, 32, 51, 0.6);
  font-size: 13px;
}
.nav-btn {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 10px 11px;
  cursor: pointer;
  transition: background var(--dur) ease, border-color var(--dur) ease, transform 0.12s ease, color var(--dur) ease;
}
.nav-btn:hover { background: #162237; }
.nav-btn:active { transform: scale(0.98); }
.nav-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 1), 0 0 0 4px rgba(59, 130, 246, 0.55);
}
.nav-btn.active { background: #12253e; border-color: #2c4f7d; }
.nav-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 8px 4px;
}
.nav-btn.nav-sub {
  padding-left: 16px;
  font-size: 13px;
  margin-bottom: 6px;
}
main {
  padding: 20px;
  margin-left: 250px;
  min-height: 100vh;
  box-sizing: border-box;
}
.sync-mode-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  font-size: 14px;
  line-height: 1.45;
}
.sync-mode-banner__text {
  margin: 0;
  flex: 1 1 220px;
  color: var(--text);
}
.billing-alert-banner {
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid rgba(220, 38, 38, 0.5);
  background: rgba(220, 38, 38, 0.12);
  font-size: 14px;
  line-height: 1.45;
}
.billing-alert-banner__text {
  margin: 0;
  color: var(--text);
}
.billing-alert-banner--readonly {
  border-color: rgba(217, 119, 6, 0.55);
  background: rgba(217, 119, 6, 0.14);
}
main.billing-read-only-main {
  opacity: 0.72;
  filter: grayscale(0.22);
}
.super-license-plan-ends {
  font-size: 14px;
  white-space: nowrap;
}
h1 { margin: 0 0 8px; font-size: 25px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }

.cards {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
.card {
  background: rgba(23, 32, 51, 0.85);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  transition: border-color var(--dur) ease, transform var(--dur) ease, box-shadow var(--dur) ease;
}
.card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.card-title { color: var(--muted); font-size: 12px; }
.card-value { font-size: 24px; margin-top: 7px; font-weight: 700; }

.view { display: none; }
.view.active {
  display: block;
  animation: viewEnter 0.35s var(--ease-out) forwards;
}
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.panel {
  margin-top: 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.panel:hover { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); }
.panel-head {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.panel-body { padding: 12px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 9px;
  border-bottom: 1px solid #24344b;
}
.click-row { cursor: pointer; }
.click-row:hover { background: rgba(59, 130, 246, 0.09); }
.click-row.selected { background: rgba(59, 130, 246, 0.18); }
th { color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 0.15s ease; }
.badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.paid { background: rgba(16, 185, 129, 0.17); color: #86efac; }
.due { background: rgba(245, 158, 11, 0.17); color: #fcd34d; }
.late { background: rgba(239, 68, 68, 0.17); color: #fca5a5; }

.btn {
  border: 1px solid #2c4f7d;
  background: #173053;
  color: #dbeafe;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: filter var(--dur) ease, transform 0.1s ease, border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 1), 0 0 0 4px rgba(96, 165, 250, 0.6);
}
.btn-danger {
  border-color: #7f1d1d;
  background: #3f1111;
  color: #fecaca;
}
.btn-danger:focus-visible {
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 1), 0 0 0 4px rgba(248, 113, 113, 0.5);
}
/** Rojo suave (inquilinos ABM); más pastel que .btn-danger */
.btn-danger-pastel {
  border-color: rgba(248, 180, 180, 0.55);
  background: rgba(220, 100, 100, 0.28);
  color: #fecdd3;
}
.btn-danger-pastel:hover {
  filter: brightness(1.12);
  border-color: rgba(252, 200, 200, 0.65);
}
.btn-danger-pastel:focus-visible {
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 1), 0 0 0 4px rgba(252, 165, 165, 0.45);
}
.btn:disabled,
.btn[disabled] {
  cursor: not-allowed;
  background: #334155;
  color: #94a3b8;
  border-color: #475569;
  opacity: 0.75;
  filter: none;
  transform: none;
}
.btn:disabled:hover,
.btn[disabled]:hover {
  filter: none;
  transform: none;
}
.toolbar { display: flex; gap: 8px; align-items: center; }
.form-toolbar-block {
  margin-top: 14px;
}
.form-toolbar {
  margin: 0;
  flex-wrap: wrap;
}
.form-toolbar-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.form-section-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 22px 0 18px;
}
.month-nav { display: flex; align-items: center; gap: 8px; }
.dashboard-cobranza-head {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}
.month-label {
  min-width: 130px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
input, select, textarea {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--text);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
  font-family: inherit;
  font-size: 14px;
}
/* Leyenda “Seleccionar…” en selects required sin valor (opción placeholder disabled) */
select:required:invalid {
  color: rgba(148, 163, 184, 0.72);
}
select:required:valid {
  color: var(--text);
}
select option:not(:disabled) {
  color: var(--text);
}
/* Contrato — propiedades del titular ya vinculadas a otro contrato */
select#cPropiedadPick option:disabled,
select#cPropiedadPick option.propiedad-pick--ocupada {
  color: rgba(100, 116, 139, 0.55);
}
/* Contrato nuevo: unidad solo de referencia (ya alquilada) — control cerrado atenuado */
select#cPropiedadPick.c-propiedad-pick--solo-ocupadas:not(:focus) {
  color: rgba(100, 116, 139, 0.62);
}
textarea { resize: vertical; min-height: 72px; }
.input-monto {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.form-monto-moneda {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.form-monto-moneda__monto {
  flex: 0 1 11rem;
  min-width: 0;
}
.form-monto-moneda__moneda {
  flex: 0 0 9.75rem;
}
.input-monto--contrato {
  max-width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: rgba(100, 116, 139, 0.9); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 5px; }
.form-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.form-grid-span2 { grid-column: 1 / -1; }

.license-code-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.license-code-input-wrap > input {
  flex: 1 1 220px;
  min-width: 0;
}
.license-code-input-wrap > input[readonly] {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
}

input.license-code-field {
  text-transform: uppercase;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
}

/* Cobranzas: un solo panel en la fila → ocupar todo el ancho del contenido */
.row.cobranzas-form-row {
  grid-template-columns: 1fr;
}

/* Contratos ABM: panel y campos al ancho útil del main (la .row por defecto es 2 columnas) */
.row.contratos-abm-row {
  grid-template-columns: 1fr;
}

/*
 * Contratos: grilla 12×1fr (mismo criterio que Cobranzas). Filas claras y lectura cómoda;
 * sin forzar anchos mínimos artificiales: los controles van al 100% de su celda.
 */
#contratos #formContrato .form-grid.form-grid--contrato {
  display: grid;
  gap: 16px 20px;
  align-items: start;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
#contratos #formContrato .form-grid.form-grid--contrato > .form-contrato__celda {
  min-width: 0;
}
#contratos #formContrato .form-contrato__celda .hint {
  margin-top: 8px;
  margin-bottom: 0;
}
#contratos #formContrato .form-contrato__celda--propietario {
  grid-column: span 6;
}
#contratos #formContrato .form-contrato__celda--inquilino {
  grid-column: span 6;
}
#contratos #formContrato .form-contrato__celda--propiedad {
  grid-column: 1 / -1;
  min-width: 0;
}
#contratos #formContrato .form-contrato__celda--tipo-plazo-fila {
  grid-column: 1 / -1;
  min-width: 0;
}
/* Tipo + plazo + cantidad: tres columnas iguales en todo el ancho del formulario */
#contratos #formContrato .form-contrato__triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: end;
  width: 100%;
}
#contratos #formContrato .form-contrato__triple__col {
  min-width: 0;
}
/* Fechas: mitad y mitad; las fechas con calendario necesitan aire */
#contratos #formContrato .form-contrato__celda--inicio,
#contratos #formContrato .form-contrato__celda--fin {
  grid-column: span 6;
}
#contratos #formContrato .form-contrato__celda--monto {
  grid-column: 1 / -1;
}
/* Ajustes: tercios iguales (selects largos: IPC, frecuencias…) */
#contratos #formContrato .form-contrato__celda--ajuste-tipo,
#contratos #formContrato .form-contrato__celda--ajuste-frec,
#contratos #formContrato .form-contrato__celda--ajuste-pct {
  grid-column: span 4;
}
#contratos #formContrato select,
#contratos #formContrato .propietario-combo input {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
#contratos #formContrato .propietario-combo {
  width: 100%;
  max-width: none;
}
#contratos #formContrato .date-group {
  width: 100%;
}
/* Monto crece con el espacio; moneda ancha fija razonable y pegada con poco gap */
#contratos #formContrato .form-monto-moneda {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
  width: 100%;
}
#contratos #formContrato .form-monto-moneda__monto {
  flex: 1 1 16rem;
  min-width: min(100%, 14rem);
}
#contratos #formContrato .form-monto-moneda__moneda {
  flex: 0 1 12rem;
  min-width: 9rem;
}
#contratos #formContrato .input-monto--contrato {
  width: 100%;
  max-width: none;
  text-align: right;
}

/*
 * Campos en proporción al contenido típico: contrato (texto largo) más ancho;
 * fecha corta; mes+anticipo; monto alineado; estado y medio compactos.
 * minmax(0, …) evita desborde horizontal; fr reparte el resto al ancho de la página.
 */
#cobranzas #formPago.form-grid--cobranzas {
  display: grid;
  gap: 12px 16px;
  align-items: start;
  grid-template-columns:
    minmax(0, 2.5fr)
    minmax(10.5rem, 0.65fr)
    minmax(12rem, 1.25fr)
    minmax(min(11rem, 100%), 0.85fr)
    minmax(7.5rem, 0.55fr)
    minmax(8.5rem, 0.6fr);
}
#cobranzas #formPago.form-grid--cobranzas > div {
  min-width: 0;
}
#cobranzas #formPago.form-grid--cobranzas .propietario-combo,
#cobranzas #formPago.form-grid--cobranzas .propietario-combo input {
  max-width: none;
}
#cobranzas #formPago.form-grid--cobranzas .input-monto {
  width: 100%;
  min-width: 7.5rem;
  max-width: min(18rem, 100%);
}

/* Propietarios y propiedades: ancho completo del panel; proporciones con fr + mínimos en rem */
.form-propietario-propiedad {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.form-block__solo {
  margin-bottom: 12px;
}
.form-block__solo:last-child {
  margin-bottom: 0;
}
.form-block__solo .propietario-combo,
.form-block__solo select#propSlotSelect {
  max-width: none;
  width: 100%;
}
.form-block__solo--notas {
  margin-top: 10px;
  margin-bottom: 0;
}
.form-block__solo--notas input {
  max-width: 100%;
}
.form-block__fila {
  display: grid;
  gap: 10px 14px;
  align-items: start;
  margin-bottom: 10px;
}
.form-block__celda {
  min-width: 0;
}
.form-block__celda .hint {
  margin-top: 4px;
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.35;
}
/* Apellido + nombre(s) + documento + tel */
.form-block__fila--titular {
  grid-template-columns:
    minmax(0, 1fr) minmax(0, 1.1fr) minmax(9rem, 0.95fr) minmax(7rem, 0.75fr);
}
/* ID unidad + calle (ID más angosta, dirección toma el resto) */
.form-block__fila--id-dir {
  grid-template-columns: minmax(8rem, 0.42fr) minmax(11rem, 1fr);
}
/* Depto, localidad, CP, provincia */
.form-block__fila--ubic {
  grid-template-columns: minmax(0, 0.55fr) minmax(0, 1fr) minmax(0, 0.42fr) minmax(0, 0.55fr);
}
.form-block__fila--ubic .form-block__celda--unidad {
  min-width: 6rem;
}
.form-block__fila--ubic .form-block__celda--localidad {
  min-width: 7.5rem;
}
.form-block__fila--ubic .form-block__celda--cp {
  min-width: 4.5rem;
}
.form-block__fila--ubic .form-block__celda--prov {
  min-width: 7rem;
}

.password-field {
  position: relative;
  display: block;
  width: 100%;
}
.password-field--small {
  max-width: 220px;
}
.password-field input {
  padding-right: 42px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: color var(--dur) ease, background var(--dur) ease;
}
.password-toggle:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
}
.password-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 1), 0 0 0 4px rgba(96, 165, 250, 0.5);
}
.password-toggle__show,
.password-toggle__hide {
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle .hidden {
  display: none !important;
}

.input-pass-small {
  max-width: 220px;
}
.password-field--small .input-pass-small {
  max-width: none;
  width: 100%;
}
.date-group {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 6px;
  align-items: center;
}
.date-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #2c4f7d;
  background: #173053;
  color: #dbeafe;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  transition: filter var(--dur) ease, transform 0.1s ease;
}
.date-btn:hover { filter: brightness(1.08); }
.date-btn:active { transform: scale(0.92); }
.date-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.45);
}
.hint { margin-top: 12px; color: var(--muted); font-size: 13px; }

.anticipo-check-label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.2;
  color: var(--text);
  width: fit-content;
  max-width: 100%;
}
.anticipo-check-label input {
  flex-shrink: 0;
  margin: 0;
}
.anticipo-check-label span {
  white-space: nowrap;
}

.adjust-alerts {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.adjust-alerts__head {
  margin: 0 0 8px 0;
  color: var(--warn);
  font-size: 14px;
}
.adjust-alerts ul {
  margin: 0;
  padding-left: 1.15rem;
}
.adjust-alerts li {
  margin-bottom: 8px;
}
.adjust-alerts li:last-child {
  margin-bottom: 0;
}
.adjust-alerts__tag {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.adjust-alerts__tag--previo {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}
.adjust-alerts__tag--mes-ajuste {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.dashboard-ajuste-inline {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.dashboard-ajuste-inline strong {
  color: var(--text);
}

.pago-ajuste-alert {
  margin-top: 12px;
  margin-bottom: 0;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.pago-ajuste-alert__tag {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.pago-ajuste-alert__tag--previo {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}
.pago-ajuste-alert__tag--mes-ajuste {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

.inquilino-select-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.inquilino-select-el {
  width: 100%;
}
#inquilinoSelector option {
  color: var(--text);
  background: #0b1220;
}

.propietario-combo {
  position: relative;
  width: 100%;
}
.combo-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.combo-opt {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.35;
  transition: background var(--dur) ease;
}
.combo-opt:hover,
.combo-opt:focus {
  background: rgba(59, 130, 246, 0.15);
}
.combo-opt--hint {
  cursor: default;
  font-size: 12px;
  color: var(--muted);
  padding-top: 6px;
  padding-bottom: 6px;
}
.combo-opt--hint:hover,
.combo-opt--hint:focus {
  background: transparent;
}
.combo-opt--muted {
  cursor: default;
  color: var(--muted);
  font-size: 13px;
}
.combo-opt--muted:hover {
  background: transparent;
}
.combo-opt-divider {
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
  list-style: none;
  padding: 0;
  pointer-events: none;
}
.combo-opt-label {
  color: var(--primary);
  font-weight: 600;
}
.receipt {
  background: #ffffff;
  color: #111827;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 20px;
  margin-top: 10px;
  max-width: 900px;
  transition: box-shadow var(--dur) ease, border-color var(--dur) ease;
}
.receipt-hint {
  color: #64748b;
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}
.receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #d1d5db;
  padding-bottom: 12px;
  margin-bottom: 14px;
  gap: 16px;
}
.receipt-title h2 { margin: 0; font-size: 20px; }
.receipt-title p { margin-top: 3px; color: #334155; font-size: 13px; }
.receipt-meta { text-align: right; font-size: 13px; line-height: 1.5; }
.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  font-size: 14px;
  margin-bottom: 14px;
}
.receipt-grid div { padding: 2px 0; }
.receipt-grid strong { display: inline-block; min-width: 110px; }
.receipt-detail {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 10px;
}
.receipt-detail th, .receipt-detail td {
  border: 1px solid #cbd5e1;
  padding: 8px;
  color: #111827;
}
.receipt-detail th { background: #f1f5f9; text-align: left; }
.receipt-total {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  font-size: 16px;
  font-weight: 700;
}
.receipt-notes {
  margin-top: 14px;
  padding: 10px 12px;
  font-size: 12px;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  line-height: 1.45;
}
.receipt-sign {
  margin-top: 34px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  font-size: 13px;
  color: #334155;
}
.receipt-sign div {
  border-top: 1px solid #94a3b8;
  padding-top: 8px;
  text-align: center;
}
.print-actions { margin-top: 10px; display: flex; gap: 8px; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

.ui-theme-fieldset {
  border: none;
  margin: 12px 0 0;
  padding: 0;
}
.ui-theme-legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 0;
}
.ui-theme-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ui-theme-options label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 500;
  margin: 0;
}
.ui-theme-options input[type="radio"] {
  margin-top: 3px;
  width: auto;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.toast-host {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: 20px;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
  margin-left: auto;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid transparent;
  max-width: 100%;
  opacity: 0;
  transform: translateX(16px) translateY(8px);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}
.toast--visible {
  opacity: 1;
  transform: translateX(0) translateY(0);
}
.toast-msg { flex: 1; min-width: 0; }
.toast-close {
  flex-shrink: 0;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}
.toast-close:hover { background: rgba(255, 255, 255, 0.22); }
.toast--success {
  background: linear-gradient(145deg, #064e3b, #065f46);
  border-color: rgba(52, 211, 153, 0.35);
  color: #ecfdf5;
}
.toast--error {
  background: linear-gradient(145deg, #450a0a, #7f1d1d);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fef2f2;
}
.toast--warn {
  background: linear-gradient(145deg, #422006, #78350f);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fffbeb;
}
.toast--info {
  background: linear-gradient(145deg, #172554, #1e3a5f);
  border-color: rgba(147, 197, 253, 0.35);
  color: #eff6ff;
}

.app-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 160px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  padding: 6px;
}
.app-context-menu__item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.app-context-menu__item:hover {
  background: rgba(59, 130, 246, 0.2);
}
.app-context-menu__item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 940px) {
  aside {
    position: static;
    width: auto;
    height: auto;
    max-height: none;
    overflow-y: visible;
    overscroll-behavior: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
  }
  .app-fixed-brand {
    width: 100%;
    left: 0;
    right: 0;
    border-right: none;
    text-align: center;
  }
  main {
    margin-left: 0;
    padding-bottom: calc(20px + var(--app-fixed-brand-h) + env(safe-area-inset-bottom, 0px));
  }
  .cards { grid-template-columns: 1fr 1fr; }
  .row, .form-grid { grid-template-columns: 1fr; }
  .row.cobranzas-form-row {
    grid-template-columns: 1fr;
  }
  .row.contratos-abm-row {
    grid-template-columns: 1fr;
  }
  #contratos #formContrato .form-grid.form-grid--contrato {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  #contratos #formContrato .form-grid.form-grid--contrato > .form-contrato__celda {
    grid-column: 1 / -1;
  }
  #contratos #formContrato .form-contrato__triple {
    grid-template-columns: 1fr;
  }
  #contratos #formContrato .form-monto-moneda__monto,
  #contratos #formContrato .form-monto-moneda__moneda {
    flex: 1 1 100%;
    min-width: 0;
  }
  #cobranzas #formPago.form-grid--cobranzas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #cobranzas #formPago.form-grid--cobranzas > div:first-child {
    grid-column: 1 / -1;
  }
  #cobranzas #formPago.form-grid--cobranzas .input-monto {
    max-width: 100%;
  }
  .form-grid-span2 { grid-column: auto; }
  .form-propietario-propiedad {
    max-width: 100%;
  }
  .form-propietario-propiedad .form-block__fila--titular,
  .form-propietario-propiedad .form-block__fila--id-dir,
  .form-propietario-propiedad .form-block__fila--ubic {
    grid-template-columns: 1fr;
  }
  .form-propietario-propiedad .form-block__solo .propietario-combo,
  .form-propietario-propiedad .form-block__solo select#propSlotSelect,
  .form-propietario-propiedad .form-block__solo--notas input {
    max-width: 100%;
  }
  .receipt-grid, .receipt-sign { grid-template-columns: 1fr; }
  .receipt-meta { text-align: left; }
}
@media (max-width: 640px) {
  #cobranzas #formPago.form-grid--cobranzas {
    grid-template-columns: 1fr;
  }
  #cobranzas #formPago.form-grid--cobranzas > div:first-child {
    grid-column: auto;
  }
}
@media print {
  body { background: #fff; }
  aside, .app-fixed-brand, .hint, .print-actions, .nav-btn, .subtitle, .toast-host, .modal-backdrop { display: none !important; }
  .app { display: block; }
  main { padding: 0; margin-left: 0; }
  .view { display: none !important; }
  #recibo { display: block !important; }
  #recibo > h1, #recibo > .muted { display: none; }
  .receipt {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
}
