/* shared-app/frame.css — the page frame factory (slice 2 of the
   2026-09-03 patch batch: docs/PATCH-NOTES-ACCOUNTS-ACCESS-UI-2026-09-03.md,
   "Owner ruling 08:00 ET: layout law for EVERY page"). Round 4's
   through-line ("round 3 fixed pages, round 4 fixes the factories" -
   docs/design/UI-ROUND4-PLAN.md) applies again here: one shared CSS
   sheet gives every page that adopts .sf-frame the same full-width
   layout, fixed chrome and non-shifting drawer, rather than a per-page
   restyle that drifts the next time someone touches one app and not
   the other two.

   TOKENS ONLY. This sheet declares no :root block and no hex literal -
   every colour, radius, spacing and font below names a token
   /dashboard/tokens.css already defines (--ink/--muted/--line/--card/
   --bg/--s1.._s5/--r/--r-cmd/--r-touch/--mono/--sans/--disp/--dur/
   --ease), the same "one token authority" contract entry-app/styles.css
   and setup-app/setup.css already keep (see each file's own header).
   Loaded by entry-app, dashboard-app and setup-app the same way
   shared-app/session-core.js is already imported by all three apps'
   api.js - here, the analogous move for a stylesheet is a <link> in
   each app's own index.html (session-core.js has no CSS of its own to
   set precedent, so this is the natural extension of "one shared
   surface, three doors").

   THE GRID. max-width 1380px + 36px gutters (14px under 767px) is not
   invented here - it is dashboard-app/ledger.css's own `.content` rule,
   read verbatim (the dashboard's grid tokens the layout law calls for).
   A page inside .sf-frame gets the SAME width discipline the dashboard
   already has, instead of a second, slightly-different full-width rule
   that could drift from it.

   NOTHING MOVES. .sf-header (and its optional .sf-filters row) are
   `position: sticky` so they hold their place while .sf-content
   scrolls under them - no eyebrow-then-h1-then-tab restatement (chrome
   law), just the one place a page states its name. The drawer
   (.sf-drawer/.sf-drawer-scrim) is `position: fixed`, exactly the
   pattern dashboard-app/ledger.css's own #drawer already uses (off-
   canvas, slid in with `transform`) - a fixed-position element is
   removed from normal flow, so opening or closing it can never change
   .sf-content's measured box. That is what "opens WITHOUT shifting the
   content" means at the CSS level, not a JS measurement trick. */

.sf-frame {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sf-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  padding: var(--s3) 0 var(--s2);
}
.sf-header-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 36px;
}
.sf-title-wrap { flex: 1 1 auto; min-width: 0; }
.sf-title {
  font-family: var(--disp);
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 1.45rem;
  color: var(--ink);
  margin: 0;
}
.sf-summary {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin: var(--s1) 0 0;
}
.sf-summary[hidden] { display: none; }
.sf-primary-action {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.sf-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
  max-width: 1380px;
  margin: 0 auto;
  padding: var(--s2) 36px 0;
}
.sf-filters[hidden] { display: none; }

.sf-content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: var(--s3) 36px 60px;
}

@media (max-width: 767px) {
  .sf-header-row, .sf-filters, .sf-content { padding-left: 14px; padding-right: 14px; }
}

/* ---- the drawer: reserved/overlay, never a layout participant ------ */
.sf-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 33, 0.45);
  z-index: 88;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.sf-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.sf-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(480px, 94vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 90;
  transform: translateX(102%);
  transition: transform var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
}
.sf-drawer.is-open { transform: none; }
.sf-drawer-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3);
  border-bottom: 1px solid var(--line);
}
.sf-drawer-head h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--disp);
  font-weight: 500;
  font-size: 1.02rem;
  color: var(--ink);
}
.sf-drawer-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.sf-drawer-body {
  padding: var(--s3);
  overflow-y: auto;
  flex: 1;
  font-size: 13.5px;
}

@media (prefers-reduced-motion: reduce) {
  .sf-drawer, .sf-drawer-scrim { transition: none; }
}

/* Opt-in worklists. Reporting/chart routes retain their existing frame.
   Wide tables scroll inside a named, keyboard-focusable region, not the
   document. More usable space comes from layout, not smaller text. */
body[data-tab="mail"] .content,
body[data-tab="customer_service"] .content,
body[data-tab="payment_disputes"] .content { max-width: none; }
.sf-worklist { min-width: 0; width: 100%; }
.sf-worklist .panel { min-width: 0; overflow: visible; }
.sf-worklist .panel:not(:first-child) { margin-top: var(--s3); }
.sf-worklist .panel > h3 {
  font: 600 1.05rem/1.4 var(--sans);
  letter-spacing: normal; text-transform: none;
  color: var(--ink); margin-bottom: var(--s2);
}
.sf-worklist .sf-worklist-toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: var(--s2); margin-bottom: var(--s2); min-width: 0;
}
.sf-worklist .sf-worklist-toolbar > label,
.sf-worklist .sf-worklist-disclosure label {
  display: flex; flex-direction: column; gap: var(--s1);
  font: 400 0.875rem/1.4 var(--sans); color: var(--muted);
  min-width: 0;
}
.sf-worklist .sf-worklist-toolbar select,
.sf-worklist .sf-worklist-toolbar input,
.sf-worklist .sf-worklist-disclosure select,
.sf-worklist .sf-worklist-disclosure input {
  min-width: 0; width: 100%; max-width: 100%; min-height: 40px;
  padding: 8px 10px; font: 400 0.875rem/1.4 var(--sans);
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-cmd);
  box-sizing: border-box;
}
.sf-worklist .sf-worklist-toolbar > label { flex: 0 1 240px; }
.sf-worklist .sf-worklist-toolbar > .sf-worklist-disclosure { margin: 0; }
.sf-worklist .linkbtn, .sf-worklist .pd-ellipsis {
  min-height: 40px; min-width: 40px; padding: 8px 12px;
  font-size: 0.875rem; letter-spacing: normal; text-transform: none;
}
.sf-worklist .sf-worklist-scroll {
  width: 100%; max-width: 100%; overflow-x: auto;
  overscroll-behavior-x: contain; margin: var(--s2) 0;
}
.sf-worklist .sf-worklist-scroll:focus-visible,
.sf-worklist .sf-worklist-disclosure > summary:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}
.sf-worklist .sf-worklist-scroll > table { width: 100%; font-size: 0.875rem; }
.sf-worklist .sf-worklist-scroll th {
  font: 600 0.8125rem/1.4 var(--sans); letter-spacing: normal;
  text-transform: none; color: var(--muted); padding: 10px 12px;
}
.sf-worklist .sf-worklist-scroll td { padding: 10px 12px; vertical-align: middle; }
.sf-worklist .sf-worklist-scroll td:first-child { white-space: normal; }
.sf-worklist .sf-worklist-disclosure { margin: var(--s2) 0; min-width: 0; }
.sf-worklist .sf-worklist-disclosure > summary {
  cursor: pointer; min-height: 40px; padding: 10px 0;
  font: 500 0.875rem/1.4 var(--sans); color: var(--ink);
  text-transform: none; letter-spacing: normal;
}
.sf-worklist .sf-worklist-state {
  padding: var(--s3) 0; border-bottom: 1px solid var(--line);
  font: 400 0.9375rem/1.5 var(--sans); color: var(--ink);
}
.sf-worklist .sf-worklist-state h3 { margin: 0 0 var(--s1); font-size: 1rem; }
.sf-worklist .sf-worklist-state p { margin: var(--s1) 0; color: var(--muted); }
.sf-worklist .cs-empty .lg-eyebrow { font: 600 0.875rem/1.4 var(--sans); letter-spacing: normal; text-transform: none; }
@media (max-width: 767px) {
  .sf-worklist .sf-worklist-toolbar > label { flex: 1 1 100%; }
  .sf-worklist .sf-worklist-toolbar > .linkbtn { flex: 1 1 auto; }
  .sf-worklist .sf-worklist-scroll { margin-top: var(--s2); }
}
