/* ============================================================
   Dashboard House Premier v2 — Estilos globales
   Stack: Bootstrap 5 + custom Conzensus design system
   ============================================================ */

:root {
    --hp-navy:          #1a1a2e;
    --hp-navy-light:    #252545;
    --hp-sidebar-w:     240px;
    --hp-navbar-h:      64px;
    --hp-accent:        #4C8BE0;
    --hp-warning:       #E07B4C;
    --hp-text-sidebar:  #c0c0d0;
}

/* ── Reset / base ─────────────────────────────────────────── */
body {
    background: #f4f6f9;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Navbar superior ──────────────────────────────────────── */
.hp-navbar {
    background: var(--hp-navy);
    height: var(--hp-navbar-h);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    z-index: 1050;
}

.hp-navbar-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    white-space: nowrap;
}

.hp-logo-right {
    margin-left: auto;
    border-radius: 4px;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.hp-sidebar {
    position: fixed;
    top: var(--hp-navbar-h);
    left: 0;
    width: var(--hp-sidebar-w);
    height: calc(100vh - var(--hp-navbar-h));
    background: var(--hp-navy);
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.28s ease;
}

.hp-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem 0.875rem;
}

/* Nav links en sidebar */
.hp-sidebar .nav-link {
    color: var(--hp-text-sidebar);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 7px;
    margin-bottom: 3px;
    transition: background 0.15s, color 0.15s;
}

.hp-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.hp-sidebar .nav-link.active {
    background: rgba(76, 139, 224, 0.25);
    color: #ffffff;
    font-weight: 500;
}

.hp-divider {
    border-color: rgba(255, 255, 255, 0.12);
    margin: 0.5rem 0;
}

.hp-sidebar-footer {
    margin-top: auto;
    padding-top: 0.5rem;
}

.hp-sidebar-footer .text-muted {
    color: #888aaa !important;
}

.hp-sidebar-footer .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--hp-text-sidebar);
    font-size: 0.8rem;
}

.hp-sidebar-footer .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* ── Main content ─────────────────────────────────────────── */
.hp-main {
    margin-left: var(--hp-sidebar-w);
    padding-top: calc(var(--hp-navbar-h) + 1.5rem);
    padding-left: 1.75rem;
    padding-right: 1.75rem;
    padding-bottom: 2.5rem;
    min-height: 100vh;
}

/* ── Overlay mobile ───────────────────────────────────────── */
.hp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}

/* ── KPI cards ────────────────────────────────────────────── */
.kpi-card {
    background: #ffffff;
    border: 1px solid #e3e8f0;
    border-radius: 10px;
    padding: 1.1rem 1.4rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #7c8db5;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.2;
}

.kpi-value.text-danger  { color: #dc3545 !important; }
.kpi-value.text-success { color: #198754 !important; }

/* ── Cards genericas ──────────────────────────────────────── */
.hp-card {
    background: #ffffff;
    border: 1px solid #e3e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.hp-card .card-header {
    background: #f8f9fc;
    border-bottom: 1px solid #e3e8f0;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a2e;
    padding: 0.75rem 1.25rem;
}

/* ── Tablas ───────────────────────────────────────────────── */
.table-hp thead th {
    background: #1a1a2e;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: none;
    padding: 0.65rem 0.75rem;
}

.table-hp tbody tr:hover {
    background: #f0f4ff;
}

.table-hp tbody td {
    font-size: 0.85rem;
    vertical-align: middle;
    padding: 0.5rem 0.75rem;
    border-color: #eef0f5;
}

/* ── Badges origen ────────────────────────────────────────── */
.badge-presup {
    background: #d1e8ff;
    color: #1a5fa8;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
}

.badge-no-presup {
    background: #ffe8d1;
    color: #a83c1a;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
}

/* ── Plotly chart container ───────────────────────────────── */
.chart-container {
    width: 100%;
    min-height: 340px;
}

/* ── Page title ───────────────────────────────────────────── */
.hp-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 1.25rem;
}

/* ── Filtros bar ──────────────────────────────────────────── */
.filtros-bar {
    background: #ffffff;
    border: 1px solid #e3e8f0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 991px) {
    .hp-sidebar {
        transform: translateX(-100%);
    }
    .hp-sidebar.show {
        transform: translateX(0);
    }
    .hp-main {
        margin-left: 0;
    }
    .hp-navbar-title {
        font-size: 0.85rem;
        letter-spacing: 0.5px;
    }
}
