/* Preserve the established desktop layout at 1133px and above. */
.nav-toggle {
    display: none;
}

@media (max-width: 1132px) {
    .shell {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
    }

    html, body, #app {
        height: 100%;
        overflow: hidden;
    }

    .topbar {
        position: relative;
        z-index: 1100;
        height: auto;
        min-height: 58px;
        flex-wrap: nowrap;
        padding: 8px 12px;
        gap: 12px;
    }

    .brand {
        min-width: 0;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        gap: 7px;
        min-height: 36px;
        padding: 0 11px;
        border: 1px solid #ffffff80;
        border-radius: 7px;
        background: transparent;
        color: #fff;
        font-size: 13px;
        font-weight: 650;
    }

    .nav-toggle[aria-expanded="true"] {
        background: #ffffff20;
    }

    .topbar .nav {
        position: absolute;
        top: 100%;
        left: 12px;
        display: none;
        width: min(320px, calc(100vw - 24px));
        height: auto;
        max-height: 65vh;
        overflow: auto;
        flex-direction: column;
        gap: 0;
        padding: 6px;
        border: 1px solid #ffffff60;
        border-radius: 0 0 8px 8px;
        background: var(--main-accent-color);
        box-shadow: 0 8px 20px #09284140;
    }

    .topbar.navigation-open .nav {
        display: flex;
    }

    .topbar .nav button {
        min-height: 44px;
        padding: 10px 12px;
        border-bottom: 3px solid transparent;
        text-align: left;
        white-space: normal;
    }

    .topbar .nav button.active {
        border-bottom-color: var(--secondary-accent-color);
    }

    .nav-status {
        min-width: 0;
        gap: 8px;
    }

    .nav-status .status-pill, .app-menu .dropdown-toggle {
        min-height: 36px;
        height: 36px;
    }

    .shell > .page, .shell > .page:not(.kiosk), .shell > .kiosk {
        flex: 1 1 auto;
        min-width: 0;
        min-height: 0;
        overflow: auto;
    }

    .page:not(.gps-page) {
        padding: 14px;
    }

    .kiosk {
        grid-template-columns: minmax(300px, 30%) minmax(0, 1fr);
        gap: 12px;
    }

    .kiosk > * {
        min-width: 0;
    }

    .groups-prominent {
        grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
        gap: 12px;
    }

    .group {
        padding: 14px;
    }

    .group-name {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .group-actions {
        flex: 0 0 auto;
    }

    .card-head {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px 14px 10px;
    }

    .card-body {
        padding: 0 14px 14px;
    }

    .activity-panel .activity-scroll, .radio-panel .radio-scroll {
        flex: 1 1 auto;
        overflow: auto;
    }

    .activity-event-preferences {
        gap: 10px;
    }

    .activity-standard-filters:not(.is-collapsed) {
        max-height: none;
        overflow: visible;
    }

    .toolbar > .filter {
        min-width: 0;
        max-width: 100%;
    }

    .page:not(.kiosk) #results {
        flex: 1 0 240px;
    }

    .statusbar {
        height: auto;
        min-height: 34px;
        flex-wrap: wrap;
        gap: 6px 12px;
        padding: 5px 10px;
    }

    .statusbar-left, .statusbar-metrics, .statusbar-right {
        gap: 8px;
    }

    .statusbar-left {
        flex-wrap: wrap;
        overflow: visible;
    }

    .statusbar-right {
        min-width: 0;
        max-width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .status-user {
        display: inline-block;
        max-width: 16ch;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
        white-space: nowrap;
    }

    .help-panel {
        top: 58px;
        bottom: 0;
    }

    /* Help overlays the narrower workspace, even when its pin preference is saved. */
    .shell.help-pinned .page {
        width: 100%;
        margin: 0;
    }

    .licence-banner {
        padding: 8px 12px;
    }

    .licence-banner button {
        flex: 0 0 32px;
        height: 32px;
    }
}

@media (max-width: 850px) {
    .brand-copy {
        display: none;
    }

    .kiosk {
        display: flex;
        flex-direction: column;
    }

    .kiosk > * {
        flex: 0 0 auto;
        margin-bottom: 0;
    }

    .kiosk .radio-panel {
        max-height: 360px;
    }

    .kiosk .talk-panel {
        overflow: visible;
    }

    .kiosk .activity-panel {
        min-height: 300px;
        max-height: 450px;
    }
}

@media (max-width: 540px) {
    .topbar {
        flex-wrap: wrap;
    }

    .nav-status {
        flex-wrap: wrap;
        margin-left: 0;
    }

    .radio-widget-controls {
        flex-wrap: wrap;
    }
}
