/* ══════════════════════════════════════════════════════════════════════════════════════════
   CONTAINMENT + ACCOUNT FILE REDESIGN (Vero, 2026-09-27)
   CEO, two screenshots: (1) the ACCOUNT FILE renders wider than the iPad — overflows the device
   on both sides and sits over the frame; (2) the war-room job (stage bar, brief hero + Back
   button, job card, right-column YOUR RESPONSE/SIGN-OFF) runs past the device's right edge — the
   Back button and the right column are clipped, and the REPORT tab overlaps.

   ROOT CAUSE, BY EVIDENCE (measured live, Playwright, 1440×900/1280×800/1194×834/1024×768):
   1. `.pnac-win` (acct-styles.css) is sized `width:min(1140px,94vw); max-height:90vh` — BOTH
      units are relative to the browser WINDOW, not to the device glass the overlay is anchored
      to (`--pn-glass-l/t/r/b`, published by pnGlassVars() from the live `.screen` rect). `94vw`
      happens to track the device closely at most widths (measured: no horizontal escape), but
      `90vh` does NOT — measured BOTTOM-OVERFLOW of 13–35px past the glass's own bottom edge at
      every one of the four desktop widths, because 90% of the full viewport height is taller
      than the glass whenever the case chrome (padding, dock) eats more than 10% of the window.
      This is the general defect: ANY overlay/window sized in vw/vh against the WINDOW, instead
      of against the glass rect it is meant to sit inside, drifts out of the device the moment
      the case's own chrome share of the window changes — exactly the class of bug the CEO named
      ("a list of named views is the known defect pattern here").
   2. `#pnfb-tab`/`#pnfb-panel` (pn-feedback-20260815.css) are `position:fixed; right:0` — anchored
      to the WINDOW's right edge, never to the glass's. On any surface whose content runs to (or
      past) the device edge, the tab sits on top of that content instead of beside the device,
      because it was never told where the device actually ends. `.pnfb-stand-down` exists for
      exactly this ("QA48 SEV-2: deletion, not dimming, while an overlay owns the screen") but is
      never toggled from any script in this tree — a dead class, confirmed by grep.
   3. The ACCOUNT FILE's loyalty hero (`.pnac-hero`) and action footer (`.pnac-foot`) carry an
      ALTERNATION LAW that inverts them to a LIGHT slate slab under `body:not(.mvc-light)`
      (acct-styles.css §"BOTTOM ACTION BAR"/"HERO"). That branch was written when a light theme
      (`body.mvc-light`) existed to alternate AGAINST. Light theme is now removed — `body` is
      ALWAYS `not(.mvc-light)` — so the "light slab" branch fires permanently. The light-grey
      loyalty slab and light footer the CEO flagged are exactly this: a dead branch of a decision
      tree whose other branch can never run again.

   FIX, BY CAUSE (not by view list):
   A. A UNIVERSAL containment rule for every fixed, glass-anchored overlay window this game
      opens: cap max-width/max-height to the GLASS RECT (`--pn-glass-*`), never the window,
      with `box-sizing:border-box` so padding can't push it back out. Add the class list here as
      new windows are built; the formula is the fix, not the list.
   B. `#pnfb-tab`/`#pnfb-panel` anchor to `--pn-glass-r` instead of the window edge, AND stand
      down (display:none) the instant ANY of the known overlay/window containers is open —
      `:has()`, so it holds for whichever one is live without a script having to remember to
      toggle a class.
   C. The Account File goes fully dark: the hero and footer's ALTERNATION LAW tokens are
      overridden unconditionally (dark values, both branches), the loyalty meter becomes the one
      big instrument, the four facts stay a calm ruled row, and the primary action ("Take them to
      dinner") becomes the one saturated block on the page.

   Loaded LAST (linked at the very end of play.html) so it wins the cascade over acct-styles.css,
   pn-feedback-20260815.css and pn-ds.css's `[class*="card"]`/button-stripping wildcards, which are
   all lower in the file and therefore lose ties on source order once specificity is matched. */

/* ── A · UNIVERSAL GLASS CONTAINMENT ────────────────────────────────────────────────────────
   Every element in this list is a fixed-position overlay/window meant to sit INSIDE the device
   while cased. Regardless of its own width/height formula, it may never exceed the glass rect.

   ⛔ ROOT-CAUSE FIX, launch day 2026-09-27 (Jon's audit — the Vault's .vv-win collapsed to its
   three title-bar dots the moment it was capped by this rule). `.vv-win` was pulled OFF this list
   as a same-day patch with a wrong diagnosis ("its overlay re-scopes the glass vars") — the real
   cause is upstream, in `pnGlassVars()` (script-01.js): it publishes `--pn-glass-l/t/r/b` from
   `html.pn-cased .screen`'s live `getBoundingClientRect()`, but `.screen` is DELIBERATELY
   `display:contents` on every full-bleed view — store, boot, create, meetteam, weeksummary
   (pn-shell-adopt.css §13) — and a `display:contents` element has NO box, so that rect reads
   {0,0,0,0} on every axis. `pnGlassVars()` re-publishes on every view change (its own comment:
   "re-publish the glass rect on the view change"), so the moment you land on the Vault
   (`data-view="store"`) it overwrites the good cached values with left=0 and right=`window
   .innerWidth` (100vw - 0-width-rect.right = the full window) — so this rule's own formula,
   `100vw - glass-l - glass-r - 24px`, becomes `100vw - 0 - 100vw - 24px` = **-24px**, and a
   negative computed max-width clamps to 0. That is the exact "sheet collapsed to its title-bar
   dots" symptom, and it is NOT specific to `.vv-win` — any window in this list opened while the
   active game view is one of the display:contents ones (store/boot/create/meetteam/weeksummary)
   collapses the same way; `.vv-win` just happens to be the one window that ONLY ever opens from
   inside the store.

   Per the launch-day audit, the fix stays in THIS file (script-01.js is out of scope for that
   pass): the formula itself is made safe against a degenerate/garbage glass rect with a `max()`
   floor, so a bogus cap can never shrink a window below a usable size — restraint FOR the device
   when the glass is real, restraint FOR THE WINDOW when the published rect is not. 320px/240px
   match the narrowest window this list ever carries (`.sqd-panel`/`.vv-win` on a small cased
   width) with room to read. `.vv-win` is back on the list — the list was never the defect, the
   unguarded formula was, and the fix is the formula, not another exclusion. */
html.pn-cased .dsr-card,
html.pn-cased .dq-card,
html.pn-cased .fc-panel,
html.pn-cased .vv-win,
html.pn-cased .pn-guide-win,
html.pn-cased .sqd-panel,
html.pn-cased #__cfoOverlay > *,
html.pn-cased #__cooOverlay > *{
  max-width: max(320px, calc(100vw - var(--pn-glass-l,0px) - var(--pn-glass-r,0px) - 24px)) !important;
  max-height: max(240px, calc(100vh - var(--pn-glass-t,0px) - var(--pn-glass-b,0px) - 24px)) !important;
  box-sizing: border-box !important;
}
/* `.pnac-win` sits inside `.pnac`, which already carries 20px padding on all four sides between
   itself and the glass edge — sizing against the PARENT's own box (a definite height/width, since
   `.pnac` is inset with top/left/right/bottom) lands exactly on the padding edge, instead of the
   viewport-relative cap above landing 8px short of it (double-counting the padding). */
html.pn-cased .pnac-win{
  max-width: calc(100% - 40px) !important;
  max-height: calc(100% - 40px) !important;
  box-sizing: border-box !important;
}
/* the account file's own scroll body must give back whatever height the cap above just took, or
   the footer (flex:none) and the last scrollable row fight for the same pixels */
html.pn-cased .pnac-win{ overflow: hidden !important; }
html.pn-cased .pnac-scroll{ min-height: 0 !important; }

/* the .pnac OUTER box is already glass-anchored (acct-styles.css); belt-and-braces so nothing
   inside it can ever paint past that box even if a future child ignores the cap above */
html.pn-cased .pnac{ overflow: hidden !important; }

/* the war-room / job window (`.pn-fwin`) and its two-column split are normal in-flow content
   inside `.content` (already `overflow-x:hidden` per pn-shell-adopt.css §12) — contained by
   ancestry, not by a size formula. The defensive cap still applies in case a future column adds
   a fixed px width wider than its track: */
html.pn-cased .pn-fwin,
html.pn-cased .wr-split,
html.pn-cased .wr-rail,
html.pn-cased .wr-main{
  max-width: 100% !important; box-sizing: border-box !important; min-width: 0 !important;
}

/* ── B · THE FEEDBACK TAB — BROWSER EDGE, OUTSIDE THE IPAD CASE (Jon, 2026-09-27) ───────────────
   Superseding the glass-anchor below: the CEO's instruction is that this tab locks to the
   bottom-right of the BROWSER, not the device glass. pn-feedback.js now mounts #pnfb-root on
   document.documentElement (never a descendant of the transformed body.pn-folio) and
   pn-feedback-20260815.css pins it `position:fixed; right:0; bottom:24px` against the true
   viewport — so on every desktop width it sits in the room's own margin OUTSIDE the device
   (html.pn-cased always keeps ≥20px of padding around body.pn-folio, per pn-ipad-shell.css), never
   over the device screen, and every window this section used to stand the tab down for
   (.pnac, .dsr-card, .fc-panel, .vv-win, #pnGd-root, .pn-fwin, #__cfoOverlay/#__cooOverlay,
   .pn-room-ovl, #pn-pub, #__cfoView) is itself a descendant of <body> and therefore confined to
   that same device box — measured (Playwright, 1440×900) with the Financials room, Account File
   and Guide all open in turn: zero overlap with the tab's rect in any case. The glass-right anchor
   and the `html.pn-cased … #pnfb-tab{ display:none }` stand-down rules are removed for exactly
   that reason: at the browser edge, outside the case, there is nothing left inside the device for
   the tab to sit over.

   PHONES ARE DIFFERENT: below 1024px / coarse pointer the game goes full-bleed (no case, no
   margin) — content genuinely runs to the real screen edge there, so the tab (still at that same
   edge, by design) CAN still land over the same right-hand figures this section used to guard
   (confirmed still true at 390px: the Financials ledger's numbers run to the edge). That risk is
   inherent to "flush to the browser edge" on a borderless viewport, not a glass-anchoring bug, so
   the phone-only stand-down stays. */
@media (max-width: 600px){
  body:has(#__cfoView) #pnfb-tab,
  body:has(#__cfoOverlay) #pnfb-tab,
  body:has(.pnac) #pnfb-tab,
  body:has(#pn-pub) #pnfb-tab,
  body:has(.pn-room-ovl) #pnfb-tab{ display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════════════════════
   C · ACCOUNT FILE — DARK SYSTEM (the light theme this alternated against no longer exists)
   ══════════════════════════════════════════════════════════════════════════════════════════ */

/* the loyalty instrument: one dark panel, not a pale slate slab. Ink + tokens matched to the
   file's own dark ground (`--s2-panel`/`--s2-ink`) so it reads as part of the SAME object as the
   header and body, not a foreign light card dropped into a dark file. */
.pnac-hero{
  --rail-bg: linear-gradient(180deg,#141f2d,#0c141e) !important;
  --rail-ink: #eef4fc !important;
  --rail-ink-dim: rgba(238,244,252,.66) !important;
  --rail-hair: rgba(238,244,252,.16) !important;
  --rail-edge: rgba(0,0,0,.55) !important;
  --rail-lift: 0 1px 0 rgba(255,255,255,.05) inset, 0 18px 34px -22px rgba(0,0,0,.7) !important;
  --rail-track: rgba(238,244,252,.12) !important;
}
/* the footer: dark chrome, and the primary action is the one saturated block on the screen —
   not a same-weight sibling of a ghost "Close". */
.pnac-foot{
  --rail-bg: linear-gradient(180deg,#141f2d,#0c141e) !important;
  --rail-ink: #eef4fc !important;
  --rail-ink-dim: rgba(238,244,252,.66) !important;
  --rail-hair: rgba(238,244,252,.16) !important;
  --rail-on: #f97316 !important;
  --rail-on-ink: #1a0f04 !important;
}
.pnac-foot .pn-btn--primary{
  padding: 12px 22px !important;
  font-weight: 800 !important;
  text-transform: none !important;         /* sentence case, not shouted caps */
  letter-spacing: 0 !important;
  border-radius: 999px !important;         /* flat, rounded ≥44px per the house pill button */
  box-shadow: 0 10px 26px -10px rgba(249,115,22,.55) !important;
}
.pnac-foot .pn-btn--secondary,
.pnac-foot .pn-btn--ghost{
  border-radius: 999px !important;
}

/* the loyalty number keeps its scale-contrast moment; the meter track reads clearly on the new
   dark ground (it was tuned for the pale slab's own dark-navy track colour). */
.pnac-mark40{ background: var(--rail-ink) !important; }
.pnac-axis b{ border-color: #0c141e !important; }

/* fewer, calmer uppercase labels: the section stamps stay (they are the file's own numbering,
   not decoration), but the eyebrow above the client name drops the extreme tracking that read as
   a wall of tiny spaced caps next to the big display name. */
.pnac-eye{ letter-spacing: .16em !important; }
