/* ============================================================================
   ONE SHELL (UI/UX PR 1, 2026-11-19)
   ----------------------------------------------------------------------------
   An audit of the live app at 390px found the phone running two shells at
   once: the old header (a hamburger, the mark and name, an "Idle" pill, a
   32px Search), the old Today dashboard under it with a floating composer
   over its Inbox, the tab bar, and the new chat as a sheet on top of all of
   it — while a desk landed on the approved beta design. The owner's calls,
   that day: the product is Scout; on a phone the bottom bar is the ONLY way
   round (no drawer); its first tab is Scout's chat. This file is what makes
   that true, plus the four rules that belong to no one page:

   1. The phone: a header of the name and Tickets, the chat docked above the
      bar as the Scout tab, no hamburger, no drawer, no status pill.
   2. One mark: the sidebar's red diamond, wherever the brand is drawn.
   3. A 44px floor for every button under a coarse pointer (`--tap-min`).
   4. No keyboard hints where there is no hover — a touch screen, which is
      also the screen with no keyboard to press them on.
   5. A loading outline, so the first paint is the shape of the app.
   6. The goal check-in above a phone's composer as a one-line chip.

   Last in the cascade (index.html), after beta-shell.css, so it is the final
   word. Every phone rule is inside `max-width: 720px` (`isPhone` in app.js);
   the floor and the hints are input-type queries, never widths, so a 1440px
   desk with a mouse is unchanged by anything here.
   ============================================================================ */

/* `--tap-min` (44px) is a token: tokens.css, TOUCH, since 2026-11-20. */

/* The mark, once (`.sb-logo` in the sidebar draws the same shape in SVG): a
   rounded square turned 45°, in the brand red. A mask, so it follows
   `--primary` into the dark theme rather than baking a colour in. */
:root {
  --mark-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Crect x='4' y='4' width='10' height='10' rx='2' transform='rotate(45 9 9)'/%3E%3C/svg%3E");
}

/* ---------- 2. one mark ------------------------------------------------------
   The page header's `.mark` was the red square with a white diamond cut out
   of it, beside a sidebar that drew the plain red diamond — two marks for one
   product, and on a phone the drawer added a third, the bear. */
.brand .mark {
  width: 18px; height: 18px; flex: none; border-radius: 0; box-shadow: none;
  background: var(--primary);
  -webkit-mask: var(--mark-mask) center / 100% no-repeat; mask: var(--mark-mask) center / 100% no-repeat;
}
#topbar .brand { display: inline-flex; align-items: center; gap: 8px; }
/* The rail's top (the drawer on a tablet, the collapsed sidebar on a desk)
   wears the mark too. The drawing stays in the document — it is the rail's
   status surface for a reader (`paintMascots` names the button "Home ·
   Scout · <state>"), and the mascot tests move it rather than rebuild it —
   but it is not what the brand looks like any more. */
#rail-mascot .mascot { display: none; }
#rail-mascot::before {
  content: ""; display: block; width: 22px; height: 22px; margin: auto;
  background: var(--primary);
  -webkit-mask: var(--mark-mask) center / 100% no-repeat; mask: var(--mark-mask) center / 100% no-repeat;
}
#rail-mascot { display: grid; place-items: center; }

/* ---------- 1. the phone ------------------------------------------------------ */
.top-tickets { display: none; }

@media (max-width: 720px) {
  /* The header: the name on the left, Tickets on the right, and Stop while a
     turn runs (style.css hides it otherwise). The menu went with the drawer;
     Search is in More; Team is a tab; the status word is the chat's own
     business, said in the chat. Two ids, so each beats the rules that give
     these buttons a display of their own. */
  #app #topbar :is(#chat-toggle, #nav-toggle, #status, #open-team, #open-search, #open-computer, #mb-more, #wb-toggle, #sp-toggle-page) { display: none; }
  #app #topbar {
    min-height: 56px; box-sizing: border-box; gap: 8px;
    padding: env(safe-area-inset-top) calc(6px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
  }
  #app #topbar .brand { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.01em; }
  #app #topbar .top-tickets {
    display: grid; place-items: center; position: relative; flex: none; margin-left: auto;
    width: 44px; height: 44px; padding: 0; border: 0; border-radius: 22px;
    background: transparent; color: var(--text); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  #app #topbar .top-tickets .ic { stroke-width: 1.8; }
  #app #topbar .top-tickets:active { background: var(--b-hover); }
  #app #topbar .top-tickets:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

  /* The drawer is gone from a phone: nothing opens it (its buttons are not
     drawn), and the chat's Menu went with it. */
  #sheet #sheet-menu { display: none; }
  /* So the title sits in the middle column on its own, Tickets on the right. */
  #sheet .sheet-bar > .sheet-who { grid-column: 2; }
  #sheet .sheet-bar > #sheet-tickets { grid-column: 3; }

  /* The chat as the Scout tab (`is-docked`, app.js `openSheet`): the whole
     screen, the bar floating over its foot as it floats over every page, no
     grabber because there is nothing under it to drag down to. The box sits
     above the bar by the room every page keeps for it (`#main`'s 96px). It
     arrives and leaves the way a tab does — a short fade — never a sheet
     rising, because it did not come from anywhere. */
  #sheet.is-docked {
    inset: 0 0 var(--kb, 0px) 0; border: 0; border-radius: 0; box-shadow: none;
    padding-top: env(safe-area-inset-top);
    animation: ph-fade-in 120ms linear;
  }
  #sheet.is-docked.is-leaving { animation: ph-fade-out 100ms linear both; }
  #sheet.is-docked #sheet-grab { display: none; }
  #sheet.is-docked #sheet-head { padding-top: 2px; touch-action: auto; }
  #sheet.is-docked #sheet-dock { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  /* With the keyboard up the bar steps away (phone.css), so the box sits on
     the keys. */
  :root.kb-open #sheet.is-docked #sheet-dock { padding-bottom: 8px; }
  /* Above the chat, which it would otherwise sit under (the sheet is 45);
     More's dim (46, later in the document) and every sheet above it still
     cover it. */
  #tabbar { z-index: 46; }

  /* Scout's tab wears the mark, not a tile: the red diamond, as the
     sidebar draws it. */
  #tabbar #tab-home > svg.ic { background: none; box-shadow: none; padding: 2px; }
  #tabbar #tab-home .mark-glyph { fill: var(--primary); stroke: none; }

  /* ---- 6. the check-in, as one line ----
     "Scout checked in on "…"" with See suggestion and ✕ took about a third
     of the screen over the composer. Folded, it is one 44px chip — the dot
     and the title, ellipsed; a tap opens it to the whole title and its two
     buttons (goals-pane.js `renderNotice`). */
  #goal-notice .goal-notice {
    flex-wrap: wrap; gap: 0 4px; margin: 0 12px 8px; padding: 0 4px; border-radius: 22px;
  }
  #goal-notice .goal-notice > span { display: none; }
  #goal-notice .goal-notice > .gn-chip { order: -1; }
  #goal-notice .goal-notice:not(.is-open) > :not(.gn-chip) { display: none; }
  #goal-notice .goal-notice.is-open { padding-bottom: 4px; border-radius: 16px; }
  #goal-notice .goal-notice.is-open > .gn-chip { flex-basis: 100%; }
  #goal-notice .goal-notice.is-open .gn-chip-text { white-space: normal; }
}
.gn-chip { display: none; }
@media (max-width: 720px) {
  #goal-notice .gn-chip {
    display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 8px;
    border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .gn-chip-dot { flex: none; width: 8px; height: 8px; border-radius: 4px; background: var(--blue); }
  .goal-notice.warn .gn-chip-dot { background: var(--err); }
  .gn-chip-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gn-chip-chev { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--dim); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--dur-quick) var(--ease-snap); }
  .goal-notice.is-open .gn-chip-chev { transform: rotate(180deg); }
  #goal-notice .gn-chip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 18px; }
}
/* Today's three figures, three across on a phone. results.css says so ("Three
   across, not two and an orphan: the three figures are read together"), and
   revamp-shell.css's wrapping row (`flex: 1 1 120px`, 24px gaps: 408px of
   floor in a 358px column) undid it, so a 390px phone read two and an
   orphan — the ui-flows finding that was reported on every phone run. The
   floor goes to zero so the three share the row. */
@media (max-width: 720px) {
  #app .td-stats-row { flex-wrap: nowrap; gap: 12px; }
  #app .td-stat { flex: 1 1 0; min-width: 0; }
}
@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  #sheet.is-docked, #sheet.is-docked.is-leaving { animation-duration: 80ms; }
  .gn-chip-chev { transition: none; }
}

/* ---------- 3. a thumb's 44px --------------------------------------------------
   The audit measured the header's Search at 32×32, a ticket's Review and
   Reject at 32, Library's Download and Delete at 32, and the check-in's See
   suggestion and ✕ at 32 — each a button somebody had sized for a mouse,
   and each needing its own patch once it was found. This is the floor
   instead: under a coarse pointer, no button is shorter than `--tap-min`.

   `!important` because it is a floor, not a style: the rules it has to beat
   are dozens of `height: 32px; min-height: 32px` written for a desk at
   higher specificity, and a floor that loses to any of them is not one. The
   exemptions are the buttons that already reach 44px another way and whose
   drawn size is the design — each grows its press with a positioned
   `::after` (the composer's + and send, the Library's pin and the quick
   tag and toast closes, style.css's coarse-pointer block) — and links set
   as words in a line of text, which WCAG 2.5.8 exempts and which a 44px box
   would tear out of their sentence. */
@media (pointer: coarse) {
  button:not(.tap-ext, .composer-bar *, .linkish, .linklike, .qt-x, .pin, .tag-chip, .cz-ask-go) {
    min-height: var(--tap-min) !important;
  }
  /* An icon alone is as wide as it is tall; a word is wider already. */
  button:is(.cp-icon, .sheet-ic, .ghost.small, .mb-btn, .x, .setup-x):not(.tap-ext) { min-width: var(--tap-min); }
}

/* ---------- 4. no keyboard hints without a keyboard ----------------------------
   "J K to move" over the Inbox and an "A" and an "N" on Review and Reject
   are promises a touch screen cannot keep. `hover: none` is the touch screen
   — a desk's narrow window still has the keyboard, and keeps them. The keys
   themselves still work for a phone with one attached, and each button still
   says its key in `aria-keyshortcuts`. The Keyboard shortcuts sheet keeps its
   own, being the list of them. */
@media (hover: none) {
  .td-keys, .td-kbd, .sb-kbd, .set-kbd, button kbd, .rp-kbd { display: none !important; }
}

/* ---------- 5. the first paint ---------------------------------------------------
   For about a second after a load the page was New chat, Search, More and an
   empty middle: the markup's furniture with nothing in it, while app.js and
   /config arrive. `booting` is on #app until /config answers (app.js
   `loadConfig`), so while it is, the empty middle draws the outline of what
   is coming — a sidebar column on a desk, a header line on a phone, and the
   composer's rounded box — in the hairline colour, so it reads as the page
   being laid out rather than as content. A slow shimmer, and none at all
   for someone who asked for less motion. Pseudo-elements on #main, so there
   is no markup to forget to remove: the class going is the outline going. */
@keyframes os-breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
#app.booting #main::before, #app.booting #main::after {
  content: ""; position: absolute; pointer-events: none; z-index: 1;
  border: 1px solid var(--line); background: var(--card-2, var(--surface-2));
  animation: os-breathe 1.6s ease-in-out infinite;
}
/* The composer's box, where the fresh chat puts it. */
#app.booting #main::after {
  left: 50%; bottom: 28px; width: min(720px, calc(100% - 32px)); height: 56px; transform: translateX(-50%);
  border-radius: 26px; background: var(--surface);
}
/* A greeting line above it. */
#app.booting #main::before {
  left: 50%; top: 38%; width: min(280px, 60%); height: 28px; transform: translateX(-50%);
  border: 0; border-radius: 14px;
}
@media (min-width: 821px) {
  /* The sidebar's column: on a desk the rail and the docked list draw
     their own furniture already; their rows are filled once /config lands,
     so their empty middle gets three row outlines. */
  #app.booting #threads::after {
    content: ""; position: absolute; left: 12px; right: 12px; top: 120px; height: 132px; pointer-events: none;
    background:
      linear-gradient(var(--card-2), var(--card-2)) 0 0 / 70% 14px no-repeat,
      linear-gradient(var(--card-2), var(--card-2)) 0 44px / 55% 14px no-repeat,
      linear-gradient(var(--card-2), var(--card-2)) 0 88px / 62% 14px no-repeat;
    animation: os-breathe 1.6s ease-in-out infinite;
  }
  #app.booting #threads { position: relative; }
}
@media (max-width: 720px) {
  #app.booting #main::after { bottom: calc(108px + env(safe-area-inset-bottom)); border-radius: 22px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  #app.booting #main::before, #app.booting #main::after, #app.booting #threads::after { animation: none; }
}
