:root {
    --brand-primary: #0b2f6b;   /* azul institucional */
    --brand-accent:  #f5b301;   /* amarillo institucional */
    --brand-dark:    #081c40;
}

body {
    background-color: #f4f6fb;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }

/* ===================== APP SHELL (sidebar) ===================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--brand-dark);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.app-sidebar .sidebar-brand {
    padding: 1.35rem 1.25rem;
    color: #fff;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: block;
    text-decoration: none;
    line-height: 1.3;
}
.app-sidebar .sidebar-user {
    padding: .9rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
    color: rgba(255,255,255,.65);
    font-size: .8rem;
}
.app-sidebar .sidebar-user strong { color: #fff; display: block; font-size: .92rem; }
.app-sidebar .sidebar-nav { flex: 1; padding: .85rem; }
.app-sidebar .sidebar-nav .nav-link {
    color: rgba(255,255,255,.78);
    padding: .65rem .9rem;
    border-radius: .55rem;
    margin-bottom: .3rem;
    font-size: .92rem;
    display: flex;
    align-items: center;
    gap: .65rem;
}
.app-sidebar .sidebar-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar .sidebar-nav .nav-link.active { background: var(--brand-accent); color: #212529; font-weight: 600; }
.app-sidebar .sidebar-footer { padding: .85rem; border-top: 1px solid rgba(255,255,255,.1); }
.app-sidebar .sidebar-footer .nav-link { color: rgba(255,255,255,.78); }
.app-sidebar .sidebar-footer .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }

.app-topbar {
    background: var(--brand-dark);
    color: #fff;
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.app-topbar .btn-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    border-radius: .5rem;
    padding: .35rem .6rem;
    line-height: 1;
    font-size: 1.1rem;
}
.app-topbar .topbar-brand { color: #fff; font-weight: 700; text-decoration: none; font-size: .95rem; }

.offcanvas-sidebar { background: var(--brand-dark); width: 270px; }
.offcanvas-sidebar .sidebar-brand,
.offcanvas-sidebar .sidebar-user,
.offcanvas-sidebar .sidebar-nav,
.offcanvas-sidebar .sidebar-footer { }

.app-content { flex: 1; min-width: 0; }
.app-content .container-fluid { padding: 1.5rem 1.25rem; }
@media (min-width: 992px) {
    .app-content .container-fluid { padding: 2rem 2.25rem; }
}

/* ===================== APP SHELL fin ===================== */

.bg-brand { background-color: var(--brand-primary) !important; }

.btn-brand {
    background-color: var(--brand-primary);
    color: #fff;
    border: none;
}
.btn-brand:hover { background-color: var(--brand-dark); color: #fff; }

.btn-accent {
    background-color: var(--brand-accent);
    color: #212529;
    border: none;
    font-weight: 600;
}
.btn-accent:hover { background-color: #d99a00; color: #212529; }

.btn-outline-brand {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    background-color: #fff;
}
.btn-check:checked + .btn-outline-brand,
.btn-outline-brand:hover {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.section-title {
    font-weight: 700;
    color: var(--brand-primary);
    text-transform: uppercase;
    font-size: .85rem;
    letter-spacing: .05em;
    text-align: center;
    border-bottom: 2px solid rgba(11,47,107,.12);
    padding-bottom: .5rem;
    margin-bottom: 1.25rem;
}

.bg-admin { background-color: var(--brand-dark) !important; }

.badge-admin {
    display: inline-block;
    background: #fff3cd;
    color: #7a5c00;
    font-weight: 600;
    font-size: .8rem;
    padding: .35rem .85rem;
    border-radius: 999px;
}

.table-admin th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #667;
    border-bottom-width: 2px;
    background-color: #f8f9fc;
}
.table-admin td { vertical-align: middle; padding-top: .85rem; padding-bottom: .85rem; }
.table-admin tbody tr { transition: background-color .1s ease; }
.table-admin tbody tr:nth-child(even) { background-color: #fafbfe; }
.table-admin tbody tr:hover { background-color: #eef3fb; }

.badge-tipo-natural { background-color: #e7f1ff; color: #0b2f6b; }
.badge-tipo-empresa { background-color: #fff0d9; color: #8a5300; }

/* Tarjetas de estadísticas (KPI) */
.stat-card {
    display: flex;
    align-items: center;
    gap: .9rem;
    background: #fff;
    border-radius: .85rem;
    padding: 1rem 1.15rem;
    box-shadow: 0 .35rem 1rem rgba(11,47,107,.07);
    height: 100%;
}
.stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: rgba(11,47,107,.08);
}
.stat-icon-natural { background: #e7f1ff; }
.stat-icon-empresa { background: #fff0d9; }
.stat-number { font-size: 1.4rem; font-weight: 700; color: var(--brand-primary); line-height: 1.1; }
.stat-label { font-size: .8rem; color: #778; }

/* Avatar circular con inicial en la tabla */
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    color: #fff;
}
.avatar-natural { background: linear-gradient(135deg, #0b2f6b, #1c4fa8); }
.avatar-empresa { background: linear-gradient(135deg, #b3720a, #e0930e); }

/* Barra de búsqueda */
.search-bar {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #fff;
    border-radius: .85rem;
    padding: .6rem .9rem;
    box-shadow: 0 .35rem 1rem rgba(11,47,107,.07);
}
.search-bar .search-icon { font-size: 1rem; opacity: .6; }
.search-bar input.form-control { border: none; box-shadow: none; padding-left: 0; }
.search-bar input.form-control:focus { box-shadow: none; }
@media (max-width: 576px) {
    .search-bar { flex-wrap: wrap; }
    .search-bar input.form-control { flex: 1 0 100%; order: 1; padding-left: .75rem; }
    .search-bar .btn { order: 2; }
}

.card-option {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 .5rem 1.5rem rgba(11,47,107,.08);
    transition: transform .15s ease, box-shadow .15s ease;
    height: 100%;
}
.card-option:hover {
    transform: translateY(-4px);
    box-shadow: 0 .75rem 2rem rgba(11,47,107,.15);
}

.card-auth {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 .5rem 1.5rem rgba(11,47,107,.10);
}

.form-label { font-weight: 600; font-size: .9rem; }

.icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(11,47,107,.08);
    color: var(--brand-primary);
    font-size: 1.75rem;
    margin: 0 auto 1rem auto;
}

@media (max-width: 576px) {
    h1, .display-5 { font-size: 1.6rem; }
    .card-option, .card-auth { border-radius: .75rem; }
}
