/*
 * Capa visual exclusiva de la PWA instalada.
 * La media query evita que estos estilos afecten a la web abierta en el navegador.
 */
.hes-pwa-bottom-nav {
    display: none;
}

/* Calendario casi a sangre en la PWA: conserva solo un margen tactil minimo. */
@media (max-width: 767.98px) {
    body.hes-pwa .horarios-scheduler-shell > .horarios-calendar-column {
        padding-right: 4px;
        padding-left: 4px;
    }

    body.hes-pwa .horarios-calendar-column > .horarios-week-card {
        border: 0 !important;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    body.hes-pwa .horarios-calendar-column > .horarios-week-card > .card-body {
        padding: 0;
    }

    body.hes-pwa .horarios-calendar-column .horarios-view-switcher,
    body.hes-pwa .horarios-calendar-column .horarios-filter-panel,
    body.hes-pwa .horarios-calendar-column .horarios-week-nav,
    body.hes-pwa .horarios-calendar-column .horarios-date-strip {
        width: calc(100% - 12px);
        margin-right: 6px;
        margin-left: 6px;
    }

    body.hes-pwa .horarios-calendar-column .horarios-week-grid-wrap,
    body.hes-pwa .horarios-calendar-column .horarios-week-grid,
    body.hes-pwa .horarios-calendar-column .horarios-day-agenda {
        width: 100%;
        max-width: 100%;
    }

    body.hes-pwa .horarios-calendar-column .horarios-week-grid-wrap {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }
}

/* La agenda de horarios tambien se aplica en navegacion movil normal. */
@media (max-width: 767.98px) {
    .horarios-scheduler-shell > .horarios-calendar-column {
        order: -1;
    }

    .horarios-week-card .card-body {
        padding: .8rem;
    }

    .horarios-week-nav {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: .5rem;
        align-items: center;
    }

    .horarios-week-title {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        font-size: 1rem !important;
        line-height: 1.2;
    }

    #horariosWeekPrev { grid-column: 1; grid-row: 1; }
    #horariosWeekNext { grid-column: 3; grid-row: 1; }

    .horarios-today-button {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
        min-height: 38px;
        padding-inline: 1.25rem;
    }

    .horarios-day-agenda {
        display: grid;
        min-width: 0;
        width: 100%;
        gap: .75rem;
    }

    .horarios-day-agenda.horarios-week-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .horarios-day-agenda .horarios-day-item {
        position: relative;
        display: grid;
        grid-template-columns: 3.25rem minmax(0, 1fr);
        gap: .65rem;
        min-width: 0;
    }

    .horarios-day-agenda .horarios-day-item__time {
        position: relative;
        z-index: 1;
        align-self: start;
        padding: .32rem .15rem;
        border-radius: .5rem;
        background: var(--color-fondo, #f6f7fb);
        color: var(--color-texto-titulo, var(--color-texto, #333));
        font-size: .78rem;
        font-weight: 800;
        text-align: center;
    }

    .horarios-day-agenda .horarios-day-item__content {
        min-width: 0;
    }

    .horarios-day-agenda .horarios-day-slot {
        position: relative;
        min-height: 3.75rem;
        padding: .35rem;
        border: 1px solid var(--color-borde, #d9dce3);
        border-radius: max(var(--redondeado-bordes, 8px), 8px);
        background: var(--color-fondo-card, #fff);
    }

    .horarios-day-agenda .horarios-week-event,
    .horarios-day-agenda .horarios-week-event--expanded,
    .horarios-day-agenda .horarios-week-event--expanded-left {
        position: relative;
        inset: auto;
        width: 100%;
        max-width: 100%;
        min-height: 5rem;
        height: auto;
        margin: 0;
        overflow: visible;
        transform: none;
    }

    .horarios-day-agenda .horarios-day-item__room {
        margin: .3rem .15rem 0;
        color: var(--color-texto, #555);
        font-size: .75rem;
        font-weight: 600;
    }

    .horarios-day-agenda .horarios-day-item__room::before {
        content: 'Sala: ';
        font-weight: 400;
    }

    .horarios-day-agenda .horarios-day-empty {
        padding: 2.5rem 1rem;
        text-align: center;
    }
}

/* Respaldo para WebViews que informan un viewport virtual de escritorio. */
body.hes-horarios-day-view .horarios-scheduler-shell > .horarios-calendar-column {
    order: -1;
}

body.hes-horarios-day-view .horarios-week-grid-wrap {
    overflow: visible;
}

body.hes-horarios-day-view .horarios-day-agenda.horarios-week-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    width: 100%;
    gap: .75rem;
}

body.hes-horarios-day-view .horarios-day-item {
    position: relative;
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: .65rem;
    min-width: 0;
}

body.hes-horarios-day-view .horarios-day-item__content {
    min-width: 0;
}

body.hes-horarios-day-view .horarios-day-slot {
    position: relative;
    min-height: 3.75rem;
    padding: .35rem;
    border: 1px solid var(--color-borde, #d9dce3);
    border-radius: max(var(--redondeado-bordes, 8px), 8px);
    background: var(--color-fondo-card, #fff);
}

body.hes-horarios-day-view .horarios-day-agenda .horarios-week-event,
body.hes-horarios-day-view .horarios-day-agenda .horarios-week-event--expanded,
body.hes-horarios-day-view .horarios-day-agenda .horarios-week-event--expanded-left {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: 100%;
    min-height: 5rem;
    height: auto;
    margin: 0;
    overflow: visible;
    transform: none;
}

.hes-pwa-section-title {
    display: none;
}

.horarios-view-switcher {
    width: min(100%, 22rem);
    margin-right: auto;
    margin-left: 0;
}

.horarios-view-switcher .form-select {
    width: 100%;
}

.horarios-filter-panel {
    width: min(100%, 38rem);
    margin-right: auto;
    margin-left: auto;
    border: 1px solid var(--color-borde, #d9dce3);
    border-radius: max(var(--redondeado-bordes, 10px), 10px);
    background: var(--color-fondo-card, #fff);
}

.horarios-filter-panel > summary {
    display: flex;
    min-height: var(--hes-pwa-touch-min, 44px);
    padding: .6rem .75rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    font-weight: 750;
    list-style: none;
}

.horarios-filter-panel > summary::-webkit-details-marker {
    display: none;
}

.horarios-filter-panel > summary::after {
    content: '⌄';
    margin-left: auto;
    font-size: 1.1rem;
    transition: transform .18s ease;
}

.horarios-filter-panel[open] > summary::after {
    transform: rotate(180deg);
}

.horarios-filter-count {
    padding: var(--hes-pwa-compact-padding-y, 2px) var(--hes-pwa-compact-padding-x, 6px);
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-borde, #d9dce3) 45%, transparent);
    font-size: var(--hes-pwa-font-aux, 12px);
    font-weight: 700;
}

.horarios-filter-count.has-active-filters {
    background: color-mix(in srgb, var(--color-boton, #121078) 14%, transparent);
    color: var(--color-boton, #121078);
}

.horarios-filter-panel__body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    padding: .25rem .75rem .85rem;
    border-top: 1px solid color-mix(in srgb, var(--color-borde, #d9dce3) 65%, transparent);
}

.horarios-filter-panel__body > div {
    min-width: 0;
}

@media (max-width: 767.98px) {
    .horarios-filter-panel__body {
        grid-template-columns: minmax(0, 1fr);
    }

    .horarios-filter-panel .horarios-room-control {
        margin-bottom: 0 !important;
    }
}

.horarios-date-strip {
    display: flex;
    width: 100%;
    gap: var(--hes-pwa-space-xs, 4px);
    padding: var(--hes-pwa-space-xs, 4px) 0 var(--hes-pwa-space-sm, 8px);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.horarios-date-strip[hidden] {
    display: none;
}

.horarios-date-strip::-webkit-scrollbar {
    display: none;
}

.horarios-date-strip__day {
    display: grid;
    flex: 0 0 56px;
    min-height: 56px;
    padding: var(--hes-pwa-space-xs, 4px);
    place-items: center;
    gap: .05rem;
    border: 1px solid var(--color-borde, #d9dce3);
    border-radius: max(var(--redondeado-bordes, 10px), 10px);
    background: var(--color-fondo-card, #fff);
    color: var(--color-texto, #333);
    line-height: 1;
    scroll-snap-align: center;
}

.horarios-date-strip__day.is-selected {
    border-color: color-mix(in srgb, var(--color-boton, #121078) 75%, #000);
    background: var(--color-boton, #121078);
    color: var(--color-texto-boton, #fff);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--color-boton, #121078) 28%, transparent);
}

.horarios-date-strip__day.is-today:not(.is-selected) {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--color-boton, #121078) 55%, transparent);
}

.horarios-date-strip__weekday,
.horarios-date-strip__month {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.horarios-date-strip__number {
    font-size: 1.15rem;
}

.horarios-quick-sheet[hidden] {
    display: none;
}

.horarios-create-fab {
    display: none;
}

@media (max-width: 767.98px) {
    body.hes-horarios-day-view .horarios-create-fab,
    body.hes-pwa .horarios-create-fab {
        position: fixed;
        right: max(1rem, env(safe-area-inset-right, 0));
        bottom: calc(76px + env(safe-area-inset-bottom, 0));
        z-index: 1026;
        display: inline-flex;
        width: 3.65rem;
        height: 3.65rem;
        padding: 0;
        align-items: center;
        justify-content: center;
        border: 2px solid color-mix(in srgb, var(--color-boton, #121078) 75%, #000);
        border-radius: 50%;
        background: var(--color-boton, #121078);
        color: var(--color-texto-boton, #fff);
        box-shadow: 0 8px 22px color-mix(in srgb, var(--color-boton, #121078) 35%, rgba(0, 0, 0, .18));
    }

    .horarios-create-fab:active {
        transform: scale(.94);
    }
}

.horarios-quick-sheet {
    position: fixed;
    inset: 0;
    z-index: 1090;
}

.horarios-quick-sheet__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: rgba(15, 23, 42, .48);
}

.horarios-quick-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: min(80dvh, 42rem);
    padding: .55rem 1rem calc(1rem + env(safe-area-inset-bottom, 0));
    overflow-y: auto;
    border-radius: 1.2rem 1.2rem 0 0;
    background: var(--color-fondo-card, #fff);
    color: var(--color-texto, #333);
    box-shadow: 0 -10px 35px rgba(15, 23, 42, .2);
    animation: horarios-sheet-in .2s ease-out;
}

.horarios-quick-sheet__handle {
    width: 2.75rem;
    height: .28rem;
    margin: 0 auto .75rem;
    border-radius: 999px;
    background: var(--color-borde, #cbd5e1);
}

.horarios-quick-sheet__header {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.horarios-quick-sheet__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.horarios-quick-action {
    min-height: max(3.25rem, var(--hes-pwa-touch-min, 44px));
    padding: .65rem;
    border: 1px solid var(--color-borde, #d9dce3);
    border-radius: max(var(--redondeado-bordes, 10px), 10px);
    background: var(--color-fondo, #f8fafc);
    color: var(--color-texto, #333);
    font-weight: 700;
}

.horarios-quick-action--danger {
    grid-column: 1 / -1;
    border-color: color-mix(in srgb, var(--color-boton-cancelar, #dc3545) 75%, #000);
    background: var(--color-boton-cancelar, #dc3545);
    color: #fff;
}

.hes-quick-sheet-open {
    overflow: hidden;
}

@keyframes horarios-sheet-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (max-width: 767.98px) {
    .horarios-bottom-sheet-modal .modal-dialog,
    body.hes-pwa .horarios-bottom-sheet-modal .modal-dialog {
        display: flex;
        width: 100%;
        max-width: none;
        min-height: 100%;
        margin: 0;
        align-items: flex-end;
        transform: translate(0, 100%);
    }

    .horarios-bottom-sheet-modal.show .modal-dialog,
    body.hes-pwa .horarios-bottom-sheet-modal.show .modal-dialog {
        transform: none;
    }

    .horarios-bottom-sheet-modal .modal-content {
        position: relative;
        width: 100%;
        max-height: calc(88dvh - env(safe-area-inset-top, 0));
        padding-top: .65rem;
        padding-bottom: env(safe-area-inset-bottom, 0);
        overflow: hidden;
        border: 0;
        border-radius: 1.2rem 1.2rem 0 0;
        box-shadow: 0 -12px 35px rgba(15, 23, 42, .2);
    }

    .horarios-bottom-sheet-modal .modal-content::before {
        content: '';
        display: block;
        flex: 0 0 auto;
        width: 2.75rem;
        height: .28rem;
        margin: 0 auto .15rem;
        border-radius: 999px;
        background: var(--color-borde, #cbd5e1);
    }

    .horarios-bottom-sheet-modal .modal-header,
    .horarios-bottom-sheet-modal .modal-footer {
        flex: 0 0 auto;
    }

    .horarios-bottom-sheet-modal .modal-body {
        overflow-y: auto;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    .horarios-bottom-sheet-modal .modal-footer {
        padding-bottom: max(.75rem, env(safe-area-inset-bottom, 0));
        background: var(--color-fondo-card, #fff);
    }

    .horarios-bottom-sheet-modal .modal-footer .btn {
        min-height: 46px;
    }
}

.horarios-day-session-card {
    gap: .45rem !important;
    padding: .65rem .75rem !important;
    font-size: .8rem !important;
}

.horarios-day-session-card .horarios-week-event__title {
    font-size: 1rem;
}

.horarios-day-session-card .horarios-week-event__details {
    align-items: start;
    gap: .75rem;
    white-space: normal;
}

.horarios-day-session-card .horarios-week-event__time,
.horarios-day-session-card .horarios-week-event__occupancy,
.horarios-day-session-card .horarios-week-event__monitor {
    display: grid;
    gap: .05rem;
    margin: 0;
    text-align: left;
}

.horarios-day-session-card small,
.horarios-day-session-card__meta > span {
    color: inherit;
    font-size: .65rem;
    font-weight: 600;
    opacity: .78;
}

.horarios-day-session-card__meta {
    display: grid;
    gap: .05rem;
}

.horarios-day-session-card .horarios-schedule-comment {
    margin: .1rem 0 0;
}

body.hes-horarios-day-view .horarios-day-agenda {
    touch-action: pan-y;
}

body.hes-horarios-day-view .horarios-day-session-card {
    transition: transform .16s ease, filter .16s ease;
    -webkit-touch-callout: none;
    user-select: none;
}

body.hes-horarios-day-view .horarios-day-session-card.is-long-pressing {
    filter: brightness(.92);
    transform: scale(.975);
}

.horarios-day-agenda.is-swiping-next {
    animation: horarios-day-from-right .2s ease-out;
}

.horarios-day-agenda.is-swiping-prev {
    animation: horarios-day-from-left .2s ease-out;
}

@keyframes horarios-day-from-right {
    from { opacity: .55; transform: translateX(1.25rem); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes horarios-day-from-left {
    from { opacity: .55; transform: translateX(-1.25rem); }
    to { opacity: 1; transform: translateX(0); }
}

.horarios-current-time {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: .65rem;
    align-items: center;
    min-width: 0;
    margin: -.2rem 0;
    color: #dc3545;
}

.horarios-current-time time {
    padding: .2rem .1rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.horarios-current-time span {
    position: relative;
    display: block;
    height: 2px;
    background: #dc3545;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .75);
}

.horarios-current-time span::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -.25rem;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: #dc3545;
    transform: translateY(-50%);
}

.horarios-schedule-loading {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0 !important;
    width: 100%;
    gap: .65rem;
    padding: .75rem;
}

.horarios-skeleton-row {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: .65rem;
    align-items: center;
}

.horarios-skeleton-row > span,
.horarios-skeleton-row i {
    display: block;
    border-radius: .45rem;
    background: linear-gradient(90deg, rgba(148, 163, 184, .18) 20%, rgba(148, 163, 184, .38) 50%, rgba(148, 163, 184, .18) 80%);
    background-size: 220% 100%;
    animation: horarios-skeleton-pulse 1.15s ease-in-out infinite;
}

.horarios-skeleton-row > span {
    height: 1.5rem;
}

.horarios-skeleton-row > div {
    display: grid;
    gap: .4rem;
    min-height: 4.25rem;
    padding: .65rem;
    border: 1px solid color-mix(in srgb, var(--color-borde, #d9dce3) 60%, transparent);
    border-radius: .65rem;
}

.horarios-skeleton-row i:first-child { width: 65%; height: .8rem; }
.horarios-skeleton-row i:last-child { width: 42%; height: .65rem; }

.horarios-range-error {
    display: grid;
    gap: .5rem;
    justify-items: center;
    padding: 2rem 1rem;
    text-align: center;
}

@keyframes horarios-skeleton-pulse {
    from { background-position: 100% 0; }
    to { background-position: -120% 0; }
}

.horarios-session-badges {
    display: flex;
    min-width: 0;
    gap: var(--hes-pwa-compact-gap, 4px);
    flex-wrap: wrap;
}

.horarios-session-badge {
    display: inline-flex;
    width: fit-content;
    min-height: 1.15rem;
    padding: var(--hes-pwa-compact-padding-y, 2px) var(--hes-pwa-compact-padding-x, 6px);
    align-items: center;
    gap: var(--hes-pwa-compact-gap, 4px);
    border: 1px solid currentColor;
    border-radius: 999px;
    background: rgba(255, 255, 255, .88);
    color: #172033;
    font-size: var(--hes-pwa-font-aux, 12px);
    font-weight: 800;
    line-height: 1;
}

.horarios-session-badge > span:last-child {
    display: none;
}

.horarios-day-session-card .horarios-session-badge > span:last-child,
.horarios-week-event--expanded .horarios-session-badge > span:last-child {
    display: inline;
}

.horarios-session-badge--available {
    color: #137044;
}

.horarios-session-badge--full {
    color: #9a5a05;
}

.horarios-session-badge--cancelled {
    color: #b4232f;
}

.horarios-session-badge--pending {
    color: #5b46a8;
}

.horarios-session-badge--recurring {
    color: #075d91;
}

.horarios-session-state--available {
    border-left: 4px solid #20a464;
}

.horarios-session-state--full {
    border-left: 4px solid #f0a12b;
}

.horarios-session-state--cancelled {
    border-left: 4px solid #dc3545;
    filter: saturate(.55);
    opacity: .78;
}

.horarios-session-state--cancelled .horarios-week-event__title {
    text-decoration: line-through;
}

.horarios-session-state--pending {
    border-left: 4px solid #7c63d5;
    border-style: dashed;
}

.horarios-month-session__state {
    font-weight: 900;
}

.horarios-month-session--available .horarios-month-session__state { color: #137044; }
.horarios-month-session--full .horarios-month-session__state { color: #9a5a05; }
.horarios-month-session--cancelled .horarios-month-session__state { color: #b4232f; }
.horarios-month-session--pending .horarios-month-session__state { color: #5b46a8; }
.horarios-month-session__recurring { color: #075d91; font-weight: 900; }

.horarios-month-grid.horarios-week-grid {
    display: block;
    min-width: 44rem;
}

.horarios-month-weekdays,
.horarios-month-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.horarios-month-weekdays > div {
    padding: .55rem .35rem;
    border-right: 1px solid var(--color-borde, #d9dce3);
    background: color-mix(in srgb, var(--color-fondo-card, #fff) 80%, var(--color-borde, #d9dce3));
    font-size: .78rem;
    font-weight: 800;
    text-align: center;
}

.horarios-month-day {
    display: flex;
    min-width: 0;
    min-height: 7rem;
    padding: .4rem;
    flex-direction: column;
    gap: .3rem;
    border: 0;
    border-top: 1px solid var(--color-borde, #d9dce3);
    border-right: 1px solid var(--color-borde, #d9dce3);
    background: var(--color-fondo-card, #fff);
    color: var(--color-texto, #333);
    text-align: left;
}

.horarios-month-day.is-outside {
    opacity: .48;
}

.horarios-month-day.is-today {
    box-shadow: inset 0 0 0 2px var(--color-boton, #121078);
}

.horarios-month-day__number {
    align-self: flex-end;
    font-size: .75rem;
    font-weight: 800;
}

.horarios-month-day__sessions {
    display: grid;
    gap: .2rem;
    min-width: 0;
}

.horarios-month-session {
    display: block;
    min-width: 0;
    padding: var(--hes-pwa-compact-padding-y, 2px) var(--hes-pwa-compact-padding-x, 6px);
    overflow: hidden;
    border-left: 3px solid var(--horarios-session-color);
    border-radius: .2rem;
    background: color-mix(in srgb, var(--horarios-session-color) 12%, transparent);
    font-size: .66rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.horarios-month-more {
    font-size: .68rem;
    font-weight: 700;
}

@media (display-mode: standalone) and (max-width: 767.98px) {
    :root {
        --hes-pwa-page-gutter: 12px;
        --hes-pwa-space: var(--hes-pwa-page-gutter);
        --hes-pwa-space-xs: 4px;
        --hes-pwa-space-sm: 8px;
        --hes-pwa-space-md: 12px;
        --hes-pwa-space-lg: 16px;
        --hes-pwa-control-height: 48px;
        --hes-pwa-touch-min: 44px;
        --hes-pwa-radius-sm: 8px;
        --hes-pwa-radius-md: 12px;
        --hes-pwa-font-base: 16px;
        --hes-pwa-font-title-xl: 20px;
        --hes-pwa-font-title-lg: 19px;
        --hes-pwa-font-title-md: 18px;
        --hes-pwa-font-card: 15px;
        --hes-pwa-font-control: 15px;
        --hes-pwa-font-detail: 14px;
        --hes-pwa-font-aux: 12px;
        --hes-pwa-compact-gap: 4px;
        --hes-pwa-compact-padding-y: 2px;
        --hes-pwa-compact-padding-x: 6px;
        --hes-pwa-ui-version: 12;
    }

    html {
        min-height: 100%;
        font-size: var(--hes-pwa-font-base);
        background: var(--color-fondo, #f6f7fb);
        overscroll-behavior-y: none;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    body.hes-pwa {
        min-height: 100dvh;
        margin: 0;
        font-size: var(--hes-pwa-font-base);
        line-height: 1.5;
        padding-top: 0;
        padding-right: env(safe-area-inset-right, 0);
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
        padding-left: env(safe-area-inset-left, 0);
        background: var(--color-fondo, #f6f7fb);
        -webkit-tap-highlight-color: transparent;
    }

    body.hes-pwa .container,
    body.hes-pwa .container-sm,
    body.hes-pwa .container-md,
    body.hes-pwa .container-lg,
    body.hes-pwa .container-xl,
    body.hes-pwa .container-xxl,
    body.hes-pwa .container-fluid {
        --bs-gutter-x: 24px;
    }

    body.hes-pwa .container,
    body.hes-pwa .container-sm,
    body.hes-pwa .container-md,
    body.hes-pwa .container-lg,
    body.hes-pwa .container-xl,
    body.hes-pwa .container-xxl {
        width: 100%;
        max-width: 100%;
    }

    body.hes-pwa nav.hes-menu-navegacion {
        position: sticky;
        top: 0;
        z-index: 1020;
        box-sizing: border-box;
        height: calc(60px + env(safe-area-inset-top, 0));
        min-height: calc(60px + env(safe-area-inset-top, 0));
        padding: calc(.25rem + env(safe-area-inset-top, 0)) .5rem .25rem;
        border-bottom: 1px solid var(--color-borde, #d9dce3);
        box-shadow: 0 3px 12px rgba(0, 0, 0, .08);
    }

    body.hes-pwa nav.hes-menu-navegacion > .container-fluid {
        position: relative;
        min-height: 51px;
    }

    body.hes-pwa .hes-pwa-section-title {
        position: absolute;
        top: 50%;
        left: 50%;
        display: block;
        width: calc(100% - 9rem);
        overflow: hidden;
        color: var(--color-texto-titulo, var(--color-texto, #222));
        font-size: 1rem;
        font-weight: 700;
        line-height: 1.2;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
        pointer-events: none;
        transform: translate(-50%, -50%);
    }

    body.hes-pwa .hes-pwa-nav-duplicate {
        display: none !important;
    }

    body.hes-pwa nav.hes-menu-navegacion img[alt="Logo"] {
        width: 48px;
        height: 48px;
        object-fit: contain;
    }

    body.hes-pwa nav.hes-menu-navegacion .navbar-toggler {
        padding: .35rem .5rem;
        border-color: var(--color-borde, #d9dce3);
    }

    body.hes-pwa .hes-login-card {
        width: calc(100% - (var(--hes-pwa-space) * 2));
        max-width: 32rem;
        margin: 1.25rem auto 0 !important;
        padding: 1.5rem var(--hes-pwa-space) !important;
        border: 1px solid var(--color-borde, #d9dce3);
        border-radius: max(var(--redondeado-bordes, 12px), 12px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
    }

    body.hes-pwa .hes-login-card h2 {
        margin-bottom: 1.5rem !important;
        font-size: clamp(1.5rem, 7vw, 2rem);
    }

    body.hes-pwa .hes-login-card .form-control,
    body.hes-pwa .hes-login-card .btn {
        min-height: var(--hes-pwa-control-height);
    }

    body.hes-pwa .hes-login-card input {
        font-size: 16px;
    }

    body.hes-pwa .hes-login-card button[type="submit"] {
        width: 100%;
        margin-top: .5rem;
    }

    body.hes-pwa .hes-pwa-primary-action {
        display: inline-flex;
        width: 100%;
        min-height: var(--hes-pwa-control-height);
        padding: var(--hes-pwa-space-md) var(--hes-pwa-space-lg);
        align-items: center;
        justify-content: center;
        border-radius: max(var(--redondeado-bordes, 10px), 10px);
        font-size: 1rem;
        font-weight: 700;
        line-height: 1.2;
        white-space: normal;
        touch-action: manipulation;
        transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
    }

    body.hes-pwa .hes-pwa-primary-action:active:not(:disabled):not(.disabled) {
        transform: scale(.98);
        filter: brightness(.94);
    }

    body.hes-pwa .hes-pwa-primary-action:focus-visible {
        outline: 3px solid color-mix(in srgb, var(--color-boton, #121078) 35%, transparent);
        outline-offset: 2px;
    }

    body.hes-pwa .hes-pwa-primary-action:disabled,
    body.hes-pwa .hes-pwa-primary-action.disabled {
        cursor: not-allowed;
        opacity: .65;
    }

    body.hes-pwa .hes-pwa-primary-action-group {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: .65rem !important;
        width: 100%;
    }

    body.hes-pwa .hes-pwa-collapsible {
        margin-bottom: 1rem;
        border: 1px solid var(--color-borde, #d9dce3);
        border-radius: max(var(--redondeado-bordes, var(--hes-pwa-radius-md)), var(--hes-pwa-radius-md));
        background: var(--color-fondo-card, #fff);
        box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
        overflow: hidden;
    }

    body.hes-pwa .hes-pwa-collapsible__summary {
        display: flex;
        min-height: var(--hes-pwa-control-height);
        padding: var(--hes-pwa-space-md) var(--hes-pwa-space-lg);
        align-items: center;
        gap: .6rem;
        color: var(--color-texto-titulo, var(--color-texto, #222));
        font-weight: 700;
        cursor: pointer;
        list-style: none;
        user-select: none;
        touch-action: manipulation;
    }

    body.hes-pwa .hes-pwa-collapsible__summary::-webkit-details-marker {
        display: none;
    }

    body.hes-pwa .hes-pwa-collapsible__summary::after {
        content: '';
        width: .6rem;
        height: .6rem;
        margin-left: auto;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg) translateY(-2px);
        transition: transform .18s ease;
    }

    body.hes-pwa .hes-pwa-collapsible[open] > .hes-pwa-collapsible__summary::after {
        transform: rotate(225deg) translate(-2px, -2px);
    }

    body.hes-pwa .hes-pwa-collapsible[open] > .hes-pwa-collapsible__summary {
        border-bottom: 1px solid var(--color-borde, #d9dce3);
    }

    body.hes-pwa .hes-pwa-collapsible__status {
        padding: .2rem .45rem;
        border-radius: 999px;
        background: var(--color-boton, #121078);
        color: #fff;
        font-size: .65rem;
        font-weight: 700;
        line-height: 1.1;
    }

    body.hes-pwa .hes-pwa-collapsible__content {
        margin: 0 !important;
        padding: 1rem !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    body.hes-pwa .hes-pwa-collapsible__content > .card-body {
        padding: 0;
    }

    body.hes-pwa .hes-pwa-progress {
        position: fixed;
        top: env(safe-area-inset-top, 0);
        right: 0;
        left: 0;
        z-index: 2100;
        height: 3px;
        overflow: hidden;
        background: transparent;
        pointer-events: none;
    }

    body.hes-pwa .hes-pwa-progress__bar {
        width: 35%;
        height: 100%;
        border-radius: 0 999px 999px 0;
        background: var(--color-boton, #121078);
        box-shadow: 0 0 8px color-mix(in srgb, var(--color-boton, #121078) 55%, transparent);
        transform: translateX(-110%);
    }

    body.hes-pwa .hes-pwa-progress.is-active .hes-pwa-progress__bar {
        animation: hes-pwa-progress 1.05s ease-in-out infinite;
    }

    @keyframes hes-pwa-progress {
        0% { transform: translateX(-110%); }
        55% { transform: translateX(150%); }
        100% { transform: translateX(310%); }
    }

    body.hes-pwa .hes-pwa-action-loading {
        position: relative;
        cursor: progress !important;
        opacity: .78;
        pointer-events: none;
    }

    body.hes-pwa .hes-pwa-action-loading::after {
        content: '';
        width: 1rem;
        height: 1rem;
        margin-left: .55rem;
        flex: 0 0 auto;
        border: 2px solid currentColor;
        border-right-color: transparent;
        border-radius: 50%;
        animation: hes-pwa-spin .7s linear infinite;
    }

    @keyframes hes-pwa-spin {
        to { transform: rotate(360deg); }
    }

    body.hes-pwa .hes-pwa-toast-region {
        position: fixed;
        top: calc(68px + env(safe-area-inset-top, 0));
        right: .75rem;
        left: .75rem;
        z-index: 2050;
        display: grid;
        gap: .5rem;
        pointer-events: none;
    }

    body.hes-pwa .hes-pwa-toast {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: .65rem;
        align-items: start;
        max-width: 32rem;
        margin-left: auto;
        padding: .8rem .9rem;
        border: 1px solid var(--color-borde, #d9dce3);
        border-left: 4px solid currentColor;
        border-radius: max(var(--redondeado-bordes, 10px), 10px);
        background: var(--color-fondo-card, #fff);
        color: var(--color-texto, #222);
        box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
        font-size: .88rem;
        line-height: 1.35;
        opacity: 0;
        transform: translateY(-.6rem);
        animation: hes-pwa-toast-in .2s ease forwards;
        pointer-events: auto;
    }

    body.hes-pwa .hes-pwa-toast::before {
        content: '✓';
        display: grid;
        width: 1.35rem;
        height: 1.35rem;
        place-items: center;
        border-radius: 50%;
        background: #198754;
        color: #fff;
        font-size: .75rem;
        font-weight: 800;
    }

    body.hes-pwa .hes-pwa-toast.is-success {
        color: #146c43;
    }

    body.hes-pwa .hes-pwa-toast.is-error {
        color: #b02a37;
    }

    body.hes-pwa .hes-pwa-toast.is-error::before {
        content: '!';
        background: #dc3545;
    }

    body.hes-pwa .hes-pwa-toast.is-leaving {
        animation: hes-pwa-toast-out .18s ease forwards;
    }

    @keyframes hes-pwa-toast-in {
        to { opacity: 1; transform: translateY(0); }
    }

    @keyframes hes-pwa-toast-out {
        to { opacity: 0; transform: translateY(-.5rem); }
    }

    @media (prefers-reduced-motion: reduce) {
        body.hes-pwa .hes-pwa-progress__bar,
        body.hes-pwa .hes-pwa-action-loading::after,
        body.hes-pwa .hes-pwa-toast {
            animation-duration: .01ms;
            animation-iteration-count: 1;
        }
    }

    body.hes-pwa footer.hes-menu-navegacion {
        display: none;
    }

    body.hes-pwa .hes-pwa-bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1025;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        align-items: stretch;
        min-height: calc(64px + env(safe-area-inset-bottom, 0));
        padding: .35rem max(.35rem, env(safe-area-inset-right, 0)) env(safe-area-inset-bottom, 0) max(.35rem, env(safe-area-inset-left, 0));
        border-top: 1px solid var(--color-borde, #d9dce3);
        background: var(--color-pie-cabecera, #fff);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, .1);
    }

    body.hes-pwa .hes-pwa-bottom-nav__item {
        display: flex;
        min-width: 0;
        min-height: 56px;
        padding: .3rem .15rem;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: .15rem;
        border-radius: max(var(--redondeado-bordes, 8px), 8px);
        color: var(--color-texto, #333);
        font-size: .7rem;
        font-weight: 600;
        line-height: 1.1;
        text-align: center;
        text-decoration: none;
    }

    body.hes-pwa .hes-pwa-bottom-nav__item svg {
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    body.hes-pwa .hes-pwa-bottom-nav__item.is-active {
        color: var(--color-boton, #121078);
        background: color-mix(in srgb, var(--color-boton, #121078) 12%, transparent);
    }

    body.hes-pwa .hes-pwa-bottom-nav__item:active {
        transform: scale(.96);
    }

    body.hes-pwa .hes-pwa-table-hint {
        display: none;
        margin: .25rem 0 .4rem;
        color: var(--color-texto, #555);
        font-size: .75rem;
        text-align: right;
    }

    body.hes-pwa .hes-pwa-table-hint.is-visible {
        display: block;
    }

    body.hes-pwa .hes-pwa-table-scroll {
        position: relative;
        max-width: 100%;
        border: 1px solid var(--color-borde, #d9dce3);
        border-radius: max(var(--redondeado-bordes, 10px), 10px);
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }

    body.hes-pwa .hes-pwa-table-scroll.has-overflow:not(.is-at-end) {
        box-shadow: inset -18px 0 14px -18px rgba(0, 0, 0, .6);
    }

    body.hes-pwa .hes-pwa-table-scroll.has-overflow:not(.is-at-start) {
        box-shadow: inset 18px 0 14px -18px rgba(0, 0, 0, .6);
    }

    body.hes-pwa .hes-pwa-table-scroll.has-overflow:not(.is-at-start):not(.is-at-end) {
        box-shadow: inset 18px 0 14px -18px rgba(0, 0, 0, .6), inset -18px 0 14px -18px rgba(0, 0, 0, .6);
    }

    body.hes-pwa .hes-pwa-card-table {
        overflow: visible;
        border: 0;
        border-radius: 0;
        box-shadow: none !important;
    }

    body.hes-pwa .hes-pwa-card-table table,
    body.hes-pwa .hes-pwa-card-table tbody {
        display: block;
        width: 100%;
    }

    body.hes-pwa .hes-pwa-card-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    body.hes-pwa .hes-pwa-card-table tbody {
        display: grid;
        gap: .85rem;
    }

    body.hes-pwa .hes-pwa-card-table tbody tr {
        display: block;
        padding: .35rem .85rem;
        border: 1px solid var(--color-borde, #d9dce3);
        border-radius: max(var(--redondeado-bordes, 12px), 12px);
        background: var(--color-fondo-card, #fff);
        box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
    }

    body.hes-pwa .hes-pwa-card-table tbody td {
        display: grid;
        grid-template-columns: minmax(6.75rem, 38%) minmax(0, 1fr);
        gap: .75rem;
        align-items: start;
        padding: .65rem 0;
        border: 0;
        border-bottom: 1px solid color-mix(in srgb, var(--color-borde, #d9dce3) 60%, transparent);
        overflow-wrap: anywhere;
    }

    body.hes-pwa .hes-pwa-card-table tbody td:last-child {
        border-bottom: 0;
    }

    body.hes-pwa .hes-pwa-card-table tbody td::before {
        content: attr(data-pwa-label);
        color: var(--color-texto-titulo, var(--color-texto, #333));
        font-size: .78rem;
        font-weight: 700;
    }

    body.hes-pwa .hes-pwa-card-table tbody td[colspan] {
        display: block;
        padding: 1rem 0;
        text-align: center;
    }

    body.hes-pwa .hes-pwa-card-table tbody td[colspan]::before {
        content: none;
    }

    body.hes-pwa .hes-pwa-card-table tbody td form {
        min-width: 0;
        flex-wrap: wrap;
    }

    body.hes-pwa .modal-dialog {
        min-height: 100%;
        margin: 0;
        align-items: flex-end;
    }

    body.hes-pwa .modal-content {
        max-height: calc(100dvh - env(safe-area-inset-top, 0));
        border: 0;
        border-radius: 1rem 1rem 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* Horarios: la agenda diaria es la vista principal de la app instalada. */
    body.hes-pwa .horarios-scheduler-shell > .horarios-calendar-column {
        order: -1;
    }

    body.hes-pwa .horarios-week-card .card-body {
        padding: .8rem;
    }

    body.hes-pwa .horarios-week-nav {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: .5rem;
        align-items: center;
    }

    body.hes-pwa .horarios-week-title {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        font-size: 1rem !important;
        line-height: 1.2;
    }

    body.hes-pwa #horariosWeekPrev {
        grid-column: 1;
        grid-row: 1;
    }

    body.hes-pwa #horariosWeekNext {
        grid-column: 3;
        grid-row: 1;
    }

    body.hes-pwa .horarios-today-button {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
        min-height: 38px;
        padding-inline: 1.25rem;
    }

    body.hes-pwa .horarios-week-grid-wrap {
        overflow: visible;
    }

    body.hes-pwa .horarios-day-agenda {
        display: grid;
        min-width: 0;
        width: 100%;
        gap: .75rem;
    }

    body.hes-pwa .horarios-day-item {
        position: relative;
        display: grid;
        grid-template-columns: 3.25rem minmax(0, 1fr);
        gap: .65rem;
        min-width: 0;
    }

    body.hes-pwa .horarios-day-item:not(:last-child)::after {
        content: '';
        position: absolute;
        top: 1.7rem;
        bottom: -.85rem;
        left: 1.55rem;
        width: 2px;
        background: color-mix(in srgb, var(--color-borde, #d9dce3) 70%, transparent);
    }

    body.hes-pwa .horarios-day-item__time {
        position: relative;
        z-index: 1;
        align-self: start;
        padding: .32rem .15rem;
        border-radius: .5rem;
        background: var(--color-fondo, #f6f7fb);
        color: var(--color-texto-titulo, var(--color-texto, #333));
        font-size: .78rem;
        font-weight: 800;
        text-align: center;
    }

    body.hes-pwa .horarios-day-item__content {
        min-width: 0;
    }

    body.hes-pwa .horarios-day-agenda .horarios-week-event {
        position: relative;
        inset: auto;
        z-index: 2;
        width: 100%;
        min-height: 5rem;
        height: auto;
        margin: 0;
        overflow: visible;
        transform: none;
        cursor: pointer;
    }

    body.hes-pwa .horarios-day-agenda .horarios-week-event--expanded,
    body.hes-pwa .horarios-day-agenda .horarios-week-event--expanded-left {
        right: auto;
        left: auto;
        width: 100%;
        max-width: 100%;
    }

    body.hes-pwa .horarios-day-item__room {
        margin: .3rem .15rem 0;
        color: var(--color-texto, #555);
        font-size: .75rem;
        font-weight: 600;
    }

    body.hes-pwa .horarios-day-item__room::before {
        content: 'Sala: ';
        font-weight: 400;
    }

    body.hes-pwa .horarios-day-empty {
        display: grid;
        gap: .3rem;
        padding: 2.5rem 1rem;
        border: 1px dashed var(--color-borde, #d9dce3);
        border-radius: max(var(--redondeado-bordes, 12px), 12px);
        color: var(--color-texto, #555);
        text-align: center;
    }
}

/* Escala tipografica tactil de la PWA. */
@media (display-mode: standalone) and (max-width: 767.98px) {
    body.hes-pwa h1,
    body.hes-pwa .h1 {
        font-size: var(--hes-pwa-font-title-xl);
        line-height: 1.25;
    }

    body.hes-pwa h2,
    body.hes-pwa .h2,
    body.hes-pwa .modal-title {
        font-size: var(--hes-pwa-font-title-lg);
        line-height: 1.3;
    }

    body.hes-pwa h3,
    body.hes-pwa h4,
    body.hes-pwa h5,
    body.hes-pwa h6,
    body.hes-pwa .h3,
    body.hes-pwa .h4,
    body.hes-pwa .h5,
    body.hes-pwa .h6,
    body.hes-pwa .card-title {
        font-size: var(--hes-pwa-font-title-md);
        line-height: 1.3;
    }

    body.hes-pwa .card-body,
    body.hes-pwa .modal-body,
    body.hes-pwa .horarios-day-session-card {
        font-size: var(--hes-pwa-font-card) !important;
    }

    body.hes-pwa .btn,
    body.hes-pwa button:not(.btn-close):not(.horarios-week-event__action):not(.horarios-schedule-comment__edit) {
        font-size: var(--hes-pwa-font-control);
    }

    body.hes-pwa .form-control,
    body.hes-pwa .form-select {
        font-size: var(--hes-pwa-font-base);
    }

    body.hes-pwa small,
    body.hes-pwa .small,
    body.hes-pwa .form-label,
    body.hes-pwa .horarios-session-badge,
    body.hes-pwa .horarios-date-strip__weekday,
    body.hes-pwa .horarios-date-strip__month,
    body.hes-pwa .horarios-month-session,
    body.hes-pwa .horarios-month-more,
    body.hes-pwa .horarios-day-item__room,
    body.hes-pwa .horarios-week-event__monitor {
        font-size: var(--hes-pwa-font-aux);
    }

    body.hes-pwa .horarios-day-session-card .horarios-week-event__title {
        font-size: var(--hes-pwa-font-title-md);
        line-height: 1.25;
    }

    body.hes-pwa .horarios-day-session-card .horarios-schedule-comment__text,
    body.hes-pwa .horarios-day-session-card .horarios-week-event__time,
    body.hes-pwa .horarios-day-session-card .horarios-week-event__occupancy {
        font-size: var(--hes-pwa-font-detail);
    }

    body.hes-pwa .horarios-week-title,
    body.hes-pwa .hes-pwa-section-title {
        font-size: var(--hes-pwa-font-title-md) !important;
        line-height: 1.25;
    }

    body.hes-pwa .hes-pwa-bottom-nav__item,
    body.hes-pwa .horarios-filter-count,
    body.hes-pwa .horarios-day-item__time,
    body.hes-pwa .horarios-current-time time {
        font-size: var(--hes-pwa-font-aux) !important;
    }
}
