/*
 * Modern visual layer for the admin portal.
 * Kept outside Metronic bundles so the redesign can evolve without rebuilding vendor assets.
 */

:root {
    --portal-bg: #f5f7fb;
    --portal-surface: #ffffff;
    --portal-surface-soft: #f8fafc;
    --portal-border: #e5e9f2;
    --portal-text: #111827;
    --portal-muted: #64748b;
    --portal-radius: 1rem;
    --portal-radius-sm: 0.75rem;
    --portal-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
    --portal-shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
    /* Blue palette — original identity, toned down (~50% intensity on surfaces) */
    --portal-accent: #1b84ff;
    --portal-accent-hover: #1570db;
    --portal-accent-soft: rgba(27, 132, 255, 0.08);
    --portal-accent-muted: rgba(27, 132, 255, 0.035);
    --portal-accent-border: rgba(27, 132, 255, 0.14);
    --portal-accent-ink: #2f7fe8;
    --portal-accent-purple: #7239ea;
    --preview-success: #2daa62;
    --preview-warning: #d4a017;
    --preview-info: #8b6fd4;
    /* Pirámides logo palette */
    --portal-logo-pink: #e91e63;
    --portal-logo-purple: #673ab7;
    --portal-logo-cyan: #4dd0e1;
    --portal-logo-blue: #1a237e;
}

.dark {
    --portal-bg: #0f1117;
    --portal-surface: #171923;
    --portal-surface-soft: #1f2330;
    --portal-border: #2b3040;
    --portal-text: var(--tw-gray-900);
    --portal-muted: var(--tw-gray-600);
    --portal-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
    --portal-shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.25);
}

body.portal-modern-shell {
    background:
        radial-gradient(circle at top left, rgba(27, 132, 255, 0.05), transparent 30rem),
        var(--portal-bg) !important;
    color: var(--portal-text);
    min-height: 100vh;
    min-height: 100dvh;
    height: auto !important;
    overflow-x: hidden;
}

html.h-full,
html.h-full body.portal-modern-shell {
    height: auto !important;
    min-height: 100%;
}

body.portal-modern-shell > .portal-shell-row {
    flex: 1 0 auto;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

body.portal-auth-shell {
    position: relative;
    overflow-x: hidden;
    background: var(--portal-bg) !important;
}

body.portal-auth-shell::before,
body.portal-auth-shell::after {
    content: '';
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(110px);
}

body.portal-auth-shell::before {
    width: 55vmax;
    height: 55vmax;
    top: -18%;
    left: -12%;
    background: radial-gradient(
        circle,
        rgba(233, 30, 99, 0.14) 0%,
        rgba(103, 58, 183, 0.1) 38%,
        transparent 72%
    );
    animation: portal-auth-tide-a 34s ease-in-out infinite alternate;
}

body.portal-auth-shell::after {
    width: 50vmax;
    height: 50vmax;
    right: -14%;
    bottom: -20%;
    background: radial-gradient(
        circle,
        rgba(77, 208, 225, 0.12) 0%,
        rgba(26, 35, 126, 0.1) 42%,
        transparent 74%
    );
    animation: portal-auth-tide-b 42s ease-in-out infinite alternate;
}

.dark body.portal-auth-shell::before {
    background: radial-gradient(
        circle,
        rgba(233, 30, 99, 0.1) 0%,
        rgba(103, 58, 183, 0.07) 38%,
        transparent 72%
    );
}

.dark body.portal-auth-shell::after {
    background: radial-gradient(
        circle,
        rgba(77, 208, 225, 0.08) 0%,
        rgba(26, 35, 126, 0.08) 42%,
        transparent 74%
    );
}

@keyframes portal-auth-tide-a {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(8vw, 6vh) scale(1.12);
    }
}

@keyframes portal-auth-tide-b {
    0% {
        transform: translate(0, 0) scale(1.05);
    }

    100% {
        transform: translate(-7vw, -5vh) scale(0.92);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.portal-auth-shell::before,
    body.portal-auth-shell::after {
        animation: none;
    }
}

.portal-wrapper {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.portal-main {
    flex: 1 0 auto;
    padding-top: 1rem;
    padding-bottom: 1.5rem;
}

.portal-main > .container-fluid,
.portal-main > .container-fixed,
.portal-page {
    --preview-primary: var(--portal-accent);
    --preview-primary-soft: var(--portal-accent-soft);
    padding-bottom: 1rem;
}

.portal-main .container-fluid {
    max-width: 1480px;
    margin-left: auto;
    margin-right: auto;
}

.portal-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0 0.75rem;
}

.portal-page-title {
    color: var(--portal-text);
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.portal-page-description {
    color: var(--portal-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: 0.35rem;
}

.portal-page-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.portal-section-title {
    color: var(--portal-text);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}

.card {
    border: 1px solid var(--portal-border) !important;
    border-radius: var(--portal-radius) !important;
    box-shadow: var(--portal-shadow-soft);
    background: var(--portal-surface) !important;
}

.card.card-grid,
.portal-table-card,
.portal-filter-card {
    overflow: hidden;
    box-shadow: var(--portal-shadow-soft);
}

.card-body {
    padding: 1.25rem;
}

.portal-filter-card {
    padding: 1rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    background: var(--portal-surface);
}

.portal-kpi-card {
    position: relative;
    overflow: hidden;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.portal-kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--portal-accent-border) !important;
    box-shadow: var(--portal-shadow);
}

.portal-kpi-icon {
    border-radius: 0.9rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background: var(--portal-surface-soft);
    color: var(--portal-muted) !important;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.table td {
    color: var(--portal-text);
    vertical-align: middle;
}

.table-border th,
.table-border td {
    border-color: var(--portal-border) !important;
}

.table tbody tr {
    transition: background-color 160ms ease;
}

.table tbody tr:hover {
    background: var(--portal-accent-muted);
}

body.portal-modern-shell .btn-primary {
    background-color: var(--portal-accent) !important;
    border-color: var(--portal-accent) !important;
    box-shadow: 0 6px 18px rgba(27, 132, 255, 0.16) !important;
}

body.portal-modern-shell .btn-primary:hover,
body.portal-modern-shell .btn-primary:focus,
body.portal-modern-shell .btn-primary:active {
    background-color: var(--portal-accent-hover) !important;
    border-color: var(--portal-accent-hover) !important;
    box-shadow: 0 8px 20px rgba(27, 132, 255, 0.2) !important;
}

body.portal-modern-shell .portal-table-action.btn-primary {
    background: var(--portal-accent-soft) !important;
    border-color: var(--portal-accent-border) !important;
    color: var(--portal-accent) !important;
    box-shadow: none !important;
}

body.portal-modern-shell .portal-table-action.btn-primary:hover,
body.portal-modern-shell .portal-table-action.btn-primary:focus {
    background: rgba(27, 132, 255, 0.14) !important;
    border-color: rgba(27, 132, 255, 0.22) !important;
    color: var(--portal-accent-hover) !important;
}

.btn {
    border-radius: 0.75rem !important;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.btn-primary {
    box-shadow: 0 6px 18px rgba(27, 132, 255, 0.16);
}

.btn-light,
.btn-secondary {
    border-color: var(--portal-border) !important;
    background: var(--portal-surface-soft) !important;
}

.input,
.select,
.textarea {
    border-color: var(--portal-border) !important;
    border-radius: 0.75rem !important;
    background-color: var(--portal-surface) !important;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--portal-accent) !important;
    box-shadow: 0 0 0 3px var(--portal-accent-soft);
}

.badge {
    border-radius: 999px !important;
    font-weight: 700;
}

#sidebar {
    background:
        radial-gradient(circle at 0% 0%, rgba(114, 57, 234, 0.07), transparent 52%),
        radial-gradient(circle at 100% 100%, rgba(27, 132, 255, 0.08), transparent 48%),
        linear-gradient(180deg, #f9fbfe 0%, #f4f7fc 42%, #eef2f8 100%) !important;
    border-right: 1px solid rgba(27, 132, 255, 0.1) !important;
    box-shadow: 8px 0 28px rgba(27, 132, 255, 0.05);
    backdrop-filter: blur(14px);
}

@media (min-width: 1024px) {
    #sidebar.portal-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        overflow: visible;
    }

    #sidebar_content {
        overflow: hidden;
    }

    #sidebar_scrollable {
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .portal-sidebar-toggle {
        position: absolute;
        top: 6.5rem;
        left: calc(100% - 1px);
        z-index: 40;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.85rem;
        height: 3rem;
        padding: 0;
        border: 1px solid rgba(27, 132, 255, 0.28);
        border-left: 0;
        border-radius: 0 0.8rem 0.8rem 0;
        background: #ffffff;
        color: #1570db;
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
        cursor: pointer;
        transition:
            background-color 160ms ease,
            border-color 160ms ease,
            color 160ms ease,
            box-shadow 160ms ease;
    }

    .portal-sidebar-toggle:hover {
        background: #f0f7ff;
        border-color: rgba(27, 132, 255, 0.45);
        color: #1266c7;
        box-shadow: 0 8px 24px rgba(27, 132, 255, 0.18);
    }

    .portal-sidebar-toggle:focus-visible {
        outline: 2px solid var(--portal-accent);
        outline-offset: 2px;
    }

    .portal-sidebar-toggle__icon {
        font-size: 0.8rem;
        font-weight: 700;
        line-height: 1;
        transition: transform 220ms ease;
    }

    .sidebar-collapse .portal-sidebar-toggle__icon {
        transform: rotate(180deg);
    }
}

.dark #sidebar {
    background:
        radial-gradient(circle at 0% 0%, rgba(114, 57, 234, 0.11), transparent 52%),
        radial-gradient(circle at 100% 100%, rgba(27, 132, 255, 0.09), transparent 48%),
        linear-gradient(180deg, #151820 0%, #111318 100%) !important;
    border-right-color: rgba(27, 132, 255, 0.14) !important;
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.2);
}

.demo1 .sidebar .sidebar-header,
#sidebar_header {
    height: auto !important;
    min-height: 7.75rem;
    padding: 1rem 1rem 0.75rem;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(27, 132, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent);
}

.dark #sidebar_header {
    border-bottom-color: rgba(27, 132, 255, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}

#sidebar .default-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 8.5rem;
    max-height: 5.25rem;
    margin: 0 auto;
    object-fit: contain;
}

.portal-sidebar-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    border-radius: 1.1rem;
    border: none;
    background: transparent;
    transition: box-shadow 160ms ease, transform 160ms ease;
}

html:not(.dark) .portal-sidebar-logo-wrap {
    position: relative;
    background: transparent;
    box-shadow: none;
}

html:not(.dark) .portal-sidebar-logo-wrap::before {
    content: '';
    position: absolute;
    inset: 0.4rem 0.25rem 0.2rem;
    border-radius: 1rem;
    background: radial-gradient(ellipse at center, rgba(30, 41, 59, 0.22) 0%, rgba(30, 41, 59, 0.04) 70%, transparent 100%);
    filter: blur(5px);
    z-index: 0;
    pointer-events: none;
}

html:not(.dark) .portal-sidebar-logo-wrap .default-logo {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.12));
}

html.dark .portal-sidebar-logo-wrap {
    background: transparent;
    box-shadow: none;
}

html.dark .portal-sidebar-logo-wrap .default-logo {
    filter: none;
}

html:not(.dark) .portal-sidebar-logo-wrap:hover {
    transform: translateY(-1px);
}

#sidebar_content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: transparent;
}

#sidebar_scrollable {
    padding-top: 0.5rem;
    padding-bottom: 1rem;
    flex: 1 1 auto;
    min-height: 0;
}

#sidebar_menu {
    padding-top: 0.15rem;
}

#sidebar_menu > .menu-item:first-child {
    margin-top: 0 !important;
}

#sidebar .menu {
    gap: 0.35rem;
}

#sidebar .menu-link {
    border-radius: 0.85rem;
    min-height: 2.65rem;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

#sidebar .menu-link:hover {
    background: var(--portal-accent-soft);
    transform: translateX(2px);
}

#sidebar .menu-link:hover .menu-title,
#sidebar .menu-link:hover .menu-icon,
#sidebar .menu-link:hover .menu-icon i {
    color: var(--portal-accent) !important;
}

.portal-menu-active > .menu-link,
.portal-menu-active.menu-link {
    background: var(--portal-accent-soft);
    border-color: var(--portal-accent-border) !important;
}

.portal-menu-active .menu-title,
.portal-menu-active .menu-icon,
.portal-menu-active .menu-icon i,
.portal-menu-active.menu-link .menu-title {
    color: var(--portal-accent) !important;
}

#sidebar .menu-accordion::before {
    border-color: rgba(27, 132, 255, 0.14) !important;
}

#sidebar .menu-accordion .menu-link:hover,
#sidebar .menu-accordion .menu-link.portal-menu-active {
    background: var(--portal-accent-soft) !important;
    border-color: var(--portal-accent-border) !important;
    border-radius: 0.75rem !important;
}

#sidebar .menu-accordion .menu-link.portal-menu-active .menu-title,
#sidebar .menu-accordion .menu-link:hover .menu-title {
    color: var(--portal-accent) !important;
}

#sidebar .menu-accordion .menu-bullet::before {
    background: rgba(27, 132, 255, 0.25);
}

#sidebar .menu-accordion .menu-link.portal-menu-active .menu-bullet::before,
#sidebar .menu-accordion .menu-link:hover .menu-bullet::before {
    background: var(--portal-accent) !important;
}

#sidebar .menu-item.portal-menu-open > .menu-accordion,
#sidebar .menu-item.show > .menu-accordion {
    display: flex !important;
}

#sidebar .menu-item.portal-menu-group > .menu-link {
    cursor: pointer;
}

#sidebar .menu-item.portal-menu-group .menu-toggle {
    cursor: pointer;
    border-radius: 0.55rem;
    padding: 0.15rem 0.35rem;
    margin-left: auto;
    transition: background-color 160ms ease, color 160ms ease;
    pointer-events: none;
}

#sidebar .menu-item.portal-menu-group .menu-toggle:hover,
#sidebar .menu-item.portal-menu-group .menu-toggle:focus-visible {
    background: var(--portal-accent-soft);
    color: var(--portal-accent);
    outline: none;
}

#sidebar .menu-item.portal-menu-group.portal-menu-open .menu-toggle .menu-item-show\:hidden,
#sidebar .menu-item.portal-menu-group.show .menu-toggle .menu-item-show\:hidden {
    display: none !important;
}

#sidebar .menu-item.portal-menu-group.portal-menu-open .menu-toggle .menu-item-show\:inline-flex,
#sidebar .menu-item.portal-menu-group.show .menu-toggle .menu-item-show\:inline-flex {
    display: inline-flex !important;
}

#header {
    border-bottom: 1px solid rgba(229, 233, 242, 0.72);
    background: rgba(245, 247, 251, 0.84) !important;
    backdrop-filter: blur(14px);
}

.dark #header {
    background: rgba(15, 17, 23, 0.84) !important;
    border-bottom-color: var(--portal-border);
}

#header_container {
    max-width: 1480px;
}

.menu-dropdown {
    border-radius: var(--portal-radius-sm) !important;
    box-shadow: var(--portal-shadow) !important;
}

.footer {
    position: relative;
    z-index: 5;
    flex-shrink: 0;
    width: 100%;
    margin-top: 1.5rem;
    border-top: 1px solid var(--portal-border);
    background: rgba(245, 247, 251, 0.97);
    backdrop-filter: blur(10px);
    color: var(--portal-muted);
}

.dark .footer {
    background: rgba(15, 17, 23, 0.97);
}

.footer .container-fixed {
    max-width: 1480px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.footer .container-fixed > div {
    padding-top: 1rem;
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

.modal-bg {
    background: rgba(15, 23, 42, 0.58) !important;
    backdrop-filter: blur(5px);
}

.modal-bg > .relative,
.fixed.inset-0.z-50 > .relative {
    animation: portal-modal-in 160ms ease-out;
}

@keyframes portal-modal-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.portal-auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 24.375rem;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid rgba(255, 255, 255, 0.65) !important;
    box-shadow: var(--portal-shadow);
    background: var(--portal-surface) !important;
}

.portal-auth-card--wide {
    max-width: 26.25rem;
}

.portal-auth-shell .page-bg {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.portal-auth-shell .portal-auth-logo {
    position: relative;
    z-index: 1;
    width: auto;
    max-width: 10rem;
    height: auto;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 10px 22px rgba(15, 23, 42, 0.12));
}

.portal-auth-card .card-body {
    color: var(--portal-text);
}

.portal-auth-card .form-label,
.portal-auth-card h2,
.portal-auth-card h3,
.portal-auth-card .portal-auth-title {
    color: var(--portal-text) !important;
}

.portal-auth-card .portal-auth-subtitle,
.portal-auth-card .text-gray-600 {
    color: var(--portal-muted) !important;
}

.portal-auth-card .input,
.portal-auth-card label.input {
    width: 100%;
    min-height: 3rem;
    border-color: var(--portal-border) !important;
    border-radius: 0.75rem !important;
    background-color: var(--portal-surface-soft) !important;
    color: var(--portal-text) !important;
}

.portal-auth-card .input.input-lg,
.portal-auth-card label.input.input-lg {
    min-height: 3rem;
    height: 3rem;
    font-size: 0.875rem;
}

.portal-auth-card label.input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.85rem;
    padding-right: 0.5rem;
}

.portal-auth-card label.input input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    box-shadow: none;
}

.portal-auth-card label.input .btn-icon {
    flex-shrink: 0;
}

.portal-auth-card label.input .btn-icon i {
    color: var(--portal-muted) !important;
}

.portal-auth-card .input:focus,
.portal-auth-card label.input:focus-within {
    border-color: var(--portal-accent) !important;
    box-shadow: 0 0 0 3px var(--portal-accent-soft) !important;
}

.portal-auth-card .input::placeholder,
.portal-auth-card label.input input::placeholder {
    color: var(--portal-muted);
}

.portal-auth-card .input:-webkit-autofill,
.portal-auth-card .input:-webkit-autofill:hover,
.portal-auth-card .input:-webkit-autofill:focus,
.portal-auth-card label.input input:-webkit-autofill,
.portal-auth-card label.input input:-webkit-autofill:hover,
.portal-auth-card label.input input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--portal-text) !important;
    caret-color: var(--portal-text);
    transition: background-color 9999s ease-out 0s;
    box-shadow: 0 0 0 1000px var(--portal-surface-soft) inset !important;
}

.dark .portal-auth-card {
    border-color: var(--portal-border) !important;
}

.dark .portal-auth-card .input,
.dark .portal-auth-card label.input {
    background-color: var(--portal-surface-soft) !important;
}

.portal-empty-state {
    color: var(--portal-muted);
    padding: 2rem 1rem;
    text-align: center;
}

@media (max-width: 767px) {
    .portal-main {
        padding-top: 0.5rem;
    }

    .portal-page-header {
        align-items: stretch;
    }

    .portal-page-actions,
    .portal-page-actions .btn {
        width: 100%;
    }

    .portal-page-actions .btn {
        justify-content: center;
    }
}

/* ── Modern preview (Dashboard prototype) ── */
.portal-page--modern-preview {
    --preview-primary: var(--portal-accent);
    --preview-primary-soft: var(--portal-accent-soft);
}

.portal-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(27, 132, 255, 0.12);
    background:
        radial-gradient(circle at top right, rgba(114, 57, 234, 0.09), transparent 42%),
        linear-gradient(135deg, rgba(27, 132, 255, 0.09), rgba(27, 132, 255, 0.02) 55%, rgba(255, 255, 255, 0.94));
    box-shadow: 0 12px 36px rgba(27, 132, 255, 0.07);
}

.dark .portal-hero {
    border-color: rgba(27, 132, 255, 0.18);
    background:
        radial-gradient(circle at top right, rgba(114, 57, 234, 0.12), transparent 42%),
        linear-gradient(135deg, rgba(27, 132, 255, 0.12), rgba(17, 19, 26, 0.94));
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

.portal-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--portal-accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dark .portal-hero__eyebrow {
    background: rgba(255, 255, 255, 0.07);
    color: #6eb3ff;
}

.portal-hero__title {
    color: var(--portal-text);
    font-size: clamp(1.6rem, 2vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.portal-hero__description {
    margin-top: 0.5rem;
    max-width: 36rem;
    color: var(--portal-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.portal-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.portal-hero__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--portal-border);
    background: rgba(255, 255, 255, 0.78);
    color: var(--portal-text);
    font-size: 0.8125rem;
    font-weight: 600;
}

.dark .portal-hero__chip {
    background: rgba(255, 255, 255, 0.06);
}

.portal-hero__chip--accent {
    border-color: rgba(27, 132, 255, 0.18);
    background: var(--portal-accent-soft);
    color: var(--portal-accent);
}

.portal-hero__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.portal-modern-section__head {
    margin-bottom: 1rem;
}

.portal-modern-section__title {
    color: var(--portal-text);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.portal-modern-section__subtitle {
    margin-top: 0.2rem;
    color: var(--portal-muted);
    font-size: 0.8125rem;
}

.portal-stat-card {
    position: relative;
    display: block;
    overflow: hidden;
    padding: 1.15rem 1.15rem 1rem;
    border-radius: 1.1rem;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface);
    box-shadow: var(--portal-shadow-soft);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

a.portal-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--portal-shadow);
}

.portal-stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--stat-accent, var(--preview-primary));
}

.portal-stat-card--primary { --stat-accent: var(--preview-primary); }
.portal-stat-card--success { --stat-accent: var(--preview-success); }
.portal-stat-card--warning { --stat-accent: var(--preview-warning); }
.portal-stat-card--info { --stat-accent: var(--preview-info); }

.portal-stat-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    margin-bottom: 0.85rem;
    border-radius: 0.85rem;
    background: var(--preview-primary-soft);
    color: var(--stat-accent, var(--preview-primary));
    font-size: 1rem;
}

.portal-stat-card--success .portal-stat-card__icon {
    background: rgba(45, 170, 98, 0.1);
}

.portal-stat-card--warning .portal-stat-card__icon {
    background: rgba(212, 160, 23, 0.1);
}

.portal-stat-card--info .portal-stat-card__icon {
    background: rgba(114, 57, 234, 0.09);
}

.portal-stat-card__value {
    color: var(--portal-text);
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.portal-stat-card--compact .portal-stat-card__value {
    font-size: 1.55rem;
}

.portal-stat-card__label {
    margin-top: 0.35rem;
    color: var(--portal-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.portal-modern-table {
    overflow: hidden;
    border: 1px solid var(--portal-border) !important;
    border-radius: 1.15rem !important;
    box-shadow: var(--portal-shadow-soft);
}

.portal-modern-table__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--portal-border);
    background: linear-gradient(180deg, var(--portal-surface-soft), var(--portal-surface));
}

.portal-modern-table__title {
    color: var(--portal-text);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.portal-modern-table__subtitle {
    margin-top: 0.15rem;
    color: var(--portal-muted);
    font-size: 0.8125rem;
}

.portal-modern-table__body {
    padding: 0.25rem 0.25rem 0.5rem;
}

.portal-modern-table__grid th {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    background: transparent;
}

.portal-modern-table__grid tbody tr:nth-child(even) {
    background: var(--portal-accent-muted);
}

.portal-modern-table__folio {
    display: inline-flex;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--preview-primary-soft);
    color: var(--preview-primary);
    font-size: 0.8125rem;
    font-weight: 700;
}

.portal-modern-table__date {
    color: var(--portal-muted);
    font-size: 0.875rem;
}

@media (max-width: 767px) {
    .portal-hero {
        padding: 1.15rem;
    }

    .portal-hero__meta {
        width: 100%;
    }

    .portal-hero__chip {
        width: 100%;
        justify-content: center;
    }
}

/* ── Modern list tables (Usuarios prototype) ── */
.portal-page--modern-list .portal-modern-table__toolbar {
    padding: 0 1.25rem 1.1rem;
    border-bottom: 1px solid var(--portal-border);
    background: var(--portal-surface-soft);
}

.portal-modern-table__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--portal-border);
    background: linear-gradient(180deg, var(--portal-surface), var(--portal-surface-soft));
}

.portal-modern-table__row {
    transition: background-color 160ms ease, box-shadow 160ms ease;
}

.portal-modern-table__row:hover {
    background: rgba(27, 132, 255, 0.035) !important;
}

.portal-modern-table__grid thead th {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--portal-border);
    background: transparent;
    color: var(--portal-muted) !important;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.portal-modern-table__grid tbody td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid rgba(229, 233, 242, 0.72);
}

.dark .portal-modern-table__grid tbody td {
    border-bottom-color: var(--portal-border);
}

.portal-modern-table__grid tbody tr:last-child td {
    border-bottom: none;
}

.portal-table-user {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 14rem;
}

.portal-table-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    background: linear-gradient(135deg, rgba(27, 132, 255, 0.12), rgba(114, 57, 234, 0.08));
    color: var(--portal-accent);
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.portal-table-avatar--role {
    background: linear-gradient(135deg, rgba(114, 57, 234, 0.12), rgba(27, 132, 255, 0.08));
    color: var(--portal-accent-purple);
}

.portal-table-name {
    display: block;
    color: var(--portal-text);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    transition: color 160ms ease;
}

.portal-table-name:hover {
    color: var(--portal-accent);
}

body.portal-modern-shell a.link {
    color: var(--portal-accent);
}

body.portal-modern-shell a.link:hover {
    color: var(--portal-accent-hover);
}

.portal-table-meta {
    margin-top: 0.15rem;
    color: var(--portal-muted);
    font-size: 0.78rem;
}

.portal-table-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.1);
    color: var(--portal-text);
    font-size: 0.78rem;
    font-weight: 700;
}

.portal-table-action-wrap {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.portal-table-action-wrap::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 0.45rem);
    left: 50%;
    z-index: 30;
    min-width: max-content;
    max-width: 14rem;
    padding: 0.35rem 0.6rem;
    border-radius: 0.5rem;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 140ms ease, transform 140ms ease;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
}

.portal-table-action-wrap::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 0.12rem);
    left: 50%;
    z-index: 31;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #0f172a;
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity 140ms ease;
    pointer-events: none;
}

.portal-table-action-wrap:hover::after,
.portal-table-action-wrap:hover::before,
.portal-table-action-wrap:focus-within::after,
.portal-table-action-wrap:focus-within::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dark .portal-table-action-wrap::after {
    background: #f8fafc;
    color: #0f172a;
}

.dark .portal-table-action-wrap::before {
    border-top-color: #f8fafc;
}

.portal-table-action {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0 !important;
    border-radius: 0.7rem !important;
}

.portal-table-action i {
    font-size: 0.9rem;
    line-height: 1;
}

.portal-pagination-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--portal-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.portal-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.portal-pagination__info {
    color: var(--portal-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.portal-pagination__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.portal-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.55rem;
    border: 1px solid var(--portal-border);
    border-radius: 0.65rem;
    background: var(--portal-surface);
    color: var(--portal-text);
    font-size: 0.8125rem;
    font-weight: 700;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.portal-pagination__btn:hover:not(.portal-pagination__btn--disabled) {
    border-color: var(--portal-accent-border);
    background: var(--portal-accent-soft);
    color: var(--portal-accent);
}

.portal-pagination__btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 767px) {
    .portal-modern-table__footer {
        align-items: stretch;
    }

    .portal-pagination {
        width: 100%;
        justify-content: space-between;
    }
}

/* --------------------------------------------------------------------------
   Form controls: custom checkboxes + Select2
   -------------------------------------------------------------------------- */

body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)) {
    -webkit-appearance: none;
    appearance: none;
    display: inline-grid;
    place-content: center;
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    border: 1.5px solid var(--portal-border);
    border-radius: 0.4rem;
    background-color: var(--portal-surface);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.7rem 0.7rem;
    cursor: pointer;
    flex-shrink: 0;
    vertical-align: middle;
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease,
        opacity 160ms ease;
}

body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)):not(:checked):hover:not(:disabled) {
    border-color: var(--portal-accent-border);
    background-color: var(--portal-accent-muted);
}

body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)):focus-visible:not(:checked) {
    outline: none;
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 3px var(--portal-accent-soft);
}

body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)):checked {
    border-color: var(--portal-accent);
    background-color: var(--portal-accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2 6.4 11 12.5 4.8' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)):checked:hover:not(:disabled),
body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)):checked:focus-visible:not(:disabled) {
    border-color: var(--portal-accent-hover);
    background-color: var(--portal-accent-hover);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2 6.4 11 12.5 4.8' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    box-shadow: 0 0 0 3px var(--portal-accent-soft);
}

body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)):disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background-color: var(--portal-surface-soft);
}

body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)):disabled:checked {
    border-color: rgba(27, 132, 255, 0.35);
    background-color: rgba(27, 132, 255, 0.45);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2 6.4 11 12.5 4.8' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

body.portal-modern-shell label:has(> input[type="checkbox"]:not(:is(.switch input, .checkbox))) {
    gap: 0.55rem;
}

body.portal-modern-shell .portal-select2-field {
    width: 100%;
}

body.portal-modern-shell .portal-select2-field .select2-container {
    width: 100% !important;
}

body.portal-modern-shell .select2-container--default .select2-selection--single,
body.portal-modern-shell .select2-container--default .select2-selection--multiple {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-sm);
    background: var(--portal-surface);
    min-height: 2.75rem;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

body.portal-modern-shell .select2-container--default .select2-selection--single {
    display: flex;
    align-items: center;
    padding: 0 0.85rem;
}

body.portal-modern-shell .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--portal-text);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    padding-left: 0;
}

body.portal-modern-shell .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--portal-muted);
    font-weight: 500;
}

body.portal-modern-shell .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 0.65rem;
}

body.portal-modern-shell .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--portal-muted) transparent transparent transparent;
}

body.portal-modern-shell .select2-container--default .select2-selection--multiple {
    padding: 0.35rem 0.45rem;
}

body.portal-modern-shell .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
}

body.portal-modern-shell .select2-container--default .select2-selection--multiple .select2-search__field {
    margin: 0.15rem 0;
    color: var(--portal-text);
    font-size: 0.875rem;
    font-weight: 500;
}

body.portal-modern-shell .select2-container--default .select2-selection--multiple .select2-search__field::placeholder {
    color: var(--portal-muted);
}

body.portal-modern-shell .select2-container--default .select2-selection--multiple .select2-selection__choice {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0.28rem 0.55rem 0.28rem 0.45rem;
    border: 1px solid var(--portal-accent-border);
    border-radius: 0.55rem;
    background: var(--portal-accent-soft);
    color: var(--portal-accent-ink);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
}

body.portal-modern-shell .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    margin: 0;
    padding: 0 0.15rem;
    border: 0;
    color: var(--portal-accent-ink);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.75;
    transition: opacity 140ms ease, color 140ms ease;
}

body.portal-modern-shell .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: var(--portal-accent-hover);
    opacity: 1;
    background: transparent;
}

body.portal-modern-shell .select2-container--default.select2-container--focus .select2-selection--single,
body.portal-modern-shell .select2-container--default.select2-container--focus .select2-selection--multiple,
body.portal-modern-shell .select2-container--default.select2-container--open .select2-selection--single,
body.portal-modern-shell .select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 3px var(--portal-accent-soft);
}

body.portal-modern-shell .select2-dropdown {
    overflow: hidden;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius-sm);
    background: var(--portal-surface);
    box-shadow: var(--portal-shadow-soft);
}

body.portal-modern-shell .select2-container--default .select2-results__option {
    padding: 0.55rem 0.85rem;
    color: var(--portal-text);
    font-size: 0.875rem;
    font-weight: 500;
}

body.portal-modern-shell .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--portal-accent-soft);
    color: var(--portal-accent-ink);
}

body.portal-modern-shell .select2-container--default .select2-results__option--selected {
    background: rgba(27, 132, 255, 0.14);
    color: var(--portal-accent-ink);
}

body.portal-modern-shell .select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--portal-border);
    border-radius: 0.55rem;
    padding: 0.45rem 0.65rem;
    color: var(--portal-text);
    font-size: 0.875rem;
}

body.portal-modern-shell .select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 3px var(--portal-accent-soft);
}

.dark body.portal-modern-shell input[type="checkbox"]:not(:is(.switch input, .checkbox)):disabled:checked {
    border-color: rgba(27, 132, 255, 0.4);
    background-color: rgba(27, 132, 255, 0.35);
}

.dark body.portal-modern-shell .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--portal-muted) transparent transparent transparent;
}

