/* Menú lateral móvil CME — cargado de forma asíncrona sin bloquear el renderizado inicial */
.cme-drawer {
    --drawer-width: min(20.5rem, 84dvw, 100dvw - 24px);
    --drawer-backdrop: 0;

    inset: 0;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    overflow: visible;
    color: #1f2937;
    font-family: var(--font-primary, 'Open Sans', sans-serif);
}

.cme-drawer::backdrop {
    background: rgba(8, 24, 15, 0.56);
    opacity: var(--drawer-backdrop, 1);
}

.cme-drawer-scroller {
    position: relative;
    display: grid;
    grid-template-columns: var(--drawer-width) 100%;
    overflow-x: scroll;
    overscroll-behavior: none;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
}

.cme-drawer-scroller::-webkit-scrollbar {
    display: none;
}

@media (prefers-reduced-motion: no-preference) {
    .cme-drawer-scroller {
        scroll-behavior: smooth;
    }
}

.cme-drawer-scroller::after {
    content: '';
    scroll-snap-align: end;
    scroll-initial-target: nearest;
}

.cme-drawer-sheet {
    display: flex;
    flex-direction: column;
    height: 100svh;
    background: #f5f7f6;
    color: #1f2937;
    box-shadow: 6px 0 32px rgba(11, 41, 26, 0.22);
    overflow: hidden;
    scroll-snap-align: start;
}

@supports (animation-timeline: scroll()) {
    .cme-drawer {
        timeline-scope: --cme-drawer-fade;
        animation: cme-drawer-backdrop-fade linear both;
        animation-timeline: --cme-drawer-fade;
    }

    .cme-drawer-scroller {
        scroll-timeline: --cme-drawer-fade x;
    }

    @property --drawer-backdrop {
        syntax: '<number>';
        inherits: true;
        initial-value: 0;
    }

    @keyframes cme-drawer-backdrop-fade {
        0% { --drawer-backdrop: 1; }
        100% { --drawer-backdrop: 0; }
    }
}

.cme-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: max(14px, env(safe-area-inset-top)) 14px 14px 16px;
    background: #134229;
    background: linear-gradient(135deg, #0b291a 0%, #1a5636 100%);
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-brand-dinamico, #134229) 72%, #07170e) 0%, var(--color-brand-dinamico, #1a5636) 100%);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    flex-shrink: 0;
}

.cme-drawer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #ffffff;
    min-width: 0;
}

.cme-drawer-brand img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #ffffff;
    padding: 2px;
    object-fit: contain;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.cme-drawer-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.cme-drawer-brand-text strong {
    font-family: var(--font-secondary, 'Outfit', sans-serif);
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cme-drawer-brand-text span {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
}

.cme-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, transform 0.15s ease;
    touch-action: manipulation;
}

.cme-drawer-close:hover {
    background: rgba(255, 255, 255, 0.26);
}

.cme-drawer-close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.cme-drawer-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px 12px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cme-drawer-student-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #e4efff 100%);
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.08);
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cme-drawer-student-card:hover,
.cme-drawer-student-card.is-active {
    border-color: #60a5fa;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.14);
}

.cme-drawer-student-card:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.cme-drawer-student-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #1d4ed8;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cme-drawer-student-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.cme-drawer-student-text strong {
    font-family: var(--font-secondary, 'Outfit', sans-serif);
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e3a8a;
}

.cme-drawer-student-text span {
    font-size: 0.75rem;
    color: #3b5998;
    margin-top: 2px;
}

.cme-drawer-chevron {
    color: #1d4ed8;
    flex-shrink: 0;
}

.cme-drawer-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cme-drawer-section-title {
    font-family: var(--font-secondary, 'Outfit', sans-serif);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #526058;
    padding: 0 6px;
}

.cme-drawer-list {
    list-style: none;
    margin: 0;
    padding: 4px;
    background: #ffffff;
    border: 1px solid #e5eae7;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.cme-drawer-list li + li {
    border-top: 1px solid #f0f3f1;
}

.cme-drawer-link {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: #1f2937;
    font-family: var(--font-secondary, 'Outfit', sans-serif);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.cme-drawer-link:hover {
    background-color: #f1f6f3;
    color: var(--color-verde-brand, #006400);
}

.cme-drawer-link:focus-visible {
    outline: 2px solid var(--color-verde-brand, #006400);
    outline-offset: -2px;
}

.cme-drawer-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #eef5f0;
    color: var(--color-brand-dinamico, var(--color-verde-brand, #006400));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cme-drawer-label {
    flex: 1;
    min-width: 0;
}

.cme-drawer-ext {
    color: #7c8b82;
    flex-shrink: 0;
}

.cme-drawer-link.is-active {
    background: #e7f3ec;
    color: #0b4624;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--color-brand-dinamico, var(--color-verde-brand, #006400));
}

.cme-drawer-link.is-active .cme-drawer-icon {
    background: var(--color-brand-dinamico, var(--color-verde-brand, #006400));
    color: #ffffff;
}

.cme-drawer-link.is-cta {
    color: #993414;
    font-weight: 600;
}

.cme-drawer-link.is-cta .cme-drawer-icon {
    background: #fdf1ed;
    color: var(--color-accent, #b8401b);
}

.cme-drawer-link.is-cta:hover {
    background: #fdf4f1;
    color: #7c290f;
}

.cme-drawer-footer {
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #e5eae7;
    padding: 10px 16px max(12px, env(safe-area-inset-bottom)) 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.76rem;
    color: #526058;
}

.cme-drawer-phone {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-verde-brand, #006400);
    font-family: var(--font-secondary, 'Outfit', sans-serif);
    font-weight: 600;
    text-decoration: none;
}

.cme-drawer-address {
    color: #526058;
    white-space: nowrap;
}
