/* P5-7 DESK LAYOUTS (R-1009-49). JD 2026-10-09 11:13 PM, office MacBook,
   enrolled, verbatim: "On the MacBook, when I click Storm, I'm still looking
   at an iPhone view. I want it to look like a computer screen."
   One file, one <link> line per page (storm, fleet-map, safety, tree-shop,
   Home), linked after the page's own sheets. EVERYTHING that changes a
   layout sits inside ONE media query, min-width 900px: under 900 px the
   device layouts JD approved are untouched. The only rule outside it hides
   the desk-only convoy table (web/desk-tables.js) on a device.
   No words here (no `content:` text). Colours are the storm-look values. */

.dk-convoy { display: none; }

@media (min-width: 900px) {

  /* ---- shared: P5-92 (JD 2026-10-13 6:05 PM: "it doesn't have the
     favorites dock at the bottom. On this MacBook like it does on my
     iPhone."): the dock stays at desk, one row of four (bottom-bar.js caps
     it at 1200 px and centres it); the rule that hid it here is removed --- */
  /* P5-86: the page foot is storm-look.css's one rule (the hidden bar
     publishes 0 px); the fixed 24 px that was here is removed */

  /* ======================= 1. STORM (storm.html) ======================== */
  body.storm:not(.fleet) .st-phone { max-width: 1440px; padding: 0 24px 24px; box-sizing: border-box; }
  body.storm:not(.fleet) .st-head { order: 0; }
  body.storm:not(.fleet) .st-notice,
  body.storm:not(.fleet) .st-modes { order: 1; }
  body.storm:not(.fleet) .st-modes { grid-template-columns: 320px 320px; justify-content: start; padding-left: 0; }
  /* the tab bar becomes a top tab row: not fixed, not at the bottom */
  body.storm:not(.fleet) .st-nav {
    order: 2; position: static; transform: none; left: auto; bottom: auto;
    width: auto; max-width: none; z-index: auto;
    grid-template-columns: repeat(5, minmax(120px, 180px)); justify-content: start;
    padding: 10px 0 8px; border-top: 0; border-bottom: 2px solid var(--st-blue, #0091FF);
  }
  body.storm:not(.fleet) .st-nav a { font-size: 15px; min-height: 48px; }
  body.storm:not(.fleet) .st-phone { padding-bottom: 24px; }
  body.storm:not(.fleet) main#st-main {
    order: 3; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 8px 24px;
    align-content: start; align-items: start; padding: 8px 0 16px;
  }
  body.storm:not(.fleet) #st-main > * { grid-column: 1 / -1; }
  /* HOME tab: the tiles three across */
  body.storm:not(.fleet) #st-screen-home:not([hidden]) { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  body.storm:not(.fleet) #st-screen-home .st-tile { margin: 0; }
  /* CONVOY tab: the table on the left, PROBLEMS in the right column */
  body.storm:not(.fleet) #st-main > #st-screen-convoy { grid-column: 1; }
  body.storm:not(.fleet):has(.st-nav a.on[data-tab="convoy"]) #st-screen-probs[hidden] { display: block !important; }   /* beats storm.css [hidden] !important by specificity */
  body.storm:not(.fleet):has(.st-nav a.on[data-tab="convoy"]) #st-main > #st-screen-probs { grid-column: 2; grid-row: span 6; }
  body.storm:not(.fleet) #st-screen-convoy #st-behind,
  body.storm:not(.fleet) #st-screen-convoy #st-stopped,
  body.storm:not(.fleet) #st-screen-convoy #st-problem,
  body.storm:not(.fleet) #st-screen-convoy #st-rest { display: none; }
  body.storm:not(.fleet) .dk-convoy { display: block; overflow-x: auto; }
  /* PROBLEMS tab: three columns - DOWN | NEED A MECHANIC | IN HAND + FIXED + WATCH */
  body.storm:not(.fleet):has(.st-nav a.on[data-tab="probs"]) #st-probs {
    column-count: 3; column-gap: 24px; column-fill: balance;
  }
  body.storm:not(.fleet):has(.st-nav a.on[data-tab="probs"]) #st-probs > h2:nth-of-type(2),
  body.storm:not(.fleet):has(.st-nav a.on[data-tab="probs"]) #st-probs > h2:nth-of-type(3) {
    break-before: column; -webkit-column-break-before: always;
  }
  body.storm:not(.fleet) #st-probs > * { break-inside: avoid; -webkit-column-break-inside: avoid; }
  body.storm:not(.fleet) #st-probs > h2:first-of-type { margin-top: 0; }

  /* the convoy table */
  .dk-convoy table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; color: #FFF; }
  .dk-convoy th, .dk-convoy td { padding: 8px 7px; text-align: left; border-bottom: 1px solid #1C2634; white-space: nowrap; }
  .dk-convoy th { position: sticky; top: 0; background: #0B0F15; z-index: 1; padding: 0; }
  .dk-convoy th button {
    all: unset; box-sizing: border-box; display: block; width: 100%; min-height: 44px; padding: 10px 7px;
    cursor: pointer; color: #C7C7C7; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  }
  .dk-convoy th button:focus-visible { outline: 3px solid #FFF; outline-offset: -3px; }
  .dk-convoy th[aria-sort="ascending"] button, .dk-convoy th[aria-sort="descending"] button { color: #FFF; box-shadow: inset 0 -3px 0 #0091FF; }
  .dk-convoy td.u { font: 700 16px "SF Mono", Menlo, Consolas, monospace; }
  .dk-convoy tr.behind td.s { color: #FF7070; font-weight: 800; }
  .dk-convoy tr.stopped td.s { color: #FFB020; font-weight: 800; }
  .dk-convoy tr.moving td.s, .dk-convoy tr.problem td.s { color: #3DDC84; font-weight: 800; }
  .dk-convoy tr.problem td.c, .dk-convoy td.dn { color: #FF7070; font-weight: 800; }
  .dk-convoy tbody tr:hover { background: #10161F; }

  /* ======================= 2. FLEET MAP ================================= */
  body.fleet .st-phone { max-width: none; }
  body.fleet main#fm-main {
    display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: repeat(8, auto) 1fr;
    gap: 0 20px; align-items: start; padding: 8px 24px 16px;
  }
  body.fleet #fm-main > * { grid-column: 2; }
  body.fleet #fm-main > #fm-map {
    grid-column: 1; grid-row: 1 / -1; position: sticky; top: 8px;
    height: calc(100vh - 140px); min-height: 420px;
  }
  body.fleet .ff-toggle { display: none; }
  body.fleet #fm-main .fm-list[hidden] { display: block !important; }
  body.fleet .fm-list { max-height: calc(100vh - 360px); overflow-y: auto; padding-right: 4px; }
  body.fleet .fm-sheet { left: auto; right: 24px; margin: 0; width: 400px; max-width: 400px; }

  /* ======================= 3. SAFETY ==================================== */
  body.safety .sf-phone {
    max-width: 1440px; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0 24px;
    grid-template-areas: "head head" "note note" "home stop" "tabs main"; align-items: start; padding: 0 24px 24px;
  }
  body.safety .sf-head { grid-area: head; }
  body.safety .sf-notice { grid-area: note; }
  body.safety .sf-homebar { grid-area: home; padding: 10px 0 0; }
  body.safety #sf-allstop {
    grid-area: stop; justify-self: end; width: 460px; max-width: 100%; margin: 10px 0;
    position: sticky; top: 8px; z-index: 5;
  }
  body.safety .sf-tabs { grid-area: tabs; grid-template-columns: 1fr; padding: 10px 0; position: sticky; top: 8px; }
  body.safety .sf-tab-wide { grid-column: auto; }
  body.safety main#sf-main { grid-area: main; min-width: 0; }

  /* ======================= 4. TREE SHOP ================================= */
  body:has(#ts-screen-home) main[id^="ts-screen"] { max-width: 1280px; margin: 0 auto; padding: 16px 24px; }
  body:has(#ts-screen-home) #ts-screen-home .ts-row { display: inline-block; width: calc((100% - 24px) / 3); margin-right: 8px; vertical-align: top; }
  body:has(#ts-screen-home) #ts-queue-units,
  body:has(#ts-screen-home) #ts-board-units { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; align-items: start; }

  /* ======================= 5. HOME ====================================== */
  #screen-home:not([hidden]) { max-width: 1280px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
  #screen-home .home-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  #screen-home .home-menu > * { margin: 0; min-height: 88px; box-sizing: border-box; }
  #screen-home .home-menu > :not(.home-row) { grid-column: 1 / -1; min-height: 0; }
  #screen-home .home-row--account, #screen-home .home-row--signout { min-height: 56px; }
  #screen-home .fd-banner, body #fd-banner { width: 100%; max-width: none; box-sizing: border-box; grid-column: 1 / -1; }
}
