:root {
    --sidebar-width: 270px;
    --primary: #6f42c1;
    --primary-dark: #59359c;
    --sidebar-bg: #161b26;
    --body-bg: #f4f6fa;
    --border-color: #e8ebf0;
    --text-primary: #252b36;
    --text-secondary: #7b8190;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--body-bg);
    color: var(--text-primary);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

a {
    text-decoration: none;
}

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
}

.text-primary {
    color: var(--primary) !important;
}

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

.admin-wrapper {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: #ffffff;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    min-height: 82px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #8d5ce7, #6334b5);
    font-size: 22px;
    box-shadow: 0 8px 22px rgba(111, 66, 193, 0.35);
}

.brand-title,
.brand-version {
    display: block;
}

.brand-title {
    font-size: 17px;
    font-weight: 700;
}

.brand-version {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 22px 14px;
}

.menu-title {
    display: block;
    margin: 0 12px 10px;
    color: rgba(255, 255, 255, 0.38);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
}

.menu-link {
    min-height: 46px;
    margin-bottom: 5px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 14px;
    transition: 0.2s ease;
}

.menu-link i {
    width: 21px;
    font-size: 17px;
}

.menu-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.menu-link.active {
    color: #ffffff;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-dark)
    );
    box-shadow: 0 8px 22px rgba(111, 66, 193, 0.25);
}

.sidebar-footer {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-footer strong,
.sidebar-footer small {
    display: block;
}

.sidebar-footer strong {
    font-size: 13px;
}

.sidebar-footer small {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.48);
    font-size: 11px;
}

.admin-main {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.admin-navbar {
    min-height: 82px;
    padding: 15px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.navbar-left,
.navbar-right,
.user-dropdown {
    display: flex;
    align-items: center;
}

.navbar-left {
    gap: 15px;
}

.navbar-right {
    gap: 14px;
}

.btn-menu {
    display: none;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 9px;
    background: #f1f3f7;
    font-size: 24px;
}

.navbar-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.navbar-subtitle {
    display: block;
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 12px;
}

.navbar-action {
    position: relative;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: #ffffff;
    color: #596071;
    font-size: 18px;
}

.notification-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: #dc3545;
}

.user-dropdown {
    padding: 5px 7px;
    gap: 10px;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
}

.user-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ede5fb;
    color: var(--primary);
    font-size: 19px;
}

.user-info strong,
.user-info small {
    display: block;
}

.user-info strong {
    font-size: 13px;
}

.user-info small {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 11px;
}

.admin-content {
    flex: 1;
    padding: 28px;
}

.dashboard-header {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.dashboard-header h2 {
    margin: 0 0 5px;
    font-size: 24px;
    font-weight: 700;
}

.dashboard-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.dashboard-date {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 13px;
}

.stat-card {
    height: 100%;
    min-height: 145px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 17px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(32, 40, 60, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(32, 40, 60, 0.08);
}

.stat-icon,
.quick-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
}

.stat-icon {
    width: 58px;
    height: 58px;
    border-radius: 15px;
    font-size: 24px;
}

.icon-purple {
    background: #eee5fc;
    color: #6f42c1;
}

.icon-blue {
    background: #e2edff;
    color: #0d6efd;
}

.icon-green {
    background: #e0f4ea;
    color: #198754;
}

.icon-orange {
    background: #fff0df;
    color: #fd7e14;
}

.stat-content span,
.stat-content strong,
.stat-content small {
    display: block;
}

.stat-content span {
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.stat-content strong {
    line-height: 1;
    font-size: 28px;
}

.stat-content small {
    margin-top: 8px;
    color: #a0a5b0;
    font-size: 11px;
}

.dashboard-card {
    padding: 22px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 6px 20px rgba(32, 40, 60, 0.04);
}

.card-heading {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-heading h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
}

.card-heading p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.card-action {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: #ffffff;
    color: var(--text-secondary);
}

.chart-container {
    position: relative;
    height: 320px;
}

.quick-actions {
    display: flex;
    flex-direction: column;
}

.quick-action {
    padding: 13px 4px;
    display: grid;
    grid-template-columns: 43px 1fr auto;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.quick-action:last-child {
    border-bottom: 0;
}

.quick-action:hover {
    color: var(--primary);
}

.quick-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    font-size: 17px;
}

.quick-action strong,
.quick-action span {
    display: block;
}

.quick-action strong {
    font-size: 13px;
}

.quick-action span {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 11px;
}

.admin-footer {
    min-height: 60px;
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-secondary);
    font-size: 12px;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.sidebar-visible {
        transform: translateX(0);
    }

    .admin-main {
        width: 100%;
        margin-left: 0;
    }

    .btn-menu {
        display: grid;
        place-items: center;
    }
}

@media (max-width: 767.98px) {
    .admin-navbar,
    .admin-content,
    .admin-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .user-info,
    .user-dropdown > .bi-chevron-down {
        display: none;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-date {
        width: 100%;
        justify-content: center;
    }

    .admin-footer {
        text-align: center;
        flex-direction: column;
    }
}

.brand-logo,
.auth-brand-logo {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: contain;
}

.brand-logo {
    padding: 4px;
    background: #ffffff;
}

/* Acceso y perfiles */
.auth-body {
    min-height: 100vh;
    background: #f5f6fb;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 1.05fr) minmax(420px, .95fr);
}

.auth-presentation {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        radial-gradient(
            circle at 85% 15%,
            rgba(255, 255, 255, .18),
            transparent 28%
        ),
        linear-gradient(
            145deg,
            var(--primary-dark),
            var(--primary) 70%,
            color-mix(
                in srgb,
                var(--primary) 75%,
                #ffffff
            )
        );
}

.auth-presentation::after {
    content: "";
    position: absolute;
    width: 330px;
    height: 330px;
    right: -130px;
    bottom: -150px;
    border: 55px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
}

.auth-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-brand-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: rgba(255, 255, 255, .16);
    font-size: 25px;
}

.auth-brand strong,
.auth-brand small {
    display: block;
}

.auth-brand strong {
    font-size: 20px;
}

.auth-brand small {
    margin-top: 2px;
    color: rgba(255, 255, 255, .66);
}

.auth-copy {
    position: relative;
    z-index: 1;
    max-width: 620px;
}

.auth-eyebrow {
    display: inline-block;
    margin-bottom: 18px;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    color: rgba(255, 255, 255, .82);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.auth-copy h1 {
    max-width: 560px;
    margin-bottom: 20px;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    font-weight: 750;
    line-height: 1.03;
}

.auth-copy p {
    max-width: 540px;
    margin: 0;
    color: rgba(255, 255, 255, .72);
    font-size: 18px;
    line-height: 1.7;
}

.auth-features {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    color: rgba(255, 255, 255, .82);
    font-size: 14px;
}

.auth-features i {
    margin-right: 7px;
}

.auth-form-panel {
    padding: 30px;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 470px);
    padding: clamp(2rem, 5vw, 3.25rem);
    border: 1px solid #e9eaf0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(37, 21, 67, .10);
}

.auth-card h2 {
    margin-bottom: 8px;
    font-weight: 750;
}

.auth-card p {
    margin: 0;
    color: var(--text-secondary);
}

.auth-card .input-group-text {
    color: #786e89;
    background: #f8f7fb;
}

.auth-card .form-control,
.auth-card .input-group-text,
.auth-card .input-group .btn {
    border-color: #e2dfeb;
}

.auth-support {
    margin-top: 25px;
    padding: 14px;
    border-radius: 10px;
    color: #696174;
    background: #f7f5fb;
    font-size: 13px;
    line-height: 1.5;
}

.auth-support i {
    margin-right: 6px;
    color: var(--primary);
}

.profile-avatar {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(
        135deg,
        color-mix(
            in srgb,
            var(--primary) 78%,
            #ffffff
        ),
        var(--primary-dark)
    );
    box-shadow: 0 10px 25px rgba(111, 66, 193, .25);
    font-size: 32px;
}

.config-summary-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    font-size: 21px;
}

.config-logo-preview {
    min-height: 190px;
    padding: 20px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px dashed #d8dbe4;
    border-radius: 16px;
    background: #f8f9fc;
}

.config-logo-preview img {
    max-width: 100%;
    max-height: 155px;
    object-fit: contain;
}

.config-logo-preview > div {
    width: 96px;
    height: 96px;
    display: grid;
    place-items: center;
    border-radius: 25px;
    color: #ffffff;
    background: var(--primary);
    font-size: 47px;
    box-shadow: 0 13px 30px
        rgba(111, 66, 193, .25);
}

#modalRol .modal-content {
    max-height: calc(100vh - 2rem);
}

#matrizPermisos .form-check:last-child {
    border-bottom: 0 !important;
}

@media (max-width: 991.98px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-presentation {
        min-height: 310px;
        gap: 45px;
    }

    .auth-copy h1 {
        font-size: clamp(2.2rem, 8vw, 3.7rem);
    }
}

@media (max-width: 575.98px) {
    .auth-presentation {
        min-height: 255px;
        padding: 24px;
    }

    .auth-copy p,
    .auth-features {
        display: none;
    }

    .auth-form-panel {
        padding: 16px;
    }

    .auth-card {
        padding: 25px 20px;
        border-radius: 16px;
    }
}
