/* Phone fit (docs/audit/MOBILE-AUDIT-2026-10-20.md): every module scrolls top-down only, nothing moves sideways.
   Everything here sits inside @media(max-width:800px) (the phone layout of pwa-ui.css / phone-shell.css); desktop and tablet are unchanged.
   Linked after the module stylesheets (which load into <head>) and before phone-shell.css; selectors start with "html body" where they
   have to win over an earlier phone rule. Sheets / modals / call minimise: /mobile-sheets.js (styles at the bottom of this file). */
@media(max-width:800px){
 /* ---------- tab rows wrap instead of scrolling (Docs, Sheets, Slides, Mind notes, Whiteboard, GitHub, Bots, Contacts, Calendar settings ...) ---------- */
 html body #appview .tabs2,html body .cal-tabs{display:flex;flex-wrap:wrap;overflow:visible;width:auto;max-width:100%;min-width:0;row-gap:0}
 html body #appview .tabs2 button,html body .cal-tabs button{flex:none;max-width:100%;overflow:hidden;text-overflow:ellipsis}
 html body #appview.psh-docs .tabs2{column-gap:22px;overflow:visible}
 html body #appview .dx-listbar,html body #appview .sh-listbar,html body #appview .sd-listbar,html body #appview .cb-listbar{min-width:0;max-width:100%}
 html body #appview .dx-search,html body #appview .sh-search,html body #appview .sd-search,html body #appview .cb-search{max-width:100%;width:100%;margin-left:0;box-sizing:border-box}

 /* ---------- side navs (Drive, Tasks, Mail, Attendance) become wrapping chips at the top, not a sideways strip ---------- */
 html body #appview .at-side,html body #appview .dr-side,html body #appview .tk-side,html body #appview .ml-side{flex-wrap:wrap!important;overflow:visible!important;row-gap:4px!important;width:auto!important;max-width:100%!important}
 html body #appview .at-side>*,html body #appview .dr-side>*,html body #appview .tk-side>*,html body #appview .ml-side>*{max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis}
 html body #appview .at-side .at-nav{min-height:40px}

 /* ---------- Tasks: date strip = two rows of seven; row meta drops below the title ---------- */
 html body #appview .tk-strip{flex-wrap:wrap!important;overflow:visible!important;padding:0 12px 12px;gap:6px}
 html body #appview .tk-strip>.tk-day{flex:0 0 calc((100% - 36px) / 7)!important;width:auto;min-width:0}
 html body #appview .tk-row{flex-wrap:wrap;min-width:0}
 html body #appview .tk-row>*{min-width:0}
 html body #appview .tk-meta{flex:1 1 100%;padding-left:30px;min-width:0}
 html body #appview .tk-lbl{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 html body #appview .tk-meta span,html body #appview .tk-gh,html body #appview .tk-due{font-size:12px}
 html body #appview .tk-chk{width:24px;height:24px;flex:none}
 html body #appview .tk-chk::after{content:"";position:absolute;inset:-10px}
 html body #appview .tk-chk{position:relative}

 /* ---------- Attendance: week of seven equal cells; side nav labels ---------- */
 html body #appview .at-week{grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}
 html body #appview .at-wd{padding:6px 2px;min-width:0}
 html body #appview .at-wd .n,html body #appview .at-wd small,html body #appview .at-chip{font-size:12px}

 /* ---------- Workplace: one column, three apps per row ---------- */
 html body #appview .wp{padding:16px;min-width:0}
 html body #appview .wp-cols{grid-template-columns:minmax(0,1fr)}
 html body #appview .wp-cols>*,html body #appview .wp-card{min-width:0}
 html body #appview .wp-card h2{flex-wrap:wrap;row-gap:8px}
 html body #appview .wp-apps{grid-template-columns:repeat(3,minmax(0,1fr))}
 html body #appview .wp-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 html body #appview .gh-ban{grid-template-columns:18px minmax(0,1fr) 24px}
 html body #appview .wp-li{min-width:0}html body #appview .wp-li .l{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 html body #appview .wp-b,html body #appview .wp-ib{min-height:40px;min-width:40px}

 /* ---------- Contacts: departments above the list, rows = avatar + name/details ---------- */
 html body #appview .ct{flex-direction:column;overflow:auto}
 html body #appview .ct-tree{width:auto;border-right:0;border-bottom:1px solid var(--line);padding:8px 12px;overflow:visible;flex:none}
 html body #appview .ct-main{flex:none;min-height:0}
 html body #appview .ct-list{overflow:visible;padding:4px 12px 24px}
 html body #appview .ct-bar{padding:10px 12px}
 html body #appview .ct-bar .inp{flex:1 1 140px;min-width:0;width:auto}
 html body #appview .ct-row{grid-template-columns:44px minmax(0,1fr);row-gap:2px}
 html body #appview .ct-row>.ct-m{grid-column:2}html body #appview .ct-row>.ct-m:empty{display:none}
 html body #appview .ct-lab,html body #appview .ct-lab button{font-size:12px}
 html body #appview .ct-lab button{min-height:36px;padding:0 4px}
 html body #appview .ct-panel{position:fixed;inset:0;width:auto;z-index:70;background:var(--paper);padding:calc(16px + var(--sa-t,env(safe-area-inset-top))) 16px calc(16px + var(--sa-b,env(safe-area-inset-bottom)))}
 html body #appview .ct-org{padding:12px;overflow:visible}

 /* ---------- Wiki: space picker + page tree above the page list ---------- */
 html body #appview .wk-root{flex-direction:column;overflow:auto}
 html body #appview .wk-nav{width:auto!important;max-width:none;flex:none;border-right:0;border-bottom:1px solid var(--line);max-height:42dvh;overflow:auto}
 html body #appview .dx-eyebrow,html body #appview .bs-eyebrow,html body #appview .bt-eyebrow{font-size:12px}

 /* ---------- Admin console: header wraps, section nav collapses to the current section (mobile-sheets.js adds the toggle) ---------- */
 html body #appview .adx-top{flex-wrap:wrap;height:auto;row-gap:8px;padding-top:8px;padding-bottom:8px}
 html body #appview .adx-sw{order:5;flex:1 1 100%;width:auto;min-width:0}html body #appview .adx-sw #adx-q{width:100%;box-sizing:border-box}
 html body #appview .adx-ic{margin-left:auto}
 html body #appview .adx-ib{width:40px;height:40px}
 html body #appview .adx-nav{flex-direction:column!important;flex-wrap:nowrap;overflow:visible!important;padding:6px 8px}
 html body #appview .adx-nav .adx-ni{width:100%;min-height:44px}
 html body #appview .adx-nav:not(.msh-open) .adx-ni:not(.on){display:none}
 html body #appview .adx-nav .msh-navt{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:44px;border:0;border-radius:10px;background:var(--wash);color:var(--ink);font:500 15px var(--f-b);padding:0 14px;margin-bottom:4px;cursor:pointer}
 html body #appview .adx-nav .msh-navt svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;transition:transform .15s}
 html body #appview .adx-nav.msh-open .msh-navt svg{transform:rotate(180deg)}
 html body #appview .adx-main{min-width:0;overflow-x:hidden}

 /* ---------- Bots & API docs, GitHub: code wraps, no sideways panel ---------- */
 html body #appview .bt-pre,html body #appview .bt-docs pre,html body #appview .cn-code,html body #appview .ig-code{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;overflow-x:hidden}

 /* ---------- generic: long words / URLs never widen a module ---------- */
 html body #appview .ap-body{overflow-x:hidden}
 html body #appview .dx-row,html body #appview .dr-r,html body #appview .sh-row,html body #appview .sd-row{min-width:0}
 html body #appview .dx-empty{min-width:0;width:auto}
 html body #appview .dx-empty .dx-btn{min-height:44px}
 html body #appview .ux-rm{width:40px;height:40px}


 /* ---------- app headers: actions drop below a title instead of cutting it to "Sli…" (Docs / Meetings heads keep phone-shell.css) ---------- */
 html body #appview:not(.psh-docs):not(.psh-mtg) .ap-head{flex-wrap:wrap;row-gap:6px}
 html body #appview:not(.psh-docs):not(.psh-mtg) .ap-head h2{flex:1 1 auto;min-width:min(160px,45%)}
 html body #appview .ap-head .ap-actions{flex-wrap:wrap;justify-content:flex-end;max-width:100%}
 html body #appview.psh-docs .tabs2 button{padding:8px 0 10px}

 /* ---------- Sheets / Slides / Mind notes / Whiteboard templates: two per row ---------- */
 html body #appview .sh-tpls,html body #appview .sd-tpls,html body #appview .cb-tpls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 html body #appview .sh-tpl,html body #appview .sd-tpl,html body #appview .cb-tpl{width:auto;min-width:0}
 html body #appview .sh-tpl,html body #appview .sd-tpl,html body #appview .cb-tpl{overflow:hidden}html body #appview .sh-tpl>*,html body #appview .sd-tpl>*,html body #appview .cb-tpl>*{max-width:100%}

 /* ---------- Wiki: header, then spaces / page tree, then the page list ---------- */
 html body #appview .wk-main:not(:has(.ProseMirror,.dx-tool,.dx-top)){display:contents}
 html body #appview .wk-main:has(.ProseMirror,.dx-tool,.dx-top){flex:1 0 auto;min-height:80dvh}
 html body #appview .wk-root>.wk-nav{order:1}html body #appview .wk-main>.ap-head{order:0}html body #appview .wk-main>:not(.ap-head){order:2}

 /* ---------- 2-step verification reminder (mod-safety.js): full width under the status bar, readable in dark mode ---------- */
 html body #sf-banner{left:12px!important;right:12px!important;transform:none!important;max-width:none!important;top:calc(8px + var(--sa-t,env(safe-area-inset-top)))!important;background:var(--paper)!important;color:var(--ink)!important;border-color:var(--line)!important}
 html body #sf-banner .ad-sub{color:var(--ink-soft)}html body #sf-banner .sf-row{display:flex;gap:8px;justify-content:flex-end}html body #sf-banner .btn{min-height:44px}

 /* ---------- small text the audit found under 12 px ---------- */
 html body #appview .cn-lab,html body #appview .ig-chip,html body #appview .gh-priv,html body #appview .chg-chip,html body #appview .tk-pr,html body #appview .tk-av,html body #appview .tk-lbl,html body #appview .dr-vh{font-size:12px}
 html body #appview .cn-cp,html body #appview .lb-btn,html body #appview .at-b{min-height:36px}
 html body .cal-app .g,html body .cal-app .tm{font-size:12px}
}

/* ---------- safe areas (any width; env() is 0 everywhere except a notched phone in the Dock app / installed PWA, so desktop is unchanged) ----------
   Full-screen layers that draw their own top / bottom bars keep them clear of the status bar / Dynamic Island and the home indicator
   (index.html has viewport-fit=cover; the iOS shell is edge to edge, the Android shell pads itself and reports 0 here). */
html body #imv{padding:var(--sa-t,env(safe-area-inset-top)) var(--sa-r,env(safe-area-inset-right)) var(--sa-b,env(safe-area-inset-bottom)) var(--sa-l,env(safe-area-inset-left));box-sizing:border-box}
html body #imv .cnt,html body #imv .tip{bottom:calc(14px + var(--sa-b,env(safe-area-inset-bottom)))}
html body .dv{padding:var(--sa-t,env(safe-area-inset-top)) var(--sa-r,env(safe-area-inset-right)) var(--sa-b,env(safe-area-inset-bottom)) var(--sa-l,env(safe-area-inset-left));box-sizing:border-box}
html body #rplay{padding:var(--sa-t,env(safe-area-inset-top)) var(--sa-r,env(safe-area-inset-right)) var(--sa-b,env(safe-area-inset-bottom)) var(--sa-l,env(safe-area-inset-left));box-sizing:border-box}
html body .mn-ov{padding:var(--sa-t,env(safe-area-inset-top)) var(--sa-r,env(safe-area-inset-right)) var(--sa-b,env(safe-area-inset-bottom)) var(--sa-l,env(safe-area-inset-left));box-sizing:border-box}
html body #scrannbar{bottom:calc(86px + var(--sa-b,env(safe-area-inset-bottom)))}

/* ---------- sheets (mobile-sheets.js): every dialog is a bottom sheet above the tab bar, with a drag handle and a sticky close bar ---------- */
@media(max-width:800px){
 body{--msh-b:var(--tabh,0px)}
 body.m-in-chat:not(.appmode),html.ts-kb body{--msh-b:0px}
 html body .msh-ov:not(.msh-box){position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:var(--msh-b)!important;height:auto!important;width:auto!important;display:flex!important;flex-direction:column;align-items:stretch!important;justify-content:flex-end!important;padding:0!important;overflow:hidden!important}
 html body .msh-box:not(.msh-own){position:relative;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;flex:none;border-radius:16px 16px 0 0!important;border-bottom:0!important;box-sizing:border-box;
  max-height:calc(var(--msh-vvh,100dvh) - var(--msh-b) - var(--sa-t,env(safe-area-inset-top)) - 10px)!important;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  padding-top:0!important;padding-bottom:calc(16px + var(--sa-b,env(safe-area-inset-bottom)))!important;animation:msh-up .22s ease}
 html body .msh-ov.msh-box:not(.msh-own){position:fixed!important;left:0!important;right:0!important;top:auto!important;bottom:var(--msh-b)!important;transform:none}
 @keyframes msh-up{from{transform:translateY(40px);opacity:.6}to{transform:none;opacity:1}}
 @media(prefers-reduced-motion:reduce){html body .msh-box:not(.msh-own){animation:none}}
 .msh-bar{position:sticky;top:0;z-index:6;display:flex;align-items:center;gap:4px;min-height:56px;box-sizing:border-box;padding:12px 6px 2px;margin:0 calc(-1 * var(--msh-pr,0px)) 10px calc(-1 * var(--msh-pl,0px));background:var(--paper);border-bottom:.5px solid var(--line);touch-action:none}
 .msh-grab{position:absolute;top:6px;left:50%;width:40px;height:5px;margin-left:-20px;border-radius:3px;background:var(--line);pointer-events:none}
 .msh-grab-own{position:sticky;display:block;top:0;margin:0 auto -5px;z-index:7;left:auto}
 .msh-x{flex:none;width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:12px;background:transparent;color:var(--ink);padding:0;cursor:pointer}
 .msh-x svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
 .msh-t{flex:1;min-width:0;text-align:center;font:600 17px var(--f-d);color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 .msh-ok{flex:none;min-height:44px;min-width:44px;padding:0 12px;border:0;border-radius:10px;background:transparent;color:var(--blue);font:600 16px var(--f-b);cursor:pointer}
 .msh-sp{flex:none;width:44px}
 .msh-box .msh-dup{display:none!important}
 .msh-draft{display:flex;align-items:center;gap:6px;padding:4px 6px 4px 12px;margin:0 0 12px;border-radius:10px;background:var(--blue-wash);color:var(--ink);font:400 14px var(--f-b)}
 .msh-draft span{flex:1;min-width:0}.msh-draft button{min-height:40px;border:0;background:none;color:var(--blue);font:600 14px var(--f-b);padding:0 8px;cursor:pointer}
 /* own-header panels: full screen above the tab bar */
 html body #appview .tk-drawer{position:fixed;top:0;left:0;right:0;bottom:var(--msh-b);width:auto;z-index:80;border-left:0;padding-top:var(--sa-t,env(safe-area-inset-top));box-shadow:none}
 html body .tk-drawer .tk-dh{position:sticky;top:0;z-index:2;background:var(--paper);flex-wrap:wrap}

 /* ---------- calendar event editor: fields stack, dates and times are never cut ---------- */
 html body .cal-dlg .row>.fld{flex:1 1 100%;min-width:0}
 html body .cal-dlg .row>.fld:has(#c-cal),html body .cal-dlg .row>.fld:has(#c-rep){flex:1 1 0}
 html body .cal-dlg .row>.fld .row{flex-wrap:nowrap}
 html body .cal-dlg .row>.fld .row>.tsp-f{min-width:0}
 html body .cal-dlg .tsp-f,html body .cal-dlg .inp{min-height:44px;font-size:16px}
 html body .cal-dlg label.f{font-size:12px}
 html body .cal-dlg .foot .btn{min-height:44px}
 html body .cal-title-in{font-size:20px}
 /* meeting scheduler (mtg-create-ui.js) on the shared #modal */
 html body #mbox.mc-box .mc-when{flex-wrap:wrap;row-gap:6px}
 html body #mbox.mc-box .mc-f{min-height:44px;font-size:16px}

 /* ---------- call minimised to a bubble (mobile-callmin.js) ---------- */
 html body.msh-cmin #call,html body.msh-cmin #cside,html body.msh-cmin #moremenu{visibility:hidden!important;pointer-events:none!important}
 #msh-cmin-b{width:44px;height:44px;min-width:44px;display:inline-flex;align-items:center;justify-content:center;flex:none;padding:0;margin-right:6px;border-radius:12px}
 #msh-cmin-b svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
 #msh-pip{position:fixed;z-index:120;width:112px;height:150px;border-radius:16px;overflow:hidden;background:#1F2023;color:#fff;box-shadow:0 10px 30px rgba(0,0,0,.45);touch-action:none;cursor:pointer;transition:left .2s ease,top .2s ease;-webkit-user-select:none;user-select:none}
 #msh-pip.drag{transition:none}
 #msh-pip[hidden]{display:none}
 #msh-pip video{width:100%;height:100%;object-fit:cover;display:block;background:#16181D}
 #msh-pip.nocam video{display:none}
 #msh-pip .msh-pav{display:none;position:absolute;left:50%;top:42%;width:56px;height:56px;margin:-28px 0 0 -28px;border-radius:50%;background:var(--blue-fill,var(--blue));align-items:center;justify-content:center;font:600 24px var(--f-b)}
 #msh-pip.nocam .msh-pav{display:flex}
 #msh-pip .msh-ptm{position:absolute;left:0;right:0;bottom:0;padding:18px 8px 7px;font:600 13px var(--f-m);text-align:center;background:linear-gradient(transparent,rgba(0,0,0,.6))}
 #msh-pip .msh-pend{position:absolute;top:6px;right:6px;width:36px;height:36px;border:0;border-radius:50%;background:#E5484D;color:#fff;display:flex;align-items:center;justify-content:center;padding:0;cursor:pointer}
 #msh-pip .msh-pend::after{content:"";position:absolute;inset:-6px}
 #msh-pip .msh-pend svg{fill:currentColor}
}
@media(min-width:801px){#msh-pip,#msh-cmin-b,.msh-bar,.msh-grab,.msh-draft{display:none!important}}
