/* Phones (19 Oct 2026 review): after the desktop work - the map dock, tiles, the chat window, the callout page's tabs - the
   phone had grown clunky: menus wrapping onto three rows, a two-line sticky strip, nine buttons stacked in a grid, the chat
   button over the page. Loaded last, phones only; nothing here changes a computer. */
@media (max-width: 700px) {
  /* the section menu and its sub-tabs: one row each that scrolls sideways (like a phone app's tabs), not a block of rows */
  html.ui-modern .sec-tabs, .sec-tabs, .ops-tabs { display: flex; flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; width: auto !important;
    max-width: none; margin-inline: -4px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .sec-tabs::-webkit-scrollbar, .ops-tabs::-webkit-scrollbar { display: none; }
  .sec-tabs a, .ops-tabs a { flex: none; scroll-snap-align: start; }
  html.ui-modern .sec-tabs { padding: 3px; margin-bottom: 6px; }
  html.ui-modern .sec-tabs a { padding: 6px 12px; font-size: var(--fs-sm, .85rem); }

  /* the alert strip (sunset, last light, sound): one slim line, the sound switch just its icon */
  .sar-alerts { top: 56px; padding: 4px 10px; gap: 6px; flex-wrap: nowrap; font-size: var(--fs-xs, .78rem); }
  
  .sar-alerts .sa-timer { white-space: nowrap; padding: 2px 8px; font-size: var(--fs-xs, .78rem); }
  
  
  /* alerts in the strip: the full width (not squeezed beside the timers), one line each, the timers on the line below */
  .sar-alerts.has-events { flex-wrap: wrap; }
  
  .sar-alerts .sa-event { padding: 5px 8px 5px 10px; gap: 8px; font-size: var(--fs-xs, .78rem); }
  .sar-alerts .sa-event a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  
  

  /* the callout's buttons: wrapped onto as many rows as they need (a sideways-scrolling row hid Open as / More off the
     screen and would clip their drop-downs); the computer-only ones go */
  
  
  
  
   .cf-btn, .tl-layout-btn{ display: none !important; }   /* the command view has its own phone layout: it stays */

  /* the figures at the top: two by two, not three and one left over */
  .inc-strip { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .inc-strip .inc-tile { min-width: 0; padding: 10px 12px; }

  /* the teams: compact rows, so the callout's tabs aren't a long scroll away */
  
  
  

  /* the callout's own tabs (Situation, Missing person, Log & notes...): a sideways row that sticks under the top bar */
  
  
  

  /* the status board: its figure tiles two by two */
  .kpis { grid-template-columns: 1fr 1fr !important; }

  /* banners: smaller on a small screen */
  .kill-strip, .demo-strip { font-size: var(--fs-xs, .78rem); padding: 6px 34px 6px 12px; }
}
@media (max-width: 700px) {
  /* the chat on the bottom bar: no floating button over the page */
  
  
  
  
  /* the chat sheet sits above the bottom bar */
  body.has-app-bar .fc-win { bottom: calc(64px + env(safe-area-inset-bottom)) !important; height: calc(78dvh - 64px) !important; }
}
@media (max-width: 700px) {
  /* Notes: the formatting bar one sideways row; the list short, so the note itself is on screen */
  .sp-toolbar { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
  .sp-toolbar::-webkit-scrollbar { display: none; }
  .sp-toolbar .sp-group { flex: none; flex-wrap: nowrap; }
  .sp-toolbar .sp-end { margin-left: 0; }
  .notes-list { max-height: 30vh; }
  .notes-page .scribble-panel { min-height: 55vh; }

  /* a page's description under its title */
  .page-head > div > p.muted { font-size: var(--fs-sm, .85rem); line-height: 1.45; }  /* shown in full (12 Nov 2026): a cut-off line read as broken */
}
@media (max-width: 700px) {
  /* last light is already on the slim strip at the top: not twice */
  
  
}
@media (max-width: 700px) { .fc-win .fc-dock { display: none; } }
@media (max-width: 700px) {
  /* figure tiles in twos: an odd one out at the end takes the whole row instead of sitting alone */
  :is(.kpis, .inc-strip) > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* the ☰ menu: Settings lined up like the other rows */
  .mainnav .nav-gear { justify-content: flex-start !important; gap: 10px; }
  .mainnav .nav-gear .caret { margin-left: auto; }
}
@media (max-width: 700px) {
  /* Big screen (the wall display) is for a computer or a TV: not offered on a phone */
  :is(.mainnav, .mrail, .mr-fly, .sec-tabs, .ops-tabs, .nav-menu) a[href$="/control-room/wall"] { display: none !important; }
}
@media (max-width: 700px) {
  /* the Chat page: the message box sits above the bottom bar, not under it */
     /* (the chat window has no bar) */
  /* the chat's messages: just the speech bubbles - no box round each row, the full width to use */
  
}
/* 25 Oct 2026 phone pass: a grid or flex child is never narrower than its content by default, so one row that doesn't wrap
   (chips that scroll sideways, a long address) pushed whole forms wider than the screen - Alert the team ran to 900px.
   Let the children of forms and panels shrink; the rows inside still scroll or wrap as they're meant to. */
@media (max-width: 700px) {
  
   form:where(.stack) { grid-template-columns: minmax(0, 1fr); }
  :where(textarea, input:not([type=checkbox]):not([type=radio]), select) { max-width: 100%; }
  .inline-form input { min-width: 0; flex: 1 1 140px; }                        /* a row of boxes: side by side when they fit, else wrapped */
  .inline-form input[style*="width"] { width: auto !important; }
  html.ui-modern .topbar { background: var(--surface); backdrop-filter: none; }   /* solid: text scrolling under it showed through, half cut */
  body:has(nav.app-bar) .fc-btn { display: none !important; }              /* the chat is the bottom bar's Chat tab (with its count), not a button over the page */
  html.ui-modern .section-tabs-wrap .sec-row > .ops-tabs.ops-wrap, .sec-row > .ops-tabs { overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; scrollbar-width: none; }   /* the section tabs scroll in their own space, clear of More */
  .sec-row > .ops-tabs::-webkit-scrollbar { display: none; }
  .sec-row > .ops-tabs { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }   /* more tabs this way (map review 19) */
}

/* long addresses and codes break instead of running off the screen */
main code { overflow-wrap: anywhere; }

/* the callout's status labels (warnings, Labs) on their own line under the badges, so they and their lists stay on screen */


/* screen review v-17 (30 Nov 2026): a two-column figures list (label | value, like the compliance calendar's Monthly
   Review) stacks on a narrow phone, label above and the value under it at full width. The status-mark label never wraps,
   so side by side it took the room and squeezed long values ("Maintenance due") to one word a line. */
@media (max-width: 600px) {
  table.kv-stack, table.kv-stack tbody, table.kv-stack tr { display: block; width: 100%; }
  html table.kv-stack > tbody > tr { padding: 8px 0; border: 0; border-bottom: 1px solid var(--border); background: none; }
  html table.kv-stack > tbody > tr:last-child { border-bottom: 0; }
  html table.kv-stack > tbody > tr > :is(td, th) { display: block; width: auto; border: 0 !important; padding: 0 !important; text-align: left; background: none; }
  html table.kv-stack > tbody > tr > th[colspan] { padding-top: 10px !important; }
  html table.kv-stack > tbody > tr > td + td { margin-top: 2px; padding-left: 14px !important; overflow-wrap: anywhere; }
  table.kv-stack .mk { white-space: normal; }
}
/* three small figures on a phone: three to a line, never two and one left alone (screen review v-37, 30 Nov 2026) -
   the Available Offline counts and the Follow-Up Actions counts */
.op-counts, .sync-counts:has(> div:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.op-counts > div, .sync-counts:has(> div:nth-child(3):last-child) > div { min-width: 0; padding: 8px 10px; }
.op-counts span { font-size: var(--fs-label, .72rem); line-height: 1.25; overflow-wrap: break-word; hyphens: auto; }
/* Kit Lists on a phone: a project with no list yet doesn't repeat "Packed: No list" - its Make List button says it (v-51) */
html:root table.stack > tbody > tr > td:has(> .kit-none:only-child) { display: none; }
