/* Phone hierarchy, using the active skin. Desktop keeps its existing controls. */
.mobile-nav-more, .mobile-header-toggle, .mobile-link-devices { display: none; }
.mobile-header-actions { display: contents; }

@media (max-width: 767px) {
    .app-shell { --phone-rail-height: calc(56px + env(safe-area-inset-bottom, 0px)); }
    .icon-rail {
        height: var(--phone-rail-height);
        padding: 0 8px env(safe-area-inset-bottom, 0px);
        overflow: visible;
        gap: 0;
    }
    .icon-rail .icon-rail-top { display: contents; }
    .icon-rail .icon-rail-bottom, .icon-rail #icon-rail-bottom-apps,
    .icon-rail .rail-group, .icon-rail .rail-btn { display: none; }
    .icon-rail #rail-sanity-btn, .icon-rail #rail-chat-btn,
    .icon-rail #rail-studio-btn, .icon-rail #mobile-nav-more {
        display: flex;
        flex: 1;
        min-width: 0;
        height: 56px;
        padding: 6px 4px;
        justify-content: center;
        gap: 3px;
    }
    .shell-top-bar { position: relative; min-height: 48px; height: 48px; gap: 2px; padding: 0 8px; }
    .shell-top-bar .topbar-left { flex: 1; min-width: 0; }
    .shell-top-bar .topbar-center { flex: none; min-width: 0; }
    .shell-top-bar .topbar-right { gap: 0; padding-left: 0; }
    .shell-top-bar .topbar-search, .shell-top-bar .topbar-user,
    .shell-top-bar .mobile-header-toggle { width: 44px; min-width: 44px; height: 44px; }
    .shell-top-bar .topbar-search { justify-content: center; border: none; background: none; }
    .shell-top-bar .topbar-search-text, .shell-top-bar .topbar-search-kbd { display: none; }
    .shell-top-bar #topbar-bc-workspace { min-height: 44px; }
    .shell-top-bar .mobile-header-toggle { display: inline-flex; }
    .shell-top-bar .mobile-header-actions { display: none; }
    .shell-top-bar.mobile-header-open .mobile-header-actions {
        display: flex;
        position: absolute;
        top: 100%; right: 8px;
        width: min(320px, calc(100vw - 16px));
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
        padding: 16px;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: 0 8px 24px color-mix(in srgb, var(--bg-primary) 40%, transparent);
        z-index: 900;
    }
    .mobile-header-actions .topbar-icon-btn { min-width: 44px; min-height: 44px; }
    .mobile-header-actions #topbar-assistant, .mobile-header-actions #topbar-join-workspace {
        display: flex; width: 100%; justify-content: flex-start; gap: 12px;
        padding: 8px 12px; font-size: var(--fs-body); font-family: var(--font-sans);
    }
    .mobile-header-actions #topbar-assistant::after,
    .mobile-header-actions #topbar-join-workspace::after { content: attr(title); }
    .mobile-header-actions .mobile-link-devices {
        display: block; width: 100%; min-height: 44px;
        border: 1px solid var(--border); border-radius: 8px;
        background: var(--bg-hover); color: var(--text-primary);
        font: inherit; text-align: left; padding: 8px 12px; cursor: pointer;
    }
    /* The safety cue and its detail menu stay available; duplicate context is in Chat options. */
    .status-bar .status-bar-left, .status-bar .status-bar-right { display: none; }
    .status-bar .status-bar-cue { min-width: 0; max-width: calc(100vw - 80px); }
    .kanban-dialog-overlay.mobile-apps-overlay { justify-content: flex-end; align-items: stretch; padding: 0; }
    .mobile-apps-overlay .kanban-dialog {
        width: 100%; max-width: none; margin: 0;
        border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        max-height: 80dvh;
    }
}
.mobile-app-list { display: grid; gap: 4px; }
.mobile-app-link {
    display: flex; align-items: center; gap: 12px;
    min-height: 48px; padding: 10px 12px;
    border: none; border-radius: 8px;
    background: none; color: var(--text-primary);
    font-family: var(--font-sans); font-size: var(--fs-body);
    text-align: left; text-decoration: none; cursor: pointer;
}
.mobile-app-link:hover, .mobile-app-link[aria-current] { background: var(--bg-hover); }
.mobile-app-link:focus-visible, .mobile-link-devices:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}
.mobile-app-link:disabled, .mobile-app-link[aria-disabled="true"] { opacity: .5; cursor: default; }
