/* ============================================================
   MARCA CORPORATIVA
   Identidad visual compartida por layout y modulos.
============================================================ */

:root {
    --corp-blue: #00436d;
    --corp-blue-soft: #eaf3f8;
    --corp-green: #008b4f;
    --corp-yellow: #e5ae00;
    --corp-red: #9a2029;
    --corp-ink: #243447;
    --corp-muted: #66788a;
    --corp-border: #d9e3ea;
    --corp-surface: #ffffff;
    --corp-page: #f4f8fb;
}

body {
    background:
        linear-gradient(180deg, rgba(244, 248, 251, .96), rgba(244, 248, 251, .96)),
        url("../../img/logof.png") no-repeat right -220px bottom -420px / 780px auto;
    color: var(--corp-ink);
}

body.is-private-app {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(244, 248, 251, .98), rgba(244, 248, 251, .98)),
        url("../../img/logof.png") no-repeat right -240px bottom -440px / 780px auto;
}

.app-sidebar {
    width: 280px;
    min-height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 18px;
    padding: 18px;
    background: var(--corp-surface);
    border-right: 1px solid var(--corp-border);
    box-shadow: 10px 0 28px rgba(0, 67, 109, .08);
    transform: translateX(-100%);
    transition: transform .22s ease;
}

body.is-sidebar-open .app-sidebar {
    transform: translateX(0);
}

.app-sidebar__user {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: var(--corp-blue-soft);
    border: 1px solid #cfe0e9;
    border-radius: 8px;
}

.app-sidebar__user span {
    color: var(--corp-muted);
    font-size: .86rem;
    font-weight: 800;
}

.app-sidebar__user strong {
    color: var(--corp-blue);
    font-size: .98rem;
    line-height: 1.25;
}

.app-sidebar__nav {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 0;
    overflow-y: auto;
}

.app-sidebar__section {
    margin: 12px 4px 4px;
    color: var(--corp-green);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.app-sidebar__subsection {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 4px 2px 8px;
    padding-left: 8px;
    border-left: 2px solid rgba(15, 76, 129, .25);
    color: #4b5d73;
    font-size: .74rem;
    font-weight: 800;
    line-height: 1.25;
}

.app-sidebar__subsection .bi {
    font-size: .8rem;
    opacity: .75;
}

.app-sidebar [data-tens-menu-funcion][hidden] {
    display: none !important;
}

.app-sidebar__labores {
    display: grid;
    gap: 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--corp-border);
}

.app-sidebar__labores-titulo {
    margin: 4px 4px 0;
    color: var(--corp-green);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.app-sidebar__labores-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.app-sidebar__labor {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    color: var(--corp-blue);
    font: inherit;
    font-size: .84rem;
    font-weight: 800;
    line-height: 1.2;
    background: #fff;
    border: 1px solid #cfe0e9;
    border-radius: 999px;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

button.app-sidebar__labor:hover,
button.app-sidebar__labor:focus-visible {
    border-color: var(--corp-blue);
    outline: none;
}

.app-sidebar__labor.is-active {
    color: #fff;
    background: var(--corp-blue);
    border-color: var(--corp-blue);
}

.app-sidebar__labor.is-unica {
    cursor: default;
}

.app-sidebar__labor-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #d97706;
    color: #fff;
    font-size: .68rem;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.app-sidebar__labor-badge[hidden] {
    display: none !important;
}

.app-sidebar__labor.is-active .app-sidebar__labor-badge {
    background: rgba(255, 255, 255, .28);
    color: #fff;
}

.app-sidebar__labor.has-pendientes:not(.is-active) {
    border-color: #e0c592;
}

.app-sidebar__link,
.app-sidebar__logout button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    color: #2f4554;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 900;
    line-height: 1;
    text-align: left;
    text-decoration: none;
}

a.app-sidebar__link.is-disabled {
    pointer-events: none;
}

.app-sidebar__link:hover,
.app-sidebar__link:focus {
    color: var(--corp-blue);
    background: #f3f8fb;
    border-color: #dce7ed;
}

.app-sidebar__link.is-active {
    color: #fff;
    background: var(--corp-blue);
    border-color: var(--corp-blue);
}

.app-sidebar__link.is-disabled,
.app-sidebar__link:disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
    color: #6b7c8a;
    background: transparent;
    border-color: transparent;
}

.app-sidebar__link.is-disabled:hover,
.app-sidebar__link.is-disabled:focus,
.app-sidebar__link:disabled:hover,
.app-sidebar__link:disabled:focus {
    color: #6b7c8a;
    background: transparent;
    border-color: transparent;
}

.app-sidebar__link .bi,
.app-sidebar__logout .bi,
.app-topbar__menu .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    line-height: 1;
}

.app-sidebar__link-text {
    flex: 1 1 auto;
    min-width: 0;
}

.app-sidebar__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 .45rem;
    margin-left: auto;
    border-radius: 999px;
    background: #e8f0f5;
    color: #16364e;
    font-size: .72rem;
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.app-sidebar__link.is-active .app-sidebar__badge {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.app-sidebar__link.is-disabled .app-sidebar__badge,
.app-sidebar__link:disabled .app-sidebar__badge {
    background: #eef2f5;
    color: #7a8b98;
}

.app-sidebar__logout {
    margin: 0;
    padding-top: 14px;
    border-top: 1px solid var(--corp-border);
}

.app-sidebar__logout--user {
    display: none;
}

.app-sidebar__logout button {
    color: var(--corp-red);
    background: #fff8f8;
    border-color: #f0d2d6;
}

.app-sidebar__logout button:hover,
.app-sidebar__logout button:focus {
    color: #fff;
    background: var(--corp-red);
    border-color: var(--corp-red);
}

.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1035;
    display: none;
    background: rgba(18, 35, 48, .46);
    border: 0;
}

body.is-sidebar-open .app-sidebar-backdrop {
    display: block;
}

/* Con el menu lateral abierto, el boton no debe tapar el contenido */
body.is-sidebar-open .app-topbar__menu {
    display: none !important;
}

.app-topbar__menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    min-height: 42px;
    padding: 10px 12px;
    position: fixed;
    top: 24px;
    left: clamp(12px, 1.5vw, 22px);
    z-index: 1100;
    box-shadow: 0 10px 24px rgba(0, 67, 109, .14);
    color: #fff;
    background: var(--corp-blue);
    border: 1px solid var(--corp-blue);
    border-radius: 8px;
    font-weight: 900;
    line-height: 1;
    text-align: left;
    text-decoration: none;
}

.app-topbar__menu .bi {
    color: #fff;
}

.app-workspace {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 22px clamp(18px, 2.4vw, 34px) 10px;
}

.brand-footer {
    width: 100%;
    padding: 18px 16px 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--corp-muted);
    font-size: .86rem;
    font-weight: 700;
    text-align: center;
}

.is-private-app .brand-footer {
    padding-left: 16px;
}

/* Overlay de arranque / carga de escritorio privado */
.overlay-loading {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    background: rgba(244, 248, 251, .94);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity .22s ease, visibility .22s ease;
}

.overlay-loading.is-visible {
    display: flex;
}

.overlay-loading.is-leaving {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 10.5rem;
    padding: 20px 24px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--corp-border);
    box-shadow: 0 14px 36px rgba(22, 54, 78, .14);
    color: var(--corp-blue);
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
}

.overlay-loading__logo {
    display: block;
    width: auto;
    max-width: 168px;
    height: auto;
    max-height: 52px;
    object-fit: contain;
}

.overlay-loading__spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid #d9e3ea;
    border-top-color: var(--corp-blue);
    animation: app-boot-spin .7s linear infinite;
}

@keyframes app-boot-spin {
    to {
        transform: rotate(360deg);
    }
}

body.is-app-booting {
    overflow: hidden;
}

@media (max-width: 575px) {
    .app-workspace {
        padding: 12px 12px 6px;
    }
}

@media (min-width: 576px) and (max-width: 1199px) {
    .app-workspace {
        padding-top: 20px;
    }
}
