:root {
    --ra-sidebar: 250px;
    --ra-tinta: #1c2536;
    --ra-tinta-suave: #5b6577;
    --ra-borde: #e3e6ec;
    --ra-fondo: #f5f6f8;
    --ra-acento: #2f5fd0;
}

body {
    background: var(--ra-fondo);
    color: var(--ra-tinta);
    font-size: 0.9rem;
}

/* ---------- Estructura ---------- */
.app {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--ra-sidebar);
    flex: 0 0 var(--ra-sidebar);
    background: #fff;
    border-right: 1px solid var(--ra-borde);
    padding: 1.25rem 0.75rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.app-contenido {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--ra-borde);
}

.app-cabecera-titulo {
    font-weight: 600;
    font-size: 1.05rem;
}

.app-principal {
    padding: 1.5rem;
    flex: 1 1 auto;
}

/* ---------- Marca y navegación ---------- */
.app-marca {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0 0.5rem 1rem;
    border-bottom: 1px solid var(--ra-borde);
    margin-bottom: 0.75rem;
}

.app-marca strong {
    display: block;
    line-height: 1.1;
}

.app-marca small {
    color: var(--ra-tinta-suave);
    font-size: 0.72rem;
}

.app-marca-icono {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--ra-acento);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.app-nav a {
    display: block;
    padding: 0.45rem 0.65rem;
    border-radius: 7px;
    color: var(--ra-tinta-suave);
    text-decoration: none;
}

.app-nav a:hover {
    background: #eef1f7;
    color: var(--ra-tinta);
}

.app-nav a.active {
    background: var(--ra-acento);
    color: #fff;
}

.app-nav-titulo {
    padding: 0.9rem 0.65rem 0.25rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9aa2b1;
    font-weight: 600;
}

/* ---------- Tarjetas y tablas ---------- */
.card {
    border: 1px solid var(--ra-borde);
    border-radius: 10px;
    box-shadow: none;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--ra-borde);
    font-weight: 600;
}

.tabla-datos {
    font-size: 0.85rem;
}

.tabla-datos thead th {
    background: #f8f9fb;
    border-bottom: 1px solid var(--ra-borde) !important;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ra-tinta-suave);
    white-space: nowrap;
}

.tabla-datos td {
    vertical-align: middle;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---------- Indicadores del panel ---------- */
.kpi {
    background: #fff;
    border: 1px solid var(--ra-borde);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    height: 100%;
}

.kpi-etiqueta {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ra-tinta-suave);
    font-weight: 600;
}

.kpi-valor {
    font-size: 1.6rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    margin-top: 0.25rem;
}

.kpi-nota {
    font-size: 0.78rem;
    color: var(--ra-tinta-suave);
}

/* ---------- Antigüedad del saldo ---------- */
.tramo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.tramo-nombre {
    flex: 0 0 105px;
    font-size: 0.78rem;
    color: var(--ra-tinta-suave);
}

.tramo-barras {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.barra {
    position: relative;
    height: 15px;
    background: #f1f3f7;
    border-radius: 3px;
    overflow: hidden;
}

.barra-relleno {
    height: 100%;
    border-radius: 3px;
    min-width: 2px;
}

.barra-cobrar {
    background: var(--ra-acento);
}

.barra-pagar {
    background: #d98324;
}

.barra-valor {
    position: absolute;
    right: 6px;
    top: 0;
    line-height: 15px;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    color: var(--ra-tinta);
}

.muestra {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 3px;
}

.muestra-cobrar {
    background: var(--ra-acento);
}

.muestra-pagar {
    background: #d98324;
}

/* ---------- Acceso ---------- */
.pagina-acceso {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #eceff4;
}

.tarjeta-acceso {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border: 1px solid var(--ra-borde);
    border-radius: 12px;
    padding: 2rem;
}

/* ---------- Utilidades ---------- */
.filtros {
    background: #fff;
    border: 1px solid var(--ra-borde);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.badge {
    font-weight: 600;
}

.vencido {
    color: #c0392b;
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .app {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        flex: 0 0 auto;
        height: auto;
        position: static;
    }
}
