/*
 * Tema visual global de gestión del talento humano.
 * Se activa únicamente en páginas con body.sap-th-theme para no alterar
 * documentos embebidos o respuestas parciales.
 */
:root {
    --th-primary: #2f6fd3;
    --th-primary-dark: #1f4f9f;
    --th-primary-soft: #e8f1ff;
    --th-ink: #18365f;
    --th-text: #355174;
    --th-muted: #6f829e;
    --th-border: #dbe6f4;
    --th-canvas: #f3f7fc;
    --th-surface: #ffffff;
    --th-success: #38a86b;
    --th-danger: #e55272;
    --th-warning: #d99a2b;
    --th-header-height: 4.25rem;
    --th-radius: 8px;
    --th-shadow: 0 4px 14px rgba(31, 79, 159, 0.07);
    --th-shadow-hover: 0 8px 22px rgba(31, 79, 159, 0.12);
}

body.sap-th-theme {
    margin: 0;
    color: var(--th-text);
    background: var(--th-canvas);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body.sap-th-theme *,
body.sap-th-theme *::before,
body.sap-th-theme *::after {
    box-sizing: border-box;
}

/* Shell y cabecera */
body.sap-th-theme .sap-header {
    position: fixed;
    z-index: 1100;
    top: 0;
    right: 0;
    left: 0;
    height: var(--th-header-height);
    min-height: var(--th-header-height);
    color: var(--th-ink);
    background: rgba(255, 255, 255, 0.97) !important;
    border: 0;
    border-bottom: 1px solid var(--th-border);
    box-shadow: 0 3px 14px rgba(31, 79, 159, 0.07);
}

body.sap-th-theme .sap-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 0 1.5rem;
}

body.sap-th-theme .sap-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--th-ink) !important;
    font-size: 1rem;
    font-weight: 750;
}

body.sap-th-theme .sap-logo-icon {
    color: var(--th-primary) !important;
}

body.sap-th-theme .sap-logo > .sap-logo-icon:not(.sap-logo-icon-wrap) {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--th-primary-soft);
}

body.sap-th-theme .sap-menu-toggle {
    color: var(--th-primary-dark) !important;
    background: #eff5ff !important;
    border: 1px solid #d9e7fb !important;
    border-radius: 7px;
}

body.sap-th-theme .sap-menu-toggle:hover {
    color: #fff !important;
    background: var(--th-primary) !important;
}

body.sap-th-theme .sap-user-info,
body.sap-th-theme .sap-user-details {
    display: flex;
    align-items: center;
}

body.sap-th-theme .sap-user-info {
    gap: 1rem;
}

body.sap-th-theme .sap-user-details {
    gap: 0.5rem;
    color: var(--th-ink);
    font-size: 0.78rem;
    font-weight: 650;
}

body.sap-th-theme .sap-user-avatar {
    width: 32px;
    height: 32px;
    border: 2px solid #dbeafe;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #eff6ff;
}

body.sap-th-theme .sap-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2rem;
    padding: 0.42rem 0.72rem;
    color: var(--th-primary-dark) !important;
    background: #eff5ff !important;
    border: 1px solid #d9e7fb !important;
    border-radius: 7px;
    font: 650 0.72rem/1 "Segoe UI", sans-serif;
    cursor: pointer;
}

body.sap-th-theme .sap-logout-btn:hover {
    color: #fff !important;
    background: var(--th-primary) !important;
    border-color: var(--th-primary) !important;
}

body.sap-th-theme.has-sidebar .sap-layout-container {
    margin-top: var(--th-header-height);
    min-height: calc(100vh - var(--th-header-height));
}

body.sap-th-theme.has-sidebar .sap-side-nav {
    top: var(--th-header-height);
    height: calc(100vh - var(--th-header-height));
    color: var(--th-text);
    background: #fff;
    border-right: 1px solid var(--th-border);
    box-shadow: 4px 0 16px rgba(31, 79, 159, 0.04);
}

body.sap-th-theme .sap-side-nav-header {
    color: var(--th-muted);
    background: #f8fbff;
    border-color: var(--th-border);
}

body.sap-th-theme .sap-nav-link,
body.sap-th-theme .sap-subnav-link {
    color: #526985;
    border-radius: 6px;
}

body.sap-th-theme .sap-nav-link:hover,
body.sap-th-theme .sap-subnav-link:hover,
body.sap-th-theme .sap-nav-link.active,
body.sap-th-theme .sap-subnav-link.active {
    color: var(--th-primary-dark);
    background: var(--th-primary-soft);
}

body.sap-th-theme .sap-nav-link i,
body.sap-th-theme .sap-subnav-link i {
    color: var(--th-primary);
}

body.sap-th-theme:not(.has-sidebar) .sap-main-content {
    width: min(100%, 1680px);
    min-height: calc(100vh - var(--th-header-height));
    margin: var(--th-header-height) auto 0;
    padding: 1.25rem 1.5rem 2rem;
}

body.sap-th-theme.has-sidebar .sap-main-content {
    min-height: calc(100vh - var(--th-header-height));
    padding: 1.25rem 1.5rem 2rem;
    background: var(--th-canvas);
}

/* Títulos y navegación de página */
body.sap-th-theme .sap-page-header,
body.sap-th-theme .page-header {
    margin: 0 0 0.9rem;
    padding: 1rem 1.1rem;
    color: var(--th-ink);
    background: #fff;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius);
    box-shadow: var(--th-shadow);
}

body.sap-th-theme .sap-page-title,
body.sap-th-theme .page-title,
body.sap-th-theme h1 {
    color: var(--th-ink);
}

body.sap-th-theme .sap-page-title,
body.sap-th-theme .page-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 760;
    letter-spacing: -0.02em;
}

body.sap-th-theme .sap-page-title i,
body.sap-th-theme .page-title i {
    color: var(--th-primary);
}

body.sap-th-theme .sap-breadcrumb,
body.sap-th-theme .page-subtitle,
body.sap-th-theme .text-muted {
    color: var(--th-muted) !important;
}

body.sap-th-theme a {
    color: var(--th-primary);
}

body.sap-th-theme a:hover {
    color: var(--th-primary-dark);
}

/* Superficies */
body.sap-th-theme .sap-content-card,
body.sap-th-theme .card,
body.sap-th-theme .content-card,
body.sap-th-theme .stat-card,
body.sap-th-theme .dashboard-card,
body.sap-th-theme .config-section,
body.sap-th-theme .profile-card,
body.sap-th-theme .user-card {
    color: var(--th-text);
    background: var(--th-surface);
    border-color: var(--th-border);
    border-radius: var(--th-radius);
    box-shadow: var(--th-shadow);
}

body.sap-th-theme .sap-content-card:hover,
body.sap-th-theme .stat-card:hover,
body.sap-th-theme .dashboard-card:hover,
body.sap-th-theme .profile-card:hover {
    box-shadow: var(--th-shadow-hover);
}

body.sap-th-theme .sap-card-header,
body.sap-th-theme .card-header {
    color: var(--th-ink);
    background: #fff !important;
    border-color: var(--th-border);
}

body.sap-th-theme .sap-card-title,
body.sap-th-theme .card-title {
    color: var(--th-ink);
    font-weight: 700;
}

body.sap-th-theme .sap-card-title i,
body.sap-th-theme .card-title i {
    color: var(--th-primary);
}

body.sap-th-theme .bg-primary,
body.sap-th-theme .bg-info {
    color: #fff !important;
    background-color: var(--th-primary) !important;
}

/* Formularios */
body.sap-th-theme label,
body.sap-th-theme .form-label {
    color: #4c6281;
    font-weight: 650;
}

body.sap-th-theme input:not([type="checkbox"]):not([type="radio"]),
body.sap-th-theme select,
body.sap-th-theme textarea,
body.sap-th-theme .form-control,
body.sap-th-theme .form-select,
body.sap-th-theme .multi-select-button {
    color: var(--th-text);
    background-color: #fff;
    border-color: #d6e1ee;
    border-radius: 6px;
}

body.sap-th-theme input:not([type="checkbox"]):not([type="radio"]):focus,
body.sap-th-theme select:focus,
body.sap-th-theme textarea:focus,
body.sap-th-theme .form-control:focus,
body.sap-th-theme .form-select:focus,
body.sap-th-theme .multi-select-button:focus {
    border-color: #8bb2eb;
    outline: 3px solid rgba(47, 111, 211, 0.1);
    box-shadow: none;
}

body.sap-th-theme input[type="checkbox"],
body.sap-th-theme input[type="radio"] {
    accent-color: var(--th-primary);
}

body.sap-th-theme .form-group,
body.sap-th-theme .filter-section,
body.sap-th-theme .filters-container,
body.sap-th-theme .search-section {
    border-color: var(--th-border);
}

/* Botones */
body.sap-th-theme .btn-primary,
body.sap-th-theme .sap-button-primary,
body.sap-th-theme button.primary,
body.sap-th-theme .primary-button,
body.sap-th-theme .action-btn.primary,
body.sap-th-theme .save-btn {
    color: #fff !important;
    background: var(--th-primary) !important;
    border-color: var(--th-primary) !important;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(47, 111, 211, 0.18);
}

body.sap-th-theme .btn-primary:hover,
body.sap-th-theme .sap-button-primary:hover,
body.sap-th-theme button.primary:hover,
body.sap-th-theme .primary-button:hover,
body.sap-th-theme .save-btn:hover {
    background: var(--th-primary-dark) !important;
    border-color: var(--th-primary-dark) !important;
}

body.sap-th-theme .btn-secondary,
body.sap-th-theme .sap-button-secondary,
body.sap-th-theme .secondary-button,
body.sap-th-theme .cancel-btn {
    color: var(--th-text) !important;
    background: #fff !important;
    border-color: var(--th-border) !important;
    border-radius: 6px;
}

body.sap-th-theme .btn-danger,
body.sap-th-theme .delete-btn {
    background-color: var(--th-danger) !important;
    border-color: var(--th-danger) !important;
}

body.sap-th-theme button:focus-visible,
body.sap-th-theme a:focus-visible {
    outline: 3px solid rgba(47, 111, 211, 0.24);
    outline-offset: 2px;
}

/* Tablas y datos */
body.sap-th-theme table {
    color: var(--th-text);
    border-color: var(--th-border);
}

body.sap-th-theme table th,
body.sap-th-theme .sap-table-header,
body.sap-th-theme .table thead th {
    color: #405978;
    background: #eef5ff;
    border-color: var(--th-border);
}

body.sap-th-theme table td,
body.sap-th-theme table th,
body.sap-th-theme .table td,
body.sap-th-theme .table th {
    border-color: #e4ecf6;
}

body.sap-th-theme table tbody tr:nth-child(even),
body.sap-th-theme .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #fafcff;
}

body.sap-th-theme table tbody tr:hover {
    background-color: #f1f6fd;
}

body.sap-th-theme .badge-primary,
body.sap-th-theme .badge.bg-primary {
    background: var(--th-primary) !important;
}

/* Modales, mensajes y paginación */
body.sap-th-theme .sap-modal,
body.sap-th-theme .modal-content,
body.sap-th-theme .modal-container,
body.sap-th-theme .modal-panel {
    color: var(--th-text);
    background: #fff;
    border: 1px solid var(--th-border);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(24, 54, 95, 0.24);
}

body.sap-th-theme .sap-modal-header,
body.sap-th-theme .modal-header {
    color: var(--th-ink);
    background: #fff;
    border-color: var(--th-border);
}

body.sap-th-theme .alert-info {
    color: #285a93;
    background: #eaf3ff;
    border-color: #cfe2fb;
}

body.sap-th-theme .alert-success {
    color: #24734d;
    background: #e5f6ed;
    border-color: #c7ead7;
}

body.sap-th-theme .alert-danger {
    color: #9e3650;
    background: #fcebf0;
    border-color: #f5cdd8;
}

body.sap-th-theme .pagination .page-link,
body.sap-th-theme .sap-pagination button {
    color: var(--th-primary);
    border-color: var(--th-border);
}

body.sap-th-theme .pagination .active .page-link,
body.sap-th-theme .sap-pagination button.active {
    color: #fff;
    background: var(--th-primary);
    border-color: var(--th-primary);
}

/* Variantes sin shell SAP */
body.sap-th-theme.admin-standalone .container,
body.sap-th-theme.report-standalone .container {
    max-width: 1440px;
}

body.sap-th-theme.admin-standalone > .container,
body.sap-th-theme.report-standalone > .container {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

body.sap-th-theme.admin-standalone > .sap-header ~ .container,
body.sap-th-theme.report-standalone > .sap-header ~ .container {
    margin-top: calc(var(--th-header-height) + 1.5rem);
}

body.sap-th-theme.report-standalone > .sap-header ~ .page {
    padding-top: calc(var(--th-header-height) + 1.25rem);
}

body.sap-th-theme.report-standalone > .sap-header + nav {
    margin-top: var(--th-header-height) !important;
}

body.sap-th-theme.report-standalone > .sap-side-nav {
    top: var(--th-header-height);
    height: calc(100vh - var(--th-header-height));
}

body.sap-th-theme.credentials-page .simple-header {
    color: var(--th-ink);
    background: #fff;
    border-bottom: 1px solid var(--th-border);
    box-shadow: 0 3px 14px rgba(31, 79, 159, 0.07);
}

body.sap-th-theme.credentials-page .simple-header a,
body.sap-th-theme.credentials-page .simple-header button {
    color: var(--th-primary-dark);
}

body.sap-th-theme.auth-page {
    min-height: 100vh;
    color: var(--th-text);
    background:
        radial-gradient(900px 450px at 5% 0%, #dceaff 0%, transparent 62%),
        radial-gradient(750px 420px at 100% 100%, #e7edff 0%, transparent 60%),
        var(--th-canvas);
}

body.sap-th-theme.auth-page .auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.35rem;
    padding: 1.5rem 1.25rem;
}

body.sap-th-theme.auth-page .auth-card {
    width: min(100%, 920px);
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--th-border);
    border-radius: 16px;
    box-shadow: 0 18px 46px rgba(31, 79, 159, 0.14);
}

body.sap-th-theme.auth-page .login-container,
body.sap-th-theme.auth-page .login-card,
body.sap-th-theme.auth-page .auth-container {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--th-border);
    border-radius: 12px;
    box-shadow: 0 18px 46px rgba(31, 79, 159, 0.14);
}

body.sap-th-theme.auth-page .auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.4rem 2.2rem;
    color: var(--th-ink);
    background:
        linear-gradient(180deg, rgba(232, 241, 255, 0.92) 0%, rgba(243, 247, 252, 0.65) 100%);
    border-right: 1px solid var(--th-border);
}

body.sap-th-theme.auth-page .auth-brand::after {
    content: "";
    position: absolute;
    right: -48px;
    bottom: -64px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(47, 111, 211, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

body.sap-th-theme.auth-page .auth-brand-mark {
    width: 5.4rem;
    height: 5.4rem;
    margin-bottom: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e3eefb;
    border-radius: 50%;
    box-shadow: 0 8px 22px rgba(31, 79, 159, 0.1);
}

body.sap-th-theme.auth-page .auth-logo {
    width: 3.7rem;
    height: 3.7rem;
    object-fit: contain;
}

body.sap-th-theme.auth-page .auth-kicker {
    margin: 0 0 0.35rem;
    color: var(--th-primary);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.sap-th-theme.auth-page .auth-brand h1,
body.sap-th-theme.auth-page .logo h1 {
    margin: 0;
    color: var(--th-ink);
    font-size: 1.85rem;
    font-weight: 750;
    letter-spacing: -0.03em;
}

body.sap-th-theme.auth-page .auth-tagline {
    margin: 0.2rem 0 0.9rem;
    color: var(--th-primary-dark);
    font-size: 0.95rem;
    font-weight: 650;
}

body.sap-th-theme.auth-page .auth-lead {
    margin: 0 0 1.35rem;
    max-width: 28rem;
    color: var(--th-text);
    font-size: 0.9rem;
    line-height: 1.5;
}

body.sap-th-theme.auth-page .auth-highlights {
    margin: 0;
    padding: 0;
    list-style: none;
}

body.sap-th-theme.auth-page .auth-highlights li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0 0 0.7rem;
    color: var(--th-text);
    font-size: 0.84rem;
    font-weight: 600;
}

body.sap-th-theme.auth-page .auth-highlights li i {
    width: 1.85rem;
    height: 1.85rem;
    flex: 0 0 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--th-primary);
    background: #fff;
    border: 1px solid #d9e7fb;
    border-radius: 50%;
    font-size: 0.72rem;
}

body.sap-th-theme.auth-page .auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.5rem 2.2rem;
    background: #fff;
}

body.sap-th-theme.auth-page .auth-panel-header h2 {
    margin: 0 0 0.4rem;
    color: var(--th-ink);
    font-size: 1.35rem;
    font-weight: 750;
}

body.sap-th-theme.auth-page .auth-panel-header p {
    margin: 0 0 1.5rem;
    color: var(--th-muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

body.sap-th-theme.auth-page .auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 1.15rem;
    padding: 0.8rem 0.9rem;
    border-radius: 8px;
    font-size: 0.84rem;
    line-height: 1.4;
}

body.sap-th-theme.auth-page .auth-alert-error {
    color: #8a1f38;
    background: #fff1f4;
    border: 1px solid #f6c5d0;
}

body.sap-th-theme.auth-page .auth-alert-success {
    color: #1f6b44;
    background: #edf9f2;
    border: 1px solid #c5e7d3;
}

body.sap-th-theme.auth-page .login-logo,
body.sap-th-theme.auth-page .logo-icon {
    color: var(--th-primary);
}

body.sap-th-theme.auth-page .google-btn,
body.sap-th-theme.auth-page .login-btn,
body.sap-th-theme.auth-page .login-button {
    width: 100%;
    min-height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    color: #fff !important;
    background: var(--th-primary) !important;
    border: 1px solid var(--th-primary) !important;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(47, 111, 211, 0.22);
    font: 700 0.95rem/1 "Segoe UI", sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

body.sap-th-theme.auth-page .login-button-icon {
    width: 1.85rem;
    height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--th-primary);
    background: #fff;
    border-radius: 50%;
    font-size: 0.85rem;
}

body.sap-th-theme.auth-page .login-button:hover {
    color: #fff !important;
    background: var(--th-primary-dark) !important;
    border-color: var(--th-primary-dark) !important;
    box-shadow: var(--th-shadow-hover);
    transform: translateY(-1px);
}

body.sap-th-theme.auth-page .login-button:focus-visible {
    outline: 3px solid #c7dbff;
    outline-offset: 2px;
}

body.sap-th-theme.auth-page .auth-hint {
    margin: 1.15rem 0 0;
    color: var(--th-muted);
    font-size: 0.78rem;
    line-height: 1.45;
    text-align: center;
}

body.sap-th-theme.auth-page .auth-copyright {
    color: var(--th-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
}

@media (max-width: 820px) {
    body.sap-th-theme.auth-page .auth-card {
        grid-template-columns: 1fr;
        max-width: 430px;
    }

    body.sap-th-theme.auth-page .auth-brand {
        padding: 1.8rem 1.5rem 1.4rem;
        border-right: 0;
        border-bottom: 1px solid var(--th-border);
        text-align: center;
        align-items: center;
    }

    body.sap-th-theme.auth-page .auth-lead,
    body.sap-th-theme.auth-page .auth-highlights {
        display: none;
    }

    body.sap-th-theme.auth-page .auth-panel {
        padding: 1.7rem 1.5rem 1.9rem;
    }
}

/* Menú global para vistas que no usan la navegación lateral completa. */
body.sap-th-theme .global-menu-launcher {
    position: fixed;
    z-index: 1650;
    top: calc(var(--th-header-height) + 0.75rem);
    left: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.25rem;
    padding: 0.5rem 0.75rem;
    color: var(--th-primary-dark);
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--th-border);
    border-radius: 7px;
    box-shadow: var(--th-shadow);
    font: 700 0.72rem/1 "Segoe UI", sans-serif;
    cursor: pointer;
}

body.sap-th-theme:not(:has(> .sap-header)) .global-menu-launcher {
    top: 0.85rem;
}

body.sap-th-theme .global-menu-launcher:hover {
    color: #fff;
    background: var(--th-primary);
    border-color: var(--th-primary);
}

body.sap-th-theme .global-menu-overlay {
    position: fixed;
    z-index: 1690;
    inset: 0;
    visibility: hidden;
    background: rgba(15, 36, 66, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.sap-th-theme .global-menu-overlay.is-open {
    visibility: visible;
    opacity: 1;
}

body.sap-th-theme .global-app-menu {
    position: fixed;
    z-index: 1700;
    top: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(320px, 88vw);
    color: var(--th-text);
    background: #fff;
    border-right: 1px solid var(--th-border);
    box-shadow: 16px 0 40px rgba(24, 54, 95, 0.2);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
}

body.sap-th-theme .global-app-menu.is-open {
    transform: translateX(0);
}

body.sap-th-theme .global-app-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--th-header-height);
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--th-border);
}

body.sap-th-theme .global-app-menu__brand,
body.sap-th-theme .global-app-menu__user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

body.sap-th-theme .global-app-menu__brand-icon,
body.sap-th-theme .global-app-menu__avatar {
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--th-primary);
    background: var(--th-primary-soft);
    border-radius: 50%;
    font-weight: 750;
}

body.sap-th-theme .global-app-menu__brand > span:last-child,
body.sap-th-theme .global-app-menu__user > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

body.sap-th-theme .global-app-menu__brand strong,
body.sap-th-theme .global-app-menu__user strong {
    overflow: hidden;
    color: var(--th-ink);
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.sap-th-theme .global-app-menu__brand small,
body.sap-th-theme .global-app-menu__user small {
    overflow: hidden;
    margin-top: 0.1rem;
    color: var(--th-muted);
    font-size: 0.64rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.sap-th-theme .global-app-menu__close {
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    padding: 0;
    color: var(--th-muted);
    background: #f6f9fd;
    border: 1px solid var(--th-border);
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

body.sap-th-theme .global-app-menu__content {
    overflow-y: auto;
    padding: 0.8rem;
}

body.sap-th-theme .global-app-menu__section + .global-app-menu__section {
    margin-top: 0.9rem;
}

body.sap-th-theme .global-app-menu__section h2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.35rem;
    padding: 0 0.45rem;
    color: var(--th-muted);
    font-size: 0.66rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

body.sap-th-theme .global-app-menu__section h2 i {
    color: var(--th-primary);
}

body.sap-th-theme .global-app-menu__section ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

body.sap-th-theme .global-app-menu__section a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 2.45rem;
    padding: 0.55rem 0.65rem;
    color: #526985;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    text-decoration: none;
}

body.sap-th-theme .global-app-menu__section a i {
    width: 1rem;
    color: var(--th-primary);
    text-align: center;
}

body.sap-th-theme .global-app-menu__section a:hover,
body.sap-th-theme .global-app-menu__section a.active {
    color: var(--th-primary-dark);
    background: var(--th-primary-soft);
}

body.sap-th-theme .global-app-menu__footer {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.8rem 0.9rem;
    background: #f8fbff;
    border-top: 1px solid var(--th-border);
}

body.sap-th-theme .global-app-menu__user {
    min-width: 0;
    flex: 1;
}

body.sap-th-theme .global-app-menu__user img {
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
    border: 2px solid #dbeafe;
    border-radius: 50%;
    object-fit: cover;
}

body.sap-th-theme .global-app-menu__logout {
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--th-danger);
    background: #fff;
    border: 1px solid var(--th-border);
    border-radius: 50%;
    text-decoration: none;
}

body.global-menu-open {
    overflow: hidden;
}

/* Bootstrap puede imponer colores mediante variables locales. */
body.sap-th-theme {
    --bs-primary: var(--th-primary);
    --bs-primary-rgb: 47, 111, 211;
    --bs-link-color: var(--th-primary);
    --bs-link-hover-color: var(--th-primary-dark);
    --bs-border-color: var(--th-border);
    --bs-body-color: var(--th-text);
    --bs-body-bg: var(--th-canvas);
}

@media (max-width: 900px) {
    body.sap-th-theme .sap-header-container {
        padding: 0 1rem;
    }

    body.sap-th-theme:not(.has-sidebar) .sap-main-content,
    body.sap-th-theme.has-sidebar .sap-main-content {
        padding: 1rem;
    }

    body.sap-th-theme .sap-side-nav {
        top: var(--th-header-height);
    }
}

@media (max-width: 640px) {
    :root {
        --th-header-height: 4rem;
    }

    body.sap-th-theme .sap-header-container {
        padding: 0 0.75rem;
    }

    body.sap-th-theme .sap-user-details span,
    body.sap-th-theme .sap-logout-btn span {
        display: none;
    }

    body.sap-th-theme .sap-logout-btn {
        width: 2rem;
        padding: 0;
    }

    body.sap-th-theme .sap-page-header,
    body.sap-th-theme .page-header {
        padding: 0.8rem;
    }

    body.sap-th-theme .sap-page-title,
    body.sap-th-theme .page-title {
        font-size: 1.05rem;
    }
}
