:root {
    --color-primary: #1a365d;
    --color-secondary: #c9a227;
    --color-on-primary: #ffffff;
    --color-on-secondary: #111111;
    --sidebar-width: 260px;
    --header-height: 64px;
    --bg-body: #f4f6f9;
    --bg-sidebar: #12233f;
    --text-sidebar: #e8eef7;
}

html,
body {
    height: 100%;
}

body.app-body {
    background: var(--bg-body);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    overflow-y: auto;
}

.sidebar .brand {
    padding: 1.1rem 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link {
    color: rgba(232, 238, 247, 0.85);
    border-radius: 0.5rem;
    margin: 0.15rem 0.75rem;
    padding: 0.55rem 0.8rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.main-wrap {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.app-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.page-content {
    padding: 1.5rem;
}

.stat-card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(18, 35, 63, 0.06);
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.btn-primary,
.bg-primary,
.badge-primary {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: var(--color-on-primary) !important;
}

.btn-secondary {
    background-color: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    color: var(--color-on-secondary) !important;
}

.card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(18, 35, 63, 0.06);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eef1f5;
    font-weight: 600;
}

.table thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5b6573;
}

.login-body {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--color-primary), #0b1a30);
}

.orgchart-wrap {
    background: #fff;
    min-height: 70vh;
    overflow: auto;
    border-radius: 1rem;
}

.orgchart-wrap .orgchart {
    background: transparent;
}

.orgchart-wrap .orgchart .node .title,
.nodo-org .title {
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.orgchart-wrap .orgchart .node .content,
.nodo-org .content {
    background: #fff;
}

.cover-entidad {
    height: 180px;
    background-size: cover;
    background-position: center;
    border-radius: 1rem;
    background-color: var(--color-primary);
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrap {
        margin-left: 0;
    }
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1035;
    }
}

@media (max-width: 575.98px) {
    .app-header .input-group .form-control {
        min-width: 0;
    }
}
