/* =====================================================================
   Eclipse Residencial · Capa de usabilidad (v3)
   Letra legible, botones grandes, navegación inferior en teléfono y
   componentes de cobro por casa. Se carga después de app.css.
   ===================================================================== */

:root {
    --ink-500: #4b5768;               /* más contraste que el gris anterior */
    --focus: #f59e0b;
    --bottom-nav-h: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --bs-secondary-color: #4b5768;
}

/* Tamaño de letra elegido por la persona */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html[data-text-size="2"] { font-size: 18px; }
html[data-text-size="3"] { font-size: 20px; }
body { line-height: 1.55; }

:focus-visible { outline: 3px solid var(--focus) !important; outline-offset: 2px; }
.btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; }
.btn-sm { min-height: 38px; }
.btn-lg { min-height: 56px; font-size: 1.08rem; }
.form-control, .form-select { min-height: 50px; font-size: 1rem; }
.input-group-lg > .form-control { min-height: 58px; font-size: 1.12rem; }
.form-label { font-size: .95rem; color: var(--ink-950); }
.form-check-input { width: 1.35em; height: 1.35em; }
.section-subtitle, .form-text { font-size: .9rem; }
.status { font-size: .82rem; }
.is-sending { opacity: .65; pointer-events: none; }

/* ---- Barra lateral (PC) --------------------------------------------- */
.nav-item-link { font-size: 1rem; }
.nav-symbol { font-size: .9rem; }
.nav-sub { display: grid; gap: .15rem; margin: -.1rem 0 .35rem 2.6rem; }
.nav-sub-link { display: flex; align-items: center; gap: .6rem; min-height: 38px; padding: .35rem .6rem; border-radius: .6rem; color: #b5f5e8; font-size: .9rem; font-weight: 650; text-decoration: none; }
.nav-sub-link i { width: 1rem; text-align: center; opacity: .85; }
.nav-sub-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-sub-link.active { color: #fff; background: rgba(94, 234, 212, .2); }
.sidebar-text-size { margin: 1.2rem 0 1rem; }

/* ---- Encabezado de página ------------------------------------------- */
.page-heading h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.page-heading p:not(.eyebrow) { font-size: 1rem; }
.mobile-house { padding: .4rem .7rem; border-radius: 999px; color: var(--brand-900); background: var(--brand-50); font-weight: 800; font-size: .9rem; }
.flash-alert { font-size: 1rem; font-weight: 600; }
.block-title { margin: 0 0 .8rem; font-size: 1.15rem; font-weight: 800; }

/* ---- Tamaño de letra ------------------------------------------------ */
.text-size-label { display: block; margin-bottom: .45rem; color: var(--ink-500); font-size: .85rem; font-weight: 700; }
.text-size-control .btn { min-height: 42px; border: 1px solid var(--line); color: var(--brand-900); background: #fff; font-weight: 800; }
.text-size-control .btn[data-text-size="1"] { font-size: 14px; }
.text-size-control .btn[data-text-size="2"] { font-size: 17px; }
.text-size-control .btn[data-text-size="3"] { font-size: 20px; }
.text-size-control .btn.active { color: #fff; border-color: var(--brand-700); background: var(--brand-700); }
.text-size-control.is-dark .text-size-label { color: #99f6e4; }
.text-size-control.is-dark .btn { color: #fff; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.06); }
.text-size-control.is-dark .btn.active { color: var(--brand-950); background: #5eead4; border-color: #5eead4; }

/* ---- Barra inferior (teléfono) ------------------------------------- */
.bottom-nav { position: fixed; z-index: 1035; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: calc(var(--bottom-nav-h) + var(--safe-bottom)); padding: 6px 6px calc(6px + var(--safe-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); box-shadow: 0 -8px 24px rgba(15,23,42,.08); }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; margin: 0 2px; padding: 4px 0; border: 0; border-radius: 14px; color: #4b5768; background: transparent; font-size: 12px; font-weight: 800; line-height: 1.1; text-decoration: none; }
.bottom-nav-item i { font-size: 21px; }
.bottom-nav-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav-item.active { color: var(--brand-700); background: var(--brand-50); }
.more-menu { width: min(88vw, 360px) !important; }
.more-user { display: flex; align-items: center; gap: .75rem; padding: .8rem; margin-bottom: .8rem; border-radius: 1rem; background: var(--brand-50); }
.more-user .avatar { background: var(--brand-700); color: #fff; }
.more-user small { color: var(--ink-500); }
.more-links { display: grid; gap: .2rem; }
.more-links a { display: flex; align-items: center; gap: .85rem; min-height: 50px; padding: .55rem .75rem; border-radius: .8rem; color: var(--ink-950); font-size: 1.02rem; font-weight: 700; text-decoration: none; }
.more-links a i { width: 1.4rem; text-align: center; color: var(--brand-700); }
.more-links a:hover, .more-links a:focus { background: var(--brand-50); }
.more-text-size { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

@media (max-width: 991.98px) {
    body.has-user { padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom)); }
    .app-footer { display: none; }
    .mobile-header { height: 60px; }
}

/* ---- Indicadores ---------------------------------------------------- */
.kpi-strip { display: grid; grid-template-columns: 1.2fr 1fr; gap: .8rem; }
.kpi { display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.kpi small { color: var(--ink-500); font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.kpi strong { font-size: clamp(1.6rem, 4.5vw, 2.3rem); font-weight: 850; letter-spacing: -.04em; line-height: 1.1; }
.kpi span { color: var(--ink-500); font-size: .88rem; }
.kpi-main { color: #fff; border-color: transparent; background: linear-gradient(140deg, var(--brand-900), var(--brand-700)); }
.kpi-main small, .kpi-main span { color: #ccfbf1; }
.kpi-main strong.text-danger { color: #fecaca !important; }
.kpi-warn { border-top: 4px solid #f79009; }

/* ---- Pestañas de Finanzas ------------------------------------------ */
.view-tabs { display: flex; gap: .5rem; overflow-x: auto; padding: .35rem; border: 1px solid var(--line); border-radius: 1rem; background: #fff; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-tab { display: inline-flex; flex: 1 0 auto; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .5rem .9rem; border-radius: .75rem; color: var(--ink-700); font-weight: 800; text-decoration: none; white-space: nowrap; }
.view-tab:hover { color: var(--brand-900); background: var(--brand-50); }
.view-tab.active { color: #fff; background: var(--brand-700); }

/* ---- Acciones grandes del Inicio ----------------------------------- */
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.action-tile { display: flex; flex-direction: column; gap: .2rem; min-height: 132px; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-950); background: #fff; box-shadow: var(--shadow); text-decoration: none; }
.action-tile:hover { color: var(--ink-950); border-color: #5eead4; transform: translateY(-1px); }
.action-tile > span { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: auto; border-radius: 14px; color: var(--brand-700); background: var(--brand-50); font-size: 1.3rem; }
.action-tile strong { margin-top: .7rem; font-size: 1.05rem; line-height: 1.25; }
.action-tile small { color: var(--ink-500); font-size: .85rem; }
.action-tile.is-primary { color: #fff; border-color: transparent; background: linear-gradient(140deg, #047857, var(--brand-700)); }
.action-tile.is-primary > span { color: #fff; background: rgba(255,255,255,.18); }
.action-tile.is-primary small { color: #d1fae5; }

/* ---- Saldo grande --------------------------------------------------- */
.balance-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.2rem; padding: 1.2rem 1.3rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.balance-hero > i { font-size: 2.4rem; }
.balance-hero > div:not(.hero-actions) { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.balance-hero small { font-size: .95rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.balance-hero strong { font-size: clamp(2rem, 7vw, 2.8rem); font-weight: 850; letter-spacing: -.04em; line-height: 1.05; }
.balance-hero span { font-size: .95rem; }
.balance-hero.is-debt { color: #7a1d14; background: #fff1ef; border: 1px solid #fecdca; }
.balance-hero.is-debt > i { color: #d92d20; }
.balance-hero.is-ok { color: #054f31; background: #ecfdf3; border: 1px solid #abefc6; }
.balance-hero.is-ok > i { color: #12b76a; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---- Cómo pagar ----------------------------------------------------- */
.pay-steps { display: grid; gap: .6rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.pay-field { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: .8rem; background: #fbfdfd; }
.pay-field small { display: block; color: var(--ink-500); font-size: .82rem; font-weight: 700; }
.pay-field strong { display: block; font-size: 1.05rem; overflow-wrap: anywhere; }
.copy-btn { flex: 0 0 auto; min-width: 104px; }
.copy-btn.copied { color: #fff; background: #12b76a; border-color: #12b76a; }

/* ---- Lista de casas ------------------------------------------------- */
.house-tools { display: grid; gap: .75rem; margin-bottom: .5rem; }
.filter-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .4rem 1rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-700); background: #fff; font-weight: 800; }
.chip b { padding: .05rem .5rem; border-radius: 999px; background: #f1f5f9; font-size: .85rem; }
.chip.active { color: #fff; border-color: var(--brand-700); background: var(--brand-700); }
.chip.active b { color: var(--brand-900); background: #fff; }
.list-count { margin: .25rem 0 .75rem; color: var(--ink-500); font-size: .88rem; font-weight: 700; }
.house-list { display: grid; gap: .6rem; }
.house-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto 18px; gap: .85rem; align-items: center; min-height: 76px; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: .9rem; color: var(--ink-950); background: #fff; text-decoration: none; }
.house-row:hover { color: var(--ink-950); border-color: #5eead4; background: var(--brand-50); }
.house-row.has-debt { border-left: 5px solid #f04438; }
.house-row:not(.has-debt) { border-left: 5px solid #12b76a; }
.house-number { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 54px; border-radius: .7rem; color: var(--brand-900); background: var(--brand-50); font-size: 1.05rem; font-weight: 850; line-height: 1.1; }
.house-number small { font-size: .68rem; font-weight: 800; text-transform: uppercase; color: var(--ink-500); }
.house-info { min-width: 0; }
.house-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.house-info small { display: block; color: var(--ink-500); font-size: .85rem; }
.house-balance { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.house-balance small { color: var(--ink-500); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.house-balance strong { font-size: 1.15rem; }
.house-balance em { color: var(--ink-500); font-size: .8rem; font-style: normal; }
.house-go { color: #94a3b8; }
.house-list.compact .house-row { min-height: 64px; }
.house-nav { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

/* ---- Cobro de cargos ------------------------------------------------ */
.charge-all { display: flex; align-items: center; gap: .7rem; min-height: 48px; margin-bottom: .5rem; padding: .5rem .9rem; border-radius: .8rem; background: #f1f5f9; font-weight: 800; cursor: pointer; }
.charge-list { display: grid; gap: .5rem; }
.charge-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; min-height: 64px; padding: .7rem .9rem; border: 2px solid var(--line); border-radius: .9rem; background: #fff; cursor: pointer; }
.charge-item strong { display: block; }
.charge-item small { display: block; color: var(--ink-500); }
.charge-item b { font-size: 1.1rem; }
.charge-item.is-checked { border-color: #12b76a; background: #ecfdf3; }
.pay-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border-radius: .9rem; color: #054f31; background: #ecfdf3; }
.pay-summary strong { font-size: clamp(1.3rem, 6vw, 1.6rem); font-weight: 850; white-space: nowrap; }
.pay-summary span { min-width: 0; }
.file-drop { display: flex; align-items: center; gap: .9rem; min-height: 64px; padding: .8rem 1rem; border: 2px dashed #94a3b8; border-radius: .9rem; color: var(--ink-700); background: #f8fafc; cursor: pointer; }
.file-drop > i { font-size: 1.5rem; color: var(--brand-700); }
.file-drop strong { display: block; }
.file-drop small { display: block; color: var(--ink-500); overflow-wrap: anywhere; }
.file-drop small.has-file { color: var(--success); font-weight: 800; }
.file-drop:hover { border-color: var(--brand-600); background: var(--brand-50); }
.file-input:focus + .file-drop, .file-drop:focus-within { outline: 3px solid var(--focus); }

/* ---- Opciones (¿a quién se le cobra?) ------------------------------- */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.choice { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem; border: 2px solid var(--line); border-radius: .9rem; cursor: pointer; }
.choice span { display: flex; flex-direction: column; }
.choice span i { color: var(--brand-700); font-size: 1.2rem; margin-bottom: .2rem; }
.choice small { color: var(--ink-500); }
.choice:has(input:checked) { border-color: var(--brand-700); background: var(--brand-50); }

/* ---- Listas simples (pagos, gastos, cuotas) ------------------------ */
.simple-list, .concept-list { display: grid; gap: .55rem; }
.simple-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .9rem; align-items: center; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: .85rem; background: #fff; }
.simple-row strong { display: block; }
.simple-row small { display: block; color: var(--ink-500); font-size: .85rem; }
.simple-row .amount { font-size: 1.08rem; white-space: nowrap; }
.simple-row .row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.simple-row.is-voided { background: #f8fafc; }
.void-box summary { list-style: none; }
.void-box summary::-webkit-details-marker { display: none; }
.concept-row { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .9rem; background: #fff; }
.concept-main { flex: 1 1 260px; min-width: 0; }
.concept-main strong { display: block; }
.concept-main small { display: block; color: var(--ink-500); }
.concept-progress { display: block; width: 100%; height: .7rem; margin: .5rem 0 .3rem; border: 0; border-radius: 999px; background: #e2e8f0; overflow: hidden; -webkit-appearance: none; appearance: none; }
.concept-progress::-webkit-progress-bar { background: #e2e8f0; border-radius: 999px; }
.concept-progress::-webkit-progress-value { background: var(--brand-600); border-radius: 999px; }
.concept-progress::-moz-progress-bar { background: var(--brand-600); border-radius: 999px; }
.concept-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.contact-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .45rem 1rem; }
.contact-list dt { color: var(--ink-500); font-weight: 700; }
.contact-list dd { margin: 0; font-weight: 700; }
.details-summary { font-size: 1rem; min-height: 56px; display: flex; align-items: center; }
.caps-warning { margin-top: .5rem; padding: .5rem .8rem; border-radius: .6rem; color: #7a4b00; background: #fff3d6; font-weight: 700; font-size: .9rem; }

@media (max-width: 991.98px) {
    .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 575.98px) {
    .kpi-strip { grid-template-columns: 1fr; }
    .action-tile { min-height: 120px; }
    .house-row { grid-template-columns: 64px minmax(0, 1fr) auto; padding: .6rem .7rem; gap: .65rem; }
    .house-go { display: none; }
    .house-balance strong { font-size: 1.05rem; }
    .choice-grid { grid-template-columns: 1fr; }
    .view-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; overflow: visible; }
    .view-tab { flex-direction: column; gap: .15rem; min-height: 58px; padding: .35rem .2rem; font-size: .8rem; }
    .view-tab i { font-size: 1.15rem; }
    .hero-actions, .hero-actions .btn { width: 100%; }
    .pay-field { flex-wrap: wrap; }
    .copy-btn { width: 100%; }
    .page-heading h1 { font-size: 1.55rem; }
}

@media print {
    .bottom-nav, .sidebar, .mobile-header, .view-tabs { display: none !important; }
    .app-content { margin-left: 0; }
}
