/* MOB-001 - Ajustes exclusivamente móviles.
   No altera estilos de escritorio ni lógica funcional. */

.epa-sidebar__mobile-head,
.epa-mobile-nav-backdrop,
.epa-mobile-account-button,
.epa-mobile-account-menu {
    display: none;
}

@media (max-width: 820px) {
    /* Cabecera móvil compacta. En escritorio se conserva el diseño existente. */
    .epa-header--m2 {
        min-height: var(--epa-header-height);
    }

    .epa-brand--app img {
        width: 165px;
        height: 48px;
    }

    .epa-header__brand {
        gap: 10px;
    }

    /* Empleado: la hamburguesa se oculta. Administrador/SuperAdministrador:
       el servidor añade epa-menu-button--mobile-enabled y el botón permanece. */
    .epa-menu-button:not(.epa-menu-button--mobile-enabled) {
        display: none;
    }

    .epa-menu-button--mobile-enabled {
        cursor: pointer;
    }

    /* Navegación administrativa off-canvas. La barra lateral de escritorio
       se reutiliza sin duplicar reglas de autorización ni enlaces. */
    .epa-sidebar {
        display: flex;
        position: fixed;
        top: var(--epa-header-height);
        left: 0;
        bottom: 0;
        width: min(86vw, 330px);
        min-height: 0;
        max-height: calc(100dvh - var(--epa-header-height));
        overflow-y: auto;
        z-index: 45;
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform .2s ease, visibility .2s ease;
        box-shadow: 12px 0 30px rgba(6, 45, 97, .18);
    }

    .epa-mobile-nav-open .epa-sidebar {
        transform: translateX(0);
        visibility: visible;
    }

    .epa-mobile-nav-open {
        overflow: hidden;
    }

    .epa-sidebar__mobile-head {
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 8px 14px;
        color: var(--epa-heading);
        border-bottom: 1px solid var(--epa-border);
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .epa-mobile-nav-close {
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 8px;
        background: #eef4fa;
        color: var(--epa-heading);
        font-size: 1.6rem;
        line-height: 1;
        cursor: pointer;
    }

    .epa-sidebar__nav {
        padding: 10px 12px 18px;
    }

    .epa-sidebar .epa-nav-item {
        min-height: 44px;
    }

    .epa-mobile-nav-backdrop {
        position: fixed;
        top: var(--epa-header-height);
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 44;
        border: 0;
        padding: 0;
        background: rgba(5, 30, 60, .42);
        cursor: default;
    }

    .epa-mobile-nav-open .epa-mobile-nav-backdrop {
        display: block;
    }

    /* Cuenta móvil independiente del menú funcional: disponible para todos
       los roles y con salida de sesión explícita. */
    .epa-header__account {
        position: relative;
        gap: 8px;
    }

    .epa-header__account > .epa-user-badge {
        display: none;
    }

    .epa-mobile-account-button {
        min-height: 44px;
        max-width: 155px;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 4px 6px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #fff;
        cursor: pointer;
    }

    .epa-mobile-account-button strong {
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: .88rem;
    }

    .epa-mobile-account-button .epa-user-badge__avatar {
        flex: 0 0 36px;
    }

    .epa-mobile-account-button__chevron {
        font-size: .75rem;
        opacity: .9;
    }

    .epa-mobile-account-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        width: min(250px, calc(100vw - 28px));
        padding: 10px;
        border: 1px solid var(--epa-border);
        border-radius: 10px;
        background: #fff;
        color: var(--epa-text);
        box-shadow: 0 14px 34px rgba(6, 45, 97, .22);
        z-index: 60;
    }

    .epa-mobile-account-menu.is-open {
        display: block;
    }

    .epa-mobile-account-menu__identity {
        padding: 7px 8px 11px;
        border-bottom: 1px solid var(--epa-border);
    }

    .epa-mobile-account-menu__identity strong,
    .epa-mobile-account-menu__identity small {
        display: block;
    }

    .epa-mobile-account-menu__identity strong {
        color: var(--epa-heading);
        overflow-wrap: anywhere;
    }

    .epa-mobile-account-menu__identity small {
        margin-top: 3px;
        color: var(--epa-muted);
    }

    .epa-mobile-account-menu form {
        margin: 8px 0 0;
    }

    .epa-mobile-account-menu form button {
        width: 100%;
        min-height: 42px;
        padding: 0 12px;
        border: 0;
        border-radius: 7px;
        background: #eef4fa;
        color: var(--epa-heading);
        text-align: left;
        font-weight: 800;
        cursor: pointer;
    }
}

/* Mi fichaje: optimización específica para teléfono. Todos los cambios están
   acotados a <= 640px; la vista de escritorio queda intacta. */
@media (max-width: 640px) {
    .epa-attendance-page .epa-page-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        margin-bottom: 9px;
    }

    .epa-attendance-page .epa-page-header .epa-eyebrow,
    .epa-attendance-page .epa-page-header > div > p:last-child {
        display: none;
    }

    .epa-attendance-page .epa-page-header h1 {
        font-size: 1.35rem;
        line-height: 1.15;
    }

    .epa-attendance-page .epa-page-header .epa-button {
        min-height: 38px;
        align-self: center;
        padding: 0 12px;
        white-space: nowrap;
        font-size: .86rem;
    }

    .epa-attendance-page .epa-alert {
        margin-bottom: 9px;
        padding: 9px 11px;
    }

    .epa-attendance-page .epa-punch-hero {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        padding: 10px;
        border-radius: 10px;
    }

    .epa-attendance-page .epa-punch-identity {
        grid-column: 1 / -1;
        gap: 10px;
        min-width: 0;
    }

    .epa-attendance-page .epa-punch-identity img {
        width: 52px;
        height: 52px;
        flex: 0 0 52px;
    }

    .epa-attendance-page .epa-punch-identity > div {
        min-width: 0;
    }

    .epa-attendance-page .epa-punch-identity .epa-eyebrow {
        margin-bottom: 2px;
        font-size: .66rem;
    }

    .epa-attendance-page .epa-punch-identity h2 {
        font-size: 1.05rem;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .epa-attendance-page .epa-punch-identity p {
        margin-top: 3px;
        font-size: .76rem;
        line-height: 1.2;
    }

    .epa-attendance-page .epa-live-clock,
    .epa-attendance-page .epa-attendance-state {
        min-height: 72px;
        padding: 9px 10px;
        border-radius: 8px;
    }

    .epa-attendance-page .epa-live-clock span,
    .epa-attendance-page .epa-attendance-state span {
        font-size: .68rem;
    }

    .epa-attendance-page .epa-live-clock strong {
        margin: 2px 0;
        font-size: 1.42rem;
        line-height: 1.05;
    }

    .epa-attendance-page .epa-live-clock small {
        font-size: .68rem;
    }

    .epa-attendance-page .epa-attendance-state strong {
        margin-top: 3px;
        font-size: 1rem;
        line-height: 1.1;
    }

    .epa-attendance-page .epa-punch-actions {
        margin-top: 9px;
        padding: 10px;
        border-radius: 10px;
    }

    .epa-attendance-page .epa-punch-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .epa-attendance-page .epa-punch-button {
        min-height: 90px;
        padding: 10px 7px;
        border-radius: 10px;
    }

    .epa-attendance-page .epa-punch-button__icon {
        margin-bottom: 3px;
        font-size: 1.45rem;
        line-height: 1;
    }

    .epa-attendance-page .epa-punch-button strong {
        font-size: .95rem;
    }

    .epa-attendance-page .epa-punch-button small {
        margin-top: 3px;
        font-size: .73rem;
    }

    .epa-attendance-page .epa-punch-comment {
        margin-top: 10px;
    }

    .epa-attendance-page .epa-punch-comment span {
        margin-bottom: 5px;
        font-size: .82rem;
    }

    .epa-attendance-page .epa-punch-comment input {
        height: 40px;
        font-size: .86rem;
    }

    .epa-attendance-page .epa-day-timeline {
        margin-top: 10px;
        padding: 14px;
    }
}

@media (max-width: 420px) {
    .epa-brand--app img {
        width: 145px;
    }

    .epa-mobile-account-button {
        max-width: 128px;
    }

    .epa-mobile-account-button strong {
        max-width: 66px;
    }
}
