/* ===========================================================
   Tesorería · estilos globales
   Overrides mínimos sobre Bootstrap 5 con variables CSS.
   =========================================================== */

:root {
    --tes-sidebar-width: 240px;
    --tes-navbar-height: 56px;
    --tes-sidebar-bg: #1f2937;       /* slate-800 */
    --tes-sidebar-bg-hover: #374151; /* slate-700 */
    --tes-navbar-bg: #111827;        /* slate-900 */
    --bs-primary: #1d4ed8;
}

/* --- Layout AUTH --- */
.auth-body {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    min-height: 100vh;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 0.75rem;
}

/* --- Layout APP (navbar + sidebar) --- */
.app-body {
    background: #f3f4f6;
    min-height: 100vh;
}

.app-navbar {
    background-color: var(--tes-navbar-bg) !important;
    height: var(--tes-navbar-height);
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    justify-content: space-between;
}

.app-shell {
    display: flex;
    min-height: calc(100vh - var(--tes-navbar-height));
}

.app-sidebar {
    width: var(--tes-sidebar-width);
    background-color: var(--tes-sidebar-bg);
    color: #fff;
    flex-shrink: 0;
    position: sticky;
    top: var(--tes-navbar-height);
    height: calc(100vh - var(--tes-navbar-height));
    overflow-y: auto;
}

.app-sidebar .nav-link,
.app-sidebar-offcanvas .nav-link {
    color: rgba(255,255,255,.85);
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    padding: 0.55rem 0.75rem;
    transition: background-color .15s ease;
}

.app-sidebar .nav-link:hover,
.app-sidebar-offcanvas .nav-link:hover {
    background-color: var(--tes-sidebar-bg-hover);
    color: #fff;
}

.app-sidebar .nav-link.active,
.app-sidebar-offcanvas .nav-link.active {
    background-color: var(--bs-primary);
    color: #fff;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* Scrollbar suave para el sidebar (webkit) */
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

/* --- Tablas / inputs comunes --- */
.input-monto {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* =================================================================
   Carga diaria (Anexo A)
   ================================================================= */

/* Tabla compacta */
.cd-tabla td, .cd-tabla th { padding: .35rem .5rem; }
.cd-tabla .cd-label { width: 60%; }
.cd-tabla .cd-monto { width: 40%; }
.cd-tabla .cd-monto .form-control { max-width: 220px; margin-left: auto; }

/* Headers de sección colapsable (bocas de cobranzas / cheques) */
.cd-section-header { cursor: pointer; user-select: none; }
.cd-section-header:hover { background-color: #e9ecef; }
.cd-section-header .cd-chevron { transition: transform .15s ease; }
.cd-section-header[aria-expanded="true"] .cd-chevron { transform: rotate(90deg); }

/* Sub-secciones inline dentro de la tabla de ingresos */
.cd-inline-section-row td {
    border-top: 1px solid #dfe6ee;
    background: #f8fafc;
}
.cd-inline-section-title {
    padding: .7rem .75rem .35rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #64748b;
}
.cd-inline-subtotal-row td {
    background: #f8fafc;
}

/* Sub-secciones inline dentro de egresos */
.cd-egreso-section-row td {
    border-top: 1px solid #f1d5db;
    background: #fff7f8;
}
.cd-egreso-section-title {
    padding: .7rem .75rem .35rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #9f1239;
}
.cd-egreso-section-row-cheques td,
.cd-egreso-subtotal-row-cheques td {
    background: #fffaf2;
}
.cd-egreso-section-title-cheques {
    color: #9a3412;
}
.cd-egreso-subtotal-row td {
    background: #fff7f8;
}
.cd-egreso-total-row td {
    background: #fffdfd;
}
.cd-egreso-section-row-totales td {
    border-top: 1px solid #f1d5db;
    background: #fef2f2;
}
.cd-egreso-section-title-totales {
    color: #7f1d1d;
}
.cd-tabla-totales tfoot th {
    background: #fee2e2;
}

/* Indicador de autosave por input */
.cd-input { transition: box-shadow .25s ease, border-color .25s ease; }
.cd-input.cd-saving { box-shadow: 0 0 0 .15rem rgba(13, 110, 253, .25); }
.cd-input.cd-saved  { box-shadow: 0 0 0 .15rem rgba(25, 135, 84, .35); border-color: #198754; }
.cd-input.is-invalid { border-color: #dc3545; }

/* Lock cuando el día está cerrado */
.cd-locked .cd-input,
.cd-locked .cd-counter { background-color: #f8f9fa; cursor: not-allowed; }

/* Footer fijo de atajos */
.cd-footer {
    z-index: 1020;
    border-top: 1px solid rgba(255,255,255,.08);
}
.cd-footer kbd {
    background: rgba(255,255,255,.1);
    color: #fff;
    border-radius: .25rem;
    padding: .05rem .35rem;
    font-size: .75rem;
}

/* Reservar espacio para el footer fijo */
.app-main { padding-bottom: 3rem; }

/* Stat cards */
#cd-stat-resultado.text-success { color: #198754 !important; }
#cd-stat-resultado.text-danger  { color: #dc3545 !important; }

/* --- Cobranzas: tabla mensual --- */
.cob-input { transition: box-shadow .25s ease; }
.cob-input.cob-saving { box-shadow: 0 0 0 .15rem rgba(13, 110, 253, .25); }
.cob-input.cob-cell-conciliada {
    background-color: #f1f5f9;
    color: #475569;
    cursor: not-allowed;
}
.cob-tabla input.cob-input { min-width: 7rem; }
