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

/* Everything here is phone-only: desktop never reads a line of this file.
   Pages without a class of their own are named by what they contain (:has),
   so a rule cannot leak onto another page that happens to share .page-shell. */
@media (max-width: 600px) {

    /* ---- Shared: the plain .page-shell pages this file owns --------------
       prep, cheat sheet, the recording deep link, calendar, tasks, history,
       board. 32px a side is a tenth of a phone; 16px matches the meetings
       list's MudContainer gutters. */
    .page-shell:has(> .d-flex:first-child a[href$="/cheat-sheet"]),
    .page-shell:has(> .d-flex:first-child a[href$="/prep"]),
    .page-shell:has(.mrec),
    .page-shell:has(.cal-view-mine, .cal-grid),
    .page-shell:has(> .d-flex.align-center:first-child > .page-title),
    .page-shell.board-shell {
        padding: 16px 16px 48px;
    }

    .page-shell:has(> .d-flex:first-child a[href$="/cheat-sheet"]) .page-title,
    .page-shell:has(> .d-flex:first-child a[href$="/prep"]) .page-title,
    .page-shell:has(.cal-view-mine, .cal-grid) .page-title,
    .page-shell:has(> .d-flex.align-center:first-child > .page-title) .page-title {
        font-size: 1.6rem;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    /* ---- Meeting artifacts (/meetings/{id}/artifacts) --------------------
       On a desktop the page IS the viewport and each tab owns its scroll. A
       phone has no room for that: the header alone takes a third of the
       screen. So the page becomes the scroller and the tabs grow to their
       content, stacked. */
    .moment-pane .artifacts-page {
        overflow-y: auto;
        overflow-x: hidden;
        padding: 10px 12px 24px;
        min-height: 0;
    }
    .artifacts-page .artifacts-bar { flex-wrap: wrap; gap: 4px 6px; }
    .artifacts-page .artifacts-bar > .mud-icon-button { margin-left: -6px; }
    .artifacts-page .artifacts-head { flex: 1 1 0; }
    .artifacts-page .artifacts-title { font-size: 1.3rem !important; overflow-wrap: anywhere; }
    .artifacts-page .artifacts-bar > .flex-grow-1 { display: none; }
    .artifacts-page .artifacts-stats { flex: 1 1 100%; flex-wrap: nowrap; gap: 6px; margin-top: 6px; }
    .artifacts-page .artifacts-stat { flex: 1 1 0; min-width: 0; padding: 6px 10px; }
    .artifacts-page .artifacts-v { font-size: 1.05rem; white-space: nowrap; }
    .artifacts-page .artifacts-k { font-size: 0.58rem; white-space: nowrap; }

    .artifacts-page .artifacts-tabs { flex: none; }
    .artifacts-page .artifacts-tabs .mud-tabs-panels { overflow: visible; }
    .artifacts-page .artifacts-tabs .mud-tab-panel { height: auto; }
    /* Four tabs on one strip: drop the icons and the wide minimums. */
    .artifacts-page .artifacts-tabs .mud-tab { min-width: 0 !important; width: auto; padding: 6px 8px; font-size: 0.74rem; letter-spacing: .02em; }
    .artifacts-page .artifacts-tabs .mud-tab .mud-icon-root { display: none; }

    /* Recording: the player first, full width; the sources list under it. */
    .artifacts-page .artifacts-rec { flex-direction: column-reverse; position: static; height: auto; gap: 12px; }
    .artifacts-page .artifacts-rec-list { width: auto; overflow: visible; padding-right: 0; }
    .artifacts-page .artifacts-rec-player { overflow: visible; }
    .artifacts-page .artifacts-rec-item { min-height: 48px; }

    /* Transcript: transcript then tasks, one above the other; no divider to drag. */
    .artifacts-page .artifacts-split { flex-direction: column; height: auto; gap: 14px; }
    .artifacts-page .artifacts-split > .artifacts-pane { flex-basis: auto !important; }
    .artifacts-page .artifacts-gutter { display: none; }
    .artifacts-page .artifacts-transcript { max-height: 60vh; overflow-y: auto; }
    .artifacts-page .transcript-offset { margin-right: 8px; }
    .artifacts-page .transcript-text { display: block; margin-top: 2px; }
    .artifacts-page .artifacts-pane-tasks { padding-left: 0; }
    .artifacts-page .artifacts-tasklist { overflow: visible; padding-right: 0; }

    /* Timeline tab: a definite height for the chart to fill. With the panel
       now sized by its content, "fill the panel" has nothing to measure. */
    .artifacts-page .artifacts-tabs .mt-root { height: 560px; }

    /* Plan vs actual: the wide tables scroll sideways inside themselves. */
    .artifacts-page .artifacts-audit { height: auto; overflow: visible; }
    .artifacts-page .artifacts-audit .audit-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .artifacts-page .artifacts-audit .audit-head { flex-wrap: wrap; }

    /* ---- Meeting timeline chart (timeline page and the artifacts tab) ----
       The chart keeps its 720px minimum and scrolls sideways inside its card
       (meeting-timeline.js); the scrollbar is made visible so the clipped
       right-hand side reads as "more this way", not as cut off. */
    .mt-root .mt-chartwrap { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; padding-bottom: 4px; }
    .mt-root .mt-legend { gap: 4px 12px; padding: 8px 8px 6px; font-size: 11px; }
    .moment-pane .mt-page { overflow-y: auto; padding: 10px 12px 12px; }

    /* ---- Recording player (/meetings/{id}/recording/{rid} and the
       artifacts Recording tab) -------------------------------------------- */
    .mrec .mrec-media { height: clamp(200px, 40vh, 360px); }
    .mrec .mrec-strip { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .mrec .mrec-controls { flex-wrap: wrap; gap: 2px; padding: 6px 0 2px; }
    .mrec .mrec-time { white-space: nowrap; margin-left: 2px; font-size: 0.78rem; }
    .mrec .mrec-volume { margin: 0 6px 0 0; gap: 4px; }
    .mrec .mrec-volume input[type="range"] { width: 64px; }
    .mrec .mrec-timeline { --mrec-gutter: 84px; padding: 4px 0 12px; }
    .mrec .mrec-row { height: 32px; }
    .mrec .mrec-row-label { padding: 0 6px; }
    /* Up to twelve ticks across ~270px overlap; label every other one. */
    .mrec .mrec-tick:nth-child(even) .mrec-tick-label,
    .mrec .mrec-tick:last-child .mrec-tick-label { display: none; }

    /* ---- Prep (/meetings/{id}/prep) -------------------------------------- */
    .page-shell:has(> .d-flex:first-child a[href$="/cheat-sheet"]) > .d-flex:first-child {
        flex-wrap: wrap;
        row-gap: 8px !important;
        column-gap: 8px !important;
    }
    .page-shell:has(> .d-flex:first-child a[href$="/cheat-sheet"]) > .d-flex:first-child > div:not(.flex-grow-1) {
        flex: 1 1 calc(100% - 80px);
        min-width: 0;
    }
    .page-shell:has(> .d-flex:first-child a[href$="/cheat-sheet"]) > .d-flex:first-child > .flex-grow-1 { display: none; }
    .page-shell:has(> .d-flex:first-child a[href$="/cheat-sheet"]) > .d-flex:first-child > .mud-button-root:not(.mud-icon-button) {
        white-space: nowrap;
        flex: 0 0 auto;
    }
    .page-shell:has(> .d-flex:first-child a[href$="/cheat-sheet"]) .mud-paper.pa-6 { padding: 16px !important; }

    /* Agenda rows: clock and handles on top, the fields full width under them. */
    .page-shell .plan-row {
        grid-template-columns: 1fr auto;
        gap: 4px 8px;
        padding: 6px 8px;
    }
    .page-shell .plan-row > .plan-row-clock { grid-column: 1; grid-row: 1; padding-top: 10px; }
    .page-shell .plan-row > .plan-row-actions { grid-column: 2; grid-row: 1; padding-top: 0; }
    .page-shell .plan-row > div:not(.plan-row-actions) { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
    .page-shell .plan-row-minutes { flex: 0 0 104px; }
    .page-shell .plan-row-footage { margin-left: 11px; }
    .page-shell .prep-import-item { grid-template-columns: 40px 1fr auto; }
    .page-shell .prep-import-head { flex-wrap: wrap; }

    /* ---- Cheat sheet (/meetings/{id}/cheat-sheet) ------------------------ */
    .page-shell:has(> .d-flex:first-child a[href$="/prep"]) > .d-flex:first-child {
        flex-wrap: wrap;
        row-gap: 4px !important;
    }
    .page-shell:has(> .d-flex:first-child a[href$="/prep"]) > .d-flex:first-child > div:not(.flex-grow-1) {
        flex: 1 1 100%;
        min-width: 0;
    }
    .page-shell:has(> .d-flex:first-child a[href$="/prep"]) > .d-flex:first-child > .flex-grow-1 { display: none; }
    .page-shell:has(> .d-flex:first-child a[href$="/prep"]) > .d-flex:first-child > a.mud-button-root {
        white-space: nowrap;
        margin-left: -8px;
    }
    .cheatsheet-notes { columns: 1; }

    /* ---- Tasks and task history: the header button stays on one line ---- */
    .page-shell:has(> .d-flex.align-center:first-child > .page-title) > .d-flex.align-center:first-child {
        flex-wrap: wrap;
        gap: 4px 8px;
    }
    .page-shell:has(> .d-flex.align-center:first-child > .page-title) > .d-flex.align-center:first-child > .mud-button-root {
        white-space: nowrap;
    }

    /* ---- Meetings list (/meetings) --------------------------------------- */
    .meetings-toolbar .mud-typography-h4 { font-size: 1.8rem; }
    .meetings-toolbar .mud-button-root { white-space: nowrap; }
    .meetings-toolbar > .mud-container > .d-flex:first-child { margin-bottom: 10px !important; }
    .meetings-toolbar > .mud-container > .d-flex:nth-child(2) { row-gap: 10px !important; column-gap: 8px !important; margin-bottom: 10px !important; }
    .meetings-toolbar > .mud-container > .d-flex:nth-child(2) > .flex-grow-1 { display: none; }
    .meetings-toolbar > .mud-container > .d-flex:nth-child(2) > .mud-input-control,
    .meetings-toolbar > .mud-container > .d-flex:nth-child(2) > .mud-autocomplete,
    .meetings-toolbar > .mud-container > .d-flex:nth-child(2) > div:last-child { flex: 1 1 100%; min-width: 0 !important; }
    .meetings-toolbar .mud-button-group-root .mud-button-root { padding-left: 8px; padding-right: 8px; }
    .meeting-card > .pa-5 { padding: 14px !important; }
    .meeting-card > .pa-5 > .d-flex.flex-row:first-child { flex-wrap: wrap; row-gap: 4px; }
    .meeting-card .meeting-card-head { flex: 1 1 100%; min-width: 0; }
    .meeting-card > .pa-5 > .d-flex.flex-row:first-child > .flex-grow-1 { display: none; }
    .meeting-card > .pa-5 > .d-flex.flex-row { flex-wrap: wrap; }

    /* ---- Calendar (/calendar) --------------------------------------------- */
    .page-shell:has(.cal-view-mine, .cal-grid) > .d-flex:first-child {
        flex-wrap: wrap;
        row-gap: 8px !important;
    }
    .page-shell:has(.cal-view-mine, .cal-grid) > .d-flex:first-child > .flex-grow-1 { flex: 1 1 100%; height: 0; }
    .page-shell:has(.cal-view-mine, .cal-grid) > .d-flex:first-child > .mud-typography-subtitle1 {
        min-width: 0 !important;
        text-align: left !important;
        flex: 1 1 auto;
    }
    .cal-team-key { flex-wrap: wrap; row-gap: 4px !important; column-gap: 12px !important; }
    .cal-team-key > .d-flex { white-space: nowrap; }
    .cal-team-key > .mud-typography { flex: 1 1 100%; margin-left: 0 !important; }

    /* The week scrolls sideways inside its card; the hour gutter and the day
       heads stay pinned so a block is always readable against its time. */
    .cal-scroll { max-height: calc(100dvh - 300px); overscroll-behavior-x: contain; }
    .cal-grid { grid-template-columns: 44px repeat(7, minmax(96px, 1fr)); min-width: 716px; }
    .cal-grid > .cal-gutter {
        position: sticky;
        left: 0;
        z-index: 3;
        background: var(--mud-palette-surface);
    }
    .cal-grid > .cal-head {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--mud-palette-surface);
    }
    .cal-grid > .cal-head.cal-today {
        background: linear-gradient(rgba(var(--mud-palette-primary-rgb), 0.06), rgba(var(--mud-palette-primary-rgb), 0.06)), var(--mud-palette-surface);
    }
    .cal-grid > .cal-gutter.cal-head { z-index: 4; }
    .cal-hour-label { padding-right: 4px; font-size: 0.64rem; }

    /* ---- Meeting board (/board) ----------------------------------------
       Seven columns of ~45px hold no title at all. On a phone each week turns
       on its side: one row per day, the day on the left and its meeting cards
       full width beside it — the same cards, read down instead of across.
       The markup is seven heads then seven cells, so each is placed by index. */
    .page-shell.board-shell > .d-flex:first-child { row-gap: 8px; }
    .page-shell.board-shell > .d-flex:first-child > .flex-grow-1 { flex: 1 1 100%; height: 0; display: none; }
    .page-shell.board-shell .board-week.is-meetings {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 4px 8px;
    }
    .page-shell.board-shell .board-week > .board-week-dayhead {
        grid-column: 1;
        padding: 6px 0 0;
        border-top: 1px solid var(--board-line);
    }
    .page-shell.board-shell .board-week > .board-week-cell { grid-column: 2; min-height: 2.75rem; }
    .page-shell.board-shell .board-week-empty { text-align: left; padding: .6rem 0 0 .5rem; }
    .page-shell.board-shell .board-week > .board-week-dayhead:nth-child(1) { grid-row: 1; }
    .page-shell.board-shell .board-week > .board-week-cell:nth-child(8) { grid-row: 1; }
    .page-shell.board-shell .board-week > .board-week-dayhead:nth-child(2) { grid-row: 2; }
    .page-shell.board-shell .board-week > .board-week-cell:nth-child(9) { grid-row: 2; }
    .page-shell.board-shell .board-week > .board-week-dayhead:nth-child(3) { grid-row: 3; }
    .page-shell.board-shell .board-week > .board-week-cell:nth-child(10) { grid-row: 3; }
    .page-shell.board-shell .board-week > .board-week-dayhead:nth-child(4) { grid-row: 4; }
    .page-shell.board-shell .board-week > .board-week-cell:nth-child(11) { grid-row: 4; }
    .page-shell.board-shell .board-week > .board-week-dayhead:nth-child(5) { grid-row: 5; }
    .page-shell.board-shell .board-week > .board-week-cell:nth-child(12) { grid-row: 5; }
    .page-shell.board-shell .board-week > .board-week-dayhead:nth-child(6) { grid-row: 6; }
    .page-shell.board-shell .board-week > .board-week-cell:nth-child(13) { grid-row: 6; }
    .page-shell.board-shell .board-week > .board-week-dayhead:nth-child(7) { grid-row: 7; }
    .page-shell.board-shell .board-week > .board-week-cell:nth-child(14) { grid-row: 7; }
    .page-shell.board-shell .board-people.is-names,
    .page-shell.board-shell .board-people-group { grid-template-columns: repeat(4, minmax(0, 1fr)); }

    /* ---- Staff chat thread (/chat/{id}) ---------------------------------
       The header packed title, five icons and three text buttons into one
       row, so the title became a column one word wide. On a phone: back and
       title on the first line, the room's verbs wrapping underneath. */
    .chat-shell-staff .chat-head { flex-wrap: wrap; gap: 2px 4px; padding: 8px 12px; }
    .chat-shell-staff .chat-head > div:not(.flex-grow-1):not(.mud-tooltip-root) {
        flex: 1 1 calc(100% - 48px);
        min-width: 0;
    }
    .chat-shell-staff .chat-head > div:not(.flex-grow-1):not(.mud-tooltip-root) .mud-typography-h6 {
        font-size: 1.05rem;
        line-height: 1.3;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow-wrap: anywhere;
    }
    .chat-shell-staff .chat-head > div:not(.flex-grow-1):not(.mud-tooltip-root) .mud-typography-caption {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .chat-shell-staff .chat-head > .flex-grow-1 { display: none; }
    .chat-shell-staff .chat-head .mud-button-root:not(.mud-icon-button) { white-space: nowrap; margin-left: 0 !important; }
    .chat-shell-staff .chat-head .mud-icon-button { padding: 8px; }
    .chat-shell-staff .chat-messages { padding: 12px 12px; }
    .chat-shell-staff .chat-composer { padding: 8px 10px 10px; }
    .chat-shell-staff .chat-composer-row { gap: 6px; }
    .chat-shell-staff .chat-composer-row .mud-button-root:not(.mud-icon-button) { min-width: 0; padding-left: 12px; padding-right: 12px; }
}
