/* Extracted from the legacy post-workspace cascade. Keep route-tail ordering stable. */
@media (max-width: 980px) {
    body.user-body-workspace:has(.workspace-calendar-shell) {
        overflow: auto;
    }

    body.user-body-workspace:has(.workspace-calendar-shell) .user-shell {
        height: auto;
        min-height: 100vh;
    }

    .workspace-calendar-layout {

        grid-template-rows: auto auto;
        height: auto;
        max-height: none;
    }

    .workspace-calendar-main {
        height: min(74vh, 760px);
    }

    .workspace-calendar-scroll {
        max-height: none;
    }

    .workspace-calendar-event-block[data-calendar-overlap-density="dense"] {
        width: calc(100% - (var(--event-overlap-stack-offset, 0) * 10px) - 4px);
        margin-left: calc(var(--event-overlap-stack-offset, 0) * 10px);
        transform: translateY(calc(var(--event-overlap-stack-offset, 0) * 3px));
        z-index: calc(8 + var(--event-overlap-stack-order, 0));
    }

    .workspace-calendar-event-block[data-calendar-overlap-density="dense"] .workspace-calendar-event-actions {
        flex-wrap: wrap;
    }

    .workspace-calendar-form-panel {
        max-height: 70vh;
    }

    .workspace-calendar-upcoming .workspace-calendar-panel {
        max-height: none;
    }}

/* The desktop sidebar remains sibling-oriented. On mobile, expose the current
   folder's actual children as a compact horizontal navigator below the surface bar. */
.workspace-mobile-subfolder-nav {
    display: none;
}

@media (max-width: 760px) {
    body.user-body-workspace:has(.workspace-mobile-subfolder-nav):not(:has(.workspace-calendar-shell)) .workspace-layout {
        --znode-mobile-surface-header-height: calc(188px + env(safe-area-inset-top)) !important;
    }

    body.user-body-workspace:not(:has(.workspace-calendar-shell)) .workspace-mobile-subfolder-nav {
        width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        padding-top: 2px;
    }

    .workspace-mobile-subfolder-label {
        display: grid;
        gap: 1px;
        color: var(--zn-member-text-muted);
        font-size: 0.66rem;
        font-weight: 750;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .workspace-mobile-subfolder-hint {
        color: var(--zn-member-text-link);
        font-size: 0.56rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        line-height: 1;
        text-transform: none;
    }

    .workspace-mobile-subfolder-hint::after {
        content: " \2194";
    }

    .workspace-mobile-subfolder-scroll {
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 7px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 1px 6px;
        overscroll-behavior-x: contain;
        scroll-padding-inline: 1px 12px;
        scroll-snap-type: x proximity;
        scrollbar-color: var(--zn-member-accent-border-muted) transparent;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .workspace-mobile-subfolder-scroll::-webkit-scrollbar {
        height: 3px;
    }

    .workspace-mobile-subfolder-scroll::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: var(--zn-member-accent-border-muted);
    }

    .workspace-mobile-subfolder-link {
        min-width: 0;
        max-width: min(62vw, 260px);
        min-height: 38px;
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 7px 10px;
        border: 1px solid var(--zn-member-border);
        border-radius: 10px;
        background: color-mix(in srgb, var(--zn-member-bg-surface) 74%, transparent);
        color: var(--zn-member-text-primary);
        text-decoration: none;
        scroll-snap-align: start;
    }

    .workspace-mobile-subfolder-link:active,
    .workspace-mobile-subfolder-link:focus-visible {
        border-color: var(--zn-member-accent-border);
        background: var(--zn-member-accent-surface);
        outline: none;
    }

    .workspace-mobile-subfolder-link.is-shared {
        border-color: var(--zn-workspace-shared-border, var(--zn-member-accent-border-muted));
        background: color-mix(in srgb, var(--zn-workspace-shared-background, var(--zn-member-accent-surface)) 34%, transparent);
    }

    .workspace-mobile-subfolder-icon {
        width: 17px;
        height: 17px;
        flex: 0 0 17px;
        color: var(--zn-member-text-link);
    }

    .workspace-mobile-subfolder-link span {
        min-width: 0;
        overflow: hidden;
        font-size: 0.76rem;
        font-weight: 720;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
