:root {
    --brand-navy: #000a56;
    --brand-navy-light: #10186b;
    --brand-purple: #9f0bff;
    --brand-purple-dark: #7c00cc;
    --brand-pink: #fc4ef5;
    --brand-primary: var(--brand-purple);
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 76px;
    --topbar-height: 56px;
}

body {
    background-color: #f4f6f9;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-purple-dark));
}

.navbar-brand {
    font-weight: 600;
}

.card {
    border: 1px solid rgba(0, 0, 0, .08);
    box-shadow: 0 .125rem .5rem rgba(0, 0, 0, .06);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    padding: .9rem 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

/* ---- Breadcrumb + cabecera de página (patrón "page-header" tipo Teki) ---- */
.page-breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: .75rem;
    font-size: .825rem;
}
.page-breadcrumb .breadcrumb-item a {
    color: var(--brand-purple);
    text-decoration: none;
}
.page-breadcrumb .breadcrumb-item a:hover { text-decoration: underline; }
.page-breadcrumb .breadcrumb-item.active { color: #6c757d; }
.page-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    color: #ced4da;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: #fff;
    border-radius: .75rem;
    box-shadow: 0 .125rem .5rem rgba(0, 0, 0, .06);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.page-header-icon {
    flex: 0 0 auto;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: .6rem;
    background-color: #eef1f7;
    color: var(--brand-purple);
    display: flex;
    align-items: center;
    justify-content: center;
}
.page-header-text { display: flex; flex-direction: column; }
.page-header-title {
    font-weight: 700;
    color: var(--brand-navy);
    margin-bottom: 0;
}
.page-header-subtitle {
    font-size: .825rem;
    color: #6c757d;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 576px) {
    .display-6 {
        font-size: 1.75rem;
    }
}

.badge-estado-nuevo { background-color: #f0ad4e; color: #1f2937; }
.badge-estado-cualificado { background-color: #5cb85c; }
.badge-estado-descartado { background-color: #d9534f; }

/* ---- Layout: sidebar fijo + topbar fijo (rediseño Aire/Teki) ---- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--brand-navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1030;
    transition: width .2s ease, transform .2s ease;
}

.sidebar-brand {
    padding: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-brand a { color: #fff; text-decoration: none; }

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .65);
    text-align: left;
    padding: .5rem 1rem;
    width: 100%;
}
.sidebar-toggle:hover { color: #fff; }

.sidebar-welcome {
    margin: .25rem .75rem 1rem;
    padding: .75rem 1rem;
    border-radius: .5rem;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-welcome-text { font-size: .75rem; opacity: .85; }
.sidebar-welcome-user { font-weight: 700; }
.sidebar-welcome-role { font-size: .75rem; opacity: .85; }

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 .5rem 1rem;
    flex: 1 1 auto;
}
.sidebar-nav-item { margin-bottom: .15rem; }
.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .75rem;
    border-radius: .5rem;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-size: .925rem;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-nav-link:hover { background-color: var(--brand-navy-light); color: #fff; }
.sidebar-nav-item.active > .sidebar-nav-link {
    background-color: var(--brand-navy-light);
    color: #fff;
    font-weight: 600;
}
.sidebar-nav-link i { width: 1.25rem; text-align: center; }

.sidebar-submenu {
    list-style: none;
    padding-left: 2.1rem;
    margin: .25rem 0 0;
}
.sidebar-submenu a {
    display: block;
    padding: .4rem 0;
    color: rgba(255, 255, 255, .65);
    text-decoration: none;
    font-size: .875rem;
}
.sidebar-submenu a:hover { color: #fff; }

.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--topbar-height);
    background-color: var(--brand-navy);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    z-index: 1020;
    transition: left .2s ease;
}
.topbar-toggle {
    background: none;
    border: none;
    color: #fff;
}
.topbar-user-link {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.topbar-user-role { opacity: .65; }

.main-content {
    width: auto;
    max-width: 100%;
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--topbar-height) + 1rem);
    padding-bottom: 1.5rem;
    overflow-x: hidden;
    transition: margin-left .2s ease;
}

.content-footer {
    margin-left: var(--sidebar-width);
    transition: margin-left .2s ease;
}

body.sidebar-collapsed .sidebar { width: var(--sidebar-width-collapsed); }
body.sidebar-collapsed .topbar { left: var(--sidebar-width-collapsed); }
body.sidebar-collapsed .main-content,
body.sidebar-collapsed .content-footer { margin-left: var(--sidebar-width-collapsed); }
body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-nav-text,
body.sidebar-collapsed .sidebar-welcome,
body.sidebar-collapsed .sidebar-submenu { display: none; }

@media (max-width: 767.98px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .topbar, .main-content, .content-footer { left: 0; margin-left: 0; }
}

/* ---- Tablas de listado: cabecera navy, texto blanco negrita ---- */
.table thead th {
    background-color: var(--brand-navy);
    color: #fff;
    font-weight: 700;
    border-color: var(--brand-navy);
}

/* ---- Botón de acción principal: pill sólido violeta ---- */
.btn-primary {
    background-color: var(--brand-purple);
    border-color: var(--brand-purple);
    border-radius: 50rem;
    font-weight: 600;
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--brand-purple-dark);
    border-color: var(--brand-purple-dark);
}

/* ---- Dashboard (index.php): banner, tarjetas de módulo, donut ---- */
.dashboard-banner {
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-purple-dark));
    color: #fff;
    border-radius: .75rem;
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.dashboard-banner-text p { opacity: .85; margin-bottom: 0; }
.dashboard-banner-cta {
    background-color: var(--brand-pink);
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 50rem;
    font-weight: 600;
    padding: .55rem 1.25rem;
    white-space: nowrap;
}
.dashboard-banner-cta:hover { background-color: #e838df; color: #fff; }

.module-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: .75rem;
    padding: 1.25rem;
    height: 100%;
    text-decoration: none;
    transition: box-shadow .15s ease, transform .15s ease;
}
.module-card:hover {
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .08);
    transform: translateY(-2px);
}
.module-card-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .5rem;
    background-color: var(--brand-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
.module-card-title { color: var(--brand-purple); font-weight: 700; }
.module-card-value { font-size: 1.75rem; font-weight: 700; color: var(--brand-navy); }
.module-card-btn {
    margin-top: auto;
    align-self: flex-start;
    background-color: #eef0f4;
    color: #495057;
    border-radius: 50rem;
    padding: .35rem 1rem;
    font-size: .825rem;
    font-weight: 600;
}

.dashboard-widget {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: .75rem;
    padding: 1.25rem;
    height: 100%;
    text-align: center;
}
.dashboard-widget-title { color: var(--brand-navy); font-weight: 700; margin-bottom: 1rem; }
.dashboard-donut {
    --donut-value: 0%;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    background: conic-gradient(var(--brand-purple) var(--donut-value), #e9e4f5 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.dashboard-donut::before {
    content: '';
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    background: #fff;
}
.dashboard-donut-value { position: relative; font-size: 1.75rem; font-weight: 700; color: var(--brand-navy); }
.dashboard-donut-legend { list-style: none; padding: 0; margin: 0; text-align: left; font-size: .875rem; color: #495057; }
.dashboard-donut-legend li { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.dot-purple { background-color: var(--brand-purple); }
.dot-navy { background-color: var(--brand-navy); }
