/* Phone layout for the client pages (2026-10-06). See app.css for the meeting room's own phone rules. */

/* Phone layout for the client pages, the Settings section (both sides) and
   the shared app bar. Everything here sits behind the 600px query, so the
   desktop layout is exactly what app.css says it is. */
@media (max-width: 600px) {

    /* --- App bar ------------------------------------------------------------
       The account button is the name (plus a client's project). On a phone a
       long one wrapped onto three lines and pushed the bar taller than the
       bar; it now holds one line and gives way with an ellipsis, while the
       brand on the left keeps its size. */
    .portal-appbar .mud-toolbar { gap: 0; min-width: 0; }
    .portal-appbar .mud-toolbar > a.mud-link { flex: 0 0 auto; margin-right: 12px !important; }
    .portal-appbar .mud-toolbar > .mud-menu,
    .portal-appbar .mud-toolbar > .portal-user-menu { min-width: 0; flex: 0 1 auto; }
    .portal-appbar .mud-menu .mud-menu-activator { min-width: 0; max-width: 100%; }
    .portal-appbar .portal-user-menu {
        min-width: 0;
        max-width: 100%;
        margin-left: 4px !important;
        padding-left: 6px;
        padding-right: 6px;
    }
    .portal-appbar .portal-user-menu .mud-button-label {
        display: block;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .portal-appbar .portal-user-menu .mud-button-icon-start {
        display: inline-flex;
        vertical-align: middle;
        margin-top: -3px;
    }
    .portal-appbar .portal-user-project { margin-left: 4px; }

    /* --- Client gutters -------------------------------------------------------
       The client side sits in a medium container AND a padded page shell:
       48px a side before any content on a 390px screen. One gutter is enough. */
    .mud-container:has(> .client-tabs) { padding-left: 12px; padding-right: 12px; }
    /* !important: mobile-meeting-pages.css pads any page-shell whose first
       row holds a .page-title, which also catches the client home and
       meetings pages; inside the client container the container is the gutter. */
    .mud-container:has(> .client-tabs) .page-shell { padding: 16px 4px 48px !important; }
    .mud-container:has(> .client-tabs) .page-title,
    .manage-shell:has(a[href="/settings/audio"]) .page-title { font-size: 1.6rem; line-height: 1.2; overflow-wrap: anywhere; }
    .client-tabs { flex-wrap: wrap; }
    .client-tab { min-height: 40px; }

    /* --- Client meetings (/my-meetings) ---------------------------------------
       Each card's top row held name, chip and the when-label side by side, so
       the name broke a word a line and "Ended · date" ran off the card. The
       when-label now takes its own line under the name and chip. */
    .mud-container:has(> .client-tabs) .d-flex:has(> .meeting-card-when) { flex-wrap: wrap; row-gap: 2px; }
    .mud-container:has(> .client-tabs) .d-flex:has(> .meeting-card-when) > .mud-typography-h6 { min-width: 0; overflow-wrap: anywhere; }
    .mud-container:has(> .client-tabs) .d-flex:has(> .meeting-card-when) > .meeting-card-when {
        flex: 1 1 100%;
        white-space: normal;
        margin-left: 0 !important;
    }
    .client-page-head { flex-wrap: wrap; gap: 8px; }

    /* Project and files pages (not reachable with the dev demo account, so
       guarded by markup reading rather than screenshots): the project switcher
       is a fixed 280px box and a file's remove-reason field a fixed 250px one
       inside a button row — let both give way to the screen. */
    .mud-container:has(> .client-tabs) div[style*="width:280px"] { width: auto !important; flex: 1 1 200px !important; min-width: 0; }
    .mud-container:has(> .client-tabs) .d-flex:has(> .mud-input-control[style*="width: 250px"]) { flex-wrap: wrap; }
    .mud-container:has(> .client-tabs) .mud-input-control[style*="width: 250px"] { width: 100% !important; flex: 1 1 100%; }

    /* --- Settings section (both sides) ----------------------------------------
       Settings borrows the Manage shell. In its phone column the body was
       sized to its content (align-items: flex-start), so a 420px camera
       preview made the whole page wider than the screen. Scoped to the
       Settings shell by its own links so Manage is untouched. */
    .manage-shell:has(a[href="/settings/audio"]) { align-items: stretch; min-height: 0; }
    .manage-shell:has(a[href="/settings/audio"]) > .manage-body { width: 100%; min-width: 0; }
    .manage-shell:has(a[href="/settings/audio"]) .page-shell { padding: 16px 16px 48px; }

    /* Settings → Booking. A day switched on put its From/To pickers beside
       the 150px day label, squeezing each to ~70px — too narrow to show the
       chosen time at all — with the remove button against the card edge.
       The blocks now drop under the day and share the full width. */
    .booking-day-row { flex-wrap: wrap; row-gap: 4px; }
    .booking-day-row > .booking-day-switch { min-width: 140px; }
    .booking-day-row > .booking-day-blocks { flex: 1 1 100%; padding-left: 4px; }
    .booking-block-row { gap: 8px !important; }
    .booking-block-row > .mud-input-control,
    .booking-block-row > div:not(.mud-button-root) { flex: 1 1 0; min-width: 0; max-width: none !important; }
    .booking-block-row .moment-time-select input { padding-left: 10px; padding-right: 0; font-size: 0.95rem; }
    .booking-block-row .moment-time-select .mud-input-adornment-end { margin-left: 0; }
    .booking-add-block { margin-left: 0; }

    /* "Open as a calendar" on a phone: the dialog keeps a thin margin and the
       hour gutter narrows, so the seven lanes get the width (hit-testing
       measures the lanes, so the narrower gutter is safe). */
    .mud-dialog:has(.bookcal) { margin: 8px; width: calc(100% - 16px); max-width: none; }
    .mud-dialog:has(.bookcal) .mud-dialog-content { padding-left: 12px; padding-right: 12px; }
    .mud-dialog:has(.bookcal) .mud-dialog-title { padding-left: 16px; padding-right: 56px; }
    .bookcal-corner, .bookcal-gutter { flex-basis: 50px; }
    .bookcal-gutter span { right: 5px; font-size: 0.65rem; }
    .bookcal-dayhead { font-size: 0.72rem; }
    /* A lane is ~40px wide here: the block's start time drops below its ×
       and may break onto two lines rather than run under it. */
    .bookcal-box-label { white-space: normal; font-size: 0.6rem; }
    .bookcal-box-label:not(.is-end) { padding-top: 17px; }

    /* The section nav strip itself (pills that wrap) is styled for both
       Manage and Settings in mobile-manage.css. */
}

/* The narrowest phones (320–360px): the client wordmark gives back a little
   width so the account button can show more than a first name. */
@media (max-width: 360px) {
    .portal-appbar .portal-logo { height: 18px; }
}
