/* ═══════════════════════════════════════════════════════════════════
   Minimum clickable hitbox: 32×32 px (desktop), 44×44 px (touch).
   (WCAG 2.5.8 minimum is 24×24; we use 32 because 24 didn't feel
   different enough to users on a standard desktop display.)
   When an icon is smaller than this, expand the button's padding or
   use min-width/min-height — NEVER enlarge the icon itself. Use
   display: inline-flex + align/justify-center to keep the glyph
   optically centered inside the larger hit area.
   See src/tests/clickable-hitboxes.test.ts for the enforcement check.
   ═══════════════════════════════════════════════════════════════════ */

/* FRG-028 follow-up #2 — icons inside clickable elements must not
   capture pointer events. Without this rule, clicks that land on the
   SVG (or the pre-hydration Lucide <i> placeholder) can "die" on the
   icon instead of reaching the button/link's click handler. Making
   icons transparent to pointer events guarantees the host element is
   always the target. This is a standard design-system pattern. */
button svg,
a svg,
[role="button"] svg,
.clickable svg,
[onclick] svg,
button i,
a i,
[role="button"] i,
.clickable i,
[onclick] i {
  pointer-events: none;
}

/* Extra coverage for icon wrappers whose parent is a <div>/<span> with
   cursor:pointer (not a <button>/<a>), so the global rule above doesn't
   match them. Forge has a few of these: the sidebar Projects toggle
   (#projects-toggle is a <div>), and any element whose role is an icon
   wrapper (.chev, .projects-chev, generic .icon). */
#projects-toggle svg, #projects-toggle i,
.project-head svg, .project-head i,
.chev svg, .chev i,
.projects-chev svg, .projects-chev i {
  pointer-events: none;
}

:root {
  /* HAT-HVH-0000392 — see the note on the dark block. Declared on both
     themes so the browser is never left guessing which way to paint the
     controls it owns. */
  color-scheme: light;
  /* ── THE PRODUCT'S PALETTE (2026-11-20, Mezzor OS logo pack, "Granary") ──
     The pack's values, written ONCE here and once in public/js/product.js
     (BRAND_COLOURS); src/tests/brand-palette.test.ts fails if they differ or
     if an old brand literal comes back. Every other rule uses these tokens.
     A workspace's own branding still overrides --brand/--accent at runtime
     (white-label.js); these are the product's own, and the fallback. */
  --mz-navy: #101B2B;   /* working dark */
  --mz-deep: #0A1220;
  --mz-paper: #F3F2EE;
  --mz-blue: #1E5A8A;   /* signature blue */
  --mz-brass: #D9A441;  /* accent: the pellet */
  --brand: var(--mz-blue);
  --brand-hover: color-mix(in srgb, var(--mz-blue) 88%, #ffffff);
  --brand-faint: color-mix(in srgb, var(--brand) 12%, transparent);
  --brand-soft: color-mix(in srgb, var(--brand) 28%, transparent);
  --brand-strong: color-mix(in srgb, var(--brand) 55%, transparent);
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-alt: #fafafb;
  /* FRG-218 — the plate a third-party logo sits on. Deliberately the SAME
     value in both themes, which is why it is not just --surface: an uploaded
     company logo is artwork we did not make and cannot recolour, and most are
     drawn for a light background. A dark-on-transparent PNG would disappear
     against a dark header. Giving it a constant near-white plate means one
     asset reads correctly in both themes instead of half of them vanishing
     at night. Restated in the dark block with the same value, on purpose. */
  --logo-plate: #ffffff;
  --sidebar-bg: var(--mz-navy);
  --sidebar-text: #d1d1d6;
  --sidebar-muted: #8a8b94;
  --sidebar-hover: #24252f;
  --border: #e6e6ea;
  --text: #1a1b23;
  /* Muted text was tuned against --bg alone, so it fell under 4.5:1 the moment
     it sat on any surface below it — a chip, an inset, a table head. Tuned
     against the darkest surface it actually lands on instead. */
  --text-muted: #606169;
  --danger: #d64545;
  /* The same red, dark enough to read as small text: #ef4444 was used raw in a
     dozen places and sits at 3.5:1 on the page. --danger stays the fill. */
  --danger-text: #c0392b;
  /* Status colours are picked to read as green/amber on a dark chip; as text
     on a light page they land near 2:1. Same split as --brand vs --brand-text. */
  --success-text: #12703a;
  --warn-text: #8a5a00;
  /* Status FILLS. Badges and callouts were painted with opaque dark hexes
     (#3b2a2a, #3a3020, #1f3a2d…) chosen against the dark theme, which is what
     left dark lozenges and dark callout blocks on the light page. A translucent
     tint of the status hue takes the colour of whatever surface it lands on, so
     one value is correct in both themes and pairs with the *-text ink above. */
  --danger-tint: rgba(214, 69, 69, 0.13);
  --warn-tint: rgba(212, 163, 50, 0.18);
  --success-tint: rgba(45, 160, 105, 0.15);
  --info-tint: rgba(74, 144, 217, 0.15);
  --neutral-tint: rgba(128, 128, 128, 0.14);
  /* Info ink, for the info badge on its tint (the other statuses already had one). */
  --info-text: #1f5a9e;
  /* Danger ink for the shared badge and the urgent priority pill. A row's hover
     tint sits under the danger tint, and --danger-text measured 3.97:1 there
     (light). This clears 5.2:1 on that stack, with margin for brand-tinted
     hovers. Scoped to the badge and pill; --danger-text is unchanged. */
  --danger-ink: #a12f20;
  /* Badge inks (util/ui-list.js badgeHtml). Light is the matching --*-text;
     measured on a hovered row, every staging brand: ui-list-contrast.test.ts. */
  --success-ink: #12703a;
  --warn-ink: #8a5a00;
  --info-ink: #1f5a9e;
  --neutral-ink: #606169;
  /* The one hover/selection tint (Drive's measured 10%: at 16% muted text
     fell to 4.11:1). Today, the calendar and Work Schedule each declared it
     locally; the shared list layer uses this. */
  --row-tint: color-mix(in srgb, var(--brand) 10%, var(--surface));
  --violet-tint: rgba(139, 92, 246, 0.16);
  --danger-faint: rgba(214, 69, 69, 0.1);
  --success: #639922;
  --warn: #ef9f27;
  --warning: #efbb3a;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.18);

  /* FRG-063 — chat reading tokens. Theme-independent metrics live here;
     the two colours are overridden per theme below. */
  --msg-fs: 15px;          /* was a hardcoded 14px — too tight to read at length */
  --msg-lh: 1.46;
  /* HAT-HVH-0000723 — ONE horizontal gutter for the whole chat pane (header,
     messages, date markers, thread, composer), so the avatars no longer sit
     jammed against the channel-list divider and everything lines up on the
     same edge. Was 20px, scattered across six rules. Mobile keeps its own
     12px override further down. */
  --chat-gutter: 28px;
  --msg-row-y: 7px;        /* first row of a group */
  --msg-row-y-grouped: 2px;
  --msg-hover: #f0f0f3;
  --code-bg: #f4f4f7;
  --link: #2f5bd8;         /* 5.4:1 on --bg */

  /* ── UI-GLASS (2026-11-12): materials and quiet ink ───────────────
     The colour half of the design tokens (the metric half is the second
     :root block below the dark theme). Pieter: "too big and heavy";
     BigJoe: an Apple feel, Forge's own colours. So the weight comes out of
     the CHROME — hairlines instead of borders, translucent fills instead of
     outlined boxes, glass on the bars — never out of the reading text.

     Glass is a translucent fill plus a background blur, and only where
     content actually passes underneath (bars over a scrolling list, sheets
     and popovers over the page). --glass-*-solid is the opaque fallback,
     painted FIRST everywhere; the translucent value is only applied inside
     @supports(backdrop-filter) on html:not(.glass-off), so a browser
     without blur, a cheap phone, or reduce-transparency gets a solid bar
     rather than text over unblurred text.

     Alpha is set by CONTRAST, not taste: at 0.82 the worst backdrop (pure
     black under the light bar, pure white under the dark one) still keeps
     --glass-ink-muted at 4.5:1. ui-glass-tokens.test.ts measures it. */
  --glass-bar: rgba(249, 249, 251, 0.82);
  --glass-bar-solid: #f9f9fb;
  --glass-sheet: rgba(255, 255, 255, 0.86);
  --glass-sheet-solid: #ffffff;
  --glass-edge: rgba(0, 0, 0, 0.09);
  --glass-ink: #1a1b23;
  --glass-ink-muted: #505159;
  /* Hairline separators and the translucent control fills that replace
     outlined boxes (Apple's "fill" tiers). */
  --separator: rgba(0, 0, 0, 0.09);
  --fill-1: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.20);
  --scrim: rgba(0, 0, 0, 0.32);
  /* Elevation: softer and wider than --shadow-*, which stay for the screens
     not yet moved onto these tokens. */
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.05);
  --elev-2: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  --elev-3: 0 12px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);

  /* ── Theme contract ────────────────────────────────────────────────
     theme.js resolves the stored preference to a literal light/dark and
     writes it to html[data-theme]. That attribute is the ONLY signal a
     stylesheet may read: CSS must never consult prefers-color-scheme,
     or a user on a dark OS who chose the light theme gets both at once.

     Everything below is a token that components already reference. They
     were referenced before they were defined, so every `var(--x, literal)`
     fell through to its literal — and those literals were written while
     looking at the dark theme. That is the single reason light mode came
     out dark in so many places, and why the handful authored the other way
     came out light in dark mode. Defining them here fixes every call site
     at once; the fallbacks in components become dead code rather than the
     thing actually painting the pixel.
     ────────────────────────────────────────────────────────────────── */

  /* Raised/recessed fills that sit ON --surface, not instead of it. */
  --surface-2: #ebecf0;
  --surface-3: #dfe1e6;

  /* Aliases — components reached for these names; point them at the real
     token rather than teaching every component a different vocabulary. */
  --bg-primary: #f7f7f8;
  --bg-secondary: #ffffff;
  --bg-alt: #fafafb;
  --text-primary: #1a1b23;

  /* Overlay fills. These must be tinted with the theme's own ink: a white
     overlay is invisible on a light page, which is what made hover and
     input states vanish in light mode. */
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-subtle: rgba(0, 0, 0, 0.03);
  --bg-input: rgba(0, 0, 0, 0.025);
  --panel: rgba(0, 0, 0, 0.025);

  --accent: var(--mz-brass);       /* brand accent — a FILL colour, never text */
  /* The same brand, adjusted for use AS text. A colour picked for a logo has
     no reason to clear 4.5:1 against the page, and the workspace's choice
     should not be overruled just because one label is printed in it — so the
     fill keeps the exact brand and the foreground gets its own token.
     white-label.js recomputes both per theme from the workspace colour. */
  /* Derived, not picked: white-label.js againstSurface(colour, --surface-2,
     4.5) applied to the pack's blue and brass (blue already clears it). */
  --brand-text: #1E5A8A;   /* = --mz-blue: it already clears 4.5:1 (the contract wants a hex here) */
  --accent-text: #846427;
  --brand-subtle: color-mix(in srgb, var(--brand) 15%, transparent);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Foregrounds for coloured fills. Text on a brand/status swatch cannot
     use --text: the fill does not change with the theme, so the ink must
     not either. */
  --on-brand: #ffffff;
  --on-accent: #1a1b23;   /* inkOn(brass), white-label.js */
  --on-warn: #3a2a05;
  --on-danger: #ffffff;
  --on-success: #10240f;   /* white clears only 3.5:1 on --success; dark ink clears 4.9:1 */

  /* ── The call surface ────────────────────────────────────────────
     FRG-200 introduced these on `forge-call-view`. They live on :root now,
     for one specific reason: the picture-in-picture window renders in its OWN
     DOCUMENT. It has no <forge-call-view> element, so an element-scoped token
     never reaches it — every var() in .vp-chat and .vchat-* would have fallen
     through to its literal fallback, silently, and the PiP would have stopped
     tracking the theme the moment those rules were converted.

     The surface is deliberately dark in BOTH themes (the Zoom/Meet
     convention). The point is not to make it light — it is to express that
     dark surface in tokens that SHIFT with the theme, exactly as --sidebar-*
     already does, rather than in literals that ignore it. The derived tokens
     follow --sidebar-*, which is restated for dark below; the white-alpha
     ones are identical in both because they sit on a dark ground either way. */
  --call-surface: var(--sidebar-bg);
  --call-surface-alt: var(--sidebar-hover);
  /* The modal's gradient ends, as tokens rather than inlined, so the whole
     surface can be re-themed from one place. */
  --call-modal-from: #2a2b37;
  --call-modal-to: #16171f;
  --call-scrim: rgba(0, 0, 0, 0.6);
  --call-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);

  --call-ink: var(--sidebar-text);
  --call-ink-dim: var(--sidebar-muted);
  /* MTG-49 — readable secondary ink on the call surface.
     --call-ink-dim is #8a8b94, which measures 4.14:1 on the lighter of the two
     call surfaces (#2a2b37) and therefore FAILS AA for small text. It stays as
     it is for the rules that already use it; nothing new goes on it. This one
     measures 5.85:1 on the same surface. */
  --call-ink-sub: #a6a7b0;
  /* The connected dot. Green reads as "live" everywhere else in the product,
     and it is never the only carrier of that meaning — the pill says the word
     Connected beside it. */
  --call-live: #6ee7a8;
  /* 2026-10-21 — a raised hand (call-hands.js). */
  --call-hand: #f5c542;
  --call-on-hand: #1d1600;
  /* The faintest legible tier — timestamps and empty-state text. */
  --call-ink-faint: rgba(255, 255, 255, 0.42);
  /* MTG-81 — ink that can be READ on the accent fill, per brand.
     Specification from the branding session, applied as written. #ffffff
     fails on every light brand, and it sits on every accent-filled control
     in the call — the active chat tab among them. --on-brand-hover is
     generated by white-label.js against the same fill, and it defaults to
     #ffffff, so a workspace with no brand is exactly where it was. */
  --call-on-accent: var(--on-brand-hover);

  --call-line: rgba(255, 255, 255, 0.10);
  --call-line-soft: rgba(255, 255, 255, 0.06);
  --call-field-line: rgba(255, 255, 255, 0.12);

  /* Three tiers of raised surface on the dark ground: a tile, a control, and
     that control hovered. */
  --call-raise: rgba(255, 255, 255, 0.03);
  --call-control: rgba(255, 255, 255, 0.08);
  --call-control-hover: rgba(255, 255, 255, 0.18);

  --call-accent: var(--brand-hover);
  /* MTG-81 — derived from the brand, not a leftover violet.
     These two are the violet BigJoe actually notices: the hover and the
     glow on controls whose fill is already gold. --brand-hover is the
     same lighten() the accent itself uses, and --brand-strong is the brand
     at 0.55 alpha — the exact alpha the hard-coded glow carried, so the
     intensity is unchanged and only the hue follows the workspace. */
  --call-accent-hover: var(--brand-hover);
  --call-accent-glow: var(--brand-strong);
  --call-danger: #ed4245;
  /* Ink ON the danger fill. #ed4245 is dark enough that white sits at 4.6:1,
     and the fill does not change with the theme, so neither does this. */
  --call-danger-ink: #ffffff;
  --call-danger-hover: #f65457;
  /* Status on the dark call surface (2026-10-04): green for on, amber for
     a warning. The light theme's --success-text / --warn-text are ~2.5:1 here. */
  --call-ok: #3ba55d;
  --call-ok-ink: #6fd99a;
  --call-warn: #f0b429;
  --call-warn-ink: #f0cf7a;
  --call-warn-line: #e0b44c;
  /* The ring a badge draws to separate itself from whatever sits behind it. */
  --call-ring: #1a1b25;
  /* Over VIDEO, not over the themed surface. A label on an arbitrary camera
     feed has to stay dark in either theme or it stops being legible against a
     bright frame — so these are the same in both blocks, deliberately. */
  --call-letterbox: #000000;
  --call-video-scrim: rgba(0, 0, 0, 0.45);
  --call-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --call-shadow-rail: 0 12px 32px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] {
  /* HAT-HVH-0000392 — native controls (the <select> popup list, date
     pickers, scrollbars) are painted by the browser, not by our rules.
     With no color-scheme declared the browser assumed light and painted
     the option list white while the option text inherited --text, which
     is near-white here: white on white, invisible. Light mode was
     unaffected, which is exactly what the ticket reported.

     This is the color-scheme PROPERTY keyed off html[data-theme], not a
     prefers-color-scheme media query, so it keeps the theme contract
     above: the stored preference decides, never the OS. */
  color-scheme: dark;
  --bg: #1a1b23;
  --surface: #22232d;
  --surface-alt: #2a2b37;
  /* Same value as light, deliberately — see the note on the light block.
     A logo we did not draw does not follow our theme. */
  --logo-plate: #ffffff;
  --border: #383944;
  --text: #e4e4e8;
  --text-muted: #a6a7b0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  /* FRG-063 — one step off --bg, not three. */
  --msg-hover: #20212b;
  --code-bg: #131419;
  --link: #8ea6ff;         /* 7.4:1 on --bg */

  /* UI-GLASS — see the light block. Same names, stepped for dark. */
  --glass-bar: rgba(30, 31, 40, 0.82);
  --glass-bar-solid: #1e1f28;
  --glass-sheet: rgba(36, 37, 47, 0.86);
  --glass-sheet-solid: #24252f;
  --glass-edge: rgba(255, 255, 255, 0.08);
  --glass-ink: #e4e4e8;
  --glass-ink-muted: #b8b9c2;
  --separator: rgba(255, 255, 255, 0.08);
  --fill-1: rgba(118, 118, 128, 0.20);
  --fill-2: rgba(118, 118, 128, 0.30);
  --scrim: rgba(0, 0, 0, 0.5);
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --elev-2: 0 4px 16px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  --elev-3: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --sidebar-bg: var(--mz-deep);   /* the pack's deep (2026-11-20) */
  --sidebar-hover: #2a2b37;
  --sidebar-text: #c8c8cc;
  --sidebar-muted: #8a8b94;
  /* The palette does not change with the theme; restated as the contract asks. */
  --mz-navy: #101B2B;
  --mz-deep: #0A1220;
  --mz-paper: #F3F2EE;
  --mz-blue: #1E5A8A;
  --mz-brass: #D9A441;
  --brand: var(--mz-blue);
  --brand-hover: color-mix(in srgb, var(--mz-blue) 88%, #ffffff);
  --brand-faint: color-mix(in srgb, var(--brand) 18%, transparent);
  --brand-soft: color-mix(in srgb, var(--brand) 28%, transparent);
  --brand-strong: color-mix(in srgb, var(--brand) 55%, transparent);
  --danger: #e85d5d;
  --danger-text: #f28787;
  --success-text: #4ade80;
  --warn-text: #f0b429;
  /* Slightly stronger against the dark page, where a 13% wash disappears. */
  --danger-tint: rgba(232, 93, 93, 0.18);
  --warn-tint: rgba(240, 180, 41, 0.20);
  --success-tint: rgba(74, 222, 128, 0.16);
  --info-tint: rgba(114, 168, 225, 0.18);
  --neutral-tint: rgba(160, 160, 175, 0.16);
  --info-text: #8fbcf0;
  /* Stepped lighter than --*-text: on the yellow brand's hovered row the old
     inks measured danger 3.96, warn 4.21, info 4.49, neutral 3.81 (dark only). */
  --danger-ink: #ffa3a3;
  --success-ink: #5fe394;
  --warn-ink: #f7c95c;
  --info-ink: #a3cbf5;
  --neutral-ink: #c0c1c9;
  --row-tint: color-mix(in srgb, var(--brand) 10%, var(--surface));
  --violet-tint: rgba(168, 130, 250, 0.20);
  --danger-faint: rgba(232,93,93,0.12);
  --success: #4caf50;
  --warn: #efbb3a;
  --warning: #efbb3a;

  /* Same tokens as :root, stepped the other way. --surface-2/-3 stay ABOVE
     --surface so a chip or inset reads as raised, not as a hole punched in
     the card. */
  --surface-2: #32333f;
  --surface-3: #3d3e4b;

  --bg-primary: #1a1b23;
  --bg-secondary: #22232d;
  --bg-alt: #2a2b37;
  --text-primary: #e4e4e8;

  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-subtle: rgba(255, 255, 255, 0.04);
  --bg-input: rgba(255, 255, 255, 0.05);
  --panel: rgba(255, 255, 255, 0.04);

  --accent: var(--mz-brass);
  /* Forge indigo lands at 2.3:1 on the dark page — unreadable as a label. */
  /* Derived as in light: the pack's blue lifted until it clears 4.5:1 on the
     dark --surface-2 (white-label.js againstSurface); brass already does. */
  --brand-text: #7fa0bc;
  --accent-text: #D9A441;   /* = --mz-brass: it already clears 4.5:1 on the dark surfaces */
  --brand-subtle: color-mix(in srgb, var(--brand) 22%, transparent);

  /* The fills below are light enough that dark ink is the readable choice
     in both themes — these do not flip. */
  --on-brand: #ffffff;
  --on-accent: #1a1b23;   /* inkOn(brass), white-label.js */
  --on-warn: #3a2a05;
  --on-danger: #ffffff;
  --on-success: #10240f;

  /* ── The call surface, restated for dark ─────────────────────────
     The whole vocabulary has to appear here — theme-contract.test.ts fails a
     token declared for light and never restated, because a var() that
     resolves in one theme and falls through to its literal in the other is
     precisely the bug that left dark chips in light mode.

     Most values are IDENTICAL to :root, and deliberately so. The call surface
     is dark in both themes, so a white-alpha line or a danger red is the same
     colour on either. What changes is the two derived tokens: --sidebar-bg
     and --sidebar-hover are restated above, so --call-surface and
     --call-surface-alt shift with the theme without anything here saying so.
     That is the "theme-responsive but always dark" behaviour the ticket asks
     for, and restating them is what proves it rather than assuming it. */
  --call-surface: var(--sidebar-bg);
  --call-surface-alt: var(--sidebar-hover);
  --call-modal-from: #24252f;
  --call-modal-to: #121319;
  --call-scrim: rgba(0, 0, 0, 0.66);
  --call-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);

  --call-ink: var(--sidebar-text);
  --call-ink-dim: var(--sidebar-muted);
  /* MTG-49 — readable secondary ink on the call surface.
     --call-ink-dim is #8a8b94, which measures 4.14:1 on the lighter of the two
     call surfaces (#2a2b37) and therefore FAILS AA for small text. It stays as
     it is for the rules that already use it; nothing new goes on it. This one
     measures 5.85:1 on the same surface. */
  --call-ink-sub: #a6a7b0;
  /* The connected dot. Green reads as "live" everywhere else in the product,
     and it is never the only carrier of that meaning — the pill says the word
     Connected beside it. */
  --call-live: #6ee7a8;
  /* 2026-10-21 — a raised hand (call-hands.js). */
  --call-hand: #f5c542;
  --call-on-hand: #1d1600;
  --call-ink-faint: rgba(255, 255, 255, 0.42);
  /* MTG-81 — ink that can be READ on the accent fill, per brand.
     Specification from the branding session, applied as written. #ffffff
     fails on every light brand, and it sits on every accent-filled control
     in the call — the active chat tab among them. --on-brand-hover is
     generated by white-label.js against the same fill, and it defaults to
     #ffffff, so a workspace with no brand is exactly where it was. */
  --call-on-accent: var(--on-brand-hover);

  --call-line: rgba(255, 255, 255, 0.10);
  --call-line-soft: rgba(255, 255, 255, 0.06);
  --call-field-line: rgba(255, 255, 255, 0.12);

  --call-raise: rgba(255, 255, 255, 0.03);
  --call-control: rgba(255, 255, 255, 0.08);
  --call-control-hover: rgba(255, 255, 255, 0.18);

  --call-accent: var(--brand-hover);
  /* MTG-81 — derived from the brand, not a leftover violet.
     These two are the violet BigJoe actually notices: the hover and the
     glow on controls whose fill is already gold. --brand-hover is the
     same lighten() the accent itself uses, and --brand-strong is the brand
     at 0.55 alpha — the exact alpha the hard-coded glow carried, so the
     intensity is unchanged and only the hue follows the workspace. */
  --call-accent-hover: var(--brand-hover);
  --call-accent-glow: var(--brand-strong);
  --call-danger: #ed4245;
  /* Ink ON the danger fill. #ed4245 is dark enough that white sits at 4.6:1,
     and the fill does not change with the theme, so neither does this. */
  --call-danger-ink: #ffffff;
  --call-danger-hover: #f65457;
  /* Status on the dark call surface (2026-10-04): green for on, amber for
     a warning. The light theme`s --success-text / --warn-text are ~2.5:1 here. */
  --call-ok: #3ba55d;
  --call-ok-ink: #6fd99a;
  --call-warn: #f0b429;
  --call-warn-ink: #f0cf7a;
  --call-warn-line: #e0b44c;
  --call-ring: #12131a;
  /* Over VIDEO, not over the themed surface. A label on an arbitrary camera
     feed has to stay dark in either theme or it stops being legible against a
     bright frame — so these are the same in both blocks, deliberately. */
  --call-letterbox: #000000;
  --call-video-scrim: rgba(0, 0, 0, 0.45);
  --call-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --call-shadow-rail: 0 12px 32px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] img.thumb, html[data-theme="dark"] .drop-zone { filter: none; }
html[data-theme="dark"] .code-block { background: #0e0f16; }

/* ═══════════════════════════════════════════════════════════════════
   UI-GLASS (2026-11-12) — the design tokens: scale.
   The metric half of Forge's design tokens (the colour half — materials,
   hairlines, fills, elevation — is in the two theme blocks above). Every
   restyled surface reads these instead of literals, so the rest of Forge
   can move onto the same look one selector at a time, and the look itself
   can be tuned here once.

   Applied so far to the app shell (bars, tab bar, sheets) and Chat. Other
   screens still use their own literals and the older --shadow-* / --radius.

   The two floors are not negotiable and come from the mobile work: reading
   text never under 16px on a phone (--fs-reading), and a tap target never
   under 44px (--tap). The bulk comes out of padding, borders, weights and
   chrome — not out of text size.
   ═══════════════════════════════════════════════════════════════════ */
:root {
  /* Type scale (Apple's text styles, in CSS px). */
  --fs-caption: 11px;     /* tab-bar labels, badges — never reading text */
  --fs-footnote: 12px;    /* timestamps, meta lines */
  --fs-subhead: 13px;     /* secondary lines, section heads */
  --fs-body: 14px;        /* desktop UI text */
  --fs-reading: 15px;     /* messages and other prose; 16px on a phone */
  --fs-headline: 15px;    /* list-row titles, bar titles on desktop */
  --fs-title-3: 17px;     /* bar titles on a phone */
  --fs-title-2: 20px;
  --fs-title-1: 24px;
  --lh-tight: 1.25;
  --lh-reading: 1.45;
  --tracking-title: -0.01em;
  /* Weights. 600 is the heaviest the restyled surfaces use: 700 is what
     made the old headers read as shouting. */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  /* Spacing — a 4px grid. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  /* Radii. Larger and softer than the old 6-8px boxes; the pill is for
     fields and capsule buttons. */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;
  /* Controls. --control-h is a desktop control's visible height; --tap is
     the touch floor every phone control's hit box keeps. */
  --control-h: 32px;
  --tap: 44px;
  /* Bars. */
  --bar-h: 48px;          /* desktop app bar (was 58) */
  --tabbar-h: 50px;       /* phone tab bar, before the home-indicator inset */
  --hairline: 0.5px;
  /* The material. Blur radius is the cost knob: 20px and up is visibly
     slower on a mid-range phone for little gain over 16. */
  --glass-blur: saturate(180%) blur(16px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-quick: 160ms;
}
@media (max-width: 768px) {
  :root {
    /* The phone floor: reading and list text at 16px. */
    --fs-reading: 16px;
    --fs-body: 16px;
    --fs-headline: 16px;
  }
}

/* Chrome paints autofilled fields with its own near-white wash and ignores
   `background`, so a filled login/profile form kept two glaring light boxes in
   dark mode. The inset shadow is the only thing that overrides it; the long
   transition delay keeps it from flashing back on blur. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
}

body.compact .kanban-col .cards { padding: 4px 6px; gap: 4px; }
body.compact .task-card { padding: 8px; }
body.compact .task-list th, body.compact .task-list td { padding: 6px 8px; }

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-faint);
}

#app { min-height: 100vh; }

/* ----- Login ----- */
/* FRG-075 — the gradient's mid and end stops were the literal Forge indigo
   (dark indigo and the old product violet), so a tenant's login page always rendered the same
   dark purple no matter what brand colour the workspace had set. It now
   layers a brand wash over a neutral dark base: the base stays constant so
   the card keeps its contrast, and the wash follows --brand. */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg);
  background-image: linear-gradient(135deg, transparent 0%, var(--brand-soft) 55%, var(--brand) 100%);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}
.login-card .login-logo {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 18px;
  box-shadow: 0 8px 24px var(--brand-soft);
}
.login-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--brand-text);
  text-align: center;
  /* Phase 4 / Bug C: long unbreakable workspace names
     (e.g. "Hattvest holdingsxfgjhxzsfdtg") used to wrap to three lines
     and stretch the card. Break anywhere so the name stays inside
     the 400px card cap. */
  overflow-wrap: anywhere;
}
.login-card p.subtitle { text-align: center; }
.login-card p.subtitle { margin: 0 0 24px; color: var(--text-muted); }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.login-form input { font-size: 15px; padding: 11px 12px; }
/* U15 — explicit, clearly-visible accent focus ring on the dark login card.
   The global input:focus ring uses --brand-faint (alpha 0.18), which is too
   subtle against the login card so the password field looked like it had no
   focus state. Applies to both email and password for a consistent ring. */
/* FRG-075 — the ring was a hardcoded indigo rgba() and now follows the
   workspace brand. Keeps U15's stronger alpha (--brand-strong, 0.55) so it
   stays visible on the dark login card, where --brand-faint was too subtle.
   Declarations only inside the block: sidebar-layout.test.ts and
   login-branding-tokens.test.ts parse this stylesheet by splitting a rule
   body on ';' and taking the first ':', so a comment placed INSIDE a block
   silently swallows the declaration that follows it. */
.login-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-strong);
  outline: none;
}
.login-form button[type=submit] {
  margin-top: 6px; background: var(--brand); color: var(--on-brand); border: none;
  padding: 12px; border-radius: 8px; font-weight: 600; font-size: 15px;
}
.login-form button[type=submit]:hover { background: var(--brand-hover); }
.login-error { color: var(--danger-text); font-size: 13px; min-height: 18px; }
.login-toggle {
  text-align: center; margin-top: 16px; color: var(--text-muted); font-size: 13px;
}
.login-toggle button { background: none; border: none; color: var(--brand-text); font-weight: 600; }

/* 2FA (2026-10-28) — the second sign-in step (mfa-step.js) and the My profile card (mfa-settings.js). */
.mfa-begin, .mfa-continue, .mfa-choice-btn {
  width: 100%; margin-top: 10px; background: var(--brand); color: var(--on-brand); border: none;
  padding: 12px; border-radius: 8px; font-weight: 600; font-size: 15px; cursor: pointer;
}
.mfa-continue:disabled { opacity: 0.5; cursor: not-allowed; }
.mfa-hint { color: var(--text-muted); font-size: 12px; margin-top: 12px; }
.mfa-qr { display: flex; justify-content: center; margin: 8px 0 12px; }
.mfa-qr svg { width: 200px; height: 200px; background: #fff; border-radius: 8px; padding: 6px; }
.mfa-key { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.mfa-key code { display: block; margin-top: 6px; font-size: 14px; letter-spacing: 0.05em; color: var(--text); user-select: all; word-break: break-all; }
.mfa-codes { columns: 2; gap: 16px; margin: 8px 0; padding-left: 22px; font-size: 14px; }
.mfa-codes code { user-select: all; }
.mfa-code-actions { display: flex; gap: 8px; margin: 8px 0; }
.mfa-saved { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; }
.mfa-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.mfa-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-muted); }
.mfa-pill.on { background: var(--success-tint); color: var(--success-text); }

/* ----- App shell ----- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; transition: grid-template-columns 0.15s ease; }
.shell.collapsed { grid-template-columns: 0 1fr; }
.shell.collapsed .sidebar { display: none; }
/* FRG-080 — .floating-sidebar-btn removed. It was position:fixed at
   top/left 12px, landing directly under the header's own hamburger
   (x 24-64, y 13-45), so collapsing the sidebar stacked two menu icons in
   the same corner. The header hamburger toggles the sidebar both ways on
   every route; the floating one only ever rendered on one of them. */

/* ----- Sidebar -----
   FRG-030: three-region flex layout.
   The <aside> is a flex column with three children:
     .sidebar-pinned-top     — brand + workspace dropdown + top nav links
                               + Projects header row. flex-shrink: 0.
     .sidebar-scrollable     — the projects list. flex: 1 1 auto;
                               overflow-y: auto; min-height: 0.
                               min-height: 0 is the critical bit — without
                               it, a flex child refuses to shrink below
                               its content size and overflow-y never
                               engages.
     .sidebar-pinned-bottom  — Clients / Billing / Retainers + user
                               footer. flex-shrink: 0.
   Authored padding moves onto the inner regions so the scrollbar can
   sit flush against the sidebar's right edge. */
/* FRG-074 — `overflow: hidden` is load-bearing. The sidebar is exactly one
   viewport tall; without this it was `overflow: visible`, so once the flex
   children could no longer be squeezed into 100vh the pinned-bottom region
   (Settings + the user status block) simply painted past the bottom edge,
   off-screen and unreachable. NOTE: declarations only inside these blocks —
   src/tests/sidebar-layout.test.ts parses this stylesheet by splitting on
   ';' and taking the first ':', so a comment inside a block silently eats
   the declaration after it. */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
/* FRG-074 — pinned-top holds the brand, the workspace nav rows and the
   Projects header. It keeps its natural height in normal conditions but is no
   longer flex-shrink: 0.
   The old rule was safe only while `pinned-top + pinned-bottom <= 100vh`.
   Both regions grew (FRG-071 added a "Meeting / Memos" nav row here and a
   "Settings" row to pinned-bottom); once their combined natural height passed
   the viewport there was nothing left to give — the scrollable middle had
   already collapsed to zero — so the user block was pushed off-screen.
   It can now shrink and scroll internally as a LAST resort. The large shrink
   factor on .sidebar-scrollable means the projects list surrenders all of its
   space first, so this only engages on very short viewports. */
.sidebar-pinned-top {
  flex-shrink: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* The one region that must NEVER shrink: it carries Settings and the user
   status block, which have to stay reachable at any viewport height. */
.sidebar-pinned-bottom {
  flex-shrink: 0;
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* grow 1 (FRG-078): this region FILLS the space between the two pinned
   regions, so .sidebar-pinned-bottom — Settings and the user status block —
   sits flush with the bottom of the viewport at any nav length.
   This REVERSES the FRG-030 follow-up, which set grow 0 so a short projects
   list would not strand the bottom items in empty space. Both cannot hold.
   With grow 0, collapsing the Projects section left the user block floating
   mid-sidebar with ~150px of empty sidebar beneath it (measured live on
   staging at 1280x720) — exactly what was reported as "not pinned to the
   bottom". The owner asked for the pinned behaviour explicitly, so it wins.
   Trade-off, deliberately accepted: Clients / Billing / Retainers ride down
   with it, because they share .sidebar-pinned-bottom.
   shrink 10000 (FRG-074, raised in FRG-079): when space runs out this region
   absorbs the pressure before pinned-top starts scrolling. The factor has to
   be this lopsided because flexbox shrinks items in PROPORTION, not in
   priority order — it never fully exhausts one before touching the other.
   At shrink 100 a routine ~190px deficit still leaked ~1.7px onto pinned-top,
   which was enough to make it overflow and paint a scrollbar over the nav on
   an ordinary tall viewport. At 10000 that leak is ~0.02px, so pinned-top
   only ever scrolls once this region has genuinely collapsed to zero — at
   which point flexbox freezes it and redistributes the remainder, which is
   exactly the intended escape hatch. */
.sidebar-scrollable {
  flex: 1 10000 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 0 12px;
}
/* Subtle dark-theme scrollbar so it doesn't feel like an OS intrusion.
   FRG-079 — .sidebar-pinned-top is included. FRG-074 gave it overflow-y:auto
   as a last-resort escape hatch on very short viewports but left it with the
   browser default, so when it did engage it rendered a 15px chunky native
   scrollbar right in the nav area — beside the 8px subtle one on the region
   below it. Measured on staging at a 430px viewport: pinned-top scrollbar
   15px, .sidebar-scrollable 8px. Two mismatched scrollbars in one sidebar is
   the "stray scrollbar element" that was reported. */
.sidebar-scrollable,
.sidebar-pinned-top {
  scrollbar-width: thin;
  scrollbar-color: #3a3b48 transparent;
}
.sidebar-scrollable::-webkit-scrollbar,
.sidebar-pinned-top::-webkit-scrollbar { width: 8px; }
.sidebar-scrollable::-webkit-scrollbar-track,
.sidebar-pinned-top::-webkit-scrollbar-track { background: transparent; }
.sidebar-scrollable::-webkit-scrollbar-thumb,
.sidebar-pinned-top::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 4px;
}
.sidebar-scrollable::-webkit-scrollbar-thumb:hover,
.sidebar-pinned-top::-webkit-scrollbar-thumb:hover { background: #4a4b58; }

/* FRG-030 — Tablet breakpoint: collapse the sidebar to an icon-only rail
   on mid-width screens (769-1023px). Mobile (<=768px) keeps the existing
   off-canvas drawer behaviour defined further down; desktop (>=1024px)
   keeps the full 260px sidebar. The rail is narrow enough for just an
   icon-sized target (per FRG-028's 32x32 hitbox minimum) plus padding. */
@media (min-width: 769px) and (max-width: 1023px) {
  .shell { grid-template-columns: 60px 1fr; }
  .sidebar { width: 60px; padding: 0; }
  .sidebar-pinned-top,
  .sidebar-pinned-bottom,
  .sidebar-scrollable { padding-left: 6px; padding-right: 6px; }
  /* Hide the brand text, workspace dropdown, and link labels — icons
     only. The link icons themselves remain visible so the user can still
     navigate; hover the link to see the native `title` tooltip. */
  .sidebar-brand .name { display: none; }
  .sidebar #ws-select { font-size: 0; padding: 4px; }
  .sidebar .chat-link {
    font-size: 0;
    padding: 8px 6px;
    justify-content: center;
  }
  .sidebar .chat-link > :not(svg):not(i) { display: none; }
  /* Reveal SVG/icon-rendered glyphs only. */
  .sidebar .chat-link svg,
  .sidebar .chat-link i { font-size: 16px; }
  .projects-label { font-size: 0; }
  .projects-label svg { font-size: 16px; }
  /* Project rows: show the project name initial only — hides the long
     name but still tells the user which project they're looking at. */
  .sidebar-scrollable .project-head .name,
  .sidebar-scrollable .sub .item span:not(.icon) { display: none; }
  .sidebar-footer .info,
  .sidebar-footer .status-btn,
  .sidebar-footer .logout { display: none; }
  .sidebar-footer { justify-content: center; }
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid #2a2b36;
  margin-bottom: 14px;
}
.sidebar-brand .logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}
.sidebar-brand .name {
  font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -0.01em;
}
.sidebar-section { margin-top: 18px; }
.sidebar-section h4 {
  margin: 0 8px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-section h4 button {
  background: none; border: none; color: var(--sidebar-muted);
  font-size: 16px; padding: 0 4px; border-radius: 4px;
}
.sidebar-section h4 button:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}
.sidebar-nav .item:hover { background: var(--sidebar-hover); }
.sidebar-nav .item.active { background: var(--brand); color: var(--on-brand); }
.sidebar-nav .item .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #2a2b36;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.sidebar-footer .info { flex: 1; min-width: 0; }
/* 2026-11-11 — a long name took five lines of the pinned footer. Two lines at
   most, then an ellipsis; the whole name is in the title. */
.sidebar-footer .info .name { color: #fff; font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.sidebar-footer .info .email { color: var(--sidebar-muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer .logout {
  background: none; border: none; color: var(--sidebar-muted); font-size: 18px; padding: 4px 6px; border-radius: 4px;
}
.sidebar-footer .logout:hover { color: #fff; background: var(--sidebar-hover); }

/* ----- Main area ----- */
.main { display: flex; flex-direction: column; min-width: 0; }
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 58px;
}
.header .crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
/* --border as ink: the separator sat at 1.2:1 in both themes, which is not a
   subtle separator, it is an invisible one. */
.header .crumbs .sep { color: var(--text-muted); }
.header .crumbs .current { color: var(--text); font-weight: 600; }
.header .crumbs button.toggle {
  background: none; border: none; font-size: 18px; color: var(--text-muted); padding: 0 4px;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.header .right { display: flex; gap: 8px; align-items: center; }

/* feat/header-version-indicator — version chip in the header.
   Always visible; env badge only when not on production.
   Mobile (≤768px) swaps the full label for a single-letter pill
   to preserve real estate (see media query below). */
.header .forge-version {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 8px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: all;
}
.header .forge-version .env-badge {
  display: inline-block;
  background: var(--warn);
  /* White on amber is 2.2:1 — the badge naming the environment you are about
     to change things in should not be the least readable thing on the page. */
  color: var(--on-warn);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 3px;
  line-height: 1.4;
}
.header .forge-version .env-badge.env-pill {
  display: none;
  width: 16px; height: 16px;
  padding: 0;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  letter-spacing: 0;
  font-size: 9px;
}
/* QW1 (UI audit 2026-09-28) — `.btn` outside the header.
   Until now `.btn` / `.btn.ghost` existed ONLY as `.header .btn…`, so the
   ~40 buttons that use `btn`, `btn primary`, `btn small` and `btn ghost`
   elsewhere (Timeline, Sprints, Accounting, Counterparties, Marketing, Sales,
   Settings, Intake, Template picker) rendered as raw browser buttons: grey
   #6b6b6b fill, outset border, square corners, system font — measured on
   Timeline; the sprint "Delete" failed contrast at 2.18:1 because of it.
   Outside the header the markup's convention is `btn primary` = primary and
   plain `btn` / `btn small` = secondary, so plain `.btn` is the neutral
   button (the same values as `.dash-btn`). The header rules below are more
   specific and keep the header exactly as it was. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 600;
  line-height: 1.2; white-space: nowrap;
}
.btn:hover { border-color: var(--brand-text); }
.btn:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand-hover); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

.header .btn {
  background: var(--brand); color: var(--on-brand); border: none;
  padding: 8px 14px; border-radius: 6px; font-weight: 600; font-size: 13px;
}
.header .btn:hover { background: var(--brand-hover); }
.header .btn.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
}
.header .btn.ghost:hover { background: var(--surface-alt); }

.content { flex: 1; overflow: auto; }

/* ----- Empty state ----- */
/* UI-QW4 — the Drive empty-state block (drive-page .dr2-empty), shared.
   Used by Project Drive, Sprints, Check-ins, Time, Git trail, the activity
   panel and the task modal. Several call sites override the padding inline;
   the border, radius and type still apply. */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 40px 16px; text-align: center;
  border: 1.5px dashed var(--border); border-radius: 12px;
  color: var(--text-muted); font-size: 13px;
}
.empty-state h2 { margin: 0; color: var(--text); font-size: 15px; font-weight: 600; }
.empty-state p { margin: 0; max-width: 380px; font-size: 13px; color: var(--text-muted); }
/* Call notes, Marketing and Sales put their LOADING and ERROR messages in an
   .empty-state as the only thing on the page. That is not an empty state, so
   it keeps the plain centred message rather than an empty-folder box. */
.page-shell > .empty-state:only-child { border: none; padding: 80px 20px; }

/* ----- Kanban ----- */
.kanban {
  display: flex;
  gap: 16px;
  padding: 20px;
  min-height: 100%;
  align-items: flex-start;
  overflow-x: auto;
}
.kanban-col {
  flex: 0 0 300px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
}
.kanban-col.drag-over { background: var(--brand-faint); border-color: var(--brand); }
.kanban-col header {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.kanban-col header .title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 13px;
}
.kanban-col header .title .chip {
  width: 10px; height: 10px; border-radius: 50%;
}
.kanban-col header .count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.kanban-col .cards {
  flex: 1; overflow-y: auto;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  min-height: 40px;
}
.kanban-col footer {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
}
.kanban-col .add-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  padding: 8px;
  border-radius: 6px;
  font-size: 13px;
}
.kanban-col .add-btn:hover { color: var(--brand-text); border-color: var(--brand); background: var(--brand-faint); }

/* ----- Task card ----- */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  user-select: none;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.task-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.task-card.dragging { opacity: 0.5; }
.task-card .created-at {
  font-size: 12px; color: var(--text-muted); margin-bottom: 4px;
}
.task-card .title { font-weight: 500; margin-bottom: 6px; line-height: 1.35; }
.task-card .meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted);
}
/* UI-BOARD — priority is the shared badge's tints and inks, in both themes.
   The light-theme hexes had no dark override, so on a dark board every
   priority was a bright light box. The shape is no longer card-only: the
   List view and the task modal had the colours without the padding. */
.priority {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.priority.urgent { background: var(--danger-tint); color: var(--danger-ink); }
.priority.high { background: var(--warn-tint); color: var(--warn-ink); }
.priority.medium { background: var(--row-tint); color: var(--brand-text); }
.priority.low { background: var(--info-tint); color: var(--info-ink); }
.priority.none { background: var(--neutral-tint); color: var(--neutral-ink); }
/* The card's small bits, on classes and the 12px floor (were inline 9-11px). */
.card-est, .card-muted, .card-unassigned { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }
.card-muted { font-style: italic; }
.card-unassigned { padding: 2px 8px; border-radius: 999px; background: var(--neutral-tint); }
.card-timer { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.card-timer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.card-timer.is-running .card-timer-dot { background: var(--success); animation: pulse 1s infinite; }
.card-timer-time { font-family: ui-monospace, monospace; font-size: 13px; font-weight: 600; color: var(--warn-text); font-variant-numeric: tabular-nums; }
.card-timer.is-running .card-timer-time { color: var(--success-text); }
.timer-btn {
  margin-left: auto; min-height: 32px; padding: 0 8px; display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.timer-btn:hover { color: var(--text); border-color: var(--brand-text); }
.timer-btn:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 1px; }
.timer-btn [data-lucide] + *, .timer-btn svg + * { margin-left: 0; }
.card-line { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.done-countdown { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.est-actual { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
@media (max-width: 768px), (hover: none) { .timer-btn { min-height: 44px; } }

.avatar-sm {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.due-date {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-alt); border: 1px solid var(--border);
}
.due-date.overdue { color: var(--danger-text); border-color: color-mix(in srgb, var(--danger-text) 35%, transparent); background: var(--danger-tint); }
.due-date [data-lucide] + *, .due-date svg + * { margin-left: 0; }

/* ----- Modal ----- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 16, 22, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 50px 20px 20px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
/* FRG-211 — `min-width: 0` is what keeps the close button on the card.
 *
 * A flex item's `min-width` defaults to `auto`, which for an <input> resolves
 * to the intrinsic width implied by its `size` attribute (~180px), not to
 * zero. `flex: 1` could therefore never shrink the title below that, so at
 * 390px the header's content measured 381px inside a 350px modal and pushed
 * `.close` to x=370–401 — past the modal's right edge and clipped away by its
 * `overflow: hidden`. The only control for dismissing the task card was
 * unreachable on a phone. Same root cause as the .mm-grid tracks above. */
.modal header .title-input {
  flex: 1;
  min-width: 0;
  border: none; padding: 4px 6px;
  font-size: 20px; font-weight: 600;
  background: transparent;
}
.modal header .title-input:focus { background: var(--surface-alt); border-radius: 6px; box-shadow: none; }
.modal header .close {
  background: none; border: none; font-size: 22px; color: var(--text-muted); padding: 4px 8px; border-radius: 4px;
  /* FRG-211 — a real thumb target, and never squeezed by the title input. */
  flex: 0 0 auto;
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal header .close:hover { background: var(--surface-alt); color: var(--text); }
.modal-body { padding: 18px 22px; display: grid; grid-template-columns: 1fr 220px; gap: 24px; }
/* Regression fix (BigJoe QA 2026-04-24): a long-filename attachment
   chip was blowing out the left grid item's min-content width, making
   the 1fr column claim >720px and pushing the 220px sidebar past
   .modal's overflow:hidden clip — sidebar went invisible. Default
   min-width: auto on a grid item resolves to its content's min-content
   width; setting min-width: 0 lets the grid honor the template. Both
   items get it (the left column is the primary culprit; sidebar-info
   is prophylactic so no column eats the other on different content). */
.modal-body > * { min-width: 0; }
.modal-body .field { margin-bottom: 16px; min-width: 0; }
.modal-body .field label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 6px;
}
.modal-body textarea { width: 100%; min-height: 120px; resize: vertical; }
.modal-body .sidebar-info { border-left: 1px solid var(--border); padding-left: 22px; }
.modal-body .sidebar-info .field select { width: 100%; }
.modal-body .sidebar-info .field input { width: 100%; }

/* HAT-HVH-0000400 — the task card as opened from Today's Work.
   .tcc was written as "deliberately the task-detail modal's shape", so the
   two already share their two-column body, field treatment and 220px
   sidebar. Only the card metrics differed: .modal is 720px and lets the
   BACKDROP scroll the whole card up the page, while .tcc is 940px, capped
   at 90vh, and scrolls its body internally with the header pinned.
   Matching those is what makes them the same card.
   Scoped to .tm-as-card so the board and Work Schedule keep .modal as-is. */
.modal.tm-as-card {
  width: min(940px, 94vw);
  max-width: none;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
/* Header and tab strip stay put; only the body scrolls. */
.modal.tm-as-card > header,
.modal.tm-as-card > .tm-locked-banner,
.modal.tm-as-card > div:not(.modal-body) {
  flex: 0 0 auto;
}
.modal.tm-as-card .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
/* .tcc-head is 16px 22px; .modal header is 18px 22px 14px. */
.modal.tm-as-card > header {
  padding: 16px 22px;
  align-items: center;
}
/* .tcc-title is 20px/700 against the modal's 20px/600. */
.modal.tm-as-card > header .title-input {
  font-weight: 700;
}
/* The backdrop no longer needs to scroll a tall card, and centring it
   matches how the New Task card presents. */
.modal-backdrop:has(> .modal.tm-as-card) {
  align-items: center;
  padding: 20px;
}

/* ══ "Add new task button in dashboard layout redo" — the New Task card ══ */
/* Deliberately the task-detail modal's shape: same two columns, same field
   treatment, same 220px sidebar. The ticket describes this card by reference to
   that one, so matching it is the specification rather than a coincidence. */
.tcc {
  width: min(940px, 94vw); max-height: 90vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.tcc-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.tcc-title {
  flex: 1 1 auto; min-width: 0; background: none; border: none; outline: none;
  font-size: 20px; font-weight: 700; color: var(--text);
}
.tcc-title::placeholder { color: var(--text-muted); font-weight: 600; }
.tcc-new-pill {
  flex: 0 0 auto; padding: 3px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  background: var(--brand-subtle); color: var(--brand-text); font-family: var(--font-mono);
}
.tcc-close {
  flex: 0 0 auto; background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--text-muted); padding: 0 4px;
}
.tcc-close:hover { color: var(--text); }

.tcc-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 18px 22px; display: grid; grid-template-columns: 1fr 220px; gap: 24px;
}
/* Same min-width: 0 fix as .modal-body — without it a long subtask blows out
   the 1fr column and pushes the sidebar out of the clip. */
.tcc-body > * { min-width: 0; }
.tcc-body .field { margin-bottom: 16px; min-width: 0; }
.tcc-body .field label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 6px;
}
.tcc-desc {
  width: 100%; min-height: 120px; resize: vertical; padding: 9px 11px;
  border-radius: 6px; background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-family: inherit;
}
.tcc-side { border-left: 1px solid var(--border); padding-left: 22px; }
.tcc-input {
  width: 100%; padding: 7px 9px; border-radius: 6px; font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
}
/* HAT-HVH-0000391 — the Attach file button carried a class with no rules
   behind it, so it rendered as a raw browser button next to styled
   controls. It matches the secondary buttons elsewhere in the card now. */
.attach-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-family: inherit;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border);
}
.attach-btn:hover { background: var(--surface-alt); border-color: var(--text-muted); }
.attach-btn:active { transform: translateY(1px); }
.attach-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.attach-btn [data-lucide], .attach-btn svg { width: 14px; height: 14px; flex: none; }

/* HAT-HVH-0000390 — the staged-file list, between the button and its note. */
.tcc-staged { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.tcc-staged-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 5px; font-size: 12px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
}
.tcc-staged-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcc-staged-size { flex: none; color: var(--text-muted); font-size: 11px; }
.tcc-staged-x {
  flex: none; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px; line-height: 1; padding: 0 2px;
}
.tcc-staged-x:hover { color: var(--danger-text); }
.tcc-attach-note.tcc-attach-warn { color: var(--warn-text, var(--danger-text)); }
/* HAT-HVH-0000392 — color-scheme above fixes the popup on Chromium; this
   states the colours outright so a browser that ignores it still renders
   readable options rather than inheriting --text onto a white list. */
select option, select optgroup {
  background: var(--surface);
  color: var(--text);
}

.tcc-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }
.tcc-muted { font-size: 12px; color: var(--text-muted); font-style: italic; }
.tcc-attach { margin-bottom: 6px; }
.tcc-attach-note { font-size: 11px; color: var(--text-muted); }

/* The subtasks checklist, directly below the Attachments button. */
.tcc-subs { display: flex; flex-direction: column; gap: 4px; }
.tcc-sub { display: flex; align-items: center; gap: 8px; }
.tcc-sub-tick { flex: 0 0 auto; }
.tcc-sub-text {
  flex: 1 1 auto; min-width: 0; padding: 5px 8px; border-radius: 5px; font-size: 13px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
}
.tcc-sub-del {
  flex: 0 0 auto; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 17px; line-height: 1; padding: 0 4px;
}
.tcc-sub-del:hover { color: var(--danger-text); }
.tcc-sub-add {
  margin-top: 6px; background: none; border: none; cursor: pointer;
  color: var(--brand-text); font-size: 12px; padding: 2px 0;
}
.tcc-sub-add:hover { text-decoration: underline; }

.tcc-save {
  width: 100%; padding: 9px; border-radius: 6px; font-weight: 600; cursor: pointer;
  background: var(--brand); color: var(--on-brand); border: 1px solid var(--brand);
}
.tcc-save:hover { background: var(--brand-hover); }
.tcc-save:disabled { opacity: 0.6; cursor: default; }
.tcc-cancel {
  width: 100%; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
  background: transparent; color: var(--text-muted); border: 1px solid var(--border);
}
.tcc-cancel:hover { color: var(--text); }

@media (max-width: 768px) {
  /* One column on a phone, sidebar underneath — the same concession
     .modal-body makes at this width. */
  .tcc-body { grid-template-columns: 1fr; }
  .tcc-side { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
}

.comments {
  margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--border);
}
.comments h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em; }
.comment {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.comment .body {
  background: var(--surface-alt); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 8px; flex: 1;
}
.comment .body .head {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted);
  margin-bottom: 4px;
}
.comment .body .head .author { font-weight: 600; color: var(--text); }
.comment-form { display: flex; gap: 10px; margin-top: 10px; }
.comment-form textarea { flex: 1; min-height: 40px; }
.comment-form button { align-self: flex-end; background: var(--brand); color: var(--on-brand); border: none; padding: 8px 14px; border-radius: 6px; font-weight: 600; }

/* ----- Toast (legacy .toast retained for any direct DOM users) ----- */
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  background: var(--text); color: #fff;
  padding: 10px 16px; border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  max-width: 360px;
  animation: slide-in 0.2s ease;
}
.toast.error { background: var(--danger); }
@keyframes slide-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ----- Forge in-app toast (ui.js) ----- */
.forge-toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  max-width: 380px;
}
.forge-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
  padding: 10px 14px; border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13px; line-height: 1.4;
  animation: forge-toast-in 0.18s ease-out;
}
.forge-toast-message { flex: 1; word-break: break-word; }
.forge-toast-info    { border-left-color: var(--brand); }
.forge-toast-success { border-left-color: var(--success); }
.forge-toast-warning { border-left-color: var(--warning); }
.forge-toast-error   { border-left-color: var(--danger); }
/* fix/toast-stronger-treatment-for-direct-pings — direct pings (DMs,
   @-mentions, task-assigned) get a brand-tinted background wash and a
   600 ms slide-in + glow halo entry. Size, padding, position unchanged. */
.forge-toast-priority {
  border-left-color: var(--brand);
  background: linear-gradient(color-mix(in srgb, var(--brand) 8%, transparent), color-mix(in srgb, var(--brand) 8%, transparent)), var(--surface);
  animation: forge-toast-priority-in 600ms ease-out;
}
@keyframes forge-toast-priority-in {
  0%   { transform: translateX(8px); opacity: 0; box-shadow: 0 0 0 color-mix(in srgb, var(--brand) 0%, transparent); }
  60%  { box-shadow: 0 0 12px color-mix(in srgb, var(--brand) 40%, transparent); }
  100% { transform: none; opacity: 1; box-shadow: var(--shadow-lg); }
}
.forge-toast-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 18px; line-height: 1; cursor: pointer;
  padding: 0 2px; margin-left: 4px;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.forge-toast-close:hover { color: var(--text); }
@keyframes forge-toast-in { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ----- Forge modal (confirmDialog / promptDialog) ----- */
/* z-index: this primitive is ALWAYS opened on top of whatever is already
   showing — it is the app's "are you sure" and never the bottom layer —
   so it has to outrank every other overlay in this sheet, not sit at a
   middling number and hope.

   It sat at 1500, UNDER the meeting modal (.ptm-overlay, 4000). Deleting
   a meeting put the confirmation behind the panel that asked for it: the
   page went dim, nothing appeared, and you had to close the meeting to
   reach the question — at which point the thing you were confirming was
   no longer on screen.

   The same trap was set for every other overlay a confirm can be raised
   from: .wr-overlay (4000), .move-modal-overlay (9999), forge-agent-call
   / forge-incoming-call / .forge-lightbox (2000). One number fixes all of
   them because confirmDialog and promptDialog share openModal(), which
   appends to document.body — the backdrop is a SIBLING of those overlays,
   so this comparison is direct and no stacking context can trap it.

   10000 is above .move-modal-overlay's 9999, the highest in the sheet.
   Anything added above this in future is, by construction, a thing that
   would cover a confirmation the user has to answer. */
.forge-modal-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  animation: forge-fade-in 0.15s ease-out;
}
.forge-modal {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  min-width: 320px; max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: forge-modal-in 0.18s ease-out;
}
.forge-modal-title {
  margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--text);
}
.forge-modal-message {
  margin: 0 0 16px; font-size: 14px; color: var(--text); white-space: pre-wrap; word-break: break-word;
}
.forge-modal-input {
  width: 100%; padding: 8px 10px;
  background: var(--surface-alt, var(--surface)); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; margin-bottom: 16px;
}
.forge-modal-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-faint);
}
.forge-modal-input.forge-input-error {
  border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-faint);
}
/* Multiline variant for promptDialog({ multiline: true }) — e.g. chat
   message edit. Inherits the single-line .forge-modal-input styling for
   background / border / focus ring, then layers in textarea-specific
   sizing + wrapping. min-height gives ~3 lines visible, max-height caps
   auto-grow at ~12 lines (JS sets inline height up to this), resize is
   vertical so users can drag further if they want. */
.forge-modal-textarea {
  min-height: 84px;
  max-height: 260px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
}
/* When the dialog hosts a textarea, widen it a bit so multi-line
   content has room to breathe. Clamped to 90vw on narrow viewports. */
.forge-modal.forge-modal-multiline {
  max-width: min(520px, 90vw);
}
.forge-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
}
.forge-modal-actions button {
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-alt, var(--surface));
  color: var(--text); cursor: pointer;
}
.forge-modal-actions button:hover { background: var(--surface); border-color: var(--text-muted); }
.forge-modal-confirm {
  background: var(--brand) !important; color: var(--on-brand) !important; border-color: var(--brand) !important;
}
.forge-modal-confirm:hover { background: var(--brand-hover) !important; border-color: var(--brand-hover) !important; }
.forge-modal-confirm.forge-btn-destructive {
  background: var(--danger) !important; border-color: var(--danger) !important;
}
.forge-modal-confirm.forge-btn-destructive:hover {
  background: #b83838 !important; border-color: #b83838 !important;
}
@keyframes forge-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* HAT-HVH-0000379 - chooseDialog(). A scrolling list of radio rows; the
   cap keeps a workspace with 40 projects from producing a modal taller
   than the viewport. Uses the same tokens as the rest of .forge-modal so
   it inherits dark mode for free. */
.forge-modal.forge-modal-choose { min-width: 360px; }
.forge-modal-choices {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 320px; overflow-y: auto;
  margin: 0 0 16px;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px;
  background: var(--surface-alt, var(--surface));
}
.forge-modal-choice {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  font-size: 14px; color: var(--text);
  cursor: pointer;
}
.forge-modal-choice:hover { background: var(--surface); }
.forge-modal-choice input[type="radio"] {
  margin: 0; flex: none; accent-color: var(--brand);
}
.forge-modal-choice:focus-within {
  outline: 2px solid var(--brand); outline-offset: -2px;
}
.forge-modal-choice-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.forge-modal-choice-hint {
  flex: none; font-size: 12px; color: var(--text-muted);
}
@keyframes forge-modal-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ----- Activity panel ----- */
.activity-list { padding: 20px; max-width: 720px; margin: 0 auto; }
.activity-list .item {
  display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-list .item .when { margin-left: auto; color: var(--text-muted); font-size: 11px; }

/* ----- Project sub-nav ----- */
.sidebar-nav .project-group { margin-bottom: 2px; }
.sidebar-nav .project-head {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px;
  color: var(--sidebar-text);
}
.sidebar-nav .project-head:hover { background: var(--sidebar-hover); }
/* FRG-028 — icon stays 10px visually; hitbox forced to 32×32 via
   min-width/min-height so clicks don't fall through to the row.
   Negative vertical margin reclaims the extra height so the sidebar
   row doesn't grow from ~30px to ~48px. */
.sidebar-nav .project-head .chev {
  font-size: 10px; color: var(--sidebar-muted);
  min-width: 32px; min-height: 32px;
  margin: -6px 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.projects-chev {
  min-width: 32px; min-height: 32px;
  margin: -6px 0;
  display: inline-flex; align-items: center; justify-content: center;
}
/* FRG-028 follow-up — workspace dropdown in the sidebar. Width stays
   100% (set inline); min-height keeps the click target a comfortable
   size on desktop. */
#ws-select {
  min-height: 32px;
}
.sidebar-nav .project-head .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav .sub {
  display: flex; flex-direction: column;
  padding: 2px 0 4px 22px; gap: 2px;
}
.sidebar-nav .sub .item {
  padding: 6px 10px; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-nav .sub .item .icon { font-size: 14px; width: 16px; text-align: center; }

/* ----- View toggle ----- */
.view-toggle {
  display: inline-flex; gap: 2px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 6px; padding: 2px;
}
.view-toggle button {
  background: none; border: none; padding: 6px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.view-toggle button.active { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-sm); }

/* ----- Filter bar ----- */
.filter-bar {
  display: flex; gap: 10px; padding: 12px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  align-items: center; flex-wrap: wrap;
}
.filter-bar input, .filter-bar select {
  padding: 6px 10px; font-size: 13px;
}
.filter-bar .search { flex: 1; min-width: 200px; max-width: 320px; }

/* FRG-211 — the mobile sort select. Desktop sorts by clicking the column
   headers, so the control is redundant there and hidden; on a phone the
   headers are gone and this is the only way to sort. */
.filter-bar .f-sort { display: none; }
@media (max-width: 768px) {
  .filter-bar { padding: 10px 12px; gap: 8px; }
  /* `min-width: 200px` on the search field forced the bar wider than a 360px
     screen once padding was counted. Let it shrink; it still takes the whole
     first line because the selects wrap beneath it. */
  .filter-bar .search { min-width: 0; max-width: none; flex: 1 0 100%; }
  .filter-bar select {
    flex: 1 1 auto; min-width: 0;
    /* 44px thumb target, and 16px text so iOS Safari does not zoom the
       viewport when the select takes focus. */
    min-height: 44px; font-size: 16px;
  }
  .filter-bar input { min-height: 44px; font-size: 16px; }
  .filter-bar .f-sort { display: block; }
}

/* ----- List view ----- */
.task-list-wrap { padding: 20px; }
.task-list {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.task-list th, .task-list td {
  text-align: left; padding: 10px 12px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.task-list thead th {
  background: var(--surface-alt);
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; user-select: none;
}
.task-list tbody tr { cursor: pointer; }
.task-list tbody tr:hover { background: var(--surface-alt); }
.task-list tbody tr:last-child td { border-bottom: none; }
.task-list .status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600;
  background: var(--surface-alt); border: 1px solid var(--border);
}
.task-list .status-chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* UI modernisation — the List view (.tl-table), on the shared filter bar.
   Headers are 12px sentence case (were uppercase with letter-spacing); the
   rows hover and focus with the shared tint; a sort select sits in the filter
   row at every size. Time and Git trail keep .task-list as it was. */
.tl-page { padding: 16px 20px 0; }
.tl-page .ui-filters { margin-bottom: 8px; }
.tl-page .f-sort { flex: 0 1 auto; min-height: 36px; }
.tl-count { margin: 0 0 4px; }
.tl-page .task-list-wrap { padding: 0 0 20px; }
.tl-table thead th { text-transform: none; letter-spacing: 0; font-size: 12px; background: var(--surface-2); }
.tl-table thead th[data-col]:hover { color: var(--text); }
.tl-table thead th[data-col]:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; }
.tl-table thead th[aria-sort] { color: var(--text); }
.tl-table thead th[aria-sort="ascending"]::after { content: " ↑" / ""; }
.tl-table thead th[aria-sort="descending"]::after { content: " ↓" / ""; }
.tl-table tbody tr:hover { background: var(--row-tint); }
.tl-table tbody tr:focus-visible { outline: none; background: var(--row-tint); box-shadow: inset 3px 0 0 var(--brand-text); }
.tl-table td { font-size: 14px; }
.tl-due { white-space: nowrap; }
.tl-due.is-overdue { color: var(--danger-text); font-weight: 600; }
.tl-muted { color: var(--text-muted); font-size: 13px; }
.tl-empty td { text-align: center; padding: 30px; color: var(--text-muted); cursor: default; }
@media (max-width: 768px) {
  .tl-page { padding: 12px 0 0; }
  .tl-page .f-sort { min-height: 44px; flex: 1 1 100%; }
  .tl-page .task-list-wrap { padding: 0 0 12px; }
}

/* FRG-211 — the list view becomes cards on a phone.
 *
 * Eight columns do not squeeze into 390px; they measured 624px, and because
 * `.task-list-wrap` was `overflow-x: visible` the surplus escaped all the way
 * up to `#view.content`, so the whole page — toolbar, filters and all — panned
 * sideways as one. A horizontal scroller would have contained the damage but
 * still left a phone dragging a table left and right to read one task.
 *
 * So the row becomes the card. This is done entirely in CSS: the markup, the
 * sort state, the filter handlers and the row click that opens the task modal
 * are all untouched and shared with desktop. The <thead> is hidden and the
 * `.f-sort` select in the filter bar takes over sorting.
 *
 * The cell order in the markup is: 1 ID · 2 Title · 3 Status · 4 Priority
 * · 5 Assignee · 6 Due · 7 Est-vs-actual · 8 Created. The card promotes the
 * title, keeps ID as a quiet caption above it, and lets the remaining six
 * wrap as a chip row beneath — so nothing is dropped, just re-stacked.
 */
@media (max-width: 768px) {
  .task-list-wrap { padding: 12px; }

  /* Rows stop being table boxes so they can be laid out as flex cards. */
  .task-list,
  .task-list thead,
  .task-list tbody,
  .task-list tr,
  .task-list td { display: block; }

  /* The header row is the desktop sort control; `.f-sort` replaces it here.
     Hidden accessibly rather than removed — the cells keep their scope. */
  .task-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

  .task-list {
    background: none; border: none; border-radius: 0;
    display: flex; flex-direction: column; gap: 10px;
  }

  /* The card is one wrapping flex line: ID and title each take a full row,
     the six metadata cells then flow inline and wrap as needed. */
  .task-list tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    /* Comfortably past the 44px thumb target for the whole card. */
    min-height: 44px;
  }

  /* Every cell sheds the table border and padding; the card owns spacing. */
  .task-list td {
    border-bottom: none;
    padding: 0;
    min-width: 0;
    font-size: 13px;
  }

  /* 1 — ticket ID, a quiet caption on its own line. */
  .task-list td:nth-child(1) {
    flex: 0 0 100%;
    font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
    color: var(--text-muted);
  }
  /* 2 — title, the thing you are scanning for. Wraps rather than truncates:
     a card has vertical room, and a clipped title is the complaint this
     change exists to fix. 15px keeps it readable without zooming. */
  .task-list td:nth-child(2) {
    flex: 0 0 100%;
    font-size: 15px; font-weight: 600; color: var(--text);
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  /* 3–8 — status, priority, assignee, due, est-vs-actual, created. */
  .task-list td:nth-child(n+3) {
    flex: 0 0 auto;
    display: inline-flex; align-items: center;
    color: var(--text-muted);
  }
  /* An empty metadata cell renders as a lone em-dash, which is noise six
     times over on a card. Desktop needs the placeholder to hold the column
     open; a card does not. */
  .task-list td:nth-child(n+3):empty { display: none; }
}

/* FRG-211 — Retainers overview: table → cards on a phone.
 *
 * The markup is inline-styled, and its wrapper carried `overflow: hidden`
 * around a 545px table. At 390px that clipped the table inside a 308px box
 * with no scrollbar, so Dev, Support, Status and the Manage link were simply
 * not on screen and no gesture could reach them.
 *
 * Cards rather than a scroller, matching the task list: this is a list of
 * clients, and a client reads better stacked than panned. `!important` is
 * needed only where an inline style occupies the same property — the inline
 * padding and text-align — not as a blanket hammer.
 *
 * Column order: 1 Client · 2 Tier · 3 Contract end · 4 Dev · 5 Support
 * · 6 Status · 7 Manage. Four of those are meaningless without their header
 * once the header row is gone, so those cells get a ::before label.
 */
@media (max-width: 768px) {
  .ro-wrap {
    background: none !important;
    border: none !important;
    overflow: visible !important;
  }
  .ro-table, .ro-table tbody, .ro-table tr, .ro-table td { display: block; }
  .ro-table thead { display: none; }
  .ro-table { display: flex; flex-direction: column; gap: 10px; }

  .ro-table tbody tr {
    background: var(--surface);
    border: 1px solid var(--border) !important;
    border-radius: 10px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px 10px;
    align-items: baseline;
  }

  .ro-table td {
    padding: 0 !important;
    text-align: left !important;
    min-width: 0;
    font-size: 13px;
  }

  /* Client name spans both columns as the card title. */
  .ro-table td:nth-child(1) {
    grid-column: 1 / -1;
    font-size: 15px; font-weight: 600;
    overflow-wrap: anywhere;
  }
  /* Manage spans both columns as the card's action, with a real target. */
  .ro-table td:nth-child(7) {
    grid-column: 1 / -1;
    margin-top: 2px;
  }
  .ro-table td:nth-child(7) a {
    display: inline-flex; align-items: center;
    min-height: 44px; min-width: 44px;
    font-size: 14px !important;
  }

  /* Labelled rows for the four cells that lose meaning without a header. */
  .ro-table td:nth-child(2)::before { content: 'Tier'; }
  .ro-table td:nth-child(3)::before { content: 'Contract end'; }
  .ro-table td:nth-child(4)::before { content: 'Dev'; }
  .ro-table td:nth-child(5)::before { content: 'Support'; }
  .ro-table td:nth-child(6)::before { content: 'Status'; }
  .ro-table td:nth-child(n+2):nth-child(-n+6) {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
  }
  .ro-table td:nth-child(n+2):nth-child(-n+6)::before {
    color: var(--text-muted);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
  }
}

/* ----- Discussions ----- */
.discussions-wrap { padding: 20px; max-width: 900px; margin: 0 auto; }
.discussions-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.mention { color: var(--brand-text); font-weight: 600; }
.code-block {
  background: var(--bg); color: var(--text);
  padding: 12px 14px; border-radius: 6px;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 12px; overflow-x: auto; margin: 8px 0;
  white-space: pre;
}
code {
  background: var(--surface-alt); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace; font-size: 12px;
  border: 1px solid var(--border);
}

/* The @mention list (util.js attachMentionAutocomplete). FIXED, so it is out of
   the document's flow and can never make the page taller or move a scroll
   position; placed above the text box by script, its height capped to the room
   there and scrolling within itself. It used to be absolute, under the box,
   and pushed the page down every time it opened. */
.mention-dropdown {
  position: fixed; z-index: 1200;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 4px; box-sizing: border-box;
  overflow-y: auto; overscroll-behavior: contain;
}
.mention-dropdown[hidden] { display: none; }
.mention-item {
  display: flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.mention-item.active, .mention-item:hover { background: var(--brand-faint); }
.mention-text { min-width: 0; }
.mention-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-email { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 768px), (hover: none) {
  .mention-item { min-height: 44px; }
}

/* ----- Files ----- */
.files-wrap { padding: 20px; max-width: 1000px; margin: 0 auto; }
.files-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.drop-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 30px; text-align: center; color: var(--text-muted);
  background: var(--surface); margin-bottom: 18px;
  transition: border-color 0.1s, background 0.1s;
}
.drop-zone.active { border-color: var(--brand); background: var(--brand-faint); color: var(--brand-text); }
.drop-zone button {
  background: var(--brand); color: var(--on-brand); border: none;
  padding: 8px 14px; border-radius: 6px; font-weight: 600; margin-top: 8px;
}
.files-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.files-table th, .files-table td { text-align: left; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.files-table thead th { background: var(--surface-alt); font-size: 11px; text-transform: uppercase; color: var(--text-muted); }
.files-table tbody tr:last-child td { border-bottom: none; }
.files-table .actions { display: flex; gap: 6px; }
.files-table button {
  background: none; border: 1px solid var(--border); padding: 4px 10px;
  border-radius: 4px; font-size: 12px; color: var(--text);
}
.files-table button.danger { color: var(--danger-text); border-color: #f2c7c4; }

/* Project Drive */
.drive-wrap { padding: 20px; max-width: 1000px; margin: 0 auto; }
.drive-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.drive-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 14px; flex-wrap: wrap; }
.crumb-link { color: var(--brand-text); cursor: pointer; text-decoration: none; }
.crumb-link:hover { text-decoration: underline; }
.crumb-sep { color: var(--text-muted); }
.crumb-current { font-weight: 600; color: var(--text); }
.drive-toolbar { display: flex; gap: 8px; align-items: center; }
.drive-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.folder-icon { background: var(--brand-faint, rgba(59,130,246,0.08)); color: var(--brand-text); }
.file-icon { background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted); }
.folder-row { cursor: pointer; }
.folder-row:hover td { background: var(--surface-alt); }
.folder-name-cell { font-weight: 500; }
.btn-icon { background: none; border: 1px solid var(--border); width: 30px; height: 30px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); padding: 0; }
.btn-icon:hover { background: var(--surface-alt); color: var(--text); }
.btn-icon.danger { color: var(--danger-text); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.08); }

/* Drag-and-drop move highlights */
.dragging { opacity: 0.4; }
.drop-hover td { background: transparent !important; }
.drop-hover { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 4px; }
a.crumb-link.drop-hover { background: var(--brand-faint); border-radius: 4px; padding: 2px 6px; }
[draggable="true"] { cursor: grab; }
[draggable="true"]:active { cursor: grabbing; }

/* Move to… modal */
.move-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.move-modal { background: var(--surface, #1e1f2b); border: 1px solid var(--border); border-radius: 10px; width: 380px; max-height: 70vh; display: flex; flex-direction: column; overflow: hidden; }
.move-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.move-modal-header h3 { font-size: 15px; color: var(--text); }
.move-modal-close {
  background: none; border: none; font-size: 22px; color: var(--text-muted);
  cursor: pointer; padding: 0 4px;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.move-tree { flex: 1; overflow-y: auto; padding: 8px 0; }
.move-tree-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--text); border-radius: 0; }
.move-tree-item:hover { background: var(--surface-alt); }
.move-tree-item.selected { background: var(--brand-faint); color: var(--brand-text); }
.move-tree-item.disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.move-modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

/* min-width: 0 so this flex container can shrink below its flex
   children's intrinsic min-content width — otherwise a wide chip (e.g.
   a long filename) would push the container wide and, in a grid
   parent, demand more than its 1fr share. See .modal-body > * above. */
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-width: 0; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 14px; font-size: 12px;
  /* Long filenames would otherwise push size + action buttons off the
     row. max-width caps the chip; min-width:0 lets the filename span
     shrink and ellipsise instead of forcing the flex parent wider. */
  max-width: 100%; min-width: 0;
}
.file-chip img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.file-chip .file-chip-icon,
.file-chip .file-chip-size { flex-shrink: 0; }
/* Issue 2 (FRG followup) — shared filename cell. The span must be
   flex:1 (grow to fill available space), min-width:0 (let it shrink
   below its intrinsic content width — critical for ellipsis inside
   flex), and the usual three-prop ellipsis incantation. Hover the
   span to see the full name in the native title tooltip. */
.file-chip-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-chip button {
  background: none; border: none; color: var(--text-muted); font-size: 14px; padding: 0 2px;
  min-width: 32px; min-height: 32px; flex-shrink: 0;
  /* FRG-028 follow-up — reclaim vertical space so chips stay ~20px tall. */
  margin: -6px 0;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Files drive table — same truncation story as chips, but applied to
   a table cell. The `table-layout: auto` default will try to size the
   cell to content; `max-width` + the ellipsis triple forces it to clip. */
.file-row-name {
  max-width: 280px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ----- Issue 3 (FRG followup): pending + error upload chips ----- */
/* A pending chip is the same shape as a regular file chip but a little
   wider so the progress bar + percent have room to breathe. The track
   is 6px tall; the fill tweens its width with a quick transition so the
   bar doesn't jitter on every progress event. */
.file-chip-pending,
.file-chip-error {
  min-width: 260px;
  max-width: 360px;
}
.file-chip-pending .file-chip-icon,
.file-chip-error .file-chip-icon {
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.file-chip-pending .file-chip-icon i[data-lucide],
.file-chip-error .file-chip-icon i[data-lucide] { width: 14px; height: 14px; }

.file-chip-progress {
  flex: 1 1 auto; min-width: 60px;
  height: 6px; border-radius: 3px;
  background: var(--border); overflow: hidden;
}
.file-chip-progress-fill {
  height: 100%; width: 0%;
  background: var(--brand);
  transition: width 0.15s linear;
}
.file-chip-percent {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 11px; color: var(--text-muted);
  min-width: 34px; text-align: right;
}

/* Error chip — red tint, keeps the same footprint as the pending chip
   so the replacement isn't jarring. The message truncates like the
   filename (single line, ellipsis, full text on hover). */
.file-chip-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.45);
}
.file-chip-error .file-chip-icon { color: var(--danger-text); }
.file-chip-error-message {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; color: var(--danger-text);
}
.file-chip-error button[data-act="retry-upload"] { color: var(--brand-text); }
.file-chip-error button[data-act="dismiss-upload"] { color: var(--text-muted); }

/* ----- Notifications bell ----- */
.notif-bell {
  position: relative; background: none; border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 6px; font-size: 16px; color: var(--text);
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.notif-bell:hover { background: var(--surface-alt); }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color:var(--on-danger);
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
/* U6 — full-overlay backdrop behind the notifications dropdown so it reads as
   a layer above the right-rail Quick Stats card instead of the card showing
   alongside/under the panel. Sits just below the panel (z-index 120). */
.notif-backdrop {
  position: fixed; inset: 0; z-index: 119;
  background: rgba(0, 0, 0, 0.32);
}
.notif-panel {
  position: absolute; top: 52px; right: 20px; z-index: 120;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); width: 380px; max-height: 70vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.notif-panel header {
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); font-weight: 600;
}
.notif-panel header button {
  background: none; border: none; color: var(--brand-text); font-size: 12px; font-weight: 600;
}
.notif-panel .list { overflow-y: auto; }
.notif-panel .item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif-panel .item:hover { background: var(--surface-alt); }
.notif-panel .item.unread { background: var(--brand-faint); }
.notif-panel .item .title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-panel .item .body { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.notif-panel .item .time { font-size: 11px; color: var(--text-muted); }
.notif-panel .empty { padding: 30px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* FRG-212 — mobile sizing for the notification / activity panels.
 *
 * The full-screen mobile treatment for these lives further down (search
 * `Notifications / activity panels`) and is unchanged in intent: top:0 to
 * just above the bottom nav. It had simply never rendered, because the panel
 * sits inside the frosted header and `backdrop-filter` makes an element a
 * containing block for `position: fixed` children — so the viewport inset
 * resolved against a 119px bar and produced a 62px sliver. notifications.js
 * now portals the panel to <body> on mobile, which is what lets that rule
 * finally do what it says.
 *
 * What is added here is only what full-screen implies and the original rule
 * did not cover: clearing the notch, and targets big enough to tap.
 */
@media (max-width: 768px) {
  .notif-panel header,
  .activity-panel header {
    min-height: 52px;
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .notif-panel header button,
  .activity-panel header button { min-height: 44px; padding: 0 8px; }
  /* Each notification is a tap target that navigates somewhere. */
  .notif-panel .item { padding: 14px 16px; min-height: 44px; }
  .notif-panel .list,
  .activity-panel .list { -webkit-overflow-scrolling: touch; }
  /* The portal host must not affect layout — it only exists to escape the
     header's containing block. */
  #forge-notif-portal { position: static; }
}

/* ----- Activity panel ----- */
.activity-panel {
  position: absolute; top: 52px; right: 20px; z-index: 110;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); width: 420px; max-height: 70vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.activity-panel header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; display: flex; justify-content: space-between; align-items: center;
}
.activity-panel .list { overflow-y: auto; padding: 8px 0; }
.activity-panel .item {
  padding: 10px 16px; display: flex; gap: 10px; align-items: flex-start;
}
.activity-panel .item .txt { font-size: 13px; line-height: 1.45; flex: 1; }
.activity-panel .item .time { font-size: 11px; color: var(--text-muted); }

.task-card .files-inline { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.task-card .files-inline .tag {
  font-size: 10px; background: var(--surface-alt); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 10px; color: var(--text-muted);
}

/* ----- Sprint cards (also reused for checkins/time panels) ----- */
.sprint-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: border-color 0.1s;
}
.sprint-card:hover { border-color: var(--brand); }
.sprint-card.active { border-color: var(--success); border-left-width: 4px; }

/* ----- Timeline ----- */
.timeline-wrap {
  height: calc(100vh - 180px);
  background: var(--surface);
}
.timeline-wrap .tl-bar:hover { filter: brightness(1.1); }

/* ----- Settings layout ----- */
.settings-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.settings-nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
}
.settings-nav .back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 600;
  padding: 8px 10px; border-radius: 6px;
  margin-bottom: 18px;
}
.settings-nav .back:hover { background: var(--surface-alt); color: var(--text); }
.settings-nav h5 {
  margin: 14px 10px 6px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700;
}
.settings-nav a.item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 14px; margin-bottom: 2px;
  cursor: pointer;
}
.settings-nav a.item:hover { background: var(--surface-alt); }
.settings-nav a.item.active { background: var(--brand-faint); color: var(--brand-text); font-weight: 600; }

/* FRG-083 — the settings pane was max-width 960px and LEFT-aligned inside a
   full-width grid cell, so at 2560 it left ~1600px pooled on the right — the
   same lopsided shape as the original Dashboard complaint. A settings form
   genuinely should not stretch to a 55" display, so the answer is a cap that
   is centred, not removed: raised to 1200 (Members and the Info tab's
   document list both earn the extra room) and margin-inline auto so whatever
   space remains is split evenly. Same policy as .page-shell. */
.settings-main {
  padding: 30px 40px;
  /* width:100% is load-bearing. .settings-main is a GRID item, and a grid
     item with auto inline margins and a max-width shrinks to fit its content
     instead of stretching to the cap — measured at 736px rather than 1200
     when this was omitted, i.e. NARROWER than the 960 it replaced. Setting
     an explicit 100% makes it fill the cell, max-width clamps it, and the
     auto margins then centre the clamped box. */
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  box-sizing: border-box;
  overflow-x: hidden;
}
.settings-main h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.01em; }
.settings-main p.subtitle { margin: 0 0 24px; color: var(--text-muted); }

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 18px;
}
.settings-card h2 {
  margin: 0 0 4px; font-size: 16px; font-weight: 600;
}
.settings-card p.card-sub { margin: 0 0 18px; color: var(--text-muted); font-size: 13px; }
.settings-card .danger-zone { border-color: var(--danger); }
.settings-card.danger { border-color: var(--danger); }

.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form-row label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted);
}
.form-row input, .form-row textarea, .form-row select {
  padding: 10px 12px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text);
}
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.btn-primary {
  background: var(--brand); color: var(--on-brand); border: none;
  padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--surface-alt); }
.btn-danger {
  background: transparent; color: var(--danger-text); border: 1px solid var(--danger);
  padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.btn-danger:hover { background: var(--danger-faint); }
/* FRG-061 UI polish (A1): .btn-secondary and .btn-sm were used in JS (Settings
   change-email / 2FA, Files move dialog) but never defined, so they rendered as
   unstyled OS buttons. Defined here to match the .btn-primary/.btn-ghost family.
   .btn-sm is a pure size modifier — placed AFTER the family so its padding wins
   on `class="btn-primary btn-sm"`. */
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 10px 18px; border-radius: 6px; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--surface-alt); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Avatar card */
.profile-avatar {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 600;
  position: relative; cursor: pointer;
  overflow: hidden; border: 4px solid var(--surface);
  box-shadow: var(--shadow-md);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar .overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; opacity: 0; transition: opacity 0.15s;
  font-weight: 600;
}
.profile-avatar:hover .overlay { opacity: 1; }

/* Toggle switch */
.toggle-row {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .text { flex: 1; }
.toggle-row .text .title { font-weight: 600; font-size: 14px; }
.toggle-row .text .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toggle {
  position: relative; width: 40px; height: 22px;
  flex-shrink: 0;
}
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.toggle .track {
  display: block; width: 100%; height: 100%;
  background: var(--border); border-radius: 12px;
  transition: background 0.15s;
}
.toggle .knob {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}
.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked ~ .knob { transform: translateX(18px); }

/* Theme cards */
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.theme-card {
  border: 2px solid var(--border); border-radius: 10px;
  padding: 18px; text-align: center; cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: var(--brand); background: var(--brand-faint); }
.theme-card .glyph { font-size: 28px; margin-bottom: 6px; }
.theme-card .name { font-weight: 600; font-size: 13px; }

/* Color swatch picker */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
}
.swatches button.active { border-color: var(--text); }

/* Members table */
.members-table { width: 100%; border-collapse: collapse; }
.members-table th, .members-table td {
  text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.members-table thead th {
  font-size: 11px; text-transform: uppercase; color: var(--text-muted);
  background: var(--surface-alt);
}
.role-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
/* Text darkened from #6a4d00 on 2026-09-23: against the darker end of the
   gradient it measured 4.43:1, just under the 4.5:1 AA wants. #5f4500 gives
   5.06:1 there and 5.62:1 at the light end, with the gold unchanged. */
.role-badge.owner,
.role-badge.super_admin { background: linear-gradient(135deg,#f5c744,#efbb3a); color: #5f4500; }
/* 2026-10-16 — on the HattVest team, no access here. A state, not a role. */
.role-badge.mem-no-access {
  background: transparent; color: var(--text-muted);
  border: 1px dashed var(--border); cursor: help;
}
.role-badge.admin { background: var(--brand-faint); color: var(--brand-text); }
.role-badge.project_manager { background: rgba(55, 138, 221, 0.15); color: #2a658a; }
html[data-theme="dark"] .role-badge.project_manager { color: #7fb9ed; }
.role-badge.member { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.role-badge.viewer { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }

.perm-info {
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  border: 1px solid var(--brand-faint);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.perm-info .icon { font-size: 16px; flex-shrink: 0; }
.perm-info .role-name { font-weight: 700; color: var(--brand-text); }

/* Invite list */
.invite-row {
  display: flex; gap: 10px; align-items: center;
  /* 2026-10-16 — wraps: on a phone the row never did, the link code was
     squeezed to one letter a line and Copy/Revoke sat past the card's edge. */
  flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-alt); margin-bottom: 8px; font-size: 12px;
}
.invite-row code {
  flex: 1 1 220px; min-width: 0; background: var(--surface); padding: 4px 8px;
  border-radius: 4px; font-size: 11px;
  word-break: break-all;
}
@media (max-width: 600px) {
  .invite-row code { flex-basis: 100%; }
}

/* Analytics */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 20px;
}
.stat-card .label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.04em; }
.stat-card .number { font-size: 28px; font-weight: 700; color: var(--brand-text); margin-top: 4px; }
.stat-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.chart {
  display: flex; align-items: flex-end; gap: 3px; height: 120px;
  padding: 10px 0 0;
}
.chart .bar {
  flex: 1; background: var(--brand); border-radius: 2px 2px 0 0;
  min-height: 2px; position: relative;
}
.chart .bar:hover { background: var(--brand-hover); }
.chart .bar .tt {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface);
  padding: 2px 6px; border-radius: 4px; font-size: 10px;
  white-space: nowrap; opacity: 0; pointer-events: none;
}
.chart .bar:hover .tt { opacity: 1; }

/* Labels list */
.label-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-alt); margin-bottom: 6px;
}
.label-row .dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.label-row .name { flex: 1; }

/* Password strength */
.strength { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.strength .bar { height: 100%; transition: width 0.15s, background 0.15s; }
.strength .bar.weak { background: var(--danger); width: 33%; }
.strength .bar.medium { background: var(--warn); width: 66%; }
.strength .bar.strong { background: var(--success); width: 100%; }

/* ----- Chat ----- */
.chat-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - var(--bar-h));
  min-height: 0;
  overflow: hidden;
}
/* 2026-10-04 (BigJoe, twice: "in chats the padding ... on the right and left
   side is not done"). Every other page keeps its content 24px from the
   sidebar and from the window's right edge (Drive, Meetings, Dashboard:
   measured 21 to 24px); Chats ran edge to edge, 0px both sides, the list's
   grey starting at the sidebar and the conversation at the window edge. On a
   desktop it now sits in the same 24px gutter, framed like Drive's list.
   The phone keeps its full-screen conversation (its own rules below). */
@media (min-width: 769px) {
  .chat-shell {
    margin: 16px 24px 24px;
    height: calc(100vh - var(--bar-h) - 40px);
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--surface);
  }
}
.chat-list {
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 8px;
}
.chat-list .chat-search {
  padding: 8px 10px; font-size: 12px; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); margin-bottom: 10px;
}
.chat-list h5 {
  margin: 12px 8px 4px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
.chat-list h5 button {
  background: none; border: none; color: var(--text-muted);
  font-size: 14px; padding: 0 4px; border-radius: 4px;
}
.chat-list h5 button:hover { background: var(--border); color: var(--text); }
.chat-list .ch-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px;
  font-size: 14px; color: var(--text);
  cursor: pointer; text-decoration: none;
  margin-bottom: 1px;
}
.chat-list .ch-item:hover { background: var(--border); }
.chat-list .ch-item.active {
  background: var(--brand-faint);
  border-left: 3px solid var(--brand);
  padding-left: 7px;
}
.chat-list .ch-item .hash { color: var(--text-muted); font-weight: 700; }
.chat-list .ch-item.unread { font-weight: 700; }

/* HAT-HVH-0000378 — the meeting marker on a channel row.
   margin-left:auto pushes it to the right edge; the unread badge that follows
   drops its own auto margin so the two sit together rather than each claiming
   the free space. Upcoming is muted, live takes the brand colour and pulses —
   "you could join this right now" has to be distinguishable at a glance from
   "there is something booked later". */
.chat-list .ch-item .ch-meet {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex: 0 0 auto;
}
.chat-list .ch-item .ch-meet.live {
  color: var(--brand-text);
  animation: ch-meet-pulse 2s ease-in-out infinite;
}
.chat-list .ch-item .ch-meet + .badge { margin-left: 6px; }
@keyframes ch-meet-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
/* Anyone who has asked for less motion should not get a pulsing icon in
   their peripheral vision for the length of a meeting. */
@media (prefers-reduced-motion: reduce) {
  .chat-list .ch-item .ch-meet.live { animation: none; }
}

/* HAT-HVH-0000377 — the in-channel meeting strip, under the header.
   Placed where the Active Vibe banner goes, and styled from tokens so it
   holds in both themes. Muted while the meeting is still upcoming; brand
   fill once it is live and joinable, which is when it earns the emphasis. */
.chat-meet-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.chat-meet-banner.live {
  background: var(--brand);
  color: var(--on-brand);
  border-color: var(--brand);
}
.chat-meet-banner .cmb-icon { display: inline-flex; flex: 0 0 auto; }
.chat-meet-banner .cmb-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.chat-meet-banner .cmb-text strong {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-meet-banner .cmb-when { opacity: 0.8; flex: 0 0 auto; }
/* Reads against the brand fill in both themes because both sides of the pair
   are derived from it — see white-label.js. */
.chat-meet-banner .cmb-join {
  flex: 0 0 auto;
  background: var(--on-brand);
  color: var(--brand);
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.chat-meet-banner .cmb-join:hover { opacity: 0.9; }
.chat-list .ch-item .badge {
  margin-left: auto; background: var(--danger); color:var(--on-danger);
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
  min-width: 16px; text-align: center;
}
.chat-list .dm-item-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.chat-list .dm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; text-decoration: none;
  color: var(--text); font-size: 13px;
  flex: 1; min-width: 0;
}
.chat-list .dm-item:hover { background: var(--border); }
.chat-list .dm-item.active { background: var(--brand-faint); }
.chat-list .dm-hide {
  position: absolute;
  right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  min-width: 32px; min-height: 32px;
  border-radius: 50%;
  font-size: 14px; line-height: 1; padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s ease, color 0.1s ease, background 0.1s ease;
  display: flex; align-items: center; justify-content: center;
}
.chat-list .dm-item-wrap:hover .dm-hide { opacity: 1; }
.chat-list .dm-hide:hover {
  color: var(--danger-text);
  border-color: var(--danger);
  background: var(--danger-faint);
}

/* DM picker modal — member list */
.dm-picker-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  background: none; border: none; border-radius: 6px;
  cursor: pointer; text-align: left;
  color: var(--text);
}
.dm-picker-item:hover { background: var(--surface-alt); }
.dm-picker-item .n { font-weight: 600; font-size: 13px; }
.dm-picker-item .e { font-size: 11px; color: var(--text-muted); }
.chat-list .dm-avatar {
  position: relative; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.chat-list .dm-avatar .status-dot {
  position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--surface-alt);
}
.status-dot.online { background: #3ec26f; }
.status-dot.away { background: #efbb3a; }
.status-dot.busy { background: #e85d5d; }
.status-dot.offline { background: #8a8b94; }
.chat-list .dm-item .info { flex: 1; min-width: 0; }
.chat-list .dm-item .info .n { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .dm-item .info .p {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.chat-main {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface);
}
.chat-header {
  padding: 14px var(--chat-gutter); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
}
.chat-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.chat-header .desc { font-size: 12px; color: var(--text-muted); }
/* 2026-10-04 — the member count and channel description: two lines at most,
   the whole text in its tooltip. Unclamped, a long description ran to five
   lines on a phone and a word that could not break slid under the member
   pill; the extra side padding made that visible. */
/* On a span inside the button: a <button> cannot take -webkit-box (Chrome
   computes it as flow-root), so a clamp on the button itself does nothing. */
.chat-header .member-count-btn { max-width: 100%; }
.chat-header .member-count-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere; line-height: 1.35;
}

/* CHT-EDIT — an archived channel: kept, readable, closed. Quiet surface
   rather than an alarm colour, because nothing is wrong — it is finished. */
.chat-archived-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 9px var(--chat-gutter);
  background: var(--surface-alt); border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
}
.chat-archived-banner .chat-archived-ico { display: inline-flex; }
.chat-archived-banner .btn-primary { padding: 5px 12px; font-size: 12.5px; }
.chat-archived-composer {
  margin: 10px var(--chat-gutter) 14px; padding: 12px 14px;
  border: 1px dashed var(--border); border-radius: 8px;
  text-align: center; font-size: 13px; color: var(--text-muted);
}
.ch-item.ch-archived-link { color: var(--text-muted); font-size: 12.5px; cursor: pointer; }
.ch-item.ch-archived-link .hash { display: inline-flex; align-items: center; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 20px 0;
  display: flex; flex-direction: column;
  /* FRG-063 — was gap: 2px on every row, so a NEW speaker was spaced
     identically to a continuation line and the thread read as one wall of
     text. Spacing is now per-row (see .msg-row rules) so grouped runs stay
     tight while a change of author gets real air. */
  gap: 0;
}
.chat-messages .loading-more {
  text-align: center; padding: 10px; font-size: 12px; color: var(--text-muted);
}
/* FRG-063 — the day marker reads as a pill sitting on the rule, so it stays
   legible when it lands next to a dense run of messages. */
.date-sep {
  display: flex; align-items: center; gap: 12px;
  padding: 16px var(--chat-gutter) 8px;
  color: var(--text-muted); font-size: 11px; letter-spacing: 0.04em; font-weight: 600;
}
.date-sep::before, .date-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.date-sep > span {
  border: 1px solid var(--border); border-radius: 20px;
  padding: 2px 12px; background: var(--bg); white-space: nowrap;
}

.msg-row {
  display: flex; gap: 12px; padding: var(--msg-row-y) var(--chat-gutter);
  position: relative;
}
/* A change of author starts a new block — this is the single biggest thing
   separating a readable thread from a wall of text. */
.msg-row:not(.grouped) + .msg-row:not(.grouped),
.msg-row.grouped + .msg-row:not(.grouped) { margin-top: 14px; }
.date-sep + .msg-row { margin-top: 0; }
/* Was --surface-alt (#2a2b37) — three steps off the message background, so
   every mouse move flashed a hard band down the thread. --msg-hover is one
   step, the way Slack does it. */
.msg-row:hover { background: var(--msg-hover); }
.msg-row .avatar {
  width: 36px; height: 36px; border-radius: 6px;
  background: var(--brand); color: var(--on-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  overflow: hidden;
}
.msg-row .avatar img { width: 100%; height: 100%; object-fit: cover; }
/* renderAvatar() hard-codes border-radius:50% inline for use elsewhere in the
   app. In the message list a rounded square reads better against the square
   text block — override the inline circle just here. */
.msg-row .avatar .avatar-base,
.msg-row .avatar .avatar-wrap img { border-radius: 8px !important; }
.msg-row .body { flex: 1; min-width: 0; }
/* Cap the measure. At full width on a 1440px screen a line ran ~150
   characters, roughly double a comfortable reading length. */
.msg-row .content,
.msg-row .reply-preview { max-width: 78ch; }
.msg-row .head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px;
}
.msg-row .head .name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.msg-row .head .ts { font-size: 11.5px; color: var(--text-muted); }
.msg-row .content { font-size: var(--msg-fs); line-height: var(--msg-lh); word-wrap: break-word; }
/* FRG-063 — [label](url) is newly supported by renderMarkdown, so chat links
   had never been styled and fell back to the UA default #0000EE: 1.8:1 against
   the dark background, well under WCAG AA. */
.msg-row .content a { color: var(--link); text-decoration: none; }
.msg-row .content a:hover { text-decoration: underline; }
.msg-row .content del { color: var(--text-muted); }
.msg-row.grouped { padding-top: var(--msg-row-y-grouped); padding-bottom: var(--msg-row-y-grouped); }
.msg-row.grouped .avatar { visibility: hidden; height: 0; }
.msg-row.grouped .head { display: none; }
.msg-row .ts-inline {
  position: absolute; top: 1px; left: 20px; width: 36px;
  text-align: center; color: var(--text-muted); font-size: 10px;
  opacity: 0; transition: opacity 0.1s;
}
.msg-row.grouped:hover .ts-inline { opacity: 1; }

.msg-row .deleted { font-style: italic; color: var(--text-muted); }
.msg-row .edited { font-size: 10px; color: var(--text-muted); margin-left: 4px; }
.msg-row .reply-preview {
  font-size: 12px; color: var(--text-muted);
  border-left: 2px solid var(--border); padding: 2px 8px; margin-bottom: 4px;
}
.msg-row .reply-preview strong { color: var(--text); font-weight: 600; }

/* FRG-063 — pills were 11px/2px, small enough to be a fiddly click target and
   easy to miss under a dense thread. Bumped to a comfortable hit area. */
.reactions-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.reaction-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 20px; font-size: 12.5px; line-height: 1.6; cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.12s, background 0.12s;
}
.reaction-pill.mine { background: var(--brand-faint); border-color: var(--brand); color: var(--brand-text); font-weight: 700; }
.reaction-pill:hover { background: var(--surface-alt); border-color: var(--brand); }
/* Trailing "+" — visible only while the row is hovered so it doesn't add
   permanent noise to every reacted message. */
.reaction-pill.add-reaction {
  gap: 2px; padding: 3px 8px; opacity: 0; transition: opacity 0.12s;
}
.reaction-pill.add-reaction span { font-size: 11px; font-weight: 700; }
.msg-row:hover .reaction-pill.add-reaction { opacity: 1; }
.reaction-pill.add-reaction:focus-visible { opacity: 1; }

/* ---- FRG-064: threads ---- */
/* Teaser under a root message. Rendered only when reply_count > 0, so an
   unthreaded channel is byte-identical to before. */
.thread-teaser {
  display: flex; align-items: center; gap: 8px;
  margin-top: 7px; padding: 4px 9px 4px 4px;
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--link); width: fit-content; max-width: 100%;
}
.thread-teaser:hover { background: var(--surface); border-color: var(--border); }
.thread-teaser .faces { display: flex; flex-shrink: 0; }
.thread-teaser .faces .avatar-wrap { margin-right: -4px; }
.thread-teaser .faces .avatar-base,
.thread-teaser .faces img { border-radius: 6px !important; }
.thread-teaser .count { margin-left: 5px; }
.thread-teaser .last { color: var(--text-muted); font-weight: 400; }

.chat-thread-panel {
  display: flex; flex-direction: column; min-width: 0;
  width: 380px; flex-shrink: 0;
  border-left: 1px solid var(--border); background: var(--bg);
  /* A narrow column, so the phone's bubble cap, not the desktop's 68%: at
     68% of a 432px panel a bug report wrapped to seven lines. */
  --bubble-max: 85%;
}
.chat-thread-panel[hidden] { display: none; }
.thread-head {
  display: flex; align-items: center; gap: 9px;
  height: 56px; flex-shrink: 0; padding: 0 8px 0 18px;
  border-bottom: 1px solid var(--border);
}
.thread-head b { font-size: 15.5px; }
.thread-head span { font-size: 12.5px; color: var(--text-muted); }
.thread-close {
  margin-left: auto; width: 32px; height: 32px; border-radius: 7px;
  display: grid; place-items: center;
  background: none; border: none; color: var(--text-muted); cursor: pointer;
}
.thread-close:hover { background: var(--surface-alt); color: var(--text); }
.thread-body { flex: 1; overflow-y: auto; padding: 12px 0; }
/* The panel is narrow — drop the 78ch cap that governs the main stream. */
.thread-body .msg-row .content { max-width: none; }
.thread-count {
  display: flex; align-items: center; gap: 12px;
  padding: 10px var(--chat-gutter) 4px; color: var(--text-muted); font-size: 12px;
}
.thread-count::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.thread-loading { padding: 20px; color: var(--text-muted); font-size: 13px; }
.thread-input-wrap { border-top: 1px solid var(--border); }

/* The shell is a two-column GRID, so the panel needs a column of its own.
   Without one it auto-placed under the channel list, a 260px strip with the
   list and the conversation each squeezed into a 64px row above it (BigJoe,
   production 5.0.0: "not right"). Placed explicitly, on the first row.
   1440, not 1280, since the page gutter (2026-10-04): at 1280 the
   conversation between list and thread was 326px and its header broke into
   "# gene / 11 / m...". At 1440 it keeps 440px. */
@media (min-width: 1440px) {
  .chat-shell.thread-open { grid-template-columns: 260px minmax(0, 1fr) clamp(380px, 30vw, 520px); }
  .chat-shell.thread-open .chat-thread-panel { grid-column: 3; grid-row: 1; width: auto; min-height: 0; }
}
@media (max-width: 1439px) {
  /* Not enough room for three columns — the thread takes over the message
     pane rather than squeezing both into unreadable strips. */
  .chat-shell.thread-open .chat-main { display: none; }
  .chat-shell.thread-open .chat-thread-panel { grid-column: 2; grid-row: 1; flex: 1; width: auto; min-height: 0; border-left: none; }
}
@media (max-width: 768px) {
  /* A phone: the thread is the whole screen. .viewing-messages shows the
     conversation and comes later in this file, so it has to be outranked
     here, or the conversation and its composer sit above the thread. */
  .chat-shell.thread-open.viewing-messages .chat-main { display: none; }
  .thread-close { width: 44px; height: 44px; }
}

/* FRG-063 — member facepile in the channel header. */
.chat-facepile {
  display: flex; align-items: center; flex-shrink: 0;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 3px 9px 3px 4px; cursor: pointer;
}
.chat-facepile:hover { border-color: var(--brand); }
.chat-facepile .avatar-wrap { margin-right: -5px; }
.chat-facepile .avatar-base,
.chat-facepile img { border-radius: 6px !important; }
.chat-facepile > span {
  margin-left: 11px; font-size: 12px; font-weight: 600; color: var(--text-muted);
}

/* FRG-063 — fenced code blocks get a header bar (language + Copy), built in
   chat.js#decorateCodeBlocks. The bare <pre class="code-block"> that other
   renderMarkdown consumers emit is unaffected and keeps its own styling. */
.code-wrap {
  margin: 8px 0; max-width: 680px;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--code-bg);
}
.code-head {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 11px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted);
}
.code-lang { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.code-copy {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 11px; padding: 3px 8px; border-radius: 5px;
}
.code-copy:hover { background: var(--surface-alt); color: var(--text); }
.code-copy.copied { color: var(--success-text); }
.code-wrap > pre.code-block {
  margin: 0; border: none; border-radius: 0; background: none;
  padding: 10px 12px; overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px; line-height: 1.55;
}

.msg-actions {
  position: absolute; top: -10px; right: 20px;
  display: none; gap: 2px; padding: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: var(--shadow-sm);
}
.msg-row:hover .msg-actions { display: flex; }
.msg-actions button {
  background: none; border: none; padding: 4px 6px;
  border-radius: 4px; font-size: 14px; cursor: pointer;
  color: var(--text);
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.msg-actions button:hover { background: var(--surface-alt); }

.file-msg {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 8px;
  margin-top: 4px; max-width: 420px;
}
.file-msg img.preview { max-width: 360px; max-height: 240px; border-radius: 6px; cursor: pointer; }
.file-msg .file-info { flex: 1; min-width: 0; }
.file-msg .file-info .n { font-weight: 600; font-size: 13px; word-break: break-all; }
.file-msg .file-info .m { font-size: 11px; color: var(--text-muted); }

.chat-typing {
  flex-shrink: 0;
  padding: 4px 20px 0;
  font-size: 12px; color: var(--text-muted); min-height: 20px;
}
.chat-typing .dots::after {
  content: '…';
  animation: typing 1.2s steps(4, end) infinite;
}
@keyframes typing {
  0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } 100% { content: ''; }
}
/* FRG-062 — agent "typing" presence: pulsing avatar next to the indicator. */
.chat-typing .typing-row { display: inline-flex; align-items: center; gap: 7px; }
.agent-avatar.typing-pulse {
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid; animation: agent-typing-pulse 1.4s ease-in-out infinite;
}
@keyframes agent-typing-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 currentColor; opacity: 0.85; }
  50% { transform: scale(1.08); box-shadow: 0 0 0 4px transparent; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .agent-avatar.typing-pulse { animation: none; }
}

.chat-input-wrap {
  flex-shrink: 0;
  border-top: 1px solid var(--border); padding: 12px var(--chat-gutter) 16px;
  background: var(--surface);
}
.chat-reply-bar {
  display: flex; gap: 10px; align-items: center;
  background: var(--surface-alt); border: 1px solid var(--border); border-left: 3px solid var(--brand);
  padding: 6px 10px; border-radius: 6px; margin-bottom: 8px;
  font-size: 12px;
}
.chat-reply-bar .close {
  background: none; border: none; color: var(--text-muted); font-size: 14px; cursor: pointer;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
/* FRG-063 — formatting toolbar. Sits flush on top of .chat-input so the two
   read as one composer; the sibling selector below squares off the join. */
.chat-format-bar {
  display: flex; align-items: center; gap: 1px;
  background: var(--surface-alt);
  border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 4px 6px;
}
.chat-format-bar + .chat-input { border-radius: 0 0 8px 8px; }
.fmt-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 26px; padding: 0;
  background: none; border: none; border-radius: 5px;
  color: var(--text-muted); cursor: pointer;
}
.fmt-btn:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.fmt-btn:disabled { opacity: 0.4; cursor: default; }
.fmt-sep { width: 1px; align-self: stretch; margin: 3px 5px; background: var(--border); }

.chat-input {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px;
}
/* Focus ring on the whole composer, not just the textarea. */
.chat-input:focus-within { border-color: var(--brand); }
.chat-format-bar:has(+ .chat-input:focus-within) { border-color: var(--brand); }
.chat-input textarea {
  flex: 1; border: none; background: transparent; resize: none;
  outline: none; font-family: inherit; font-size: var(--msg-fs); color: var(--text);
  line-height: 1.5; padding: 4px 6px; max-height: 140px;
}
.chat-input textarea:focus { box-shadow: none; }
.chat-input button {
  background: none; border: none; color: var(--text-muted);
  padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 16px;
}
.chat-input button:hover { background: var(--border); color: var(--text); }
.chat-input button.send {
  background: var(--brand); color: var(--on-brand); padding: 6px 14px; font-weight: 600;
}
.chat-input button.send:hover { background: var(--brand-hover); }
.chat-input button.send:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

/* feat/chat-emoji-picker — full categorized, searchable picker. Desktop:
   popover (absolute, positioned in JS above the trigger). Mobile: a bottom
   sheet (.emoji-picker-sheet) sized for the pinned chat layout. */
.emoji-picker {
  position: absolute; z-index: 3000;
  width: 320px; max-width: calc(100vw - 16px); max-height: 360px;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.emoji-search { padding: 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.emoji-search-input {
  width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text);
  font-size: 14px; outline: none;
}
.emoji-cats {
  display: flex; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0;
}
.emoji-cats button {
  flex: 0 0 auto; background: none; border: none; font-size: 18px; line-height: 1;
  padding: 4px 6px; border-radius: 6px; cursor: pointer;
}
.emoji-cats button:hover { background: var(--surface-alt); }
.emoji-grid { flex: 1; overflow-y: auto; padding: 6px; }
.emoji-sec-label {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 700; margin: 6px 4px 4px;
}
.emoji-sec-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.emoji-sec-grid button {
  font-size: 22px; line-height: 1; background: none; border: none;
  padding: 4px 0; border-radius: 6px; cursor: pointer;
}
.emoji-sec-grid button:hover { background: var(--surface-alt); }
.emoji-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* PR C — picker panels, tabs (Emoji | GIF), and the GIF library grid. */
.picker-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.picker-tabs { display: flex; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.picker-tab {
  flex: 1; background: none; border: none; padding: 9px 0; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent;
}
.picker-tab.active { color: var(--text); border-bottom-color: var(--brand); }
.gif-grid {
  flex: 1; overflow-y: auto; padding: 8px; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 6px; align-content: start;
}
.gif-add {
  aspect-ratio: 1; border: 1px dashed var(--border); border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; cursor: pointer; color: var(--text-muted); font-size: 12px;
}
.gif-add:hover { background: var(--surface-alt); }
.gif-add-plus { font-size: 22px; line-height: 1; }
.gif-tile { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--surface-alt); }
.gif-tile img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.gif-del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.gif-empty { grid-column: 1 / -1; }

/* feat/chat-voice-notes — inline audio player in bubbles + the record/preview bar. */
.audio-player { width: 240px; max-width: 100%; height: 36px; display: block; }
.voice-bar { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; box-sizing: border-box; }
.voice-dot { width: 10px; height: 10px; border-radius: 50%; background: #e23b3b; flex-shrink: 0; animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.voice-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.voice-label { color: var(--text-muted); font-size: 13px; }
.voice-dur { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.voice-prev-audio { flex: 1; min-width: 0; height: 36px; }
.voice-bar button.voice-stop, .voice-bar button.voice-send {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px;
  border: none; border-radius: 16px; cursor: pointer; font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.voice-bar button.voice-stop { margin-left: auto; background: #e23b3b; }
.voice-bar button.voice-send { background: var(--brand); color: var(--on-brand); }
.voice-cancel, .voice-discard { flex-shrink: 0; }

/* ── Today, 2026-09 (docs/proposals/todays-work-mobile-first.md) ─────────────
   Today's Work, built for the phone first and widened for desktop. Same row
   language as Drive: one row shape, no per-row borders, no always-on text
   buttons, actions in a "⋯" menu (and inline on hover, where there is hover).

   The phone budget (375x812, 688px between the header and the bottom nav):
   the day card, Meetings, Work and Personal all fit without scrolling, because
   each group shows 3 rows (meetings 2) and then "+N more".

   Colours are tokens only. The day card and hover use Drive's measured 10%
   brand tint (never more: at 16% muted text fell to 4.11:1). Done is shown by a
   filled tick and a struck title, never by opacity — dimming a past item with
   opacity measured 2.47:1. Ratios are pinned in todays-work-mobile.test.ts. */
.tdy {
  --tdy-tint: color-mix(in srgb, var(--brand) 10%, var(--surface));
  display: flex; flex-direction: column; gap: 18px;
  /* 1600px and NOT centred: the "remove open spaces in todays work" decision
     (workflow-landing-and-spacing.test.ts). 1100px left an ordinary monitor
     half empty, and centring put the empty space on both sides. */
  max-width: 1600px; min-width: 0;
  padding: 12px 12px calc(56px + env(safe-area-inset-bottom, 0px) + 20px);
  color: var(--text);
}
.tdy-loading { padding: 24px 16px; color: var(--text-muted); }
.tdy-failed { color: var(--danger-text); }

/* The day, in a sentence. */
.tdy-day {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 14px 14px 16px; border-radius: 14px; background: var(--tdy-tint);
}
.tdy-day-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tdy-date { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.tdy-stale .tdy-date::after { content: " · updating"; font-weight: 400; }
.tdy-summary { font-size: 18px; font-weight: 650; line-height: 1.25; letter-spacing: -0.2px; }
.tdy-big { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 14px; }
.tdy-big-label { flex: none; color: var(--text-muted); }
.tdy-big-title {
  min-width: 0; padding: 0; border: 0; background: none; font: inherit; font-weight: 600;
  color: var(--text); text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tdy-big-title:hover, .tdy-big-title:focus-visible { text-decoration: underline; outline: none; }
.tdy-overnight {
  display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 2px;
  font-size: 13px; color: var(--text-muted);
}
.tdy-overnight span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The agent-written line: same place, same ink; a sparkle instead of the bell
   says who wrote it, and the label is there for screen readers too. */
.tdy-overnight-agent { color: var(--text); align-items: flex-start; }
.tdy-overnight-agent > span:not(.tdy-sr) {
  white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.tdy-overnight-agent svg { margin-top: 2px; }
.tdy-overnight-agent svg { color: var(--brand-text); flex: none; }
.tdy-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Progress ring. Stroke is --brand-text (derived per workspace to clear 4.5:1
   on the surface); the track is the border colour. */
.tdy-ring { position: relative; flex: none; width: 56px; height: 56px; }
.tdy-ring svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.tdy-ring circle { fill: none; stroke-width: 5; }
.tdy-ring-track { stroke: var(--border); }
.tdy-ring-fill { stroke: var(--brand-text); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.tdy-ring-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text);
}
.tdy-ring.is-complete .tdy-ring-label { color: var(--brand-text); }
.tdy-ring.is-complete { animation: tdy-ring-done .5s ease-out 1; }
@keyframes tdy-ring-done { 0% { transform: scale(1); } 45% { transform: scale(1.1); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .tdy-ring.is-complete { animation: none; }
  .tdy-ring-fill { transition: none; }
}

/* Groups. */
.tdy-group { display: flex; flex-direction: column; min-width: 0; }
.tdy-group-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 0 4px 0 12px; }
.tdy-group-title {
  margin: 0; display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted);
}
.tdy-count {
  min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2);
  font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--text); text-align: center;
}
.tdy-add {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--brand-text); cursor: pointer;
}
.tdy-add:hover, .tdy-add:focus-visible { background: var(--tdy-tint); outline: none; }
.tdy-list { display: flex; flex-direction: column; }
.tdy-quiet { padding: 8px 12px; font-size: 14px; color: var(--text-muted); }

/* One row shape for tasks and meetings. */
.tdy-row {
  position: relative; display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 2px 4px 2px 0; border-radius: 10px; cursor: pointer;
}
.tdy-row:hover, .tdy-row:focus-within { background: var(--tdy-tint); }
.tdy-row:focus-visible { outline: none; background: var(--tdy-tint); box-shadow: inset 3px 0 0 var(--brand-text); }
.tdy-row-main { flex: 1; min-width: 0; padding: 3px 0; }
.tdy-row-title { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 15px; font-weight: 500; line-height: 1.3; }
.tdy-title-text {
  min-width: 0; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.tdy-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.tdy-ticket {
  flex: none; padding: 1px 6px; border-radius: 5px; background: var(--surface-2);
  font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-muted);
}
.tdy-row-note, .tdy-row-meta {
  font-size: 13px; line-height: 1.35; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tdy-row-meta { margin-top: 2px; font-variant-numeric: tabular-nums; }
.tdy-working { color: var(--brand-text); font-weight: 600; }
.tdy-task.is-done .tdy-title-text { text-decoration: line-through; color: var(--text-muted); }

/* The tick: a 44px target around a 22px circle. */
.tdy-tick {
  flex: none; position: relative; width: 44px; height: 44px; margin: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.tdy-tick::before {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--text-muted); background: var(--surface); box-sizing: border-box;
  transition: border-color .15s, background .15s;
}
.tdy-tick-mark { position: relative; display: inline-flex; color: var(--on-brand); opacity: 0; transition: opacity .15s; }
.tdy-tick:hover::before, .tdy-tick:focus-visible::before { border-color: var(--brand-text); }
.tdy-tick:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -4px; }
.tdy-task.is-done .tdy-tick::before { background: var(--brand); border-color: var(--brand); }
.tdy-task.is-done .tdy-tick-mark { opacity: 1; }
.tdy-tick-slot { flex: none; width: 44px; display: inline-flex; justify-content: center; color: var(--text-muted); }

/* Work actions: the work-order control inline on hover, everything in "⋯". */
.tdy-actions { flex: none; display: flex; align-items: center; gap: 2px; }
.tdy-icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer;
}
.tdy-icon-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.tdy-icon-btn:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; color: var(--text); }
.tdy-inline { opacity: 0; }
.tdy-row:hover .tdy-inline, .tdy-row:focus-within .tdy-inline { opacity: 1; }
.tdy-menu-wrap { position: relative; }
.tdy-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 200px; padding: 4px;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.tdy-menu[hidden] { display: none; }
.tdy-menu-item {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.tdy-menu-item:hover, .tdy-menu-item:focus-visible { background: var(--tdy-tint); outline: none; }
/* "Pick a day": the native date input, so every phone gets its own picker. */
.tdy-pick { cursor: pointer; }
.tdy-pick-input {
  margin-left: auto; min-height: 32px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
}
.tdy-pick-input:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 1px; }

/* Meetings. */
.tdy-meet { padding-left: 12px; }
.tdy-time {
  flex: none; min-width: 92px; font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.tdy-new {
  flex: none; padding: 2px 8px; border-radius: 999px;
  background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700;
}
.tdy-join {
  flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border-radius: 8px; background: var(--brand); color: var(--on-brand);
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.tdy-join:hover { background: var(--brand-hover); color: var(--on-brand-hover); }

/* 2026-10-14 — every meeting, by day, in ONE bounded box that scrolls
   (todays-work.js meetingsGroup). Bounded so a full calendar never pushes Work
   and Personal off the screen; the day heading sticks at the top of the box
   while its meetings scroll under it, so you always know which day you are
   looking at. The box carries its own surface: the sticky heading needs an
   opaque background, and the page has none of its own. */
.tdy-meet-scroll {
  max-height: min(360px, 48vh); overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  padding: 0 4px 6px;
}
.tdy-meet-scroll:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.tdy-meet-day-head {
  position: sticky; top: 0; z-index: 1;
  margin: 0; padding: 10px 12px 4px; background: var(--surface);
  font-size: 13px; font-weight: 700; color: var(--text);
}
.tdy-meet-day + .tdy-meet-day .tdy-meet-day-head { border-top: 1px solid var(--border); }
.tdy-meet.is-ended .tdy-time, .tdy-meet.is-ended .tdy-row-title { color: var(--text-muted); }
.tdy-ended {
  flex: none; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); font-size: 12px; font-weight: 600;
}
@media (max-width: 768px) {
  .tdy-meet-scroll { max-height: min(280px, 40vh); }
}

/* One foot row per group: "+N more", waiting, done today, earlier — chips
   side by side rather than a full-width row each. The folded list opens
   underneath. */
.tdy-group-foot { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 0 40px; }
.tdy-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
}
.tdy-chip svg { color: var(--text-muted); }
.tdy-chip:hover, .tdy-chip:focus-visible { border-color: var(--brand-text); outline: none; }
.tdy-chip[aria-expanded="true"] { background: var(--tdy-tint); border-color: var(--brand-text); }
.tdy-fold { margin-top: 4px; }
.tdy-head-note { flex: 1; margin-left: 10px; font-size: 14px; color: var(--text-muted); }

/* Footnote. */
.tdy-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 4px 8px; font-size: 13px; color: var(--text-muted);
}
.tdy-later { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-text); text-decoration: none; font-weight: 600; }
.tdy-later:hover { text-decoration: underline; }
.tdy-link-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer;
}
.tdy-link-btn:hover { border-color: var(--brand-text); }
.tdy-legend { display: inline-flex; flex-wrap: wrap; gap: 12px; margin-left: auto; font-size: 12px; }
.tdy-legend-item { display: inline-flex; align-items: center; gap: 5px; }

/* Phone, and any device without hover: 44px targets, actions only in "⋯",
   one line of notes, no ticket chip. */
@media (max-width: 768px), (hover: none) {
  .tdy-inline { display: none; }
  .tdy-icon-btn, .tdy-add { width: 44px; height: 44px; }
  .tdy-chip, .tdy-join, .tdy-link-btn { min-height: 44px; }
  .tdy-menu-item { min-height: 44px; }
}
@media (max-width: 768px) {
  .tdy { gap: 12px; padding-top: 0; }
  .tdy-day { padding: 12px 12px 12px 14px; gap: 10px; }
  .tdy-summary { font-size: 17px; }
  .tdy-ring, .tdy-ring svg { width: 48px; height: 48px; }
  .tdy-group-foot { padding-left: 44px; }
  .tdy-ticket { display: none; }
  .tdy-row-note ~ .tdy-row-note { display: none; }
  .tdy-legend { margin-left: 0; }
}

/* Desktop: the same page, in two columns — the day and meetings on the left,
   work and personal on the right. Widened, never redesigned. */
@media (min-width: 1024px) {
  .tdy {
    display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    column-gap: 32px; row-gap: 18px; align-items: start; padding: 24px 24px 32px;
  }
  .tdy-day { grid-column: 1; grid-row: 1; }
  .tdy-meetings { grid-column: 1; grid-row: 2 / span 2; }
  .tdy-work { grid-column: 2; grid-row: 1 / span 2; }
  .tdy-personal { grid-column: 2; grid-row: 3; }
  .tdy-foot { grid-column: 1 / -1; grid-row: 4; }
}

/* ── Schedule, 2026-09 (docs/proposals/todays-work-mobile-first.md §4) ─────────
   Work Schedule, in Today's language: task rows ARE Today's rows (.tdy-row …),
   chips and menus are Today's, and the tint is the same measured 10%. What is
   the Schedule's own: the week of day columns, the load bar, the month grid.

   Phone: the week is a list of days, one under the other, and tasks move with
   "⋯ → Tomorrow / Pick a day". Desktop: seven columns, and a task can be
   dragged to another day. Days that have passed take no drop. */
.wks {
  --tdy-tint: color-mix(in srgb, var(--brand) 10%, var(--surface));
  display: flex; flex-direction: column; gap: 12px;
  max-width: 1600px; min-width: 0;
  padding: 12px 12px calc(56px + env(safe-area-inset-bottom, 0px) + 20px);
  color: var(--text);
}
.wks-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.wks-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.wks-range { margin: 0 0 0 8px; font-size: 17px; font-weight: 650; letter-spacing: -0.2px; }
.wks-views { display: flex; gap: 6px; }
.wks-views .tdy-chip[aria-pressed="true"] { background: var(--tdy-tint); border-color: var(--brand-text); }
.wks-summary { margin: 0; padding: 0 4px; font-size: 14px; color: var(--text-muted); }

/* The week: a list of days on a phone, seven columns from 1024px. */
.wks-week { display: flex; flex-direction: column; gap: 14px; }
.wks-day {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 8px 4px 8px 8px; border-radius: 12px;
}
.wks-day.is-today { background: var(--tdy-tint); }
.wks-day.is-drop { box-shadow: inset 0 0 0 2px var(--brand-text); }
.wks-day-head { display: flex; align-items: baseline; gap: 6px; padding: 0 4px; }
.wks-dow { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.wks-date { font-size: 18px; font-weight: 650; }
.wks-today {
  padding: 1px 8px; border-radius: 999px; background: var(--brand); color: var(--on-brand);
  font-size: 12px; font-weight: 700;
}
.wks-load { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* A thin bar under the load figure. Information, not a warning: it fills to
   the day's share of the person's own weekly capacity and never turns red. */
.wks-bar { height: 3px; margin: 2px 4px 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.wks-bar > span { display: block; height: 100%; background: var(--brand-text); }
.wks-meet {
  display: flex; align-items: baseline; gap: 8px; min-height: 36px; padding: 4px 8px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: 14px;
}
.wks-meet:hover, .wks-meet:focus-visible { background: var(--tdy-tint); outline: none; }
.wks-meet-time { flex: none; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wks-meet-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wks-list .tdy-row { padding-left: 8px; }
.wks-task[draggable="true"] { cursor: grab; }
.wks-task.is-dragging { opacity: .5; }
.wks-empty { padding: 4px 8px 8px; font-size: 13px; color: var(--text-muted); }
/* Your own unavailable / out-of-office time on the day: neutral, as on the calendar. */
.wks-away {
  margin: 2px 4px; padding: 4px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--text) 8%, var(--surface)); color: var(--text);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* The month: a grid of days; a day opens its week. */
.wks-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.wks-mdow { padding: 4px 6px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.wks-cell {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; min-height: 96px;
  padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  font: inherit; text-align: left; color: var(--text); cursor: pointer;
}
.wks-cell:hover, .wks-cell:focus-visible { background: var(--tdy-tint); border-color: var(--brand-text); outline: none; }
.wks-cell.is-out { background: transparent; }
.wks-cell.is-out .wks-cell-date { color: var(--text-muted); }
.wks-cell.is-today { border-color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--brand-text); }
.wks-cell-date { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wks-cell-item {
  display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wks-cell-more, .wks-cell-meet { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }

@media (max-width: 768px) {
  .wks { padding-top: 0; }
  .wks-range { font-size: 16px; }
  .wks-cell { min-height: 56px; padding: 4px; }
  .wks-cell-item, .wks-cell-more { display: none; }
  /* A past day with nothing on it is not worth a screen of scrolling on a phone. */
  .wks-day.is-past.is-empty { display: none; }
}
@media (max-width: 768px), (hover: none) {
  .wks-meet { min-height: 44px; }
}
@media (min-width: 1024px) {
  .wks { padding: 24px 24px 32px; }
  .wks-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
  .wks-day { min-height: 320px; padding: 8px 4px; }
  .wks-day:not(.is-today) { background: color-mix(in srgb, var(--text) 3%, transparent); }
  .wks-list .tdy-row { padding-left: 6px; }
  .wks-list .tdy-row-title { font-size: 14px; }
  /* A narrow column: let the title and its detail wrap rather than cut to a word. */
  .wks-list .tdy-title-text { -webkit-line-clamp: 3; }
  .wks-list .tdy-row-meta { white-space: normal; }
}
/* With a mouse, "⋯" floats over the row on hover instead of taking a column
   of every row's width. Touch keeps it in place and always visible. */
@media (min-width: 1024px) and (hover: hover) {
  .wks-list .tdy-row { padding-right: 4px; }
  .wks-list .tdy-actions { position: absolute; top: 4px; right: 4px; border-radius: 8px; background: var(--surface); opacity: 0; }
  .wks-list .tdy-row:hover .tdy-actions, .wks-list .tdy-row:focus-within .tdy-actions { opacity: 1; }
}

/* ── Calendar, 2026-09 (docs/proposals/calendar-build.md) ──────────────────────
   The Meetings calendar: a side panel and an hour grid (<forge-cal-grid>), in
   the language of Today's Work and Work Schedule — their toolbar, chips, rows
   and menus are reused as they are, and the tints are the measured ones.

   BLOCKS, measured across the seven staging brands in both themes
   (calendar-contrast.test.ts):
   - YOUR MEETINGS: a 14% brand tint, every word on it in --text (title, time
     and channel). --text-muted fails on 14% (4.37:1), so it is not used there.
     A 3px --brand-text edge (non-text, >= 3:1).
   - OTHER PEOPLE'S TIME: a neutral 8% fill with a faint hatch, the name in
     --text and the honest label ("Busy", "Unavailable", "Out of office") in
     --text-muted — measured against the hatch's darker stripe, not the fill.
   - PAST AND CANCELLED: the same neutral fill, never opacity (2.47:1 measured).
   - Hover, selection and today use the house 10%. */
.cal-page {
  --tdy-tint: color-mix(in srgb, var(--brand) 10%, var(--surface));
  --cal-row: 24px;
  --cal-meeting: color-mix(in srgb, var(--brand) 14%, var(--surface));
  --cal-neutral: color-mix(in srgb, var(--text) 8%, var(--surface));
  --cal-hatch: color-mix(in srgb, var(--text) 11%, var(--surface));
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px;
  max-width: 1600px; min-width: 0;
  padding: 12px 12px calc(56px + env(safe-area-inset-bottom, 0px) + 20px);
  color: var(--text);
}
.cal-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cal-new {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 0; border-radius: 999px; background: var(--brand); color: var(--on-brand);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.cal-new:hover { background: var(--brand-hover); color: var(--on-brand-hover); }
.cal-new:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.cal-hint { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--tdy-tint); font-size: 14px; }
/* 2026-11-21 — the selection tip: a small card over the grid's corner, not a
   bar above it. Lighter than a banner: surface, hairline border, muted text. */
/* Fixed to the window's corner: the calendar column can be taller than the
   window, and a tip below the fold teaches nobody. Only drawn on Calendar. */
.cal-tip {
  position: fixed; right: 16px; bottom: 16px; z-index: 40; max-width: 320px;
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 6px 8px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md);
  color: var(--text-muted); font-size: 13px; line-height: 1.4;
}
.cal-tip > i, .cal-tip > svg { flex: none; margin-top: 2px; color: var(--text-muted); }
.cal-tip p { margin: 0; }
.cal-tip-x { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin: -2px 0 0; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text-muted); cursor: pointer; }
.cal-tip-x:hover { background: var(--surface-alt); color: var(--text); }
.cal-tip-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 768px) {
  .cal-tip { left: 12px; right: 12px; max-width: none; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px); }
}
/* The date heading picks a date (the mini month is gone). */
.wks-range { position: relative; }
.wks-range-pick { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 2px 6px; margin: -2px -6px; border-radius: 8px; cursor: pointer; }
.wks-range-pick:hover { background: var(--surface-alt); }
.wks-range-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-date-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
/* 2026-11-20 — action points from minutes waiting on the viewer (meetings-page.js waitingHtml). */
.cal-waiting { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--tdy-tint); font-size: 14px; }
.cal-waiting h2 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.cal-waiting ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.cal-waiting li { display: flex; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.cal-waiting li span { color: var(--text-muted); overflow-wrap: anywhere; }

.cal-danger { color: var(--danger-text); }
.wks-views .tdy-chip[aria-checked="true"] { background: var(--tdy-tint); border-color: var(--brand-text); }

/* ── The grid ── */
/* --cal-days: a week unless the grid says otherwise (it sets it inline). */
.cal-grid { --cal-days: 7; --cal-gutter: 52px; min-width: 0; border-radius: 12px; background: var(--surface); }
.cal-head, .cal-allday, .cal-body {
  display: grid; grid-template-columns: var(--cal-gutter) repeat(var(--cal-days), minmax(0, 1fr));
}
.cal-head { border-bottom: 1px solid var(--border); }
/* Wraps: a phone's week column (~45px) cannot hold "MON 28" on one line, and
   unwrapped the names ran into the next day's number. */
.cal-dayhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; row-gap: 2px; padding: 8px 8px 6px; min-width: 0; }
.cal-dow { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.cal-dnum { font-size: 18px; font-weight: 650; }
.cal-dayhead.is-today .cal-dnum {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 999px; background: var(--brand); color: var(--on-brand);
}
.cal-allday { border-bottom: 1px solid var(--border); }
.cal-allday-label { display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; font-size: 12px; color: var(--text-muted); }
.cal-allday-cell { display: flex; flex-direction: column; gap: 2px; padding: 3px; min-width: 0; }
.cal-scroll { max-height: calc(100vh - 230px); overflow-y: auto; overscroll-behavior: contain; }
.cal-body { position: relative; }
.cal-hours { position: relative; }
.cal-hour { position: relative; height: calc(var(--cal-row) * 2); }
.cal-hour span {
  position: absolute; top: -7px; right: 6px; font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.cal-col {
  position: relative; min-width: 0; height: calc(var(--cal-row) * 48);
  border-left: 1px solid var(--border);
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 100% calc(var(--cal-row) * 2);
  cursor: pointer; touch-action: pan-y;
}
.cal-col.is-today { background-color: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
.cal-col.is-past { cursor: default; }
/* 2026-11-20 — selectable empty time says so: a cell cursor, and a faint slot under the mouse (cal-grid.js). */
forge-cal-grid.is-bookable .cal-col:not(.is-past) { cursor: cell; }
.cal-hover-slot { position: absolute; left: 2px; right: 2px; height: var(--cal-row); border: 1px dashed color-mix(in srgb, var(--brand-text) 55%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--text-muted); font-size: 11px; line-height: 1; padding: 3px 6px; white-space: nowrap; overflow: hidden; pointer-events: none; z-index: 1; }
/* Behind the blocks (z 1), not over them: at z 3 the line ran through a
   meeting's title and read as a strikethrough. The fills are opaque, so it
   shows either side of an event and its dot stays out in the column edge. */
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--brand-text); pointer-events: none; z-index: 0; }
.cal-now::before {
  content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-text);
}
.cal-selection {
  position: absolute; left: 2px; right: 2px; z-index: 2; pointer-events: none;
  border: 2px dashed var(--brand-text); border-radius: 8px; background: var(--tdy-tint);
}

/* ── Blocks ── */
.cal-block {
  position: absolute; z-index: 1; display: flex; flex-direction: column; gap: 1px; overflow: hidden;
  padding: 3px 6px; border: 0; border-radius: 7px; text-align: left; font: inherit;
  font-size: 12.5px; line-height: 1.25; color: var(--text); cursor: default;
}
.cal-allday-cell .cal-block { position: static; min-height: 24px; justify-content: center; }
button.cal-block { cursor: pointer; }
/* Someone else's time is not openable, and must not stop you booking into it:
   a click goes through to the slot underneath (and the form names the clash). */
div.cal-block { pointer-events: none; }
button.cal-block:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 1px; z-index: 4; }
.cal-block-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-block-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cal-block-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Half an hour or less: one line — time, then title. */
.cal-block.is-short { flex-direction: row; align-items: center; gap: 6px; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
.cal-block.is-short .cal-block-sub { display: none; }
.cal-block-title { white-space: nowrap; }

/* Your meetings. */
.cal-block.is-meeting { background: var(--cal-meeting); box-shadow: inset 3px 0 0 var(--brand-text); }
.cal-block.is-meeting:hover { filter: none; background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
/* Other people's time, and your own marked time: neutral, hatched. */
.cal-block.is-busy, .cal-block.is-unavailable, .cal-block.is-out_of_office, .cal-block.is-focus {
  background: repeating-linear-gradient(135deg, var(--cal-neutral) 0 8px, var(--cal-hatch) 8px 10px);
}
.cal-block.is-busy .cal-block-sub, .cal-block.is-unavailable .cal-block-sub, .cal-block.is-out_of_office .cal-block-sub, .cal-block.is-focus .cal-block-sub,
.cal-block.is-busy .cal-block-time, .cal-block.is-unavailable .cal-block-time, .cal-block.is-out_of_office .cal-block-time, .cal-block.is-focus .cal-block-time { color: var(--text-muted); }
/* 2026-11-20 — your own focus time: plain tint, not the hatch that says "not available". */
.cal-block.is-focus { background: color-mix(in srgb, var(--success, #3fb27f) 14%, var(--surface)); }
.cal-block.is-own { box-shadow: inset 3px 0 0 var(--brand-text); }
.cal-block.is-own .cal-block-sub { color: var(--text); }
/* Past and cancelled meetings: neutral, never faded. */
.cal-block.is-meeting.is-past, .cal-block.is-meeting.is-cancelled { background: var(--cal-neutral); box-shadow: inset 3px 0 0 var(--border); }
.cal-block.is-cancelled .cal-block-title { text-decoration: line-through; }

/* ── The side panel ── */
.cal-panel { display: none; flex-direction: column; gap: 18px; min-width: 0; }
.cal-mini { display: flex; flex-direction: column; gap: 4px; }
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 650; }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-mini-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); padding: 2px 0; }
.cal-mini-day {
  position: relative; height: 32px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums;
}
.cal-mini-day:hover, .cal-mini-day:focus-visible { background: var(--tdy-tint); outline: none; }
.cal-mini-day.is-out { color: var(--text-muted); }
.cal-mini-day.is-today { font-weight: 800; box-shadow: inset 0 0 0 1px var(--brand-text); }
.cal-mini-day.is-on { background: var(--brand); color: var(--on-brand); }
.cal-mini-day.has-meeting::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor;
}
.cal-people { display: flex; flex-direction: column; gap: 8px; }
.cal-people .tdy-group-title { padding: 0 4px; }
.cal-people-search {
  display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-muted);
}
.cal-people-search:focus-within { border-color: var(--brand-text); }
.cal-people-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; }
.cal-people-results { display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.cal-people-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-person { gap: 4px; padding-right: 4px; }
.cal-person-x {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer;
}
.cal-person-x:hover, .cal-person-x:focus-visible { background: var(--tdy-tint); color: var(--text); outline: none; }
.cal-quiet { margin: 0; padding: 4px; font-size: 13px; color: var(--text-muted); }
.cal-lists { display: flex; flex-direction: column; gap: 8px; }
.cal-list-row { width: 100%; border: 0; background: transparent; font: inherit; text-align: left; color: var(--text); padding-left: 8px; }
.cal-list-row.is-cancelled .tdy-title-text { text-decoration: line-through; color: var(--text-muted); }
/* 2026-10-04 — a title with a word longer than the column (a pasted link, a
   name with no spaces) breaks inside the word rather than running out of
   the column. The column also clips
   sideways, so nothing in the side panel can ever draw over the calendar. */
/* 2026-10-04 (BigJoe on 5.9.0: "it mustn't cut off the text, it must show the
   full text"): the WHOLE title, on as many lines as it needs, inside its own
   column. He tells meetings apart by their long titles. Not clamped. */
.cal-list-row .tdy-title-text { display: block; -webkit-line-clamp: unset; overflow: visible; overflow-wrap: anywhere; }
.cal-panel { overflow-x: clip; }
.cal-more { align-self: flex-start; }
/* ── International time zones (2026-11-19, BigJoe) ──
   components/world-clock.js. One row per city: state dot, code, city, the
   live local time, and the offset from the viewer's own zone. The row says
   at a glance whether people there are working (green), awake but off
   (amber) or probably asleep (hollow dot, row dimmed). */
.cal-clocks { display: flex; flex-direction: column; gap: 6px; }
.cal-clocks .tdy-group-title { padding: 0 4px; }
.cal-clock-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.cal-clock {
  display: grid; grid-template-columns: 8px 30px minmax(0, 1fr) auto 40px; align-items: center; gap: 6px;
  min-height: 30px; padding: 0 4px; border-radius: 8px; font-size: 13px; color: var(--text);
}
.cal-clock + .cal-clock { border-top: 1px solid var(--border); }
.cal-clock-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--text-muted); box-sizing: border-box;
}
.cal-clock.is-work .cal-clock-dot, .cal-clock-keyitem.is-work .cal-clock-dot { background: var(--success); }
.cal-clock.is-off .cal-clock-dot, .cal-clock-keyitem.is-off .cal-clock-dot { background: var(--warn); }
.cal-clock.is-asleep .cal-clock-dot, .cal-clock-keyitem.is-asleep .cal-clock-dot { background: transparent; border: 1.5px solid var(--text-muted); }
.cal-clock-code { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--text-muted); }
.cal-clock-city { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-clock-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-clock-day { margin-left: 1px; font-size: 10px; font-weight: 700; color: var(--text-muted); }
.cal-clock-day:empty { display: none; }
.cal-clock-off { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; }
/* Asleep: the row steps back, so who can take a call stands out. */
.cal-clock.is-asleep .cal-clock-city, .cal-clock.is-asleep .cal-clock-time { color: var(--text-muted); font-weight: 400; }
.cal-clock.is-asleep .cal-clock-city { font-weight: 500; }
/* The viewer's own clock (same offset): marked, not hidden. */
.cal-clock.is-you { background: var(--tdy-tint); }
.cal-clock-key { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 0; padding: 0 4px; font-size: 12px; color: var(--text-muted); }
.cal-clock-keyitem { display: inline-flex; align-items: center; gap: 5px; }
.cal-cell-time { font-weight: 700; margin-right: 4px; font-variant-numeric: tabular-nums; }
.cal-cell-away { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.wks-cell-item.is-cancelled { text-decoration: line-through; color: var(--text-muted); }

/* ── Work Schedule on the calendar (2026-09-28) ──
   The page is .cal-page like Meetings and draws with the same parts
   (util/cal-shell.js, <forge-cal-grid>). Only what is new lives here:
   capacity on each day's header, planned tasks in the day lane, the panel. */
.wks-cap { flex-basis: 100%; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wks-cap .wks-load { margin-left: 0; }
.wks-cap .wks-bar { margin: 0; }
/* The lane holds tasks, so it earns more room than a meeting's all-day strip,
   but never so much that the hours leave the screen. */
/* The grid occupies the SAME box as Meetings' (header + hours = 100vh - 186px,
   i.e. .cal-scroll's calc(100vh - 230px) plus its 44px header). The task lane and
   the capacity line take their room from inside it, so the page never scrolls. */
.wks-cal .cal-grid { display: flex; flex-direction: column; height: calc(100vh - 186px); }
.wks-cal .cal-head { flex: none; }
.wks-cal .cal-allday { flex: 0 0 auto; max-height: 40%; overflow-y: auto; }
.wks-cal .cal-scroll { flex: 1 1 auto; max-height: none; min-height: 120px; }
/* Phone: the grid is flexed into the page instead — see the .cal-page block
   under "Phone: the day view" below. */
.wks-cal .cal-allday-cell { gap: 4px; padding: 4px; min-height: 44px; }
/* Rows keep their height; a full lane scrolls (.cal-allday) rather than the
   rows shrinking into each other inside the capped lane. */
.wks-cal .cal-allday-cell > * { flex-shrink: 0; }
.wks-cal .cal-allday-cell.is-drop { background: var(--tdy-tint); box-shadow: inset 0 0 0 2px var(--brand-text); border-radius: 8px; }
.wks-lane-task { min-height: 0; padding: 4px 2px 4px 6px; gap: 4px; border-radius: 8px; align-items: flex-start; }
.wks-lane-task .tdy-row-title { font-size: 13px; }
.wks-lane-task .tdy-row-meta { font-size: 12px; }
/* A week lane is a seventh of the grid: the title is what matters there, so
   the meta line goes (Day view keeps it) and ⋯ shrinks to the 32px desktop floor. */
.wks-cal forge-cal-grid.is-week .wks-lane-task .tdy-row-meta { display: none; }
.wks-cal forge-cal-grid.is-week .wks-lane-task .tdy-more { width: 32px; height: 32px; min-width: 32px; }
.wks-cal forge-cal-grid.is-week .wks-lane-task { padding-right: 0; }
/* On a pointer device the week lane gives the title the whole row: ⋯ floats in
   the corner and shows on hover or keyboard focus (Drive's inline-action rule).
   Touch keeps it always visible. */
@media (hover: hover) {
  .wks-cal forge-cal-grid.is-week .wks-lane-task { position: relative; }
  .wks-cal forge-cal-grid.is-week .wks-lane-task .tdy-actions {
    position: absolute; top: 0; right: 0; opacity: 0; border-radius: 8px; background: var(--surface);
  }
  .wks-cal forge-cal-grid.is-week .wks-lane-task:hover .tdy-actions,
  .wks-cal forge-cal-grid.is-week .wks-lane-task:focus-within .tdy-actions { opacity: 1; }
}
/* A phone's week: a column is ~45px, too narrow for a title. Each day shows a
   count that opens the Day view (tasks live there); the header keeps the
   planned hours and the bar, and drops "of Yh" (the bar says it). */
.wks-lane-count { display: none; }
@media (max-width: 768px) {
  .wks-cal forge-cal-grid.is-week .wks-lane-task { display: none; }
  .wks-cal forge-cal-grid.is-week .wks-lane-count {
    display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 44px;
    padding: 4px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    color: var(--text); font: inherit; font-size: 15px; font-weight: 650; line-height: 1.1; cursor: pointer;
  }
  .wks-cal forge-cal-grid.is-week .wks-lane-count span { font-size: 11px; font-weight: 500; color: var(--text-muted); }
  .wks-cal forge-cal-grid.is-week .wks-of { display: none; }
}
.cal-panel-close { display: none; }
@media (max-width: 1023px) {
  .cal-page.panel-open .cal-panel-close { display: inline-flex; align-self: flex-end; flex: none; }
}
.wks-cell-cap { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* 2026-11-20 — work with no day (overdue, or in progress undated), said apart
   from the day's figure and never added to it. Quiet, like the figure: a fact,
   not an alarm (the "no pressure" rule above .wks-bar). */
.wks-needs { display: block; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: underline dotted; text-underline-offset: 2px; }
.wks-panel-needs { margin: 0; font-size: 13px; color: var(--text-muted); }
.wks-panel-needs strong { color: var(--text); font-weight: 650; }
/* 2026-11-21 — Capacity keeps its numbers; how they are counted is one quiet link away. */
.wks-cap-how { margin-top: 4px; font-size: 13px; color: var(--text-muted); }
.wks-cap-how summary { cursor: pointer; padding: 4px; width: fit-content; border-radius: var(--radius); }
.wks-cap-how summary:hover { color: var(--text); }
.wks-cap-how summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wks-cap-how p { margin: 0; padding: 2px 4px 4px; }
.wks-panel-cap, .wks-panel-legend { display: flex; flex-direction: column; gap: 6px; }
.wks-panel-figure { margin: 0; font-size: 14px; color: var(--text-muted); }
.wks-panel-figure strong { color: var(--text); font-size: 17px; font-weight: 650; }
.wks-legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }

/* Invitees' time, inside the scheduling form. */
.cal-avail { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cal-avail:empty { display: none; }
.cal-avail-clash {
  display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 10px; border-radius: 8px;
  background: var(--tdy-tint); font-size: 13px; font-weight: 600;
}
.cal-avail-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cal-avail-list li { display: flex; gap: 8px; min-width: 0; }
.cal-avail-name { flex: none; font-weight: 600; }
.cal-avail-spans { min-width: 0; color: var(--text-muted); overflow-wrap: anywhere; }

/* Phone: the day view, 36px rows, the panel as a sheet from the toolbar. */
@media (max-width: 1023px) {
  .cal-page.panel-open .cal-panel {
    display: flex; position: fixed; inset: 0 0 0 0; z-index: 60; overflow-y: auto;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(76px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
  }
  .cal-page.panel-open .cal-main { visibility: hidden; }
}
@media (max-width: 768px) {
  .cal-page { --cal-row: 36px; padding-top: 0; }
  .cal-grid { --cal-gutter: 44px; }
  /* The hour grid fills exactly the room between the header and the bottom
     nav, and scrolls inside itself. This used to be a max-height of
     100dvh minus a guessed 150px of toolbar; the time-zone note made the real
     figure ~180px, so the last hours ran under the nav on every phone, and
     with the notch unaccounted for iOS lost another 47px. Flex measures what
     is actually above the grid, so a new toolbar row cannot reopen it.
     Month view has no <forge-cal-grid> and keeps scrolling the page. */
  .cal-page:has(> .cal-main > forge-cal-grid) {
    height: calc(100dvh - var(--mob-header-h));
    grid-template-rows: minmax(0, 1fr);
  }
  .cal-page forge-cal-grid { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .cal-page forge-cal-grid .cal-grid { flex: 1 1 auto; min-height: 0; height: auto; display: flex; flex-direction: column; }
  .cal-page forge-cal-grid .cal-head { flex: none; }
  .cal-page forge-cal-grid .cal-scroll { flex: 1 1 auto; min-height: 0; max-height: none; }
  /* An icon for New on a phone, so the toolbar is two rows, not three. */
  .cal-new span { display: none; }
  .cal-new { width: 44px; justify-content: center; padding: 0; }
}
@media (max-width: 768px), (hover: none) {
  .cal-new { min-height: 44px; }
  .cal-mini-day { height: 40px; }
  .cal-person-x { width: 32px; height: 32px; }
}
@media (min-width: 1024px) {
  .cal-page { grid-template-columns: 260px minmax(0, 1fr); padding: 24px 24px 32px; align-items: start; }
  .cal-panel { display: flex; position: sticky; top: 16px; }
  .cal-panel-toggle { display: none; }
}

/* ── What's New, 2026-09 (scripts/release-notes.mjs) ──────────────────────────
   The release notes, once per person per version after a release. Mobile
   first: a bottom sheet with a full-width "Got it" on a phone; a centred
   dialog from 768px.

   Branded without new colour logic: the header is the workspace's --brand
   with --on-brand ink, both derived in white-label.js (inkOn, which has a
   floor so it always reaches 4.5:1). Icons use --brand-text on a 10% tint.
   Everything else is --text on --surface. Measured in whats-new.test.ts. */
.wn-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .45);
}
.wn-panel {
  width: 100%; max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column; overflow: hidden; outline: none;
  border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .25);
  animation: wn-rise .22s ease-out 1;
}
@keyframes wn-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .wn-panel { animation: none; } }

.wn-head { position: relative; padding: 16px 60px 18px 18px; background: var(--brand); color: var(--on-brand); }
/* Specific enough to beat the lockup's own themed name colour (.wl-name). */
.wn-head .wn-brand, .wn-head .wn-brand .wl-name, html[data-theme] .wn-head .wn-brand .wl-name { color: var(--on-brand); }
.wn-brand { min-height: 28px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
/* The logo on its own tile: most logos are drawn in the brand colour, and on a
   band of that same colour they vanish. */
.wn-brand .wl-logo {
  width: 36px; height: 36px; padding: 4px; object-fit: contain; box-sizing: border-box;
  border-radius: 9px; background: var(--surface);
}
.wn-close {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--on-brand); cursor: pointer;
}
.wn-close:hover { background: color-mix(in srgb, var(--on-brand) 14%, transparent); }
.wn-close:focus-visible { outline: 2px solid var(--on-brand); outline-offset: -4px; }
.wn-title { margin: 12px 0 2px; font-size: 22px; font-weight: 700; letter-spacing: -0.2px; color: var(--on-brand); }
.wn-version { margin: 0; font-size: 14px; color: var(--on-brand); font-variant-numeric: tabular-nums; }

.wn-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 18px 18px; overscroll-behavior: contain; }
.wn-section { margin-top: 14px; }
.wn-section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.wn-icon {
  flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); color: var(--brand-text);
}
.wn-count {
  margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; text-align: center;
}
.wn-items { margin: 0; padding: 0 0 0 56px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.45; }
.wn-items li::marker { color: var(--brand-text); }
.wn-older { margin-top: 16px; border-top: 1px solid var(--border); }
.wn-older > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px;
  list-style: none; cursor: pointer; font-weight: 600;
}
.wn-older > summary::-webkit-details-marker { display: none; }
.wn-older > summary:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 6px; }
.wn-older-date { font-size: 13px; font-weight: 400; color: var(--text-muted); }

.wn-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); background: var(--surface); }
.wn-ok {
  width: 100%; min-height: 48px; border: 0; border-radius: 12px;
  background: var(--brand); color: var(--on-brand); font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
}
.wn-ok:hover { background: var(--brand-hover); color: var(--on-brand-hover); }
.wn-ok:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }

/* The version number opens What's New: buttons that keep the old look. */
button.forge-version { border: 0; background: none; cursor: pointer; border-radius: 6px; }
button.forge-version:hover, button.forge-version:focus-visible { color: var(--text); outline: none; background: var(--surface-2); }
button.settings-version {
  min-height: 44px; padding: 0 8px; border: 0; border-radius: 8px; background: none;
  font-family: inherit; cursor: pointer;
}
button.settings-version:hover, button.settings-version:focus-visible { color: var(--text); outline: none; background: var(--surface-2); }

@media (min-width: 768px) {
  .wn-overlay { align-items: center; padding: 24px; }
  .wn-panel { max-width: 560px; max-height: min(80vh, 760px); border-radius: 18px; box-shadow: 0 16px 48px rgba(0, 0, 0, .3); }
  .wn-foot { display: flex; justify-content: flex-end; }
  .wn-ok { width: auto; min-height: 44px; padding: 0 28px; }
}

/* FRG-071 (ticket 7) — Settings → Info: business details, branding, documents. */
.info-card {
  margin-bottom: 22px; padding: 18px 20px; border-radius: 12px;
  background: var(--surface, #1e1f2a); border: 1px solid var(--border, #2a2b36);
}
.info-h { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--text, #fff); }
.info-note { margin: 0 0 14px; font-size: 12px; color: var(--text-muted, #8a8b94); }
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px 16px; flex: 1; min-width: 0;
}
.info-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
/* 2026-10-21 — office hours: two times and the working days. */
.info-hours-times { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.info-hours-days { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.info-day { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.info-field-wide { grid-column: 1 / -1; }
.info-field > span { font-size: 12px; font-weight: 600; color: var(--text-muted, #8a8b94); }
.info-field input[type="text"], .info-field textarea {
  width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px;
  background: var(--bg, #15161d); border: 1px solid var(--border, #2a2b36);
  color: var(--text, #fff); font-size: 13px; font-family: inherit;
}
.info-field textarea { resize: vertical; }
.info-brand-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.info-logo-box { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.info-logo {
  width: 84px; height: 84px; object-fit: contain; border-radius: 12px; padding: 8px;
  background: var(--bg, #15161d); border: 1px solid var(--border, #2a2b36);
}
/* Migration 670 — each preview on the background it is for, whatever the
   theme the admin is using: the main logo on white, the dark-mode logo on the
   dark sidebar colour. Otherwise a dark admin would judge the light logo on
   the wrong background, and vice versa. */
.info-logo.info-logo-on-light { background: #ffffff; }
.info-logo.info-logo-on-dark { background: #1a1b23; border-color: #383944; }
.info-logo-empty {
  display: flex; align-items: center; justify-content: center; text-align: center;
  box-sizing: border-box; font-size: 11px; line-height: 1.3; color: #a6a7b0;
}
.info-color { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.info-color input[type="color"] {
  width: 42px; height: 30px; padding: 0; border-radius: 6px; cursor: pointer;
  background: none; border: 1px solid var(--border, #2a2b36);
}
.info-swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.info-swatch {
  width: 20px; height: 20px; border-radius: 5px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18); padding: 0;
}
.info-swatch:hover { transform: scale(1.12); }
.info-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Internal document store — folders + drag-and-drop. Not Google Drive. */
.drive-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.drive-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.drive-crumb {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--brand-text); font-size: 13px; font-weight: 600; font-family: inherit;
}
.drive-crumb:hover { text-decoration: underline; }
.drive-sep { color: var(--text-muted, #8a8b94); }
.drive-actions { display: flex; gap: 8px; }
.drive-drop {
  border: 1px dashed var(--border, #2a2b36); border-radius: 10px;
  padding: 10px; min-height: 90px; transition: border-color 0.15s, background 0.15s;
}
.drive-drop.drag-over { border-color: var(--brand); background: var(--brand-faint); }
.drive-empty { padding: 26px 0; text-align: center; color: var(--text-muted, #8a8b94); font-size: 13px; }
.drive-list { display: flex; flex-direction: column; gap: 2px; }
.drive-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 8px;
  border: 1px solid transparent;
}
.drive-row:hover { background: var(--bg, #15161d); }
.drive-row.drag-over { border-color: var(--brand); background: var(--brand-faint); }
.drive-file { cursor: grab; }
.drive-file:active { cursor: grabbing; }
.drive-icon { color: var(--text-muted, #8a8b94); display: inline-flex; }
.drive-name {
  flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 0;
  color: var(--text, #fff); font-size: 13px; font-family: inherit; cursor: pointer;
  text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drive-name:hover { color: var(--brand-text); }
.drive-meta { font-size: 11px; color: var(--text-muted, #8a8b94); flex-shrink: 0; }
.drive-del {
  background: none; border: none; cursor: pointer; padding: 0 4px; flex-shrink: 0;
  color: var(--text-muted, #8a8b94); font-size: 16px; line-height: 1; opacity: 0;
}
.drive-row:hover .drive-del { opacity: 1; }
.drive-del:hover { color: var(--danger-text); }

/* FRG-071 (tickets 7 + 8) — white-label brand lockup + relocated chrome. */
.wl-logo { object-fit: contain; border-radius: 6px; display: block; }
.wl-name { font-weight: 700; color: var(--text, #fff); }
/* FRG-079 — .hdr-brand is gone: the header's logo + workspace name duplicated
   the lockup the sidebar already shows, so it was removed. .wl-logo / .wl-name
   above are still used by the sidebar brand. .ws-current is the static
   fallback shown when there is only one workspace and therefore no dropdown,
   so the header never loses its workspace identity entirely. */
.ws-current {
  font-weight: 600; color: var(--text, #fff); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.ws-switcher {
  background: var(--surface-alt, #24252f); color: var(--text, #fff);
  border: 1px solid var(--border, #2a2b36); padding: 5px 8px; border-radius: 6px;
  font-size: 13px; font-weight: 600; max-width: 200px;
}
.ws-switcher:hover { border-color: var(--brand); }

/* ── "Move workspace selector" — the sidebar arrow ────────────────── */
/* A downward-pointing arrow beside the workspace logo and name, and nothing
   else. The old header <select> insisted on rendering its own text, which is
   why this is a button rather than a restyled control. */
.sidebar-brand-row {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
/* The brand keeps its own layout but hands its spacing to the row, so the
   arrow sits on the same baseline as the name rather than below the rule. */
.sidebar-brand-row .sidebar-brand {
  flex: 1 1 auto; min-width: 0;
  padding: 0; margin: 0; border-bottom: none;
}
.ws-arrow {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; border-radius: 5px; cursor: pointer;
  background: none; border: none; color: var(--sidebar-muted);
}
.ws-arrow:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.ws-arrow:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* A CSS triangle rather than an icon font: it is the one glyph the ticket
   asks for, and it cannot fail to load. */
.ws-arrow-glyph {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
}
.ws-arrow[aria-expanded="true"] .ws-arrow-glyph { transform: rotate(180deg); }
/* Collapsed sidebar hides the name, so the arrow would float alone. */
.sidebar.collapsed .ws-arrow, .shell.collapsed .ws-arrow { display: none; }

/* N-01 — "+ Add workspace", split off the selector.
   The selector now renders only at two or more workspaces, and this menu was
   the only route to creating the second one, so adding needs a control that
   does not depend on the selector being drawn. Sized to match .ws-arrow. */
.ws-add {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; border-radius: 5px; cursor: pointer;
  background: none; border: none; color: var(--sidebar-muted);
  font-size: 16px; line-height: 1;
}
.ws-add:hover { background: var(--sidebar-hover); color: var(--sidebar-text); }
.ws-add:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.sidebar.collapsed .ws-add, .shell.collapsed .ws-add { display: none; }

.ws-menu {
  position: absolute; z-index: 200; min-width: 200px; max-width: min(320px, calc(100vw - 24px)); padding: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 1px;
}
.ws-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 5px; font-size: 13px; cursor: pointer;
  background: none; border: none; color: var(--text);
}
.ws-menu-item:hover { background: var(--bg-hover); }
.ws-menu-item.on { background: var(--brand-faint); color: var(--brand-text); font-weight: 600; }
/* 2026-11-11 — you pick a workspace by its name, so the name is never cut:
   "Bergview Agricultural Development and R…" hid the words that tell two
   firms apart. It wraps instead. */
.ws-menu-name { flex: 1 1 auto; min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.ws-menu-tick { flex: 0 0 auto; color: var(--brand-text); }
.ws-menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.ws-menu-add { color: var(--brand-text); }
/* Settings + the user block are the last two rows of the sidebar and are
   rendered outside the reorderable nav list, so they can't be moved. */
.sidebar-fixed-item { flex-shrink: 0; }

/* FRG-081 — shared page container.
   The Dashboard hard-coded `max-width: 1400px` inline with no centering, so
   at 1920 the content sat left and left a 245px dead column on the right
   (85% of the available width used); at 2560/3840 that column grows to
   hundreds/thousands of pixels. Measured live before the change.

   Two deliberate choices, BOTH ASSUMPTIONS pending BigJoe's answers on the
   responsive audit — change the two values here and every page using this
   class follows:
     * max-width 2200px, not unlimited. A 12-column table stretched across a
       3840px display is unreadable, and BigJoe has not yet confirmed whether
       he wants edge-to-edge or comfortable density. 2200 means 1920 and
       2560 are effectively FULL width (zero and ~50px of margin), so the
       cap only engages on genuinely huge displays.
     * margin-inline auto, so whatever margin does remain is split evenly
       instead of pooling into one dead column on the right — which was the
       actual complaint. */
.page-shell {
  padding: 24px;
  max-width: 2200px;
  margin-inline: auto;
}

/* FRG-084 — Clients card list.
   The page was capped at 900px (the tightest cap in the app) and left-
   aligned, so at 2560 it used 39% of the available width with 1400px dead on
   the right — the worst instance found in the audit, and on real content
   rather than an empty state.

   Widening the container alone would have produced one 2200px-wide card per
   row, which is not an improvement. The cards flow into columns instead:
   auto-fill with a 420px floor gives 1 column on mobile, 2 on a 13" laptop,
   and 4-5 on a 27"+ display, so the reclaimed width turns into more clients
   visible at once rather than more whitespace inside each card. */
.client-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
}
@media (max-width: 560px) {
  /* Below the floor a single column beats a cramped two — minmax would
     otherwise force horizontal overflow on a narrow phone. */
  .client-grid { grid-template-columns: 1fr; }
}

/* FRG-082 — responsive Dashboard table.
   13 columns (12 for non-master) needed 1466px, inside a 1005px container on
   a 13" laptop — so the most-used view on the most common screen size forced
   sideways scrolling to reach Environments / Repository.

   Columns drop in tiers as the viewport narrows. What stays, and why: Project,
   Workspace, Client and Status identify the row; Tasks and Time Left are the
   "is this in trouble" signals; Environments is the link people actually
   click. What goes is either slow-moving (Type, SoW Phase), derivable
   elsewhere (Members, Hours — both on the project page), or secondary
   (Timeframe is implied by Time Left; Repository is the less-used of the two
   link columns).

   Thresholds are viewport-based while the table lives in viewport-minus-
   sidebar (260px), so they are set ~275px above the width actually needed.
   Nothing is unreachable at any size: the wrapper keeps overflow-x as the
   backstop below the last tier, and every hidden column is on the project
   page itself. */
@media (max-width: 1500px) {
  .dash-table .col-type,
  .dash-table .col-members,
  .dash-table .col-timeframe { display: none; }
}
@media (max-width: 1350px) {
  .dash-table .col-sow,
  .dash-table .col-hours { display: none; }
}
@media (max-width: 1150px) {
  .dash-table .col-repo { display: none; }
}

/* FRG-071 (ticket 6) — Meeting / Memos page. */
/* FRG-082 — the width cap lives in .page-shell now (the element carries both
   classes). This kept its own `max-width: 1200px`, which sits AFTER
   .page-shell in source order and so overrode it: the month grid used 50% of
   a 27" screen and 32% of a 4K one. Padding stays here because the mobile
   override below tightens it. */
.mm-shell { padding: 24px; }
.mm-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.mm-title { margin: 0 0 4px; color: var(--text, #fff); font-size: 22px; }
.mm-sub { color: var(--text-muted, #8a8b94); font-size: 14px; }
.mm-btn {
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  background: var(--surface, #1e1f2a); border: 1px solid var(--border, #2a2b36);
  color: var(--text, #fff); font-size: 13px; font-weight: 600;
}
.mm-btn:hover { border-color: var(--brand); }
.mm-btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.mm-btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.mm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border, #2a2b36); margin-bottom: 18px; }
.mm-tab {
  padding: 9px 16px; background: none; border: none; cursor: pointer;
  color: var(--text-muted, #8a8b94); font-size: 14px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.mm-tab:hover { color: var(--text, #fff); }
.mm-tab.active { color: var(--text, #fff); border-bottom-color: var(--brand); }


/* FRG-211 — the seven tracks are minmax(0, 1fr), not 1fr.
 *
 * `1fr` is shorthand for `minmax(auto, 1fr)`, and `auto` as a track MINIMUM
 * resolves to the content's min-content width — which a grid item, whose own
 * `min-width` defaults to `auto`, refuses to shrink below. One meeting title
 * that cannot break was therefore enough to blow a single column out to 225px
 * and push the row to 473px inside a 324px shell. Because the grid clips with
 * `overflow: hidden`, the surplus was not scrollable: Friday and Saturday were
 * simply invisible on a phone, with nothing on screen to suggest they existed.
 *
 * minmax(0, ...) lets a track floor at zero; `min-width: 0` on the children
 * lets the items follow. The chips then truncate (below) instead of pushing.
 */


.mm-empty {
  padding: 40px 0; text-align: center; color: var(--text-muted, #8a8b94); font-size: 14px;
}

.mm-memos { display: flex; flex-direction: column; gap: 10px; }
.mm-memo {
  padding: 14px 16px; border-radius: 10px;
  background: var(--surface, #1e1f2a); border: 1px solid var(--border, #2a2b36);
}
.mm-memo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mm-memo-title { font-size: 15px; font-weight: 700; color: var(--text, #fff); }
.mm-memo-actions { display: flex; gap: 10px; flex-shrink: 0; }
.mm-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-muted, #8a8b94); font-size: 12px; font-family: inherit;
}
.mm-link:hover { color: var(--text, #fff); }
.mm-link.mm-danger:hover { color: var(--danger-text); }
.mm-memo-meta { font-size: 12px; color: var(--text-muted, #8a8b94); margin-top: 3px; }
.mm-memo-body {
  margin-top: 10px; white-space: pre-wrap; word-break: break-word;
  font-size: 13px; color: var(--text, #fff); line-height: 1.5;
}

.mm-modal { width: 560px; }
.mm-hint { margin-top: 6px; font-size: 12px; color: var(--text-muted, #8a8b94); }

/* ── FAW-420 — agenda checklist ───────────────────────────────────── */
.mag {
  padding: 8px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
}
.mag-list { display: flex; flex-direction: column; gap: 4px; }
.mag-row {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 4px; border-radius: 6px; border: 1px solid transparent;
}
.mag-row:hover { background: var(--bg-hover); }
.mag-row.dragging { opacity: 0.45; }
.mag-row.drop-into { border-color: var(--brand); }
.mag-grip {
  display: flex; cursor: grab; color: var(--text-muted); flex: 0 0 auto;
}
.mag-grip:active { cursor: grabbing; }
.mag-tick { flex: 0 0 auto; cursor: pointer; }
.mag-text {
  flex: 1 1 auto; min-width: 0; background: transparent; border: none;
  color: var(--text); font-size: 13px; padding: 4px 2px; outline: none;
}
.mag-text::placeholder { color: var(--text-muted); }
.mag-text:focus { border-bottom: 1px solid var(--brand); }
.mag-text.over { border-bottom: 1px solid var(--danger); }
.mag-count { flex: none; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.mag-count.over { color: var(--danger); }
/* A covered point stays readable — struck through, not faded to nothing. */
.mag-row:has(.mag-tick:checked) .mag-text {
  text-decoration: line-through; color: var(--text-muted);
}
.mag-del {
  flex: 0 0 auto; display: flex; background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px; border-radius: 4px;
}
.mag-del:hover { color: var(--danger-text); background: var(--danger-tint); }
.mag-add {
  margin-top: 6px; background: none; border: none; cursor: pointer;
  color: var(--brand-text); font-size: 12px; padding: 4px 2px;
}
.mag-add:hover { text-decoration: underline; }

/* ── FAW-421 — 24-hour scroll wheels ──────────────────────────────── */
.mm-when-row { align-items: start; }
.mtw {
  position: relative; display: flex; align-items: center; gap: 2px;
  padding: 4px 6px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
}
/* MTG-11 — clickable arrows above and below each column.
 *
 * Reported from a MacBook: the scroll columns are slow and fiddly on a
 * trackpad. An arrow is a discrete target that behaves identically on a
 * mouse, a trackpad and a touchscreen.
 *
 * The unit is SYMMETRIC — equal arrow height top and bottom — because
 * .mtw-mask is centred with top:50% over the whole control. Uneven arrows
 * would slide the selection band off the selected row. */
.mtw-unit {
  display: flex; flex-direction: column; align-items: stretch;
  flex: 1 1 0; min-width: 0;
}
.mtw-arrow {
  height: 18px; line-height: 1; padding: 0; flex: 0 0 18px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.12s ease, background 0.12s ease;
  border-radius: 4px;
}
.mtw-arrow:hover { color: var(--text); background: var(--brand-subtle); }
/* Held down it repeats, so the press needs a state of its own to read as
   held rather than merely hovered. */
.mtw-arrow:active { color: var(--brand); }
.mtw-col {
  height: 96px; overflow-y: auto; scrollbar-width: none;
  flex: 1 1 0; min-width: 0; text-align: center; outline: none;
  /* The track is padded top and bottom so the first and last values can
     actually reach the centre line rather than jamming at the edge. */
  padding: 34px 0;
}
.mtw-col::-webkit-scrollbar { display: none; }
.mtw-col:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); border-radius: 6px; }
.mtw-opt {
  height: 28px; line-height: 28px; font-size: 14px; cursor: pointer;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
  transition: color 0.12s ease;
}
.mtw-opt:hover { color: var(--text); }
.mtw-opt.sel { color: var(--text); font-weight: 600; font-size: 16px; }
/* HAT-HVH-0000394 — a slot that has already gone today. Struck through as
   well as dimmed, because --text-muted is the wheel's own resting colour
   and dimming alone would not read as "you cannot pick this". The hover
   rule is overridden or it would light back up under the pointer. */
.mtw-opt-past,
.mtw-opt-past:hover {
  color: var(--text-muted);
  opacity: 0.35;
  text-decoration: line-through;
  cursor: not-allowed;
}
.mtw-sep { color: var(--text-muted); font-size: 15px; padding-bottom: 2px; }
/* The centre band that makes it read as a wheel. Purely decorative, so it
   never intercepts a click or a drag on the columns beneath it. */
.mtw-mask {
  position: absolute; left: 4px; right: 4px; top: 50%; height: 30px;
  transform: translateY(-50%); pointer-events: none; border-radius: 6px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.mm-duration { font-variant-numeric: tabular-nums; }
.mm-duration.mm-hint-warn { color: var(--warn-text); }

/* ── FAW-422 — searchable participant picker ──────────────────────── */
.mpp { display: flex; flex-direction: column; gap: 8px; }
.mpp-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; align-items: center; }
.mpp-none { font-size: 12px; color: var(--text-muted); }
.mpp-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 6px 3px 9px; border-radius: 999px; font-size: 12px;
  background: var(--brand-subtle); color: var(--brand-text);
  border: 1px solid var(--brand-soft);
}
.mpp-chip em { font-style: normal; opacity: 0.7; }
.mpp-chip.locked { padding-right: 9px; }
.mpp-chip-x {
  display: flex; background: none; border: none; cursor: pointer;
  color: inherit; padding: 0; opacity: 0.7;
}
.mpp-chip-x:hover { opacity: 1; }
.mpp-list {
  max-height: 190px; overflow-y: auto; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
}
.mpp-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 10px; background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border);
}
.mpp-opt:last-child { border-bottom: none; }
.mpp-opt:hover:not([disabled]) { background: var(--bg-hover); }
.mpp-opt.on { background: var(--brand-faint); }
.mpp-opt[disabled] { cursor: default; color: var(--text-muted); }
.mpp-opt-name { flex: 0 1 auto; }
.mpp-opt-mail { flex: 1 1 auto; min-width: 0; font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpp-opt-state { flex: 0 0 auto; display: flex; color: var(--brand-text); }
.mpp-empty { padding: 12px 10px; font-size: 12px; color: var(--text-muted); }

/* ── FAW-423/427 — delivery record and declines on the meeting ────── */
.mm-dispatch {
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
}
.mm-dispatch-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); margin-bottom: 8px;
}
.mm-declines-head { margin-top: 14px; }
/* MTG-45 — a meeting's recordings, in its dialog. */
.mm-rec-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; font-size: 12.5px; color: var(--text); }
.mm-rec-meta { flex: 1 1 auto; min-width: 0; }
.mm-rec-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.mm-rec-audio { flex: 1 1 100%; width: 100%; height: 36px; }
.mm-rec-video { height: auto; max-height: 360px; background: #000; border-radius: 6px; }
.mm-disp-row {
  display: flex; align-items: baseline; gap: 8px; padding: 4px 0;
  font-size: 12px; color: var(--text);
}
.mm-disp-who { flex: 0 0 auto; font-weight: 500; }
.mm-disp-what { flex: 1 1 auto; min-width: 0; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-disp-when { flex: 0 0 auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mm-disp-state {
  flex: 0 0 auto; padding: 1px 6px; border-radius: 999px; font-size: 11px;
}
.mm-disp-sent { background: var(--success-tint); color: var(--success-text); }
.mm-disp-failed { background: var(--danger-tint); color: var(--danger-text); }
.mm-disp-skipped { background: var(--neutral-tint); color: var(--text-muted); }
.mm-disp-detail {
  font-size: 11px; color: var(--text-muted); padding: 0 0 4px 0;
}
/* A send failure is the organiser's problem to act on, so it gets a real
   callout rather than sitting as one more grey row in a list. */
.mm-disp-alert {
  padding: 8px 10px; margin-bottom: 10px; border-radius: 6px;
  background: var(--danger-tint); color: var(--danger-text); font-size: 12px;
  border: 1px solid var(--danger);
}

/* ══ FAW-430..440 — the memo library ═══════════════════════════════ */

/* Tile geometry. A4 is 1 : 1.414 portrait, and --mlib-scale is the factor that
   shrinks a real 794px-wide A4 page down to the tile — the two MUST move
   together or the preview stops being a true miniature. */
.mlib {
  --mlib-tile-w: 170px;
  --mlib-scale: 0.214;   /* 170 / 794 */
  display: flex; flex-direction: column; gap: 14px;
}
.mlib-tile-h { height: calc(var(--mlib-tile-w) * 1.414); }

/* ── 1. search ───────────────────────────────────────────────────── */
.mlib-search-band { display: flex; justify-content: center; }
/* DOCS-05 — the platform's search box (.ui-search) and icon button; the
   library's own copies were removed. Only its width is the library's. */
.mlib-search { width: 100%; max-width: none; }
.mlib-clear { font-size: 20px; }

/* ── 2. create card + recent, ONE ROW ────────────────────────────── */
/* NEVER WRAPS and NEVER SCROLLS: what fits, fits. Tiles past what fits are
   hidden at breakpoints below rather than squeezed or half-clipped. */
.mlib-top-row {
  display: flex; gap: 12px; flex-wrap: nowrap; overflow: hidden;
  align-items: flex-start;
}
.mlib-top-row > * { flex: 0 0 var(--mlib-tile-w); }

/* FAW-432 — the create card. A4 proportion, matching the memo tiles in size,
   OUTLINED rather than filled so it reads as an action, not as a memo. */
.mlib-create {
  height: calc(var(--mlib-tile-w) * 1.414);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; border-radius: 8px;
  background: transparent; border: 2px dashed var(--border); color: var(--text-muted);
}
.mlib-create:hover { border-color: var(--brand); color: var(--brand-text); background: var(--brand-faint); }
.mlib-create-plus { font-size: 34px; line-height: 1; font-weight: 300; }
.mlib-create-label { font-size: 12px; }

/* ── 3. filters ──────────────────────────────────────────────────── */
.mlib-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 4px; border-top: 1px solid var(--border);
}
/* DOCS-05 — selects are .ui-select, buttons .tdy-chip / .tdy-icon-btn. */
.mlib-spacer { flex: 1 1 auto; }
.mlib-viewtoggle { display: flex; gap: 2px; }
.mlib-vt.on { background: var(--tdy-tint); color: var(--text); }

/* Active filters as removable chips, so it is always obvious why something is
   missing from the grid. */
.mlib-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* An active filter is a .tdy-chip in its "on" state. */
.mlib-chip { background: var(--tdy-tint); border-color: var(--brand-text); cursor: default; padding-right: 4px; }
.mlib-chip-x { background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 18px; line-height: 1; min-width: 28px; min-height: 28px; border-radius: 999px; }
.mlib-chip-x:hover { color: var(--text); }

.mlib-crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.mlib-crumb { background: none; border: none; cursor: pointer; color: var(--brand-text); font-size: 12px; padding: 0; }
.mlib-crumb:hover { text-decoration: underline; }
.mlib-crumb-sep { color: var(--text-muted); }

/* ── 4. the grid ─────────────────────────────────────────────────── */
.mlib-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(var(--mlib-tile-w), 1fr));
}
.mlib-empty { padding: 32px; text-align: center; color: var(--text-muted); font-size: 13px; }

.mlib-tile {
  position: relative; display: flex; flex-direction: column;
  height: calc(var(--mlib-tile-w) * 1.414);
  border-radius: 8px; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
}
.mlib-tile:hover { border-color: var(--brand-soft); box-shadow: var(--shadow-md); }
.mlib-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* FAW-436 — the rendered preview. The inner page is a REAL A4-width render of
   the memo's own HTML, scaled down — so headings are headings and lists are
   lists, just small. Not a truncated string. */
.mlib-tile-prev { flex: 1 1 auto; position: relative; overflow: hidden; background: var(--surface-2); }
/* HAT-HVH-0000367 — centre the miniature in the tile.
   --mlib-scale is the constant 170/794, but the grid stretches tiles past
   170px with 1fr, so the scaled page is usually narrower than the tile it sits
   in. Pinned at top-left with transform-origin 0 0, every bit of that slack
   collected on the right, and a short memo hung from the top with dead space
   below. A transformed element still occupies its untransformed box, so
   centring the full 794px page with flexbox overflows it symmetrically and
   scaling about its own centre leaves the visible miniature centred. */
.mlib-prev {
  position: absolute; inset: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.mlib-prev-page {
  /* Must keep its full A4 layout box — letting flexbox shrink it to the tile
     width would reflow the content, and a reflow is precisely what this
     preview exists not to be. */
  flex: 0 0 auto;
  transform: scale(var(--mlib-scale)); transform-origin: center center;
  padding: 40px; background: var(--surface); color: var(--text);
  font-size: 15px; line-height: 1.5;
  /* The preview must never react to the pointer — the whole tile is the
     click target, and a link inside a thumbnail is a trap. */
  pointer-events: none;
}
.mlib-prev-page h1 { font-size: 30px; font-weight: 700; margin: 0 0 12px; }
.mlib-prev-page h2 { font-size: 24px; font-weight: 700; margin: 14px 0 10px; }
.mlib-prev-page h3 { font-size: 19px; font-weight: 600; margin: 12px 0 8px; }
.mlib-prev-page p { margin: 0 0 10px; }
.mlib-prev-page ul, .mlib-prev-page ol { margin: 0 0 10px; padding-left: 28px; }
.mlib-prev-page li { margin: 0 0 4px; }
.mlib-prev-page blockquote {
  margin: 0 0 10px; padding-left: 14px; border-left: 3px solid var(--border); color: var(--text-muted);
}
.mlib-prev-page table { border-collapse: collapse; margin: 0 0 10px; }
.mlib-prev-page td, .mlib-prev-page th { border: 1px solid var(--border); padding: 4px 8px; }
.mlib-prev-page img { max-width: 100%; }
.mlib-prev-page hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.mlib-prev-page a { color: var(--link); }
.mlib-prev-page mark { background: var(--warn-tint); color: var(--text); }
/* An empty memo says so, rather than rendering as a broken tile. */
.mlib-prev-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 11px; font-style: italic;
}

/* FAW-437 — the footer strip. */
.mlib-foot {
  flex: 0 0 auto; padding: 7px 9px; background: var(--surface);
  border-top: 1px solid var(--border);
}
.mlib-foot-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mlib-foot-meta {
  display: flex; align-items: center; gap: 4px; margin-top: 2px;
  font-size: 10px; color: var(--text-muted);
  overflow: hidden; white-space: nowrap;
}
.mlib-shared { display: inline-flex; align-items: center; gap: 3px; margin-left: auto;
  color: var(--brand-text); }
.mlib-snip { font-size: 10px; color: var(--text-muted); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mlib-infolder, .mlib-owner, .mlib-copy {
  font-size: 10px; color: var(--text-muted); margin-top: 2px;
}
.mlib-copy { color: var(--warn-text); }

/* A .tdy-icon-btn; over a tile it needs the page colour behind it. */
.mlib-menu, .mlib-folder-menu {
  position: absolute; top: 6px; right: 6px; display: none; background: var(--surface);
}
.mlib-tile:hover .mlib-menu, .mlib-folder:hover .mlib-folder-menu,
.mlib-tile:focus-within .mlib-menu { display: flex; }
.mlib-lrow .mlib-menu { position: static; display: flex; background: none; border: none; }

/* FAW-439 — folder tiles. FOLDER-SHAPED, never A4, so the two are never
   confused, and they sit ABOVE the memos in the same grid. */
.mlib-folder {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  height: calc(var(--mlib-tile-w) * 0.72); cursor: pointer;
  border-radius: 8px 8px 6px 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text);
}
.mlib-folder::before {
  content: ''; position: absolute; top: -1px; left: 10px; width: 38%; height: 7px;
  background: var(--surface-2); border: 1px solid var(--border); border-bottom: none;
  border-radius: 4px 4px 0 0; transform: translateY(-100%);
}
.mlib-folder:hover, .mlib-folder.drop { border-color: var(--brand); background: var(--brand-faint); }
.mlib-folder-icon { color: var(--text-muted); }
.mlib-folder-name { font-size: 12px; font-weight: 600; padding: 0 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mlib-folder-count { font-size: 10px; color: var(--text-muted); }

/* FAW-440 — list view. */
.mlib-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mlib-lrow {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 0.7fr 1fr 32px;
  align-items: center; gap: 8px; padding: 7px 10px; font-size: 12px;
  border-bottom: 1px solid var(--border); cursor: pointer; color: var(--text);
}
.mlib-lrow:last-child { border-bottom: none; }
.mlib-lrow:hover { background: var(--bg-hover); }
.mlib-lhead { background: var(--surface-2); cursor: default; }
.mlib-lhead:hover { background: var(--surface-2); }
.mlib-lcol { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
button.mlib-lcol { background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 11px; font-weight: 600; padding: 0; }
button.mlib-lcol:hover { color: var(--text); }
.mlib-ltitle { font-weight: 600; }

/* The overflow popover, shared by tiles, rows and folders. */
/* Drawn as the platform's "⋯" menu (.tdy-menu); rows are .tdy-menu-item. */
.mlib-pop {
  position: absolute; z-index: 70; min-width: 200px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column;
}
.mlib-pop-item.danger { color: var(--danger-text); }
.mlib-pop-item.danger:hover { background: var(--danger-tint); }

/* FAW-459 — the provisional-rulings notice. Reuses the FAW-414 badge. */
.mlib-rulings {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 6px; font-size: 12px;
  background: var(--warn-tint); color: var(--text);
}
.mlib-rulings-link {
  background: none; border: none; cursor: pointer; color: var(--brand-text);
  font-size: 12px; text-decoration: underline; padding: 0;
}
.mlib-ruling-pop { max-width: 380px; gap: 14px; max-height: 70vh; overflow-y: auto; }
.mlib-ruling { display: flex; flex-direction: column; gap: 5px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.mlib-ruling:last-child { border-bottom: none; padding-bottom: 0; }

/* Rendered read-only body, until the FAW-441 editor replaces this modal. */
.mm-memo-readonly {
  max-height: 320px; overflow-y: auto; padding: 12px 14px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; line-height: 1.5;
}
.mm-memo-readonly h1 { font-size: 19px; font-weight: 700; margin: 0 0 8px; }
.mm-memo-readonly h2 { font-size: 16px; font-weight: 700; margin: 12px 0 6px; }
.mm-memo-readonly h3 { font-size: 14px; font-weight: 600; margin: 10px 0 5px; }
.mm-memo-readonly p { margin: 0 0 8px; }
.mm-memo-readonly ul, .mm-memo-readonly ol { margin: 0 0 8px; padding-left: 22px; }
.mm-memo-readonly blockquote {
  margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--border); color: var(--text-muted);
}
.mm-memo-readonly hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.mm-memo-readonly a { color: var(--link); }

/* FAW-451 — the share dialog. */
.msh-modal { width: 460px; }
.msh-wide {
  display: flex; align-items: flex-start; gap: 9px; padding: 10px;
  border-radius: 8px; cursor: pointer; margin-bottom: 14px;
  background: var(--bg); border: 1px solid var(--border);
}
.msh-wide span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text); }
.msh-wide em { font-style: normal; font-size: 11px; color: var(--text-muted); }
.msh-results { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 14px; }
.msh-hit {
  text-align: left; padding: 6px 9px; border-radius: 5px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; color: var(--text);
}
.msh-hit:hover { background: var(--brand-faint); border-color: var(--brand-soft); }
.msh-list { display: flex; flex-direction: column; gap: 4px; }
.msh-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); }
.msh-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msh-via { font-size: 11px; color: var(--text-muted); font-style: italic; }
.msh-level { font-size: 11px; color: var(--text-muted); }
.msh-level-sel {
  padding: 3px 6px; border-radius: 5px; font-size: 11px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
}
.msh-x { display: flex; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 2px; }
.msh-x:hover { color: var(--danger-text); }

/* The recent row shows as many tiles as fit and NO MORE — it never wraps to a
   second line and never scrolls, so surplus tiles are hidden at each step.
   Six is the ceiling even on a very wide screen (create card + 6 = 7 items):
   beyond six it stops being "recent" and becomes a second grid. */
@media (max-width: 1500px) { .mlib-top-row > *:nth-child(n+7) { display: none; } }
@media (max-width: 1280px) { .mlib-top-row > *:nth-child(n+6) { display: none; } }
@media (max-width: 1080px) { .mlib-top-row > *:nth-child(n+5) { display: none; } }
@media (max-width: 880px) {
  /* Floor of three recents: the tiles shrink rather than the row dropping to
     two, which is the minimum the ticket asks for on a narrow screen. */
  .mlib { --mlib-tile-w: 132px; --mlib-scale: 0.166; }
}
@media (max-width: 620px) {
  .mlib { --mlib-tile-w: 108px; --mlib-scale: 0.136; }
  .mlib-lrow { grid-template-columns: 2fr 1fr 1fr 32px; }
  .mlib-lrow > *:nth-child(n+4):nth-child(-n+6) { display: none; }
  .msh-modal { width: 100%; }
}

/* ══ FAW-441..450 — the memo editor ════════════════════════════════ */

.me-loading { padding: 32px; color: var(--text-muted); font-size: 13px; }
.me-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* DOCS-05 — the editor's frame, in the platform's own style (Today's Work,
   BigJoe's pick, 2026-10-14). Its controls are the shared ones, not private
   copies: .tdy-chip for labelled actions, .tdy-icon-btn for icon-only ones,
   .btn.primary for Share, .ui-select for the toolbar's dropdowns, and the
   "⋯" menu's look for its pop-ups. What is left below is LAYOUT only. The
   editor's own button, select and menu-item styles were removed, not
   adjusted; do not add them back. This frame is the pattern other screens
   are brought to. */
.me-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
}
/* MEM-01 — the header carries Share, Project, History, Export and Agent now,
   so it lays them out rather than relying on inline flow. Wraps on a narrow
   window instead of pushing the title off the row. */
.me-top-right {
  margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  justify-content: flex-end;
}
.me-owner { font-size: 13px; color: var(--text-muted); }

/* FAW-450 — a small status by the title. NO SAVE BUTTON EXISTS. */
.me-status { font-size: 12px; color: var(--text-muted); }
.me-status-saving { color: var(--text-muted); }
.me-status-saved { color: var(--success-text); }
/* A failing save is not a quiet grey word. */
.me-status-retrying { color: var(--warn-text); font-weight: 600; }
.me-status-failed {
  color: var(--danger-text); font-weight: 700;
  background: var(--danger-tint); padding: 2px 8px; border-radius: 4px;
}

/* FAW-443 — ONE SLIM ROW. Nothing else is ever permanently on screen, and
   there is NO MENU BAR anywhere above it. */
.me-bar {
  display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; overflow-x: auto;
  padding: 8px 24px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.me-bar > * { flex: 0 0 auto; }
.me-style { min-width: 112px; }
.me-font { min-width: 108px; }
.me-size { min-width: 64px; }
.me-bar .me-ctl + .me-ctl { margin-left: 6px; }
/* Groups of related tools, set apart by a hairline, as a dense control
   surface is elsewhere: no boxes round the buttons. */
.me-group { display: flex; gap: 2px; }
.me-bar .me-ctl + .me-group, .me-bar .me-group + *, .me-bar .me-swatch + .me-group {
  margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--border);
}

/* FAW-441 — A4-width writing surface, CENTRED, on a contrasting background so
   the page edge is visible. Continuous scroll; A4 in WIDTH ONLY. */
.me-canvas-wrap {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 28px 16px 96px; background: var(--bg-alt);
}
/* HAT-HVH-0000399 — A4 pages.
   The canvas is now a STACK of sheets rather than one sheet that grew with
   its content. The sheets are painted in .me-sheets behind the text; the
   editable sits on top as one continuous element and is never split, so the
   caret has no boundary to fall through. */
.me-canvas {
  position: relative;
  width: 794px; max-width: 100%; margin: 0 auto;
  min-height: 1123px;
  padding: 56px 64px;
  /* The sheets carry the paper now, so the canvas itself is just a
     positioning context - no background, border or shadow of its own. */
  background: none; border: none; box-shadow: none; border-radius: 0;
}
.me-sheets {
  position: absolute; inset: 0;
  pointer-events: none;   /* clicks must reach the text above */
  z-index: 0;
}
.me-sheet {
  position: absolute; left: 0; right: 0;
  height: 1123px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: var(--shadow-md);
}
.me-sheet-num {
  position: absolute; right: 12px; bottom: 8px;
  font-size: 10px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  user-select: none;
}
/* Above the sheets, and transparent so the paper shows through. */
.me-canvas > .me-body {
  position: relative; z-index: 1;
  background: none;
  min-height: 1011px;  /* 1123 - 56*2, one page of text area */
}
@media print {
  /* Printing gets the browser's own pagination; the on-screen sheets would
     only double up with it. */
  .me-sheets { display: none; }
  .me-canvas { min-height: 0; padding: 0; }
}
/* HAT-HVH-0000396 — the heading moved from the canvas into .me-top, so it
   is sized for a header bar rather than a document title, and it flexes to
   fill the space between the back button and the save status. min-width:0
   is what actually lets it ellipsis rather than shoving the status off the
   right-hand edge. It unclamps on focus so a long title stays editable. */
.me-title {
  flex: 1 1 auto; min-width: 0;
  font-size: 20px; font-weight: 650; line-height: 1.3; color: var(--text);
  outline: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-title:focus { white-space: normal; overflow: visible; }
.me-title:empty::before, .me-body:empty::before {
  content: attr(data-placeholder); color: var(--text-muted); pointer-events: none;
}
.me-body {
  outline: none; font-size: 16px; line-height: 1.6; color: var(--text); min-height: 40vh;
}
.me-body h1 { font-size: 28px; font-weight: 700; margin: 20px 0 10px; }
.me-body h2 { font-size: 22px; font-weight: 700; margin: 18px 0 8px; }
.me-body h3 { font-size: 18px; font-weight: 600; margin: 16px 0 6px; }
.me-body p { margin: 0 0 12px; }
.me-body ul, .me-body ol { margin: 0 0 12px; padding-left: 26px; }
.me-body li { margin: 0 0 4px; }
.me-body blockquote {
  margin: 0 0 12px; padding-left: 16px;
  border-left: 3px solid var(--border); color: var(--text-muted);
}
.me-body hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.me-body a { color: var(--link); }
.me-body table { border-collapse: collapse; margin: 0 0 12px; }
.me-body td, .me-body th { border: 1px solid var(--border); padding: 5px 9px; }
.me-body ul.me-check { list-style: none; padding-left: 4px; }
.me-body ul.me-check li { display: flex; align-items: baseline; gap: 8px; }
/* DOCS-05 — a highlight is a paper colour, so the words on it are ink in BOTH
   themes. In dark mode they were the theme's near-white on pale yellow,
   about 1.1:1. A text colour the writer chose is an inline style and still
   wins. "No highlight" is written as a transparent background, and keeps the
   theme's own colour. */
.me-body [style*="background-color"], .mlib-tile-prev [style*="background-color"] { color: #1a1a1a; }
.me-body [style*="background-color: transparent"], .mlib-tile-prev [style*="background-color: transparent"],
.me-body [style*="background-color: rgba(0, 0, 0, 0)"], .mlib-tile-prev [style*="background-color: rgba(0, 0, 0, 0)"] { color: inherit; }

.me-readonly-note {
  padding: 8px 16px; font-size: 12px;
  background: var(--neutral-tint); color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

/* Tier two and the other popovers. None of this is ever on the bar. */
/* Positioned by the editor next to the control that opened it; drawn exactly
   as the platform's "⋯" menu (.tdy-menu), and its rows are .tdy-menu-item. */
.me-pop {
  position: absolute; z-index: 80; padding: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  display: flex; flex-direction: column; min-width: 200px;
}
.me-pop-label { font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 8px 12px 4px; }
.me-colours { min-width: 200px; }
.me-swatches { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 6px 6px; }
.me-sw {
  width: 22px; height: 22px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--border);
}
.me-sw:hover { outline: 2px solid var(--brand); outline-offset: 1px; }
.me-sw.none { position: relative; }
.me-sw.none::after {
  content: ''; position: absolute; inset: 3px;
  background: linear-gradient(to bottom right, transparent 45%, var(--danger) 45%,
              var(--danger) 55%, transparent 55%);
}

/* FAW-445 — the selection bubble. Follows the selection, disappears when it
   clears, and sits ABOVE the text so it never covers what is being edited. */
.me-bubble {
  position: absolute; z-index: 90; display: none; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; box-shadow: var(--shadow-lg);
}
.me-bubble.on { display: flex; }
.me-bub {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 24px; border-radius: 4px; cursor: pointer;
  background: none; border: none; color: var(--text); font-size: 12px;
}
.me-bub:hover { background: var(--bg-hover); }

/* FAW-454 — ACTION and DECISION blocks. Recognised from what people already
   type; no new toolbar controls exist for them. */
.mb {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 9px 12px; border-radius: 6px;
  border-left: 3px solid var(--brand);
  background: var(--brand-faint);
}
/* A DECISION is VISUALLY DISTINCT from an action — the whole point is being
   able to find what was decided later. */
.mb.decision { border-left-color: var(--success); background: var(--success-tint); }
/* HVH 54253f87 — a POD is a point RAISED, not one settled, so it reads as a
   third distinct thing rather than a variant of either. Amber sits between the
   brand purple of an action and the green of a decision, and these tokens carry
   their own light and dark values, so one rule is correct in both themes. */
.mb.pod { border-left-color: var(--warn); background: var(--warn-tint); }
.mb-tag {
  flex: 0 0 auto; font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 4px; cursor: pointer;
  background: var(--brand); color: var(--on-brand);
}
.mb.decision .mb-tag { background: var(--success); color: var(--on-success); }
.mb.pod .mb-tag { background: var(--warn); color: var(--on-warn); }
.mb-tag:hover { opacity: 0.85; }
.mb-text { flex: 1 1 auto; min-width: 120px; }
.mb-make {
  flex: 0 0 auto; padding: 3px 9px; border-radius: 5px; font-size: 11px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.mb-make:hover { background: var(--bg-hover); border-color: var(--brand); }
.mb-task {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--success-text); text-decoration: none;
}
.mb-task:hover { text-decoration: underline; }

/* FAW-447 — images: a sensible width and a drag handle. NO wrapping options,
   NO captions, NO positioning controls. */
.me-body img, .me-img {
  max-width: 100%; height: auto; border-radius: 4px; display: block;
  margin: 8px 0; cursor: nwse-resize;
}
/* File attachments render as a chip showing name and type. */
.me-file {
  display: inline-flex; align-items: center; gap: 7px; vertical-align: middle;
  padding: 4px 10px 4px 4px; margin: 2px 2px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-size: 13px;
}
.me-file:hover { border-color: var(--brand); }
.me-file-ext {
  padding: 2px 6px; border-radius: 999px; font-size: 9px; font-weight: 700;
  background: var(--brand); color: var(--on-brand);
}

/* FAW-448 — tables. A size picker and hover controls; deliberately no merging,
   no border styling, no fills, no header styling, no sorting, no formulas. */
.me-table { border-collapse: collapse; margin: 8px 0; }
.me-table td, .me-table th {
  border: 1px solid var(--border); padding: 5px 9px; min-width: 48px;
  /* The right edge is the column-resize divider. */
  cursor: text;
}
/* DOCS-05 — the table tools are .tdy-chip; only their spacing is the editor's. */
.me-tbl-ctl { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.me-tablepick { padding: 8px; }
.me-tp-grid { display: grid; gap: 2px; }
.me-tp-cell {
  width: 18px; height: 18px; padding: 0; cursor: pointer; border-radius: 2px;
  background: var(--bg); border: 1px solid var(--border);
}
.me-tp-cell.on { background: var(--brand); border-color: var(--brand); }
.me-tp-label { font-size: 12px; color: var(--text-muted); text-align: center; padding-top: 6px; }

/* FAW-450 — the last line of defence when a save cannot succeed. */
.me-rescue {
  margin: 12px 16px; padding: 14px 16px; border-radius: 8px;
  background: var(--danger-tint); border: 1px solid var(--danger); color: var(--text);
}
.me-rescue-head { font-size: 14px; font-weight: 700; color: var(--danger-text); margin-bottom: 6px; }
.me-rescue-why { font-size: 12px; color: var(--text); margin-bottom: 10px; line-height: 1.5; }
.me-rescue-box {
  width: 100%; font-family: var(--font-mono); font-size: 12px; padding: 8px;
  border-radius: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
}
.me-rescue-actions { display: flex; gap: 8px; margin-top: 10px; }

@media (max-width: 880px) {
  .me-canvas { padding: 32px 22px; }
  .me-bar { padding: 6px 10px; }
}

/* ── FAW-426 — the join prompt ────────────────────────────────────── */
/* Deliberately NOT a modal: no overlay, no scrim. The ticket is explicit that
   it must not block the interface behind it. */
.mjp {
  position: fixed; right: 20px; bottom: 20px; z-index: 900; width: 320px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.mjp-body { display: flex; align-items: flex-start; gap: 10px; padding: 14px; }
.mjp-icon { flex: 0 0 auto; display: flex; color: var(--brand-text); padding-top: 1px; }
.mjp-text { flex: 1 1 auto; min-width: 0; }
.mjp-title { font-size: 13px; font-weight: 600; color: var(--text); }
.mjp-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mjp-x {
  flex: 0 0 auto; display: flex; background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px;
}
.mjp-x:hover { color: var(--text); }
.mjp-actions {
  display: flex; gap: 8px; padding: 0 14px 14px; justify-content: flex-end;
}
.mjp-btn {
  padding: 6px 16px; border-radius: 6px; font-size: 12px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.mjp-btn:hover { background: var(--bg-hover); }
.mjp-yes {
  background: var(--brand); border-color: var(--brand); color: var(--on-brand);
}
.mjp-yes:hover { background: var(--brand-hover); }
.mjp-modal { width: 420px; }
.mjp-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.mjp-reason {
  padding: 6px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.mjp-reason:hover { background: var(--brand-subtle); border-color: var(--brand-soft);
  color: var(--brand-text); }
/* Host first (2026-10-16) — waiting for the organiser. Built on the join
   prompt's card; the note may wrap where .mjp-sub is a single line. */
.mwait-note { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.mwait-spinner {
  display: inline-block; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--brand);
  animation: mwait-spin 0.9s linear infinite;
}
@keyframes mwait-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mwait-spinner { animation: none; } }

@media (max-width: 768px) {
  .mjp { left: 12px; right: 12px; width: auto; }
  .mjp-modal { width: 100%; }
}
/* FRG-200 — "no note taker → no memo will be sent". Not an error (it's a
   legitimate choice) but it must not read as ordinary helper text either, so
   it takes the warn INK token. --warn is a fill and would be illegible as
   text; --warn-text is the paired ink. */
.mm-notetaker-hint.mm-hint-warn { color: var(--warn-text); }
.mm-danger-btn { color: var(--danger-text); margin-right: auto; }
.mm-danger-btn:hover { border-color: #ef4444; }

@media (max-width: 768px) {
  .mm-shell { padding: 16px; }
  .mm-modal { width: 100%; }
}

/* FRG-071 (ticket 5) — Dashboard header actions + split link columns. */
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-btn {
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  background: var(--surface, #1e1f2a); border: 1px solid var(--border, #2a2b36);
  color: var(--text, #fff); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.dash-btn:hover { border-color: var(--brand); }
/* The fill is a brand colour and does not change with the theme, so the ink
   on it must not inherit --text either — that put dark text on mid-blue in
   light mode. */
.dash-btn-primary { background: var(--brand); border-color: var(--brand);
  color: var(--on-brand); }
.dash-btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

/* Environments and Repository are separate columns; within a column the
   entries stack so they never read as one run-on list. */
.dash-link-group { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.dash-link { color: var(--brand-text); text-decoration: none; }
.dash-link:hover { text-decoration: underline; }
.dash-access-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-muted, #8a8b94); font-size: 12px; font-family: inherit;
}
.dash-access-btn:hover { color: var(--text, #fff); }
.dash-access-view {
  margin: 0; padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; word-break: break-word;
  background: var(--bg, #15161d); border: 1px solid var(--border, #2a2b36);
  color: var(--text, #fff); font-size: 13px;
}

/* FRG-071 — New Personal Task dialog (shared: Today's Work + Dashboard). */
.ptm-overlay {
  position: fixed; inset: 0; z-index: 4000; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.ptm-modal {
  width: 460px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column;
  background: var(--surface, #1e1f2a); border: 1px solid var(--border, #2a2b36);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.5));
}
.ptm-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border, #2a2b36);
}
.ptm-title { font-size: 17px; font-weight: 700; color: var(--text, #fff); }
.ptm-sub { font-size: 12px; color: var(--text-muted, #8a8b94); margin-top: 3px; }
.ptm-close {
  background: none; border: none; color: var(--text-muted, #8a8b94);
  cursor: pointer; padding: 2px 6px; border-radius: 6px; font-size: 20px; line-height: 1;
}
.ptm-close:hover { background: var(--surface-alt, #2a2b36); color: var(--text, #fff); }
.ptm-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.ptm-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-muted, #8a8b94);
  margin-bottom: 6px;
}
.ptm-label:not(:first-child) { margin-top: 14px; }
.ptm-opt { font-weight: 400; opacity: 0.75; }
/* 2026-11-20 — "What is this time for?" (util/time-use-modal.js), in the meeting popup's shell. */
.tu-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tu-choice { padding: 10px 8px; line-height: 1.25; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-align: center; cursor: pointer; min-height: 44px; }
.tu-choice:hover { border-color: var(--brand-text); }
.tu-choice[aria-checked="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 16%, var(--surface)); box-shadow: inset 0 0 0 1px var(--brand); }
.tu-says { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--tdy-tint, var(--surface)); font-size: 14px; line-height: 1.45; }
.tu-form { margin-top: 12px; }
.tu-form .ptm-row { flex-wrap: wrap; }
.tu-ooo { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 14px; }
.tu-ooo[hidden], .tu-times[hidden], .tu-until[hidden], .tu-form[hidden] { display: none; }
/* FRG-203 — what picking a project (or not) actually does. */
.ptm-hint { margin-top: 6px; font-size: 12px; line-height: 1.4; color: var(--text-muted); }
.ptm-input {
  width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: 8px;
  background: var(--bg, #15161d); border: 1px solid var(--border, #2a2b36);
  color: var(--text, #fff); font-size: 14px; font-family: inherit;
}
.ptm-input:focus { outline: none; border-color: var(--brand); }
.ptm-textarea { resize: vertical; min-height: 62px; }
.ptm-row { display: flex; gap: 12px; }
.ptm-row .ptm-field { flex: 1; min-width: 0; }
.ptm-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 18px; border-top: 1px solid var(--border, #2a2b36);
}
.ptm-btn {
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border, #2a2b36); background: var(--surface-alt, #2a2b36);
  color: var(--text, #fff);
}
.ptm-cancel:hover { border-color: var(--text-muted, #8a8b94); }
.ptm-save { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.ptm-save:hover:not(:disabled) { background: var(--brand-hover); }
.ptm-save:disabled { opacity: 0.6; cursor: default; }
@media (max-width: 480px) {
  .ptm-row { flex-direction: column; gap: 0; }
}

.wr-overlay {
  position: fixed; inset: 0; z-index: 4000; background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.wr-modal {
  width: 560px; max-width: 100%; max-height: 85vh; display: flex; flex-direction: column;
  background: var(--surface, #1e1f2a); border: 1px solid var(--border, #2a2b36);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.5));
}
.wr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border, #2a2b36); }
.wr-title { font-size: 17px; font-weight: 700; color: var(--text, #fff); }
.wr-sub { font-size: 13px; color: var(--text-muted, #8a8b94); margin-top: 2px; }
.wr-close { background: none; border: none; color: var(--text-muted, #8a8b94); cursor: pointer; padding: 4px; border-radius: 6px; }
.wr-close:hover { background: var(--surface-alt, #2a2b36); }
.wr-totals { display: flex; gap: 18px; padding: 12px 18px; border-bottom: 1px solid var(--border, #2a2b36); font-size: 13px; color: var(--text-muted, #8a8b94); }
.wr-num { font-size: 18px; font-weight: 700; color: var(--text, #fff); margin-right: 3px; }
.wr-body { flex: 1; overflow-y: auto; padding: 12px 18px; }
.wr-project { margin-bottom: 16px; }
.wr-project-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.wr-project-name { font-weight: 600; color: var(--text, #fff); font-size: 14px; }
.wr-project-meta { color: var(--text-muted, #8a8b94); font-size: 12px; flex-shrink: 0; }
.wr-task { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border, #2a2b36); font-size: 13px; }
.wr-task-title { color: var(--text, #fff); flex: 1; min-width: 0; }
.wr-task-date { color: var(--text-muted, #8a8b94); font-size: 11px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.wr-empty { text-align: center; color: var(--text-muted, #8a8b94); padding: 40px 0; font-size: 14px; }
.wr-foot { padding: 12px 18px; border-top: 1px solid var(--border, #2a2b36); display: flex; justify-content: flex-end; }
.wr-copy { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; background: var(--brand); color: var(--on-brand); font-size: 13px; font-weight: 600; }

@media (max-width: 768px) {
  .wr-overlay { padding: 0; }
  .wr-modal { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
}

@media (max-width: 768px) {
  .emoji-picker.emoji-picker-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; max-width: 100%; max-height: 45vh;
    border-radius: 12px 12px 0 0; border-left: none; border-right: none; border-bottom: none;
  }
  .emoji-picker-sheet .emoji-sec-grid button { font-size: 26px; padding: 7px 0; }
  .emoji-picker-sheet .gif-grid { grid-template-columns: repeat(4, 1fr); }
}

.new-msg-bar {
  position: sticky; bottom: 8px; align-self: center;
  background: var(--brand); color: var(--on-brand);
  padding: 6px 14px; border-radius: 16px; font-size: 12px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-md);
}

/* Main sidebar nav rows.
   FRG-065 — every row used to carry `background: var(--sidebar-hover)`
   permanently, so all eight sat in filled grey boxes and the whole column
   read as a stack of cards. A filled row should mean something: hover or
   selected. Resting state is now transparent, which also stops the active
   purple pill from competing with seven grey ones. */
.sidebar .chat-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: 14px; font-weight: 500;
  background: transparent;
  margin-bottom: 2px; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sidebar .chat-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .chat-link.active { background: var(--brand); color: var(--on-brand); font-weight: 600; }
.sidebar .chat-link.active:hover { background: var(--brand-hover); }
.sidebar .chat-link .badge {
  margin-left: auto; background: var(--danger); color:var(--on-danger);
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
  min-width: 16px; text-align: center;
}

/* Neutral "No SoW" pill — sidebar project list + project header. */
.no-sow-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  /* This pill renders in two places with different backgrounds: the sidebar,
     which is dark in BOTH themes, and the project header, which follows the
     theme. It had reached for --sidebar-hover, which is why it stayed a dark
     lozenge on the light page. A translucent grey and inherited ink read
     correctly on either, without needing to know which one it is in. */
  color: inherit;
  opacity: 0.8;
  background: rgba(128, 128, 128, 0.18);
  border: 1px solid rgba(128, 128, 128, 0.28);
  border-radius: 10px;
  vertical-align: middle;
  white-space: nowrap;
}

/* CHT-03 — an agent speaking must never be mistaken for a person.
   The identity strip sits inline in the message head, after the name. */
.msg-row .agent-ident {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  vertical-align: middle;
}
/* A WORD, not a tint. A colour alone fails for anyone who cannot see it, and
   "never be mistaken for a person" has to hold for every reader. */
.msg-row .agent-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--brand-subtle, rgba(160, 48, 106, 0.15));
  color: var(--brand-text);
  white-space: nowrap;
}
.msg-row .agent-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #8a8b94);
  white-space: nowrap;
}
.msg-row .agent-run {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-muted, #8a8b94);
  text-decoration: none;
  border-bottom: 1px dotted rgba(128, 128, 128, 0.5);
  white-space: nowrap;
}
.msg-row .agent-run:hover { color: var(--brand-text); border-bottom-color: currentColor; }
/* A personal assistant has no run to link to. Not a broken link — no link. */
.msg-row .agent-run.none { border-bottom-style: none; font-style: italic; opacity: 0.75; }

/* The row-level mark. A grouped follow-up renders no head, so without this the
   SECOND thing an agent says would look exactly like a person's message. */
.msg-row.agent {
  border-left: 2px solid var(--brand-subtle, rgba(160, 48, 106, 0.35));
  /* HAT-HVH-0000723 (second pass, found on screen) — this rule used to be
     padding-left 6px / margin-left -8px, which OVERRODE the chat gutter and
     put every agent's avatar flush against the channel-list divider. #general
     is mostly agent messages, so the gutter change looked like it did nothing.
     Now the accent rule sits inside the gutter and the avatar lands on the
     same --chat-gutter line as people's messages, the header and the composer:
     margin (gutter - 10) + 2px rule + 8px padding = gutter. */
  margin-left: calc(var(--chat-gutter) - 10px);
  padding-left: 8px;
}
@media (max-width: 768px) {
  /* Phone gutter is 12px (the !important .msg-row rule below); same sum. */
  .msg-row.agent { margin-left: 2px; padding-left: 8px !important; }
}

/* CHT-02 — a system event on the conversation timeline.
   "Visually distinct from messages" is the criterion, so this shares none of
   the message row's shape: no avatar column, no name, no bubble. A single
   quiet line with a rule down the left, which reads as a margin note against
   the conversation rather than as a turn in it. Plain system lines
   (.sysev-plain) use this same row: one kind of thing, one look.

   Sized to its content and capped, so the time sits right after the text it
   belongs to. At full pane width on a wide screen the time was flung ~900px
   from its line and read as unrelated to it. */
.msg-row.sysev {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: fit-content;
  max-width: min(calc(100% - 2 * var(--chat-gutter)), 760px);
  box-sizing: border-box;
  padding: 2px 10px 2px 8px;
  margin: 10px var(--chat-gutter) 0;
  border-left: 2px solid rgba(128, 128, 128, 0.35);
  font-size: 12.5px;
  color: var(--text-muted, #8a8b94);
  line-height: 1.45;
}
/* A run of consecutive events closes up into one block, its left rules
   joining into a single line. Specificity matches the change-of-author rule
   (.msg-row:not(.grouped) + .msg-row:not(.grouped)), which comes earlier. */
.msg-row.sysev + .msg-row.sysev { margin-top: 0; }
.msg-row.sysev .sysev-icon {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  opacity: 0.75;
}
/* FRG-211 — min-width:0 so a long line wraps rather than pushing the row
   past a 390px thread and into a horizontal scroll. */
.msg-row.sysev .sysev-body { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.msg-row.sysev .sysev-time {
  flex: 0 0 auto;
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* The link back to the item the event describes. Underlined on hover only —
   a timeline of permanently underlined lines reads as an error state. */
.msg-row.sysev .sysev-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(128, 128, 128, 0.5);
}
.msg-row.sysev .sysev-link:hover {
  color: var(--brand-text);
  border-bottom-color: currentColor;
}
/* A failed gate is the one event worth colouring: it is the one somebody has
   to act on. Everything else stays deliberately quiet. */
.msg-row.sysev-gate_pass .sysev-icon { opacity: 0.9; }

/* WST-02 — the work stream reference chip, beside the stream name in the
   header. Monospaced and tabular so a column of references lines up, and
   deliberately quieter than the name: it is an identifier you copy, not the
   thing you read first.

   Same translucent-grey treatment as .no-sow-pill and for the same reason
   documented there — it renders on both the theme-following header and the
   always-dark sidebar, so it inherits its ink rather than naming a colour. */
.ws-ref {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: inherit;
  opacity: 0.65;
  background: rgba(128, 128, 128, 0.18);
  border: 1px solid rgba(128, 128, 128, 0.28);
  border-radius: 6px;
  vertical-align: middle;
  white-space: nowrap;
  user-select: all; /* one click selects the whole reference for copying */
}

/* Avatar status dot (for message avatars) */
.avatar-status {
  position: relative;
}
.avatar-status .status-dot {
  position: absolute; bottom: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ----- Channel member panel (right side drawer) ----- */
.chat-member-panel {
  position: absolute; top: 58px; right: 0; bottom: 0;
  width: 280px; z-index: 50;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.chat-member-panel .mp-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.chat-member-panel .mp-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 22px; cursor: pointer; padding: 0 4px;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.chat-member-panel .mp-add {
  margin: 10px 16px; padding: 8px 12px; font-size: 13px;
}
.chat-member-panel .mp-list { padding: 6px 8px; }
.chat-member-panel .mp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; font-size: 13px;
}
.chat-member-panel .mp-row:hover { background: var(--surface-alt); }
.chat-member-panel .mp-remove {
  background: none; border: none;
  color: var(--text-muted); font-size: 18px;
  cursor: pointer; padding: 0 4px;
  margin-left: auto;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.chat-member-panel .mp-remove:hover { color: var(--danger-text); }
.chat-main { position: relative; }

/* ----- Utility ----- */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Profile panel ---------- */
forge-profile-panel { position: fixed; inset: 0; z-index: 500; pointer-events: none; }
forge-profile-panel .pp-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.4);
  opacity: 0; transition: opacity 200ms ease; pointer-events: auto;
}
forge-profile-panel.open .pp-overlay { opacity: 1; }
forge-profile-panel .pp-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: 350px;
  background: var(--surface); box-shadow: -4px 0 20px rgba(0,0,0,0.2);
  transform: translateX(100%); transition: transform 220ms ease;
  pointer-events: auto; display: flex; flex-direction: column;
  overflow-y: auto;
}
forge-profile-panel.open .pp-panel { transform: translateX(0); }
.pp-body { display: flex; flex-direction: column; min-height: 100%; }
.pp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border, #e5e5ea);
}
.pp-title { font-weight: 700; font-size: 16px; }
.pp-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: var(--text-muted); line-height: 1; padding: 0 4px;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.pp-main { padding: 18px; display: flex; flex-direction: column; align-items: center; }
.pp-avatar { margin: 8px 0 12px; }
.pp-name { margin: 4px 0 2px; font-size: 20px; font-weight: 700; text-align: center; }
.pp-title-job { color: var(--text-muted); font-size: 13px; text-align: center; }
.pp-status { margin-top: 6px; font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.pp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9ba0a6; }
.pp-dot.online { background: #3ba55c; }
.pp-dot.away { background: #faa61a; }
.pp-dot.busy { background: #ed4245; }
.pp-dot.offline { background: #9ba0a6; }
.pp-time { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
/* 2026-10-21 — last seen, only when not online. */
.pp-seen { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.pp-note { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
/* The rest of the Chats panel continues the identity block's column. */
.pp-identity + .pp-more { padding-top: 0; }
.pp-actions { display: flex; gap: 8px; width: 100%; margin-top: 16px; }
.pp-btn {
  flex: 1; padding: 10px 12px; border: 1px solid var(--border, #e5e5ea);
  background: var(--surface-alt); color: inherit; border-radius: 6px;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.pp-btn:hover { background: var(--brand-faint); border-color: var(--brand); }
.pp-sect {
  width: 100%; margin-top: 20px; border-top: 1px solid var(--border, #e5e5ea);
  padding-top: 14px;
}
.pp-sect h5 {
  margin: 0 0 10px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700;
}
.pp-row { display: flex; gap: 10px; padding: 6px 0; font-size: 13px; }
.pp-ico { font-size: 15px; width: 18px; text-align: center; }
.pp-row-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.pp-row a { color: var(--brand-text); text-decoration: none; }
.pp-role-badge {
  display: inline-block; padding: 4px 10px; background: var(--brand-faint);
  color: var(--brand-text); border-radius: 12px; font-size: 12px; font-weight: 600;
}
.pp-projects, .pp-activity { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.pp-projects li { padding: 4px 0; }
.pp-activity li { padding: 6px 0; border-bottom: 1px solid var(--border, #eee); }
.pp-activity li:last-child { border-bottom: none; }
.pp-activity .pp-ts { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.pp-loading, .pp-error { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.pp-error { color: var(--danger-text); }

/* ---------- FRG-034: Central call-view modal ---------- */
forge-call-view {
  position: fixed; inset: 0; z-index: 1500;
  pointer-events: none;

  /* FRG-066 — THE call box, declared once, on the host.
   *
   * Two boxes have to agree on these four numbers: .cv-modal, and the
   * notes/chat rail, which is a SIBLING overlay rather than a child (it is
   * kept outside the ~10Hz chrome re-render so a textarea survives it). The
   * rail used to carry its own hand-written copy — `80vw / 1180px / 75vh /
   * 700px` — and copies drift. Fullscreen is exactly how it drifted: the
   * modal had a `.fullscreen` variant and the rail had none, so the rail
   * could not follow it anywhere.
   *
   * Tokens on the host fix that structurally. There is one set of numbers, so
   * there is nothing to keep in sync, and both consumers are downstream of the
   * same cascade.
   *
   * It also retires the specificity collision that broke fullscreen in the
   * first place. `forge-call-view .cv-modal.fullscreen` and
   * `forge-call-view .cv-modal.cv-meeting` were two rules of IDENTICAL
   * specificity (one type, two classes) racing on source order — and the
   * meeting's 1180px cap was written later in the file, so it won. Fullscreen
   * then applied its `inset: 0; left: 0; top: 0` to a box still capped at
   * 1180px: a full-height, 1180px-wide call jammed into the top-left corner of
   * a 1920px screen, which is precisely what BigJoe photographed. The two
   * facts are now expressed on the SAME element, where source order is the
   * only mechanism in play and reads as a decision rather than an accident. */
  --cv-box-w: 80vw;
  --cv-box-maxw: 960px;
  --cv-box-h: 75vh;
  --cv-box-maxh: 700px;
}
/* A meeting carries a notes rail on the right, so it is wider than a plain
   vibe. Ordering matters below — see .cv-fullscreen. */
forge-call-view.cv-is-meeting { --cv-box-maxw: 1180px; }
/* Fullscreen means the screen. Declared AFTER the meeting cap, on the same
   element, so it wins by order with nothing to out-rank it. If a future box
   variant is added, it goes ABOVE this line. */
forge-call-view.cv-fullscreen {
  /* 100%, not 100vw/100vh. Both boxes are absolutely positioned inside
     forge-call-view, which is `position: fixed; inset: 0` — so 100% is exactly
     their containing block, and the `left: 50% + translate(-50%)` centring
     lands them on 0 to the pixel. `100vw` counts the classic scrollbar while
     the containing block does not, which put the box 7px off-centre when
     measured. Real fullscreen has no page scrollbar so it would usually have
     looked right, but "usually right because of a coincidence elsewhere" is
     not a thing to leave in a stylesheet. */
  --cv-box-w: 100%;
  --cv-box-maxw: none;
  --cv-box-h: 100%;
  --cv-box-maxh: none;
}
forge-call-view:empty { display: none; }
forge-call-view .cv-backdrop {
  position: absolute; inset: 0;
  background: var(--call-scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: auto;
}
forge-call-view .cv-backdrop.hidden { display: none; }
forge-call-view .cv-modal {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  width: var(--cv-box-w); max-width: var(--cv-box-maxw);
  height: var(--cv-box-h); max-height: var(--cv-box-maxh);
  background: linear-gradient(160deg, var(--call-modal-from), var(--call-modal-to));
  border: 1px solid var(--call-control);
  border-radius: 16px;
  box-shadow: var(--call-shadow);
  color: var(--call-ink);
  display: flex; flex-direction: column;
  overflow: hidden;
}
/* Size comes from the host tokens above; this rule carries only what is not a
   dimension. Repeating the width and height here would recreate the second
   source of truth that caused the bug. */
forge-call-view .cv-modal.fullscreen {
  border-radius: 0; border: none;
}
forge-call-view .cv-modal.minimised { display: none; }
forge-call-view .cv-header {
  padding: 18px 22px 10px;
  border-bottom: 1px solid var(--call-line-soft);
}
forge-call-view .cv-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; color: var(--call-ink);
}
forge-call-view .cv-sub {
  margin-top: 2px; font-size: 12px; color: var(--call-ink-dim);
}
forge-call-view .cv-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--cv-cols, 2), minmax(0, 1fr));
  grid-template-rows: repeat(var(--cv-rows, 1), minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
  overflow: auto;
  align-items: center;
  justify-items: center;
}
forge-call-view .cv-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; width: 100%; height: 100%;
  padding: 12px; border-radius: 12px;
  background: var(--call-raise);
  border: 1px solid var(--call-line-soft);
  min-width: 140px; min-height: 140px;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}
forge-call-view .cv-avatar-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  padding: 4px;
  transition: box-shadow 160ms ease;
}
forge-call-view .cv-tile.is-speaking .cv-avatar-wrap {
  box-shadow: 0 0 0 3px var(--call-accent), 0 0 24px var(--call-accent-glow);
}
/* FRG-201 — badges are anchored to the TILE with POSITIVE insets, so they are
   inside its bounds by construction. Hung off .cv-avatar-wrap at right:-2px /
   bottom:-2px they hung over the avatar's edge, and once the avatar filled the
   tile that overhang fell outside the tile and was clipped away by the tile's
   overflow:hidden. Nothing that must stay visible may sit at a negative inset
   inside a clipping box. */
forge-call-view .cv-badge {
  position: absolute; z-index: 2;
  right: var(--cv-badge-inset, 8px); bottom: var(--cv-badge-inset, 8px);
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--call-ring);
}
forge-call-view .cv-mute-overlay {
  background: var(--call-danger); color: var(--call-on-accent);
}
forge-call-view .cv-name {
  font-size: 13px; font-weight: 600; color: var(--call-ink);
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
forge-call-view .cv-footer {
  border-top: 1px solid var(--call-line-soft);
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  /* FRG-066 — the size container for the control bar.
   *
   * On the FOOTER rather than on the row inside it, for two reasons, both
   * found by measuring rather than by reasoning:
   *
   *   1. A size query reports its container's CONTENT box. The footer's border
   *      box never changes when the notes rail opens — but its content box
   *      does, because that is exactly what the rail's padding eats. Verified
   *      in Chrome: 1178px border box, 798px content box, and a
   *      `(max-width: 900px)` query fires. So the footer sees the narrowing.
   *   2. A container cannot style ITSELF, only its descendants. With the
   *      container on the row, `@container` rules could hide the labels (those
   *      target buttons) but silently could not change the row's own `gap` —
   *      it stayed at 10px through every tier, which is how the bar still
   *      overflowed below ~570px in testing. From the footer, the row is a
   *      descendant and every property on it is reachable. */
  container-type: inline-size;
  container-name: cv-bar;
}
/* FRG-066 — the control row, and the box the collapse rules measure.
 *
 * The bar burst on staging with the notes rail open: ten controls, and
 * `.cv-modal.rail-open .cv-footer` pads its right edge by the whole rail
 * width to keep the row centred under the video column. That left roughly
 * 800px of a 1180px modal for the controls — on a 1920px screen, so every
 * viewport-keyed rule stayed silent. The buttons shrank (flex items do, by
 * default), "Start video" wrapped to two lines, and a fixed-height footer had
 * nowhere to put the second line.
 *
 * Why a row element at all, when .cv-footer is already a flex row: the footer
 * is the size CONTAINER (see above), and a container cannot style itself. The
 * spacing that has to give way as the bar narrows therefore has to live on a
 * descendant. This row is that descendant.
 *
 * `min-width: 0` because a flex item will not shrink below its content
 * otherwise, so the row would stay as wide as the sum of its buttons and push
 * them out of the footer instead of letting the tiers do their work. */
forge-call-view .cv-controls {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: nowrap;
  gap: 10px;
}
forge-call-view .cv-btn {
  /* 44px is the thumb-target FLOOR, not a target — at exactly 44 with tight
     padding, eleven of these read as a row of small chips. 52px was the first
     correction and overshot: on staging the bar became the loudest thing in the
     meeting. 48px sits between the two — comfortably above the floor, without
     competing with the video it sits under. Judged on screen, not derived. */
  min-width: 46px; min-height: 46px;
  /* The direct cause of the burst pill. A flex item's default is
     `flex-shrink: 1`, so every control was squeezed below its content width
     until the longest label had to wrap. Controls collapse by DROPPING their
     labels (below), never by being crushed. */
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  background: var(--call-control);
  border: 1px solid var(--call-line);
  color: var(--call-ink);
  border-radius: 24px;
  cursor: pointer;
  font-size: 13.5px; font-weight: 600;
}
forge-call-view .cv-btn:hover { background: var(--call-control-hover); }
forge-call-view .cv-btn-mute.on { background: var(--call-danger); border-color: var(--call-danger); }
forge-call-view .cv-btn-cam.on { background: var(--call-danger); border-color: var(--call-danger); }
forge-call-view .cv-btn-cam[disabled] { opacity: 0.5; cursor: not-allowed; }
forge-call-view .cv-btn-cam[disabled]:hover { background: var(--call-control); }
forge-call-view .cv-btn-end { background: var(--call-danger); border-color: var(--call-danger); }
forge-call-view .cv-btn-end:hover { background: var(--call-danger-hover); }
forge-call-view .cv-btn-min { min-width: 46px; padding: 11px; }
/* nowrap is the belt to flex:0 0 auto's braces. Even at a width no tier below
   anticipated, a label shortens the row rather than growing it a second line —
   the footer's height is fixed (the rail's bottom inset is derived from it), so
   a second line has nowhere to go but out through the button's edge, which is
   exactly what "Start video" did. */
forge-call-view .cv-btn-label { font-size: 13.5px; white-space: nowrap; }
/* FRG-066 — a disabled control reads as unavailable at a glance, not only on
   hover. Was scoped to .cv-btn-cam; Background needs it too, and so will the
   next one, so it is stated for every .cv-btn. */
forge-call-view .cv-btn[disabled] { opacity: 0.5; cursor: not-allowed; }
forge-call-view .cv-btn[disabled]:hover { background: var(--call-control); }

/* ── FRG-066: how the bar collapses ──────────────────────────────────────
 *
 * Two tiers, both measured against the control row itself, so they respond to
 * every cause of narrowness rather than just one: the notes or chat rail
 * opening, a screen share re-laying-out the stage, or the window simply being
 * small. The old rule only knew about the last of those, and only below 768px.
 *
 * Nothing is ever moved out of reach. BigJoe's constraint was explicit — an
 * overflow menu that swallowed End or Mute would be worse than an ugly bar —
 * so the controls stay where they are and shed their words instead. Ten
 * icon-only 44px buttons plus 10px gaps need ~530px; the narrowest bar the
 * desktop layout can produce is ~575px (a 769px viewport, rail open, after the
 * gutter reclaim below), so every control still fits at the worst case.
 *
 * Tier 1 — where ten labelled controls stop fitting. Labels go, icons stay,
 * and End keeps its word: it is the one control worth naming outright and the
 * one you least want to hit by accident. Same judgement the phone layout
 * already made.
 *
 * 1140px is measured, not estimated, and measured against the WIDEST label set
 * rather than the one that happens to be on screen at rest. Several controls
 * grow when active — "Share" becomes "Stop share", "Mute" becomes "Unmute" —
 * and the widest combination comes to 1121px against 1075px for the idle bar.
 * A threshold set from the idle measurement (1060px was the first attempt)
 * leaves a band around a 1373–1388px viewport where the labels are still shown
 * but no longer fit, and two controls hang out of the row. Found by sweeping
 * every width in Chrome; it is not the sort of thing that shows up in the two
 * or three widths one thinks to try by hand. */
@container cv-bar (max-width: 1500px) {
  forge-call-view .cv-btn .cv-btn-label { display: none; }
  forge-call-view .cv-btn-end { padding: 10px 18px; }
  forge-call-view .cv-btn-end .cv-btn-label { display: inline; }
}
/* Tier 2 — gaps and padding give way, hitboxes do not. min-width/min-height
 * stay at 44px throughout: a control too small to hit reliably is as good as
 * one hidden behind a menu, which is the thing we are not doing.
 *
 * 780px rather than the width at which the row strictly stops fitting. Measured
 * in Chrome, ten icon-only controls at the tier-1 metrics come to 638px, and a
 * 1280px window with the notes rail open gives the row 642px — a four-pixel
 * margin, which is not a margin. This tier starts tightening well before the
 * arithmetic gets that close. */
@container cv-bar (max-width: 780px) {
  forge-call-view .cv-controls { gap: 6px; }
  forge-call-view .cv-btn { padding: 10px 12px; }
  forge-call-view .cv-btn-end { padding: 10px 14px; }
}
/* Tier 3 — the narrowest the desktop layout can produce. End's word is the
 * last thing to go, and it keeps its red fill and phone-off icon when it does,
 * so it stays the most identifiable control in the bar. */
@container cv-bar (max-width: 560px) {
  forge-call-view .cv-controls { gap: 4px; }
  forge-call-view .cv-btn-end { padding: 10px 12px; }
  forge-call-view .cv-btn-end .cv-btn-label { display: none; }
}

/* Vibes video — tile becomes the positioning context. Video element fills
 * the tile; avatar block is the placeholder shown when video is off (or
 * has not arrived yet). `display` swap is keyed on the `.video-on` /
 * `.video-off` class set in call-view.js. */
forge-call-view .cv-tile { position: relative; overflow: hidden; }
forge-call-view .cv-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #0e0f15;
  border-radius: 12px;
}
forge-call-view .cv-video-mirrored { transform: scaleX(-1); }
forge-call-view .cv-tile.video-off .cv-video { display: none; }
forge-call-view .cv-tile.video-on .cv-avatar-wrap { display: none; }
/* Screen share: a shared screen is letterboxed (contain), never mirrored, on a
 * black backing. When someone is sharing, that tile spans the full grid width
 * as the presentation, and other tiles flow beneath it. */
forge-call-view .cv-video-screen { object-fit: contain; background: #000; transform: none; }
forge-call-view .cv-tile.is-screen {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
/* FRG-201 — the share gets a row of its own that takes whatever height is
   left, and the participants get fixed-height rows beneath it. Every tile is
   placed explicitly by call-view (grid-area), so nothing auto-flows into the
   share's row.

   The previous rule hoisted the share with `grid-column: 1 / -1` and a
   200px minimum while the OTHER tiles kept 1fr rows inside a fixed-height
   grid — so the share's minimum ate the container and the remaining rows
   collapsed to a sliver. minmax(0, 1fr) on the share row and a real track
   height on the peer rows is what keeps every tile fully visible. */
/* HAT-HVH-0000365 — the share is a block on the LEFT with a peer rail down
   the right, rather than a full-width band with rows beneath it.
   Every track is an equal fraction now: call-grid.js gives the share
   SHARE_MAIN_COLS of the columns and every row, so the proportions come from
   the placement rather than from a bespoke track sizing here. Rows are
   uniform so the rail thumbnails are all the same size, which the old
   1fr-then-fixed-rows template could not do. */
forge-call-view .cv-grid.has-screen {
  grid-template-columns: repeat(var(--cv-cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--cv-rows, 1), minmax(0, 1fr));
  align-items: stretch;
  justify-items: stretch;
}
forge-call-view .cv-grid.has-screen .cv-tile {
  /* The presentation is the thing being looked at; the peer strip must not
     force the grid to overflow, which is what min-width/min-height did. */
  min-width: 0; min-height: 0;
}
forge-call-view .cv-grid.has-screen .cv-tile.is-screen {
  background: var(--call-letterbox);
}
/* Screen-share button active state mirrors the mute/cam "on" convention. */
forge-call-view .cv-btn-share.on { color: var(--brand-text); }
forge-call-view .cv-btn-share:disabled { opacity: 0.4; cursor: not-allowed; }
/* The name label sits at the bottom of the tile when video is on so it
 * doesn't bury the avatar in the video-off state. */
forge-call-view .cv-tile.video-on .cv-name {
  position: absolute; left: 8px; bottom: 8px; z-index: 1;
  background: var(--call-video-scrim);
  padding: 4px 8px; border-radius: 6px;
  backdrop-filter: blur(4px);
}
/* The badge corner is the same whether video is on or off — one anchor, one
 * set of insets, no state-dependent re-positioning to get wrong. */

/* Denser tile chrome for many participants. */
forge-call-view .cv-size-sm .cv-tile { min-width: 100px; min-height: 110px; padding: 8px; }
forge-call-view .cv-size-sm .cv-name { font-size: 12px; }

/* MTG-28 — while someone is sharing, the faces are thumbnails and their labels
   must shrink with them.

   Measured before changing this, at 1440px: a thumbnail is 209x111 and its
   label kept full-size chrome — 12px text, 4x8px padding, 8px insets — for a
   24px band covering 22% of the tile's height. A guest's name ("johan
   vermeulen (test 111) · Guest") ran across 99% of its width. That band sits
   exactly where a face's lower half is.

   Only the THUMBNAILS: the presenter's own tile is large enough that its label
   covers 5% of it, and it carries the "screen" marker people look for. */
forge-call-view .cv-grid.has-screen .cv-tile:not(.is-screen) .cv-name {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 5px;
  left: 4px; bottom: 4px;
  /* Truncates with the existing ellipsis rather than banding across the whole
     tile. Measured: a long guest name still spanned 94% of the width at the
     smaller size. The full name remains on the header avatar stack. */
  max-width: 70%;
  border-radius: 4px;
}
/* Vibe finding 5 (2026-09-26) — and the FACE must fit the thumbnail too.
   Measured at 1280x720: a share thumbnail is 171x81, and a camera-off tile put
   8px padding, a 72px avatar in a 4px ring, a 10px gap and an in-flow name
   into it, about 122px of content in 81. The tile clips, so the avatar lost
   its bottom and the name vanished. The name is pinned to the corner whatever
   the camera is doing (it already was for video-on), and the avatar takes the
   speaker strip's thumbnail size, which fits with room for the ring. */
forge-call-view .cv-grid.has-screen .cv-tile:not(.is-screen) .cv-name {
  position: absolute; z-index: 1; margin: 0;
  background: var(--call-video-scrim);
}
forge-call-view .cv-grid.has-screen .cv-tile:not(.is-screen) .cv-avatar-wrap .avatar-wrap,
forge-call-view .cv-grid.has-screen .cv-tile:not(.is-screen) .cv-avatar-wrap .avatar-base,
forge-call-view .cv-grid.has-screen .cv-tile:not(.is-screen) .cv-avatar-wrap img {
  width: 40px !important; height: 40px !important; font-size: 15px !important; line-height: 40px !important;
}

@media (max-width: 768px) {
  forge-call-view .cv-modal.fullscreen .cv-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(160px, auto);
  }
  forge-call-view .cv-modal.fullscreen.cv-size-md .cv-grid,
  forge-call-view .cv-modal.fullscreen.cv-size-sm .cv-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* FRG-201 — the phone re-tracks the grid to one or two columns, so the
     desktop areas (up to six columns wide) would spill into implicit tracks
     and scroll sideways. Hand placement back to auto-flow here and let the
     share take the full width as the first row. call-view emits the areas as
     INLINE styles, so !important is the only lever that reaches them — the
     alternative is a viewport branch in the component, which would put the
     same decision in two places. */
  forge-call-view .cv-modal.fullscreen .cv-tile { grid-area: auto !important; }
  forge-call-view .cv-modal.fullscreen .cv-grid.has-screen {
    grid-template-rows: none;
    grid-auto-rows: minmax(160px, auto);
  }
  forge-call-view .cv-modal.fullscreen .cv-grid.has-screen .cv-tile.is-screen {
    grid-column: 1 / -1 !important;
    order: -1;
    min-height: 200px;
  }
  forge-call-view .cv-btn-label { display: none; }
  forge-call-view .cv-btn { min-height: 48px; min-width: 48px; padding: 10px; }
}

/* ═══════════════ forge-vibe-pip — Document PiP "minimised call" ═══════════════
   Styles for the standalone Picture-in-Picture window opened by
   <forge-vibe-pip>. That window is a SEPARATE document with /css/app.css linked
   in, so the forge-call-view .cv-* rules above never match there (no
   forge-call-view ancestor exists in the PiP document — which is why the PiP
   rendered unstyled). Everything here is scoped to .vp-call, the wrapper
   rendered into pipWindow.document.body. Visual target: Google Meet's minimised
   PiP — flat dark panel, a centred participant, circular controls. */
.vp-call {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--call-surface);
  color: var(--call-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}

/* The participant "stage" — fills the space above the control bar. */
.vp-call .vp-stage {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: 28px 24px;
}

.vp-call .vp-avatar-wrap { position: relative; }

/* Big circular avatar — initials placeholder until video lands (PR 2). */
.vp-call .vp-avatar {
  width: 116px; height: 116px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 600; line-height: 1; color: var(--call-on-accent);
  background: linear-gradient(160deg, var(--call-accent), var(--call-modal-to));
  box-shadow: var(--call-shadow);
  overflow: hidden;
  transition: box-shadow 160ms ease;
}
.vp-call .vp-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Speaking ring — mirrors forge-call-view .cv-tile.is-speaking. */
.vp-call .vp-avatar.is-speaking {
  box-shadow: 0 0 0 4px var(--call-accent), 0 0 26px var(--call-accent-glow);
}

/* Muted badge over the avatar. */
.vp-call .vp-mute-badge {
  position: absolute; right: 2px; bottom: 2px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--call-danger); color: var(--call-on-accent);
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--call-surface);
}

/* Label block — channel name + participant count. */
.vp-call .vp-meta { text-align: center; max-width: 100%; }
.vp-call .vp-label {
  font-size: 18px; font-weight: 600; color: var(--call-ink);
  max-width: 300px; margin: 0 auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vp-call .vp-count {
  margin-top: 5px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--call-ink-dim);
}

/* Control bar pinned to the bottom. */
.vp-call .vp-controls {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  gap: 22px; padding: 18px 0 30px;
}

/* Circular control buttons. */
.vp-call .vp-ctrl {
  width: 58px; height: 58px; padding: 0;
  border: none; border-radius: 50%;
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--call-field-line);
  color: var(--call-ink); cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
}
.vp-call .vp-ctrl:hover { background: var(--call-control-hover); }
.vp-call .vp-ctrl:active { transform: scale(0.94); }
.vp-call .vp-ctrl:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--call-accent);
}

/* Mic toggled to muted → red, matching Meet. */
.vp-call .vp-ctrl.cv-btn-mute.is-muted { background: var(--call-danger); }
.vp-call .vp-ctrl.cv-btn-mute.is-muted:hover { background: var(--call-danger-hover); }

/* End call → solid red circle. */
.vp-call .vp-ctrl.cv-btn-end { background: var(--call-danger); }
.vp-call .vp-ctrl.cv-btn-end:hover { background: var(--call-danger-hover); }

/* ═══════════════ PR 3 (3C) — ephemeral in-call (vibe) chat ═══════════════
   Two surfaces, ONE shared bubble template (.vchat-msg, see vibe-chat-bubble.js).
   Modal: a panel that overlays the call area, toggled by the Chat button.
   PiP (390px, too narrow for side-by-side): a VIEW SWAP between call + chat.
   The .vchat block is unscoped so it applies in BOTH the main document and the
   PiP's separate document (which links this same stylesheet). */

/* Modal Chat-toggle highlight (the button itself inherits .cv-btn). */
forge-call-view .cv-btn-chat.on { background: var(--call-accent); border-color: var(--call-accent); }

/* Modal chat panel — sits exactly over .cv-modal; hidden via [hidden]. */
forge-call-view .cv-chat {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 80vw; max-width: 960px; height: 75vh; max-height: 700px;
  pointer-events: auto;
  background: linear-gradient(160deg, var(--call-modal-from), var(--call-modal-to));
  border: 1px solid var(--call-control);
  border-radius: 16px;
  box-shadow: var(--call-shadow);
  color: var(--call-ink); overflow: hidden;
}
forge-call-view .cv-chat[hidden] { display: none; }
@media (max-width: 768px) {
  forge-call-view .cv-chat {
    inset: 0; left: 0; top: 0; transform: none;
    width: 100vw; height: 100vh; max-width: none; max-height: none;
    border-radius: 0; border: none;
  }
}

/* ═══ FRG-200 — the MEETING call layout ═══════════════════════════════
   Everything below is scoped to .cv-meeting, which call-view adds only when
   vibeManager.meetingId is set. An ordinary vibe never matches any of these
   selectors, so its layout is untouched.

   COLOUR: the call surface is dark in BOTH themes (the Zoom/Meet convention),
   which is why the older .cv-* rules above are written in raw literals. Forge
   already has a token family for exactly this situation — --sidebar-*, a
   permanently-dark surface that still shifts between light and dark themes —
   so the rail below is expressed in call tokens derived from it. One place to
   retheme, no literals scattered through the rules, and it tracks the theme
   rather than ignoring it. */
forge-call-view {
  /* The call-surface COLOUR tokens moved to :root (and are restated for dark).
     They had to: the picture-in-picture window is a separate document with no
     <forge-call-view> element in it, so anything declared here is invisible to
     the PiP's own .vp-chat and .vchat-* rules. Only the LAYOUT metrics below
     stay scoped — the PiP has its own geometry and never reads them. */

  /* ── Meeting layout metrics ──────────────────────────────────────
     The rail is an overlay box congruent with .cv-modal (same centring,
     same width/height caps), NOT a child of it — it has to live outside
     .cv-chrome so the 10Hz speaking re-render can't eat the textarea.
     That means its top/bottom insets have to be derived, not guessed.

     So the meeting header and footer are given FIXED heights and the
     same numbers drive the rail's insets and the video column's padding.
     One set of values, three consumers, guaranteed shared grid lines.
     The first cut hardcoded 64px/78px insets against a header that was
     actually 67px tall and could grow when a long title wrapped, which
     is why the columns never lined up. */
  --call-rail-w: 320px;
  --call-gutter: 20px;
  --call-header-h: 68px;
  --call-footer-h: 73px;

  /* FRG-201 — grid metrics for the screen-share layout. Declared here rather
     than left to a var() fallback: an undeclared token falls through to a
     literal written against one theme, which is the mistake theme-contract
     guards. These two carry lengths, not colour, so one value serves both
     themes — but they still have to exist. (--cv-peer-rows is a COUNT written
     onto .cv-grid per render by call-view, so it belongs with --cv-cols.) */
  --cv-peer-row-h: 148px;  /* height of one participant row under the share */
  --cv-badge-inset: 8px;   /* mute badge's inset from its tile's corner */
}

/* FRG-066 — the meeting's extra width moved to `forge-call-view.cv-is-meeting`
   with the rest of the box tokens. It lived here, as
   `.cv-modal.cv-meeting { max-width: 1180px }`, and out-ranked
   `.cv-modal.fullscreen` on source order alone — which is what stopped
   fullscreen from filling the screen. Nothing below may reintroduce a width
   for the modal; change the token instead. */
/* The meeting header is a fixed-height two-column grid: the title/subtitle
   stack on the left, the avatar stack on the right, both vertically centred.
   Fixed height is load-bearing — the rail's top inset is derived from it, so a
   header that grew (a long title wrapping) would silently break the shared top
   line. The title therefore ellipsises rather than wrapping.

   The avatars are laid out IN the grid, not absolutely positioned. That is what
   makes the collision impossible rather than merely unlikely: previously they
   were positioned against the modal's top-right, which is the rail's airspace,
   and only a lucky 17px of vertical clearance kept them apart. */
forge-call-view .cv-meeting .cv-header {
  box-sizing: border-box;
  height: var(--call-header-h);
  padding: 0 var(--call-gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  grid-template-areas: "title listen rec timer people" "sub listen rec timer people";
  align-content: center;
  column-gap: 16px;
}
forge-call-view .cv-meeting .cv-title {
  grid-area: title;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
forge-call-view .cv-meeting .cv-sub { grid-area: sub; min-width: 0; }

/* ── Meeting countdown, HVH d2bc1b6f ──────────────────────────────────────
   Counts down to the scheduled end, then turns red and counts UP through
   overtime. Sits between the meeting name and the participant avatars, which
   is where somebody glances when deciding whether to wrap up.

   The clock is tabular-nums so the digits do not jitter the layout every
   second, and the whole block is right-aligned so the seconds column stays
   put as the label shortens from 1:00:00 to 9:59.                          */
forge-call-view .cv-timer {
  grid-area: timer;
  display: flex; flex-direction: column; align-items: flex-end;
  justify-content: center;
  padding-right: 14px; margin-right: 2px;
  border-right: 1px solid var(--call-line);
  line-height: 1.25;
}
forge-call-view .cv-timer-clock {
  font-size: 17px; font-weight: 700; color: var(--call-ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
forge-call-view .cv-timer-range {
  font-size: 11px; color: var(--call-ink-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* Overtime. The colour is the ticket's cue; the '+' the label already carries
   says the same thing in text, for anyone who cannot read the red. */
forge-call-view .cv-timer.is-over .cv-timer-clock { color: var(--danger-text); }
forge-call-view .cv-timer.is-over .cv-timer-range { color: var(--danger-text); opacity: 0.75; }

/* Visually hidden: carries the one-off "now in overtime" announcement. */
forge-call-view .cv-timer-say {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* Narrow calls drop the scheduled range and keep the clock — the countdown is
   the part being read, the start/end times are reference. */
@media (max-width: 720px) {
  forge-call-view .cv-timer-range { display: none; }
  forge-call-view .cv-timer { padding-right: 10px; }
}

/* Participant avatars, top right of the header. */
forge-call-view .cv-people {
  grid-area: people;
  display: flex; align-items: center;
  flex-direction: row-reverse; /* so earlier avatars stack on top */
}
/* 2026-10-03 — "+N": the people beyond the first four, as one circle the size
   of an avatar (call-view.js PEOPLE_SHOWN). Its tooltip names them. */
forge-call-view .cv-people-more {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; margin-left: -8px; box-sizing: border-box;
  border-radius: 50%; border: 2px solid var(--call-surface-alt);
  background: var(--call-raise); color: var(--call-ink);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: var(--call-shadow-sm);
}
forge-call-view .cv-people-av {
  display: inline-flex;
  margin-left: -8px;
  border-radius: 50%;
  border: 2px solid var(--call-surface-alt);
  background: var(--call-surface-alt);
  box-shadow: var(--call-shadow-sm);
}
forge-call-view .cv-people-av {
  /* MTG-27 — the glow fades rather than snapping. Speaking detection flips
     this class up to ten times a second in real conversation, and an instant
     on/off at that rate reads as flicker rather than as "this person is
     talking". */
  position: relative;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}
/* MTG-27 — whoever is speaking GLOWS. This rule used to change only a 2px
   border colour, which is invisible at a glance and is why the ask came in.
   With the bottom strip gone (MTG-26) the header stack is the only place that
   says who is talking, so it has to be unmistakable.

   Lifted above its neighbours: the stack overlaps by 8px, so without z-index
   the next avatar along would cut into the glow. */
forge-call-view .cv-people-av.is-speaking {
  border-color: var(--call-accent);
  box-shadow: 0 0 0 2px var(--call-accent), 0 0 14px 4px var(--call-accent-glow);
  z-index: 1;
}
forge-call-view .cv-people-av :is(img, .avatar, .avatar-initials) {
  display: block; border-radius: 50%;
}

/* Video area + filmstrip. The stage wrapper exists in meeting mode only. */
forge-call-view .cv-meeting .cv-stage {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  transition: padding-right 140ms ease;
}
/* Video column. The grid's own 20px padding IS the gutter, so reserving
   rail + one gutter here leaves exactly one gutter of air between the last
   tile and the rail. */
forge-call-view .cv-modal.rail-open .cv-stage {
  padding-right: calc(var(--call-rail-w) + var(--call-gutter));
}
/* MTG-25 — the "waiting to be let in" bar gets the same reservation.
 *
 * The rail is an overlay spanning from one gutter below the header to one
 * gutter above the footer, and .cv-stage steps out of its way. The knock bar
 * sits BETWEEN the header and the stage, so it never got that reservation: it
 * ran the full modal width and its right-hand end — exactly where Let in and
 * Refuse live — lay underneath the chat panel. A host with chat open could not
 * admit anybody; elementFromPoint at the centre of both buttons returned the
 * chat header.
 *
 * Derived from the same tokens as the stage, not a hand-picked number, so the
 * two cannot drift apart when the rail width changes. The bar already wraps,
 * so a long name folds rather than being clipped. */
/* MTG-58 — an ordinary vibe has no .cv-stage wrapper; its grid and its audio
   stage sit directly in the modal, so they are what reserves the room. Same
   tokens as the meeting rule above, so the two cannot drift apart. */
forge-call-view .cv-modal.rail-open .cv-grid,
forge-call-view .cv-modal.rail-open .cv-audio {
  padding-right: calc(var(--call-rail-w) + var(--call-gutter));
}
forge-call-view .cv-modal.rail-open .cv-knock {
  margin-right: calc(var(--call-rail-w) + var(--call-gutter));
}
/* Vibe finding 6 — the sharing bar sits where the knock bar does, so it steps
   out of the rail the same way. */
forge-call-view .cv-modal.rail-open .cv-sharing {
  margin-right: calc(var(--call-rail-w) + var(--call-gutter));
}
/* MTG-37 — the recording notice and refusal sit in the knock bar position, so
 * they step out of the rail the same way. */
forge-call-view .cv-modal.rail-open .cv-consent,
forge-call-view .cv-modal.rail-open .cv-rec-error {
  margin-right: calc(var(--call-rail-w) + var(--call-gutter));
}

/* Fixed-height footer, for the same reason as the header: the rail's bottom
   inset is derived from it. */
forge-call-view .cv-meeting .cv-footer {
  box-sizing: border-box;
  /* A minimum, not a fixed height (2026-10-03): the minutes and translate
     controls live in the bar now, and a standing translation warning is a
     line of it. What hangs off the bar's height reads its LIVE height
     (--call-footer-live-h, syncCallBands) and falls back to this. */
  min-height: var(--call-footer-h);
}
/* The control row is centred on the MODAL, in every rail state.
 *
 * It used to be re-centred on the VIDEO COLUMN whenever the rail was open —
 * padding-right of rail + two gutters. Defensible in the abstract, but on
 * screen it reads as a bar that has slipped left, and it MOVES when the rail is
 * toggled, which is worse than either resting position. The rail stops above
 * the footer, so a modal-centred row never runs underneath it.
 *
 * Symmetric padding only. The container query above still collapses the labels
 * when the row genuinely runs out of room, which is what stops it bursting. */
forge-call-view .cv-modal.rail-open .cv-footer {
  padding-left: var(--call-gutter);
  padding-right: var(--call-gutter);
}
forge-call-view .cv-meeting .cv-stage .cv-grid {
  flex: 1 1 auto; min-height: 0;
}
/* MTG-31 — equal tiles sized to fit the stage. Square until 2026-10-04; now
 * the largest tile of a camera's shape (bestTileFit, 9:16 to 16:9), so the
 * stage is filled top to bottom (--cv-tile-w / --cv-tile-h).
 *
 * When the renderer has measured the stage, it emits .is-fitted with the
 * square size (--cv-tile) and the column/row count that make that square as
 * large as possible (bestSquareFit in call-grid.js). The tracks become exactly
 * that size and the block of tiles is centred, instead of 1fr tracks that
 * stretch to whatever shape the stage happens to be — the 2.30:1 letterboxes
 * that cut faces off.
 *
 * Four classes deep ON PURPOSE: the phone block below replaces this grid's
 * template with an auto-fit one at the same depth, and a fitted grid must win
 * there too, or the letterboxing simply returns on a phone. The screen-share
 * layout is never fitted (has-screen is excluded), so HAT-HVH-0000365's rail is
 * untouched. */
forge-call-view .cv-meeting .cv-stage .cv-grid.is-fitted:not(.has-screen) {
  grid-template-columns: repeat(var(--cv-cols), var(--cv-tile-w, var(--cv-tile)));
  grid-template-rows: repeat(var(--cv-rows), var(--cv-tile-h, var(--cv-tile)));
  grid-auto-rows: var(--cv-tile-h, var(--cv-tile));
  /* SAFE centre: when the tiles are ever wider or taller than the stage, they
     start at the edge and scroll, instead of spilling off BOTH sides where the
     leading part cannot even be scrolled to (BigJoe's third person, cut by the
     left edge with the chat open). */
  justify-content: safe center;
  align-content: safe center;
}
/* MTG-31 follow-up — a fitted tile is EXACTLY its cell, never larger.
 *
 * .cv-tile carries min-width/min-height: 140px (and 100x110 at cv-size-sm),
 * floors written for the old 1fr tracks. A min-size beats the grid track, so
 * whenever the fitted square came out smaller than the floor the tile burst
 * its cell and overlapped its neighbours. Found on a phone with chat open,
 * where the video band is capped at 32dvh: the tracks were a correct 116px and
 * the tiles rendered 140x140, overlapping, with a scrollbar.
 *
 * The fit already guarantees a sensible size (bestSquareFit refuses anything
 * under 40px), so the floors have nothing left to protect here. */
forge-call-view .cv-meeting .cv-stage .cv-grid.is-fitted:not(.has-screen) .cv-tile {
  min-width: 0;
  min-height: 0;
}

/* Filmstrip along the bottom of the video area — identity chips, not video. */
forge-call-view .cv-strip {
  flex: 0 0 auto;
  display: flex; gap: 8px;
  /* Bottom padding is one gutter so the chips end on the same line the rail
     ends on. Left padding matches the grid's, so both columns start together. */
  padding: 8px var(--call-gutter) var(--call-gutter);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin;
}
forge-call-view .cv-strip-item {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  background: var(--call-raise);
  border: 1px solid var(--call-line-soft);
  max-width: 190px;
}
forge-call-view .cv-strip-item.is-speaking {
  border-color: var(--call-accent);
  box-shadow: 0 0 0 1px var(--call-accent) inset;
}
forge-call-view .cv-strip-item.is-local { background: var(--brand-faint); }
forge-call-view .cv-strip-item :is(img, .avatar, .avatar-initials) {
  display: block; border-radius: 50%;
}
forge-call-view .cv-strip-name {
  font-size: 12px; color: var(--call-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
forge-call-view .cv-strip-mute {
  display: inline-flex; color: var(--call-danger);
}

/* Notes-toggle highlight, matching the Chat button's treatment. */
forge-call-view .cv-btn-notes.on { background: var(--call-accent); border-color: var(--call-accent); }

/* ── The rail ────────────────────────────────────────────────────────
   Notes and Chat share ONE right-hand rail in a meeting: same box, same
   width, same open/close, switched by a tab bar. Two rails side by side
   would leave the video and the participant strip cramped, which is the
   opposite of what this was asked for.

   Both .cv-notes and .cv-chat use the same centring box as the modal so
   they line up with it exactly; the box is transparent and click-through
   and only the panel inside is interactive, so the maths lives in one
   place. They overlap deliberately — only one is ever un-hidden. */
forge-call-view .cv-notes,
forge-call-view .cv-chat-rail {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  /* FRG-066 — the same box as .cv-modal, from the same tokens, not a second
     copy of its numbers. The copy that used to live here had no fullscreen
     case and could not get one: the rail sits outside the chrome that gets
     re-rendered, so the `.fullscreen` class never reached it. Reading the host
     tokens means it follows the modal into fullscreen and back out without
     knowing that fullscreen exists. */
  width: var(--cv-box-w); max-width: var(--cv-box-maxw);
  height: var(--cv-box-h); max-height: var(--cv-box-maxh);
  pointer-events: none;
  display: flex; justify-content: flex-end;
  /* Derived from the header/footer heights above, plus one gutter, so the rail
     shares a top line with the first row of tiles and a bottom line with the
     participant strip. These were hand-guessed constants before, which is
     precisely why the two columns never aligned. */
  padding:
    calc(var(--call-header-h) + var(--call-gutter))
    var(--call-gutter)
    calc(var(--call-footer-live-h, var(--call-footer-h)) + var(--call-gutter))
    0;
}
forge-call-view .cv-notes[hidden] { display: none; }

/* The outer .cv-chat box is a full-modal PANEL on an ordinary vibe — gradient,
   border, 16px radius, drop shadow, overflow:hidden. As a rail it must be an
   invisible positioning frame instead, exactly like .cv-notes, with the only
   painted thing being the .vchat panel inside it.
   Without this reset, opening Chat in a meeting paints a modal-sized slab over
   the video grid, the participant strip, the header and the control bar — i.e.
   it blanks the call. Geometry alone is not enough; the cosmetics have to go
   too. */
forge-call-view .cv-chat-rail {
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

/* Chat becomes the rail — on EVERY call, since MTG-58.
 *
 * It was meeting-only, and on an ordinary vibe chat took over the whole
 * modal: opening it hid everyone you were talking to. BigJoe asked for the
 * meetings behaviour everywhere, so the rules are lifted rather than
 * duplicated, and .cv-chat-rail is now a class the chat region always
 * carries. Overrides the full-panel rules further down. */
.vnotes,
forge-call-view .cv-chat-rail .vchat {
  pointer-events: auto;
  width: var(--call-rail-w); display: flex; flex-direction: column; min-height: 0;
  background: var(--call-surface);
  border: 1px solid var(--call-line);
  border-radius: 12px;
  box-shadow: var(--call-shadow-rail);
  color: var(--call-ink);
  overflow: hidden;
  position: static; inset: auto; /* undo .vchat's absolute inset:0 */
}
.vnotes-head,
forge-call-view .cv-chat-rail .vchat-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--call-line-soft);
}
.vnotes-title {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600;
}
.vnotes-role {
  margin-left: auto;
  font-size: 11px; color: var(--call-ink-dim);
  white-space: nowrap;
}
.vnotes-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--call-raise); border: none; color: var(--call-ink); cursor: pointer;
}
.vnotes-close:hover { background: var(--call-surface-alt); }

.vnotes-input {
  flex: 1 1 auto; min-height: 0;
  padding: 12px;
  background: transparent; border: none; resize: none;
  color: var(--call-ink); font: inherit; font-size: 13px; line-height: 1.55;
}
.vnotes-input:focus { outline: none; }
.vnotes-input::placeholder { color: var(--call-ink-dim); }
.vnotes-input[hidden] { display: none; }

/* The rail's tab bar. Flat and three-across — My notes · Shared memo · Chat —
   rather than Chat/Notes with the memo tabs nested underneath: one row of
   three beats two rows of two, and nesting would bury the shared memo a click
   deeper than it already is. Rendered into BOTH panels, since only one is
   visible at a time and whichever is showing has to carry the way out. */
/* Written as ONE selector list covering both rail panels rather than a bare
   `.vrail-tab`. The bar is rendered into .vnotes AND into .vchat, and .vchat
   is a shared block that also styles the PiP surface and the ordinary vibe's
   full-modal chat — its own rules and colours land on anything inside it. A
   bare class here inherits whichever context it happens to be in, which is
   why the same markup read as a styled bar under Notes and as bare text under
   Chat. Naming both hosts pins the appearance to the tab, not to its
   surroundings, and the colours below are stated outright (own background,
   own border, own ink) instead of leaning on what the panel sets. */
.vnotes .vrail-tabs,
forge-call-view .cv-chat-rail .vchat .vrail-tabs {
  flex: 0 0 auto;
  display: flex; gap: 4px;
  margin: 8px 10px 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--call-raise, rgba(255,255,255,0.06));
  border: 1px solid var(--call-line-soft, rgba(255,255,255,0.06));
}
.vnotes .vrail-tab,
forge-call-view .cv-chat-rail .vchat .vrail-tab {
  flex: 1 1 auto;
  padding: 6px 8px; border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--call-ink-dim, rgba(255,255,255,0.62));
  font: inherit; font-size: 12px; font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vnotes .vrail-tab:hover,
forge-call-view .cv-chat-rail .vchat .vrail-tab:hover {
  color: var(--call-ink, #fff);
  background: var(--call-surface-alt, rgba(255,255,255,0.1));
}
/* The active tab is the one thing on this bar that has to be unambiguous, so
   it is a filled pill in the call accent with white ink — not a grey box a
   shade off its own track. */
.vnotes .vrail-tab.on,
forge-call-view .cv-chat-rail .vchat .vrail-tab.on {
  background: var(--call-accent);
  border-color: var(--call-accent);
  color: var(--call-on-accent);
}
/* The shared memo, as read by everyone who isn't writing it. */
.vnotes-shared {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 12px;
  font-size: 13px; line-height: 1.55;
  color: var(--call-ink);
  white-space: pre-wrap; word-break: break-word;
}
.vnotes-shared[hidden] { display: none; }
.vnotes-shared.is-empty { color: var(--call-ink-dim); font-style: italic; }
.vnotes-tools[hidden] { display: none; }

/* HVH bcafbd69 — the recording indicator. Shown to EVERY participant, not
   just whoever pressed record: being recorded has to be visible to the people
   being recorded. Deliberately in the header, next to the meeting name, rather
   than tucked into a corner. */
forge-call-view .cv-recording {
  grid-area: rec;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; margin-right: 12px;
  border-radius: 999px;
  background: var(--danger-tint);
  color: var(--danger-text);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
forge-call-view .cv-rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  animation: cv-rec-pulse 1.6s ease-in-out infinite;
}
@keyframes cv-rec-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}
/* A pulsing dot is motion for its own sake to anyone who has asked for less
   of it — the colour and the label already carry the message. */
@media (prefers-reduced-motion: reduce) {
  forge-call-view .cv-rec-dot { animation: none; }
}
/* 2026-10-05 — the recording indicator when it is NOT fine. Warning: the host's
   pieces are not reaching the server. Stopped: it ended by itself, shown to
   everyone instead of the indicator simply vanishing. Both may wrap: these are
   sentences, and cutting one off would hide the part that matters. */
forge-call-view .cv-recording.is-warning,
forge-call-view .cv-recording.is-stopped { white-space: normal; max-width: 420px; }
forge-call-view .cv-recording.is-warning { background: var(--warn-tint); color: var(--warn-text); }
forge-call-view .cv-recording.is-warning .cv-rec-dot { background: var(--warn); }
forge-call-view .cv-recording.is-stopped .cv-rec-dot { animation: none; border-radius: 2px; }
/* The agent hears the call. Shown to EVERY participant, for the same reason
   as the recording indicator: being transcribed has to be visible to the
   people being transcribed, and a stop has to be visible so nobody thinks
   she is listening when she is not. Its own grid column in the meeting
   header, so it can never push that fixed-height header out of shape. */
forge-call-view .cv-listening-slot {
  grid-area: listen;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-width: 0; max-width: min(46vw, 420px);
}
forge-call-view .cv-meeting .cv-listening-slot { align-items: flex-end; }
forge-call-view .cv-header:not(.cv-header-focus) > .cv-listening-slot:not(:empty) { margin-top: 6px; }
forge-call-view .cv-listening {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  max-width: 100%;
}
forge-call-view .cv-listening-text { overflow: hidden; text-overflow: ellipsis; }
forge-call-view .cv-listening-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
forge-call-view .cv-listening.is-on { background: var(--success-tint); color: var(--success-text); }
/* The call is dark in both themes: --success-text is the light theme's ink and
   measured about 2.5:1 here. This green is 6.5:1 on the tinted chip. */
forge-call-view .cv-header .cv-listening.is-on { color: var(--call-ok-ink); }
forge-call-view .cv-listening.is-on .cv-listening-dot { background: var(--success); animation: cv-rec-pulse 1.6s ease-in-out infinite; }
forge-call-view .cv-listening.is-off,
forge-call-view .cv-listening.is-problem { background: var(--call-raise); color: var(--call-ink-dim); border: 1px solid var(--call-line-soft); }
forge-call-view .cv-listening.is-off .cv-listening-dot { background: var(--call-ink-dim); }
forge-call-view .cv-listening.is-problem .cv-listening-dot { background: var(--danger); }
forge-call-view .cv-listening-resume {
  margin-left: 2px; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--call-accent); background: transparent; color: var(--call-ink);
  font: inherit; font-weight: 600; cursor: pointer; min-height: 28px;
}
forge-call-view .cv-listening-resume:hover { background: var(--call-accent); color: var(--call-on-accent); }
/* Consent (2026-09-28): an agent in the call is not listening until someone
   presses Start listening; this line says, in words, what pressing means. It
   wraps, unlike the chip above it, so it is never cut off. */
forge-call-view .cv-listening-consent { margin: 0; font-size: 12px; line-height: 1.4; color: var(--call-ink); white-space: normal; max-width: 100%; }
/* On a phone the chip is 46vw wide at most: "Not listening" and the button do
   not both fit, and the text was cut to "No...". There the chip is the button,
   and the line under it says the rest. */
@media (max-width: 640px) {
  forge-call-view .cv-listening.is-consent .cv-listening-text { display: none; }
}
forge-call-view .cv-heard {
  font-size: 12px; color: var(--call-ink-dim);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
forge-call-view .cv-heard-who { color: var(--call-ink); font-weight: 600; }
forge-call-view .cv-header-focus .cv-heard { display: none; }
@media (prefers-reduced-motion: reduce) {
  forge-call-view .cv-listening.is-on .cv-listening-dot { animation: none; }
}
/* Live translation (call-translation.js). The chip is the listening chip's
   sibling and speaks the same visual language: being translated is shown to
   everyone, like being transcribed. The pickers open under it. */
/* One line, always: the meeting header is a fixed height, and a wrapped row
   pushed the chip out of it (seen on screen 2026-09-28). The chip gives way. */
forge-call-view .cv-translate-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; max-width: 100%; min-width: 0; }
forge-call-view .cv-translate-row .cv-translate { flex: 1 1 auto; min-width: 0; overflow: hidden; }
forge-call-view .cv-translate-row .cv-translate-meter { flex: none; }
forge-call-view .cv-translate-row .cv-translate .cv-listening-text { overflow: hidden; text-overflow: ellipsis; }
forge-call-view .cv-translate-btn { flex: 0 0 auto; white-space: nowrap; }
forge-call-view .cv-translate {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--call-raise); color: var(--call-ink); border: 1px solid var(--call-accent);
}
forge-call-view .cv-translate .cv-listening-dot { background: var(--call-accent); }
forge-call-view .cv-translate-meter { font-weight: 500; color: var(--call-ink-dim); }
forge-call-view .cv-translate-btn {
  padding: 3px 10px; border-radius: 999px; min-height: 28px;
  border: 1px solid var(--call-line-soft); background: var(--call-raise); color: var(--call-ink);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
forge-call-view .cv-translate-btn:hover,
forge-call-view .cv-translate-btn.is-open { border-color: var(--call-accent); }
/* A popover under the control, not part of the header's flow: the meeting
   header is a fixed height, and in-flow pickers were pushed up out of it. */
forge-call-view .cv-listening-slot { position: relative; }
forge-call-view .cv-translate-pick {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  width: min(340px, calc(100vw - 32px));
  display: grid; gap: 8px; padding: 10px 12px;
  border-radius: 10px; background: var(--call-surface); border: 1px solid var(--call-line);
  box-shadow: var(--call-shadow);
  font-size: 12px; color: var(--call-ink);
}
forge-call-view .cv-translate-pick label { display: grid; gap: 4px; font-weight: 600; }
forge-call-view .cv-translate-pick select {
  font: inherit; font-weight: 500; min-height: 32px; padding: 4px 8px; border-radius: 8px;
  border: 1px solid var(--call-field-line, var(--call-line)); background: var(--call-surface); color: var(--call-ink);
}
forge-call-view .cv-translate-pick .cv-translate-check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
forge-call-view .cv-translate-check input { width: 16px; height: 16px; accent-color: var(--call-accent); }
/* Phone (2026-09-28): the picker hung off the right edge of its button, which
   sits at the left of the header, so at 375px it opened from x=-153: its
   labels and the start of every control off the screen. On a phone both
   popovers span the header instead, 12px in from each side, just below it.
   Nothing else in the header is positioned, so anchoring them to it moves
   nothing else. */
@media (max-width: 640px) {
  forge-call-view .cv-header, forge-call-view .cv-header-focus { position: relative; }
  forge-call-view .cv-header .cv-listening-slot,
  forge-call-view .cv-header-focus .cv-listening-slot { position: static; }
  forge-call-view .cv-translate-pick,
  forge-call-view .cv-translate-warn { left: 12px; right: 12px; width: auto; }
  /* And what is inside stays inside: the selects sized themselves to their
     longest option and the notes inherited the header's no-wrap, both
     running off the right edge once the panel fit the screen. */
  forge-call-view .cv-translate-pick { grid-template-columns: minmax(0, 1fr); white-space: normal; }
  forge-call-view .cv-translate-pick select { width: 100%; min-width: 0; }
}
/* The one line under "My language" saying what it means (2026-09-28). */
forge-call-view .cv-translate-hint { margin: -2px 0 0; color: var(--call-ink-dim); font-weight: 500; line-height: 1.4; white-space: normal; }
forge-call-view .cv-translate-summary { margin: 0; color: var(--call-ink); font-weight: 500; line-height: 1.4; white-space: normal; }
forge-call-view .cv-translate-note { margin: 0; color: var(--call-ink-dim); font-weight: 400; line-height: 1.4; white-space: normal; }
/* The ONE list (2026-09-29): every language in its own script; one tap is the
   whole choice. Scrolls inside the panel rather than past the screen. */
forge-call-view .cv-lang-list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
  max-height: min(52vh, 420px); overflow-y: auto;
}
forge-call-view .cv-lang-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  min-height: 44px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--call-line); background: transparent; color: var(--call-ink);
  font: inherit; text-align: left; cursor: pointer;
}
forge-call-view .cv-lang-opt:hover { border-color: var(--call-accent); }
forge-call-view .cv-lang-opt.is-on { border-color: var(--call-accent); box-shadow: inset 0 0 0 2px var(--call-accent); }
forge-call-view .cv-lang-native { font-size: 15px; font-weight: 650; line-height: 1.25; }
forge-call-view .cv-lang-en { font-size: 11px; color: var(--call-ink-dim); }
forge-call-view .cv-lang-off {
  justify-self: start; min-height: 36px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--call-line); background: transparent; color: var(--call-ink-dim);
  font: inherit; cursor: pointer;
}
/* "I'm using earphones" (2026-10-03): a switch, with what it means under it. */
forge-call-view .cv-earphones {
  display: grid; gap: 2px; min-height: 44px; padding: 8px 12px 8px 40px; position: relative;
  border-radius: 8px; border: 1px solid var(--call-line); background: transparent;
  color: var(--call-ink); font: inherit; text-align: left; cursor: pointer;
}
forge-call-view .cv-earphones::before {
  content: ''; position: absolute; left: 12px; top: 12px; width: 18px; height: 18px;
  border-radius: 5px; border: 2px solid var(--call-line);
}
forge-call-view .cv-earphones.is-on { border-color: var(--call-accent); }
forge-call-view .cv-earphones.is-on::before { border-color: var(--call-accent); background: var(--call-accent); }
forge-call-view .cv-earphones-label { font-weight: 600; }
forge-call-view .cv-earphones-hint { font-size: 12px; color: var(--call-ink-dim); line-height: 1.35; }
/* "We could not work out your language, using English. Tap to choose."
   (2026-09-29): seen, not in the way. One line under the button, wrapping on
   a phone, and itself the button that opens the list. */
forge-call-view .cv-translate-fallback {
  display: inline-flex; align-items: center; gap: 6px; max-width: min(420px, 100%);
  margin-top: 4px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--call-accent); background: var(--call-surface); color: var(--call-ink);
  font: inherit; font-size: 12px; font-weight: 500; line-height: 1.3; text-align: left;
  white-space: normal; cursor: pointer;
}
forge-call-view .cv-translate-fallback svg { flex: none; color: var(--call-accent); }
/* Below the header, like the pickers, not inside it: a two-line notice in a
   68px header pushed everything else out of view. */
forge-call-view .cv-translate-warn {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 29;
  width: min(360px, calc(100vw - 32px)); box-shadow: var(--call-shadow);
  font-size: 12px; line-height: 1.4; color: var(--call-ink); white-space: normal;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--danger); background: var(--call-raise);
}
/* Minutes (2026-10-03). In every call: "Start minutes" in the header row,
   and once on, a chip plus a banner under the header saying so, who started
   it and where the minutes go. The banner is on the LEFT under the header;
   the translation warning keeps the right. Red dot: the same "you are being
   recorded" cue as recording. */
forge-call-view .cv-minutes {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; white-space: nowrap;
  padding: 3px 4px 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--call-raise); color: var(--call-ink); border: 1px solid var(--call-line-soft);
}
forge-call-view .cv-minutes.is-off { padding: 0; border: 0; background: transparent; }
forge-call-view .cv-minutes.is-on { border-color: var(--danger); }
forge-call-view .cv-minutes-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; }
forge-call-view .cv-minutes-btn {
  padding: 3px 10px; border-radius: 999px; min-height: 28px;
  border: 1px solid var(--call-line-soft); background: var(--call-raise); color: var(--call-ink);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
forge-call-view .cv-minutes.is-on .cv-minutes-btn { min-height: 24px; padding: 2px 9px; }
forge-call-view .cv-minutes-btn:hover { border-color: var(--call-accent); }
forge-call-view .cv-minutes-btn:disabled { color: var(--call-ink-dim); cursor: wait; }
forge-call-view .cv-minutes-note {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 28;
  width: min(380px, calc(100vw - 32px)); box-shadow: var(--call-shadow);
  font-size: 12px; line-height: 1.4; color: var(--call-ink); white-space: normal;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--danger); background: var(--call-raise);
}
forge-call-view .cv-minutes-note p { margin: 0; }
forge-call-view .cv-minutes-warn { margin: 6px 0 0; font-weight: 600; color: var(--call-ink); white-space: normal; }
/* 2026-10-03 — the passing minutes notice (member call). Under the header,
   centred over the STAGE: when a side panel is open it stays clear of it, and
   it is gone after a few seconds (call-view.js MINUTES_NOTICE_MS). */
forge-call-view .cv-minutes-toast {
  position: absolute; z-index: 28;
  top: calc(var(--call-header-live-h, 68px) + 12px);
  left: var(--call-gutter, 20px); right: var(--call-gutter, 20px);
  margin: 0 auto; width: fit-content; max-width: 560px;
  font-size: 13px; line-height: 1.45; color: var(--call-ink); white-space: normal;
  /* Opaque: --call-raise is a 3% wash, and the faces behind showed through the words. */
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--danger); background: var(--call-modal-from);
  box-shadow: var(--call-shadow);
  animation: cv-minutes-toast-in 200ms ease-out;
}
forge-call-view .cv-minutes-toast p { margin: 0; }
forge-call-view .cv-modal.rail-open > .cv-minutes-toast {
  right: calc(var(--call-rail-w) + var(--call-gutter, 20px) * 2);
}
@keyframes cv-minutes-toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { forge-call-view .cv-minutes-toast { animation: none; } }

/* 2026-10-04 (BigJoe, 5.4.0: "the bar is sloppy and text-heavy"). The bar
   holds only what you press, as round buttons in the same row and style as
   the mic: minutes, translate (its word is my language), aloud, show her.
   Their state is a dot or a colour on the button, never a sentence; the
   sentences are tooltips, and what is HAPPENING (listening, translating, the
   floor cue) is a compact line in the header (.cv-status, below). */
forge-call-view .cv-bar-tools { display: contents; }
forge-call-view .cv-btn-tool { position: relative; }
forge-call-view .cv-btn-tool.is-on,
forge-call-view .cv-btn-tool.is-open { border-color: var(--call-accent); box-shadow: inset 0 0 0 1px var(--call-accent); }
forge-call-view .cv-btn-minutes.is-on { border-color: var(--call-danger); box-shadow: inset 0 0 0 1px var(--call-danger); }
forge-call-view .cv-btn-translate.is-blocked { color: var(--call-ink-sub); border-style: dashed; }
/* The dot: red while minutes are taken, green while translating, amber for
   something wrong. Ringed in the bar's own colour so it reads on any fill. */
forge-call-view .cv-btn-dot {
  position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--call-modal-from); pointer-events: none;
}
forge-call-view .cv-btn-dot.is-rec { background: var(--call-danger); }
forge-call-view .cv-btn-dot.is-on { background: var(--call-ok); }
forge-call-view .cv-btn-dot.is-busy { background: var(--call-accent); animation: cv-rec-pulse 1.6s ease-in-out infinite; }
forge-call-view .cv-btn-dot.is-warn { background: var(--call-warn); }
forge-call-view .cv-btn-dot.is-off { background: var(--call-ink-sub); }
@media (prefers-reduced-motion: reduce) { forge-call-view .cv-btn-dot.is-busy { animation: none; } }
/* The language list opens wholly ABOVE the bar, anchored to the bar. */
forge-call-view .cv-footer { position: relative; }
forge-call-view .cv-footer .cv-translate-pick {
  position: absolute; top: auto; bottom: calc(100% + 8px); right: auto; left: 50%; transform: translateX(-50%);
  max-height: min(480px, 60vh); overflow-y: auto; white-space: normal;
}
forge-call-view .cv-translate-pick .cv-aloud { justify-self: start; min-height: 36px; padding: 6px 12px; border-radius: 8px; }
/* "Show her this" (the vision session's control) as a round eye button in
   the row. Its words stay the button's text, so it keeps its accessible name,
   and its tooltip carries the note; the colour of its ring is its tone. */
forge-call-view .cv-controls > .cv-agent-vision { flex: 0 0 auto; position: relative; display: flex; }
forge-call-view .cv-controls > .cv-agent-vision:empty { display: none; }
forge-call-view .cv-controls .avc { position: static; max-width: none; gap: 0; }
forge-call-view .cv-controls .avc-show {
  width: 46px; height: 46px; min-width: 46px; padding: 0; border-radius: 24px;
  font-size: 0; color: var(--call-ink); background: var(--call-control); border: 1px solid var(--call-line);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
forge-call-view .cv-controls .avc-show::before {
  content: ''; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--cv-eye) center / contain no-repeat; mask: var(--cv-eye) center / contain no-repeat;
}
forge-call-view .cv-controls .avc-show:hover:not(:disabled) { background: var(--call-control-hover); }
forge-call-view .cv-controls .avc-show:disabled { opacity: 0.5; cursor: not-allowed; }
forge-call-view .cv-controls .avc[data-tone="cannot"] .avc-show { border-color: var(--call-danger); opacity: 1; }
forge-call-view .cv-controls .avc[data-tone="unknown"] .avc-show { border-color: var(--call-warn-line); border-style: dashed; opacity: 1; }
forge-call-view .cv-controls .avc-note,
forge-call-view .cv-controls .avc-retry { display: none; }
/* The picture waiting to go, and aiming the camera: above the bar. */
forge-call-view .cv-controls .avc-pending:not([hidden]),
forge-call-view .cv-controls .avc-aim:not([hidden]) {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 30;
  width: max-content; max-width: min(320px, calc(100vw - 32px));
  padding: 8px 10px; border-radius: 10px; background: var(--call-surface); border: 1px solid var(--call-line); box-shadow: var(--call-shadow);
}
forge-call-view { --cv-eye: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }

/* The status, in the header (2026-10-04): the listening chip, then ONE short
   line for translation, most urgent first: the floor cue, not knowing my
   language, a warning, else "Translating into ... · 12s". Two lines at most,
   the whole text in the tooltip. "The translation is behind you" is amber
   with a hand: noticeable, and not a red box. */
forge-call-view .cv-status { gap: 3px; }
forge-call-view .cv-status-line {
  display: flex; align-items: flex-start; gap: 6px; max-width: 100%; min-width: 0;
  margin: 0; padding: 0; border: 0; background: none; text-align: left;
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--call-ink-sub);
}
forge-call-view .cv-status-line > span:last-child {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-width: 0;
}
forge-call-view .cv-status-line > .cv-listening-dot { margin-top: 4px; background: var(--call-accent); }
forge-call-view .cv-status-line > svg { flex: none; margin-top: 1px; }
forge-call-view .cv-status--on > .cv-listening-dot { background: var(--call-ok); }
forge-call-view .cv-status--mine { color: var(--call-ink); }
forge-call-view .cv-status--idle > .cv-listening-dot { background: currentColor; opacity: .6; }
forge-call-view .cv-status--behind,
forge-call-view .cv-status--warn { color: var(--call-warn-ink); }
forge-call-view .cv-status--behind { font-size: 12.5px; }
forge-call-view .cv-status--behind > svg { animation: cv-rec-pulse 1.6s ease-in-out 3; }
forge-call-view .cv-status--fallback { color: var(--call-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { forge-call-view .cv-status--behind > svg { animation: none; } }
/* The meeting header grows a little rather than cutting a line off; the
   tiles re-fit into what is left (syncCallBands). */
forge-call-view .cv-meeting .cv-header:has(.cv-status-line, .cv-listening-consent) { height: auto; min-height: var(--call-header-h); padding-top: 8px; padding-bottom: 8px; }
forge-call-view .cv-header-focus > .cv-status { max-width: min(46vw, 420px); }
@media (max-width: 640px) {
  forge-call-view .cv-footer .cv-translate-pick { left: 12px; right: 12px; width: auto; transform: none; }
  forge-call-view .cv-minutes-toast { max-width: none; }
}

@media (max-width: 640px) {
  forge-call-view .cv-minutes-note { left: 12px; right: 12px; width: auto; }
  forge-call-view .cv-listening-slot:has(.cv-minutes-note) .cv-translate-warn { top: calc(100% + 76px); }
}
/* Translation aloud (2026-10-03). The call-wide switch sits in the row, and
   the floor's cue drops below the header on the LEFT (the warning keeps the
   right): who is being translated, into what, and that microphones are
   paused, on every screen. The speaker's own cue is the accent colour: it is
   the one that tells them to stop and let the other person answer. */
forge-call-view .cv-aloud {
  flex: 0 0 auto; white-space: nowrap; padding: 3px 10px; border-radius: 999px; min-height: 28px;
  border: 1px solid var(--call-line-soft); background: var(--call-raise); color: var(--call-ink);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
forge-call-view span.cv-aloud { display: inline-flex; align-items: center; cursor: default; }
forge-call-view .cv-aloud.is-on { border-color: var(--call-accent); box-shadow: inset 0 0 0 1px var(--call-accent); }
forge-call-view .cv-aloud:disabled { color: var(--call-ink-dim); cursor: not-allowed; }
forge-call-view .cv-floor {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 29;
  width: min(380px, calc(100vw - 32px)); box-shadow: var(--call-shadow);
  font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--call-ink); white-space: normal;
  padding: 7px 11px; border-radius: 8px; border: 1px solid var(--call-line); background: var(--call-raise);
}
forge-call-view .cv-floor--mine { border-color: var(--call-accent); box-shadow: inset 0 0 0 1px var(--call-accent), var(--call-shadow); }
forge-call-view .cv-floor--behind { border-color: var(--danger); }
@media (max-width: 640px) {
  forge-call-view .cv-floor { left: 12px; right: 12px; width: auto; }
  forge-call-view .cv-floor ~ .cv-translate-warn { top: calc(100% + 64px); }
}
/* Captions ON the speaker's tile: what they said, and under it what it says
   in the language I read. Over the lower part of the tile, above the name. */
forge-call-view .cv-caption-slot {
  position: absolute; left: 8px; right: 8px; bottom: 36px; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none;
}
forge-call-view .cv-caption {
  max-width: 100%; padding: 6px 10px; border-radius: 8px;
  /* White on the video scrim, in both themes: the one call token that is. */
  background: var(--call-video-scrim); color: var(--call-danger-ink); text-align: center;
  backdrop-filter: blur(4px);
  font-size: 14px; line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
}
forge-call-view .cv-caption-orig { opacity: 0.8; font-size: 13px; }
forge-call-view .cv-caption-tr { font-weight: 600; margin-top: 2px; }
forge-call-view .cv-caption-tr.is-pending { opacity: 0.6; }
forge-call-view .cv-caption-tr.is-problem { font-weight: 500; font-size: 12px; font-style: italic; }
forge-call-view .cv-size-sm .cv-caption { font-size: 12px; }
forge-call-view .cv-size-sm .cv-caption-orig { display: none; }
/* Your own line, as the others receive it (2026-09-28, call-translation.js).
   In a two-person call your tile is the small self view in the corner, too
   small to hold a caption, so your line floats just above it. */
forge-call-view .cv-grid.cv-focus > .cv-caption-slot.is-own {
  left: auto; right: 20px; bottom: 138px; width: min(360px, calc(100% - 40px));
  align-items: flex-end; z-index: 4;
}
@media (max-width: 640px) {
  forge-call-view .cv-grid.cv-focus > .cv-caption-slot.is-own { right: 12px; bottom: 92px; width: calc(100% - 24px); }
}
/* A voice call has no tiles: its captions sit in one place on the stage,
   under the person, each line named ("You", or the speaker). */
forge-call-view .cv-audio-captions {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: min(560px, calc(100% - 32px)); margin: 14px auto 0;
}
forge-call-view .cv-audio-captions[hidden] { display: none; }
forge-call-view .cv-caption-who { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
/* 2026-10-04 — captions of someone with no tile on this screen: an agent on
   the guest's (call-translation.js, the stage strip). Over the bottom of the
   stage, just above the control bar, named, centred; never under the bar. */
forge-call-view .cv-stage-captions {
  position: absolute; z-index: 40; pointer-events: none;
  left: 50%; transform: translateX(-50%);
  /* + the name strip of the tiles in the bottom row (36px, as a tile caption
     clears it), so nobody's name is hidden behind her words. */
  bottom: calc(var(--call-footer-live-h, 88px) + 48px);
  width: min(620px, calc(100% - 32px));
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
forge-call-view .cv-stage-captions[hidden] { display: none; }
forge-call-view .cv-stage-captions .cv-caption { font-size: 15px; -webkit-line-clamp: 8; }
forge-call-view .cv-stage-captions .cv-caption-orig { font-size: 14px; }
/* 2026-09-29: a rule here hid the language panel in the two-person header
   (display: none) since 2026-09-27. A two-person video call IS that header, so
   pressing Translation there opened nothing and translation could not be
   turned on in a vibe call: BigJoe's "it is missing from vibe calls". Removed;
   the one list now shows in every header (meeting-header-areas.test.ts). */
/* The record button reads as armed while recording, matching the indicator. */
forge-call-view .cv-btn-record.on { color: var(--danger-text); }
/* HVH f86b7037 — the background picker. A small dialog over the call rather
   than another rail tab: choosing a background is something you do once and
   close, and the rail already carries four tabs. */
forge-call-view .cv-bg-picker {
  position: absolute; z-index: 6;
  left: 50%; bottom: calc(var(--call-footer-live-h, var(--call-footer-h)) + 12px);
  transform: translateX(-50%);
  width: min(390px, calc(100% - 32px));
  background: var(--call-modal-from);
  border: 1px solid var(--call-line);
  border-radius: 12px;
  box-shadow: var(--call-shadow);
  padding: 12px;
  color: var(--call-ink);
}
/* FRG-067 — the first effect of a session downloads the model (~3.6MB over
   the wire), which on a slow line is seconds, not milliseconds. The picker
   says it is working rather than appearing to have ignored the click, and
   stops accepting further picks while it does — starting a second effect
   mid-download would queue a second track swap behind the first for no
   benefit. Colour and cursor only; no layout change, so nothing moves under
   the pointer while somebody is still deciding. */
forge-call-view .cv-bg-picker.is-loading .cvbg-opt {
  opacity: 0.5;
  pointer-events: none;
}
forge-call-view .cv-bg-picker.is-loading .cvbg-title::after {
  content: ' — loading…';
  font-weight: 400;
  color: var(--call-ink-dim);
}
forge-call-view .cvbg-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
forge-call-view .cvbg-title { font-size: 13px; font-weight: 600; }
forge-call-view .cvbg-close {
  background: none; border: none; cursor: pointer;
  color: var(--call-ink-dim); display: inline-flex; padding: 2px;
}
forge-call-view .cvbg-close:hover { color: var(--call-ink); }
/* Why an option cannot be applied, said once and plainly. */
forge-call-view .cvbg-note {
  font-size: 12px; line-height: 1.45;
  color: var(--warn-text);
  background: var(--warn-tint);
  border-radius: 6px; padding: 8px 10px; margin-bottom: 10px;
}
forge-call-view .cvbg-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
forge-call-view .cvbg-opt {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px;
  padding: 5px; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 8px;
  color: var(--call-ink);
}
forge-call-view .cvbg-opt:hover { border-color: var(--call-line); }
forge-call-view .cvbg-opt.on { border-color: var(--brand); background: var(--brand-faint); }
forge-call-view .cvbg-preview { display: block; }
forge-call-view .cvbg-swatch {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 16 / 10; width: 100%; border-radius: 5px;
  background: var(--call-control);
  color: var(--call-ink-dim);
}
/* The blur swatch shows what blur DOES rather than naming it. */
forge-call-view .cvbg-blur {
  background: linear-gradient(120deg, var(--brand), #2a2b37 60%, #4caf50);
  filter: blur(4px);
}
forge-call-view .cvbg-custom {
  /* The image itself is set inline by the picker — it is per-user data, not
     a theme value, so it has no business being a CSS token. */
  background-size: cover; background-position: center;
}
forge-call-view .cvbg-label {
  font-size: 11px; text-align: center; color: var(--call-ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
forge-call-view .cvbg-opt.on .cvbg-label { color: var(--call-ink); }
forge-call-view .cvbg-upload {
  display: block; margin-top: 10px; text-align: center; cursor: pointer;
  font-size: 12px; color: var(--call-ink-dim);
  border: 1px dashed var(--call-line); border-radius: 8px; padding: 8px;
}
forge-call-view .cvbg-upload:hover { color: var(--call-ink); border-color: var(--brand); }
/* HVH bc229a4a — the agenda, in the same rail slot as the notes and the shared
   memo. Scrolls independently: a long agenda must not push the tab bar off. */
.vnotes-agenda {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 10px 12px;
  font-size: 13px; line-height: 1.5;
  color: var(--call-ink);
}
.vnotes-agenda[hidden] { display: none; }

/* FRG-071 — the live transcript panel. Shares the agenda's box metrics so the
   rail's four tabs sit on identical geometry rather than each inventing its
   own padding. Colours are call tokens throughout: this panel appears in both
   themes and has no literals of its own. */
.vnotes-transcript {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 10px 12px;
  font-size: 13px; line-height: 1.5;
  color: var(--call-ink);
  display: flex; flex-direction: column; gap: 10px;
}
.vnotes-transcript[hidden] { display: none; }
.vtr-title { font-weight: 600; font-size: 13px; margin: 0; }
.vtr-lede { margin: 0; font-weight: 600; }
.vtr-note { margin: 0; font-size: 12px; line-height: 1.45; }
.vtr-dim { color: var(--call-ink-dim); }
/* The disclosure. Deliberately plain text rather than a styled callout — it is
   information the reader needs, not a warning to be dismissed. */
.vtr-facts {
  margin: 0; padding-left: 16px;
  font-size: 12px; line-height: 1.5;
  color: var(--call-ink-dim);
  display: flex; flex-direction: column; gap: 4px;
}
.vtr-lines {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--call-line-soft);
  padding-top: 8px;
}
.vtr-line { margin: 0; font-size: 13px; line-height: 1.45; }
/* The offset, so a line can be found in the recording if one was made. */
.vtr-at {
  display: inline-block; min-width: 44px;
  color: var(--call-ink-dim);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}
.vtr-action {
  align-self: flex-start;
  min-height: 36px; padding: 8px 14px;
  border-radius: 18px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  background: var(--call-control); color: var(--call-ink);
  border: 1px solid var(--call-line);
}
.vtr-action:hover { background: var(--call-control-hover); }
.vtr-stop { background: var(--call-danger); border-color: var(--call-danger); color: var(--call-on-accent); }
.vtr-stop:hover { background: var(--call-danger-hover); }
.vtr-retry {
  align-self: flex-start;
  background: none; border: none; padding: 0;
  color: var(--call-accent); cursor: pointer;
  font-size: 12px; text-decoration: underline;
}
.vagenda-empty { color: var(--call-ink-dim); font-style: italic; }
.vagenda-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 8px; margin-bottom: 6px;
  border-bottom: 1px solid var(--call-line-soft);
}
.vagenda-count {
  font-size: 11px; letter-spacing: 0.03em; color: var(--call-ink-dim);
  font-variant-numeric: tabular-nums;
}
.vagenda-list { list-style: none; margin: 0; padding: 0; }
.vagenda-item { margin: 0 0 2px; border-radius: 6px; }
.vagenda-item:hover { background: var(--call-line-soft); }
/* The whole row is the hit target — ticking a point mid-meeting should not
   require hitting a 13px box. */
.vagenda-label {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 7px 8px; cursor: pointer;
}
.vagenda-check {
  flex: 0 0 auto; margin: 2px 0 0; cursor: pointer;
  accent-color: var(--brand);
}
.vagenda-text { flex: 1 1 auto; min-width: 0; word-break: break-word; }
/* A covered point stays legible — it is a record of what was discussed, not
   something to hide — but reads as done at a glance. */
.vagenda-item.is-done .vagenda-text {
  text-decoration: line-through;
  color: var(--call-ink-dim);
}

.vnotes-status {
  flex: 0 0 auto;
  padding: 0 12px 6px;
  font-size: 11px; color: var(--call-ink-dim);
  min-height: 15px;
}

/* Tools, beneath the notes panel on the right. */
.vnotes-tools {
  flex: 0 0 auto;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--call-line-soft);
  background: var(--call-raise);
}
.vnotes-tools-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--call-ink-dim);
  margin-bottom: 8px;
}
.vnotes-tools-row { display: flex; flex-wrap: wrap; gap: 6px; }
.vnotes-tool {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--call-raise);
  border: 1px solid var(--call-line);
  color: var(--call-ink); font-size: 12px; cursor: pointer;
}
.vnotes-tool:hover { background: var(--call-surface-alt); }

/* Narrow desktop / tablet: a 320px rail beside a 80vw modal squeezes the video
   column badly once the modal drops under ~1000px. Shrink the rail with the
   viewport rather than letting the tiles collapse — the metrics are tokens, so
   every consumer (stage padding, footer padding, rail width) follows along. */
@media (max-width: 1100px) and (min-width: 769px) {
  forge-call-view { --call-rail-w: 268px; --call-gutter: 16px; }
}

/* FRG-211 — the call on a phone: full-bleed, stage-first, rail as a sheet.
 *
 * What a 1180px modal with a 320px rail becomes on a 390px screen is the
 * question this block answers. The side-by-side arrangement cannot survive —
 * subtract the rail and the gutters and the video column is left with under
 * 50px — so the two do not compete for width at all: the stage owns the
 * screen and the rail comes over it as a sheet.
 *
 * What a phone call actually needs, in priority order:
 *   1. the video — the whole point, and the thing a 312x633 floating card
 *      was wasting a third of the screen around;
 *   2. the controls — mute, camera, leave, always reachable by thumb;
 *   3. notes and chat — wanted occasionally, and only one at a time.
 *
 * So: the modal goes full-bleed rather than floating (a call is not a dialog
 * on a phone, it is the screen you are on); the stage takes all remaining
 * height; the footer becomes a fixed control bar above the home indicator;
 * and the rail keeps the full-sheet behaviour that was already here, which
 * was the one part of this already pointing the right way.
 */
@media (max-width: 768px) {
  /* --- The modal is the screen. --- */
  forge-call-view .cv-modal {
    inset: 0; left: 0; top: 0;
    transform: none;
    width: 100vw; max-width: none;
    /* dvh, not vh: on mobile Safari and Chrome `100vh` is the viewport with
       the URL bar retracted, so a 100vh call bar sits under the browser
       chrome until you scroll. dvh tracks the live viewport. The vh line is
       the fallback for anything without dvh support. */
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  forge-call-view .cv-modal.cv-meeting { max-width: none; }

  /* --- Stage takes everything the header and footer do not. --- */
  forge-call-view .cv-stage,
  forge-call-view .cv-meeting .cv-stage {
    flex: 1 1 auto; min-height: 0;
    padding: 10px;
  }
  forge-call-view .cv-modal.rail-open .cv-stage { padding-right: 10px; }
  /* MTG-25 — at this width the rail is a bottom sheet, not a side column, and
     the knock bar sits above it. Reserving the desktop rail width here would
     crush the bar into a sliver for no reason. */
  forge-call-view .cv-modal.rail-open .cv-knock { margin-right: 16px; }
  forge-call-view .cv-modal.rail-open .cv-sharing { margin-right: 16px; }
  forge-call-view .cv-modal.rail-open .cv-consent,
  forge-call-view .cv-modal.rail-open .cv-rec-error { margin-right: 16px; }

  /* Tiles reflow to fit the screen instead of following the desktop column
     count. call-view sets `--cv-cols` inline per render (4, 5, 6 across for
     a big call), and an inline custom property cannot be overridden from a
     stylesheet — so the template is replaced outright rather than the
     variable. auto-fit with a 160px floor gives two columns at both 390px
     and 360px: a 1:1 call shows both faces side by side without scrolling,
     and a six-way becomes three tidy rows. Rows go auto because --cv-rows
     assumed a column count that no longer applies. */
  forge-call-view .cv-meeting .cv-stage .cv-grid,
  forge-call-view .cv-stage .cv-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    grid-template-rows: none;
    grid-auto-rows: minmax(120px, 1fr);
    gap: 8px;
    padding: 0;
  }
  /* A shared screen is the thing you are looking at: it takes the full width
     and the faces sit under it.

     MTG-13 — two faults here, both silent.

     1. This rule never applied. call-view writes every tile's placement as an
        INLINE `grid-area`, and an inline declaration beats a stylesheet rule
        that is not marked !important — so at phone width the share kept its
        desktop rail placement (four columns of five) inside a two-column
        auto-fit template, and nothing looked like it was meant to.
     2. Full width alone was never enough. `grid-auto-rows: minmax(120px,1fr)`
        gives the presentation the SAME HEIGHT as a face, so it came out as a
        wide short band — which is the "equal-sized strip" complaint again,
        in the host app rather than the guest one.

     So: full width, and three rows of height, with the faces on the row
     beneath. */
  forge-call-view .cv-stage .cv-grid.has-screen .cv-tile.is-screen {
    grid-column: 1 / -1 !important;
    grid-row: 1 / span 3 !important;
  }
  forge-call-view .cv-stage .cv-grid.has-screen .cv-tile:not(.is-screen) {
    grid-row: 4 !important;
    grid-column: auto !important;
  }

  /* --- Header: title ellipsises, avatars beneath. ---
     2026-09-29: EVERY area the header places must be named here. This named
     only title, sub and people, so the timer, the recording mark and the
     listening/translation slot (grid-area timer, rec, listen) all fell into
     the same implicit cell and were drawn on top of each other. On a guest's
     phone the timer sat over the Translation button and a tap hit the timer:
     the guest could not open translation at all. The clock stays beside the
     title; translation gets a whole row of its own, the width of the screen. */
  forge-call-view .cv-meeting .cv-header {
    height: auto;
    padding: 12px 14px 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title timer" "sub rec" "people people" "listen listen";
    column-gap: 10px;
  }
  forge-call-view .cv-meeting .cv-header > .cv-listening-slot {
    align-items: stretch; max-width: none; margin-top: 8px;
  }
  forge-call-view .cv-meeting .cv-header > .cv-timer { border-right: 0; padding-right: 0; margin-right: 0; }
  forge-call-view .cv-header { padding: 12px 14px 8px; }
  forge-call-view .cv-title { min-width: 0; }
  forge-call-view .cv-title > * {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
  }
  /* row-reverse means the main axis runs right-to-left, so flex-START is the
     right edge — which is where the stack belongs. */
  forge-call-view .cv-people { margin-top: 8px; justify-content: flex-start; }

  /* --- Footer: the thumb bar. Wraps rather than overflowing, clears the
         home indicator, and every control keeps a 44px target. --- */
  forge-call-view .cv-footer,
  forge-call-view .cv-meeting .cv-footer {
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  forge-call-view .cv-modal.rail-open .cv-footer {
    padding-left: 12px; padding-right: 12px;
  }
  /* FRG-066 — the wrap lives on the control row now that the row is the flex
     container. A phone bar is allowed to become two lines; the desktop one is
     not, because its footer height is fixed. */
  forge-call-view .cv-controls {
    flex-wrap: wrap;
    gap: 8px;
  }
  /* The text labels are what make six controls too wide for a phone bar, so
     they drop and the icons carry it. `.cv-btn-label` is a real span in the
     markup, so this hides the words without touching the icon — and the
     button keeps its accessible name from the existing title/aria-label.
     min-width/height are already 44px on .cv-btn; restated so a later
     padding change cannot quietly shrink the target. */
  forge-call-view .cv-btn {
    min-width: 44px; min-height: 44px;
    padding: 10px 12px;
  }
  forge-call-view .cv-btn .cv-btn-label { display: none; }
  /* Ending the call keeps its word: it is the one control worth naming
     outright, and the one you least want to hit by accident. */
  forge-call-view .cv-btn-end { padding: 10px 18px; }
  forge-call-view .cv-btn-end .cv-btn-label { display: inline; }

  /* --- Rail (notes / chat) as a BOTTOM SHEET over the call. ---
   *
   * Beside the video is impossible at 390px; over it entirely is possible but
   * wrong. Taking notes during a call while the call disappears means you
   * stop being in the call to write about it — you lose the speaker, who is
   * talking, whether your camera is still on. A sheet covering the lower two
   * thirds keeps the stage alive above it, which is the arrangement every
   * phone conferencing app converges on for the same reason.
   *
   * 68dvh leaves roughly a third of the screen as live video: enough for the
   * active speaker at a glance. It is a maximum, not a fixed height, so a
   * short notes panel does not stretch to fill it.
   */
  forge-call-view .cv-notes,
  forge-call-view .cv-chat-rail {
    inset: auto 0 0 0;
    top: auto; left: 0; right: 0; bottom: 0;
    transform: none;
    width: 100vw; max-width: none;
    height: auto;
    max-height: 68dvh;
    padding: 0;
    /* Above the call footer so the sheet is not sliced by the control bar. */
    z-index: 20;
  }
  .vnotes,
  forge-call-view .cv-chat-rail .vchat {
    width: 100%;
    border: none;
    /* Rounded only at the top — it is a sheet rising from the bottom edge,
       and the corner radius is what says so. */
    border-radius: 14px 14px 0 0;
    max-height: 68dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  /* The sheet covers the call controls while it is open, so its own dismiss
     has to be an obvious, reachable target. */
  .vnotes-tool,
  forge-call-view .cv-chat-rail .vchat-head button {
    min-width: 44px; min-height: 44px;
  }
  /* With the sheet up, the stage gives it room rather than sitting behind it:
     the tiles shrink into the visible third instead of being half-covered. */
  forge-call-view .cv-modal.rail-open .cv-stage {
    max-height: 32dvh;
    overflow: hidden;
  }

  /* MTG-33 — on a phone the sheet sits BETWEEN the video and the controls.
   *
   * DELIBERATE REVERSAL. The sheet above used to rise from the very bottom edge
   * and, per its own comment, "covers the call controls while it is open". That
   * is what made chat unusable on a phone: measured at 375px, the element at
   * the centre of the Leave button was the message list, so while chatting you
   * could not mute, stop your camera, or leave.
   *
   * Now: header, video (the 32dvh band above), chat, controls — each in its own
   * band, nothing overlapping. The sheet's top is the header plus the video
   * band; its bottom is the top of the control bar. Both heights are measured
   * per render (syncCallBands) because both bands wrap on a phone by amounts
   * that depend on the title and on how many controls this person has.
   *
   * The 68dvh cap stays as a ceiling, so this is still a sheet and never a
   * full cover. Declared after the sheet rule so it wins at equal specificity. */
  forge-call-view .cv-notes,
  forge-call-view .cv-chat-rail {
    top: calc(var(--call-header-live-h, 0px) + 32dvh);
    bottom: var(--call-footer-live-h, 0px);
    height: auto;
  }
  /* And the control bar stays at the BOTTOM of the screen while chat is open.
     With the stage capped at 32dvh, the modal's column otherwise collapses
     upward and the bar floats up under the video — measured at y=363 on an
     812px screen, exactly where the sheet now sits. margin-top: auto hands the
     freed height to the gap the sheet occupies. */
  forge-call-view .cv-modal.rail-open .cv-footer {
    margin-top: auto;
  }
  .vnotes,
  forge-call-view .cv-chat-rail .vchat {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* The control bar is below the sheet now, so the safe-area inset belongs
       to the control bar, not to the chat. */
    padding-bottom: 0;
  }
}

/* PiP chat view — fills the window; the view swap toggles [hidden] on the two
   sibling regions so exactly one is shown. */
.vp-chat {
  position: fixed; inset: 0;
  background: var(--call-surface); color: var(--call-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.vp-chat[hidden], .vp-callchrome[hidden] { display: none; }

/* ---- Shared panel (both surfaces) ---- */
.vchat {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; min-height: 0;
}
.vchat-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--call-control);
  font-weight: 600;
}
.vchat-title { font-size: 15px; }
.vchat-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--call-control); border: none; color: var(--call-ink); cursor: pointer;
}
.vchat-close:hover { background: var(--call-control-hover); }

/* Scrollable message list. */
.vchat-list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px;
}

/* Empty-state placeholder (3D) — centred in the message area when no messages. */
.vchat-empty {
  margin: auto;
  color: var(--call-ink-faint); font-size: 13px; text-align: center;
}

/* One message bubble — others left, self right (accent). */
.vchat-msg {
  display: flex; flex-direction: column; gap: 2px;
  max-width: 78%; align-self: flex-start;
}
.vchat-msg.is-self { align-self: flex-end; align-items: flex-end; }
.vchat-meta {
  display: flex; align-items: baseline; gap: 6px; padding: 0 4px;
}
.vchat-msg.is-self .vchat-meta { flex-direction: row-reverse; }
.vchat-author { font-size: 11px; font-weight: 600; color: var(--call-ink-dim); }
.vchat-time { font-size: 10px; color: var(--call-ink-faint); }
.vchat-bubble {
  background: var(--call-control);
  border: 1px solid var(--call-line-soft);
  border-radius: 14px; padding: 8px 12px;
  font-size: 14px; line-height: 1.35; color: var(--call-ink);
  white-space: pre-wrap; word-break: break-word;
}
/* MTG-81 — YOUR OWN BUBBLE IN THE CALL IS YOUR OWN BUBBLE IN CHAT.

   Specification from the branding session, applied as written. This rule
   painted --call-on-accent (white) on --call-accent (the brand), which
   measured 1.97:1 in HattVest and 1.12:1 on Potential Projects' yellow —
   live on staging, and predating any of the call work. It would have been
   the first thing BigJoe saw on opening chat during a call, sitting beside
   his new gold chat bubbles.

   --bubble-own* are generated per workspace by white-label.js and already
   measured at 4.5:1 or better across all seven staging brands, so the two
   surfaces cannot drift: one derivation, both places. */
.vchat-msg.is-self .vchat-bubble {
  background: var(--bubble-own);
  border-color: var(--bubble-own);
  color: var(--bubble-own-text);
  box-shadow: inset 0 0 0 1.5px var(--bubble-own-edge);
}

/* Input row. */
.vchat-form {
  flex: 0 0 auto;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--call-control);
}
.vchat-input {
  flex: 1 1 auto; resize: none;
  min-height: 40px; max-height: 120px;
  padding: 9px 12px; border-radius: 18px;
  background: var(--call-control);
  border: 1px solid var(--call-field-line);
  color: var(--call-ink); font: inherit; font-size: 14px; line-height: 1.35;
  outline: none;
}
.vchat-input::placeholder { color: var(--call-ink-faint); }
.vchat-input:focus { border-color: var(--call-accent); box-shadow: 0 0 0 2px var(--call-accent-glow); }
.vchat-send {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--call-accent); border: none; color: var(--call-on-accent); cursor: pointer;
}
.vchat-send:hover { background: var(--call-accent-hover); }

/* ---------- Incoming / outgoing call overlay ---------- */
forge-incoming-call {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0; transition: opacity 200ms ease;
}
forge-incoming-call.open { opacity: 1; }
forge-incoming-call .ic-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 12, 20, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}
forge-incoming-call .ic-card {
  position: relative; pointer-events: auto;
  background: linear-gradient(160deg, #2a2b37, #16171f);
  color: #fff; border-radius: 20px;
  padding: 36px 32px; width: 360px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
forge-incoming-call .ic-avatar-wrap {
  position: relative; width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
forge-incoming-call .ic-pulse {
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 3px solid #3ba55c;
  animation: ic-pulse 1.6s ease-out infinite;
}
forge-incoming-call .ic-pulse::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid #3ba55c;
  animation: ic-pulse 1.6s ease-out infinite;
  animation-delay: 0.8s;
}
@keyframes ic-pulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.45); opacity: 0; }
}
forge-incoming-call .ic-name {
  margin: 4px 0 6px; font-size: 22px; font-weight: 700;
}
forge-incoming-call .ic-sub {
  color: var(--text-muted); font-size: 14px; margin-bottom: 26px;
}
forge-incoming-call .ic-dots::after {
  content: ''; display: inline-block; width: 0;
  animation: ic-dots 1.4s steps(4, end) infinite;
  overflow: hidden; vertical-align: bottom;
}
@keyframes ic-dots {
  0% { width: 0; } 25% { width: 3px; } 50% { width: 6px; } 75% { width: 9px; } 100% { width: 0; }
}
forge-incoming-call .ic-actions {
  display: flex; gap: 12px; width: 100%;
}
forge-incoming-call .ic-btn {
  flex: 1; padding: 12px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  border: none; color: #fff;
}
forge-incoming-call .ic-decline,
forge-incoming-call .ic-cancel {
  background: #ed4245;
}
forge-incoming-call .ic-decline:hover,
forge-incoming-call .ic-cancel:hover { background: #f65457; }
forge-incoming-call .ic-accept {
  background: #3ba55c;
}
forge-incoming-call .ic-accept:hover { background: #46b869; }

/* Channel vibe invite banner */
.vibe-invite-banner {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 900; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-hover)); color: #fff;
  padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  font-size: 13px; font-weight: 600;
}
.vibe-invite-banner .vib-join {
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4);
  color: #fff; padding: 6px 12px; border-radius: 6px; font-weight: 700; cursor: pointer;
}
.vibe-invite-banner .vib-join:hover { background: rgba(255,255,255,0.3); }
.vibe-invite-banner .vib-dismiss {
  background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; line-height: 1;
}

/* Chat header vibe + back buttons */
.chat-vibe-btn {
  background: var(--brand-faint); color: var(--brand-text);
  border: 1px solid var(--brand); border-radius: 8px;
  padding: 6px 12px; font-size: 16px; cursor: pointer;
  margin-left: auto;
}
/* MTG-54 — the SECOND call button must not be pushed away from the first.
 *
 * .chat-vibe-btn carries margin-left:auto so a single button sits hard right.
 * With two of them the FIRST one absorbs all the free space and the pair ends
 * up split across the header with a gap between them — which is what an agent
 * DM has looked like since it grew a second button, and is visible in the
 * screenshot BigJoe sent. Higher specificity than the rule above, so order in
 * this file is not what decides it.
 *
 * ZERO, not a margin of its own: .chat-header already sets gap: 12px, so the
 * spacing is the header's and the pair matches everything else in that row.
 * A margin here would add to the gap and make these two buttons the only
 * things in the header spaced differently. */
.chat-vibe-btn + .chat-vibe-btn { margin-left: 0; }
.chat-vibe-btn:hover { background: var(--brand); color: var(--on-brand); }
.chat-back-btn {
  background: none; border: 1px solid var(--border, #e5e5ea);
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
  font-size: 13px; color: var(--text-muted);
}

/* ===== MOBILE RESPONSIVE ===== */

/* Bottom navigation bar — mobile only */
forge-bottom-nav { display: none; }

@media (max-width: 768px) {
  /* --- Shell --- */
  .shell { display: block !important; }
  .main { display: flex; flex-direction: column; }

  /* --- Bottom nav --- */
  forge-bottom-nav { display: block; }
  .bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--mob-nav-h);
    background: #16171f;
    border-top: 1px solid rgba(255,255,255,0.08);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav .tab {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px; color: var(--text-muted);
    text-decoration: none; font-size: 10px;
    position: relative; cursor: pointer;
  }
  .bottom-nav .tab.active { color: var(--brand-text); }
  .bottom-nav .tab .icon { font-size: 20px; }

  /* --- Sidebar: off-canvas drawer --- */
  .sidebar {
    position: fixed !important;
    top: 0; left: 0;
    width: 260px; height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  /* FRG-211 — the desktop collapse state must not reach the mobile drawer.
   *
   * `.shell.collapsed .sidebar { display: none }` is how desktop hides the
   * rail, and `state.sidebarCollapsed` persists across sessions and widths.
   * A phone inheriting a collapsed desktop session therefore got a drawer
   * that was display:none: tapping the hamburger set `body.sidebar-open`,
   * which showed the backdrop — a full-screen scrim at z-index 199 — with no
   * menu behind it. Every tap hit the scrim, and the only way out was the
   * scrim's own dismiss. Navigation looked completely broken.
   *
   * Collapsed is a desktop concept; on mobile the drawer's open/closed state
   * is `body.sidebar-open` and nothing else, so the two never interact.
   */
  .shell.collapsed .sidebar { display: flex; }

  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
  }

  /* --- Main content --- */
  .content { padding-bottom: 64px; }

  /* --- Header --- */
  .header { padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .header .right { gap: 6px; }
  .header .btn { padding: 6px 10px; font-size: 12px; }

  /* FRG-211 — the Board / List / Timeline switcher is visible again.
     It was hidden because all three routes were hidden; with them reachable
     it is the only way to move between a project's views on a phone. The
     labels go, the icons stay: three 44px icon targets fit 390px where
     "Board List Timeline" plus a project breadcrumb does not. */
  .header .view-toggle { display: inline-flex; flex: 0 0 auto; }
  .header .view-toggle button {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; font-size: 0; /* collapses the text node, keeps the icon */
    gap: 0;
  }
  .header .view-toggle button > svg,
  .header .view-toggle button > i { font-size: 16px; }
  /* The breadcrumb yields first when the bar runs out of room. */
  .header .crumbs { min-width: 0; overflow: hidden; }
  .header .crumbs .current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* FRG-215 — no drawer on mobile, so no hamburger anywhere.
   *
   * The five bottom-nav tabs are the whole of mobile navigation. This rule
   * covers the standard header, which still renders on deep-linked pages (a
   * ticket from a notification, a project from a chat link) — those pages
   * are reachable and readable, but they are not somewhere you browse to,
   * and a drawer listing surfaces that are deliberately not destinations
   * would undo the simplification. The bottom nav is on screen there, so
   * there is always a way back. */
  .header .toggle { display: none !important; }

  /* --- Kanban: horizontal swipe --- */
  .kanban {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 12px; gap: 12px;
  }
  .kanban-col {
    min-width: 80vw;
    max-width: 85vw;
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  /* --- Modals go bottom-sheet --- */
  .modal-backdrop { align-items: flex-end; }
  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 92vh;
    margin: 0;
    border-radius: 16px 16px 0 0 !important;
    overflow-y: auto;
  }
  .modal-body {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 14px !important;
    padding: 16px !important;
  }

  /* --- Chat layout --- */
  .chat-shell {
    display: flex !important;
    flex-direction: column;
    height: 100%;
  }
  .chat-list {
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .chat-main { width: 100%; }
  /* When viewing messages, hide the channel list */
  .chat-shell.viewing-messages .chat-list { display: none; }
  .chat-shell.viewing-messages .chat-main { display: flex; }
  .chat-shell.viewing-channels .chat-main { display: none; }
  .chat-shell.viewing-channels .chat-list { display: block; }
  /* FRG-215 — 44px. Inside a conversation `body.in-chat` hides the bottom
     nav (the thread wants the height, and the composer is pinned), so this
     back button is the ONLY way out of Chat and back to the five tabs. It
     measured 40px wide. */
  .chat-shell.viewing-messages .chat-back-btn {
    display: inline-flex !important;
    align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
  }

  .chat-messages { padding: 8px 12px; }
  .chat-input-wrap { padding: 8px 12px; }
  .chat-input-wrap textarea { font-size: 16px !important; }

  /* --- Files --- */
  .files-table { display: block; }
  .files-table thead { display: none; }
  .files-table tbody { display: flex; flex-direction: column; gap: 8px; }
  .files-table tbody tr {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 10px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface);
  }
  .files-table td { border: none; padding: 0; }

  /* --- Timeline horizontal scroll --- */
  .timeline-wrap, forge-timeline { overflow-x: auto; }

  /* --- Settings --- */
  .settings-layout, forge-settings .layout {
    flex-direction: column !important;
  }
  .settings-sidebar, forge-settings .settings-side {
    width: 100% !important;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* --- Profile panel — full screen --- */
  forge-profile-panel .pp-panel {
    width: 100vw !important;
  }

  /* --- Notifications / activity panels --- */
  forge-notifications-panel, .notif-panel,
  forge-activity-panel, .activity-panel {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    bottom: 56px !important;
    width: 100% !important; max-width: 100% !important;
    max-height: none !important;
    border-radius: 0 !important;
  }

  /* --- Incoming call overlay --- */
  forge-incoming-call .ic-card { width: 92vw; padding: 28px 20px; }
  forge-incoming-call .ic-actions { flex-direction: row; gap: 12px; }
  forge-incoming-call .ic-btn { flex: 1; min-height: 52px; font-size: 16px; }

  /* --- Touch targets --- */
  button, a.btn, select, [role="button"] { min-height: 44px; }
  input, textarea, select { font-size: 16px !important; }
  body { overscroll-behavior-y: contain; }

  /* --- Login --- */
  .login-card { width: 92vw !important; max-width: 400px; padding: 22px; }

  /* --- Discussions --- */
  .discussions-wrap, forge-discussions { padding: 12px; }
}

@media (max-width: 768px) and (hover: none) {
  .task-card:hover,
  .sidebar-nav .item:hover,
  .files-table tbody tr:hover,
  .notif-panel .item:hover { background: inherit; }
}

/* Loading screen — mobile */
@media (max-width: 768px) {
  #loading-screen .logo { width: 60px; height: 60px; }
  #loading-screen .name { font-size: 22px; }
}

/* ===== Lucide icon baseline ===== */
[data-lucide] {
  width: 18px; height: 18px;
  stroke-width: 1.75;
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}
.sidebar-nav [data-lucide] { width: 16px; height: 16px; }
.bottom-nav [data-lucide] { width: 22px; height: 22px; }
.header [data-lucide] { width: 20px; height: 20px; }
.header .view-toggle [data-lucide] { width: 16px; height: 16px; }
button [data-lucide] + * { margin-left: 4px; }

/* ===== Mobile — modern refresh ===== */
@media (max-width: 768px) {
  body { font-size: 15px; line-height: 1.5; }

  h1, .page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
  h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
  h3 { font-size: 15px; font-weight: 600; }

  .content { padding: 16px; }

  /* fix/mobile-reduce-page-padding (follow-up) — Today + Schedule routes ONLY:
     drop the shared .content horizontal padding so their cards/rows sit nearly
     edge-to-edge (Andre's choice; total horizontal edge gap ~4px = the
     .tw-shell / .ws-shell 4px set below). Route-scoped via :has() — an
     established pattern here (see body:has(forge-mobile-home) ~3241) — so Home,
     Settings, and every other route keep the shared 16px. Horizontal only;
     the vertical 16px is untouched. */
  .content:has(forge-todays-work),
  .content:has(forge-work-schedule) {
    padding-left: 0;
    padding-right: 0;
  }

  /* Elevated cards */
  .task-card,
  .sprint-card,
  .file-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.1s;
  }
  .task-card:active { transform: scale(0.98); }

  /* Bottom nav — frosted */
  .bottom-nav {
    background: rgba(255,255,255,0.85) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--border);
    padding: 4px 0;
  }
  [data-theme="dark"] .bottom-nav {
    background: rgba(22,23,31,0.85) !important;
    border-top: 0.5px solid rgba(255,255,255,0.08);
  }
  .bottom-nav .tab {
    font-size: 10px; font-weight: 500; gap: 3px;
    transition: color 0.15s;
  }
  .bottom-nav .tab.active { color: var(--brand-text); }
  .bottom-nav .tab [data-lucide] { width: 24px; height: 24px; }

  /* Header — sticky + frosted */
  .header {
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(255,255,255,0.85);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--border);
    position: sticky; top: 0; z-index: 50;
  }
  [data-theme="dark"] .header {
    background: rgba(26,27,35,0.85);
    border-bottom: 0.5px solid rgba(255,255,255,0.08);
  }
  .header .crumbs { font-size: 15px; font-weight: 600; }
  .header .crumbs .ws-name { display: none; }
  .header .crumbs .sep { display: none; }
  .header .view-toggle button span { display: none; }
  .header .btn { padding: 8px 10px; }
  /* feat/header-version-indicator — swap full env label for the
     single-letter pill on mobile so the version still fits. */
  .header .forge-version { padding: 0 4px; gap: 4px; }
  .header .forge-version .env-badge.env-full { display: none; }
  .header .forge-version .env-badge.env-pill { display: inline-block; }

  /* Kanban — spaced cards */
  .kanban { padding: 12px 8px; gap: 8px; }
  .kanban-col {
    min-width: 82vw; max-width: 82vw;
    background: var(--surface-alt);
    border-radius: 14px;
    padding: 12px;
  }
  .kanban-col header .title {
    font-size: 13px; font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
  }
  .kanban-col .task-card {
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }

  /* Chat mobile — modern */
  .chat-list .dm-item {
    padding: 10px 14px;
    border-radius: 10px;
    margin: 2px 6px;
  }
  .chat-list .ch-item {
    padding: 10px 14px;
    border-radius: 10px;
    margin: 2px 6px;
  }
  .chat-messages { padding: 8px 12px; }
  .chat-input-wrap {
    padding: 8px 12px;
    gap: 8px;
    background: var(--surface);
    border-top: 0.5px solid var(--border);
  }
  .chat-input-wrap textarea {
    background: var(--surface-alt);
    border: 1px solid var(--border) !important;
    border-radius: 20px !important;
    padding: 10px 16px !important;
    font-size: 15px !important;
    resize: none;
  }
  .chat-main .msg-row .body .content { font-size: 15px; line-height: 1.45; }

  /* Task modal — sheet style with drag handle */
  .modal {
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    position: relative;
  }
  .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 8px auto 4px;
  }
  .modal header { padding: 12px 20px 16px; border-bottom: 0.5px solid var(--border); }
  .modal header .title-input { font-size: 18px; font-weight: 600; }

  /* Login polish */
  .login-card { border-radius: 18px; }

  /* FAB */
  .fab {
    display: flex;
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom));
    right: 16px;
    width: 52px; height: 52px;
    border-radius: 16px;
    background: var(--brand);
    color: var(--on-brand);
    border: none;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 40%, transparent);
    align-items: center;
    justify-content: center;
    z-index: 90;
    cursor: pointer;
  }
  .fab:hover { background: var(--brand-hover); }
  .fab [data-lucide] { width: 22px; height: 22px; stroke-width: 2; }
}
@media (min-width: 769px) {
  .fab { display: none !important; }
}

/* Incoming call — modern pulse */
forge-incoming-call.open .ic-backdrop {
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  background: rgba(10,12,20,0.6);
}
forge-incoming-call .ic-card {
  background: var(--surface);
  color: var(--text);
  border-radius: 24px;
  padding: 40px 32px 28px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
}
forge-incoming-call .ic-name { color: var(--text); }
forge-incoming-call .ic-sub { color: var(--text-muted); }
forge-incoming-call .decline-btn {
  background: #ed4245 !important;
  border-radius: 14px;
  padding: 14px !important;
  min-height: 52px;
  font-size: 15px; font-weight: 600;
}
forge-incoming-call .accept-btn {
  background: #1D9E75 !important;
  border-radius: 14px;
  padding: 14px !important;
  min-height: 52px;
  font-size: 15px; font-weight: 600;
}
forge-incoming-call .accept-btn:hover { background: #22b483 !important; }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); }
  70% { box-shadow: 0 0 0 20px color-mix(in srgb, var(--brand) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 0%, transparent); }
}
forge-incoming-call .ic-avatar-wrap .avatar-wrap {
  border-radius: 50%;
  animation: pulse-ring 1.5s ease-in-out infinite;
}

/* Loading screen polish */
#loading-screen .logo {
  border-radius: 20px;
  box-shadow: 0 0 60px color-mix(in srgb, var(--brand) 35%, transparent);
}

/* ===== Mobile fixes (pass 2) ===== */
@media (max-width: 768px) {
  /* --- Settings mobile --- */
  .settings-shell {
    display: block !important;
    min-height: 100vh;
  }
  .settings-shell .settings-nav {
    width: 100% !important;
    max-width: 100% !important;
    border-right: none !important;
    padding: 16px;
    box-sizing: border-box;
  }
  .settings-shell .settings-main {
    width: 100% !important;
    padding: 16px !important;
    box-sizing: border-box;
  }
  .settings-shell.viewing-content .settings-nav { display: none; }
  .settings-shell.viewing-menu .settings-main { display: none; }
  .settings-back {
    display: inline-flex; align-items: center; gap: 8px;
    background: none; border: none;
    color: var(--brand-text); font-size: 14px; font-weight: 600;
    padding: 4px 0 12px;
    cursor: pointer;
  }
  .settings-back [data-lucide] { width: 18px; height: 18px; }

  .settings-shell .settings-main h1 { font-size: 22px; margin-top: 4px; }
  .settings-shell .settings-main .profile-avatar,
  .settings-shell .settings-main .profile-avatar img {
    max-width: 120px !important;
    max-height: 120px !important;
  }
  .settings-shell .settings-main .profile-avatar {
    margin: 0 auto 16px;
  }
  .settings-shell .settings-main > div > div[style*="display:flex"],
  .settings-shell .settings-main .settings-card > div[style*="display:flex"] {
    flex-direction: column !important;
    gap: 16px !important;
    align-items: stretch !important;
  }
  /* 2026-11-11 — "input" alone also took radio buttons and checkboxes to the
     full width (a 128px radio pushed its label across the screen). Only
     fields you type into are stretched. */
  .settings-shell .settings-main input:not([type=radio]):not([type=checkbox]):not([type=color]):not([type=range]):not([type=file]),
  .settings-shell .settings-main select,
  .settings-shell .settings-main textarea {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  .settings-shell .settings-main table { display: block; }
  .settings-shell .settings-main thead { display: none; }
  .settings-shell .settings-main tbody { display: flex; flex-direction: column; gap: 8px; }
  .settings-shell .settings-main tbody tr {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px; border: 1px solid var(--border);
    border-radius: 10px; background: var(--surface);
  }
  .settings-shell .settings-main tbody td { border: none; padding: 0; }

  /* --- Header polish --- */
  /* FRG-212 — "New task" was hidden outright. Creating a ticket from a phone
     is an ordinary thing to want, so it stays; only its label goes, leaving
     a + at a full thumb target. The disabled SoW-locked variant keeps its
     title attribute, so the reason is still reachable on long-press. */
  .header #new-task-hdr {
    min-width: 44px; min-height: 44px;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0;
  }
  .header #new-task-hdr > svg,
  .header #new-task-hdr > i { font-size: 16px; }
  .header .right { gap: 4px; }
  .header .right .btn.ghost,
  .header .right .btn { padding: 6px 8px; min-height: 44px; }

  /* --- Timeline --- */
  .tl-row-label { min-width: 120px !important; max-width: 40vw !important; }
  .timeline-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }

  /* --- Chat input spacing --- */
  .chat-input-wrap {
    padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
  }
  .chat-main { padding-bottom: 0; }
  /* Allow the chat shell to fill the viewport minus bottom nav */
  .chat-shell { min-height: calc(100vh - 56px); }

  /* --- Kanban indicator --- */
  .kanban-wrap { padding-bottom: 64px; }
}

/* --- Kanban indicator (all viewports — hidden on desktop) --- */
.kanban-indicator { display: none; }
@media (max-width: 768px) {
  .kanban-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px 14px;
  }
  .kanban-indicator .ki-label {
    font-size: 13px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .kanban-indicator .ki-dots {
    display: flex; gap: 8px;
  }
  .kanban-indicator .ki-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border);
    transition: background 0.15s, transform 0.15s;
  }
  .kanban-indicator .ki-dot.active {
    background: var(--brand);
    transform: scale(1.25);
  }
}

/* ===== Full-page notifications view ===== */
forge-notifications-view { display: block; min-height: 100vh; background: var(--surface); }
.notif-view {
  display: flex; flex-direction: column;
  min-height: 100vh;
  padding-bottom: 72px;
  background: var(--surface);
}
.notif-view-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(255,255,255,0.9);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 0.5px solid var(--border);
}
[data-theme="dark"] .notif-view-head {
  background: rgba(26,27,35,0.9);
}
.notif-view-head h1 { flex: 1; font-size: 18px; margin: 0; font-weight: 700; }
.notif-view-head .nv-back {
  background: none; border: none; padding: 6px;
  border-radius: 8px; cursor: pointer; color: var(--text);
}
.notif-view-head .nv-back:hover { background: var(--surface-alt); }
.notif-view-head .nv-read-all {
  background: none; border: none; color: var(--brand-text);
  font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
}
.notif-view-head .nv-read-all:hover { background: var(--brand-faint); }

.notif-view-list { padding: 8px; flex: 1; }
.notif-view-list .nv-item {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--text);
  position: relative;
  transition: transform 0.1s;
}
.notif-view-list .nv-item:active { transform: scale(0.98); }
.notif-view-list .nv-item.unread {
  border-color: var(--brand);
  background: var(--brand-faint);
}
.notif-view-list .nv-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-faint); color: var(--brand-text);
  flex-shrink: 0;
}
.notif-view-list .nv-body { flex: 1; min-width: 0; }
.notif-view-list .nv-title { font-weight: 600; font-size: 14px; }
.notif-view-list .nv-sub {
  font-size: 13px; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-view-list .nv-time {
  font-size: 11px; color: var(--text-muted); margin-top: 4px;
}
.notif-view-list .nv-dot {
  position: absolute; top: 14px; right: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}
.notif-view-list .nv-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Desktop: the centre sits in the app shell like any other screen (app.js),
   not as the phone page in a centred strip with no sidebar, and at the app's
   own page width (.page-shell): an 880px cap left it in a column with the
   rest of a wide screen empty (BigJoe, 2026-10-22). */
forge-notifications-view:has(.notif-view-desk) { min-height: 0; background: transparent; }
.notif-view-desk { min-height: 0; background: transparent; }
.notif-view-desk .notif-view-head {
  position: static; padding: 0 0 12px; background: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: none;
  flex-wrap: wrap;
}
[data-theme="dark"] .notif-view-desk .notif-view-head { background: none; }
.notif-view-desk .notif-view-head h1 { font-size: 22px; }
.notif-view-desk .nv-back {
  display: inline-flex; align-items: center; gap: 6px;
  flex-basis: 100%; justify-content: flex-start; width: max-content; max-width: max-content;
  margin-left: -6px; font-size: 13px; color: var(--text-muted);
}
.notif-view-desk .nv-filters { padding-left: 0; padding-right: 0; }
.notif-view-desk .notif-view-list { padding: 8px 0; }

/* One notification, as its own record */
.nv-one {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.nv-one-head { display: flex; gap: 12px; align-items: flex-start; }
.nv-one-title { font-size: 16px; font-weight: 600; margin: 4px 0 2px; }
.nv-one-body { white-space: pre-wrap; margin: 16px 0 0; color: var(--text); line-height: 1.5; max-width: 80ch; }
.nv-one-go { display: inline-flex; margin-top: 16px; text-decoration: none; }
.nv-one .nv-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-faint); color: var(--brand-text); flex-shrink: 0;
}
.nv-one .nv-time { font-size: 12px; color: var(--text-muted); }

/* ===== PWA Install Banner ===== */
.pwa-install-banner {
  position: fixed;
  bottom: -120px;
  left: 0; right: 0;
  z-index: 9000;
  transition: bottom 0.3s ease;
  padding: 0 12px 12px;
  pointer-events: none;
}
.pwa-install-banner.visible { bottom: 0; }
.pwa-install-banner .pwa-banner-content { pointer-events: auto; }

/* U7 — while the fixed install banner is up, reserve bottom space in the main
   scroll area so the banner doesn't cover the last row of content (e.g. the
   bottom task row on Today's Work). Toggled by pwa-install.js. */
/* #view, not bare .content: every chat message body is also .content, so the
   bare selector padded each bubble by 132px while the banner was up. */
body.pwa-banner-shown #view.content { padding-bottom: 132px; }

/* P1 — keyboard focus ring for the SoW phase-strip pills (now <button>s).
   --brand-text, not --brand: the raw brand can fail as an edge on the page. */
.sow-phase-pill:focus-visible {
  outline: 2px solid var(--brand-text);
  outline-offset: 2px;
}

/* B3 — read-only treatment for the task modal when opened from a locked
   (SoW phase < 7) board. Editable controls are disabled; the close button,
   tab buttons and ticket-copy pill stay interactive so the task is viewable. */
.modal.tm-locked input,
.modal.tm-locked textarea,
.modal.tm-locked select,
.modal.tm-locked .save-exit,
.modal.tm-locked .time-submit,
.modal.tm-locked button[data-act],
.modal.tm-locked .btn-primary {
  pointer-events: none;
  opacity: 0.55;
}

@media (max-width: 768px) {
  .pwa-install-banner.visible {
    bottom: calc(56px + env(safe-area-inset-bottom));
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25), 0 -4px 20px rgba(0,0,0,0.08);
  max-width: 480px;
  margin: 0 auto;
}
.pwa-banner-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 0 22px color-mix(in srgb, var(--brand) 35%, transparent);
}
.pwa-banner-text {
  flex: 1; min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-banner-text strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.pwa-banner-text span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}
.pwa-banner-text .ios-share {
  display: inline-block; font-size: 16px; vertical-align: -1px;
  color: var(--link);
}
.pwa-install-btn {
  background: var(--brand);
  color: var(--on-brand);
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.pwa-install-btn:hover { background: var(--brand-hover); }
.pwa-install-btn:active { transform: scale(0.96); }
.pwa-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 8px;
}
.pwa-dismiss-btn:hover { background: var(--surface-alt); color: var(--text); }

/* ===== Standalone mode tweaks ===== */
@media (display-mode: standalone) {
  .open-in-browser { display: none !important; }

  .header {
    padding-top: max(10px, env(safe-area-inset-top));
  }
  #loading-screen {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ===== Mobile chat fixes (pass 3) ===== */
@media (max-width: 768px) {
  /* Full-height chat column that leaves room for bottom nav */
  .chat-shell { height: calc(100vh - 56px - env(safe-area-inset-bottom)); }
  .chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
  .chat-messages {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .chat-input-wrap {
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    border-top: 0.5px solid var(--border);
    background: var(--surface);
  }

  /* Compact chat header.
     fix/mobile-chat-input — when the chat conversation goes full-screen
     (body.in-chat hides the bottom nav and pins the chat-shell to the
     viewport), this header sits flush under the phone's status bar /
     notch because the @media block above only adds `padding-top` for
     env(safe-area-inset-top) on the focused-mobile header (`.header`),
     not on `.chat-header`. Add it here so the header clears the status
     bar on real devices. `viewport-fit=cover` is already set in
     index.html so the env() value resolves properly. */
  .chat-header {
    padding: 10px 12px !important;
    padding-top: max(10px, env(safe-area-inset-top)) !important;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 0.5px solid var(--border);
    flex-shrink: 0;
  }
  .chat-header h2 { font-size: 16px !important; margin: 0 !important; font-weight: 600; }
  .chat-header .desc { font-size: 12px !important; color: var(--text-muted); }
  .chat-header .member-count-btn { font-size: 12px !important; }
  .chat-header .channel-desc { display: none; }

  /* Tighter message spacing */
  .msg-row { padding: 4px 12px !important; }
  .msg-row .content { font-size: 15px !important; line-height: 1.4 !important; }
  .msg-row .head { margin-bottom: 2px !important; }
  .msg-row .head .name { font-size: 14px !important; }
  .msg-row .head .ts { font-size: 11px !important; }
  .msg-row.sysev { padding: 2px 8px !important; margin-left: 12px; margin-right: 12px; font-size: 12px !important; }

  /* Send button: prominent round brand button */
  .chat-input-wrap .send-btn,
  .chat-input-wrap button[type="submit"],
  .chat-input-wrap > form > button:last-child,
  .chat-input-wrap .chat-send {
    background: var(--brand) !important;
    color: var(--on-brand) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
  }
}

/* ===== Mobile chat: full-screen when inside a channel ===== */
@media (max-width: 768px) {
  /* Hide bottom nav + FAB + PWA banner while inside a chat channel */
  body.in-chat forge-bottom-nav,
  body.in-chat .fab,
  body.in-chat .pwa-install-banner { display: none !important; }

  /* Chat column pinned to the visible viewport */
  body.in-chat .chat-shell {
    height: 100dvh;
    height: 100vh; /* fallback */
    min-height: 0;
  }
  body.in-chat .chat-main {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh; /* fallback — JS overrides to visualViewport.height */
    min-height: 0;
    overflow: hidden;
  }
  body.in-chat .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.in-chat .chat-input-wrap {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--surface);
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    border-top: 0.5px solid var(--border);
  }

  /* Input bar contents.
     fix/mobile-chat-input — the previous `display:flex` on the OUTER
     wrap was the cause of the missing Send button on real devices. The
     wrap holds an optional reply-bar AND the .chat-input row; making it
     a flex row turned .chat-input into a single flex item that
     defaulted to `flex: 0 1 auto` (i.e. shrinks to content, doesn't
     grow). The textarea's intrinsic min-content width (placeholder +
     adjacent buttons) then pushed .chat-input past the wrap edge on
     real mobile rendering, hiding the Send button beyond the viewport.
     Make the wrap a plain block container so reply-bar + chat-input
     stack vertically the natural way, and let .chat-input itself fill
     the wrap horizontally with proper shrinking allowed. */
  body.in-chat .chat-input-wrap {
    display: block;
    box-sizing: border-box;
  }
  body.in-chat .chat-input-wrap .chat-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  body.in-chat .chat-input-wrap textarea {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 16px !important; /* prevent iOS zoom */
    max-height: 120px;
    resize: none;
    border: 1px solid var(--border);
    background: var(--surface-alt);
  }
  body.in-chat .chat-input-wrap .send-btn,
  body.in-chat .chat-input-wrap button[type="submit"] {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--on-brand);
    border: none;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  body.in-chat .chat-input-wrap .action-btn {
    width: 36px; height: 36px;
    flex-shrink: 0;
  }

  /* When NOT in-chat (channel list mode), let the bottom nav coexist */
  body:not(.in-chat) .chat-shell { min-height: calc(100vh - 56px); }

  /* fix/mobile-chat-pin-header-channelname-input — bound the chat column to
     the visible viewport so #72/#73's in-chat pinning pins to the VIEWPORT,
     not just within a 100dvh shell. The shell was 100dvh nested inside
     .content (flex:1; overflow:auto), so .content (≈ 100vh − forge-header)
     scrolled the whole shell as one unit — header scrolled away, input
     floated below the fold. Make .main the 100dvh flex column, stop .content
     scrolling, and let the shell FILL .content instead of being viewport-tall.
     forge-header pins at the top of .main; .chat-header pins beneath it; the
     message list is the only scroller; the input pins to the bottom. #73's
     safe-area padding + flex column stay untouched. Additions/overrides only. */
  body.in-chat .main      { height: 100dvh; height: 100vh; min-height: 0; }
  body.in-chat .content   { flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 0; }
  body.in-chat .chat-shell { height: 100%; } /* was 100dvh — fill .content */
  body.in-chat .chat-main  { height: 100%; } /* was 100dvh — fill .content */

  /* fix/mobile-reduce-page-padding — halve the in-chat horizontal page padding
     (12px -> 6px) so chat content sits closer to the screen edges. Horizontal
     ONLY (padding-left/right); vertical + #73 safe-area padding (padding-top
     /-bottom) untouched. Internal row padding (.msg-row) untouched. Scoped to
     body.in-chat → channel-list view, Home, and Settings unaffected. !important
     because .chat-header's mobile padding shorthand is itself !important. */
  /* 2026-10-04 (BigJoe, 5.7.0: "there is no space ... like a bit of
     padding"): 6px put the header text, the composer box and the agent
     stripe against the screen edges, on every conversation and in the
     thread. 14px gives them air; the bubbles lose 16px of a 390px phone,
     which does not change how a message wraps in any way that matters. */
  body.in-chat .chat-header,
  body.in-chat .chat-messages,
  body.in-chat .chat-input-wrap {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}

/* ===================================================================
 * Mobile Slack-style redesign
 * =================================================================== */
@media (max-width: 768px) {
  /* FRG-215 — the sidebar is hidden on mobile, and this time it should be.
   *
   * History, because the two states look identical and are not: FRG-211
   * changed this from `display: none` to `display: contents` because the
   * host carries the off-canvas drawer, and a `position: fixed` child of a
   * `display: none` parent does not render — the drawer could never open, so
   * the hamburger produced only its backdrop, a full-screen scrim over an
   * empty screen.
   *
   * FRG-215 removed the drawer: mobile is five destinations and the bottom
   * nav lists all five, so a drawer would be a second navigation system
   * saying the same thing. Nothing opens it now, and leaving the host alive
   * only parks a rail at x=-260 carrying a dozen links and a status button
   * that no one can reach but the accessibility tree still sees.
   *
   * If a drawer ever returns, this MUST go back to `display: contents` or it
   * will silently fail to open, exactly as it did before FRG-211.
   */
  .shell > forge-sidebar,
  forge-sidebar { display: none; }
  .shell { display: block !important; }
  .main { display: flex; flex-direction: column; min-height: 100vh; }

  /* Also hide the desktop header when on the mobile Home — mobile-home
     renders its own header. The header stays for project views. */
  forge-mobile-home ~ forge-header,
  body:has(forge-mobile-home) forge-header { display: none; }
}

/* ---------- Mobile Home ---------- */
forge-mobile-home {
  display: block;
  background: var(--bg, var(--surface-alt));
  min-height: 100vh;
  padding-bottom: 80px;
}
forge-mobile-home .mh { max-width: 720px; margin: 0 auto; }

@media (max-width: 768px) {
  .mobile-home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: var(--surface);
    position: sticky; top: 0; z-index: 50;
    border-bottom: 0.5px solid var(--border);
  }
  .mobile-home-header .logo-section {
    display: flex; align-items: center; gap: 10px;
  }
  .mobile-home-header .logo-section img {
    width: 32px; height: 32px; border-radius: 8px;
  }
  .mobile-home-header .workspace-name {
    font-size: 20px; font-weight: 700; color: var(--text);
    letter-spacing: -0.3px;
  }
  .mobile-home-header .user-avatar {
    width: 36px; height: 36px;
  }

  /* Quick action cards */
  .quick-actions {
    display: flex; gap: 10px;
    padding: 14px 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .quick-actions::-webkit-scrollbar { display: none; }
  .action-card {
    flex-shrink: 0;
    width: 130px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-snap-align: start;
    text-decoration: none;
    color: var(--text);
  }
  .action-card [data-lucide] { color: var(--brand-text); }
  .action-card strong { font-size: 14px; font-weight: 700; }
  .action-card span { font-size: 12px; color: var(--text-muted); }
  .action-card:active { transform: scale(0.98); }

  /* Sections */
  .mobile-section { padding: 0 16px; }
  .mobile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-top: 0.5px solid var(--border);
    cursor: pointer;
  }
  .mobile-section:first-of-type .mobile-section-header { border-top: none; }
  .mobile-section-header .section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
  }
  .mobile-section-header [data-lucide] {
    width: 18px; height: 18px;
    color: var(--text-muted);
    transition: transform 0.2s;
  }
  .mobile-section-header.collapsed [data-lucide] { transform: rotate(-90deg); }
  .mobile-section .section-content.collapsed { display: none; }

  /* Channel rows */
  .mobile-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: var(--text);
    font-size: 15px;
    text-decoration: none;
  }
  .mobile-channel-item .hash {
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 500;
    width: 22px;
    text-align: center;
  }
  .mobile-channel-item .name { flex: 1; }
  .mobile-channel-item.unread .name { font-weight: 700; color: var(--text); }
  .mobile-channel-item .unread-badge,
  .mobile-dm-item .unread-badge {
    margin-left: auto;
    background: var(--brand);
    color: var(--on-brand);
    font-size: 11px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0 6px;
  }

  .mobile-dm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    text-decoration: none;
    color: var(--text);
    font-size: 15px;
  }
  .mobile-dm-item .dm-avatar-wrap .dm-dot {
    position: absolute;
    bottom: -1px; right: -1px;
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    background: #9ba0a6;
  }
  .mobile-dm-item .dm-dot.online { background: #1D9E75; }
  .mobile-dm-item .dm-dot.away { background: #faa61a; }
  .mobile-dm-item .dm-dot.busy { background: #ed4245; }
  .mobile-dm-item .you-label { color: var(--text-muted); font-size: 13px; font-weight: 400; }

  .mobile-add-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
  }
  .mh-empty {
    padding: 14px 0;
    color: var(--text-muted);
    font-size: 13px;
  }
}

/* ---------- Mobile Home dashboard (feat/mobile-focused-nav) ---------- */
/* 2×2 stat tiles + collapsible by-client list. Reuses existing surface,
   border and text-muted tokens — no new colours. Status dots use the same
   green / amber / red palette already in use elsewhere (DM presence dots,
   priority chips). */
@media (max-width: 768px) {
  .mh-body { padding-bottom: 24px; }

  .mh-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px 16px 4px;
  }
  /* FRG-213 — the tiles are buttons now, and shorter.
   *
   * Four tiles at 105px tall took 237px — over a quarter of the screen — to
   * show four numbers, which pushed the By client list, the actual content of
   * this screen, almost entirely below the fold. Putting the icon on the same
   * line as the label instead of on its own row reclaims a row of height per
   * tile without shrinking the numbers, which are the point. */
  .mh-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "value icon"
      "label label";
    align-items: center;
    gap: 2px 8px;
    min-height: 72px;
    /* Button reset — these were <div>s. */
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mh-stat:active { background: var(--surface-alt); }
  .mh-stat-value { grid-area: value; }
  .mh-stat-label { grid-area: label; }
  .mh-stat-icon {
    grid-area: icon;
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
  }
  .mh-stat-icon [data-lucide] { width: 18px; height: 18px; }
  .mh-stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    margin-top: 2px;
  }
  .mh-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
  }
  .mh-stat-warning .mh-stat-icon { color: var(--warn-text); }
  .mh-stat-warning .mh-stat-value { color: var(--warn-text); }
  .mh-stat-danger  .mh-stat-icon { color: var(--danger-text); }
  .mh-stat-danger  .mh-stat-value { color: var(--danger-text); }

  .mh-clients { padding: 14px 16px 0; }
  .mh-clients-heading {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 6px 4px 8px;
  }
  .mh-client {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 10px;
  }
  .mh-client-head {
    width: 100%;
    background: none;
    border: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    cursor: pointer;
    font: inherit;
    text-align: left;
  }
  .mh-client-chev {
    display: inline-flex;
    color: var(--text-muted);
    transition: transform 0.2s;
  }
  .mh-client-chev [data-lucide] { width: 16px; height: 16px; }
  .mh-client.collapsed .mh-client-chev { transform: rotate(-90deg); }
  .mh-client-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mh-client-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .mh-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.4;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
  }
  .mh-pill-red { background: rgba(239, 68, 68, 0.18); color: var(--danger-text); }
  .mh-pill-amber { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
  .mh-pill-count { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

  .mh-client-body {
    border-top: 0.5px solid var(--border);
    padding: 4px 0;
  }
  .mh-client.collapsed .mh-client-body { display: none; }
  /* FRG-211 — now a <button> that opens the project board, so it needs the
     button chrome reset and a full-width thumb target. */
  .mh-project {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text);
    width: 100%;
    min-height: 44px;
    background: none;
    border: none;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
  }
  .mh-project:active { background: var(--surface-alt); }
  .mh-project + .mh-project { border-top: 0.5px solid var(--border); }
  .mh-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
  }
  /* FRG-211 — these three were hardcoded hexes that never changed between
     themes; the amber in particular sat badly on the light surface. The
     status tokens carry a per-theme value, which is the whole point of them. */
  .mh-dot-green { background: var(--success); }
  .mh-dot-amber { background: var(--warning); }
  .mh-dot-red   { background: var(--danger); }
  .mh-project-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mh-project-ws {
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 7px;
    border-radius: 999px;
    /* FRG-211 — was rgba(255,255,255,0.06): a white veil that reads as a
       subtle chip on the dark theme and is invisible on the light one. */
    background: var(--surface-alt);
    flex-shrink: 0;
  }
}

/* ---------- Bottom nav: Slack 5-tab style ---------- */
/* iOS safe area (Pieter's iPhone, 2026-10-29). Every box is border-box, so a
   fixed height with the inset as padding does not GROW by the inset — it is
   eaten from inside. The bar stayed 56px, its 34px home-indicator padding left
   17px for icon + label, and the labels spilled into the home indicator; the
   header did the same with the notch and pushed the logo 31px below itself.
   Android reports no inset, which is why it never showed there. The rule:
   a bar that pads by an inset has its height ADD that inset. These two are
   the heights everything else on a phone measures itself against. */
@media (max-width: 768px) {
  :root {
    --mob-header-h: calc(68px + env(safe-area-inset-top, 0px));
    --mob-nav-h: calc(56px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 768px) {
  forge-bottom-nav { display: block; }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--mob-nav-h);
    background: var(--surface) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }
  .bottom-nav .tab.active { color: var(--text); }
  .bottom-nav .tab.active .icon {
    background: var(--brand-faint);
    border-radius: 14px;
    padding: 3px 14px;
  }
  .bottom-nav .tab .icon {
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.15s;
  }
  .bottom-nav .tab [data-lucide] {
    width: 22px; height: 22px;
  }
}

/* ---------- More menu ---------- */
forge-more-menu { display: block; min-height: 100vh; background: var(--bg, var(--surface)); }
.more-menu {
  padding: 16px 16px 80px;
  padding-top: max(16px, env(safe-area-inset-top));
  max-width: 720px;
  margin: 0 auto;
}
.more-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 6px 18px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 14px;
}
.more-header img { width: 48px; height: 48px; border-radius: 12px; }
.more-header strong { font-size: 18px; display: block; font-weight: 700; }
.more-header span { font-size: 13px; color: var(--text-muted); }
.more-section {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-bottom: 0.5px solid var(--border);
}
.more-section .more-item:last-child { border-bottom: none; }
.more-item:active { background: var(--surface-alt); }
.more-item [data-lucide] { color: var(--text-muted); }
.more-item.logout { color: var(--danger-text); }
.more-item.logout [data-lucide] { color: var(--danger-text); }

/* ---------- Search view ---------- */
forge-search-view { display: block; min-height: 100vh; background: var(--surface); }
.search-view { padding-bottom: 80px; max-width: 720px; margin: 0 auto; }
.sv-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255,255,255,0.9);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 0.5px solid var(--border);
}
[data-theme="dark"] .sv-head { background: rgba(26,27,35,0.9); }
.sv-back {
  background: none; border: none; padding: 6px;
  border-radius: 8px; cursor: pointer; color: var(--text);
}
.sv-input-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
}
.sv-input-wrap [data-lucide] { color: var(--text-muted); flex-shrink: 0; }
.sv-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  min-width: 0;
}
.sv-clear {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  min-width: 32px; min-height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sv-body { padding: 12px 16px; }
.sv-body h5 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin: 14px 0 6px;
  font-weight: 700;
}
.sv-body .sv-row,
.sv-body .sv-recent {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 8px;
  color: var(--text);
  background: none; border: none;
  text-decoration: none;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
}
.sv-body .sv-row:active,
.sv-body .sv-recent:active { background: var(--surface-alt); }
.sv-body .sv-sub {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
}
.sv-body .sv-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; color: var(--text-muted); font-weight: 600;
}
.sv-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- In-chat WhatsApp-style input ---------- */
@media (max-width: 768px) {
  body.in-chat .chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 0.5px solid var(--border);
  }
  body.in-chat .chat-input-wrap textarea {
    flex: 1;
    background: var(--surface-alt) !important;
    border: 1px solid var(--border) !important;
    border-radius: 22px !important;
    padding: 10px 16px !important;
    font-size: 16px !important;
    color: var(--text);
    resize: none;
    max-height: 120px;
    min-height: 40px;
    outline: none;
  }
}

/* ---------- Desktop: hide all mobile-only elements ---------- */
@media (min-width: 769px) {
  forge-mobile-home,
  forge-bottom-nav,
  .fab,
  .sidebar-backdrop,
  forge-more-menu,
  forge-search-view { display: none !important; }
}

/* FRG-212 — the header icon cluster is back on mobile.
 *
 * This block used to be `.header .desktop-only-btns { display: none }`, whose
 * comment pointed at "the bottom nav / More menu instead". The bottom nav has
 * five tabs and none of them is notifications, and the More menu no longer
 * exists — so the bell was not relocated, it was removed. Notifications are
 * one of the six things a phone is actually for; going looking for the bell
 * and finding nothing is the exact failure we are trying to stop.
 *
 * Fitting it is the real problem: hamburger, breadcrumb, three view-toggle
 * segments, bell, activity and New all want a 390px bar, and at 44px each
 * that does not close. So the bar becomes two rows rather than dropping
 * controls — the identity row (hamburger + where you are) and the action row
 * (view switch + the icon cluster). No markup change; .right simply claims a
 * full line of its own and the header wraps.
 */
@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    row-gap: 4px;
    height: auto;
    align-items: center;
  }
  /* Row 1: hamburger + breadcrumb, with the crumb free to ellipsis. */
  .header .crumbs { flex: 1 1 auto; min-width: 0; }
  /* Row 2: everything actionable, spread across the full width. */
  .header .right {
    flex: 1 0 100%;
    gap: 4px;
    justify-content: flex-start;
  }
  .header .desktop-only-btns {
    display: inline-flex; align-items: center; gap: 4px;
    /* Sits hard right, after the view switcher. */
    margin-left: auto;
  }
  /* The bell and the activity button are icon-only here and need targets. */
  .header .desktop-only-btns > button,
  .header .desktop-only-btns forge-notifications > button {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
}

/* SoW form styles */
.sow-label { color: var(--text-muted, #8a8b94); font-size: 12px; margin-bottom: 4px; text-transform: capitalize; }
.sow-val { color: var(--text, #fff); font-size: 13px; }
.sow-input { width: 100%; padding: 8px 10px; background: var(--bg, #24252f); color: var(--text, #fff); border: 1px solid var(--border, #2a2b36); border-radius: 6px; font-size: 13px; box-sizing: border-box; }
.sow-ta { resize: vertical; font-family: inherit; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* UI-QW5 (2026-09-28) — 12px is the text floor (design language §2.4). The
   ticket-id family, card meta, list chips/headers, link chips and the stage
   badges below were 9.5–11px; all raised to 12px. */
/* FRG-037 — ticket-id styling. Consistent mono font + accent colour across
   every surface (task card, list cell, timeline label, sidebar row, modal). */
.ticket-id,
.ticket-id-cell,
.ticket-id-inline {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--text-muted, #8a8b94);
  font-weight: 600;
  user-select: all;
}
.ticket-id { margin-bottom: 4px; }
.ticket-id-cell { font-size: 12px; }
.ticket-id-inline {
  background: var(--bg, #24252f);
  border: 1px solid var(--border, #2a2b36);
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
/* Modal header pill — bigger, clickable, with a copy affordance. */
.ticket-pill {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  font-size: 12px;
  letter-spacing: 0.6px;
  font-weight: 700;
  background: var(--bg, #24252f);
  color: var(--text, #fff);
  border: 1px solid var(--border, #2a2b36);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  transition: background 0.12s, border-color 0.12s;
}
.ticket-pill:hover { background: var(--surface, #1e1f2a); border-color: var(--brand); }
.ticket-pill-copy { color: var(--text-muted, #8a8b94); font-size: 11px; }
.ticket-pill:hover .ticket-pill-copy { color: var(--brand-text); }

/* ═══════════════════════════════════════════════════════════════════
   File preview lightbox
   ───────────────────────────────────────────────────────────────────
   Full-viewport dark backdrop. Used by <forge-file-preview> for
   images, PDFs (via PDF.js canvas), text, and download fallback.
   All colours pull from existing tokens; no new palette.
   ═══════════════════════════════════════════════════════════════════ */
.forge-lightbox {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10, 11, 16, 0.85);
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: forge-fade-in 0.15s ease-out;
}
.lightbox-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}
.lightbox-meta { flex: 1; min-width: 0; }
.lightbox-filename {
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #fff;
}
.lightbox-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lightbox-actions {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.lightbox-counter {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
}
.lightbox-zoom-badge {
  font-size: 11px; font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  min-width: 44px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.lightbox-header button {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.88);
  min-width: 36px; min-height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px;
  border-radius: 6px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.lightbox-header button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
.lightbox-header button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.lightbox-header button svg, .lightbox-header button i {
  width: 16px; height: 16px;
}

.lightbox-body {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: auto;
  padding: 24px;
}
.lightbox-viewport {
  position: relative;
  max-width: 100%; max-height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  user-select: none;
}
/* 2026-10-22 — the player fits the window. It had no size of its own, so a
 * 720p video in an 800x600 window ran off the bottom and took its controls
 * (the scrubber) with it. The grid row may not grow past the window either. */
.lightbox-body { min-height: 0; }
.lightbox-audio {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: min(560px, 100%); color: #fff;
}
.lightbox-audio-player { width: 100%; }
.lightbox-video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
}
.lightbox-image {
  max-width: 100%; max-height: 100%;
  display: block;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-pdf-canvas {
  /* Drawn at its own size (file-preview.js renderPdfPages): no max-width,
     or a zoomed page would be squeezed back instead of scrolling. */
  flex: none;
  background: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
/* 2026-10-04 — the PDF is a column of pages that SCROLLS, at any zoom. It
   fills the body itself: the body centres its content, which made anything
   above the fold unreachable. `safe center` keeps a page wider than the
   column scrollable from its left edge rather than spilling off both sides. */
.lightbox-pdf-scroll {
  position: absolute; inset: 0;
  overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 16px;
}
.lightbox-pdf-scroll:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.lightbox-pdf-pages {
  display: flex; flex-direction: column; align-items: safe center; gap: 16px;
  min-width: min-content;
}
.lightbox-text {
  max-width: 90vw; max-height: 80vh;
  overflow: auto;
  margin: 0;
  background: var(--surface, #22232d);
  color: var(--text, #e4e4e8);
  padding: 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

/* Nav arrows (prev/next between files) */
.lightbox-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  min-width: 44px; min-height: 44px;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  z-index: 2;
  transition: background 0.12s, color 0.12s, transform 0.12s;
}
.lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  transform: translateY(-50%) scale(1.05);
}
.lightbox-nav:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.lightbox-nav-prev { left: 20px; }
.lightbox-nav-next { right: 20px; }
.lightbox-nav svg, .lightbox-nav i { width: 22px; height: 22px; }

/* Footer bar used for PDF paging */
.lightbox-pdf-bar {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.lightbox-pdf-bar button {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.85);
  min-width: 36px; min-height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.lightbox-pdf-bar button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.lightbox-pdf-bar svg, .lightbox-pdf-bar i { width: 16px; height: 16px; }

/* Loading / error / non-previewable fallback */
.lightbox-loading,
.lightbox-error,
.lightbox-fallback {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  gap: 12px;
}
.lightbox-progress { font-size: 12px; opacity: 0.7; font-variant-numeric: tabular-nums; }
.lightbox-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: forge-spin 0.8s linear infinite;
}
.lightbox-error-icon,
.lightbox-fallback-icon {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.lightbox-error-icon svg, .lightbox-error-icon i { width: 28px; height: 28px; color: var(--warn-text); }
.lightbox-fallback-icon svg, .lightbox-fallback-icon i { width: 28px; height: 28px; color: rgba(255, 255, 255, 0.75); }
.lightbox-error-title,
.lightbox-fallback-name {
  font-size: 15px; font-weight: 600; color: #fff;
  max-width: 70vw; overflow-wrap: anywhere;
}
.lightbox-error-message,
.lightbox-fallback-meta,
.lightbox-fallback-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
.lightbox-download-instead {
  margin-top: 8px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand);
  color: var(--on-brand);
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  min-height: 40px;
}
.lightbox-download-instead:hover { background: var(--brand-hover); }
.lightbox-download-instead:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lightbox-download-instead svg, .lightbox-download-instead i { width: 16px; height: 16px; }

/* Mobile: controls reachable by thumb; full-viewport media */
@media (max-width: 720px) {
  .lightbox-header {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .lightbox-meta { order: 1; flex-basis: 100%; }
  .lightbox-actions { order: 2; flex-basis: 100%; justify-content: flex-end; }
  .lightbox-body { padding: 8px; }
  .lightbox-nav {
    bottom: 76px; top: auto; transform: none;
    width: 48px; height: 48px; min-width: 48px; min-height: 48px;
  }
  .lightbox-nav-prev { left: 12px; }
  .lightbox-nav-next { right: 12px; }
  .lightbox-nav:hover { transform: scale(1.05); }
  .lightbox-counter { order: 3; flex-basis: auto; }
  .lightbox-zoom-badge { display: none; }
}

/* ──────────────────────────────────────────────────────────────────────
   Attachment Preview button
   ──────────────────────────────────────────────────────────────────────
   Emitted by renderPreviewButton() in file-preview.js. Appears in task
   modal attachment chips, the Files/Drive table, and SoW brand-guide
   zones — anywhere a previewable file needs a discoverable affordance.

   Subtle text-button styling: brand-coloured icon + label, no fill at
   rest, faint brand tint on hover. The min-height of 32px meets the
   desktop hitbox rule; on narrow viewports we bump it to 44px so a
   thumb can reach it reliably (WCAG 2.5.8).

   The flexbox layout keeps the icon + label aligned even when the
   filename beside it wraps or truncates.
*/
button.attachment-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--brand-text);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 32px;
  line-height: 1;
  white-space: nowrap;
  /* Sits inside a flex row next to a shrinking filename — must never
     compress or wrap its own label. */
  flex-shrink: 0;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
button.attachment-preview-btn:hover {
  color: var(--brand-hover);
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border-color: color-mix(in srgb, var(--brand) 25%, transparent);
}
button.attachment-preview-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
button.attachment-preview-btn:active {
  background: color-mix(in srgb, var(--brand) 16%, transparent);
}
button.attachment-preview-btn svg,
button.attachment-preview-btn i[data-lucide] {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Mobile: bigger hitbox so a thumb can actually land on it. */
@media (max-width: 720px) {
  button.attachment-preview-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 6px 10px;
    font-size: 13px;
    gap: 6px;
  }
  button.attachment-preview-btn svg,
  button.attachment-preview-btn i[data-lucide] {
    width: 16px;
    height: 16px;
  }
}

/* ===================================================================
 * feat/mobile-focused-nav — second pass (top bar + screen fixes)
 *
 * Scope is strictly @media (max-width: 768px). All rules reuse existing
 * tokens (--surface, --border, --text, --text-muted, --brand). Desktop
 * is not touched anywhere in this block.
 * =================================================================== */

/* ---- (A) Focused mobile top bar — one shape for Chat / Today / Schedule
   / Settings. Reuses .header height/background so the four screens feel
   like one family. Renders inside <forge-header> for Chat/Today/Schedule,
   and inline at the top of <forge-settings> for Settings. ---- */
.header.header-focused-mobile {
  display: none; /* hidden on desktop — only the @media block below shows it */
}
@media (max-width: 768px) {
  .header.header-focused-mobile {
    display: flex;
    align-items: center;
    /* FRG-211 — gap for the hamburger that now sits before the title. */
    gap: 6px;
    /* FRG-220 — 56 -> 68, because for a wordmark the bar's HEIGHT is what
       caps its width. The logo is 3:1, so every extra pixel of bar height
       buys three of legible logo: at a 40px mark it rendered 108px wide and
       its lettering was at one-ninth scale; at 52px it renders about 156px,
       comparable to the page title beside it. 68px is a chunky phone header
       but it is the number that makes the mark readable, and the bell's 44px
       target has more room than it did. Plus the notch: see --mob-header-h. */
    height: var(--mob-header-h);
    /* FRG-215 — back to an even gutter now the hamburger has gone; the
       right side keeps 8px so the bell's 44px box centres on the 16px line. */
    padding: 0 8px 0 16px;
    padding-top: env(safe-area-inset-top);
    background: var(--surface);
    border-bottom: 0.5px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
  }
  /* FRG-215 — the bell sits at the right of the focused bar; the hamburger
     is gone (the bottom nav is the whole of mobile navigation now). */
  .header.header-focused-mobile forge-notifications {
    margin-left: auto;
    flex: 0 0 auto;
    position: relative;
  }
  .header.header-focused-mobile .notif-bell {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    background: none; border: none; border-radius: 8px;
    color: var(--text); cursor: pointer;
  }
  .header.header-focused-mobile .notif-bell:active { background: var(--surface-alt); }
  .focused-mobile-title {
    margin: 0;
    /* The title must be free to ellipsis rather than shove the hamburger
       off the bar — the same min-width:0 story as the task modal header. */
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
  }
}

/* ---- (D) Chat list — collapsible Channels + Direct messages sections.
   The wrapper class is .chat-section (renders on every viewport). On
   desktop it visually matches the old <h5> heading — just with a small
   chevron — so chat sidebar layout doesn't shift. On any viewport when
   collapsed, the body is hidden. ---- */
.chat-list .chat-section { margin-top: 4px; }
.chat-list .chat-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
}
.chat-list .chat-section-chev {
  display: inline-flex;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.chat-list .chat-section-chev [data-lucide] { width: 14px; height: 14px; }
.chat-list .chat-section.collapsed .chat-section-chev { transform: rotate(-90deg); }
.chat-list .chat-section-title { flex: 1; }
.chat-list .chat-section-add {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.chat-list .chat-section-add:hover {
  background: var(--border);
  color: var(--text);
}
.chat-list .chat-section.collapsed .chat-section-body { display: none; }
.chat-list .chat-empty-note { color: var(--text-muted); font-size: 12px; padding: 6px 14px; }

/* ── "Chats - add P.A to chats" — the pinned personal assistant ────── */
/* Sits directly under the search bar and above the Channels section. Pinned
   rather than listed: it is the one agent that belongs to this user. */
.chat-pa-wrap { position: relative; display: flex; align-items: center; margin: 4px 8px 8px; }
.chat-pa {
  display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left;
  background: var(--brand-faint); border: 1px solid var(--brand-soft); color: var(--text);
}
.chat-pa:hover { background: var(--brand-subtle); }
.chat-pa.active { background: var(--brand-subtle); border-color: var(--brand); }
.chat-pa-setup {
  width: calc(100% - 16px); margin: 4px 8px 8px;
  background: none; border: 1px dashed var(--border); color: var(--text-muted);
}
.chat-pa-setup:hover { border-color: var(--brand); color: var(--brand-text); background: var(--brand-faint); }
.chat-pa-avatar {
  position: relative; flex: 0 0 auto; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
}
.chat-pa-info { flex: 1 1 auto; min-width: 0; }
.chat-pa-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-pa-setup .chat-pa-name { color: inherit; }
.chat-pa-sub {
  font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-pa-edit {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: none; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; border-radius: 5px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
}
.chat-pa-wrap:hover .chat-pa-edit, .chat-pa-wrap:focus-within .chat-pa-edit { display: flex; }
.chat-pa-edit:hover { color: var(--text); border-color: var(--brand); }

.pa-modal { width: 400px; }
.pa-icons { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
/* 2026-10-15 — the assistant's personality: four choices, each with its hint. */
.pa-personalities { display: grid; gap: 6px; }
.pa-personality {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px;
}
.pa-personality:has(input:checked) { border-color: var(--brand); }
.pa-personality input { margin-top: 3px; flex: none; }
.pa-personality-text { display: grid; gap: 2px; min-width: 0; }
.pa-personality-name { font-weight: 600; font-size: 13px; }
.pa-personality-hint { font-size: 12px; color: var(--text-muted); }
.pa-icon {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.pa-icon:hover { color: var(--text); border-color: var(--brand-soft); }
.pa-icon.on { background: var(--brand-subtle); border-color: var(--brand); color: var(--brand-text); }

/* ---- (E) Chat input bar — fix send-button clip + mobile icon-only. ---- */
/* Render the icon on every viewport but suppress it on desktop; the text
   "Send" carries on the desktop side. */
.chat-input button.send .send-icon { display: none; }
.chat-input button.send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  /* FRG-063 kept the formatting toolbar off mobile because a permanent extra
     row above the composer competes with the soft keyboard — which is right.
     FRG-214 keeps that but stops it meaning "no formatting on a phone": the
     bar is collapsed by default and the #fmt-toggle button in the composer
     opens it, so it costs a row only while you are using it. */
  .chat-format-bar { display: none; }
  .chat-input-wrap.fmt-open .chat-format-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
  }
  .chat-input-wrap.fmt-open .chat-format-bar .fmt-btn {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .chat-format-bar + .chat-input { border-radius: 8px; }
  /* Desktop shows the bar permanently, so the toggle is mobile-only. */
  #fmt-toggle { display: inline-flex; }
  .chat-input-wrap.fmt-open #fmt-toggle { color: var(--brand-text); }

  /* FRG-214 — the composer becomes two rows on a phone.
   *
   * The action buttons were 36px, under the target floor. Widening them to
   * 44px made things worse rather than better: four of them plus a 44px send
   * is 220px of a 360px bar, leaving the textarea 76px — about eight visible
   * characters. Dividing a single row differently does not fix that; there
   * simply is not enough width for five controls and a text field.
   *
   * So the textarea takes a row of its own and the controls sit beneath it.
   * The composer grows by one row, which it can afford (it is pinned to the
   * bottom and the message list flexes above it), and the text field goes
   * from 76px to full width. */
  .chat-input {
    flex-wrap: wrap;
    row-gap: 6px;
    align-items: center;
  }
  .chat-input #chat-ta {
    order: -1;
    flex: 1 1 100%;
    min-width: 0;
    min-height: 44px;
  }
  .chat-input .action-btn {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
  }
  /* Send sits hard right on the control row, furthest from the attachment
     buttons so a mis-tap does not post an unfinished message. */
  .chat-input #send-btn { margin-left: auto !important; }

  /* In the chat conversation input bar, flip the send button to an
     icon-only round button so it fits at 360px no matter how long the
     textarea grows. Targets the actual `#send-btn` id since the legacy
     selectors at line 3085 (`.send-btn` / `[type="submit"]`) don't
     match this DOM. */
  .chat-input #send-btn {
    /* FRG-214 — 40px was under the thumb-target floor on the single most
       pressed control in chat. 44px still fits alongside four action
       buttons and the textarea at 360px. */
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: var(--brand) !important;
    color: var(--on-brand) !important;
    border: none !important;
    flex-shrink: 0 !important;
  }
  .chat-input #send-btn .send-text { display: none; }
  .chat-input #send-btn .send-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .chat-input #send-btn .send-icon [data-lucide] {
    width: 18px;
    height: 18px;
  }
  /* Make the attach + emoji buttons icon-sized too — the inline lucide
     icons need a slightly bigger tap target than the old emoji glyphs. */
  .chat-input #attach-btn,
  .chat-input #emoji-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .chat-input #attach-btn [data-lucide],
  .chat-input #emoji-btn [data-lucide] {
    width: 20px;
    height: 20px;
  }
}

/* ---- (F) Settings — line-icon nav items + mobile footer. ---- */
.settings-nav .item .item-icon {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  vertical-align: -3px;
  color: var(--text-muted);
}
.settings-nav .item .item-icon [data-lucide] {
  width: 18px;
  height: 18px;
}
.settings-nav .item.active .item-icon { color: var(--brand-text); }

/* FAW-138 — an entry you can see but not open. Deliberately reads as
   unavailable rather than broken: dimmed and non-interactive, but still
   legible, because the point is that agent governance is visibly THERE for
   roles that cannot administer it. `cursor: default` rather than
   `not-allowed` — this is not a refusal, it is simply not a control. */
.settings-nav .item-readonly {
  cursor: default;
  opacity: 0.55;
  pointer-events: auto; /* keep the title tooltip reachable */
}
.settings-nav .item-readonly:hover { background: transparent; }

.settings-mobile-footer {
  display: none; /* shown only at <=768px */
}
@media (max-width: 768px) {
  /* feat/mobile-focused-nav — the "← Back to Forge" anchor at the top
     of the settings nav is redundant on mobile: the bottom nav is the
     way out of Settings. Hide it below 768px; desktop is unchanged. */
  .settings-nav .back { display: none !important; }

  .settings-mobile-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
    border-top: 0.5px solid var(--border);
    align-items: center;
  }
  .settings-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
  }
  .settings-logout:hover {
    background: var(--surface);
    border-color: var(--brand);
  }
  .settings-logout [data-lucide] { width: 18px; height: 18px; }
  .settings-version {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
  }
}

/* ============ Teams page (HAT-HVH-0000045/46) ============ */
.teams-page { padding: 24px 28px; max-width: 1100px; }
.teams-page h1 { margin: 0 0 4px; }
.teams-page .subtitle { color: var(--text-muted); font-size: 13px; margin: 0 0 22px; }
.teams-section { margin-bottom: 34px; }
.teams-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.teams-section-head h2 {
  display: flex; align-items: center; gap: 8px;
  margin: 0; font-size: 17px;
}
.agents-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.agent-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 22px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; color: var(--text); font: inherit;
  transition: border-color 0.15s, transform 0.1s;
}
.agent-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.agent-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 2px solid; flex-shrink: 0;
}
.agent-card-name { font-weight: 600; font-size: 14px; }
.agent-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.agent-detail-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
}
.agent-specs {
  white-space: pre-wrap; font-size: 13px; line-height: 1.65; color: var(--text);
}

/* ============ Agent DMs (HAT-HVH-0000047) ============ */
.chat-agents-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 10px 10px 4px;
}
.agent-pill {
  display: inline-block; font-size: 8.5px; font-weight: 700;
  letter-spacing: 0.06em; padding: 1px 5px; border-radius: 4px;
  background: var(--brand); color: var(--on-brand); vertical-align: 1px;
}

/* ============ Ticket Agent task-creation modal (HAT-HVH-0000048) ============ */
.ta-backdrop {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.ta-modal {
  width: 100%; max-width: 560px; max-height: 80vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
}
.ta-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.ta-title { font-weight: 700; font-size: 15px; }
.ta-sub { font-size: 12px; color: var(--text-muted); }
.ta-close { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; padding: 0 4px; }
.ta-messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
.ta-empty { color: var(--text-muted); font-size: 13px; text-align: center; margin: auto; }
.ta-msg {
  max-width: 82%; padding: 8px 12px; border-radius: 10px; font-size: 13px;
  background: var(--surface-2, #2a2b36); align-self: flex-start; white-space: pre-wrap; word-break: break-word;
}
.ta-msg.mine { background: var(--brand); color: var(--on-brand); align-self: flex-end; }
.ta-note { font-size: 11.5px; color: var(--text-muted); padding: 8px 16px; border-top: 1px solid var(--border); }
.ta-note a { color: var(--brand-text); }
.ta-input-row { display: flex; gap: 8px; padding: 10px 16px 14px; align-items: flex-end; }
.ta-input-row textarea {
  flex: 1; resize: none; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg, #16171d); color: var(--text); font: inherit; font-size: 13px;
}
.ta-attach { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 14px; }

/* ============ Column activity indicators (HAT-HVH-0000049) ============ */
.kcol-indicators {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 0;
}
.kcol-activity {
  display: none; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
}
.kcol-activity.active { display: inline-flex; animation: kcol-pulse 1.4s ease-in-out infinite; }
@keyframes kcol-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.65; }
}
.kcol-light {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}
.kcol-light.green { background: #3fb26f; color: #3fb26f; }
.kcol-light.yellow { background: #d6a52e; color: #d6a52e; }
.kcol-light.red { background: #d64545; color: #d64545; }
.kcol-gauge {
  flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2, #2a2b36);
  position: relative; overflow: visible; min-width: 40px;
}
.kcol-gauge-fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width 0.4s ease; }
.kcol-gauge-pct { font-size: 12px; color: var(--text-muted); margin-left: 6px; }

/* ============ Reports section (HAT-HVH-0000050) ============ */
.reports-page { padding: 24px 28px; max-width: 900px; }
.reports-head h1 { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; }
.reports-head .subtitle { color: var(--text-muted); font-size: 13px; margin: 0 0 22px; }
.reports-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 48px 20px;
  border: 1px dashed var(--border); border-radius: 12px; color: var(--text);
}
.reports-empty-icon { color: var(--text-muted); margin-bottom: 6px; }
.reports-list { display: flex; flex-direction: column; gap: 10px; }
.report-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
}
.report-icon { color: var(--brand-text); flex-shrink: 0; }
.report-info { flex: 1; min-width: 0; }
.report-title { font-weight: 600; font-size: 14px; }
.report-summary { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.report-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* The agent voice-call overlay's styles lived here. The component was
 * deleted in MTG-61 — calling an agent opens the ordinary call stage — so
 * these had nothing left to style. Removed rather than left behind: dead CSS
 * for a deleted component is how a resurrected old path finds itself looking
 * correct. */

/* ── FAW-034/035 — acceptance criteria checklist + card indicator ───── */

.criteria-field label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.criteria-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.criterion-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.criterion-row:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.03));
  border-color: var(--border);
}

.criterion-status {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  margin-top: 1px;
  display: flex;
}

.criterion-main { flex: 1; min-width: 0; }

.criterion-statement {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}
/* A settled criterion recedes; the outstanding ones are what you scan for. */
.criterion-row[data-status="passed"] .criterion-statement,
.criterion-row[data-status="waived"] .criterion-statement {
  color: var(--text-muted);
}
.criterion-row[data-status="failed"] .criterion-statement { color: var(--text); }

.criterion-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
}

.criterion-level {
  background: var(--bg-input, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  cursor: pointer;
}

.criterion-spec,
.criterion-version,
.criterion-decompose,
.criterion-evidence {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
}
.criterion-spec-add {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-muted);
  cursor: pointer;
}
.criterion-evidence { color: var(--brand-text); text-decoration: none; }
.criterion-evidence:hover { text-decoration: underline; }
.criterion-decompose { color: var(--warning, #d29922); }
.criterion-version { opacity: 0.7; }
.criterion-status-label { font-weight: 600; font-size: 10px; }

.criterion-waived-reason {
  margin-top: 3px;
  font-size: 11px;
  font-style: italic;
  color: var(--text-muted);
}

.criterion-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0;
}
.criterion-row:hover .criterion-del { opacity: 1; }
.criterion-del:hover { color: var(--danger-text); }

.criteria-empty {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.criteria-add { display: flex; gap: 6px; margin-top: 8px; }
.criterion-input {
  flex: 1;
  background: var(--bg-input, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 6px 9px;
}
.criterion-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 6px 10px;
}
.criterion-add-btn:hover { color: var(--text); border-color: var(--brand); }

/* ── FAW-088b — lint findings on the ticket detail view ────────────────
   Deliberately plain, and deliberately a sibling of the criteria checklist
   rather than its own visual language: FAW-082's findings panel is still
   waiting on a wireframe, and this should be cheap to replace when it lands. */

.findings-field label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.findings-schema {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
  opacity: 0.8;
}

.findings-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.findings-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.findings-sha {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  opacity: 0.8;
}

.findings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.finding-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.finding-row:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.03));
  border-color: var(--border);
}

.finding-severity { line-height: 1; margin-top: 1px; display: flex; }

.finding-main { flex: 1; min-width: 0; }

.finding-message {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

.finding-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
}

.finding-rule {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
}
.finding-category { font-size: 10px; opacity: 0.85; }
.finding-severity-label { font-weight: 600; font-size: 10px; }
.finding-location {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 10px;
  word-break: break-all;
}

.finding-remediation {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-top: 3px;
  font-size: 11px;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.45;
}

.findings-empty {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

/* Progress indicator — shared by the checklist header and the board card. */
.criteria-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.criteria-progress-bar {
  width: 46px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.criteria-progress-fill { height: 100%; border-radius: 2px; transition: width 0.2s ease; }
.criteria-progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

forge-task-card .criteria-progress { margin-top: 6px; }

/* ── WS4 — verdict evidence viewer + L3 transcript ─────────────────── */

.gate-status { display:flex; flex-direction:column; gap:6px; font-size:12px; padding:8px 10px; border-radius:6px; margin:8px 0; }
.gate-status.ok { color: var(--success-text); background: rgba(63,185,80,.08); }
.gate-status.blocked { color: var(--danger-text); background: rgba(248,81,73,.08); }
.gate-blocking { margin:0; padding-left:18px; color: var(--text-muted); }
.gate-blocking em { color: var(--danger-text); font-style: normal; font-size: 10px; text-transform: uppercase; }

.verdict { border:1px solid var(--border); border-radius:6px; padding:8px 10px; margin:6px 0; }
.verdict.is-stale, .verdict.is-superseded { opacity:.65; }
.verdict-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:11px; color:var(--text-muted); }
.verdict-level { font-weight:700; font-size:10px; padding:1px 5px; border:1px solid var(--border); border-radius:3px; }
.verdict-result { display:inline-flex; align-items:center; gap:4px; font-weight:600; }
.verdict-build { font-family: ui-monospace, monospace; }
.verdict-banner { display:flex; align-items:center; gap:6px; font-size:11px; padding:5px 8px; border-radius:4px; margin-top:6px; }
.verdict-stale { color: var(--warning, #d29922); background: rgba(210,153,34,.1); }
.verdict-superseded { color: var(--text-muted); background: rgba(255,255,255,.03); }
.verdict-justification { font-size:12px; line-height:1.5; margin-top:6px; }
.verdict-criterion { font-size:11px; color:var(--text-muted); margin-top:4px; }

.evidence-list { list-style:none; margin:8px 0 0; padding:0; display:flex; flex-direction:column; gap:6px; }
.evidence-artefact { border:1px solid var(--border); border-radius:5px; overflow:hidden; }
.evidence-artefact-head { display:flex; align-items:center; gap:5px; font-size:10px; font-weight:600;
  text-transform:uppercase; letter-spacing:.03em; color:var(--text-muted);
  padding:4px 8px; background:rgba(255,255,255,.03); }
.evidence-time { margin-left:auto; font-weight:400; text-transform:none; letter-spacing:0; }
.evidence-artefact-body { padding:8px; }
.evidence-screenshot { max-width:100%; border-radius:4px; display:block; }
.evidence-kv { width:100%; font-size:11px; border-collapse:collapse; }
.evidence-kv th { text-align:left; color:var(--text-muted); font-weight:600; padding:2px 8px 2px 0; vertical-align:top; white-space:nowrap; }
.evidence-kv td { padding:2px 0; word-break:break-all; }
.evidence-pre { margin:0; font-size:11px; max-height:220px; overflow:auto; white-space:pre-wrap; word-break:break-word; }
.evidence-link { font-size:11px; color:var(--brand-text); text-decoration:none; display:inline-flex; align-items:center; gap:4px; }
.evidence-missing { font-size:11px; color:var(--danger-text); }

.l3-transcript { border:1px solid var(--border); border-radius:6px; margin:8px 0; }
.l3-transcript-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:11px;
  color:var(--text-muted); padding:6px 10px; background:rgba(255,255,255,.03); }
.l3-budget.over { color: var(--danger-text); font-weight:700; }
.l3-status { margin-left:auto; text-transform:capitalize; }
.l3-status-completed { color: var(--success-text); }
.l3-status-budget_exceeded, .l3-status-failed { color: var(--danger-text); }
.l3-steps { margin:0; padding:6px 10px 8px 28px; font-size:11px; max-height:280px; overflow:auto; }
.l3-step { padding:2px 0; color:var(--text-muted); }
.l3-step.failed { color: var(--danger-text); }
.l3-step-action { color:var(--text); font-weight:600; }
.l3-step-target { font-size:10px; }
.l3-step-url { opacity:.7; margin-left:6px; }
.l3-step-seq { display:none; }

/* ── WS7 — escalation queue ────────────────────────────────────────── */
.esc-wrap { display:flex; gap:16px; align-items:flex-start; padding:16px; }
.esc-list-pane { flex:1; min-width:0; }
.esc-detail-pane { width:420px; flex-shrink:0; border:1px solid var(--border); border-radius:8px; padding:14px; }
.esc-head h2 { display:flex; align-items:center; gap:8px; font-size:16px; margin:0 0 8px; }
.esc-summary { display:flex; gap:14px; flex-wrap:wrap; font-size:12px; color:var(--text-muted); margin-bottom:8px; }
.esc-sev-count i { display:inline-block; width:8px; height:8px; border-radius:2px; margin-right:4px; }
.esc-filters { display:flex; gap:14px; font-size:12px; color:var(--text-muted); margin-bottom:10px; }
.esc-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; }
.esc-row { display:flex; align-items:flex-start; gap:10px; padding:10px; border:1px solid var(--border);
  border-radius:6px; cursor:pointer; }
.esc-row:hover { border-color:var(--brand); }
.esc-row.is-breached { border-left:3px solid var(--danger, #f85149); }
.esc-sev { width:6px; align-self:stretch; border-radius:3px; flex-shrink:0; }
.esc-main { flex:1; min-width:0; }
.esc-q { font-size:13px; line-height:1.45; }
.esc-meta { display:flex; gap:10px; flex-wrap:wrap; margin-top:4px; font-size:11px; color:var(--text-muted); align-items:center; }
.esc-code { font-size:10px; font-weight:700; padding:1px 5px; border:1px solid var(--border); border-radius:3px; }
.esc-unowned { color:var(--warning, #d29922); }
.esc-breached { color:var(--danger-text); font-weight:600; }
.esc-claim { background:transparent; border:1px solid var(--border); border-radius:5px; color:var(--text-muted);
  font-size:11px; padding:4px 9px; cursor:pointer; }
.esc-claim:hover { border-color:var(--brand); color:var(--text); }
.esc-assignee { font-size:11px; color:var(--text-muted); }
.esc-empty { display:flex; align-items:center; gap:8px; padding:24px; color:var(--text-muted); font-size:13px;
  border:1px dashed var(--border); border-radius:8px; }
.esc-detail-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:11px; }
.esc-sev-pill { color:#fff; font-size:10px; font-weight:700; padding:2px 7px; border-radius:10px; }
.esc-meaning { color:var(--text-muted); flex:1; }
.esc-close { background:none; border:none; color:var(--text-muted); font-size:18px; cursor:pointer; line-height:1; }
.esc-question { font-size:15px; line-height:1.5; margin:12px 0; }
.esc-facts { display:grid; grid-template-columns:1fr 1fr; gap:8px 14px; font-size:12px; margin-bottom:12px; }
.esc-facts label { display:block; font-size:10px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); }
.esc-context pre, .esc-history { font-size:11px; }
.esc-context pre { max-height:180px; overflow:auto; white-space:pre-wrap; word-break:break-word; }
.esc-resolve label { display:block; font-size:11px; color:var(--text-muted); margin-bottom:4px; }
.esc-resolution { width:100%; background:var(--bg-input, rgba(255,255,255,.04)); border:1px solid var(--border);
  border-radius:6px; color:var(--text); font-size:12px; padding:8px; }
.esc-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.esc-actions button { background:var(--brand); border:none; border-radius:6px; color: var(--on-brand); font-size:12px;
  padding:7px 11px; cursor:pointer; }
.esc-actions button.secondary { background:transparent; border:1px solid var(--border); color:var(--text-muted); }
.esc-resolved { border-left:3px solid var(--success, #3fb950); padding-left:10px; font-size:12px; }
.esc-resumed { color:var(--success-text); }
.esc-history ol { padding-left:16px; }
.esc-history span { color:var(--text-muted); }

/* ── FRG-070 — relay control loop switch ───────────────────────────── */
.relay-loop-card { display:flex; align-items:center; gap:16px; flex-wrap:wrap;
  border:1px solid var(--border); border-left:3px solid var(--text-muted);
  border-radius:8px; padding:12px 14px; margin:12px 0 18px; }
.relay-loop-card.is-on { border-left-color: var(--success, #3fb950); }
.relay-loop-main { flex:1; min-width:240px; }
.relay-loop-title { display:flex; align-items:center; gap:8px; font-size:13px; }
.relay-loop-state { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em;
  padding:2px 7px; border-radius:10px; background:rgba(255,255,255,.06); color:var(--text-muted); }
.relay-loop-card.is-on .relay-loop-state { background:rgba(63,185,80,.15); color:var(--success-text); }
.relay-loop-help { font-size:11px; color:var(--text-muted); margin:5px 0 0; line-height:1.5; }
.relay-loop-actions { display:flex; align-items:center; gap:10px; }
.relay-loop-interval { font-size:11px; color:var(--text-muted); display:flex; align-items:center; gap:5px; }
.relay-loop-interval input { width:56px; background:var(--bg-input, rgba(255,255,255,.04));
  border:1px solid var(--border); border-radius:5px; color:var(--text); font-size:12px; padding:4px 6px; }

/* ── WS6 — performance dashboard ───────────────────────────────────── */
.perf-page { padding:16px; display:flex; flex-direction:column; gap:16px; }
.perf-head { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.perf-crumbs { display:flex; align-items:center; gap:6px; font-size:13px; }
.perf-crumbs button { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:13px; padding:2px 4px; }
.perf-crumbs button.active { color:var(--text); font-weight:600; }
.perf-breach-count { color:var(--danger-text); font-size:12px; display:inline-flex; align-items:center; gap:5px; }
.perf-filters { display:flex; gap:6px; margin-left:auto; flex-wrap:wrap; }
.perf-filters input { background:var(--bg-input,rgba(255,255,255,.04)); border:1px solid var(--border);
  border-radius:5px; color:var(--text); font-size:11px; padding:5px 8px; width:120px; }
.perf-filters button { background:var(--brand); border:none; border-radius:5px; color: var(--on-brand); font-size:11px;
  padding:5px 12px; cursor:pointer; }

.perf-tiles { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:10px; }
.perf-tile { display:flex; flex-direction:column; gap:3px; align-items:flex-start; text-align:left;
  background:transparent; border:1px solid var(--border); border-left:3px solid var(--text-muted);
  border-radius:7px; padding:10px 12px; cursor:pointer; }
.perf-tile:hover { background:rgba(255,255,255,.03); }
.perf-tile-label { font-size:11px; color:var(--text-muted); }
.perf-tile-value { font-size:22px; font-weight:600; font-variant-numeric:tabular-nums; }
.perf-tile-threshold { font-size:10px; color:var(--text-muted); }
.perf-tile-threshold em { font-style:normal; font-weight:700; text-transform:uppercase; margin-left:5px; }

.perf-panels { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:12px; }
.perf-panel { border:1px solid var(--border); border-radius:8px; padding:12px 14px; }
.perf-panel h3 { display:flex; align-items:center; gap:7px; font-size:13px; margin:0 0 10px; }
.perf-muted { color:var(--text-muted); font-size:12px; }
.perf-bottleneck { font-size:12px; margin:0 0 8px; }
.perf-bars { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:5px; }
.perf-bars li { display:flex; align-items:center; gap:8px; font-size:11px; }
.perf-bar-label { width:110px; color:var(--text-muted); flex-shrink:0; }
.perf-bar { flex:1; height:6px; background:var(--border); border-radius:3px; overflow:hidden; }
.perf-bar i { display:block; height:100%; background:var(--brand); }
.perf-bar-value { width:60px; text-align:right; font-variant-numeric:tabular-nums; }

.perf-dl { display:grid; grid-template-columns:auto 1fr; gap:5px 14px; font-size:12px; margin:0; }
.perf-dl dt { color:var(--text-muted); }
.perf-dl dd { margin:0; font-variant-numeric:tabular-nums; }
.perf-dl small { color:var(--text-muted); margin-left:6px; }
.perf-alert { margin-top:10px; font-size:11px; color:var(--danger-text);
  background:rgba(248,81,73,.08); border-radius:5px; padding:6px 9px; display:flex; gap:6px; }

.perf-table { width:100%; border-collapse:collapse; font-size:12px; }
.perf-table th { text-align:left; font-size:10px; text-transform:uppercase; letter-spacing:.04em;
  color:var(--text-muted); padding:5px 8px; border-bottom:1px solid var(--border); }
.perf-table td { padding:7px 8px; border-bottom:1px solid var(--border); font-variant-numeric:tabular-nums; }
.perf-table tbody tr { cursor:pointer; }
.perf-table tbody tr:hover { background:rgba(255,255,255,.03); }
.perf-actor-type { font-size:10px; padding:1px 6px; border-radius:9px; background:rgba(255,255,255,.06);
  color:var(--text-muted); text-transform:capitalize; }
.perf-actor-type.human { background:rgba(63,185,80,.12); color:var(--success-text); }

.perf-lint { list-style:none; margin:0 0 8px; padding:0; font-size:12px; }
.perf-lint li { display:flex; justify-content:space-between; padding:3px 0; }

.perf-timeline { list-style:none; margin:0; padding:0; font-size:11px; max-height:420px; overflow:auto; }
.perf-timeline li { display:flex; gap:10px; align-items:center; padding:4px 0;
  border-bottom:1px solid rgba(255,255,255,.04); flex-wrap:wrap; }
.perf-ev-time { color:var(--text-muted); font-variant-numeric:tabular-nums; }
.perf-ev-type { font-weight:600; }
.perf-ev-actor, .perf-ev-outcome { color:var(--text-muted); }
.perf-ev-open { background:none; border:1px solid var(--border); border-radius:4px; color:var(--text-muted);
  font-size:10px; padding:1px 7px; cursor:pointer; margin-left:auto; }

.perf-drill { border:1px solid var(--brand); border-radius:8px; padding:12px 14px; }
.perf-drill-head { display:flex; align-items:center; gap:10px; margin-bottom:8px; font-size:13px; }
.perf-drill-head button { margin-left:auto; background:none; border:none; color:var(--text-muted);
  font-size:18px; cursor:pointer; line-height:1; }
.perf-loading, .perf-empty { color:var(--text-muted); font-size:13px; padding:24px; }

/* ── WS8 reports browser: author/date filters + version badge ────── */

.reports-filters {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  margin: 0 0 1rem; padding: .85rem 1rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2, transparent);
}
.reports-filters label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: 12px; color: var(--text-muted);
}
.reports-filters select, .reports-filters input {
  padding: .35rem .5rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; background: var(--surface); color: var(--text);
}

/* A corrected report has to announce itself in the list. Without this the
   only visible difference between v1 and v3 is the date. */
.report-version {
  display: inline-block; margin-left: .5rem; padding: .05rem .45rem;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  background: #fdf3d8; color: #7a5b00; vertical-align: middle;
}
html[data-theme="dark"] .report-version { background: var(--warn-tint); color: #e8c766; }

/* FAW-235 — a report the client can see has to be distinguishable from an
   internal one at a glance. It carries its own word rather than relying on
   colour: "which of these has the client already read" is not a question worth
   answering by hue alone. */
.report-client-flag {
  display: inline-block; margin-left: .5rem; padding: .05rem .45rem;
  border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--success-tint); color: #14653a; vertical-align: middle;
}
html[data-theme="dark"] .report-client-flag { background: var(--success-tint); color: #6ee7a8; }

/* ── WS9: Team page (FAW-131) ─────────────────────────────────────── */

/* "remove open spaces in the teams page" — the content was capped at 1100px
   and centred, so on any wide screen it sat in a column with a large empty
   margin either side.
   NOT a shared page shell, which is worth recording: Today's Work had the
   same complaint from the same magic number written into a DIFFERENT rule
   (.tw-tasks-col). Two rules, one number, two tickets. Other pages keep
   their caps on purpose — Drive, Files, Discussions and Reports are reading
   widths at 900-1000px, not accidents. */
/* "remove open spaces in the teams page" — capped at 1100px AND centred, so
   the dead space fell on both sides. Raised for the same reason and to the
   same bound as .tw-tasks-col: fills an ordinary monitor, still refuses a
   3440px line. The auto margins go, so what is left over sits on the right
   rather than being split into two gaps. */
.team-page { max-width: 1600px; padding: 1.25rem 1.5rem 3rem; }
.team-head h1 { display: flex; align-items: center; gap: .5rem; font-size: 1.4rem; margin: 0; }
.team-head .subtitle { color: var(--text-muted); font-size: 13px; margin: .25rem 0 1.25rem; }

.team-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .75rem; margin-bottom: 1.25rem; }
/* A card needs a surface, not just an outline. Border-only cards sat flush
   with the page in dark mode, so the Team page read as one unbroken sheet. */
.team-stat { background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .75rem .9rem; }
.team-stat .n { font-size: 1.35rem; font-weight: 700; }
.team-stat .l { font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); }
.team-stat .sub:empty { display: none; }
.team-stat .sub { margin-top: .3rem; }

/* ── FAW-382: spend framing ───────────────────────────────────────── */

.team-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; }

/* The period switcher. Segmented rather than a <select> because the choice is
   between three fixed windows and the current one should be readable without
   opening anything — the figures beside it are meaningless unless you can see
   which window they cover. */
.team-period { display: inline-flex; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; flex: none; }
.team-period button { appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12px; padding: .4rem .7rem; color: var(--text-muted);
  border-right: 1px solid var(--border); }
.team-period button:last-child { border-right: 0; }
.team-period button:hover { background: var(--bg-hover); }
.team-period button.on { background: var(--surface); color: var(--text); font-weight: 600; }

/* ── FAW-461 — the three-view switcher ────────────────────────────── */
.team-views {
  display: flex; gap: 2px; margin: 4px 0 18px;
  border-bottom: 1px solid var(--border);
}
.team-view-tab {
  appearance: none; background: none; border: none; cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 600; padding: 8px 16px; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.team-view-tab:hover { color: var(--text); }
.team-view-tab.on { color: var(--brand-text); border-bottom-color: var(--brand); }

/* FAW-471 — the provisional-rulings notice, reusing FAW-414's amber badge. */
.team-rulings {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 6px; font-size: 12px; margin-bottom: 16px;
  background: var(--warn-tint); color: var(--text);
}
.team-rulings-link {
  background: none; border: none; cursor: pointer; color: var(--brand-text);
  font-size: 12px; text-decoration: underline; padding: 0;
}
.team-ruling-pop { max-width: 420px; gap: 14px; max-height: 70vh; overflow-y: auto; }
.team-ruling {
  display: flex; flex-direction: column; gap: 5px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.team-ruling:last-child { border-bottom: none; padding-bottom: 0; }
/* A ruling that moved once the code was read says so, rather than presenting
   the final answer as though it had always been obvious. */
.ruling-departed {
  font-size: 11px; color: var(--warn-text); line-height: 1.45;
  padding-left: 8px; border-left: 2px solid var(--warn);
}

/* The Now view's header: the count, and the definition behind it. */
.team-now-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.team-now-def {
  flex: 1 1 240px; font-size: 11px; color: var(--text-muted); line-height: 1.45;
}
.team-idle-note {
  margin-top: 12px; padding: 8px 12px; border-radius: 6px; font-size: 12px;
  background: var(--surface-2); color: var(--text-muted);
}

/* ══ FAW-470 — the detail panel ════════════════════════════════════ */
/* Opens OVER the page rather than navigating away, so the reader keeps their
   place. A side sheet, not a route. */
.td-overlay {
  position: fixed; inset: 0; z-index: 300; display: flex; justify-content: flex-end;
  background: rgba(0, 0, 0, 0.45);
}
.td-panel {
  width: min(520px, 100%); height: 100%; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.td-head {
  display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.td-id { flex: 1 1 auto; min-width: 0; }
.td-name { font-size: 16px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-sub { font-size: 12px; color: var(--text-muted); }
.td-close {
  flex: 0 0 auto; background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--text-muted); padding: 0 4px;
}
.td-close:hover { color: var(--text); }
/* 2026-10-19 — chat, voice call, vibe call, next to the name. */
.td-quick { display: flex; gap: 6px; flex: 0 0 auto; }
.td-quick-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); cursor: pointer;
}
.td-quick-btn:hover { background: var(--brand-faint); color: var(--brand-text); border-color: var(--brand-text); }
.td-quick-btn:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.td-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 18px 32px; }

.td-sec { margin-bottom: 22px; }
.td-sec h3 {
  margin: 0 0 10px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
}
/* 2026-10-22 — a person's Team panel opens with the identity block shared with
   the Chats panel (person-identity.js), then Team's own sections, each with the
   same rule above it, so it reads as one panel. */
.td-body .pp-identity { padding: 4px 0 18px; }
.td-sec-rule { border-top: 1px solid var(--border); padding-top: 14px; }
.td-sec-rule .pp-row { padding: 4px 0; }
.td-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.td-grid > div { display: flex; flex-direction: column; gap: 2px; }
.td-l { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.td-v { font-size: 13px; color: var(--text); }
.td-note { font-size: 12px; color: var(--text-muted); font-style: italic; }

.td-bar {
  height: 6px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; margin-top: 10px;
}
.td-bar span { display: block; height: 100%; background: var(--brand); }

.td-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.td-chip {
  padding: 4px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
  background: var(--brand-subtle); color: var(--brand-text); border: 1px solid var(--brand-soft);
}
.td-chip:hover { background: var(--brand-faint); }

.td-list { display: flex; flex-direction: column; gap: 2px; }
.td-item {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; font-size: 12px;
}
.td-item:hover { background: var(--bg-hover); }
.td-item-t { flex: 1 1 auto; min-width: 0; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-item-p, .td-item-d { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; }

.td-runs { display: flex; flex-direction: column; gap: 3px; }
.td-run { display: flex; align-items: baseline; gap: 8px; font-size: 12px; padding: 4px 0; }
.td-run-stage { flex: 0 0 70px; color: var(--text); font-weight: 600; }
.td-run-out {
  flex: 0 0 auto; padding: 0 7px; border-radius: 999px; font-size: 10px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted);
}
.td-run-out.passed, .td-run-out.succeeded { background: var(--success-tint); color: var(--success-text); }
.td-run-out.failed, .td-run-out.errored { background: var(--danger-tint); color: var(--danger-text); }
.td-run-t { flex: 1 1 auto; min-width: 0; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-run-when { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; }

.td-actions { display: flex; flex-direction: column; gap: 7px; }
.td-btn {
  padding: 8px 12px; border-radius: 7px; font-size: 13px; cursor: pointer; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.td-btn:hover { border-color: var(--brand); }
.td-btn.danger { color: var(--danger-text); }
.td-btn.danger:hover { border-color: var(--danger); background: var(--danger-tint); }

/* MTR-04 — the rate control on the agent panel.
   The band and the sentence qualifying it are ONE bordered block, so that a
   later edit cannot move a figure out from under the line saying how many
   observations produced it. That separation is the ticket's reject condition. */
.tr-rate { display: flex; flex-direction: column; gap: 10px; }
.tr-rate-grade { display: flex; align-items: center; gap: 8px; }
.tr-rate-grade select {
  flex: 1; padding: 6px 8px; border-radius: 6px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.tr-band {
  padding: 10px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.tr-band-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.tr-band-l { color: var(--text-muted); }
.tr-band-v { font-variant-numeric: tabular-nums; font-weight: 600; }
.tr-band-note { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.tr-band-why { margin: 6px 0 0; padding-left: 16px; font-size: 11px; color: var(--text-muted); }
.tr-band-why li { margin-top: 2px; }
.tr-rate-cur { font-size: 14px; }
.tr-rate-cur.none { font-size: 12px; color: var(--text-muted); font-style: italic; }
.tr-rate-mark {
  margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 11px;
  background: var(--bg-hover); color: var(--text-muted);
}
/* MTR-05 — provisional has to be VISIBLE, not merely present. It carries the
   warning colour rather than the muted one every other pill uses, because a
   provisional rate read as a firm one is the failure this ticket is about. */
.tr-rate-mark.provisional {
  background: var(--warn-tint, var(--bg-hover));
  color: var(--warn-text, var(--text));
  font-weight: 600;
}
.tr-band.provisional { border-color: var(--warn, var(--border)); }
.tr-band-flag {
  margin-top: 6px; display: inline-block; padding: 1px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--warn-tint, var(--bg-hover)); color: var(--warn-text, var(--text));
}
/* Zero observations: no band is drawn at all, so this replaces the rows rather
   than sitting beside them. */
.tr-band-blind { font-size: 13px; color: var(--text-muted); }
.tr-rate-set { display: flex; flex-direction: column; gap: 7px; }

.td-event { padding: 6px 8px; border-radius: 6px; font-size: 12px; }
.td-event:hover { background: var(--bg-hover); }
.td-ev-a { font-weight: 600; color: var(--text); }
.td-ev-by, .td-ev-when { color: var(--text-muted); font-size: 11px; margin-left: 6px; }
.td-ev-why { color: var(--text-muted); font-size: 11px; font-style: italic; margin-top: 2px; }

@media (max-width: 620px) {
  .td-panel { width: 100%; }
  .td-grid { grid-template-columns: 1fr; }
}

/* ══ FAW-468/469 — the Performance table ═══════════════════════════ */
.tp-wrap { overflow-x: auto; }
.tp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* HAT-HVH-0000371 — left-aligned throughout, with the actor icons flush at
   the table's left edge. Every cell was right-aligned with the name column
   exempted, which pushed the numbers to the far side of a full-width table
   and left a gulf between a person and their figures. */
.tp-table th, .tp-table td {
  padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tp-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
/* The name column leads the row, so it carries no side padding of its own —
   the icon starts at the table edge rather than one gutter inside it. */
.tp-th-name, .tp-td-name { padding-left: 0; }
.tp-sort {
  background: none; border: none; cursor: pointer; font: inherit;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); padding: 0;
}
.tp-sort:hover { color: var(--text); }
.tp-table th.on .tp-sort { color: var(--brand-text); }
.tp-only {
  display: block; font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); opacity: .75;
}
.tp-table tbody tr { cursor: pointer; }
.tp-table tbody tr:hover { background: var(--bg-hover); }
.tp-table tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.tp-who { display: inline-flex; align-items: center; gap: 9px; }
.tp-n { display: flex; flex-direction: column; line-height: 1.2; }
.tp-name { font-weight: 600; color: var(--text); }
.tp-type { font-size: 10px; color: var(--text-muted); }

/* FAW-469's three states, visibly distinct from each other.
   BLANK is genuinely empty — the metric is meaningless for that actor type, so
   there is nothing to render and nothing to explain. */
.tp-blank { }
/* NO DATA is a dash: it applies and it is instrumented, there is simply nothing
   measured yet. Muted, and it carries a tooltip saying so. */
.tp-no-data { color: var(--text-muted); }
/* ZERO is a real, readable number. It is information, and must never be
   mistaken for either of the two above. */
.tp-zero { color: var(--text); }
.tp-value { color: var(--text); font-variant-numeric: tabular-nums; }

.tp-hidden-note, .tp-period-note {
  display: flex; align-items: center; gap: 6px; margin-top: 12px;
  font-size: 11px; color: var(--text-muted); line-height: 1.5;
}

/* ══ FAW-462/463 — the Now view ════════════════════════════════════ */
.tn-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tn-def { flex: 1 1 260px; font-size: 11px; color: var(--text-muted); line-height: 1.45; }

.tn-list { display: flex; flex-direction: column; gap: 8px; }
/* Humans and agents use the SAME row shape — the two are comparable, and a
   different-looking row for each would contradict that on the one view where
   they sit side by side. */
.tn-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
}
.tn-row:hover { border-color: var(--brand-soft); }
.tn-row:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tn-av { flex: 0 0 auto; }
.tn-main { flex: 1 1 auto; min-width: 0; }
.tn-who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tn-name { font-size: 14px; font-weight: 600; color: var(--text); }
.tn-occ {
  padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2); color: var(--text-muted);
}
.tn-occ.working  { background: var(--success-tint); color: var(--success-text); }
.tn-occ.chatting { background: var(--info-tint);    color: var(--link); }
.tn-work { display: flex; align-items: center; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.tn-ticket, .tn-project {
  background: none; border: none; padding: 0; cursor: pointer; font-size: 12px;
  color: var(--brand-text);
}
.tn-ticket:hover, .tn-project:hover { text-decoration: underline; }
.tn-sep { color: var(--text-muted); font-size: 12px; }
.tn-nowork { color: var(--text-muted); font-size: 12px; }
.tn-title {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tn-right { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; gap: 3px; }
/* The number the view exists for: how long they have been on it. */
.tn-elapsed { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tn-run { font-size: 10px; color: var(--text-muted); }
.tn-attempt {
  display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 999px;
  background: var(--warn-tint); color: var(--warn-text); font-weight: 700;
}

.tn-nobody {
  display: flex; align-items: center; gap: 12px; padding: 22px;
  border-radius: 10px; background: var(--surface-2); color: var(--text-muted);
}
.tn-nobody-t { font-size: 14px; font-weight: 600; color: var(--text); }
.tn-nobody-s { font-size: 12px; }

/* FAW-463 — idle collapses to ONE LINE at the bottom. Eight identical "Idle"
   badges filling a view about activity is the thing being fixed. */
.tn-idle { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.tn-idle-head {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  background: none; border: 1px solid transparent; color: var(--text-muted);
}
.tn-idle-head:hover { background: var(--bg-hover); border-color: var(--border); }
.tn-idle-chev { display: inline-flex; transition: transform .15s ease; }
.tn-idle.open .tn-idle-chev { transform: rotate(90deg); }
.tn-idle-count { font-size: 12px; font-weight: 700; color: var(--text); flex: 0 0 auto; }
.tn-idle-avs { display: inline-flex; flex: 0 0 auto; }
/* Overlapped, so eight avatars occupy the width of about four. */
.tn-idle-avs .tr-av { margin-right: -7px; border-width: 1.5px; }
.tn-idle-names {
  flex: 1 1 auto; min-width: 0; font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tn-idle-body {
  display: grid; gap: 4px; padding: 8px 4px 0;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.tn-idle-row {
  display: flex; align-items: center; gap: 9px; padding: 6px 8px;
  border-radius: 7px; cursor: pointer; font-size: 12px;
}
.tn-idle-row:hover { background: var(--bg-hover); }
.tn-idle-name { flex: 1 1 auto; min-width: 0; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-idle-seen { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; }

/* ══ FAW-464/465 — the Roster card grid ════════════════════════════ */
.tr-section { margin-bottom: 28px; }
.tr-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tr-section-head .team-group { margin: 0; }
.tr-count {
  padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted);
}
.tr-sort { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tr-sort-l { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.tr-sort select {
  padding: 4px 8px; border-radius: 6px; font-size: 12px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
}

/* The grid gains columns on wider screens — auto-fill against a min width, so
   it uses the FULL PAGE WIDTH rather than a fixed column count. */
.tr-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
}

/* CONSISTENT HEIGHT. The rows are a fixed set, and the card stretches to the
   tallest in its row, so an actor with no projects still occupies the same
   card as one with three. Ragged heights are what make a grid look untidy. */
.tr-card {
  position: relative; display: flex; flex-direction: column; align-items: center;
  height: 100%; min-height: 236px;
  padding: 18px 14px 14px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.tr-card:hover { border-color: var(--brand-soft); box-shadow: var(--shadow-md); }
.tr-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.tr-menu {
  position: absolute; top: 8px; right: 8px; display: none;
  align-items: center; justify-content: center; width: 26px; height: 26px;
  padding: 0; border-radius: 6px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.tr-card:hover .tr-menu, .tr-card:focus-within .tr-menu { display: flex; }
.tr-menu:hover { color: var(--text); border-color: var(--brand); }

.tr-top { margin-bottom: 12px; }

/* ── FAW-465 — the avatar ─────────────────────────────────────────── */
/* Materially larger than the old 32px row avatar, and carrying BOTH the type
   indicator and the live status, so neither needs a separate badge. */
.tr-av {
  /* Component-local, not a theme token. Declared here so the avatar still has
     a sane size if the inline override is ever missing, and so it is a real
     declaration rather than a var() with no origin. */
  --tr-av: 64px;
  position: relative; width: var(--tr-av); height: var(--tr-av);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 2px solid var(--border); overflow: visible;
}
.tr-av.agent { border-color: var(--brand-soft); background: var(--brand-faint); }
.tr-av-img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block;
}
/* The two fallbacks. There is no fourth branch — a blank circle is impossible. */
.tr-av-initials {
  font-size: calc(var(--tr-av) * 0.34); font-weight: 700; color: var(--text-muted);
  letter-spacing: .02em;
}
.tr-av-glyph { display: flex; color: var(--brand-text); }

/* Type ON the avatar: agents and humans stay distinguishable without being
   given different-looking cards. */
/* HAT-HVH-0000369 — scales with the avatar instead of being fixed.
   avatarHtml() is called at 64, 40, 28 and 22px; a constant 22px badge is an
   accent on the first and the entire icon on the last. Clamped so the small
   avatars stay readable and the 64px card keeps the size it already had. */
.tr-av-type {
  position: absolute; left: -2px; bottom: -2px;
  display: flex; align-items: center; justify-content: center;
  width: clamp(13px, calc(var(--tr-av) * 0.34), 22px);
  height: clamp(13px, calc(var(--tr-av) * 0.34), 22px);
  border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
}
.tr-av.agent .tr-av-type { color: var(--brand-text); border-color: var(--brand-soft); }

/* Live status ON the avatar, not floating in the row. */
/* HAT-HVH-0000369 — the reported bug. At the 22px avatar in the collapsed
   idle strip, a fixed 15px dot plus its 2.5px ring was 20px of a 22px circle:
   the status covered the person it was describing. The ring scales too, or it
   reintroduces the same problem at a fraction of the size. */
.tr-av-status {
  position: absolute; right: -1px; top: -1px;
  width: clamp(8px, calc(var(--tr-av) * 0.23), 15px);
  height: clamp(8px, calc(var(--tr-av) * 0.23), 15px);
  border-radius: 50%;
  border: clamp(1.5px, calc(var(--tr-av) * 0.04), 2.5px) solid var(--surface);
  background: var(--text-muted);
}
/* The occupation scale is deliberately literal — see components/team-status.js:
   these are semantic states that must read identically in both themes. */
.tr-av-status.working     { background: #22c55e; }
.tr-av-status.chatting    { background: #38bdf8; }
.tr-av-status.queued      { background: #f59e0b; }
.tr-av-status.errored     { background: #ef4444; }
.tr-av-status.unknown     { background: #a855f7; }
.tr-av-status.disabled,
.tr-av-status.unavailable { background: #6b7280; }
.tr-av-status.idle        { background: #8a8b94; }
.tr-av-status.working, .tr-av-status.chatting { animation: tr-pulse 2s ease-in-out infinite; }
@keyframes tr-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* The NAME is the most prominent text on the card. */
.tr-name {
  font-size: 15px; font-weight: 700; color: var(--text); text-align: center;
  line-height: 1.25; margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.tr-role {
  font-size: 11px; color: var(--text-muted); text-align: center; margin-bottom: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}

.tr-line {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  padding: 4px 0; font-size: 12px; border-top: 1px solid var(--border);
}
.tr-line:first-of-type { border-top: none; }
.tr-l { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; }
.tr-v {
  flex: 1 1 auto; min-width: 0; text-align: right; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 620px) {
  .tr-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .tr-card { min-height: 210px; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-av-status.working, .tr-av-status.chatting { animation: none; }
}
.team-period button:focus-visible { outline: 2px solid var(--accent, #C09020); outline-offset: -2px; }

/* "not recorded" must not read like a number, and must not read like an error
   either — it is a legitimate state. Muted and italic: present, quiet, clearly
   not a measurement. */
.team-unrecorded { font-style: italic; font-weight: 400; font-size: .78em;
  color: var(--text-muted); letter-spacing: 0; text-transform: none; }
.team-partial { font-size: 10.5px; color: var(--text-muted); }

.team-splitbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .75rem; margin-bottom: 1.25rem; }
.team-split { background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .7rem .9rem; }
.team-split .hd { display: flex; align-items: baseline; gap: .45rem; margin-bottom: .45rem; }
.team-split .lbl { font-weight: 700; font-size: 13px; }
.team-split .hint { font-size: 11px; color: var(--text-muted); }
.team-split .figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
  font-size: 13px; }
.team-split .figs .l { display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); }

/* Per-agent work/chat line, under the figures. */
.team-kinds { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .25rem 1rem;
  margin-top: .4rem; font-size: 11.5px; color: var(--text-muted); }
.team-kinds b { color: var(--text); font-weight: 600; margin-right: .2rem; }

.team-scope-note { display: flex; align-items: center; gap: .5rem; font-size: 12.5px;
  color: var(--text-muted); border: 1px dashed var(--border); border-radius: 8px;
  padding: .55rem .75rem; margin-bottom: 1rem; }

.team-group { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin: 1.25rem 0 .5rem; }

.team-list { display: flex; flex-direction: column; gap: .5rem; }
.team-row { display: grid; grid-template-columns: minmax(160px, 1.1fr) minmax(160px, 1.2fr) 2fr;
  gap: 1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: .7rem .9rem; }

.team-who { display: flex; align-items: center; gap: .6rem; }
.team-icon { display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2, #2a2b36);
  position: relative; flex: none; }
/* The dot is the only thing distinguishing a working agent from a stopped one
   at a glance, so it gets a ring to stay visible against any avatar colour. */
.team-icon.online::after { content: ''; position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%; background: #35c46a;
  border: 2px solid var(--bg, #1b1c24); }
.team-name { font-weight: 600; font-size: 14px; }
.team-role { font-size: 11.5px; color: var(--text-muted); text-transform: capitalize; }

/* --link, not --accent. --accent is the workspace's brand accent: it is chosen
   for recognition on a fill and carries no contrast guarantee as text (this
   workspace's is #1e00ff, which lands at 2:1 on the dark page). --link is the
   token that is tuned per theme for exactly this job. */
.team-ticket { background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--link); font-size: 13.5px; font-weight: 600; text-align: left; }
.team-ticket:hover { text-decoration: underline; }
.team-meta { font-size: 11.5px; color: var(--text-muted); }
.team-idle { font-size: 13px; color: var(--text-muted); font-style: italic; }

/* ---------- FAW-380: live agent status on the Team page ----------
 *
 * The chip colour arrives from the component as --dot, so the vocabulary lives
 * in one place (team-page.js STATUS) rather than being split between a JS map
 * and a parallel set of CSS classes that would drift the first time a state was
 * added.
 */
.team-status-line { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-bottom: .3rem; }
.team-status { display: inline-flex; align-items: center; gap: .38rem;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  padding: 2px 9px 2px 7px; border-radius: 10px; white-space: nowrap;
  color: var(--dot); background: color-mix(in srgb, var(--dot) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--dot) 28%, transparent); }
.team-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot);
  flex: none; }

/* --dot is doing three jobs: the dot itself, the chip tint, and the label. The
   first two want the saturated colour the component picked; the third does not
   — those hues are chosen to glow against the dark page and land near 2.5:1 as
   ink on a light chip. Darkening the same hue keeps the vocabulary in one place
   (team-page.js STATUS) rather than splitting it into a second per-theme map
   that would drift the first time a state was added. */
html[data-theme="light"] .team-status { color: color-mix(in srgb, var(--dot) 55%, #000); }
/* Dark needs the mirror of the same adjustment, not the raw hue: against the
   13% tint the chip sits on, Idle's grey lands at 3.8:1 unlightened. */
html[data-theme="dark"] .team-status { color: color-mix(in srgb, var(--dot) 82%, #fff); }

/* Change-tier / assign-retainer modal.
   Was a fixed 2- and 3-column grid of inline-styled inputs with no height
   limit: on a short viewport the panel ran off the screen with no way to
   reach the buttons, and grid children default to min-width:auto, so a long
   label like "Contract end (blank = indefinite)" pushed its input past the
   column and everything read as cramped. */
.ct-modal-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; width: 90%; max-width: 560px;
  color: var(--text);
  max-height: min(88vh, 780px); overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.ct-modal-body { display: grid; gap: 14px; }

/* auto-fit so the columns collapse instead of crushing their contents */
.ct-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ct-field { display: grid; gap: 5px; min-width: 0; }
.ct-field > span { font-size: 12px; color: var(--text-muted); line-height: 1.35; }

.ct-input {
  width: 100%; box-sizing: border-box;
  padding: 10px; border-radius: 6px;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); font-size: 13px;
}
.ct-input:focus { outline: none; border-color: var(--brand); }
.ct-textarea { resize: vertical; min-height: 56px; }

/* Callouts inside the modal. These were flush 10px blocks exactly as wide as
   the inputs, which is what made the warning read as running into the edge of
   the dialog rather than sitting inside it. They now get real padding, a
   hanging icon column and a readable line-height. */
.ct-callout {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.5; color: var(--text);
}
.ct-callout-icon { flex: none; font-size: 14px; line-height: 1.35; }

/* The border is a tint of the same hue rather than the ink: a full-strength
   --warn-text outline around a pale fill reads as shouting. */
.ct-callout-warn {
  background: var(--warn-tint);
  border: 1px solid color-mix(in srgb, var(--warn-text) 38%, transparent);
}
.ct-callout-danger {
  background: var(--danger-tint);
  border: 1px solid color-mix(in srgb, var(--danger-text) 38%, transparent);
}

/* Hidden until the contract is shorter than 12 months; the handler sets an
   inline display, which outranks this. */
.ct-paperwork-row { display: none; cursor: pointer; }
.ct-paperwork-row input { margin: 2px 0 0; flex: none; }

/* A rule so the buttons do not crowd whichever callout precedes them. */
.ct-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Provider type pill (Settings → Compute). Same shape as .team-status: the
   component supplies one hue as --pill, the tint and the ink are derived from
   it here so each theme takes what it needs. */
.mp-type-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--pill) 15%, transparent);
}
html[data-theme="light"] .mp-type-pill { color: color-mix(in srgb, var(--pill) 62%, #000); }
html[data-theme="dark"]  .mp-type-pill { color: color-mix(in srgb, var(--pill) 78%, #fff); }

/* Errored is the one state that must survive being glanced past. */
.team-status-errored { font-weight: 700;
  border-color: color-mix(in srgb, var(--dot) 55%, transparent); }

/* Only the states that are genuinely moving pulse. A pulsing "Idle" would be
 * the same false reassurance in animated form. */
.team-status.pulsing .dot { animation: team-pulse 1.9s ease-in-out infinite; }
@keyframes team-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--dot) 60%, transparent); }
  50%      { opacity: .55; box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .team-status.pulsing .dot { animation: none; }
}

.team-status-warn { display: inline-flex; align-items: center; gap: .25rem;
  font-size: 11px; font-weight: 600; color: var(--danger-text); cursor: help; }

.team-reason { font-size: 11.5px; color: var(--text-muted); margin-top: .25rem;
  line-height: 1.4; }
.team-reason.bad { color: var(--danger-text); }

.team-stat.attention { border-color: color-mix(in srgb, #ef4444 45%, var(--border)); }
.team-stat.attention .n { color: var(--danger-text); }

.team-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: .5rem; font-size: 13px; }
.team-figures .l { display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); }

.team-empty, .team-error { padding: 1.25rem; border: 1px dashed var(--border);
  border-radius: 10px; color: var(--text-muted); font-size: 13.5px; }
.team-error { color: var(--danger-text); border-color: #e06c75; }

@media (max-width: 860px) {
  .team-row { grid-template-columns: 1fr; gap: .6rem; }
}

/* ---------- FRG-069: dense WS6/WS7/WS9 panels on small screens ----------
 *
 * The Tier-1 actor table is ~550px of columns. At 375px it was reaching past
 * the viewport and, because the only scrollable ancestor was the page shell,
 * the ENTIRE PAGE scrolled sideways — header and all — instead of just the
 * table. The content was reachable, so this was awkward rather than broken,
 * but a page that slides under your thumb while you try to read a number is
 * the wrong trade.
 *
 * Each dense panel now scrolls within itself, so the page stays put.
 */
@media (max-width: 768px) {
  .perf-panel,
  .esc-panel,
  .team-panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .perf-table,
  .esc-table {
    /* Keep the columns legible inside the scroller rather than letting them
     * crush together to fit — a squeezed table is harder to read than a
     * scrolled one. */
    min-width: 520px;
  }
  /* Tiles wrap to one column instead of overflowing. */
  .perf-tiles,
  .team-totals {
    grid-template-columns: 1fr 1fr;
  }
  .perf-filters {
    flex-direction: column;
    align-items: stretch;
  }
}

/* FAW-204 — relay stage 1, Project SoW Tasks: a derived, read-only column.
   Visually distinct from a real board column so nobody tries to drag into it;
   the only way out of stage 1 is to write a ticket citing the phase. */
.kanban-col-derived {
  border-style: dashed;
  opacity: 0.92;
}
.kanban-col-derived .cards-readonly { cursor: default; }
.sow-card {
  background: var(--surface-2, #1b1b1f);
  border: 1px dashed var(--border, #35343a);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.sow-card-phase { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.02em; }
.sow-card-type { font-size: 14px; margin: 2px 0 4px; }
.sow-card-note { font-size: 12px; color: var(--text-muted, #8b8a93); }
.sow-foot {
  font-size: 12px;
  color: var(--text-muted, #8b8a93);
  padding: 6px 10px 10px;
}

/* FAW-205 — the relay stage a board column represents. Small and quiet: it is
   orientation, not a call to action, and must not compete with the cards. */
.stage-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 10px 6px; font-size: 12px;
  color: var(--text-muted, #8b8a93);
  border-bottom: 1px solid var(--border, #2a2930);
  margin-bottom: 6px;
}
.stage-badge-n {
  min-width: 15px; height: 15px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2, #26252b); font-weight: 600; font-size: 12px;
}
.stage-badge-name { letter-spacing: 0.01em; }
/* Stage 7 is where a person accepts the work — the one column whose label is
   a responsibility rather than a status. */
.stage-badge-terminal .stage-badge-gate {
  margin-left: auto; padding: 1px 6px; border-radius: 999px;
  background: rgba(99, 153, 34, 0.16); color: #8ec03f; font-size: 12px;
}
/* UI-QW3 — no opacity for state (design rule 6). 0.65 took the muted label to
   3.36:1 dark / 2.81:1 light. Italic alone says "not mapped"; the colour
   stays the text-safe --text-muted from .stage-badge. */
.stage-badge-none { font-style: italic; }

/* ── FAW-237 — column owner + live relay run state ──────────────────────
   The stage badge above says WHICH stage a column is. These say who owns it
   and what is happening in it, which is what makes the board read as a relay
   rather than a kanban with numbered columns.

   The badge keeps its border-bottom as the divider under the whole block, so
   the owner row sits inside that group rather than looking like a third
   unrelated strip. */
.stage-badge { border-bottom: 0; margin-bottom: 0; padding-bottom: 2px; }
.stage-owner {
  display: flex; align-items: center; gap: 5px;
  padding: 0 10px 6px; font-size: 12px;
  border-bottom: 1px solid var(--border, #2a2930);
  margin-bottom: 6px;
  color: var(--text-muted, #8b8a93);
}
.stage-owner i, .stage-owner svg { flex: 0 0 auto; opacity: 0.8; }
/* An agent-owned column is tinted with that agent's own colour, so the same
   agent is recognisable here, in chat and on the Teams page without reading. */
.stage-owner-agent { color: var(--owner-color, #C09020); }
/* A stage bound to a role with no active agent: the relay will not dispatch
   here (FAW-207). Loud enough to be noticed, not so loud it reads as an error
   on a board that is otherwise fine. */
.stage-owner-missing { color: var(--warn-text); }
/* An `either` stage: the agent is named, and this says a person may act too.
   Muted, because the agent is the usual case and the human is the exception. */
.stage-owner-or {
  margin-left: 5px; padding: 0 5px; border-radius: 999px;
  background: var(--surface-2, #26252b);
  color: var(--text-muted, #8b8a93); font-size: 9.5px;
}

.col-runs { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 8px; }
.col-run {
  border: 1px solid var(--border, #2a2930);
  border-left: 2px solid #C09020;
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--surface-2, #26252b);
  font-size: 11px;
}
.col-run-top { display: flex; align-items: center; gap: 6px; }
.col-run-agent { font-weight: 600; }
.col-run-time { margin-left: auto; color: var(--text-muted, #8b8a93); font-variant-numeric: tabular-nums; }
/* The pulse is the only motion on the board and it means exactly one thing:
   an agent is working in this column right now. */
.col-run-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #C09020; flex: 0 0 auto;
  animation: col-run-pulse 1.6s ease-in-out infinite;
}
@keyframes col-run-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.col-run-ticket {
  margin-top: 3px; color: var(--text-muted, #8b8a93);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Progress is acceptance criteria settled, NOT elapsed-vs-timeout — a bar that
   filled as a run approached being killed would read as the opposite of what
   it meant. See renderColRuns in kanban.js. */
.col-run-bar {
  margin-top: 5px; height: 3px; border-radius: 2px;
  background: var(--surface-3, #34333a); overflow: hidden;
}
.col-run-bar-fill { height: 100%; background: #8ec03f; transition: width 0.3s ease; }
.col-run-crit { margin-top: 3px; font-size: 10px; color: var(--text-muted, #8b8a93); }
.col-run-nocrit {
  margin-top: 4px; font-size: 10px; font-style: italic;
  color: var(--text-muted, #8b8a93); opacity: 0.8;
}
/* Still `running` in the table, but its heartbeat stopped. Saying "running"
   without this would be a claim the data does not support. */
.col-run-stale { border-left-color: #d08770; }
.col-run-stale .col-run-dot { background: #d08770; animation: none; }
.col-run-warn { margin-top: 4px; font-size: 10px; color: var(--warn-text); }

@media (prefers-reduced-motion: reduce) {
  .col-run-dot { animation: none; }
}

/* ── FAW-360 — the preset builder ("Custom") ───────────────────────── */

.pb-step { padding: 24px; max-width: 820px; margin: 0 auto; }
/* 2026-10-27 — use the width a wide screen already has (BigJoe). The
   starting points become more cards per row; the builder pairs short
   sections (.pb-duo) and lays long lists out in columns. Every pair and
   grid falls back to one column under a sensible width, measured on the
   form itself, not the window, so the sidebar is accounted for. */
.pb-step { max-width: 1360px; container-type: inline-size; }
.pb-duo { display: grid; grid-template-columns: 1fr; }
@container (min-width: 900px) {
  .pb-duo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 48px; }
}
/* Each section in a pair keeps its own rule, at any width, so two sections
   side by side (or one under the other) never read as one. */
.pb-step .pb-duo > .pb-section { border-top: 1px solid var(--border, #2a2b36); }
/* Fields: each scope is its own titled box, its fields in as many columns as fit. */
.pb-field-scope {
  margin-top: 12px;
  padding: 4px 12px 10px;
  border: 1px solid var(--border, #2a2b36);
  border-radius: 8px;
}
.pb-field-scope .pb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2px 16px;
}
.pb-field-scope .pb-row { justify-content: space-between; }
/* A board column row (name, colour, who works it, move, remove) wraps on a
   phone instead of running off the screen. */
@container (max-width: 560px) {
  .pb-step .pb-column { flex-wrap: wrap; }
  /* Line one: the name and its colour. Line two: who works it, then move and remove. */
  .pb-step .pb-column .pb-col-name { flex: 1 1 calc(100% - 60px); min-width: 0; }
  .pb-step .pb-column .pb-col-owner { flex: 1 1 0; min-width: 0; }
}

.pb-title { margin: 0 0 6px; color: var(--text, #fff); font-size: 22px; }
.pb-lede { margin: 0 0 24px; color: var(--text-muted, #8a8b94); font-size: 14px; line-height: 1.55; }

.pb-section-title {
  margin: 24px 0 6px;
  color: var(--text, #fff);
  font-size: 14px;
  font-weight: 600;
}
.pb-hint {
  margin: 0 0 10px;
  color: var(--text-muted, #8a8b94);
  font-size: 12px;
  line-height: 1.5;
}

/* Step one — starting points. */
.pb-start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.pb-start {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 14px 16px;
  background: var(--bg, #24252f);
  border: 1px solid var(--border, #2a2b36);
  border-radius: 10px;
  color: var(--text, #fff);
  cursor: pointer;
  transition: border-color 0.15s;
}
.pb-start:hover { border-color: var(--brand); }
.pb-start-name { font-size: 14px; font-weight: 600; }
.pb-start-tier {
  justify-self: start;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #8a8b94);
  border: 1px solid var(--border, #2a2b36);
  border-radius: 4px;
  padding: 1px 5px;
}
.pb-start-desc { font-size: 12px; line-height: 1.5; color: var(--text-muted, #8a8b94); }

/* Step two — the builder. */
.pb-section {
  padding: 16px 0;
  border-top: 1px solid var(--border, #2a2b36);
}
.pb-section:first-of-type { border-top: none; }

.pb-pair { display: flex; gap: 12px; flex-wrap: wrap; }
.pb-pair label, .pb-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 200px;
  font-size: 12px;
  color: var(--text-muted, #8a8b94);
}
.pb-block { margin-top: 12px; }

.pb-step input[type="text"],
.pb-step select {
  background: var(--bg-input, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border, #2a2b36);
  border-radius: 6px;
  color: var(--text, #fff);
  font-size: 13px;
  padding: 7px 9px;
}
.pb-step input[type="color"] {
  width: 34px; height: 30px; padding: 2px;
  background: none;
  border: 1px solid var(--border, #2a2b36);
  border-radius: 6px;
  cursor: pointer;
}

/* The shape is shown AND disabled — the choice stays visible on the form. */
.pb-shape { font-size: 15px; color: var(--text, #fff); margin-bottom: 6px; }
.pb-shape-control { opacity: 0.55; cursor: not-allowed; }
.pb-shape-reason {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted, #8a8b94);
  border-left: 2px solid var(--border, #2a2b36);
  padding-left: 10px;
}

.pb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.pb-row:hover { background: var(--bg-hover, rgba(255, 255, 255, 0.03)); border-color: var(--border, #2a2b36); }
.pb-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.pb-row-name { font-size: 13px; color: var(--text, #fff); }
.pb-row-desc { font-size: 11px; color: var(--text-muted, #8a8b94); margin-left: auto; text-align: right; }

.pb-column .pb-col-name { flex: 1; min-width: 120px; }
.pb-column button,
.pb-phases button {
  background: none;
  border: none;
  color: var(--text-muted, #8a8b94);
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.pb-column button:disabled { opacity: 0.3; cursor: default; }
.pb-column button:hover:not(:disabled) { color: var(--text, #fff); }
.pb-col-del:hover, .pb-phase-del:hover { color: var(--danger-text) !important; }

.pb-phase-n {
  width: 20px;
  font-size: 11px;
  color: var(--text-muted, #8a8b94);
  text-align: right;
}
.pb-phase-name { flex: 1; }

/* FRG-V2 D-04 — a phase that carries gates or locks says so. The builder
   cannot author them yet, so this badge is the only thing telling an author
   that the row is more than its name. */
.pb-phase-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--brand-text, #a5a0e8);
  background: var(--brand-faint);
  border: 1px solid var(--border, #2a2b36);
  white-space: nowrap;
}

.pb-add { display: flex; gap: 6px; margin-top: 8px; }
.pb-add input { flex: 1; }
.pb-add button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--border, #2a2b36);
  border-radius: 6px;
  color: var(--text-muted, #8a8b94);
  cursor: pointer;
  font-size: 12px;
  padding: 6px 10px;
}
.pb-add button:hover { color: var(--text, #fff); border-color: var(--brand); }

.pb-scope-title {
  margin: 12px 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #8a8b94);
}

/* The AC's fourth line, made visible: what is wrong, all of it, before save. */
.pb-problems {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid var(--danger, #f85149);
  border-radius: 8px;
  background: rgba(248, 81, 73, 0.06);
  color: var(--text, #fff);
  font-size: 13px;
}
.pb-problems ul { margin: 6px 0 0; padding-left: 18px; }
.pb-problems li { line-height: 1.6; }

.pb-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border, #2a2b36);
}
.pb-back, .pb-save {
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  border: 1px solid var(--border, #2a2b36);
  background: none;
  color: var(--text, #fff);
}
.pb-save {
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 600; color: var(--on-brand); }
.pb-save:disabled { opacity: 0.45; cursor: not-allowed; }

.pb-loading, .pb-error { padding: 24px; color: var(--text-muted, #8a8b94); font-size: 14px; }
.pb-error { color: var(--danger-text); }
/* FAW-321 — the Admin board summary strip.
   Who is working on what, how many overdue, how many due this week, how many
   waiting on someone. Sits above the board and is absent entirely on shapes
   that do not use the completion-and-workload reporting model. */
.kanban-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin: 0 0 12px;
  background: var(--panel, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.kanban-summary .ks-counts { display: flex; gap: 18px; align-items: center; }
.kanban-summary .ks-stat { display: flex; align-items: baseline; gap: 6px; }
.kanban-summary .ks-n { font-size: 16px; font-weight: 600; color: var(--text); }
.kanban-summary .ks-l { color: var(--text-muted); }
/* Zero stays neutral: a count of nothing is good news and should not shout. */
.kanban-summary .ks-stat.bad .ks-n { color: var(--danger-text); }
.kanban-summary .ks-stat.warn .ks-n { color: var(--warn-text); }
.kanban-summary .ks-people {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  color: var(--text-muted);
}
.kanban-summary .ks-person {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.kanban-summary .ks-person b { color: var(--text); margin-left: 2px; }
.kanban-summary .ks-empty { font-style: italic; }

/* ── FAW-347: the pipeline surface ─────────────────────────────────
   It looks like a board and behaves differently, and the column header is
   where that first shows: count AND value, because a pipeline column hiding
   the one deal worth more than the other nineteen is the failure this shape
   exists to prevent. */
.pipeline-page { padding: 12px 16px 24px; }
.pl-loading, .pl-empty { color: var(--text-muted); font-size: 13px; padding: 24px 0; }

.pl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pl-modes { display: flex; gap: 4px; }
.pl-mode {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer;
}
.pl-mode.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pl-head .pl-export { margin-left: auto; }

.pl-overdue-count {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: #fdecec; color: #a12020;
}

.pl-filters {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 8px;
}
.pl-filters label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-muted); }
.pl-filters select, .pl-filters input {
  padding: 4px 7px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--bg); color: var(--text); font-size: 12.5px; min-width: 108px;
}

.pl-board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; }
.pl-col {
  flex: 0 0 268px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-subtle, rgba(127,127,127,.04)); display: flex; flex-direction: column;
}
/* A terminal column is where things stop. Muted so the eye rests on the ones
   still in play. */
.pl-col-terminal { opacity: .88; }
.pl-col-head { padding: 9px 11px; border-bottom: 1px solid var(--border); }
.pl-col-name { font-weight: 700; font-size: 13px; }
.pl-col-figures { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.pl-col-count {
  font-size: 11.5px; font-weight: 700; color: var(--text-muted);
  background: var(--border); border-radius: 999px; padding: 1px 7px;
}
.pl-col-value { font-size: 12px; font-weight: 600; color: var(--text); }

.pl-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 48px; }
.pl-cards.over { background: color-mix(in srgb, var(--brand) 7%, transparent); border-radius: 6px; }

.pl-card {
  background: var(--bg); border: 1px solid var(--border); border-left: 3px solid transparent;
  border-radius: 6px; padding: 8px 10px; cursor: grab; font-size: 12.5px;
}
.pl-card.dragging { opacity: .5; }
.pl-card-title { font-weight: 600; margin-bottom: 2px; }
.pl-card-cp { color: var(--text-muted); font-size: 11.5px; }
.pl-card-figures { display: flex; gap: 8px; margin-top: 5px; align-items: baseline; }
.pl-card-value { font-weight: 700; }
.pl-card-prob { color: var(--text-muted); font-size: 11.5px; }
.pl-card-foot {
  display: flex; justify-content: space-between; gap: 8px; margin-top: 6px;
  font-size: 11px; color: var(--text-muted);
}

/* Overdue: past the expected close date WHILE STILL OPEN. Marked on the left
   edge and on the date itself, and the card carries the day count in its
   title — colour alone would leave this invisible to anybody who cannot
   distinguish it, and "how late" is the part that decides what to do. */
.pl-card-overdue { border-left-color: #d64545; }
.pl-card-close.overdue { color: #a12020; font-weight: 700; }

.pl-list-wrap { overflow-x: auto; }
.pl-list { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pl-list th, .pl-list td {
  text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.pl-list th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.pl-list th.right, .pl-list td.right { text-align: right; }
.pl-row-overdue td:first-child { box-shadow: inset 3px 0 0 #d64545; }

html[data-theme="dark"] .pl-overdue-count { background: var(--danger-tint); color: #f0a0a0; }
html[data-theme="dark"] .pl-card-close.overdue { color: #f0a0a0; }

/* FAW-322 — ageing in waiting, on the card.
   Tiered by age: one day blocked and a month blocked need different
   reactions, and a flat marker would hide the one that matters. */
.task-card .waiting-badge {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 3px 8px;
  border-radius: 4px; font-size: 11px;
  background: rgba(168, 85, 247, 0.10);
  color: var(--text-muted, #8a8b94);
}
.task-card .waiting-badge .wb-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #a855f7; flex: none;
}
.task-card .waiting-badge .wb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card .waiting-badge.ageing { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.task-card .waiting-badge.ageing .wb-dot { background: var(--warn); }
.task-card .waiting-badge.stale { background: rgba(226, 75, 74, 0.14); }
.task-card .waiting-badge.stale .wb-dot { background: #E24B4A; }
.task-card .waiting-badge.stale .wb-text { color: var(--danger-text); }

/* ── FAW-349: the pipeline overview dashboard ──────────────────────
   "A pipeline project opens on the numbers." Four panels, each of which links
   through to the list behind it — a number you cannot click is a number you
   have to take on trust. */
.pl-panels {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}
.pl-panel {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  background: var(--bg-subtle, rgba(127,127,127,.03));
}
.pl-panel > header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pl-panel h3 { margin: 0; font-size: 13px; font-weight: 700; }
.pl-panel h4 {
  margin: 10px 0 4px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.pl-panel-count {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: #fdecec; color: #a12020; border-radius: 999px; padding: 1px 8px;
}
.pl-drill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 3px;
  background: transparent; border: none; cursor: pointer;
  font-size: 11px; font-weight: 600; color: var(--brand-text); padding: 0;
}
.pl-drill:hover { text-decoration: underline; }

.pl-panel-totals { display: flex; gap: 18px; margin-bottom: 8px; }
.pl-panel-totals > div { display: flex; flex-direction: column; }
.pl-fig { font-size: 18px; font-weight: 700; line-height: 1.1; }
.pl-panel-totals small { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.pl-mini { width: 100%; border-collapse: collapse; font-size: 12px; }
.pl-mini td, .pl-mini th { padding: 3px 4px; border-bottom: 1px solid var(--border); }
.pl-mini th { font-size: 10.5px; text-transform: uppercase; color: var(--text-muted); text-align: left; }
.pl-mini td.right, .pl-mini th.right { text-align: right; }
.pl-none { font-size: 12px; color: var(--text-muted); font-style: italic; margin: 4px 0; }

.pl-att { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.pl-att li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.pl-att-title { font-weight: 600; }
.pl-att-meta { display: flex; gap: 8px; color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.pl-att-late { color: #a12020; font-weight: 700; }
/* Quiet is not late. Distinguished from overdue on purpose: a deal nobody has
   touched is a different problem from one whose date has passed, and the panel
   loses its point if they look the same. */
.pl-att-quiet { color: #8a6d1f; font-weight: 700; }

.pl-out-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pl-won { color: #14653a; }
.pl-lost { color: #a12020; }
.pl-loss-dist { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.pl-loss-row { display: grid; grid-template-columns: 1fr 80px 24px; align-items: center; gap: 6px; font-size: 11.5px; }
.pl-loss-bar { background: var(--border); border-radius: 3px; height: 6px; overflow: hidden; }
.pl-loss-bar i { display: block; height: 100%; background: #d64545; }

html[data-theme="dark"] .pl-panel-count { background: var(--danger-tint); color: #f0a0a0; }
html[data-theme="dark"] .pl-att-late { color: #f0a0a0; }
html[data-theme="dark"] .pl-att-quiet { color: #e8c766; }
html[data-theme="dark"] .pl-won { color: #6ee7a8; }
html[data-theme="dark"] .pl-lost { color: #f0a0a0; }
/* FAW-323 — create from template.
   The preview is the point: instantiating makes several tasks appear at once,
   and a user who cannot see what is about to happen will not use it twice. */
.tp-modal { max-width: 760px; width: 92vw; }
.tp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.tp-head h3 { margin: 0; font-size: 15px; }
.tp-close { background: none; border: 0; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.tp-body { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 0; }
.tp-list { border-right: 1px solid var(--border); max-height: 50vh; overflow-y: auto; }
.tp-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 14px; background: none; border: 0; border-bottom: 1px solid var(--border);
  color: var(--text); text-align: left; cursor: pointer; font-size: 13px;
}
.tp-item:hover { background: rgba(255, 255, 255, 0.04); }
.tp-item.selected { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.tp-item .tp-name { flex: 1; }
.tp-item .tp-count { color: var(--text-muted); font-size: 11px; }
.tp-item .tp-scope { font-size: 10px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 6px; }
.tp-detail { padding: 14px 18px; max-height: 50vh; overflow-y: auto; }
.tp-preview { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 10px; }
.tp-preview th { text-align: left; color: var(--text-muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.tp-preview td { padding: 5px 6px; border-bottom: 1px solid var(--border); }
.tp-empty { padding: 24px 18px; }
.tp-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.tpl-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.tpl-table th { text-align: left; color: var(--text-muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tpl-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tpl-actions { text-align: right; white-space: nowrap; }

/* FAW-324 — checklist progress on the board card.
   A count and a bar, not a list: the card says how much is left, the task
   detail says what. Absent entirely where there is no checklist. */
.task-card .checklist-progress {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 11px; color: var(--text-muted, #8a8b94);
}
.task-card .checklist-progress .cp-bar {
  flex: 1; height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.08); overflow: hidden;
}
.task-card .checklist-progress .cp-fill {
  height: 100%; background: #6b7280; border-radius: 2px;
  transition: width 120ms ease;
}
.task-card .checklist-progress.complete .cp-fill { background: #22c55e; }
.task-card .checklist-progress.complete .cp-count { color: var(--success-text); }
.task-card .checklist-progress .cp-count { flex: none; font-variant-numeric: tabular-nums; }

/* FAW-325 — approval on the board card.
   Absent for the overwhelming majority of tasks; a badge on every card would
   bury the ones actually waiting on a person. */
.task-card .approval-badge {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 3px 8px;
  border-radius: 4px; font-size: 11px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--text-muted, #8a8b94);
}
.task-card .approval-badge .ab-mark { color: var(--warn-text); flex: none; font-size: 10px; }
.task-card .approval-badge .ab-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 2026-10-14 — the sign-off gate a card waits at. Warn-tinted when it is you,
   or when nobody holds the role (then the work cannot move). */
.task-card .gate-badge {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 3px 8px;
  border-radius: 4px; font-size: 12px;
  background: var(--surface-2, rgba(127, 127, 127, 0.12));
  color: var(--text-muted);
}
.task-card .gate-badge .gb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card .gate-badge.gate-you { background: var(--warn-tint); color: var(--text); font-weight: 600; }
.task-card .gate-badge.gate-none { background: var(--warn-tint); color: var(--warn-text); font-weight: 600; }
.gate-roles-modal { padding: 18px 20px; gap: 12px; max-width: 520px; }
.gate-roles-modal h3 { margin: 0; font-size: 16px; }
.gate-roles-intro { margin: 0; font-size: 13px; color: var(--text-muted); }
.gate-roles-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gate-roles-table th, .gate-roles-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.gate-roles-table td:not(:first-child), .gate-roles-table th:not(:first-child) { text-align: center; width: 120px; }
.gate-roles-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* The sign-off panel on a ticket. */
.gate-panel { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: grid; gap: 8px; }
.gate-panel.gate-panel-yours { border-color: var(--accent); }
.gate-panel h4 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.gate-panel .gp-status { font-size: 14px; }
.gate-panel .gp-commit { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.gate-panel textarea { width: 100%; min-height: 60px; font: inherit; font-size: 13px; }
.gate-panel .gp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* The project manager sends back by answering three questions the agent reads verbatim. */
.gate-panel .gp-sendback { display: grid; gap: 6px; }
.gate-panel .gp-sendback-lead { font-size: 13px; color: var(--text-muted); }
.gate-panel .gp-q { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.gate-panel .gp-q input { width: 100%; font: inherit; font-size: 13px; min-width: 0; }
.gate-panel .gp-thin { font-size: 12px; color: var(--warning, #b45309); }
@media (max-width: 600px) { .gate-panel .gp-q { grid-template-columns: 1fr; gap: 2px; } }
.gate-panel .gp-history { margin: 0; padding-left: 18px; font-size: 12px; color: var(--text-muted); display: grid; gap: 2px; }
.gate-panel .gp-cancelled { text-decoration: line-through; }
.gate-panel .gp-change { display: grid; gap: 4px; }
.gate-panel .gp-change-missing { color: var(--warn-text); font-weight: 600; font-size: 13px; }
.gate-panel .gp-change-sum { font-size: 13px; }
.gate-panel .gp-file summary { cursor: pointer; font-size: 13px; padding: 2px 0; }
.gate-panel .gp-diff { margin: 4px 0 0; padding: 8px; max-height: 420px; overflow: auto; font-size: 12px; line-height: 1.45;
  background: var(--surface-2, rgba(127, 127, 127, 0.08)); border-radius: 6px; white-space: pre; }
.gate-panel .gd-add { color: var(--success); }
.gate-panel .gd-del { color: var(--danger, #c0392b); }
.gate-panel .gd-hunk { color: var(--text-muted); }
.gate-panel .gp-nosign { font-size: 13px; color: var(--text-muted); align-self: center; }
/* The reviewer's plain-English account: what the project manager reads. */
.gate-panel .gp-review { display: grid; gap: 10px; }
.gate-panel .gp-review-part h5 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.gate-panel .gp-review-part p { margin: 0; font-size: 14px; line-height: 1.5; }
.gate-panel .gp-words, .gate-panel .gp-criteria { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; line-height: 1.5; }
.gate-panel .gp-criteria .gp-met strong { color: var(--success); }
.gate-panel .gp-criteria .gp-notmet strong { color: var(--danger, #c0392b); }
.gate-panel .gp-why { font-size: 13px; color: var(--text-muted); }
.gate-panel .gp-reviewer { margin: 0; font-size: 12px; color: var(--text-muted); }
.gate-panel .gp-code > summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.task-card .approval-badge.approved { background: rgba(34, 197, 94, 0.12); }
.task-card .approval-badge.approved .ab-mark { color: var(--success-text); }
.task-card .approval-badge.approved .ab-text { color: var(--success-text); }

/* ── FAW-370 — library preset toggles (Settings → Workspace) ──────── */

.lib-preset {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}
.lib-preset:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.03));
  border-color: var(--border, #2a2b36);
}
.lib-preset input { margin-top: 3px; }
.lib-preset-main { display: flex; flex-direction: column; gap: 3px; }
.lib-preset-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #fff);
}
/* The shape is what actually distinguishes one preset from another, so it
   sits beside the name rather than in the description nobody reads twice. */
.lib-preset-shape {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #8a8b94);
  border: 1px solid var(--border, #2a2b36);
  border-radius: 4px;
  padding: 1px 5px;
}
.lib-preset-retired {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warning, #d29922);
  border: 1px solid var(--warning, #d29922);
  border-radius: 4px;
  padding: 1px 5px;
}
.lib-preset-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted, #8a8b94);
}

/* ═══════════════════════════════════════════════════════════════════
   FAW-401/404/405/406/410 — the dashboard metric row.

   One shared component set (FAW-406), so the row reads as designed
   rather than assembled. Every colour here is a token: the surface,
   the ink and the state tints all shift with the theme, and nothing
   below hardcodes a literal.
   ═══════════════════════════════════════════════════════════════════ */

/* ── The period toggle (FAW-401) ─────────────────────────────────── */

.period-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.period-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.period-btn:hover { color: var(--text); background: var(--bg-hover); }

.period-btn.is-active {
  background: var(--brand);
  color: var(--on-brand);
}

/* ── The shared metric block (FAW-406) ───────────────────────────── */

.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  align-items: stretch;
}

/* The two graph treatments need room to be read; the numeric ones do not.
   This is the "one third graphs, two thirds numeric" ratio expressed in
   layout rather than left to whoever adds the next block. */
.metric-block-wide { grid-column: span 2; }

@media (max-width: 900px) {
  .metric-block-wide { grid-column: span 1; }
}

.metric-block {
  /* A button, not a div: FAW-406 requires every block to click through, and
     a button gets keyboard focus and Enter for free. */
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.metric-block:hover {
  border-color: var(--brand-soft);
  box-shadow: var(--shadow-sm);
}

.metric-block:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.mb-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.mb-figure { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.mb-value {
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* ── The delta chip ──────────────────────────────────────────────── */

.mb-delta {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.mb-delta-good { background: var(--success-tint); color: var(--success-text); }
.mb-delta-bad { background: var(--danger-tint); color: var(--danger-text); }
.mb-delta-flat { background: var(--neutral-tint); color: var(--text-muted); }

/* Absent data is styled as absent, not as a neutral result. */
.mb-delta-none {
  background: transparent;
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
  padding-left: 0;
}

/* ── Sparkline and trend ─────────────────────────────────────────── */

.mb-spark {
  width: 100%;
  height: 24px;
  color: var(--brand-text);
  opacity: 0.85;
}

.mb-trend { width: 100%; height: 48px; }
.mb-trend-fill { fill: var(--brand-faint); }
.mb-trend-line { stroke: var(--brand-text); }

.mb-empty {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  padding: 12px 0;
}

/* ── Sub-counts and breakdowns ───────────────────────────────────── */

.mb-subs, .mb-breaks { display: flex; flex-wrap: wrap; gap: 4px 12px; }

.mb-sub, .mb-break {
  font-size: 12px;
  color: var(--text-muted);
}

.mb-sub b, .mb-break b { color: var(--text); font-variant-numeric: tabular-nums; }

.mb-sub-absent { font-style: italic; opacity: 0.75; }

.mb-break {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--neutral-tint);
}

/* The breakdown kinds are distinguished by tint, but every one of them also
   carries its own status name as text — the colour is reinforcement, never
   the only carrier of the distinction. */
.mb-break-waiting { background: var(--warn-tint); color: var(--warn-text); }
.mb-break-waiting b { color: var(--warn-text); }
.mb-break-approval { background: var(--info-tint); color: var(--text); }

/* ── The block footer: period, basis, ruling ─────────────────────── */

.mb-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.mb-period { font-size: 11px; color: var(--text-muted); }

.mb-ruling {
  appearance: none;
  border: 0;
  background: var(--brand-faint);
  color: var(--brand-text);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-mono);
}

.mb-ruling:hover { background: var(--brand-subtle); }

.mb-basis { font-size: 11px; color: var(--text-muted); line-height: 1.35; }

/* ── The actor bar chart (FAW-404) ───────────────────────────────── */

.mb-bars { display: flex; flex-direction: column; gap: 5px; width: 100%; }

.mb-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 34%) 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.mb-bar-name {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Humans and agents share one chart and one measure — that comparability is
   the point of FAW-404. The dot and the "agent" label distinguish them
   without splitting the chart in two. */
.mb-actor-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex: none;
}

.mb-actor-human { background: var(--brand); }
.mb-actor-agent { background: var(--accent); border-radius: 50%; }

.mb-actor-kind {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mb-bar-track {
  height: 8px;
  background: var(--neutral-tint);
  border-radius: 999px;
  overflow: hidden;
}

.mb-bar-fill { display: block; height: 100%; border-radius: 999px; }
.mb-bar-human { background: var(--brand); }
.mb-bar-agent { background: var(--accent); }

.mb-bar-value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 24px;
  text-align: right;
}

/* ── The attention strip (FAW-410) ───────────────────────────────── */

.attention-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.att-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  appearance: none;
  cursor: pointer;
  font: inherit;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color 0.12s ease;
}

.att-item:hover { border-color: var(--brand-soft); }

.att-item:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.att-count {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.att-label { font-size: 12px; font-weight: 600; }

/* Severity by tint, but each chip always carries its own label, so the
   ordering is never carried by colour alone. */
.att-overdue { background: var(--danger-tint); border-color: var(--danger-faint); }
.att-overdue .att-count { color: var(--danger-text); }
.att-over_estimate { background: var(--warn-tint); border-color: var(--warn-tint); }
.att-over_estimate .att-count { color: var(--warn-text); }
.att-no_deadline { background: var(--neutral-tint); }
.att-stale { background: var(--violet-tint); }

/* ── The ruling popover (FAW-414) ────────────────────────────────── */

.ruling-pop {
  position: absolute;
  z-index: 60;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ruling-q { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.ruling-a { font-size: 14px; color: var(--text); font-weight: 700; line-height: 1.35; }
.ruling-why { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

.ruling-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ruling-provisional {
  background: var(--warn-tint);
  color: var(--warn-text);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.ruling-confirmed {
  background: var(--success-tint);
  color: var(--success-text);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.ruling-by { font-size: 11px; color: var(--text-muted); font-style: italic; line-height: 1.4; }

/* The breakdown's snapshot label — see numericBlock(). A per-status
   breakdown taken NOW sits under a headline averaged over the period, so it
   says which it is rather than looking like an arithmetic error. */
.mb-break-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  align-self: center;
}

/* ═══════════════════════════════════════════════════════════════════
   FAW-407/408/409/411/412 — the dashboard project table.

   Health leads the row, Progress adapts to the preset's shape,
   Environments and Repository collapse into Links, and hours read as
   a bar. Tokens throughout, in both themes.
   ═══════════════════════════════════════════════════════════════════ */

/* ── FAW-407 — the health pill ───────────────────────────────────── */

.health-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Every state carries its own WORD. The tint is reinforcement, never the
   only carrier — a red/green pair is invisible to a good share of readers,
   and "Overdue 90d" is legible to all of them. */
.health-overdue { background: var(--danger-tint); color: var(--danger-text); }
.health-at_risk { background: var(--warn-tint); color: var(--warn-text); }
.health-on_track { background: var(--success-tint); color: var(--success-text); }

/* "No deadline set" is deliberately NEUTRAL, not green. It is an absence of
   information, not a good sign — FAW-407 is explicit that it must not read
   as On Track, and colouring it green is exactly how it would. */
.health-no_deadline {
  background: var(--neutral-tint);
  color: var(--text-muted);
  font-style: italic;
}

/* ── FAW-408 — the adaptive Progress cell ────────────────────────── */

.prog-label {
  display: block;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.prog-track {
  display: block;
  height: 3px;
  margin-top: 4px;
  background: var(--neutral-tint);
  border-radius: 999px;
  overflow: hidden;
  max-width: 190px;
}

.prog-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ── FAW-411 — hours as a variance bar ───────────────────────────── */

.hours-bar { display: flex; align-items: center; gap: 7px; white-space: nowrap; }

.hours-track {
  display: block;
  width: 62px;
  height: 8px;
  background: var(--neutral-tint);
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}

.hours-fill { display: block; height: 100%; background: var(--success); border-radius: 999px; }

/* Past 100%. The percentage label alongside carries the same information as
   text, so "over" is never communicated by the colour alone. */
.hours-bar.is-over .hours-fill { background: var(--danger); }
.hours-bar.is-over .hours-pct { color: var(--danger-text); font-weight: 700; }

.hours-pct {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* No estimate is visually distinct from zero logged — a bar at 0% would
   assert that an estimate exists (FAW-411). */
.hours-none { font-size: 12px; color: var(--text-muted); font-style: italic; white-space: nowrap; }

/* ── FAW-409 — the Links column ──────────────────────────────────── */

.link-chips { display: flex; flex-wrap: wrap; gap: 4px; }

.link-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--brand-text);
  cursor: pointer;
  font-family: inherit;
}

.link-chip:hover { border-color: var(--brand-soft); text-decoration: none; }

.link-chip-access { color: var(--text-muted); }

/* HAT-HVH-0000385 — the assistant's photo control, beneath the icon set.
   Tokens throughout so it holds in both themes; the preview reuses the same
   avatar markup the sidebar draws, so what you see here is what you get. */
.pa-photo { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.pa-photo-preview { flex: 0 0 auto; display: flex; }
.pa-photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.pa-photo-hint {
  flex-basis: 100%;
  font-size: 11px;
  color: var(--text-muted);
}
/* Removal is the quieter of the two — it undoes rather than adds, and it is
   hidden entirely when there is no photo to remove. */
.pa-photo-remove { color: var(--danger-text); }

/* HAT-HVH-0000381 — the "no agents set up for this project" offer.
   Every colour is a token so it holds in both themes; the primary option
   takes the brand fill with --on-brand ink, which is derived from the
   workspace's own colour rather than assumed white. */
.pas-modal { max-width: 520px; }
.pas-body { display: flex; flex-direction: column; gap: 10px; }
.pas-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.pas-option:hover { border-color: var(--brand); }
.pas-option:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pas-option.pas-primary {
  background: var(--brand);
  color: var(--on-brand);
  border-color: var(--brand);
}
.pas-option.pas-primary:hover { background: var(--brand-hover); }
.pas-ico { display: inline-flex; flex: 0 0 auto; margin-top: 1px; }
.pas-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pas-text strong { font-weight: 700; }
/* The help line is load-bearing, not decoration — "agents only" read as a
   bare label says the opposite of what it means — so it is always visible
   and never dimmed past readability. */
.pas-text span { font-size: 12px; opacity: 0.85; }

/* HAT-HVH-0000359 — the section heading above the project filters.
   Sized between the page h2 and body text: it divides two regions of one
   page, so it should read as a separator rather than compete with the page
   title. Colour comes from --text, which both themes declare. */
.dash-section-h {
  margin: 22px 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* ── FRG-D18 — the panels that replaced the project list ─────────────
   Work stream shape, the agent workforce and the intake queue. Tokens
   only: a literal colour here would be right in one theme and wrong in
   the other, which is the rule .dash-section-h above already follows. */
.dash-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}

/* ── FAW-412 — the filter bar ────────────────────────────────────── */

.dash-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.dash-filter-spacer { flex: 1 1 auto; }

.dash-filter,
.dash-filter-search {
  appearance: none;
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.dash-filter-search { min-width: 190px; }

.dash-filter:focus-visible,
.dash-filter-search:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.dash-filter-clear,
.dash-filter-save {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.dash-filter-clear:hover,
.dash-filter-save:hover { border-color: var(--brand-soft); color: var(--text); }

.dash-filter-save { color: var(--brand-text); background: var(--brand-faint); border-color: transparent; }

/* ── The shared list layer (UI modernisation, 2026-09-28) ────────────
   util/ui-list.js. One page head, one filter bar, one row, one badge, one
   "⋯" (Today's .tdy-menu). Workflows is its first screen; the project
   sub-screens move onto it rather than each keeping a table of their own.
   Rules: docs/audits/ui-audit-2026-09-28.md §2.2. Nothing under 12px; 44px
   targets on touch; state never shown by opacity. */
.ui-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ui-head-text { min-width: 0; }
.ui-title { margin: 0; font-size: 22px; font-weight: 650; line-height: 1.25; color: var(--text); }
.ui-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ui-sub:empty { display: none; }
.ui-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.ui-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ui-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-search {
  flex: 1 1 260px; max-width: 420px; min-width: 0; min-height: 36px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-muted); cursor: text;
}
.ui-search:focus-within { border-color: var(--brand-text); box-shadow: 0 0 0 1px var(--brand-text); }
.ui-search-icon { display: inline-flex; flex: none; }
.ui-search-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 14px; }
.ui-search-input::placeholder { color: var(--text-muted); opacity: 1; }
.ui-filter-toggle, .ui-filter-clear { flex: none; }
.ui-filter-toggle[aria-expanded="true"] { border-color: var(--brand-text); }
.ui-count {
  min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700;
}
.ui-count[hidden], .ui-filter-clear[hidden], .ui-filter-panel[hidden] { display: none; }
.ui-filter-panel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.ui-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ui-field-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.ui-select {
  min-height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
.ui-select:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 1px; }
.ui-check { flex-direction: row; align-items: center; gap: 8px; min-height: 36px; align-self: end; cursor: pointer; font-size: 14px; color: var(--text); }
.ui-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }

.ui-list {
  margin: 0; padding: 4px; list-style: none; display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.ui-row {
  position: relative; min-height: 44px; display: flex; align-items: center; gap: 12px;
  padding: 6px 6px 6px 12px; border-radius: 8px; cursor: pointer;
}
.ui-row:hover, .ui-row:focus-within { background: var(--row-tint); }
.ui-row:focus-visible { outline: none; background: var(--row-tint); box-shadow: inset 3px 0 0 var(--brand-text); }
.ui-row-lead { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; }
.ui-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ui-row-title { font-size: 15px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-row-title a { color: inherit; text-decoration: none; }
.ui-row-title a:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 4px; }
.ui-row-meta {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; row-gap: 0;
  font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.ui-row-meta > * { white-space: nowrap; }
/* The separator is CSS, with empty alt text so a screen reader does not say "dot". */
.ui-row-meta > * + *::before { content: "·" / ""; margin-right: 6px; color: var(--text-muted); font-weight: 400; }
.ui-row-trail { flex: none; display: flex; align-items: center; gap: 6px; }
.ui-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.ui-dot.is-danger { background: var(--danger); }
.ui-dot.is-warn { background: var(--warning); }
.ui-dot.is-success { background: var(--success); }
.ui-strong { color: var(--text); }
.ui-meta-danger { color: var(--danger-text); font-weight: 600; }
.ui-meta-warn { color: var(--warn-text); font-weight: 600; }

.ui-badge {
  display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-tint); color: var(--neutral-ink);
}
.ui-badge.is-success { background: var(--success-tint); color: var(--success-ink); }
.ui-badge.is-warn { background: var(--warn-tint); color: var(--warn-ink); }
.ui-badge.is-danger { background: var(--danger-tint); color: var(--danger-ink); }
.ui-badge.is-info { background: var(--info-tint); color: var(--info-ink); }
.ui-badge.is-brand { background: var(--row-tint); color: var(--brand-text); }

.ui-empty-icon { display: inline-flex; color: var(--text-muted); margin-bottom: 4px; }
.ui-empty .dash-btn { margin-top: 8px; }

/* "⋯" outside Today: its hover tint is Today's variable, which only exists
   inside .tdy. Everywhere else it falls back to the shared token. */
.tdy-menu-item:hover, .tdy-menu-item:focus-visible { background: var(--tdy-tint, var(--row-tint)); }
.tdy-menu a.tdy-menu-item { text-decoration: none; }
.tdy-menu.is-up { top: auto; bottom: calc(100% + 4px); }
/* Items space icon and label with gap; the global "button [data-lucide] + *"
   margin added 4px more to button items only, so they sat out of line with links. */
.tdy-menu-item [data-lucide] + * { margin-left: 0; }

@media (max-width: 768px), (hover: none) {
  .ui-row { min-height: 52px; padding-left: 10px; }
  .ui-row .tdy-icon-btn, .ui-filter-toggle, .ui-filter-clear { min-width: 44px; min-height: 44px; }
  .ui-search, .ui-select, .ui-check { min-height: 44px; }
  .tdy-menu a.tdy-menu-item, .ui-row .tdy-menu-item { min-height: 44px; }
}
@media (max-width: 768px) {
  /* #view already gives a phone 16px each side; .page-shell's 24px on top of
     it left 40px. A page on the shared layer uses the 16px alone. */
  .ui-page { padding: 12px 0 24px; }
  .ui-row-meta .ui-wide { display: none; }
  .ui-head { margin-bottom: 12px; }
  .ui-title { font-size: 20px; }
  /* Search and the Filters chip share one line: the list starts a row higher. */
  .ui-search { max-width: none; flex-basis: 0; }
  .ui-filter-panel { grid-template-columns: 1fr 1fr; }
}

/* ── Layer extensions (2026-09-29): what the project sub-screens (Tickets,
   Drive, Reports, Time, Git trail, API testing) need that the first screens
   did not. All additive: a row that uses none of them renders as before. ── */
/* A quiet sentence under the meta line, two lines at most. */
.ui-row-detail {
  font-size: 13px; line-height: 1.45; color: var(--text-muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* A value kept at the right edge on every screen size; a phone never hides it. */
.ui-row-aside { flex: none; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ui-row-aside strong { font-size: 14px; font-weight: 650; color: var(--text); }
/* A row that opens nothing: no pointer, and no hover tint unless its "⋯" has focus. */
.ui-row.is-static { cursor: default; }
.ui-row.is-static:hover:not(:focus-within) { background: none; }
.ui-row > [data-ui-menu] { flex: none; }
/* listHtml(..., { trailBelow: true }): on a phone the trail wraps under the
   title, aligned with it, and the "⋯" stays on the first line. At 375px two
   badges beside the title left it 85px wide. */
@media (max-width: 768px) {
  .ui-list.is-trail-below .ui-row { flex-wrap: wrap; row-gap: 6px; }
  .ui-list.is-trail-below .ui-row-main { flex: 1 1 0; }
  .ui-list.is-trail-below .ui-row > [data-ui-menu] { order: 2; }
  .ui-list.is-trail-below .ui-row-trail { order: 3; flex: 1 0 100%; flex-wrap: wrap; padding-left: 28px; }
}
/* A destructive menu entry, in the danger ink (measured on the hovered item). */
.tdy-menu-item.is-danger, .tdy-menu-item.is-danger svg { color: var(--danger-ink); }

/* The one small form dialog (openFormModal). Labels are .ui-field-label;
   selects are .ui-select; text and textareas are .ui-input. */
.ui-input {
  width: 100%; min-height: 36px; padding: 7px 10px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px;
}
textarea.ui-input { min-height: 88px; resize: vertical; line-height: 1.5; }
.ui-input::placeholder { color: var(--text-muted); opacity: 1; }
.ui-input:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 1px; }
.ui-form .ui-select { width: 100%; }
.ui-form-modal { max-width: 560px; }
.ui-form-title { margin: 0; font-size: 18px; font-weight: 650; color: var(--text); }
.ui-form { padding: 18px 22px 22px; display: grid; gap: 14px; }
.ui-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ui-field-more summary { cursor: pointer; font-size: 13px; color: var(--text-muted); min-height: 32px; display: flex; align-items: center; }
.ui-field-more[open] summary { margin-bottom: 10px; }
.ui-form-note {
  display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px;
  border-radius: 8px; background: var(--info-tint); color: var(--text); font-size: 13px; line-height: 1.45;
}
.ui-form-note svg { color: var(--text-muted); flex: none; margin-top: 1px; }
.ui-form-note code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ui-form-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
/* A disabled primary must LOOK disabled: a neutral fill and muted ink, never
   opacity (opacity for state measured 2.47:1). */
.ui-form-foot .dash-btn:disabled {
  background: var(--surface-2); border-color: var(--border); color: var(--text-muted); cursor: not-allowed;
}
@media (max-width: 768px), (hover: none) {
  .ui-input { min-height: 44px; }
  .ui-form-foot .dash-btn { min-height: 44px; }
}
@media (max-width: 768px) {
  .ui-field-row { grid-template-columns: 1fr; }
  .ui-form { padding: 16px; }
}

/* ── The meeting popup (components/meeting-popup.js, 2026-10-03) ──
   BigJoe's five blocks: controls top right; title with the date under it; the
   join row; the guests with the reminder and calendar rows; Going? at the
   bottom. openFormModal with its toolbar and subtitle options. Every colour is
   a token: answers are .ui-badge kinds (measured in ui-list-contrast.test.ts),
   Going? is the calendar's .wks-views chip group. */
/* openFormModal's toolbar header (shared: any dialog that passes `toolbar`). */
.modal header.ui-form-head-stacked { display: block; padding: 10px 14px 14px 22px; }
.ui-form-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 2px; margin-bottom: 2px; }
.ui-form-toolbar .tdy-menu { right: 0; left: auto; }
.ui-form-heading { min-width: 0; }
.ui-form-subtitle { margin: 4px 0 0; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.mm-pop-modal { max-width: 480px; }
.mm-pop-modal .ui-form-title { font-size: 22px; overflow-wrap: anywhere; }
.mm-pop { display: grid; gap: 18px; min-width: 0; }
.mm-pop-block { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; column-gap: 14px; align-items: start; min-width: 0; }
.mm-pop-ico { display: inline-flex; padding-top: 6px; color: var(--text-muted); }
.mm-pop-join-main { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.mm-pop-join-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; }
/* The shared primary keeps --on-brand on its --brand-hover fill; the ink made
   FOR that fill is --on-brand-hover (white-label.js), so hover holds 4.5:1. */
.mm-pop-join-btn:hover, .mm-pop-join-btn:focus-visible { color: var(--on-brand-hover, var(--on-brand)); }
.mm-pop-link-text { font-size: 13px; color: var(--text); overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.mm-pop-copy { align-self: center; }
.mm-pop-copy:disabled { color: var(--text-muted); cursor: not-allowed; }
.mm-pop-status { margin: -10px 0 0 38px; font-size: 13px; font-weight: 600; color: var(--success-text); }
.mm-pop-status:empty { display: none; }
#mm-pop-door:not([hidden]) { margin-left: 38px; }
#mm-pop-door .ui-callout { margin: 0; }
.mm-pop-guests-main { min-width: 0; }
.mm-pop-count { margin: 4px 0 0; font-size: 15px; font-weight: 650; color: var(--text); }
.mm-pop-tally { margin: 2px 0 8px; font-size: 13px; color: var(--text-muted); }
.mm-pop .ui-row-lead { width: 28px; }
.mm-pop-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 700;
}
.mm-pop-guests .ui-list { max-height: min(320px, 40vh); overflow-y: auto; }
.mm-pop-guests .ui-row-title { white-space: normal; overflow-wrap: anywhere; }
.mm-pop-line { align-items: center; font-size: 14px; color: var(--text); }
.mm-pop-line .mm-pop-ico { padding-top: 0; }
/* 2026-10-20 — a meeting's minutes, with Try again when a run failed. */
.mm-pop-minutes-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mm-pop-minutes-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; color: var(--text); }
.mm-pop-minutes-open { font-weight: 600; }
.mm-pop-label { margin: 0; font-size: 14px; font-weight: 650; color: var(--text); }
.mm-pop-rsvp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 14px; border-top: 1px solid var(--border); }
/* --tdy-tint lives on the calendar page; a dialog hangs off <body>, so the
   pressed chip names the shared row tint itself. Ink stays var(--text). */
.mm-pop .wks-views { display: inline-flex; gap: 6px; }
.mm-pop .wks-views .tdy-chip { min-width: 64px; justify-content: center; }
.mm-pop .wks-views .tdy-chip[aria-pressed="true"] { background: var(--row-tint); border-color: var(--brand-text); color: var(--text); }
.mm-pop-answer { font-size: 13px; color: var(--text-muted); }
@media (max-width: 768px), (hover: none) {
  .mm-pop-join-btn, .mm-pop .wks-views .tdy-chip, .ui-form-toolbar .tdy-icon-btn, .mm-pop-copy { min-height: 44px; min-width: 44px; }
}
@media (max-width: 768px) {
  /* A phone: the sheet keeps 12px of the page each side, and stops above the
     bottom navigation so the last guest and Going? are never under it. */
  .modal-backdrop:has(> .mm-pop-modal) { padding: 12px 12px calc(68px + env(safe-area-inset-bottom)); }
  .modal header.ui-form-head-stacked { padding: 8px 10px 12px 16px; }
  .mm-pop-modal .ui-form-title { font-size: 20px; }
  .mm-pop-guests .ui-list { max-height: none; }
  /* The rows have no lead mark beyond the avatar, so the badge lines up with the name. */
  .mm-pop .ui-list.is-trail-below .ui-row-trail { padding-left: 38px; }
}

/* ── Shared callout (util/ui-list.js calloutHtml) ── */
.ui-callout {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 12px 14px;
  border: 1px solid transparent; border-radius: 10px; font-size: 14px; line-height: 1.5;
  background: var(--info-tint); color: var(--info-text);
}
.ui-callout-icon { flex: none; display: inline-flex; margin-top: 2px; }
.ui-callout-body { min-width: 0; color: var(--text); }
.ui-callout.is-warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn-text) 35%, transparent); color: var(--warn-text); }
.ui-callout.is-danger { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger-text) 35%, transparent); color: var(--danger-text); }
.ui-callout.is-success { background: var(--success-tint); color: var(--success-text); }
.ui-callout.is-danger strong, .ui-callout.is-warn strong { color: inherit; }

/* ── SOW (UI modernisation, 2026-09-28): the page frame on the shared layer.
   The phase forms inside keep their own markup (.sow-label/.sow-input). ── */
.sow-page { max-width: 960px; margin-inline: 0; }
.sow-page .btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.sow-page .btn [data-lucide] + *, .sow-page .btn svg + * { margin-left: 0; }
.sow-progress { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.sow-progress-line { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; font-size: 13px; color: var(--text-muted); }
.sow-progress-count { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.sow-progress-now strong { color: var(--text); font-weight: 600; }
.sow-progress-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.sow-progress-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.sow-steps { display: flex; gap: 4px; }
.sow-phase-pill {
  flex: 1 1 0; min-width: 0; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-muted);
  font: inherit; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
}
.sow-phase-pill:hover { border-color: var(--brand-text); color: var(--text); }
.sow-phase-pill.is-done { background: var(--success-tint); border-color: transparent; color: var(--success-text); }
.sow-phase-pill.is-current { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.sow-phase-pill.is-ready { color: var(--brand-text); }
.sow-phase-pill.is-locked { background: var(--surface-2); border-color: transparent; }

.sow-phases { gap: 0; padding: 0; overflow: hidden; }
.sow-phase + .sow-phase { border-top: 1px solid var(--border); }
.sow-phase-head {
  width: 100%; margin: 0; border: 0; border-radius: 0; background: transparent; color: inherit;
  font: inherit; text-align: left; padding: 10px 12px; min-height: 56px;
}
.sow-phase-head:focus-visible { outline: none; background: var(--row-tint); box-shadow: inset 3px 0 0 var(--brand-text); }
.sow-phase.is-open > .sow-phase-head { background: var(--row-tint); }
.sow-num {
  flex: none; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.sow-num.is-done { background: var(--success-tint); color: var(--success-text); }
.sow-num.is-open { background: var(--row-tint); color: var(--brand-text); }
.sow-num.is-locked { background: var(--surface-2); color: var(--text-muted); }
.sow-chevron { display: inline-flex; color: var(--text-muted); transition: transform .15s; }
.sow-phase.is-open .sow-chevron { transform: rotate(180deg); }
.sow-phase-body { padding: 16px; border-top: 1px solid var(--border); }
.sow-note, .sow-done { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.sow-note { color: var(--text-muted); }
.sow-done { color: var(--success-text); font-weight: 600; }
.sow-done-line { font-size: 13px; color: var(--text-muted); }
/* What an open phase still needs, listed before Mark complete. */
.sow-reqs { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }
.sow-reqs-head { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.sow-reqs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sow-reqs li { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.sow-reqs li.is-done { color: var(--success-text); }
.sow-stamp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.sow-stamp .sow-done { margin-right: 4px; }
.sow-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.sow-actions .sow-history-btn { margin-left: auto; }
.sow-add { width: 100%; justify-content: center; margin-top: 12px; border-style: dashed; color: var(--text-muted); }
.sow-grid { display: grid; gap: 12px; }
.sow-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sow-p7-link { margin: 0 0 16px; }
.sow-p7-link .btn { text-decoration: none; }
/* Status buttons, each fill with its own ink (the global .btn set had none). */
.btn.success { background: var(--success); border-color: var(--success); color: var(--on-success); }
.btn.success:hover { filter: brightness(1.05); }
.btn.danger-outline { background: transparent; border-color: var(--danger-text); color: var(--danger-text); }
.btn.danger-outline:hover { background: var(--danger-tint); }
.sow-add:hover { color: var(--text); }

@media (max-width: 768px), (hover: none) {
  .sow-phase-head { min-height: 60px; }
  .sow-page .btn { min-height: 44px; }
}
@media (max-width: 768px) {
  /* Thirteen 24px pills are not tap targets; on a phone the rows below are. */
  .sow-steps { display: none; }
  .sow-page .ui-head-actions { width: 100%; }
  .sow-page .ui-head-actions .btn { width: 100%; justify-content: center; }
  .sow-phase-head .ui-row-trail .ui-badge { display: none; }
  .sow-phase-body { padding: 12px; }
  .sow-grid-2 { grid-template-columns: 1fr; }
  .sow-actions .sow-history-btn { margin-left: 0; }
}

/* ── UI modernisation: Timeline (.tml-*), 2026-09-28 ────────────────────
   Owned by the Workflows/SOW/Board/List/Timeline/Sprints track. Additive: the
   old .timeline-wrap / .tl-row-label / #pan-* rules still apply. */
.tml-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.tml-nav { display: inline-flex; align-items: center; gap: 4px; }
.tml-range { margin-left: auto; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tml-note { padding: 12px 20px 0; }
.tml-note .ui-callout { margin: 0; }
.tml-page { padding: 24px 20px; }
.tml-grid { display: grid; min-width: max-content; }
.tml-labels { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--border); }
.tml-head { height: 44px; border-bottom: 1px solid var(--border); background: var(--surface); }
.tml-head-label { padding: 13px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tml-row {
  height: 40px; padding: 0 12px; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border); font-size: 13px; overflow: hidden; cursor: pointer;
}
.tml-row:hover { background: var(--row-tint); }
.tml-row:focus-visible { outline: none; background: var(--row-tint); box-shadow: inset 3px 0 0 var(--brand-text); }
.tml-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.tml-nodate { position: absolute; top: 0; height: 100%; display: flex; align-items: center; font-size: 12px; font-style: italic; color: var(--text-muted); white-space: nowrap; }
.tml-canvas { position: relative; }
.tml-ticks { position: relative; }
.tml-tick {
  position: absolute; top: 0; bottom: 0; padding: 14px 4px 0; border-left: 1px solid transparent;
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.tml-tick.is-labelled { border-left-color: var(--border); }
.tml-lane { position: relative; height: 40px; border-bottom: 1px solid var(--border); }
.tml-bar {
  position: absolute; top: 7px; height: 26px; padding: 0 8px; display: flex; align-items: center;
  border-radius: 6px; font-size: 12px; font-weight: 600; overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm);
}
.tml-bar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tml-bar .tl-resize { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; background: rgba(0, 0, 0, .18); }
.tml-milestone { position: absolute; top: 0; height: 40px; display: flex; align-items: center; gap: 6px; margin-left: -8px; cursor: pointer; white-space: nowrap; }
.tml-diamond { width: 14px; height: 14px; transform: rotate(45deg); border-radius: 3px; flex: none; }
.tml-milestone-text { font-size: 12px; color: var(--text); }
.tml-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--brand-text); pointer-events: none; z-index: 1; }
@media (max-width: 768px) {
  forge-timeline { --tml-label: 150px; }
  .tml-toolbar { padding: 10px 12px; }
  .tml-range { margin-left: 0; flex: 1 1 100%; }
  .tml-row, .tml-lane { height: 44px; }
  .tml-bar { top: 9px; }
  .tml-milestone { height: 44px; }
  .tml-note { padding: 10px 12px 0; }
  forge-timeline .view-toggle button { min-height: 44px; min-width: 52px; }
  /* The label column is 150px on a phone: the title is the part worth reading. */
  /* !important: renderAvatar() sets display inline on the wrapper. */
  .tml-row .avatar-wrap, .tml-row .ticket-id-inline { display: none !important; }
  /* An older phone rule sets flex-shrink: 0 on every label child, which cut
     titles off with no ellipsis. The title shrinks; the rest stays put. */
  .tml-row .tml-title { flex-shrink: 1; }
}

/* ── UI modernisation: Sprints (.spr-*), 2026-09-28 ──────────────────────
   Owned by the Workflows/SOW/Board/List/Timeline/Sprints track. Additive: the
   old .sprint-card rules are left for anything else that still uses them. */
.spr-page { max-width: 1100px; }
.spr-page .btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.spr-page .btn [data-lucide] + *, .spr-page .btn svg + * { margin-left: 0; }
.spr-page .ui-row-trail { gap: 12px; }
.spr-goal { max-width: 40ch; overflow: hidden; text-overflow: ellipsis; }
.spr-progress { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.spr-progress-text { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.spr-bar { display: block; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.spr-bar > span { display: block; height: 100%; background: var(--success); border-radius: inherit; }
.spr-back { margin-bottom: 12px; text-decoration: none; color: var(--text-muted); }
.spr-back:hover { color: var(--text); }
.spr-hero {
  display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; padding: 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.spr-hero.is-active { box-shadow: inset 4px 0 0 var(--success); }
.spr-hero-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.spr-hero-text { min-width: 0; }
.spr-hero-goal { margin: 4px 0 0; font-size: 14px; color: var(--text); }
.spr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.spr-hero .spr-progress { min-width: 0; }
.spr-hero .spr-bar { height: 8px; }
.spr-section { display: inline-flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.spr-count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; text-align: center; letter-spacing: 0; }
.spr-status { font-size: 12px; }
.spr-backlog > summary { cursor: pointer; list-style: none; }
.spr-backlog > summary::-webkit-details-marker { display: none; }
.spr-backlog > summary { display: flex; align-items: center; gap: 4px; }
.spr-chev { display: inline-flex; color: var(--text-muted); transition: transform .15s; }
.spr-backlog[open] .spr-chev { transform: rotate(90deg); }
.spr-modal { max-width: 480px; }
.spr-modal-title { font-size: 18px; font-weight: 650; }
.spr-modal-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.spr-input { width: 100%; min-height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; }
.spr-input:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 1px; }
.spr-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spr-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
@media (max-width: 768px), (hover: none) {
  .spr-page .btn, .spr-input { min-height: 44px; }
}
@media (max-width: 768px) {
  .spr-page .ui-row-trail .ui-badge { display: none; }
  .spr-page .ui-row-trail .spr-progress { min-width: 84px; }
  .spr-goal { display: none; }
  .spr-actions { width: 100%; }
  .spr-dates { grid-template-columns: 1fr; }
}

/* ===================================================================
 * FRG-211 — mobile touch targets and remaining overflow
 *
 * Last block in the file so it wins on order where an earlier rule sets
 * the same property at equal specificity. Everything here is scoped to
 * (max-width: 768px); desktop is untouched.
 *
 * The 44px figure is the usual thumb-target floor (Apple's HIG says 44pt,
 * Material says 48dp). Where a control is visually small on purpose, the
 * BOX grows rather than the glyph — padding and min-height, not font-size —
 * so the layout reads the same and only the hit area changes.
 * =================================================================== */
@media (max-width: 768px) {
  /* --- Settings: nav rows were 358x37. --- */
  .settings-nav a.item {
    min-height: 44px;
    padding: 10px 12px;
  }
  /* The back control is the way out of a settings sub-page. */
  .settings-nav .back { min-height: 44px; display: flex; align-items: center; }

  /* --- Memo editor toolbar: eleven buttons at 28-29px wide. The bar already
         scrolls horizontally, so widening the targets costs nothing but
         scroll distance, which is the right trade on a phone. --- */
  .me-btn {
    min-width: 44px; height: 44px;
    padding: 0 8px;
  }
  .me-size { min-width: 64px; }
  /* The bar is a scroller; make that explicit and give it momentum. */
  .me-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .me-bar::-webkit-scrollbar { display: none; }

  /* --- Team → Performance: the sort buttons in the sticky header were
         29px wide with no padding. --- */
  .tp-sort {
    min-height: 44px;
    display: inline-flex; align-items: center;
    padding: 0 4px;
  }

  /* The memo library's search sits outside .filter-bar, so it needs the same
     44px target and 16px text (16px stops iOS Safari zooming on focus). */
  #mlib-q { min-height: 44px; font-size: 16px; }

  /* --- Memo library: `.mlib-top-row` is `flex-wrap: nowrap; overflow: hidden`,
         so the tiles past the fold were clipped rather than reachable — one
         sat at x=392-500 on a 390px screen, entirely off-canvas. The existing
         nth-child rules hide surplus tiles at each breakpoint, which works on
         a wide screen but leaves a half-tile guillotined on a phone. Let the
         row scroll instead: nothing is hidden and nothing is cut. --- */
  .mlib-top-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }
  .mlib-top-row::-webkit-scrollbar { display: none; }
  .mlib-top-row > * { scroll-snap-align: start; flex-shrink: 0; }
  /* Those nth-child rules hid tiles for a layout that no longer applies. */
  .mlib-top-row > *:nth-child(n+5) { display: flex; }

  /* --- Sidebar drawer: this is the primary navigation now that the drawer is
         reachable again — every route that is not one of the five bottom tabs
         is reached through here — so the rows have to be thumb-sized. They
         were 236x37. --- */
  .sidebar .chat-link,
  .sidebar-nav .item,
  .sidebar-nav .project-head {
    min-height: 44px;
    padding-top: 10px; padding-bottom: 10px;
  }
  /* The workspace switcher arrow was 22px wide next to a 28px-tall brand
     link; both are in the drawer header and both are tappable. */
  .sidebar-brand { min-height: 44px; }
  #ws-arrow.ws-arrow { min-width: 44px; min-height: 44px; }
  /* The project expand/collapse chevrons were 32x32. There are a dozen of
     them stacked in the drawer, which is exactly the situation where an
     undersized target gets mis-hit and collapses the wrong project. */
  /* Specificity has to beat `.sidebar-nav .project-head .chev` (0,3,0),
     which sets min-width/min-height: 32px. */
  .sidebar .chev,
  .sidebar-nav .project-head .chev,
  .sidebar-nav .chev { min-width: 44px; min-height: 44px; margin: 0; }

  /* --- Timeline: `.tl-row-label` already gets `min-width: 120px` further up,
         but the spans inside it were still being squeezed to 49px against a
         ~166px natural width — a label that short is a hint, not a name. The
         chart scrolls horizontally by design, so widening this costs scroll
         distance rather than legibility. The pan buttons were 28px wide. --- */
  .tl-row-label { min-width: 150px !important; }
  .tl-row-label > * { flex-shrink: 0; }
  #pan-left, #pan-right {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }

  /* --- Discussions header pushed 24px past the viewport via its own
         min-width; let it wrap instead. --- */
  .discussions-header { flex-wrap: wrap; gap: 8px; }
  .discussions-wrap { padding: 12px; }
}

/* ===================================================================
 * FRG-214 — Meetings on a phone: the agenda, joining, and the memo.
 *
 * What a phone wants from Meetings is "what's next, and let me into it".
 * The agenda row led with the timestamp and wrapped the title after it, so
 * scanning a list meant reading dates to find names. The detail dialog was a
 * centred 460px card with a 33px-tall row of footer buttons, one of which is
 * Join — the single most time-critical control in the product, because you
 * press it when a meeting has already started.
 * =================================================================== */
@media (max-width: 768px) {
  /* --- Agenda rows: the meeting name leads. --- */
  /* Source order is when / name / meta; on a card the name comes first. */

  /* --- The meeting dialog becomes a sheet. ---
     Near-full-height rather than a floating card: it holds the agenda, the
     participants and the notes, and a 460px card centred in 844px of phone
     leaves the content scrolling in a letterbox. */
  .ptm-overlay { padding: 0; align-items: flex-end; }
  .ptm-modal {
    width: 100%; max-width: none;
    max-height: 92dvh;
    border-radius: 14px 14px 0 0;
    border-bottom: none;
  }
  .ptm-head { padding: 14px 16px; }
  .ptm-close {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
  }
  .ptm-title { min-width: 0; overflow-wrap: anywhere; }
  .ptm-body { padding: 14px 16px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  /* 16px so iOS Safari does not zoom the viewport when a field takes focus. */
  .ptm-input { font-size: 16px; min-height: 44px; }
  .ptm-textarea { min-height: 88px; }

  /* --- Footer: stacked, thumb-sized, Join first. ---
     The footer is `justify-content: flex-end` with three small buttons in a
     row; at 390px that is a cramped huddle in the corner furthest from a
     right thumb. Full-width stacked rows instead, in priority order. */
  .ptm-foot {
    /* Plain `column`, not column-reverse: in a reversed column the main axis
       runs bottom-to-top, so a lower `order` sinks an item rather than
       raising it — the opposite of what the ordering below reads as. */
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .ptm-btn {
    min-height: 48px;
    font-size: 15px;
    padding: 12px 16px;
    width: 100%;
  }
  /* Join is why you opened this on a phone — you are usually already late.
     Ordered above Save and Cancel so reading order is priority order, and
     given the success fill so it is the only coloured control in the stack:
     findable without reading it. */
  #mm-join {
    order: -1;
    background: var(--success); border-color: var(--success); color: var(--on-success);
  }
}

/* ===================================================================
 * FRG-214 — Ticket detail on a phone: status and assignee first.
 *
 * The modal already stacks to one column, but it stacks in DESKTOP reading
 * order: description, acceptance criteria and comments first, then the
 * meta panel. Measured at 390px that put the status control 900px down the
 * scroll and the assignee at 1150px — and changing status or reassigning is
 * most of what anyone does to a ticket from a phone. Reading the description
 * is what you do at a desk.
 *
 * So the meta panel comes first on mobile. Nothing is hidden or moved in the
 * markup; only the order changes, and only below 768px.
 * =================================================================== */
@media (max-width: 768px) {
  .modal-body { flex-direction: column; }
  .modal-body .sidebar-info {
    order: -1;
    /* The left rule is a column separator on desktop and meaningless once
       the panel is a stacked block; a bottom rule does the same job here. */
    border-left: none;
    padding-left: 0;
    padding-bottom: 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
  }

  /* --- Header: the title gets a line of its own. ---
     It shared one flex row with the ticket-ID pill and the close button and
     was squeezed to 84px — about ten characters of a ticket title. A grid
     gives the title the full width beside the close target, and drops the
     pill onto its own row where it stays copyable. */
  .modal header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-areas:
      "title close"
      "pill  pill";
    gap: 6px 8px;
    align-items: center;
    padding: 12px 14px;
  }
  .modal header .title-input {
    grid-area: title;
    min-height: 44px;
    font-size: 17px;
  }
  .modal header .ticket-pill { grid-area: pill; justify-self: start; }
  .modal header .close { grid-area: close; }

  /* Sits flush to the bottom of the screen, so it needs the inset. */
  .modal { padding-bottom: env(safe-area-inset-bottom); }
}

/* ===================================================================
 * FRG-214 — Tier 2: present and usable, but phone-shaped.
 * =================================================================== */

/* --- Team → Performance: a stacked read, not a sideways table. ---
 *
 * Eight columns measuring 877px inside a 330px wrapper. It scrolled, so
 * nothing was lost, but reading one person's numbers meant dragging the
 * table back and forth and losing the name column on the way out. Stacked,
 * each person is a card and every figure keeps its label.
 *
 * Columns: 1 Name · 2 Tickets · 3 No-rework · 4 Rework · 5 Escalations
 * · 6 Cycle time · 7 Tokens · 8 Cost.
 */
@media (max-width: 768px) {
  .tp-wrap { overflow-x: visible; }
  .tp-table, .tp-table tbody, .tp-table tr, .tp-table td { display: block; }
  .tp-table thead { display: none; }
  .tp-table { width: 100%; display: flex; flex-direction: column; gap: 10px; }

  .tp-table tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
  }
  .tp-table td {
    border: none;
    padding: 4px 0;
    text-align: left !important;
    min-width: 0;
    /* label left, figure right — the shape that makes a stack scannable */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: baseline;
    font-size: 13px;
  }
  /* The name is the card's heading, not a labelled row. */
  .tp-table td:nth-child(1) {
    display: block;
    font-size: 15px; font-weight: 600; color: var(--text);
    padding-bottom: 8px; margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
  }
  .tp-table td:nth-child(n+2)::before {
    color: var(--text-muted);
    font-size: 12px; font-weight: 600;
  }
  .tp-table td:nth-child(2)::before { content: 'Tickets'; }
  .tp-table td:nth-child(3)::before { content: 'No-rework rate'; }
  .tp-table td:nth-child(4)::before { content: 'Rework rate'; }
  .tp-table td:nth-child(5)::before { content: 'Escalations'; }
  .tp-table td:nth-child(6)::before { content: 'Cycle time'; }
  .tp-table td:nth-child(7)::before { content: 'Tokens'; }
  .tp-table td:nth-child(8)::before { content: 'Cost'; }
}

/* --- Project list cards: the scanning fields, then tap through. ---
 *
 * FRG-211 turned the eight-column table into cards, but a card carrying all
 * eight fields is just a table row with a border round it. On a phone the
 * list answers "which ticket is this, where is it, who has it, when is it
 * due" — so estimate-vs-actual (cell 7) and created date (cell 8) come off
 * the card. Both are desk-reading fields and both are one tap away in the
 * detail, which is also where you would change them.
 *
 * That leaves four chips rather than the three the brief asked for: status,
 * priority, assignee, due. Priority stays because it is the field you scan a
 * list BY, and it costs one short coloured chip; dropping it is a one-line
 * change here if it reads as noise.
 *
 * Hidden on the CARD only — nothing leaves the markup or the ticket.
 */
@media (max-width: 768px) {
  .task-list td:nth-child(7),
  .task-list td:nth-child(8) { display: none; }
}

/* --- Memo editor: read-first on a phone. ---
 *
 * The editor renders a document on a desk: a contrasting outer band
 * (.me-canvas-wrap, 16px each side) around a shadowed paper canvas
 * (.me-canvas, 22px each side). That metaphor is worth 76px of chrome on a
 * desktop and costs 76px of a 390px screen — the text column measured 280px,
 * so a fifth of the phone was spent saying "this is a document".
 *
 * A phone already knows it is looking at one thing. The desk collapses, the
 * paper keeps its surface colour (it still reads as the document, and the
 * toolbar needs something to sit against) but loses the shadow and most of
 * its inset. The text column goes from 280px to ~350px, which is the whole
 * point: reading and small edits, done comfortably.
 *
 * Deliberately NOT a rebuild into a phone word-processor. The toolbar still
 * scrolls with 44px targets (FRG-211) and everything it did still works.
 */
@media (max-width: 768px) {
  .me-canvas-wrap {
    padding: 10px 8px 96px;
    background: var(--bg);
  }
  .me-canvas {
    padding: 16px 14px;
    box-shadow: none;
    border-radius: 10px;
  }
}

/* ===================================================================
 * FRG-215 — mobile is five destinations.
 *
 * Today's Work · Work Schedule · Meetings · Chat · Settings (personal).
 * The bottom nav lists all five and is the whole of mobile navigation; the
 * drawer and its hamburger are gone (see .header .toggle above).
 *
 * Not listed is not unreachable. Every route still resolves, so a
 * notification or a chat link pointing at a ticket, a project or a client
 * opens and renders — the bottom nav stays on screen there, so there is
 * always a way back into the five.
 * =================================================================== */
@media (max-width: 768px) {
  /* The note explaining what Settings deliberately does not show here. */
  .settings-desktop-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 18px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
  }
  .settings-desktop-note [data-lucide] { flex: 0 0 auto; margin-top: 1px; }
}

/* ===================================================================
 * FRG-216 — the memo toolbar wraps instead of scrolling.
 *
 * Thirteen controls (three selects, ten buttons) on one nowrap row with
 * `overflow-x: auto` meant the bar ran off the right edge and had to be
 * dragged sideways to reach anything past Underline. A toolbar you have to
 * scroll to use is a toolbar you stop using — and on a phone the scroll
 * competes with swiping the document underneath it.
 *
 * Two rows, nothing hidden and nothing scrolling. The selects lead (they are
 * the widest and carry text), the buttons flow after them and wrap onto a
 * second line. Bold / Italic / Underline and the size select stay one tap
 * away on the first row, which is what the essentials have to be.
 *
 * Deliberately NOT solved by moving controls into the More popover: wrapping
 * costs one row of height and keeps every control where it can be seen,
 * which is what was asked for. If the bar ever grows again, More is the
 * pressure valve.
 * =================================================================== */
@media (max-width: 768px) {
  .me-bar {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 4px;
    padding: 6px 8px;
  }
  /* The selects grow to fill whatever row they land on.
   *
   * Thirteen controls at a 44px target do not fit two rows of 342px — the
   * arithmetic lands about four pixels short, and buying those pixels means
   * truncating "Default" to "Defau…" and resting the whole layout on 2px of
   * slack that a different font or device would eat. So it wraps to three
   * rows and the rows are made to look deliberate instead: the selects
   * stretch across their row rather than leaving a third of it blank, which
   * also makes their labels more readable, not less.
   *
   * min-width: 0 is still required — without it a long font name sets the
   * flex base and pushes the row wide, the same min-width:auto trap as the
   * calendar tracks and the modal title. */
  .me-bar .me-ctl {
    min-width: 0;
    flex: 1 1 auto;
    min-height: 44px;
    /* 16px stops iOS Safari zooming the viewport when a select takes focus,
       which would leave the page scrolled sideways after it closes. */
    font-size: 16px;
  }
  .me-bar .me-style { flex-basis: 104px; }
  .me-bar .me-font  { flex-basis: 96px; }
  .me-bar .me-size  { flex-basis: 68px; }
  /* Groups must not be broken across rows mid-pair. */
  .me-bar .me-group { flex: 0 0 auto; display: inline-flex; gap: 2px; }
}

/* ===================================================================
 * FRG-217 — Schedule meeting: Start and End on a phone.
 *
 * The scroll-wheel picker keeps its intrinsic width, so stacked into a
 * full-width mobile field it sat as a narrow strip against the left edge
 * with two-thirds of the row empty. meeting-form-controls.js now swaps it
 * for a native `<input type="time">` below 768px (same {value,set}
 * interface, so validation and the derived duration are untouched); this is
 * the layout that goes with it.
 *
 * Date takes its own full-width row, then Start and End sit side by side.
 * They are a pair and reading them as one line — 09:00 to 10:00 — is the
 * whole point; stacking them vertically would have filled the width but
 * separated two halves of a single answer.
 * =================================================================== */
@media (max-width: 768px) {
  .mm-when-row {
    display: flex;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 12px;
  }
  /* 1 Date · 2 Start · 3 End */
  .mm-when-row > .ptm-field:nth-child(1) { flex: 1 1 100%; min-width: 0; }
  .mm-when-row > .ptm-field:nth-child(2),
  .mm-when-row > .ptm-field:nth-child(3) {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
  }

  .mtw-native { display: block; width: 100%; }
  .mtw-input {
    width: 100%;
    min-height: 44px;
    /* 16px so iOS Safari does not zoom the viewport when the picker opens. */
    font-size: 16px;
    /* Safari gives time inputs a centred, intrinsically-sized value box;
       left-align it so it matches the Date field beside it. */
    text-align: left;
  }
  /* iOS renders its own inner spin container; keep it from adding width. */
  .mtw-input::-webkit-date-and-time-value { text-align: left; margin: 0; }

  /* The derived duration reads as a caption under the pair, not a field. */
  .mm-duration { margin-top: 2px; font-size: 12px; }
}

/* --- FRG-217 — notifications that cannot be followed on a phone. ---
 *
 * Shown, not hidden: the point of the panel is knowing the thing happened,
 * and filtering these out means finding out at your desk hours later. They
 * are muted and carry a "Desktop" chip so the row admits what it is before
 * you tap it, rather than looking live and then declining.
 */
@media (max-width: 768px) {
  .notif-panel .item.is-desktop-only .title,
  .notif-panel .item.is-desktop-only .body {
    color: var(--text-muted);
  }
  .notif-panel .item.is-desktop-only .time {
    display: flex; align-items: center; gap: 8px;
  }
  .notif-desktop-chip {
    display: inline-flex; align-items: center;
    padding: 1px 7px; border-radius: 999px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px; font-weight: 600; letter-spacing: .02em;
    text-transform: uppercase;
  }
  /* An unread desktop-only item keeps its unread tint but not its emphasis —
     it is still news, it just is not news you can act on here. */
  .notif-panel .item.unread.is-desktop-only { background: var(--surface-alt); }
}

/* --- FRG-217 — the chat channel list is a landing screen now. ---
 *
 * Chat used to open straight into a thread, so the list was something you
 * passed through rather than arrived at and its rows were never held to the
 * mobile target floor. Now that tapping Chat lands here (Johan: "when
 * opening chats this is how it must open and look"), every row on it is a
 * primary target and has to behave like one.
 *
 * Measured before this: search 342x39, channel rows 330x41, the section "+"
 * 22px wide, and the DM hide buttons 32x32.
 */
@media (max-width: 768px) {
  .chat-search {
    min-height: 44px;
    /* 16px so focusing search does not zoom the viewport on iOS. */
    font-size: 16px;
  }
  .ch-item {
    min-height: 44px;
    display: flex; align-items: center;
  }
  .chat-section-add {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
  }
  /* Hide-a-DM is revealed on hover, which a touch screen does not have — so
     on a phone this was not merely small, it was unreachable. Shown outright
     here, muted so it stays quiet beside the name, with a real target.
     Specificity must match `.chat-list .dm-hide` (0,2,0) or the 32px
     minimums declared there win.
     It does not disturb the landing screen Johan approved: Direct messages
     arrives collapsed, so these appear only once the section is opened. */
  .chat-list .dm-hide {
    opacity: 1;
    min-width: 44px; min-height: 44px;
    background: transparent;
    border-color: transparent;
  }
}

/* --- FRG-217 — agenda rows in the Schedule meeting sheet. ---
 *
 * Part of the same sheet as the Start/End fix. The agenda is where you
 * actually type on this form, and its rows were built at desktop scale: a
 * 13px checkbox, a 29px-tall text field and an 18px-wide delete. On a phone
 * that is three misses in a single row, on the one control you are most
 * likely to use repeatedly.
 */
@media (max-width: 768px) {
  .mag-row { gap: 10px; }
  /* The one deliberate exception to the 44px floor, and worth naming.
   *
   * This is a bare <input type="checkbox"> in a div — no label wrapper — so
   * neither usual trick is available: pseudo-elements do not render on
   * replaced elements (which is how .tw-check gets a 44px reach around a
   * 22px ring), and there is no wrapper to pad. That left a 44px native
   * checkbox, which is a very large square beside a text field, or
   * reimplementing the control with appearance:none and a drawn tick — a lot
   * of surface to risk on a secondary control inside a sheet. 28px is a
   * comfortable inline checkbox sitting in a row with 44px of vertical
   * clearance, and the text field and delete beside it are both full
   * targets. If it draws a complaint, the fix is a label wrapper in
   * meeting-form-controls.js and then the .tw-check treatment. */
  .mag-tick {
    width: 28px; height: 28px;
    flex: 0 0 28px;
  }
  .mag-text {
    min-height: 44px;
    /* 16px or iOS zooms the viewport the moment you start typing an item. */
    font-size: 16px;
  }
  .mag-del {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
  }
}

/* ===================================================================
 * FRG-218 — the workspace mark in the mobile header.
 *
 * Sits between the page title and the bell. Which workspace you are in was
 * otherwise invisible on a phone: the sidebar carried that lockup and the
 * sidebar is gone.
 *
 * Never an empty circle. The initials layer is always painted; the <img>,
 * when there is one, covers it and removes itself on error. So a workspace
 * with no logo, a logo URL that 404s, and a logo that loads all produce
 * something deliberate rather than a hole. See workspaceMarkHtml().
 * =================================================================== */
/* FRG-219 — the height is set inline; the WIDTH follows the artwork.
 *
 * Previously both axes were fixed and the image was absolutely positioned to
 * fill the square, so object-fit: contain letterboxed a wordmark down to a
 * few pixels of ink. The image is now in normal flow, which lets it size
 * itself from its aspect ratio and gives the span its width; `max-width` is
 * the only limit, so a very wide wordmark stops before it can crowd the
 * title or the bell.
 *
 * The initial stays absolutely positioned behind it. When there is no image —
 * or `onerror` has removed one that failed — nothing is in flow, so the span
 * falls back to its inline `min-width` (equal to the height) and the initial
 * fills a proper square tile rather than a sliver. */
/* FRG-220 — a wordmark needs WIDTH; a fallback letter needs a square.
 *
 * FRG-219 let the width follow the aspect ratio but still drove everything
 * from the height, and for a 3:1 wordmark that is the binding constraint:
 * width is only ever 3x whatever the bar allows vertically. At a 40px mark
 * the Fencesens logo rendered 108x40, which sounds fine and is not — the
 * asset is 909x303 with no wasted margin (measured: ink fills 99% of it), so
 * 108px wide means its lettering is at one-ninth scale and unreadable.
 *
 * So the two cases get different shapes, keyed off `has-logo`:
 *   - with a logo, the mark FLEXES into whatever room is left between the
 *     title and the bell, and the image is centred in it at the largest size
 *     the bar's height allows, capped at the box so it can never overflow;
 *   - without one, the mark stays a square tile, because a single letter
 *     stretched across a wide box is worse than a small one in a round one.
 */
.wsmark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 7px;
  overflow: hidden;
}
/* The image carries its own plate and hugs its own ink, so the flexed box
   around it is invisible — it only decides how much room the logo may use. */
.wsmark.has-logo {
  flex: 1 1 auto;
  border-radius: 0;
  overflow: visible;
}
.wsmark-init {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand);
  color: var(--on-brand);
  /* Sized for the 40px tile the mobile header asks for. Not an em: the mark's
     height is set inline in px and em would track the header's font size,
     which is a different number entirely. */
  font-size: 17px;
  font-weight: 700; letter-spacing: .02em;
}
/* Only a fallback. With a logo present the box is wide, and an absolutely
   positioned initial would paint a --brand bar across the whole of it with
   the logo floating in the middle. Hidden here and brought straight back by
   the `onerror` handler, which drops `has-logo` — so a failed image still
   lands on a square tile with a letter in it, never an empty box. */
.wsmark.has-logo .wsmark-init { display: none; }

.wsmark-img {
  position: relative;
  height: 100%;
  width: auto;
  /* Never wider than the room it was given: if the bar is too narrow for the
     full height-driven width, contain letterboxes rather than overflowing. */
  max-width: 100%;
  object-fit: contain;
  box-sizing: border-box;
  display: block;
  /* The plate is no longer here unconditionally — see .wl-art below. */
  /* An indicator, not a control — do not swallow taps meant for the bar. */
  pointer-events: none;
}
/* A square mark carries more ink per pixel of height than a wordmark does, so
   at the bar's full height it read as a block crowding the title and the bell
   (BigJoe, 2026-10-29). logoArtHtml measures each image on load and tags one
   under 2:1 as `wl-squarish`; it is drawn at three-quarters of the height.
   The wordmark keeps the whole height, which it needs to stay legible. */
.wsmark-img.wl-squarish { height: 76%; }
/* A workspace with ONLY a dark-background logo has nothing to show on a light
   header, so there it is the initial tile again, square like any other. */
html:not([data-theme="dark"]) .wsmark.dark-only { flex: 0 0 auto; border-radius: 7px; overflow: hidden; }
html:not([data-theme="dark"]) .wsmark.dark-only .wsmark-init { display: flex; }

/* ── Migration 670: one logo rule for every surface that can be dark ─────────
 *
 * white-label.js logoArtHtml() decides the artwork; these rules draw it.
 *
 *   .wl-art-light / .wl-art-dark — a workspace that has uploaded a logo for
 *       dark backgrounds gets BOTH images on a themed surface, and the theme
 *       shows one. No re-render when the theme flips, and no plate on either:
 *       each was drawn for the background it is shown on.
 *   .wl-plate-dark — no dark logo: the main one, plated in the dark theme only
 *       (FRG-218's fallback). On a light surface a white plate is invisible
 *       anyway, so it is not drawn.
 *   .wl-plate — the same plate on a surface that is dark in BOTH themes
 *       (the sidebar), or after a dark logo failed to load.
 *
 * html[data-theme] is always set (theme.js runs before render), so "not dark"
 * means light, never "unknown". */
html[data-theme="dark"] .wl-art.wl-art-light,
html:not([data-theme="dark"]) .wl-art.wl-art-dark { display: none !important; }
.wl-art.wl-plate,
html[data-theme="dark"] .wl-art.wl-plate-dark {
  background: var(--logo-plate);
  padding: 3px;
  box-sizing: border-box;
  /* A badge, not a slab: square corners made the plate read as a white block
     on the dark header. */
  border-radius: 8px;
}
/* Square boxes that a wordmark used to be squashed into (they set width AND
   height with no object-fit). A wide logo keeps its aspect ratio at a height
   that leaves its lettering legible; a square one keeps the box. */
.login-card .login-logo,
.more-header .wl-art,
.mobile-home-header .logo-section .wl-art { object-fit: contain; }
.login-card .login-logo.wl-wide { width: auto; max-width: 100%; height: 64px; box-shadow: none; }
.more-header .wl-art.wl-wide { width: auto; max-width: 168px; height: 40px; }
.mobile-home-header .logo-section .wl-art.wl-wide { width: auto; max-width: 132px; height: 28px; }
.sidebar-brand .wl-logo { width: auto; max-width: 132px; }
.sidebar-brand .wl-logo.wl-squarish { width: 28px; }
@media (min-width: 769px) and (max-width: 1023px) {
  /* The icon rail is 60px: whatever the artwork, it has to fit. */
  .sidebar-brand .wl-logo { max-width: 44px; }
}
/* The large marks get a proportionally larger inset. */
.login-card .login-logo.wl-plate,
html[data-theme="dark"] .login-card .login-logo.wl-plate-dark,
.more-header .wl-art.wl-plate,
html[data-theme="dark"] .more-header .wl-art.wl-plate-dark { padding: 6px; }

@media (max-width: 768px) {
  /* Title left, mark in the middle, bell right.
   *
   * The title is `0 1 auto` — it shrinks but does not GROW. That is what
   * leaves slack for the mark's `margin: 0 auto` to split evenly, putting the
   * mark between the two rather than pinned against the bell. A growing title
   * would swallow all the free space and leave nothing to centre in.
   *
   * The title also yields first when the bar runs out of room: the mark and
   * the bell are fixed-size and mean nothing truncated, whereas a screen name
   * ellipsises perfectly well. "Work Schedule" losing its last characters is
   * a smaller loss than either of the other two being pushed off the bar. */
  .header.header-focused-mobile .focused-mobile-title { flex: 0 1 auto; min-width: 0; }
  /* FRG-220 — the space between the title and the bell belongs to the mark.
   *
   * No max-width any more: the flexed box takes what is left and the image
   * inside is limited by the bar's height, so the logo simply cannot grow
   * past what the bar can show. The old 132px cap was solving a problem that
   * only existed while the box hugged the image.
   *
   * The title gives way first, deliberately: a truncated "Work Schedule" is
   * a smaller loss than an unreadable company mark, which is the trade Johan
   * asked for. It keeps a floor so it never vanishes entirely. */
  .header.header-focused-mobile .wsmark { margin: 0; }
  .header.header-focused-mobile .focused-mobile-title { min-width: 3.5em; }
  .header.header-focused-mobile forge-notifications { margin-left: 0; }
}

/* FRG-229 — the agent roster, grouped by workspace.
   Only rendered in the master super-view, where more than one workspace is on
   screen at once; a single-workspace roster stays an ungrouped grid. */
.agent-ws-group + .agent-ws-group { margin-top: 26px; }
.agent-ws-heading {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
}
.agent-ws-heading::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.agent-ws-count {
  order: 1; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2, rgba(128,128,128,0.10));
  border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; letter-spacing: 0;
}

/* ── FRG-075: guests ─────────────────────────────────────────────────────
 *
 * Two surfaces: the knock banner in the call chrome, and the Guests rail
 * panel. The banner is the important one — a host is looking at the video,
 * not at a tab, and an outsider who knocks and is never let in is the only
 * way this feature actually fails in front of a client.
 *
 * Painted from --call-* throughout. The call surface stays dark in both
 * themes but is expressed in tokens that shift with it; a literal here would
 * be the exact regression call-surface-tokens.test.ts exists to catch, and
 * did catch when this was first written in invented --forge-* names.
 */

.cv-knock {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 16px 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--call-control);
  border: 1px solid var(--call-accent-glow);
  color: var(--call-ink);
  font-size: 13.5px;
}
.cv-knock-who { flex: 1 1 auto; font-weight: 600; }

/* Vibe finding 6 — "you are sharing", with its own Stop. Same place and shape
   as the knock bar, in the danger colour a live broadcast of your screen
   deserves; the Stop is the End button's colour, because it ends something. */
forge-call-view .cv-sharing {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 var(--call-gutter) 8px;
  padding: 8px 10px 8px 14px;
  border-radius: 10px;
  background: var(--call-control);
  border: 1px solid var(--call-danger);
  color: var(--call-ink);
  font-size: 13.5px; font-weight: 600;
}
forge-call-view .cv-sharing-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%;
  background: var(--call-danger);
}
forge-call-view .cv-sharing-what { flex: 1 1 auto; min-width: 0; }
forge-call-view .cv-sharing-stop {
  flex: none; border: none; border-radius: 8px;
  min-height: 36px; padding: 0 14px;
  font: inherit; font-size: 13px; font-weight: 650;
  background: var(--call-danger); color: var(--call-on-accent);
  cursor: pointer;
}
forge-call-view .cv-sharing-stop:focus-visible { outline: 2px solid var(--call-ink); outline-offset: 2px; }
.cv-knock button {
  border: none;
  border-radius: 7px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.cv-knock-admit { background: var(--call-accent); color: var(--call-on-accent); }
.cv-knock-admit:hover { background: var(--call-accent-hover); }
.cv-knock-deny {
  background: transparent;
  color: var(--call-ink-dim);
  border: 1px solid var(--call-line) !important;
}

/* The rail panel. */
.vnotes-guests { display: flex; flex-direction: column; gap: 18px; overflow-y: auto; padding-bottom: 4px; }
/* The rail's other panels each state this; this one did not. `hidden` only
 * means `display:none` while nothing else sets `display` — the rule above does,
 * so the guests panel stayed on screen under My notes, Agenda and Transcript
 * even though _syncRail was setting the attribute correctly. */
.vnotes-guests[hidden] { display: none; }
.vg-form { display: flex; flex-direction: column; gap: 6px; }
.vg-label { font-size: 12px; font-weight: 600; color: var(--call-ink-dim); }
.vg-input {
  background: var(--call-raise);
  border: 1px solid var(--call-field-line);
  border-radius: 7px;
  color: var(--call-ink);
  font: inherit;
  font-size: 13.5px;
  padding: 8px 10px;
}
.vg-btn {
  align-self: flex-start;
  background: var(--call-accent);
  color: var(--call-on-accent);
  border: none; border-radius: 7px;
  padding: 8px 14px;
  font: inherit; font-weight: 650; font-size: 13px;
  cursor: pointer;
}
.vg-btn:hover { background: var(--call-accent-hover); }
.vg-btn:disabled { opacity: 0.6; cursor: default; }
.vg-note { font-size: 12px; color: var(--call-ink-dim); line-height: 1.5; margin: 0; }

/* The send result. A failed send is a WARNING with the link attached, not a
 * silent success — the whole point of awaiting the send server-side. */
.vg-result {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--call-line);
  background: var(--call-raise);
}
.vg-result p { margin: 0; }
.vg-result.ok { border-color: var(--call-accent-glow); }
.vg-result.warn { border-color: var(--call-danger); }
.vg-copy {
  align-self: flex-start;
  background: var(--call-control);
  color: var(--call-ink);
  border: 1px solid var(--call-line);
  border-radius: 7px;
  padding: 6px 12px;
  font: inherit; font-size: 12.5px;
  cursor: pointer;
}
.vg-copy:hover { background: var(--call-control-hover); }
.vg-error {
  background: var(--call-raise);
  border: 1px solid var(--call-danger);
  color: var(--call-danger);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  margin: 0;
}

.vg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.vg-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--call-line);
  border-radius: 8px;
}
/* Somebody at the door is not just another row in a list. */
.vg-row.vg-waiting { border-color: var(--call-accent); background: var(--call-control); }
.vg-row.vg-denied, .vg-row.vg-left, .vg-row.vg-expired { opacity: 0.6; }
.vg-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.vg-name { font-size: 13px; font-weight: 600; color: var(--call-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vg-sub, .vg-state { font-size: 11.5px; color: var(--call-ink-dim); line-height: 1.4; }
.vg-name { line-height: 1.35; }
.vg-actions { display: flex; gap: 8px; flex-shrink: 0; }
.vg-actions button {
  border-radius: 6px;
  padding: 7px 13px;
  font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--call-line);
  background: var(--call-control);
  color: var(--call-ink);
}
.vg-actions button:hover { background: var(--call-control-hover); }
.vg-admit,
.vg-share-allow {
  background: var(--call-accent) !important;
  color: var(--call-on-accent) !important;
  border-color: transparent !important;
}
/* MTG-35 / MTG-34 — an admitted guest can carry up to four controls (share
 * decision, mute, remove). They wrap rather than squeezing the name to nothing. */
.vg-row.vg-admitted .vg-actions { flex-wrap: wrap; justify-content: flex-end; flex-shrink: 1; }
.vg-mute[aria-pressed="true"] { border-color: var(--call-accent); color: var(--call-accent); }

/* FRG-075 — the workspace-invite send outcome.
 *
 * This one is NOT on the call surface: it lives in Settings, so it uses the
 * ordinary app tokens and follows the theme like everything around it.
 *
 * A region rather than a toast. When the mail did not go, this holds the
 * reason and the link the admin now has to send by hand, and both must still
 * be on screen a minute later.
 */
.inv-result {
  margin-top: 10px;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.inv-result p { margin: 0; line-height: 1.5; }
.inv-result.ok { border-color: var(--success); }
.inv-result.warn { border-color: var(--warning); }
.inv-result-why { color: var(--text-muted); font-size: 12.5px; }
.inv-result-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.inv-result-link {
  width: 100%;
  background: var(--surface, var(--bg));
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit; font: inherit; font-size: 12.5px;
  padding: 7px 9px;
}
.inv-result-copy {
  align-self: flex-start;
  background: transparent; color: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit; font-size: 12.5px;
  cursor: pointer;
}

/* FRG-075 — guests on the schedule form.
 *
 * The already-invited list is information, not a control surface: it sits
 * quietly under the field so the organiser can see who is already on the
 * list without it competing with the form they are filling in. */
.mm-guest-existing {
  margin: 8px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.mm-guest-existing-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.mm-guest-existing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-size: 13px;
}
.mm-guest-existing-state {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* FRG-075 — the Guests control and its panel.
 *
 * The control sits at the right-hand end of the call bar next to End. The
 * badge is the reason it can live behind a button at all: a guest waiting at
 * the door has to be visible without the panel being open. */
.cv-btn-guests { position: relative; }
.cv-btn-guests.alert { color: var(--warn); }
.cv-btn-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--call-danger);
  color: var(--call-on-accent);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* The field and its Send button on one line — the panel exists to be opened,
 * used and closed, so the primary action must not be a scroll away. */
.vg-form-row { display: flex; gap: 8px; align-items: stretch; }
.vg-form-row .vg-input { flex: 1 1 auto; min-width: 0; }
.vg-form-row .vg-btn { flex: none; white-space: nowrap; }



/* Somebody at the door is the row that needs a decision, so it is the row
 * that is allowed to draw the eye. Every other state stays quiet. */
.vg-row.vg-waiting {
  border-left: 3px solid var(--warn);
  padding-left: 9px;
}

/* FRG-075 — the door, and the waiting room.
 *
 * The banner is deliberately the loudest thing in the call chrome. A host
 * asked outright how they would know somebody was waiting, which means a
 * badge was not enough; this is sized and coloured to be seen without being
 * looked for, and it carries the decision so one guest never needs the panel. */
.cv-knock {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 var(--call-gutter) 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--warn-tint);
  border: 1px solid var(--warn);
  color: var(--call-ink);
  font-size: 13.5px;
}
.cv-knock-who { flex: 1 1 auto; min-width: 0; }
.cv-knock-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  /* Movement, because a static strip becomes furniture within a minute and
   * this has to keep reading as "someone is still standing outside". */
  animation: cv-knock-pulse 1.6s ease-in-out infinite;
}
@keyframes cv-knock-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.72); }
}
@media (prefers-reduced-motion: reduce) {
  .cv-knock-dot { animation: none; }
}
.cv-knock-admit,
.cv-knock-deny,
.cv-knock-all {
  flex: none;
  padding: 6px 14px;
  border-radius: 7px;
  border: 1px solid var(--call-line);
  background: var(--call-control);
  color: var(--call-ink);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.cv-knock-admit {
  background: var(--call-accent);
  border-color: var(--call-accent);
  color: var(--call-on-accent);
}
.cv-knock-admit:hover { background: var(--call-accent-hover); }
.cv-knock-deny:hover,
.cv-knock-all:hover { background: var(--call-control-hover); }

/* MTG-36 — the bottom strip: the active speaker fills the stage, everyone else
 * is a thumbnail along the bottom that scrolls sideways when it runs out of
 * room. Applies to both call surfaces (the guest page is inside
 * forge-call-view too). Tiles are 16:9 in the strip — a thumbnail is a glance,
 * not a face to read — and the main tile keeps cover-cropping like the grid. */
forge-call-view .cv-grid.is-speaker {
  /* row-gap, not gap: 10px is the space between the speaker and the strip.
     The column gap stays the grid's own, because the stage is measured from
     this element when the call switches to equal tiles (measureGridBox reads
     the column gap), and a 10px reading made that first frame's tiles too big
     to fit (2026-10-03). */
  display: flex; flex-direction: column; row-gap: 10px;
  min-height: 0; overflow: hidden;
  /* The grid rules centre their items; here both rows must span the stage, or
   * the speaker shrinks to its content and the strip overflows instead of
   * scrolling. Measured at 1440px before this: a 98px-wide main tile. */
  align-items: stretch; justify-content: stretch;
}
forge-call-view .cv-speaker-main,
forge-call-view .cv-speaker-strip {
  align-self: stretch; width: 100%; min-width: 0;
}
forge-call-view .cv-speaker-main {
  flex: 1 1 auto; min-height: 0; display: flex; justify-content: center;
}
/* 2026-10-04 — never wider than a camera's own 16:9 (BigJoe: nine people at
   1920x1080 made the speaker a 2.9:1 letterbox, cropping the top and bottom
   of their face). The tile takes the full height and is centred; on a stage
   narrower than 16:9 it takes the full width instead. Same limit as the grid
   (TILE_MAX_ASPECT in call-grid.js). */
forge-call-view .cv-speaker-main > .cv-tile {
  flex: 0 1 auto; min-width: 0; min-height: 0; height: 100%;
  width: auto; aspect-ratio: 16 / 9; max-width: 100%;
}
forge-call-view .cv-speaker-strip {
  flex: 0 0 auto; display: flex; gap: 8px; justify-content: safe center;
  height: 118px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding-bottom: 2px;
}
forge-call-view .cv-speaker-strip > .cv-tile {
  /* 2026-10-03 — thumbnails SHARE the strip's width (never under
     STRIP_TILE_MIN_W: below that the call switches to equal tiles, see
     chooseCallLayout), so everyone in the strip is on screen, none scrolled
     off the edge. 210px is the old 16:9 width at this height. */
  flex: 1 1 0; height: 100%; max-width: 210px;
  min-width: 0; min-height: 0;
  scroll-snap-align: start;
}
/* Pinned to the corner, as on share thumbnails (MTG-28). In flow beneath the
 * avatar it was squeezed to 2px tall in an 82px phone thumbnail — invisible. */
forge-call-view .cv-speaker-strip > .cv-tile .cv-name {
  position: absolute; left: 4px; bottom: 4px; max-width: calc(100% - 8px);
  height: auto; line-height: 1.3; margin: 0;
  font-size: 10.5px; padding: 1px 5px; border-radius: 4px;
  background: var(--call-video-scrim); color: var(--call-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* renderAvatar sizes inline for the grid tile; a thumbnail needs a smaller one. */
forge-call-view .cv-speaker-strip > .cv-tile .cv-avatar-wrap .avatar-wrap,
forge-call-view .cv-speaker-strip > .cv-tile .cv-avatar-wrap .avatar-base,
forge-call-view .cv-speaker-strip > .cv-tile .cv-avatar-wrap img {
  width: 44px !important; height: 44px !important; font-size: 16px !important; line-height: 44px !important;
}
@media (max-width: 768px) {
  forge-call-view .cv-speaker-strip { height: 84px; gap: 6px; }
}

/* HVH-702 — a stage's process protocol, under the board column heading and in
 * the task detail. Two lines on the board (the full text is the tooltip and the
 * confirm dialog); in full on the task. */
.kanban-protocol {
  margin: 0 10px 8px; padding: 7px 9px; border-radius: 6px;
  background: var(--surface-2, rgba(128,128,128,0.10));
  border-left: 2px solid var(--brand);
  font-size: 11.5px; line-height: 1.45; color: var(--text-muted, #8a8b94);
  display: flex; flex-direction: column; gap: 3px;
}
.kanban-protocol .kp-fn { font-weight: 700; color: var(--text, #fff); }
.kanban-protocol .kp-text {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kanban-protocol .kp-owner { display: flex; align-items: center; gap: 4px; opacity: 0.9; }

/* 2026-10-26 — "Worked by" under each column name: who is put on a card when
 * it arrives, and for an editor the control that changes it. */
.kanban-col-owner {
  display: flex; align-items: center; gap: 6px; width: calc(100% - 20px);
  margin: 0 10px 8px; padding: 6px 9px; border-radius: 6px; text-align: left;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text, #fff);
  background: var(--surface-2, rgba(128,128,128,0.10)); border: 1px solid var(--border, #2a2b36);
}
button.kanban-col-owner { cursor: pointer; }
button.kanban-col-owner:hover { border-color: var(--brand); }
.kanban-col-owner.is-empty { color: var(--text-muted, #8a8b94); font-weight: 500; border-style: dashed; }
.kanban-col-owner.is-static { cursor: default; }
.kanban-col-owner.is-flash { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.sm-banner.sm-who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sm-banner.sm-who span { flex: 1 1 260px; }
.tm-protocol .tmp-fn { font-weight: 700; color: var(--text, #fff); font-size: 12.5px; }
.tm-protocol .tmp-text { font-size: 12.5px; line-height: 1.5; color: var(--text, #fff); white-space: pre-wrap; }
.tm-protocol .tmp-owner { font-size: 11.5px; color: var(--text-muted, #8a8b94); margin-top: 4px; }

/* MTG-46 Tier 1 — connection bars (top-right of each tile) and, on your own
 * tile, a line when your outgoing video is limited and why. */
forge-call-view .cv-tile .cv-quality {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: inline-flex; align-items: flex-end; gap: 2px;
  padding: 3px 4px; border-radius: 4px; background: var(--call-video-scrim);
}
forge-call-view .cv-quality i { display: block; width: 3px; border-radius: 1px; background: var(--call-line); }
forge-call-view .cv-quality i:nth-child(1) { height: 4px; }
forge-call-view .cv-quality i:nth-child(2) { height: 7px; }
forge-call-view .cv-quality i:nth-child(3) { height: 10px; }
forge-call-view .cv-quality.q-none { display: none; }
forge-call-view .cv-quality.q-good i { background: var(--success-text); }
forge-call-view .cv-quality.q-fair i:nth-child(-n+2) { background: var(--warn); }
forge-call-view .cv-quality.q-poor i:nth-child(1) { background: var(--call-danger); }
forge-call-view .cv-tile .cv-limit {
  position: absolute; top: 8px; left: 8px; z-index: 2; max-width: calc(100% - 16px);
  padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600;
  background: var(--call-video-scrim); color: var(--warn);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
forge-call-view .cv-tile .cv-limit[hidden] { display: none; }

/* MTG-44 — your own camera, small, over your screen tile while you share.
 * Mirrored like every self-view; cover-cropped because it is a face. */
forge-call-view .cv-tile .cv-self-cam {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  width: 22%; max-width: 200px; min-width: 96px; aspect-ratio: 16 / 9;
  object-fit: cover; transform: scaleX(-1);
  border-radius: 8px; border: 2px solid var(--call-ring);
  background: var(--call-video-scrim);
  pointer-events: none;
}

/* MTG-37 — the recording notice, where the knock bar sits and as loud.
 * Somebody is being recorded; the notice must be read, not glanced past. The
 * text is the full notice (MTG-02 version string on the server), wrapped, and
 * capped in height so a phone still shows the controls beneath it. */
.cv-consent {
  margin: 0 var(--call-gutter) 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--danger-tint);
  border: 1px solid var(--danger);
  color: var(--call-ink);
  font-size: 13.5px;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 40vh; overflow-y: auto;
}
.cv-consent-head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.cv-consent .cv-rec-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none;
}
.cv-consent-text { margin: 0; line-height: 1.45; }
.cv-consent-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cv-consent-actions button {
  padding: 6px 14px; border-radius: 7px; font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--call-line); background: var(--call-control); color: var(--call-ink);
}
.cv-consent-actions .cv-consent-accept {
  background: var(--call-accent); border-color: var(--call-accent); color: var(--call-on-accent);
}
/* A refusal that stays until dismissed (MTG-37). */
.cv-rec-error {
  display: flex; align-items: center; gap: 10px;
  margin: 0 var(--call-gutter) 8px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--danger-tint); border: 1px solid var(--danger); color: var(--call-ink);
  font-size: 13.5px;
}
.cv-rec-error-text { flex: 1 1 auto; min-width: 0; }
.cv-rec-error-close, .cv-rec-retry, .cv-rec-keep {
  flex: none; padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--call-line); background: var(--call-control); color: var(--call-ink);
}

/* The waiting room, at the top of the Guests tab. Everyone at the door in one
 * list, with the one action that a queue actually needs. */
.vg-waiting {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warn-tint);
  border: 1px solid var(--warn);
}
.vg-waiting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}
.vg-admit-all {
  flex: none;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--call-accent);
  background: var(--call-accent);
  color: var(--call-on-accent);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.vg-admit-all:disabled { opacity: 0.6; cursor: progress; }

/* ── MEM-01 — version history, compare, and agent attribution ─────────── */

/* THE REJECT IF, in the document itself: "An agent edit cannot be told apart
   from a person's". A history panel alone would not satisfy it — people read
   the page, not the panel — so agent-written text carries a visible mark
   wherever it appears, in the editor and in the read-only preview alike. */
[data-agent-edit] {
  background: var(--brand-faint);
  box-shadow: inset 2px 0 0 var(--brand);
  border-radius: 3px;
  padding: 0 2px;
}
[data-agent-edit]::after {
  content: attr(data-agent-name);
  font-size: 9px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--brand); vertical-align: super; margin-left: 4px; opacity: .85;
  user-select: none;
}

/* The strip above the document. Persistent, because AC3 asks for the undo to
   be one action and a toast that has expired is not one. */
.me-agentbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 16px; font-size: 12px;
  background: var(--brand-faint); border-bottom: 1px solid var(--brand-soft);
  color: var(--text);
}
.me-agentbar-what { display: inline-flex; align-items: center; gap: 6px; }
.me-agentbar-why { color: var(--text-muted); font-style: italic; }
.me-agentbar-undo {
  margin-left: auto; cursor: pointer; font-size: 12px; padding: 3px 10px;
  border-radius: 5px; border: 1px solid var(--brand); background: var(--surface);
  color: var(--brand); font-weight: 600;
}
.me-agentbar-undo:hover { background: var(--brand); color: #fff; }

/* ── History panel ──────────────────────────────────────────────────── */
.mvh-modal { width: min(980px, 94vw); }
.mvh-body { display: grid; grid-template-columns: 250px 1fr; gap: 0; padding: 0; min-height: 340px; }
.mvh-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 58vh; padding: 6px; }
.mvh-diff { overflow-y: auto; max-height: 58vh; padding: 14px 16px; }
.mvh-empty { color: var(--text-muted); font-size: 13px; padding: 10px 2px; }

.mvh-row {
  display: flex; gap: 8px; width: 100%; text-align: left; cursor: pointer;
  padding: 7px 8px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--text); margin-bottom: 2px;
}
.mvh-row:hover { background: var(--bg-hover); }
.mvh-row.is-selected { background: var(--brand-faint); border-color: var(--brand-soft); }
.mvh-row.is-compare { border-color: var(--brand); border-style: dashed; }
.mvh-no { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.mvh-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.mvh-who { font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.mvh-when { font-size: 11px; color: var(--text-muted); }
.mvh-prompt, .mvh-reverted { font-size: 11px; color: var(--text-muted); font-style: italic; }
/* An AGENT row reads differently at a glance — that is the whole point. */
.mvh-row.is-agent .mvh-who { color: var(--brand); }
.mvh-fn {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  background: var(--brand); color: #fff; padding: 1px 5px; border-radius: 3px;
}
.mvh-row.is-reverted .mvh-main { opacity: .6; }
.mvh-row.is-reverted .mvh-reverted { color: var(--warn-text); font-style: normal; }

.mvh-summary { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.mvh-b { font-size: 13px; line-height: 1.55; padding: 4px 8px; border-radius: 4px; margin-bottom: 3px; }
.mvh-b.same { color: var(--text-muted); }
.mvh-b.add { background: var(--success-tint); }
.mvh-b.del { background: var(--danger-tint); }
.mvh-b.chg { background: var(--surface-alt); }
.mvh-b ins { background: var(--success-tint); text-decoration: none; color: var(--success-text); }
.mvh-b del { background: var(--danger-tint); color: var(--danger-text); }
.mvh-btag {
  font-size: 9px; font-weight: 700; letter-spacing: .05em; margin-right: 6px;
  color: var(--text-muted); border: 1px solid var(--border); padding: 0 4px; border-radius: 3px;
}
.mvh-foot { display: flex; align-items: center; gap: 8px; }
.mvh-foot-left { display: flex; gap: 8px; margin-right: auto; }
.mvh-undo { border-color: var(--brand); color: var(--brand); }

/* ── Agent panel ────────────────────────────────────────────────────── */
.mag-modal { width: min(680px, 94vw); }
.mag-fns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mag-fn {
  display: grid; grid-template-columns: 18px 1fr; grid-template-rows: auto auto;
  gap: 2px 8px; text-align: left; cursor: pointer; padding: 10px 12px;
  border-radius: 7px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text);
}
.mag-fn:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-faint); }
.mag-fn.is-on { border-color: var(--brand); background: var(--brand-faint); }
.mag-fn:disabled { opacity: .55; cursor: not-allowed; }
.mag-fn-label { font-weight: 600; font-size: 13px; }
.mag-fn-blurb { grid-column: 2; font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.mag-detail { margin-top: 14px; }
.mag-prompt { width: 100%; resize: vertical; font-family: inherit; }
.mag-note { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
/* AC4 made visible — the person sees the passage that will be replaced. */
.mag-selected {
  border: 1px solid var(--warn); background: var(--warn-tint);
  border-radius: 6px; padding: 8px 10px; margin-bottom: 12px;
}
.mag-sel-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; color: var(--warn-text); margin-bottom: 4px;
}
.mag-sel-text { font-size: 12.5px; max-height: 96px; overflow-y: auto; white-space: pre-wrap; }
.mag-result { margin-top: 14px; }
.mag-produced {
  font-size: 12.5px; white-space: pre-wrap; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 6px; padding: 10px; max-height: 200px;
  overflow-y: auto;
}

@media (max-width: 720px) {
  .mvh-body { grid-template-columns: 1fr; }
  .mvh-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
  .mag-fns { grid-template-columns: 1fr; }
}

/* ── MTG-01 — reviewing what the meeting agent heard ──────────────────── */
.man-modal { width: min(760px, 94vw); }
.man-body { max-height: 66vh; overflow-y: auto; }

.man-run {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px; border-radius: 8px;
  background: var(--brand-faint); border: 1px solid var(--brand-soft);
}
.man-run-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 240px; }
.man-run-text strong { font-size: 13px; }
/* AC4 in words, on the screen: running the agent creates nothing. */
.man-run-text span { font-size: 11.5px; color: var(--text-muted); }
.man-run-pick { max-width: 240px; }

.man-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 700; margin: 16px 0 8px;
}
.man-note-empty {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-muted); padding: 14px 2px;
}

.man-row {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--surface);
}
.man-row.man-action   { border-left: 3px solid var(--warn); }
.man-row.man-decision { border-left: 3px solid var(--success); }
.man-row.man-note     { border-left: 3px solid var(--border); }
/* A discarded proposal STAYS on the list, greyed. That the agent proposed
   something a person rejected is a fact about the meeting. */
.man-row.is-discarded { opacity: .55; }
.man-row.is-confirmed { background: var(--surface-alt); }

.man-row-head { display: flex; gap: 9px; align-items: baseline; }
.man-kind {
  font-size: 9px; font-weight: 700; letter-spacing: .06em; flex: 0 0 auto;
  padding: 2px 6px; border-radius: 3px; color: #fff; background: var(--text-muted);
}
.man-action .man-kind   { background: var(--warn); color: var(--on-warn); }
.man-decision .man-kind { background: var(--success); color: var(--on-success); }
.man-text { font-size: 13.5px; line-height: 1.5; }

/* AC3, visible: the words from the transcript and where in it they were. */
.man-quote {
  font-size: 11.5px; color: var(--text-muted); font-style: italic;
  margin: 7px 0 0 46px; padding-left: 9px; border-left: 2px solid var(--border);
}
.man-at { font-style: normal; font-variant-numeric: tabular-nums; margin-right: 6px; opacity: .8; }

.man-fields { display: flex; gap: 10px; flex-wrap: wrap; margin: 11px 0 0 46px; }
.man-field { display: flex; flex-direction: column; gap: 3px; flex: 1 1 200px; }
.man-field > span {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 700;
}

/* The reason the button is disabled, said rather than left to be guessed. */
.man-missing {
  font-size: 11.5px; color: var(--warn-text); font-weight: 600;
  margin: 9px 0 0 46px;
}
.man-outcome {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--success-text); margin: 9px 0 0 46px;
}
.man-outcome-off { color: var(--text-muted); }

.man-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.man-actions .ptm-btn:disabled { opacity: .5; cursor: not-allowed; }
.man-discard { color: var(--text-muted); }

@media (max-width: 620px) {
  .man-quote, .man-fields, .man-missing, .man-outcome { margin-left: 0; }
  .man-fields { flex-direction: column; }
}

/* MTG-01 — who decided, inside the DECISION block.
   AC2 is "who decided AND what was decided", so the attribution rides in the
   block rather than only in meeting_agent_note. NOTE: like every other class
   on a memo block, this is stripped by sanitiseMemoHtml on reopen until MEM-06
   is fixed — the TEXT still renders, so the criterion holds either way; this
   rule is what makes it look deliberate once the block attributes survive. */
.mb-by {
  font-size: 10.5px; color: var(--text-muted); white-space: nowrap;
  margin-left: auto; padding-left: 10px; flex: 0 0 auto;
}

/* ── MEM-02 — document templates and generation ───────────────────────── */
.dtp-modal { width: min(900px, 95vw); }
.dtp-body { max-height: 68vh; overflow-y: auto; }
.dtp-tabs { padding: 0 20px; }
.dtp-empty { font-size: 12.5px; color: var(--text-muted); padding: 14px 2px; }
.dtp-error { color: var(--danger-text); font-size: 12.5px; }

.dtp-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 16px 0 6px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); font-weight: 700;
}
.dtp-refresh { font-size: 11px; padding: 3px 9px; }
.dtp-preview {
  border: 1px solid var(--border); border-radius: 7px; padding: 16px 18px;
  background: var(--surface); max-height: 300px; overflow-y: auto; font-size: 13px;
  line-height: 1.55;
}
.dtp-preview h1 { font-size: 17px; margin: 0 0 8px; }
.dtp-preview h2 { font-size: 14px; margin: 12px 0 6px; }
.dtp-preview p { margin: 0 0 8px; }

/* THE REJECT IF, on screen. A field with nothing behind it is marked where its
   value would have been — never left blank, because a blank in a generated
   contract reads as a term that says nothing rather than one never filled in. */
.dt-unresolved {
  background: var(--danger-tint); color: var(--danger-text);
  border: 1px dashed var(--danger); border-radius: 3px;
  padding: 0 5px; font-size: .92em; font-style: normal; white-space: nowrap;
}
.dtp-unresolved {
  border: 1px solid var(--warn); background: var(--warn-tint);
  border-radius: 7px; padding: 11px 13px; margin: 12px 0;
}
.dtp-unresolved-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--warn-text); margin-bottom: 6px;
}
.dtp-unresolved ul { margin: 0 0 0 18px; font-size: 12px; line-height: 1.6; }
.dtp-unresolved code {
  background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 11.5px;
}
.dtp-unresolved-foot { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.dtp-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dtp-done {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--success); background: var(--success-tint);
  border-radius: 7px; padding: 13px 15px; font-size: 13px;
}
.dtp-done-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* ── Authoring ──────────────────────────────────────────────────────── */
.dtp-manage { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.dtp-manage-list { border-right: 1px solid var(--border); padding-right: 14px; }
.dtp-manage-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 8px;
}
.dtp-manage-head .ptm-btn { font-size: 11px; padding: 3px 8px; }
.dtp-tmpl {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  cursor: pointer; padding: 8px 9px; border-radius: 6px; margin-bottom: 3px;
  background: transparent; border: 1px solid transparent; color: var(--text);
}
.dtp-tmpl:hover { background: var(--bg-hover); }
.dtp-tmpl.is-on { background: var(--brand-faint); border-color: var(--brand-soft); }
.dtp-tmpl-name { font-size: 12.5px; font-weight: 600; }
.dtp-tmpl-meta { font-size: 10.5px; color: var(--text-muted); }

.dtp-editor { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.dtp-fields { margin-top: 14px; }
.dtp-fields-head {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 6px;
}
.dtp-field-group { margin-bottom: 8px; }
.dtp-field-group > span {
  display: block; font-size: 10.5px; color: var(--text-muted); margin-bottom: 3px;
}
.dtp-field {
  cursor: pointer; font-family: ui-monospace, Consolas, monospace; font-size: 11px;
  padding: 2px 7px; margin: 0 4px 4px 0; border-radius: 4px;
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--text);
}
.dtp-field:hover { border-color: var(--brand); color: var(--brand); }

.dtp-versions { margin-top: 16px; }
.dtp-version { font-size: 11.5px; padding: 3px 0; }
.dtp-version > span { color: var(--text-muted); margin-left: 6px; }
.dtp-version-note {
  font-size: 11px; color: var(--text-muted); margin-top: 7px;
  padding-top: 7px; border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .dtp-manage { grid-template-columns: 1fr; }
  .dtp-manage-list { border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; }
}

/* ── MEM-03 — signatures ──────────────────────────────────────────────── */
.dsp-modal { width: min(660px, 94vw); }
.dsp-body { max-height: 68vh; overflow-y: auto; }
.dsp-empty { font-size: 12.5px; color: var(--text-muted); padding: 12px 2px; }

.dsp-status {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; padding: 11px 13px; border-radius: 7px; margin-bottom: 12px;
  border: 1px solid var(--border);
}
.dsp-status-label { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; }
.dsp-status-detail { font-size: 11.5px; color: var(--text-muted); }
.dsp-unsigned { background: var(--surface-alt); }
.dsp-signed { background: var(--success-tint); border-color: var(--success); }
.dsp-signed .dsp-status-label { color: var(--success-text); }
/* The state that must never look like the one above it. */
.dsp-superseded { background: var(--warn-tint); border-color: var(--warn); }
.dsp-superseded .dsp-status-label { color: var(--warn-text); }

.dsp-warn {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px; line-height: 1.5; color: var(--warn-text);
  background: var(--warn-tint); border: 1px solid var(--warn);
  border-radius: 7px; padding: 10px 12px; margin-bottom: 14px;
}

.dsp-section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 700; margin: 16px 0 7px;
}

.dsp-sig {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0; border-top: 1px solid var(--border);
}
.dsp-sig.is-reversed { opacity: .6; }
.dsp-sig-main { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.dsp-sig-who { font-size: 13px; font-weight: 600; }
.dsp-sig-meta { font-size: 11px; color: var(--text-muted); }
.dsp-sig-stmt { font-size: 11.5px; font-style: italic; color: var(--text-muted); }
.dsp-sig-reversed { font-size: 11.5px; color: var(--warn-text); }
.dsp-reverse {
  cursor: pointer; font-size: 11.5px; padding: 3px 9px; border-radius: 5px;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  flex: 0 0 auto;
}
.dsp-reverse:hover { border-color: var(--danger); color: var(--danger-text); }

.dsp-req {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; padding: 6px 0; border-top: 1px solid var(--border);
}
.dsp-req em { font-style: normal; font-size: 11px; color: var(--text-muted); margin-left: 6px; }
.dsp-cancel-req {
  cursor: pointer; font-size: 11px; padding: 2px 8px; border-radius: 5px;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
}

.dsp-signbox, .dsp-requestbox {
  margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--border);
}
.dsp-signbox-hint { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.5; }
.dsp-signbox .ptm-input, .dsp-requestbox .ptm-input { margin-bottom: 8px; }

/* ── FAW-202 — the relay stage mapping ─────────────────────────────────────
   The screen shipped with no stylesheet at all: `grep -c "sm-" app.css` was 0.
   That is consistent with nothing ever having instantiated it — an unreachable
   screen is never looked at, so nobody saw the unstyled table.

   Written against the theme tokens rather than fixed hexes so it is correct in
   both themes, and using --warn-tint/--success-tint for the banner because
   those already take the colour of whatever surface they land on. */

/* The board's own strip. Only rendered when a column is unmapped, so it is a
   problem statement, not furniture. */
.kanban-relay {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 10px; padding: 9px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text);
  font-size: 12.5px; line-height: 1.45;
}
/* Two states. The warning is the one that should catch an eye; the healthy
   state is a way in, not an announcement, so it stays uncoloured and muted. */
.kanban-relay.kr-warn { background: var(--warn-tint); }
.kanban-relay.kr-ok { background: var(--surface); color: var(--text-muted); }
.kanban-relay svg { flex: none; color: var(--warn-text); }
.kanban-relay .kr-text { min-width: 0; }
.kanban-relay .kr-btn { flex: none; margin-left: auto; white-space: nowrap; }

/* The `unmapped` badge, once it is a button. It must keep reading as the same
   badge it was — same italic, same muted weight — and only pick up an
   affordance, or the board grows a row of buttons where it had labels. */
button.stage-badge-fix {
  font: inherit; font-style: italic;
  border: 0; background: none; cursor: pointer;
  text-align: left; width: 100%;
  text-decoration: underline; text-decoration-style: dotted;
  text-underline-offset: 2px;
}
button.stage-badge-fix:hover { opacity: 1; color: var(--text); }
button.stage-badge-fix:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px;
}

/* The dialog shell. .modal/.modal-backdrop carry the overlay and the card;
   this only sizes it, because the table inside wants width. */
.modal.sm-modal {
  /* .modal caps everything at max-width: 720px. The mapping table is four
     columns wide with a select in one of them; at 720 the stage names wrap. */
  width: min(920px, 94vw); max-width: min(920px, 94vw); max-height: 86vh;
  display: flex; flex-direction: column;
}
.sm-modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.sm-modal-head h3 {
  margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px;
}
.sm-modal-close {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 6px;
}
.sm-modal-close:hover { background: var(--surface-alt); color: var(--text); }
.sm-modal-body { overflow: auto; padding: 4px 18px 18px; }

.stage-map { font-size: 13px; color: var(--text); }
.sm-head h2 {
  margin: 14px 0 4px; font-size: 15px;
  display: flex; align-items: center; gap: 8px;
}
.sm-head .subtitle { margin: 0 0 14px; color: var(--text-muted); font-size: 12.5px; }

.sm-empty, .sm-error { padding: 28px 4px; color: var(--text-muted); }
.sm-error { color: var(--danger-text); }

.sm-banner {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 13px; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 14px;
  font-size: 12.5px; line-height: 1.5;
}
.sm-banner svg { flex: none; margin-top: 1px; }
.sm-banner.ok { background: var(--success-tint); }
.sm-banner.ok svg { color: var(--success-text); }
.sm-banner.warn { background: var(--warn-tint); }
.sm-banner.warn svg { color: var(--warn-text); }
.sm-banner code {
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 4px; padding: 0 5px; font-size: 11.5px;
}

.sm-table { width: 100%; border-collapse: collapse; }
.sm-table th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted);
  padding: 6px 10px; border-bottom: 1px solid var(--border);
}
.sm-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sm-table tr:last-child td { border-bottom: 0; }
.sm-table .sm-num { text-align: right; width: 70px; color: var(--text-muted); }
/* The unmapped rows are the reason this screen exists, so they are marked
   rather than left to be found by reading every select. */
.sm-table tr.sm-unmapped { background: var(--warn-tint); }
.sm-select { width: 100%; max-width: 280px; }
.sm-meta { color: var(--text-muted); font-size: 12px; }
.sm-auto { font-style: italic; }

.sm-actions {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 4px; flex-wrap: wrap;
}
.sm-detail { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.sm-detail summary { cursor: pointer; font-size: 12.5px; color: var(--text-muted); }
.sm-detail ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.sm-detail li { padding-left: 10px; border-left: 2px solid var(--border); }
.sm-owner {
  margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  background: var(--neutral-tint); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted);
}

@media (max-width: 640px) {
  .kanban-relay { flex-wrap: wrap; }
  .kanban-relay .kr-btn { margin-left: 0; width: 100%; }
  .sm-table .sm-num { display: none; }
  .sm-table th:nth-child(2) { display: none; }
}
/* NOT-02 — the per-category notification matrix.
   One row per category, channels on the right. A channel the workspace has
   closed, or a transactional category, renders as a locked checkbox rather
   than being hidden: a person should be able to SEE that a thing is always
   on (or switched off for everyone) rather than wonder where it went. */
.notif-matrix {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.notif-row:last-child { border-bottom: none; }

.notif-row-main { min-width: 0; }

.notif-row-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.notif-row-sub {
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.notif-row-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

.notif-row-channels {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
  padding-top: 2px;
}

.notif-ch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}

.notif-ch.is-locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.notif-quiet-times {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.notif-quiet-times label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

@media (max-width: 640px) {
  .notif-row {
    flex-direction: column;
    gap: 8px;
  }
  .notif-row-channels { padding-top: 0; }
}

/* NOT-03 — how often, per category. Sits beside the channel boxes because it
   is the same decision: what do I want from this category, and how often. */
.notif-cadence {
  font-size: 13px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  min-width: 132px;
}

.notif-cadence.is-locked {
  opacity: 0.5;
  border-color: transparent;
  background: none;
  white-space: nowrap;
}

/* NOT-08 — the notification centre's filter bar. */
.nv-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.nv-tabs { display: flex; gap: 4px; }

.nv-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.nv-tab.is-on {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}

.nv-selects { display: flex; gap: 8px; flex-wrap: wrap; }

.nv-filter {
  font-size: 13px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  max-width: 200px;
}

.nv-cat { color: var(--text-muted); }

/* ACC-01 — the Accounting screens' table.
 *
 * The first draft of these screens used `class="table"`, which does not exist
 * in this stylesheet and never has: the tables rendered with the browser's
 * default layout, so every header sat over the wrong column. Modelled on
 * .files-table, which is the closest thing this codebase has to a house table,
 * rather than adding a third look. */
.acc-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.acc-table th, .acc-table td { text-align: left; padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
.acc-table thead th { background: var(--surface-alt); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.acc-table tbody tr:last-child td { border-bottom: none; }

/* ---------- RPT-01: the Reports registry page ---------- */
.reports-list { display: grid; gap: 16px; max-width: 900px; }
.report-card {
  background: var(--surface, #1b1c24);
  border: 1px solid var(--border, #2a2b36);
  border-radius: 10px;
  padding: 18px 20px;
}
.report-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.report-card-head h2 { margin: 0; font-size: 17px; color: var(--text, #fff); }
.report-scope {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted, #8a8b94);
  border: 1px solid var(--border, #2a2b36); border-radius: 999px; padding: 2px 10px;
}
.report-purpose { margin: 8px 0 14px; color: var(--text, #e4e4e8); font-size: 13px; }

.report-meta { display: grid; gap: 8px; margin: 0 0 14px; }
.report-meta > div { display: grid; grid-template-columns: 190px 1fr; gap: 10px; }
.report-meta dt {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted, #8a8b94);
}
.report-meta dd { margin: 0; font-size: 13px; color: var(--text, #e4e4e8); }
.report-meta code { font-size: 12px; color: var(--text-muted, #8a8b94); }

.report-def-toggle {
  background: none; border: 1px solid var(--border, #2a2b36);
  color: var(--text, #fff); padding: 6px 12px; border-radius: 6px;
  font-size: 12px; cursor: pointer;
}
.report-def-toggle:hover { border-color: var(--accent); }

.report-definitions { margin-top: 14px; display: grid; gap: 14px; }
.report-figure { border-left: 2px solid var(--border, #2a2b36); padding-left: 12px; }
.report-figure-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.report-figure-head strong { color: var(--text, #fff); font-size: 13px; }
.report-unit {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted, #8a8b94);
}
/* A provisional definition is called out in words as well as colour — the same
   rule the portal pills follow. A figure whose meaning is not yet settled must
   not be quoted as though it were. */
.report-provisional {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  background: #3a3011; color: #e8c766; border-radius: 999px; padding: 1px 8px;
}
.report-figure-def { margin: 4px 0 0; font-size: 13px; color: var(--text, #e4e4e8); }
.report-ruling {
  margin-top: 6px; padding: 8px 10px;
  background: var(--bg, #24252f); border-radius: 6px;
}
.report-ruling-q { font-size: 12px; color: var(--text, #fff); }
.report-ruling-why { font-size: 12px; color: var(--text, #e4e4e8); margin-top: 3px; }
.report-ruling-by { font-size: 11px; color: var(--text-muted, #8a8b94); margin-top: 5px; }

.reports-provisional-note {
  max-width: 900px; margin: 0 0 16px;
  background: #3a3011; color: #e8c766;
  border-radius: 8px; padding: 10px 14px; font-size: 13px;
}
.reports-empty, .reports-error {
  max-width: 900px; padding: 24px; border-radius: 10px;
  border: 1px dashed var(--border, #2a2b36); color: var(--text-muted, #8a8b94);
  font-size: 13px;
}
.reports-error { border-style: solid; border-color: #8c1d18; color: #f0a49c; }

@media (max-width: 640px) {
  .report-meta > div { grid-template-columns: 1fr; gap: 2px; }
}

/* ── SAL-01 — Sales page ──────────────────────────────────────────
   Colours come from the theme tokens only. No literal hex here: the
   workspace brand colour and the light/dark pair are both variables, and a
   hard-coded colour is the thing that looks right in one theme and
   unreadable in the other. */
.sales-page .page-sub { color: var(--text-muted); margin: 4px 0 0; font-size: 13px; }

.sales-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}
.sales-figure {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.sales-figure-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sales-figure-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); font-weight: 600;
}
/* The definition button. Present on EVERY figure — SAL-01's fourth criterion
   is that the definition is reachable, and a figure without this button is a
   figure that fails it. */
.sales-def-btn {
  width: 18px; height: 18px; flex: none;
  border-radius: 50%; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  font-size: 11px; font-style: italic; line-height: 1; cursor: pointer;
}
.sales-def-btn:hover, .sales-def-btn:focus-visible {
  color: var(--text); border-color: var(--text-muted);
}
.sales-figure-value { font-size: 24px; font-weight: 650; margin-top: 6px; color: var(--text); }
.sales-figure-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sales-def { display: none; }
.sales-figure.def-open .sales-def {
  display: block;
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.sales-def-title { font-weight: 650; font-size: 13px; margin-bottom: 6px; }
.sales-def-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); margin-top: 8px; font-weight: 600;
}
.sales-def-line { font-size: 12px; line-height: 1.5; color: var(--text); }
.sales-def-status {
  margin-top: 8px; font-size: 11px; color: var(--warn-text);
  background: var(--warn-tint); border-radius: 6px; padding: 5px 8px;
}

.sales-pipeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
}
.sales-col { background: var(--surface-alt); border-radius: 10px; padding: 10px; min-width: 220px; }
.sales-col-head { display: flex; align-items: center; justify-content: space-between; }
.sales-col-title { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.5px; }
.sales-col-count {
  font-size: 11px; color: var(--text-muted);
  background: var(--surface); border-radius: 999px; padding: 1px 8px;
}
.sales-col-total { font-size: 12px; color: var(--text-muted); margin: 4px 0 10px; }
.sales-col-body { display: flex; flex-direction: column; gap: 8px; }
.sales-empty { font-size: 12px; color: var(--text-muted); margin: 4px 0; }

.sales-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; cursor: pointer;
}
.sales-card:hover, .sales-card:focus-visible { border-color: var(--accent); outline: none; }
.sales-card-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.sales-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.sales-card-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; }
.sales-card-value { font-size: 13px; font-weight: 600; }
.sales-card-prob { font-size: 11px; color: var(--text-muted); }
.sales-card-flag { font-size: 10px; color: var(--text-muted); margin-top: 6px; }

.sales-timeline { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.sales-timeline ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sales-timeline li { display: flex; flex-direction: column; font-size: 11px; }
.sales-tl-kind { text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; font-size: 10px; }
.sales-tl-body { color: var(--text); }
.sales-tl-actor { color: var(--text-muted); }

/* 2026-10-15 — a part of the Sales page that failed to load, named. */
.sales-missing { margin: 0 0 16px; color: var(--danger-text); font-size: 13px; }

/* ── SAL-04 — the release queue on the Sales page ─────────────────
   Uses the warn tokens rather than danger: something waiting on a person is
   not an error, and painting it red teaches people to dismiss it. */
.sales-queue {
  background: var(--surface);
  border: 1px solid var(--warn-text);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 24px;
}
.sales-queue-head { display: flex; align-items: center; gap: 10px; }
.sales-queue-head h2 { font-size: 14px; margin: 0; font-weight: 650; }
.sales-queue-count {
  background: var(--warn-tint); color: var(--warn-text);
  border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 650;
}
.sales-queue-note { font-size: 12px; color: var(--text-muted); margin: 4px 0 12px; }
.sales-queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sales-queue-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  background: var(--surface-alt);
}
.sales-queue-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.sales-queue-kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 650; color: var(--text-muted);
}
.sales-queue-age { font-size: 11px; color: var(--text-muted); }
.sales-queue-window { font-size: 11px; color: var(--text-muted); }
.sales-queue-late {
  font-size: 11px; color: var(--danger-text); background: var(--danger-tint);
  border-radius: 999px; padding: 1px 8px; font-weight: 600;
}
.sales-queue-body { font-size: 13px; line-height: 1.5; color: var(--text); }
.sales-queue-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 10px; flex-wrap: wrap;
}
.sales-queue-by { font-size: 11px; color: var(--text-muted); }
.sales-queue-actions { display: flex; gap: 6px; }

/* ── MKT-03 — the engagement queue ────────────────────────────────
   A pair per row: what the public said, and the reply drafted against it. */
.mkt-page .page-sub { color: var(--text-muted); margin: 4px 0 0; font-size: 13px; max-width: 62ch; }
.mkt-queue { margin-top: 20px; }
.mkt-queue-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.mkt-queue-head h2 { font-size: 14px; margin: 0; font-weight: 650; }
.mkt-queue-count {
  background: var(--warn-tint); color: var(--warn-text);
  border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 650;
}
.mkt-empty { font-size: 13px; color: var(--text-muted); margin: 12px 0; }
.mkt-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mkt-item {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px;
  border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  background: var(--surface);
}
@media (max-width: 900px) { .mkt-item { grid-template-columns: minmax(0, 1fr); } }
.mkt-inbound-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mkt-channel {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 650; color: var(--text); background: var(--surface-alt);
  border-radius: 4px; padding: 1px 6px;
}
.mkt-kind, .mkt-age, .mkt-window { font-size: 11px; color: var(--text-muted); }
.mkt-late {
  font-size: 11px; color: var(--danger-text); background: var(--danger-tint);
  border-radius: 999px; padding: 1px 8px; font-weight: 600;
}
.mkt-author { font-size: 13px; font-weight: 600; margin-top: 8px; }
.mkt-body {
  margin: 6px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--border);
  font-size: 13px; line-height: 1.5; color: var(--text);
}
.mkt-draft { border-left: 1px solid var(--border); padding-left: 16px; }
@media (max-width: 900px) { .mkt-draft { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 12px; } }
.mkt-draft-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 650; color: var(--text-muted); margin-bottom: 6px;
}
.mkt-draft-none .mkt-draft-label { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 400; }
.mkt-draft-text {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  background: var(--bg-input); color: var(--text); resize: vertical;
}
.mkt-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* ── MKT-01 — channel configuration ───────────────────────────────
   A refused permission and an unchecked one are painted differently on
   purpose: they send a person to different places. */
.mkt-channels { margin-top: 28px; }
.mkt-channel-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mkt-channel-row {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; background: var(--surface);
}
.mkt-channel-row.disconnected { opacity: 0.62; }
.mkt-channel-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mkt-channel-label { font-size: 13px; font-weight: 650; }
.mkt-channel-kind {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); background: var(--surface-alt);
  border-radius: 4px; padding: 1px 6px;
}
.mkt-channel-handle { font-size: 12px; color: var(--text-muted); }
.mkt-channel-off {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 650;
  color: var(--warn-text); background: var(--warn-tint); border-radius: 999px; padding: 1px 8px;
}
.mkt-channel-cred { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.mkt-perms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mkt-perm {
  font-size: 11px; border-radius: 999px; padding: 2px 9px;
  border: 1px solid transparent; cursor: default;
}
.mkt-perm.ok { background: var(--success-tint); color: var(--success-text); }
.mkt-perm.no { background: var(--danger-tint); color: var(--danger-text); }
/* Never checked is NOT painted as refused — it is an open question, and
   colouring it red would send people to the platform instead of to this page. */
.mkt-perm.unknown {
  background: transparent; color: var(--text-muted); border-color: var(--border);
  border-style: dashed;
}

/* ── MKT-02 — the content calendar and what needs attention ───────
   The unresolved block uses warn, not danger: something with no result yet is
   a question, not a failure. A genuine failure inside it carries its own
   danger-toned reason line. */
.mkt-unresolved {
  margin-top: 28px; padding: 14px 16px;
  border: 1px solid var(--warn-text); border-radius: 10px; background: var(--surface);
}
.mkt-calendar { margin-top: 28px; }
.mkt-cal-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mkt-cal-item {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface);
}
.mkt-cal-item.urgent { background: var(--surface-alt); }
@media (max-width: 760px) { .mkt-cal-item { grid-template-columns: minmax(0, 1fr); } }
.mkt-cal-when { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mkt-cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mkt-res {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 650;
  border-radius: 999px; padding: 1px 8px;
}
.mkt-res.ok { background: var(--success-tint); color: var(--success-text); }
.mkt-res.bad { background: var(--danger-tint); color: var(--danger-text); }
.mkt-res.warn { background: var(--warn-tint); color: var(--warn-text); }
.mkt-res.muted { background: var(--surface-alt); color: var(--text-muted); }
.mkt-cal-notes { font-size: 13px; margin-top: 6px; }
.mkt-cal-fail { font-size: 12px; color: var(--danger-text); margin-top: 6px; }
.mkt-cal-live { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.mkt-cal-live code { font-size: 11px; background: var(--surface-alt); border-radius: 4px; padding: 1px 5px; }
.mkt-cal-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── MKT-04 — listening rules ─────────────────────────────────────
   A rule reads as a name and a list of terms, because an owner writes it. */
.mkt-listening { margin-top: 28px; }
.mkt-rule-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mkt-rule {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface);
}
.mkt-rule.off { opacity: 0.6; }
.mkt-rule-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mkt-rule-name { font-size: 13px; font-weight: 650; }
.mkt-rule-terms { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.mkt-term {
  font-size: 11px; background: var(--surface-alt); border-radius: 4px; padding: 1px 7px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.mkt-rule-mode { font-size: 11px; color: var(--text-muted); }
.mkt-rule-foot { font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.mkt-rule-foot code { font-size: 11px; background: var(--surface-alt); border-radius: 4px; padding: 1px 5px; }

/* ── MKT-05 — campaigns and the chain to placement ────────────────
   The chain renders as a chain: one row per advertisement, each showing every
   hop, because the claim is that the links are stored rather than inferred. */
.mkt-campaigns { margin-top: 28px; }
.mkt-camp-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mkt-camp {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface);
}
.mkt-camp.archived { opacity: 0.62; }
.mkt-camp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mkt-camp-name { font-size: 13px; font-weight: 650; }
.mkt-camp-money { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.mkt-chain { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mkt-chain-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; background: var(--surface-alt); border-radius: 6px; padding: 6px 10px;
}
.mkt-chain-hop { color: var(--text); }
.mkt-chain-hop em { color: var(--text-muted); font-style: italic; }
.mkt-chain-arrow { color: var(--text-muted); }
.mkt-chain-cost { margin-left: auto; color: var(--text-muted); font-size: 11px; }

/* ── MKT-06 — performance and attribution ─────────────────────────
   Two columns, never one row: the REJECT IF is that Forge-recorded and
   platform-reported figures get added together, and adjacent cells in one
   table is an invitation to do exactly that. */
.mkt-performance { margin-top: 28px; }
.mkt-perf-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mkt-perf { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.mkt-perf-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mkt-perf-none { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }
.mkt-perf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
@media (max-width: 760px) { .mkt-perf-cols { grid-template-columns: 1fr; } }
.mkt-perf-col { background: var(--surface-alt); border-radius: 8px; padding: 10px 12px; }
.mkt-perf-col.platform { border: 1px dashed var(--border); background: transparent; }
.mkt-perf-src {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 650; color: var(--text-muted); margin-bottom: 8px;
}
.mkt-perf-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 12px; }
.mkt-perf-dl dt { color: var(--text-muted); }
.mkt-perf-dl dd { margin: 0; color: var(--text); }
.mkt-fig-none { color: var(--text-muted); font-style: italic; }
.mkt-perf-warn { font-size: 11px; color: var(--text-muted); margin: 10px 0 0; }

/* ── SAL-05 — forecast and pipeline reporting ─────────────────────
   The weighting sits in the row it multiplies, so a reader can see which
   number is doing the work without opening settings. */
.sales-forecast { margin-top: 28px; }
/* The forecast/quotes tables have a natural minimum width wider than a phone.
   Let them scroll inside their own box rather than pushing the page sideways —
   same treatment as .tp-wrap and .pl-list-wrap. */
.sales-fc-wrap { overflow-x: auto; }
.sales-fc-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
.sales-fc-table th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); font-weight: 650; padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.sales-fc-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.sales-fc-table tfoot td { font-weight: 650; border-bottom: 0; border-top: 2px solid var(--border); }
.sales-fc-n { color: var(--text-muted); font-size: 11px; }
.sales-fc-over {
  font-size: 10px; background: var(--surface-alt); color: var(--text-muted);
  border-radius: 4px; padding: 0 5px;
}
.sales-fc-stalled { margin-top: 16px; }
.sales-fc-stalled ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.sales-fc-sources { margin-top: 20px; }

/* ── SAL-03 — quotes ──────────────────────────────────────────────
   The accepted version sits beside the accepter's name: an acceptance applies
   to the wording it was given. */
.sales-quotes { margin-top: 28px; }

/* ── N-02 — document control: the banner and the panel ──────────────
   The banner sits on the document's own face because a revision number behind
   a button is one nobody acts on, and a SUPERSEDED document has to announce
   itself — a reader acting on a withdrawn policy is the failure document
   control exists to prevent. Hence three states with three weights. */
.me-revbar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px; padding: 8px 12px;
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 6px; font-size: 13px; color: var(--text);
  background: var(--surface);
}
.me-revbar em { color: var(--text-muted); font-style: normal; }
.me-revbar-draft { border-left-color: var(--text-muted); color: var(--text-muted); }
.me-revbar-superseded {
  border-left-color: var(--danger-text, #e5484d);
  background: color-mix(in srgb, var(--danger-text, #e5484d) 8%, var(--surface));
}
.me-revbar-superseded a { color: var(--brand-text); }

.mr-back {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px; overflow-y: auto;
}
.mr-panel {
  width: 100%; max-width: 520px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 16px;
}
.mr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mr-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.mr-loading, .mr-empty { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
/* A server refusal, shown verbatim. Every one of them is a sentence saying
   what to do instead, so it gets room to be read rather than a toast. */
.mr-error {
  margin-bottom: 12px; padding: 8px 10px; border-radius: 6px; font-size: 13px;
  color: var(--danger-text, #e5484d);
  border: 1px solid color-mix(in srgb, var(--danger-text, #e5484d) 40%, transparent);
  background: color-mix(in srgb, var(--danger-text, #e5484d) 8%, transparent);
}
.mr-off p { margin: 0 0 8px; font-size: 13px; }
.mr-off-why { color: var(--text-muted); }
.mr-field { display: block; margin: 0 0 10px; font-size: 13px; }
.mr-field > span { display: block; margin-bottom: 4px; color: var(--text-muted); }
.mr-field em { font-style: normal; opacity: 0.7; }
.mr-field input, .mr-field textarea {
  width: 100%; box-sizing: border-box; padding: 7px 9px; font: inherit; font-size: 13px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
}
.mr-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mr-ref { font-size: 12px; color: var(--text-muted); }
.mr-badge {
  font-size: 12px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg);
}
.mr-badge-draft { color: var(--text-muted); }
.mr-badge-superseded {
  color: var(--danger-text, #e5484d);
  border-color: color-mix(in srgb, var(--danger-text, #e5484d) 40%, transparent);
}
.mr-issue, .mr-supersede {
  border-top: 1px solid var(--border); padding-top: 12px; margin-bottom: 12px;
}
.mr-issue-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.mr-supersede summary { font-size: 13px; cursor: pointer; color: var(--text-muted); }
.mr-supersede[open] summary { margin-bottom: 8px; color: var(--text); }
.mr-list-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); border-top: 1px solid var(--border);
  padding-top: 12px; margin-bottom: 8px;
}
.mr-list { list-style: none; margin: 0; padding: 0; }
.mr-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.mr-item:last-child { border-bottom: none; }
.mr-item.is-superseded { opacity: 0.65; }
.mr-item-head { display: flex; align-items: baseline; gap: 8px; }
.mr-item-date { color: var(--text-muted); font-size: 12px; }
.mr-item-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted);
}
.mr-item-log { margin-top: 3px; color: var(--text); }
.mr-item-why { margin-top: 3px; color: var(--text-muted); font-size: 12px; }

/* ── N-03 — Drive ───────────────────────────────────────────────────
   The scope chip is load-bearing rather than decoration: Drive lists one
   object per file across three surfaces, and a reader who cannot tell where a
   file came from is a reader who re-uploads it — which is how a second copy
   appears without anybody building a second store. */
/* The Share dialog (folder-access.js) still uses .dr-btn. */
.dr-btn {
  padding: 4px 10px; font-size: 12px; border-radius: 5px; cursor: pointer;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
}

/* ── Drive items, 2026-09 (docs/proposals/drive-redesign.md) ─────────────────
   ONE list for folders and files — "a file browser lives or dies on being able
   to scan forty items quickly". No header row, no per-row borders, no
   always-on text buttons: one row shape, a quiet detail line, actions on hover,
   on keyboard focus and in a "⋯" menu.

   MEASURED, across the seven staging brands and both themes (worst case):
   name on a hovered row 9.36:1; detail text on a hovered row 4.96:1; folder
   icon (--brand-text) on a hovered row 4.71:1 (non-text, needs 3). Hover and
   selection use a 10% brand tint, NEVER 16%: at 16% the detail text fell to
   4.11:1 on a yellow brand in dark theme. Delete's red is set per theme and
   measured in drive-redesign.test.ts. */
.dr2 {
  position: relative;
  --dr2-hover: color-mix(in srgb, var(--brand) 10%, var(--surface));
  --dr2-danger: #b3261e;
}
html[data-theme="dark"] .dr2 { --dr2-danger: #ff9a8a; }
.dr2-loading { padding: 24px; color: var(--text-muted); }

.dr2-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dr2-head-text { flex: 1 1 320px; min-width: 0; }
.dr-crumbs { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.dr-crumbs a { color: var(--text-muted); text-decoration: none; }
.dr-crumbs a:hover { color: var(--brand-text); text-decoration: underline; }
.dr2-sep { color: var(--text-muted); }
.dr2-here { margin: 0; overflow-wrap: anywhere; }
.dr2-actions-bar { display: flex; gap: 8px; flex-wrap: wrap; }

.dr2-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.dr2-search {
  flex: 1 1 240px; min-width: 180px; height: 34px; padding: 0 10px;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-muted);
}
.dr2-search:focus-within { border-color: var(--brand-text); }
.dr2-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 13px;
}
.dr2-sort { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.dr2-sort select {
  height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
}
.dr2-toggle {
  height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  background: var(--surface); color: var(--text-muted); font-size: 13px;
}
.dr2-toggle.on { color: var(--text); border-color: var(--brand-text); }

.dr2-list {
  display: flex; flex-direction: column; padding: 4px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.dr2-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 38px; padding: 3px 6px 3px 10px; border-radius: 7px; cursor: pointer; position: relative;
}
.dr2-row:hover, .dr2-row:focus-within { background: var(--dr2-hover); }
.dr2-row:focus-visible { outline: none; background: var(--dr2-hover); box-shadow: inset 3px 0 0 var(--brand-text); }
.dr2-icon { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.dr2-folder .dr2-icon { color: var(--brand-text); }
.dr2-main { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.dr2-name {
  flex: 0 1 auto; min-width: 0; font-size: 14px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dr2-meta {
  flex: 0 1000 auto; min-width: 0; font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}

.dr2-row-actions { display: flex; align-items: center; gap: 2px; }
.dr2-icon-btn {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer;
}
.dr2-icon-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.dr2-icon-btn:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; color: var(--text); }
/* Inline actions on hover and keyboard focus; the "⋯" is always there. */
.dr2-row .dr2-icon-btn:not(.dr2-more) { opacity: 0; }
.dr2-row:hover .dr2-icon-btn, .dr2-row:focus-within .dr2-icon-btn { opacity: 1; }
.dr2-menu-wrap { position: relative; }
.dr2-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 168px; padding: 4px;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.dr2-menu[hidden] { display: none; }
/* 2026-11-22 — Drive's one Upload button and its Files / Folder / Photo menu. */
.dr2-upload-wrap { display: inline-flex; }
.dr2-upload-wrap > .dash-btn { width: 100%; }
.dr2-empty-actions .dr2-upload-menu { right: auto; left: 0; }
.dr2-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.dr2-menu-item:hover, .dr2-menu-item:focus-visible { background: var(--dr2-hover); outline: none; }
.dr2-menu-item.danger { color: var(--dr2-danger); }

.dr2-naming { cursor: default; background: var(--dr2-hover); }
.dr2-name-input {
  min-width: 0; padding: 5px 8px; font: inherit; font-size: 14px;
  border: 1px solid var(--brand-text); border-radius: 6px; background: var(--surface); color: var(--text);
}
.dr2-naming-hint { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.dr2-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 40px 16px; border: 1.5px dashed var(--border); border-radius: 12px; color: var(--text-muted);
}
.dr2-empty strong { color: var(--text); font-size: 15px; }
.dr2-empty > svg, .dr2-empty > i { color: var(--brand-text); }
.dr2-empty-drop { border-color: var(--brand-text); }
.dr2-empty-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.dr2-flat-title { font-size: 12px; color: var(--text-muted); margin: 4px 0 8px; }

/* Dragging files over the page says where they will land. */
.dr2-drop {
  position: absolute; inset: 0; z-index: 30; pointer-events: none;
  display: none; align-items: center; justify-content: center;
  border: 2px dashed var(--brand-text); border-radius: 12px; background: var(--dr2-hover);
}
.dr2.dropping .dr2-drop { display: flex; }
.dr2-drop > div { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text); }
.dr2-drop svg { color: var(--brand-text); }

/* List / Grid switch. Pressed = the brand as a border and full-contrast text;
   unpressed = muted text on the surface (6.16:1 light, 6.52:1 dark). */
.dr2-views { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.dr2-view {
  height: 32px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer;
}
.dr2-view + .dr2-view { border-left: 1px solid var(--border); }
.dr2-view.on { color: var(--text); background: var(--dr2-hover); box-shadow: inset 0 -2px 0 var(--brand-text); }
.dr2-view:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; }

/* GRID: the same rows as the list, laid out as tiles. A tile is the list's
   row surface (--surface) with the same hover tint, so every pairing measured
   for the list holds here unchanged — re-measured on screen all the same.
   The name may wrap to two lines; the detail line wraps IN FULL, so nothing
   the list shows is truncated away in a tile. */
.dr2-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px;
  padding: 0; border: 0; background: transparent;
}
.dr2-grid .dr2-row {
  grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: start;
  min-height: 128px; padding: 12px; gap: 0 6px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.dr2-grid .dr2-row:hover, .dr2-grid .dr2-row:focus-within { background: var(--dr2-hover); }
.dr2-grid .dr2-icon { grid-column: 1; grid-row: 1; justify-content: flex-start; }
.dr2-grid .dr2-row-actions { grid-column: 2; grid-row: 1; }
.dr2-grid .dr2-main { grid-column: 1 / -1; grid-row: 2; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 12px; }
.dr2-grid .dr2-name {
  white-space: normal; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dr2-grid .dr2-meta { white-space: normal; overflow: visible; }
.dr2-grid .dr2-naming { grid-column: 1 / -1; min-height: 0; grid-template-rows: auto; align-items: center; }
.dr2-grid .dr2-naming .dr2-name-input { grid-column: 1; }

/* Phone, and any device without hover: details under the name, actions in "⋯". */
@media (max-width: 720px) {
  .dr2-main { flex-direction: column; align-items: flex-start; gap: 1px; }
  .dr2-name, .dr2-meta { max-width: 100%; }
  .dr2-row { min-height: 52px; }
  .dr2-naming-hint { display: none; }
  .dr2-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dr2-view span { display: none; }
}
@media (max-width: 720px), (hover: none) {
  .dr2-row .dr2-icon-btn:not(.dr2-more) { display: none; }
}

/* The agent note. Deliberately prominent: a reader assuming "everyone in the
   workspace" includes that workspace's agents is making exactly the assumption
   the access model refuses, and the screen has to say so unprompted. */
.fa-note {
  font-size: 12px; color: var(--text-muted); margin: 0 0 10px;
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  background: var(--bg);
}
.fa-note strong { color: var(--text); }
.fa-list { list-style: none; margin: 0 0 10px; padding: 0; }
.fa-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.fa-item > span:first-child { flex: 1 1 auto; }
.fa-add { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.fa-add select {
  flex: 1 1 140px; padding: 6px 8px; font: inherit; font-size: 13px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
}

/* N-03 — a notice that corrects an implication the UI itself creates.
   "Trash" implies a window that expires and "retention" implies a timer; the
   schema is here and no purge is scheduled. Saying so is the difference
   between a feature that is honest about its state and one that quietly does
   nothing. */
.dr-notice {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 0 12px; padding: 8px 12px; font-size: 12px;
  color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 6px;
}

/* ── N-05 — the financial dashboard ─────────────────────────────────
   THE UNAVAILABLE CARD IS THE POINT OF THIS BLOCK.

   Several of the eleven blocks have no data source until N-04 lands, so this
   screen is looked at with holes in it. A hole has to read as DELIBERATE:
   somebody scanning the page must be able to tell "not built yet" from "this
   page is broken" without opening anything, because those are different
   problems with different people to chase.

   So an unavailable card is NOT dimmed to near-invisibility and NOT styled as
   an error. It keeps full-strength title text, carries a neutral dashed border
   that reads as a placeholder rather than a fault, and states its reason and
   its dependency in normal body colour. Faded-out would say "ignore me"; red
   would say "something went wrong". Neither is true. */
.acc-dash { margin: 0 0 24px; }
.acc-dash-head { margin-bottom: 12px; }
.acc-dash-head h3 {
  margin: 0 0 6px; font-size: 15px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); font-weight: 500;
}
.acc-dash-note {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text-muted); padding: 7px 10px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--border);
}
.acc-dash-loading { color: var(--text-muted); font-size: 13px; padding: 12px 0; }
.acc-dash-error {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--danger-text, #e5484d); padding: 10px 12px; border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--danger-text, #e5484d) 40%, transparent);
  background: color-mix(in srgb, var(--danger-text, #e5484d) 8%, transparent);
  margin-bottom: 20px;
}
.acc-dash-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.acc-card {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--border); border-radius: 8px; padding: 13px;
  background: var(--surface);
}
.acc-card-label {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.acc-card-value { font-size: 22px; font-weight: 600; color: var(--text); }
.acc-card-detail { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.acc-card-cmp { font-size: 12px; color: var(--text-muted); }
.acc-card-cmp.up { color: var(--success-text, #46a758); }
.acc-card-cmp.down { color: var(--danger-text, #e5484d); }
/* An absent comparison, said rather than drawn as zero. */
.acc-card-absent { font-size: 11px; color: var(--text-muted); font-style: italic; }
.acc-card-link { font-size: 12px; margin-top: auto; padding-top: 6px; color: var(--brand-text); text-decoration: none; }
.acc-card-link:hover { text-decoration: underline; }

.acc-card-unavailable { border-style: dashed; background: var(--bg); }
.acc-card-pending {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 500; color: var(--text);
}
.acc-card-why { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.acc-card-needs {
  font-size: 11px; color: var(--brand-text); margin-top: 2px;
  padding-top: 5px; border-top: 1px solid var(--border);
}
.acc-card-empty .acc-card-value { color: var(--text-muted); font-size: 16px; font-weight: 500; }

/* ── N-07 — the agent payslip ────────────────────────────────────────
   Styled as a PAYSLIP and deliberately not as a dashboard tile. The employee
   record at the head is what makes the lines below read as a person's cost
   rather than a bill for compute, and the line/amount table is the shape
   anybody who has ever been paid already knows how to read.

   REJECT IF the screen presents as a usage meter. There are no token counts
   here and no gauge; every row is a named line with an amount. */
/* align-items:start — without it the grid equalises row heights and every card
   stretches to the tallest, which made an eight-agent grid 1445px tall with
   most of it empty. A payslip is as tall as its lines. */
/* min(440px, 100%) — 2026-10-16: a plain 440px minimum was wider than a
   phone, so every payslip card was cut and the page scrolled sideways. */
.ps-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); gap: 14px; margin-bottom: 8px; align-items: start; }
.ps-card {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); overflow: hidden;
  display: flex; flex-direction: column;
}
.ps-head { padding: 13px 14px; border-bottom: 1px solid var(--border); }
.ps-name { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.ps-record { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 0; }
.ps-field dt { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ps-field dd { margin: 0; font-size: 13px; color: var(--text); }
.ps-missing { margin-top: 8px; font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }

.ps-lines { width: 100%; border-collapse: collapse; }
.ps-line th {
  text-align: left; font-weight: 400; font-size: 13px; color: var(--text);
  padding: 9px 14px; vertical-align: top;
}
.ps-line td {
  text-align: right; font-size: 13px; padding: 9px 14px;
  white-space: nowrap; vertical-align: top; color: var(--text);
}
.ps-line + .ps-line th, .ps-line + .ps-line td { border-top: 1px solid var(--border); }
.ps-basis, .ps-why, .ps-needs {
  display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.45;
}
.ps-needs { color: var(--brand-text); }
/* An unavailable line keeps its label at full strength — it is a real line of
   the payslip whose amount is not yet knowable, not a row to be ignored. */
.ps-line-unavailable th { color: var(--text); }
.ps-absent { color: var(--text-muted); font-style: italic; font-size: 12px; }
.ps-total th {
  text-align: left; padding: 11px 14px; font-size: 13px; font-weight: 600;
  border-top: 2px solid var(--border);
}
.ps-total td {
  text-align: right; padding: 11px 14px; font-size: 15px; font-weight: 600;
  border-top: 2px solid var(--border); white-space: nowrap;
}
/* The closing argument, at the foot of the card where a closing argument goes. */
.ps-headline {
  padding: 12px 14px; border-top: 1px solid var(--border);
  background: var(--bg); margin-top: auto;
}
.ps-headline-value { font-size: 20px; font-weight: 600; color: var(--brand-text); }
.ps-headline-label { font-size: 12px; color: var(--text-muted); }
.ps-headline-absent { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
/* N-07 — one notice instead of five apparent faults. */
.ps-unconfigured {
  display: flex; align-items: flex-start; gap: 6px;
  margin: 0; padding: 9px 14px; font-size: 12px; line-height: 1.45;
  color: var(--text-muted); background: var(--bg);
  border-bottom: 1px solid var(--border);
}

/* ── N-08 — the twelve reports ───────────────────────────────────────
   An unavailable report keeps its title at full strength and states its
   reason, exactly like the dashboard's unavailable card and for the same
   reason: a reader must tell a known gap from a broken page without opening
   anything.

   A report that cannot be fully answered offers NO download. A blank cell in
   a money column reads as zero to a spreadsheet and to whoever totals it —
   the one place an absent figure does real damage. There is no disabled
   button either: a control that does nothing and does not say why is its own
   small mystery. */
.rp-wrap { margin-bottom: 8px; }
.rp-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.rp-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px;
  background: var(--surface);
}
.rp-item-unavailable { border-style: dashed; background: var(--bg); }
.rp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rp-title {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--text);
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
}
.rp-pending { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text); }
.rp-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.rp-count { font-size: 12px; color: var(--text-muted); }
.rp-export {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--brand-text); text-decoration: none;
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 9px;
}
.rp-export:hover { border-color: var(--brand); }
.rp-summary, .rp-why { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.45; }
.rp-needs { font-size: 11px; color: var(--brand-text); margin-top: 5px; }
.rp-absent { color: var(--text-muted); font-style: italic; font-size: 12px; }
/* Wide reports scroll inside their own box rather than pushing the page. */
.rp-table-wrap { overflow-x: auto; margin-top: 10px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rp-table th {
  text-align: left; font-weight: 500; color: var(--text-muted);
  padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.rp-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* A row that cannot be compared says so in place rather than being dropped —
   a missing row is a silent omission. */
.rp-note-row td {
  color: var(--text-muted); font-style: italic; white-space: normal;
  padding-top: 0; border-bottom: 1px solid var(--border);
}

/* MTG-10 — the Guests chip field.
 *
 * Reuses .mpp-chip's shape and colours deliberately: guests and participants
 * are the same idea to a reader — people on this meeting — and giving them two
 * different pills would say they are different kinds of thing.
 *
 * The BOX is what carries the focus ring, not the bare input inside it, so the
 * whole control reads as one field the way a mail client's To line does. */
.mec-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  width: 100%; padding: 7px 10px;
  background: var(--bg, #15161d);
  border: 1px solid var(--border, #2a2b36); border-radius: 8px;
  color: var(--text); cursor: text;
}
.mec-box:focus-within { outline: none; border-color: var(--brand); }
.mec-chips { display: contents; }
.mec-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 3px 6px 3px 9px; border-radius: 999px; font-size: 12px;
  background: var(--brand-subtle); color: var(--brand-text);
  border: 1px solid var(--brand-soft);
}
/* A long address shortens rather than widening the field past the modal. */
.mec-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mec-chip-x {
  display: flex; background: none; border: none; cursor: pointer;
  color: inherit; padding: 0; opacity: 0.7; flex-shrink: 0;
}
.mec-chip-x:hover { opacity: 1; }
/* Grows to fill the row it is on, so the caret sits after the last chip and
   the field still accepts a click anywhere along the empty remainder. */
.mec-input {
  flex: 1 1 140px; min-width: 120px;
  background: none; border: none; outline: none; padding: 2px 0;
  color: inherit; font: inherit;
}
.mec-error { margin-top: 6px; font-size: 12px; color: var(--danger-text, #c0392b); }

/* ── Members page, reworked 2026-09-23 ──────────────────────────────────────
   Presentation only. Who may change or remove whom is unchanged and still
   decided in members-section.js against the WRITE role.

   THE CONTRAST FAULT THIS FIXES

   "Delete user" was danger-coloured text on a danger-coloured fill:
   #c0392b on #d64545 in light, 1.24:1, and #f28787 on #e85d5d in dark,
   1.40:1. WCAG AA wants 4.5:1 for text this size. It read as disabled
   because it was barely legible, which is the worst possible look for the
   most destructive control on the page.

   The destructive actions now live in a menu as danger-coloured text on the
   surface: 5.44:1 in light and 6.38:1 in dark, both comfortably AA. That is
   also better than any filled variant could manage, since white on #d64545
   only reaches 4.38:1. Disabled is expressed as MUTED text plus a not-allowed
   cursor, so enabled and disabled differ in hue rather than only in opacity.
*/
.members-table { table-layout: fixed; width: 100%; }
.members-table th,
.members-table td { vertical-align: middle; }

/* One row height whether or not somebody has a job title: the subtitle line is
   always rendered, empty when there is nothing to say. Rows that grow by a few
   pixels when one person happens to have a title are what made the columns
   look out of step. */
.mem-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mem-identity-text { min-width: 0; }
.mem-name { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-title { font-size: 11px; color: var(--text-muted); line-height: 1.3; min-height: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-email,
.mem-meta { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-meta { font-size: 12px; }

/* The role badge and its dropdown are ONE control rather than two things side
   by side. The badge is the button; clicking it reveals the select in place,
   already focused. Nothing is added to the row until somebody wants to change
   something. */
.role-control { position: relative; display: inline-block; }
.role-chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; cursor: pointer; font: inherit;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.role-chip:hover { filter: brightness(1.06); }
.role-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.role-control .role-sel {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font-size: 12px; max-width: 160px;
}
.role-badge i { width: 12px; height: 12px; }
/* PROJECT MGR wrapped onto two lines inside a fixed-width column, which made
   that row 4px taller than every other and put the whole table back out of
   step. The badge never wraps. */
.role-badge, .role-chip { white-space: nowrap; }

/* Destructive actions are behind this rather than sitting in the row. Reset
   password is safe and stays one click away; remove and delete are two. */
.mem-actions { text-align: right; white-space: nowrap; }
.mem-menu { position: relative; display: inline-block; }
.mem-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border-radius: 6px;
  border: 1px solid transparent; background: none; color: var(--text-muted); cursor: pointer;
}
.mem-menu-btn:hover { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.mem-menu-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.mem-menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  min-width: 232px; padding: 4px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.mem-menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 6px; background: none;
  color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.mem-menu-item:hover { background: var(--surface-alt); }
.mem-menu-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
/* 5.44:1 light, 6.38:1 dark. The old filled button was 1.24:1 and 1.40:1. */
.mem-menu-item.danger { color: var(--danger-text); }
.mem-menu-item.danger:hover { background: var(--danger-faint); }
.mem-menu-item[disabled],
.mem-menu-item[aria-disabled="true"] {
  color: var(--text-muted); cursor: not-allowed; background: none;
}
.mem-menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.mem-menu-note { padding: 7px 10px; font-size: 12px; color: var(--text-muted); }

.self-locked-pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface-alt);
}

@media (max-width: 860px) {
  .members-table colgroup { display: none; }
  .members-table { table-layout: auto; }
  .mem-email { max-width: 180px; }
}

/* A deactivated member still sits in the roster, because they are still a
   member: deactivation revokes access, it does not remove them. So the row has
   to say so, and "Deactivated" takes the job-title line, which is empty for
   most people anyway. Muted rather than red: this is a state, not an error. */
.mem-identity.is-deactivated .mem-name { color: var(--text-muted); }
.mem-identity.is-deactivated .mem-title { color: var(--warning); font-weight: 600; }
.mem-identity.is-deactivated .avatar,
.mem-identity.is-deactivated img { filter: grayscale(1); opacity: 0.65; }

/* ── Chat bubbles, 2026-09-23 ───────────────────────────────────────────────
   BigJoe: "one bubble is my reply, other bubble is the person you're
   messaging. Our chats are just looking very old school."

   Bubbles everywhere, channels included, the way a WhatsApp group does it:
   your messages right and violet, everybody else left and neutral, with the
   sender's name above incoming bubbles in a colour that is theirs. That name
   colour is the whole reason bubbles survive a busy channel, which is the
   objection the flat Slack-style list exists to answer.

   PRESENTATION ONLY. Reactions, replies, editing, agent messages, file cards
   and mentions all keep working; they are re-placed, not rebuilt.

   MEASURED, not asserted. Sender palette against its bubble: worst 5.22:1 in
   light, 6.53:1 in dark. Body on violet 6.93:1. Timestamp on violet 5.01:1.
   Mentions: 5.37:1 on violet, 6.23:1 light neutral, 9.97:1 dark neutral. AA
   wants 4.5:1 at this size.

   WORKSPACE COLOUR, 2026-09-25. Your own bubble now follows the workspace the
   chat belongs to. Every --bubble-own-* value below is only the violet
   DEFAULT: white-label.js (bubbleTokens) re-derives the whole set per theme
   from the workspace brand, and falls back to the neutral bubble with a brand
   edge if the brand cannot carry readable ink. No colour on your own bubble
   may be a literal from here on — a tint measured against violet read at
   1.22:1 on a yellow brand.
*/
:root {
  --bubble-in: #eceaf4;          /* a faint tint of the brand, not flat grey */
  --bubble-in-text: #1a1b23;
  --bubble-in-ts: #646570;       /* 4.85:1 on the bubble */
  --bubble-own: var(--brand);
  --bubble-own-text: #ffffff;
  --bubble-own-ts: #dcd8f5;      /* 5.01:1 on the violet */
  --bubble-own-link: #e8e4ff;
  --bubble-own-mention: #ffe08a;
  --bubble-own-mention-bg: rgba(255, 255, 255, 0.16);
  --bubble-own-code-bg: rgba(255, 255, 255, 0.18);
  --bubble-own-edge: transparent;
  /* Ink on --brand-hover, for the call UI's accent fills. Default: white on
     Forge violet's hover #6860c0, 5.22:1. white-label.js re-derives it per
     workspace. Declared here, in this section, to stay out of the theme
     block; it is not a bubble token. */
  --on-brand-hover: #ffffff;
  --bubble-code-bg: #1a1b23;
  --bubble-code-text: #e4e4e8;
  --bubble-max: 68%;
}
html[data-theme="dark"] {
  --bubble-in: #2a2b37;
  --bubble-in-text: #e4e4e8;
  --bubble-in-ts: #9a9ba6;       /* 5.08:1 on the bubble */
  --bubble-code-bg: #15161d;
}

/* The row becomes a side-aware flex line. Own messages flip to the right and
   drop the avatar entirely: on your own side there is only one person it can
   be, which is why WhatsApp shows neither name nor face there. */
.msg-row:not(.system):not(.sysev) { align-items: flex-end; gap: 8px; }
.msg-row.own { flex-direction: row-reverse; }
.msg-row.own .avatar { display: none; }
.msg-row .body { flex: 0 1 auto; max-width: var(--bubble-max); min-width: 0; }

/* The bubble itself. Sized to content: a three-word message stays three words
   wide rather than stretching to the cap. */
.msg-row:not(.system):not(.sysev) .body {
  position: relative;
  padding: 7px 11px 6px;
  border-radius: 12px;
  background: var(--bubble-in);
  color: var(--bubble-in-text);
}
/* :not() twice, to match the specificity of the base bubble rule above.
   Without it that rule wins on specificity and own messages render in the
   NEUTRAL colour: caught by measuring the deployed page, where the own bubble
   came back rgb(42,43,55) instead of violet. */
.msg-row.own:not(.system):not(.sysev) .body {
  background: var(--bubble-own);
  color: var(--bubble-own-text);
  /* Only visible in the neutral fallback: the brand kept as an edge. Inset, so
     the bubble does not change size between the two modes. */
  box-shadow: inset 0 0 0 1.5px var(--bubble-own-edge);
}
/* The tail corner, the small asymmetry that tells you which side a bubble
   belongs to even at a glance. Only on the first of a run. */
.msg-row.incoming:not(.grouped) .body { border-bottom-left-radius: 4px; }
.msg-row.own:not(.grouped) .body { border-bottom-right-radius: 4px; }

/* The measure cap that made sense for full-width rows would now fight the
   bubble, which has its own. */
.msg-row:not(.system) .content,
.msg-row:not(.system) .reply-preview { max-width: none; }

/* Name above the text on incoming bubbles, never on your own. */
.msg-row.own .head { display: none; }
.msg-row.incoming .head { margin-bottom: 1px; }
.msg-row.incoming .head .name { font-size: 12.5px; font-weight: 700; }
/* The head timestamp goes: it lives inside the bubble now. */
.msg-row .head .ts { display: none; }

/* Timestamp inside the bubble, bottom right, sitting on the last line where
   there is room for it. */
.msg-row .bubble-ts {
  float: right;
  margin: 6px -3px -2px 10px;
  font-size: 10.5px;
  line-height: 1;
  color: var(--bubble-in-ts);
  user-select: none;
}
.msg-row.own .bubble-ts { color: var(--bubble-own-ts); }
.msg-row.system .bubble-ts, .msg-row.sysev .bubble-ts { display: none; }

/* Consecutive messages from one person: tight, and no repeated face or name.
   The avatar is hidden rather than removed so the bubbles stay in their
   column. */
.msg-row.grouped { margin-top: 0; }
.msg-row:not(.grouped) { margin-top: 10px; }
.msg-row.grouped .avatar { visibility: hidden; height: 36px; }
.msg-row.own.grouped .avatar { display: none; }
.msg-row .ts-inline { display: none; }

/* Links, mentions and inline code have to work on BOTH bubble colours. */
.msg-row.own .content a { color: var(--bubble-own-link); text-decoration: underline; }
.msg-row .content .mention {
  font-weight: 600; border-radius: 4px; padding: 0 3px;
  color: #7a4b00; background: color-mix(in srgb, var(--warn) 18%, transparent);
}
/* :not(.own) — this dark rule outranks .msg-row.own's on specificity (0,4,1
   vs 0,4,0) and painted #ffd479 on a gold own bubble at 1.49:1, measured on
   the rendered page. It is a NEUTRAL-bubble rule; your bubble has its own. */
html[data-theme="dark"] .msg-row:not(.own) .content .mention { color: #ffd479; background: rgba(239, 187, 58, 0.16); }
.msg-row.own .content .mention { color: var(--bubble-own-mention); background: var(--bubble-own-mention-bg); }

/* CODE. The case a naive bubble implementation gets wrong: a code block that
   inherits a violet background is unreadable, and one that wraps loses its
   indentation. It gets its own dark surface inside both bubble types, so the
   code sits ON the bubble rather than in it, and scrolls sideways instead of
   wrapping. */
.msg-row .content pre {
  background: var(--bubble-code-bg);
  color: var(--bubble-code-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 9px 11px;
  margin: 6px 0 2px;
  overflow-x: auto;
  max-width: 100%;
}
.msg-row .content pre code { background: none; color: inherit; padding: 0; font-size: 12.5px; }
.msg-row .content code {
  background: rgba(0, 0, 0, 0.08); border-radius: 4px; padding: 1px 5px; font-size: 12.5px;
}
html[data-theme="dark"] .msg-row:not(.own) .content code { background: rgba(255, 255, 255, 0.1); }
.msg-row.own .content code { background: var(--bubble-own-code-bg); color: var(--bubble-own-text); }

/* MEDIA ESCAPES THE BUBBLE. An image inside a padded coloured box is the
   giveaway of an obvious implementation: the picture IS the message, so the
   bubble gets out of its way and the timestamp overlays the corner. */
.msg-row.media-only:not(.system):not(.sysev) .body,
.msg-row.own.media-only:not(.system):not(.sysev) .body { padding: 0; background: none; }
.msg-row.media-only .bubble-ts {
  position: absolute; right: 8px; bottom: 6px; float: none; margin: 0;
  color: #fff; background: rgba(0, 0, 0, 0.45);
  padding: 1px 6px; border-radius: 10px;
}
.msg-row .file-msg .preview { border-radius: 12px; display: block; max-width: 100%; }

/* File cards keep their card: they are text shaped, not picture shaped. */
.msg-row.own .file-msg { background: var(--bubble-own-code-bg); border-color: var(--bubble-own-code-bg); }
.msg-row.own .file-msg .n, .msg-row.own .file-msg .m { color: var(--bubble-own-text); }

/* Reactions sit ON the bubble's lower edge, overlapping it, rather than
   taking a line of their own. */
.msg-row .reactions-row {
  position: relative; margin: 6px -4px -12px; z-index: 2;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.msg-row.own .reactions-row { justify-content: flex-end; }
.msg-row:not(.grouped) + .msg-row { margin-top: 14px; }

/* Quoted replies and thread teasers, on both colours. */
.msg-row.own .reply-preview { border-left-color: var(--bubble-own-ts); color: var(--bubble-own-ts); }
.msg-row.own .reply-preview strong { color: var(--bubble-own-text); }
.msg-row.own .thread-teaser { color: var(--bubble-own-link); }
/* Its "1m ago" kept --text-muted, a page colour: 1.13:1 on the violet. And
   the shared hover painted --surface behind this pale ink: 1.00:1. The border
   alone marks the hover here, in the bubble's own timestamp ink. */
.msg-row.own .thread-teaser .last { color: var(--bubble-own-ts); }
.msg-row.own .thread-teaser:hover { background: none; border-color: var(--bubble-own-ts); }

/* Hover actions follow the bubble's side. */
.msg-row:hover { background: none; }
.msg-row .msg-actions { opacity: 0; transition: opacity 0.1s; }
.msg-row:hover .msg-actions { opacity: 1; }
.msg-row.own .msg-actions { order: -1; }

/* Agents are participants, so they sit on the incoming side with the badge
   they already carry. The old negative offset belonged to the flat list. */
.msg-row.agent { margin-left: 0; padding-left: var(--chat-gutter); }

/* PHONE. Bubbles earn their keep here, and the cap widens because the column
   is narrow: 68% of a 390px screen would waste half the width. */
@media (max-width: 720px) {
  :root { --bubble-max: 85%; }
  .msg-row:not(.system):not(.sysev) { gap: 6px; }
  .msg-row .avatar { width: 28px; height: 28px; }
  .msg-row.grouped .avatar { height: 28px; }
}

/* The ten sender colours. Same index, same person, every session: the class
   is chosen by hashing the user id in chat.js. Light measured against #eceaf4
   (worst 5.22:1), dark against #2a2b37 (worst 6.53:1). */
.msg-row.incoming.sc-0 .head .name { color: #b3261e; }
.msg-row.incoming.sc-1 .head .name { color: #9a4b00; }
.msg-row.incoming.sc-2 .head .name { color: #6b5a00; }
.msg-row.incoming.sc-3 .head .name { color: #1f6b3a; }
.msg-row.incoming.sc-4 .head .name { color: #00696e; }
.msg-row.incoming.sc-5 .head .name { color: #00639c; }
.msg-row.incoming.sc-6 .head .name { color: #3f51b5; }
.msg-row.incoming.sc-7 .head .name { color: #7b3fa0; }
.msg-row.incoming.sc-8 .head .name { color: #a2006b; }
.msg-row.incoming.sc-9 .head .name { color: #6d4c41; }

html[data-theme="dark"] .msg-row.incoming.sc-0 .head .name { color: #ff9a8a; }
html[data-theme="dark"] .msg-row.incoming.sc-1 .head .name { color: #ffb870; }
html[data-theme="dark"] .msg-row.incoming.sc-2 .head .name { color: #e2d15a; }
html[data-theme="dark"] .msg-row.incoming.sc-3 .head .name { color: #7fd39b; }
html[data-theme="dark"] .msg-row.incoming.sc-4 .head .name { color: #66d9dd; }
html[data-theme="dark"] .msg-row.incoming.sc-5 .head .name { color: #7fc4ff; }
html[data-theme="dark"] .msg-row.incoming.sc-6 .head .name { color: #a3b2ff; }
html[data-theme="dark"] .msg-row.incoming.sc-7 .head .name { color: #d79cff; }
html[data-theme="dark"] .msg-row.incoming.sc-8 .head .name { color: #ff9ec9; }
html[data-theme="dark"] .msg-row.incoming.sc-9 .head .name { color: #d1a98f; }

/* ── MTG-49 — the audio call stage ────────────────────────────────────────
 *
 * A call with no picture in it is drawn as a phone call, not as a video call
 * whose cameras have failed. See public/js/call-audio-layout.js for which
 * calls land here and why the decision is made from live participant state.
 *
 * The call surface is dark in BOTH themes (--call-modal-from is #2a2b37 light
 * / #24252f dark), so these colours are measured once against the lighter of
 * the two, which is the worst case.
 */
forge-call-view .cv-audio {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  /* NOT justify-content: center. In a scrolling column, centred content that
     is taller than the box overflows UPWARD, above the scroll origin, where no
     scrolling can reach it: at 320x640 with three people the top row sat at
     y = -34, under the header, which is BigJoe's "the tiles overlapped". Auto
     margins on the first and last child centre exactly the same when there is
     room, and simply scroll when there is not. */
  align-items: center; justify-content: flex-start;
  gap: 28px;
  padding: 24px 20px;
  overflow: auto;
}
forge-call-view .cv-audio > :first-child { margin-top: auto; }
forge-call-view .cv-audio > :last-child { margin-bottom: auto; }
forge-call-view .cv-audio-who {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
/* The ring is the speaking indicator, and it is the SAME state the tiles and
   the header avatars use (p.isSpeaking), so they can never disagree. */
forge-call-view .cv-audio-ring {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  padding: 4px;
  box-shadow: 0 0 0 2px var(--call-line-soft);
  transition: box-shadow 140ms ease;
}
forge-call-view .cv-audio-ring.is-speaking {
  box-shadow: 0 0 0 4px var(--call-accent), 0 0 28px var(--call-accent-glow);
}
forge-call-view .cv-audio-ring img,
forge-call-view .cv-audio-ring .avatar {
  border-radius: 50%;
}
/* 2026-09-26 — THE PHOTO FOLLOWS ITS BOX. renderAvatar gives the <img> its
   own inline width and height (148px on the solo stage). Every phone rule
   below resizes the .avatar-wrap and none resized the image, so for anyone
   WITH a profile photo the picture overflowed its circle down and to the
   right while the initials disc behind it stayed put and peeked out top-left:
   BigJoe's phone screenshot, "a second avatar circle directly behind it,
   offset up and to the left". Test accounts without photos never showed it. */
forge-call-view .cv-audio-ring .avatar-wrap > img {
  width: 100% !important; height: 100% !important;
}
forge-call-view .cv-audio-mute {
  position: absolute; right: 2px; bottom: 2px;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--call-modal-from);
  border: 1px solid var(--call-control);
  color: var(--call-ink);
}
forge-call-view .cv-audio-name {
  margin: 6px 0 0; font-size: 22px; font-weight: 600;
  color: var(--call-ink);
}
/* --call-ink-sub, not --call-ink-dim: the dim token measures 4.14:1 on this
   surface and fails AA for small text. See the token declaration. */
forge-call-view .cv-audio-sub {
  margin: 0; font-size: 13px; color: var(--call-ink-sub);
}
/* The connected pill. "Ringing" with no clock until somebody is actually
   here — see _connectedPillHtml. */
forge-call-view .cv-pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--call-raise);
  border: 1px solid var(--call-control);
  font-size: 12px; color: var(--call-ink-sub);
  font-variant-numeric: tabular-nums;
}
forge-call-view .cv-pill-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--call-live);
}
forge-call-view .cv-pill.is-ringing .cv-pill-dot { background: var(--call-accent); }
forge-call-view .cv-pill-time { color: var(--call-ink); font-weight: 600; }

/* The waveform. Sized here so the canvas has a box to measure; it draws
   itself from the real microphone level. */
forge-call-view .cv-audio-wave,
forge-call-view forge-call-wave {
  display: block;
  width: min(340px, 78%); height: 44px;
  --cw-colour: var(--call-accent);
}
forge-call-view forge-call-wave .cw-canvas { width: 100%; height: 100%; display: block; }
/* MTG-69 — the meter says whose it is. --call-ink-sub measures 7.0:1 on the
   call surface (7.16 light / 7.46 dark), comfortably past AA. Measured. */
forge-call-view .cv-audio-wave-label {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--call-ink-sub);
  text-align: center;
}
/* MTG-70 — why nobody answered. --call-ink measures 8.97:1 light / 8.61:1
   dark on the call surface; this is the one line on the screen that explains
   silence, so it is not dimmed. */
forge-call-view .cv-address-notice {
  margin: 8px auto 0; max-width: 42ch;
  font-size: 12px; line-height: 1.45;
  color: var(--call-ink);
  text-align: center;
}
forge-call-view .cv-address-notice[hidden] { display: none; }

/* MTG-75 — "only you can hear her". BigJoe asked for this to be
   unmissable, and a dim line under a name is exactly what gets missed, so
   this one is a bordered strip rather than another caption.
   --call-ink on --call-control measures 8.97:1 light / 8.61:1 dark; the
   border is --call-ink-faint at 4.05:1 / 4.08:1, both measured. */
forge-call-view .cv-agent-reach {
  margin: 10px auto 0; max-width: 44ch;
  padding: 8px 12px;
  border: 1px solid var(--call-ink-faint);
  border-radius: 10px;
  background: var(--call-control);
  color: var(--call-ink);
  font-size: 12px; line-height: 1.45; text-align: center;
}
forge-call-view .cv-agent-reach[hidden] { display: none; }

/* MTG-79 — the @ picker in the call chat.

   ABOVE the input, not below it. The input sits at the bottom of the rail,
   so a list opening downward would render past the panel and be clipped —
   which is exactly what made the overflow menu unusable and took five
   reports to fix. Not rediscovering that.

   --call-ink on --call-surface measures 8.97:1 light / 8.61:1 dark; the
   active row uses --call-control-hover, which keeps the same ink. */
/* MTG-82 — the speaking ring wears the speaker's colour.
   --call-speaker is set per tile by call-view; without it the tile falls
   back to the accent exactly as before, so a participant with no colour
   yet is never ringless. */
/* 2026-09-26 (defect 4, reported three times) — AND THE CELL'S RING. In a
   group the ring is a child of .cv-audio-cell, which is the element carrying
   data-user-id, so it is the CELL that call-view toggles is-speaking on
   between renders (MTG-36: speaking does not re-render). The ring's own class
   was set only at render, so no group ring ever lit while anyone spoke,
   his own included. Measured on screen: selfSpeaking true, level 0.116, and
   the ring's shadow never left the neutral line. */
forge-call-view .cv-audio-ring.is-speaking,
forge-call-view .cv-audio-cell.is-speaking .cv-audio-ring,
forge-call-view .cv-tile.is-speaking {
  /* 2026-09-26 — a 2px band of the call surface between the avatar and the
     colour. The colour then only ever sits against the dark surface (7.99:1
     worst case), whatever the avatar is: a pale photo next to a pale ring
     was a colour that did not read. The band itself is the surface against
     the avatar, which is the tile's own edge. */
  box-shadow: 0 0 0 2px var(--call-surface),
              0 0 0 5px var(--call-speaker),
              0 0 18px 2px var(--call-speaker);
}
/* The meter takes the loudest speaker's colour, and falls back to its own
   when the call is quiet rather than freezing on whoever spoke last. */
forge-call-view forge-call-wave { --cw-ink: var(--call-speaker); }

forge-call-view .vchat-mentions {
  list-style: none; margin: 0 0 6px; padding: 4px;
  max-height: 40vh; overflow-y: auto;
  background: var(--call-surface);
  border: 1px solid var(--call-ink-faint);
  border-radius: 10px;
}
forge-call-view .vchat-mentions[hidden] { display: none; }
forge-call-view .vchat-mention {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 7px;
  color: var(--call-ink); font-size: 13px; cursor: pointer;
}
forge-call-view .vchat-mention.is-active,
forge-call-view .vchat-mention:hover { background: var(--call-control-hover); }
forge-call-view {
/* MTG-82 — A COLOUR PER PERSON, THE SAME ONE THEY HAVE IN CHAT.

   Pieter's idea: you should be able to see who is talking. The index is
   chat.js's existing sender hash, so a person who is orange in chat is
   orange in a call — a second scheme would be a second answer to "what
   colour is Andre".

   These are chat's DARK-theme inks, used in BOTH themes, because the
   call surface is dark in both. Chat paints a name on the page, which is
   light in light mode; a call tile is not. Measured against both call
   surfaces: worst 7.99:1, best 11.48:1, against the 3:1 that non-text UI
   needs. A glow nobody can see is not a feature. */
  /* MTG-82 — whose colour is being shown RIGHT NOW. Set per tile, and on
     the modal for the meter, by call-view at render. Declared here with
     NEUTRAL INK as its value (2026-09-26; it was the gold accent) so an
     element nobody has coloured yet is still ringed, and a quiet waveform
     is grey. Gold is also three of the ten personal colours' neighbourhood
     (orange, yellow, tan), so a gold default made "nobody speaking" and
     "BigJoe speaking" look the same: exactly his report that both devices
     were yellow. Any colour on screen now belongs to a person: a default is a better answer than a var() fallback,
     which hides from the theme contract whether the token exists at all. */
  --call-speaker: var(--call-ink-sub);

  --call-speak-0: #ff9a8a;
  --call-speak-1: #ffb870;
  --call-speak-2: #e2d15a;
  --call-speak-3: #7fd39b;
  --call-speak-4: #66d9dd;
  --call-speak-5: #7fc4ff;
  --call-speak-6: #a3b2ff;
  --call-speak-7: #d79cff;
  --call-speak-8: #ff9ec9;
  --call-speak-9: #d1a98f;
}

/* An agent is labelled, because "reply back" means something different
   when the thing replying is not a person. */
forge-call-view .vchat-mention-tag {
  margin-left: auto; padding: 1px 6px; border-radius: 999px;
  background: var(--call-control); color: var(--call-ink-sub);
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
}

/* Three or more with no cameras: the same ring, several times. */
forge-call-view .cv-audio-grid {
  display: flex; flex-wrap: wrap;
  /* Top-aligned: an agent's cell carries two more lines (tag, state), and
     centring lifted her ring above her neighbours' and into the header. */
  align-items: flex-start; justify-content: center;
  gap: 26px 32px;
  max-width: 100%;
}
forge-call-view .cv-audio-cell {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
forge-call-view .cv-audio-cell-name {
  font-size: 13px; color: var(--call-ink-sub); max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* On the solo stage the subtitle says "Agent · voice call". In a group there
   is no subtitle, so without this an agent looks exactly like a colleague —
   the one thing this screen must never leave ambiguous. */
forge-call-view .cv-audio-cell-tag {
  margin-top: 2px; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 999px;
  background: var(--call-raise); border: 1px solid var(--call-control);
  color: var(--call-ink-sub);
}

/* Phone. The stage is the one thing on screen, so it gets the room: a
   smaller avatar, tighter gaps, and a waveform that still spans the width. */
@media (max-width: 640px) {
  forge-call-view .cv-audio { gap: 20px; padding: 16px 12px; }
  /* renderAvatar emits a .avatar-wrap span carrying inline width/height, so
     that is the box to override. The first version of this rule targeted img
     and .avatar, which the renderer does not emit at all — it was dead. */
  forge-call-view .cv-audio-ring .avatar-wrap {
    width: 120px !important; height: 120px !important;
  }
  forge-call-view .cv-audio-name { font-size: 19px; }
  forge-call-view .cv-audio-wave,
  forge-call-view forge-call-wave { width: 86%; height: 38px; }
  forge-call-view .cv-audio-grid { gap: 18px 20px; }
  /* The 120px above is for the ONE face on a solo stage. It also caught every
     cell in a group, making three people wider than a phone. A group's faces
     are smaller so three sit on a 375px screen and nothing is pushed off. */
  forge-call-view .cv-audio-cell .cv-audio-ring .avatar-wrap {
    width: 84px !important; height: 84px !important;
  }
  forge-call-view .cv-audio-cell .avatar-base { font-size: 34px !important; }
  forge-call-view .cv-audio-grid { gap: 14px 16px; }
}

/* 2026-10-13 — A VOICE CALL WITH AN AGENT FITS WITHOUT AN INNER SCROLLBAR.
 * BigJoe: the panel scrolled inside itself at his window size. The stage was
 * sized for width only; a laptop window is short, and avatar + name + state +
 * Stop + pill + chip + notice + waveform ran past it. Height decides here:
 * the face shrinks and the gaps tighten as the window gets shorter, so the
 * whole stage stays visible. Group cells keep their own sizes. */
/* The box was 75vh (max 700px) whatever it held, so the stage scrolled inside
   it. Measured 2026-10-13: at 1366x657, 457px of stage in a 338px box; at
   1920x969, 581px in 545px. A VOICE call's box now grows to what it holds:
   never smaller than it was, never taller than the window. Desktop only; a
   phone's box is already the whole screen (max-width: 768px below). */
@media (min-width: 769px) {
  forge-call-view:not(.cv-fullscreen) .cv-modal.cv-audio-mode {
    height: auto;
    min-height: min(var(--cv-box-h), calc(100dvh - 32px));
    max-height: calc(100dvh - 32px);
  }
}
@media (max-height: 820px) {
  forge-call-view .cv-audio { gap: 16px; padding-top: 12px; padding-bottom: 12px; }
  forge-call-view .cv-audio-who { gap: 6px; }
  forge-call-view .cv-audio-who > .cv-audio-ring .avatar-wrap { width: 104px !important; height: 104px !important; }
  forge-call-view .cv-audio-who > .cv-audio-ring .avatar-base { font-size: 40px !important; }
  forge-call-view .cv-audio-name { font-size: 19px; margin-top: 2px; }
}
@media (max-height: 640px) {
  forge-call-view .cv-audio { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  forge-call-view .cv-audio-who > .cv-audio-ring .avatar-wrap { width: 76px !important; height: 76px !important; }
  forge-call-view .cv-audio-who > .cv-audio-ring .avatar-base { font-size: 30px !important; }
  forge-call-view .cv-audio-name { font-size: 17px; }
  forge-call-view .cv-audio-wave,
  forge-call-view forge-call-wave { height: 32px; }
}

/* 2026-09-26 — CHAT ON A PHONE MUST NOT HIDE THE CALL, in an ORDINARY call.
 *
 * BigJoe: opening the chat during a voice call on his phone took over the
 * screen and he could not see the call. The phone rules above already put the
 * sheet between the video band and the controls, but they shrink .cv-stage,
 * which only a MEETING has. An ordinary call puts .cv-audio / .cv-grid
 * straight into the modal (MTG-58), so on a phone:
 *   - the desktop rule still reserved a whole side rail of padding on the
 *     right, pushing the 148px avatar off the LEFT edge of a 375px screen;
 *   - nothing shrank the stage, so it sat full height behind the sheet.
 * Measured at 375x812 with chat open: avatar box starting at x<0 and cut by
 * the sheet. This gives the ordinary call the same band a meeting gets, and a
 * compact face that fits in it. */
@media (max-width: 768px) {
  forge-call-view .cv-modal.rail-open > .cv-audio,
  forge-call-view .cv-modal.rail-open > .cv-grid {
    flex: 0 0 32dvh; max-height: 32dvh; min-height: 0;
    padding: 8px 12px;
    gap: 8px;
    /* Scrolls rather than clips: whatever does not fit in the band (a
       notice about who can hear her) is still reachable, never cut off. */
    overflow-y: auto;
  }
  forge-call-view .cv-modal.rail-open > .cv-audio .cv-agent-reach { font-size: 12px; padding: 6px 10px; margin: 0; }
  /* The "Show her this" pill lives in the footer band, which the sheet covers
     on a phone; half of it peeked out under the composer. It returns when
     the chat closes. (A call-layout rule; the control itself is the vision
     session's and is untouched.) */
  forge-call-view .cv-modal.rail-open .cv-agent-vision { display: none; }
  forge-call-view .cv-modal.rail-open > .cv-audio .cv-audio-ring .avatar-wrap {
    width: 72px !important; height: 72px !important;
  }
  forge-call-view .cv-modal.rail-open > .cv-audio .avatar-base { font-size: 30px !important; }
  forge-call-view .cv-modal.rail-open > .cv-audio .cv-audio-cell .avatar-wrap {
    width: 52px !important; height: 52px !important;
  }
  forge-call-view .cv-modal.rail-open > .cv-audio .cv-audio-cell .avatar-base { font-size: 22px !important; }
  forge-call-view .cv-modal.rail-open > .cv-audio .cv-audio-name { font-size: 16px; }
  forge-call-view .cv-modal.rail-open > .cv-audio .cv-audio-grid { gap: 8px 14px; }
  forge-call-view .cv-modal.rail-open > .cv-audio :is(.cv-audio-sub, .cv-audio-notice, .cv-audio-wave, forge-call-wave, .cv-audio-wave-label) {
    display: none;
  }
}

/* ── MTG-50 — Add someone to this call ────────────────────────────────────
 *
 * A sibling of .cv-chrome, not a child, for the same reason .cv-chat is: it
 * holds a search field and a list you click through, and adding an agent
 * calls notify(), which rebuilds the chrome wholesale. Inside the chrome the
 * panel would delete itself the moment you used it.
 *
 * Colours are the call tokens, so it follows the surface and the brand. Small
 * text uses --call-ink-sub (5.85:1 on the lighter call surface); the dim token
 * is 4.14:1 and fails AA.
 */
/* THE SAME BOX AS .cv-modal, from the same host tokens.
 *
 * This started as `inset: 0`, which is the HOST — a fixed, full-viewport
 * layer — not the modal inside it. The panel was therefore centred on the
 * window rather than on the call, and its bottom edge sat BELOW the modal,
 * covering Mute, Chat and Share while leaving End visible off to one side.
 * Found on the staging screen, not in a test.
 *
 * The notes rail solved exactly this problem in FRG-066 by reading the host
 * tokens instead of hand-copying the numbers, and the comment there warns
 * that copies drift. So this reads them too. */
forge-call-view .cv-add {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: var(--cv-box-w); max-width: var(--cv-box-maxw);
  height: var(--cv-box-h); max-height: var(--cv-box-maxh);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 12px 96px;
  pointer-events: none;
  z-index: 6;
}
/* Fullscreen changes the modal's box, so it changes this one too. */
forge-call-view.cv-fullscreen .cv-add { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; }
forge-call-view .cv-add[hidden] { display: none; }
forge-call-view .cv-add-panel {
  pointer-events: auto;
  width: min(380px, 100%);
  /* Bounded by the call box, not by the viewport: the panel sits INSIDE
     the modal now, and 70vh in a 700px-tall modal on a 1080px screen would
     overflow it again. */
  max-height: min(420px, 100%);
  display: flex; flex-direction: column;
  background: var(--call-modal-from);
  border: 1px solid var(--call-control);
  border-radius: 14px;
  box-shadow: var(--call-shadow);
  color: var(--call-ink);
  overflow: hidden;
}
forge-call-view .cv-add-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px; font-size: 14px;
}
forge-call-view .cv-add-close {
  background: none; border: none; cursor: pointer;
  color: var(--call-ink-sub); padding: 4px; border-radius: 6px;
  display: flex; align-items: center;
}
forge-call-view .cv-add-close:hover { background: var(--call-control); color: var(--call-ink); }
forge-call-view .cv-add-search {
  margin: 0 14px 10px; padding: 8px 10px;
  background: var(--call-raise);
  border: 1px solid var(--call-control);
  border-radius: 8px;
  color: var(--call-ink); font-size: 13px;
}
forge-call-view .cv-add-search::placeholder { color: var(--call-ink-sub); }
forge-call-view .cv-add-search:focus {
  outline: none; border-color: var(--call-accent);
  box-shadow: 0 0 0 2px var(--call-accent-glow);
}
forge-call-view .cv-add-list { flex: 1 1 auto; overflow-y: auto; padding: 0 8px 4px; }
forge-call-view .cv-add-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 8px; border: none; border-radius: 8px;
  background: none; color: var(--call-ink); cursor: pointer;
  font-size: 13px; text-align: left;
}
forge-call-view .cv-add-row:hover { background: var(--call-control); }
forge-call-view .cv-add-row:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--call-accent);
}
forge-call-view .cv-add-name {
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
forge-call-view .cv-add-tag {
  font-size: 11px; padding: 2px 6px; border-radius: 999px;
  background: var(--call-raise); border: 1px solid var(--call-control);
  color: var(--call-ink-sub);
}
/* The verb, not an icon: "Ring" and "Add" are different things and the
   difference is the whole point of one list holding both. */
forge-call-view .cv-add-verb { font-size: 12px; color: var(--call-ink-sub); }
forge-call-view .cv-add-row:hover .cv-add-verb { color: var(--call-ink); }
/* 2026-10-04 — agents that cannot be added to calls yet: listed, greyed out.
   Greyed by colour and a desaturated face, NOT by opacity on the text: the
   words stay at --call-ink-sub (about 6:1), so the reason is still readable. */
forge-call-view .cv-add-row.is-blocked { color: var(--call-ink-sub); cursor: not-allowed; }
forge-call-view .cv-add-row.is-blocked:hover { background: none; }
forge-call-view .cv-add-row.is-blocked:hover .cv-add-verb { color: var(--call-ink-sub); }
forge-call-view .cv-add-row.is-blocked .avatar-wrap { filter: grayscale(1); opacity: 0.5; }
forge-call-view .cv-add-row.is-blocked .cv-add-verb { font-style: italic; }
forge-call-view .cv-add-blocked-note {
  margin: 6px 8px 4px; padding: 6px 8px; border-radius: 8px;
  font-size: 12px; line-height: 1.4; color: var(--call-ink-sub); background: var(--call-raise);
}
forge-call-view .cv-add-empty,
forge-call-view .cv-add-note {
  padding: 10px 14px; font-size: 12px; color: var(--call-ink-sub); margin: 0;
}
forge-call-view .cv-add-note { border-top: 1px solid var(--call-line-soft); }

@media (max-width: 640px) {
  forge-call-view .cv-add { padding: 0 8px 88px; align-items: flex-end; }
  forge-call-view .cv-add-panel { width: 100%; max-height: 60vh; }
}

/* ── MTG-52 — the in-tab dock ─────────────────────────────────────────────
 *
 * A minimised call for every browser that does not get Document
 * Picture-in-Picture, and for every phone. Small, draggable, inside the page.
 *
 * IT MUST NOT SWALLOW CLICKS. forge-call-view is a full-viewport fixed layer
 * with pointer-events: none, and only the boxes inside it take events back.
 * The host below stays none; only .cv-dock takes them, so the page underneath
 * stays usable — which is the whole point of minimising.
 */
forge-call-view .cv-dock-host {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1600;
}
forge-call-view .cv-dock-host[hidden] { display: none; }
forge-call-view .cv-dock {
  position: absolute;
  pointer-events: auto;
  width: 280px;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: linear-gradient(160deg, var(--call-modal-from), var(--call-modal-to));
  border: 1px solid var(--call-control);
  border-radius: 14px;
  box-shadow: var(--call-shadow);
  color: var(--call-ink);
}
/* The grip is the whole identity block, not a separate handle: a 20px bar
   nobody can find is how draggable windows become undraggable ones. */
forge-call-view .cv-dock-grip {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  cursor: grab;
  /* Stops the browser panning the page instead of moving the dock on touch. */
  touch-action: none;
  user-select: none;
}
forge-call-view .cv-dock.is-dragging { cursor: grabbing; }
forge-call-view .cv-dock.is-dragging .cv-dock-grip { cursor: grabbing; }
forge-call-view .cv-dock-who { min-width: 0; }
forge-call-view .cv-dock-name {
  font-size: 13px; font-weight: 600; color: var(--call-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
forge-call-view .cv-dock-time {
  font-size: 11px; color: var(--call-ink-sub);
  font-variant-numeric: tabular-nums;
}
forge-call-view .cv-dock-actions { display: flex; align-items: center; gap: 4px; }
forge-call-view .cv-dock-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--call-control); border: none;
  color: var(--call-ink); cursor: pointer;
}
forge-call-view .cv-dock-btn:hover { background: var(--call-raise); }
forge-call-view .cv-dock-btn:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--call-accent);
}
forge-call-view .cv-dock-btn.on { background: var(--call-accent); }
forge-call-view .cv-dock-end { background: var(--call-danger); color: var(--call-danger-ink); }
forge-call-view .cv-dock-end:hover { background: var(--call-danger); filter: brightness(1.1); }

/* Phone: the dock spans the width rather than floating, because a 280px box
   on a 375px screen leaves nothing usable beside it and the point of
   minimising is to use the page. */
@media (max-width: 640px) {
  forge-call-view .cv-dock {
    width: calc(100vw - 16px);
    left: 8px !important;
  }
}

/* ── MTG-53 — the one-to-one video call ───────────────────────────────────
 *
 * They fill the stage; you sit small in the corner; the header shrinks to the
 * one thing not already on screen.
 *
 * This is a CSS ARRANGEMENT of the tiles the grid already produced — the same
 * .cv-tile elements with the same data-user-id and the same <video> children.
 * syncTileVideo re-parents cached video elements by exactly that shape, so a
 * different structure here would silently break video resume (HAT-HVH-364).
 * Hence grid-area overrides rather than new markup.
 */
forge-call-view .cv-grid.cv-focus {
  display: block;            /* the tiles position themselves below */
  position: relative;
  padding: 12px;
}
forge-call-view .cv-grid.cv-focus .cv-tile {
  grid-area: auto !important;
  position: absolute;
  inset: 12px;
  width: auto; height: auto;
  min-width: 0; min-height: 0;
  border-radius: 14px;
}
/* Your own camera: bottom-right, small, on top. 16:10 so a webcam frame is
   not cropped to a letterbox slot. */
forge-call-view .cv-grid.cv-focus .cv-tile.is-local {
  inset: auto 20px 20px auto;
  width: 176px; height: 110px;
  border-radius: 10px;
  /* The call surface already owns a shadow token; a second hand-rolled one
     would be the drift this file keeps removing. */
  box-shadow: var(--call-shadow);
  z-index: 2;
}
forge-call-view .cv-grid.cv-focus .cv-tile.is-local .cv-avatar-wrap img,
forge-call-view .cv-grid.cv-focus .cv-tile.is-local .cv-avatar-wrap .avatar-wrap {
  width: 48px !important; height: 48px !important;
}
forge-call-view .cv-grid.cv-focus .cv-tile.is-local .cv-name {
  font-size: 11px; padding: 2px 6px;
}
/* The remote tile fills, so its video fills too rather than letterboxing into
   a tile-sized box. */
forge-call-view .cv-grid.cv-focus .cv-tile:not(.is-local) .cv-video { object-fit: cover; }
/* Video fit (call-tiles.js applyVideoFit): cover only while it shows at least
   80% of the frame; past that the whole frame, letterboxed on black. Written
   after the focus rule above and at least as specific, so it wins there too.
   Your own small corner picture stays cover: at 176x110 a letterboxed self
   view is a sliver, and it is only there to check your framing. */
forge-call-view .cv-video.is-fit-contain,
forge-call-view .cv-grid.cv-focus .cv-tile:not(.is-local) .cv-video.is-fit-contain {
  object-fit: contain; background: var(--call-letterbox);
}
forge-call-view .cv-grid.cv-focus .cv-tile.is-local .cv-video { object-fit: cover; }

/* Chat open in a one-to-one call (vibe finding 3, 2026-09-26). The rail-open
   rule reserves room by PADDING the grid, but these tiles are absolutely
   positioned, and an absolute box's insets ignore its parent's padding: the
   chat panel landed on top of your own camera and the right third of theirs.
   Measured at 1280x720: remote tile right edge 1107, local tile 923-1099,
   both under the rail. The tiles step out by the same tokens the padding uses.
   Desktop only: at phone width the rail is a band below the video, not a
   side column, and the phone rules already give the stage its own band. */
@media (min-width: 769px) {
  forge-call-view .cv-modal.rail-open .cv-grid.cv-focus .cv-tile {
    right: calc(var(--call-rail-w) + var(--call-gutter) + 12px);
  }
  forge-call-view .cv-modal.rail-open .cv-grid.cv-focus .cv-tile.is-local {
    right: calc(var(--call-rail-w) + var(--call-gutter) + 20px);
  }
}

/* The compact header. */
forge-call-view .cv-header-focus {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 10px;
}
forge-call-view .cv-hf-av {
  display: inline-flex; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--call-line-soft);
  transition: box-shadow 140ms ease;
}
forge-call-view .cv-hf-av.is-speaking {
  box-shadow: 0 0 0 2px var(--call-accent), 0 0 14px var(--call-accent-glow);
}
forge-call-view .cv-hf-name {
  font-size: 14px; font-weight: 600; color: var(--call-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
forge-call-view .cv-hf-time {
  margin-left: auto;
  font-size: 12px; color: var(--call-ink-sub);
  font-variant-numeric: tabular-nums;
}

/* Phone: the self view shrinks and hugs the corner, and the controls stay
   centred under it rather than being pushed off by the header. */
@media (max-width: 640px) {
  forge-call-view .cv-grid.cv-focus .cv-tile.is-local {
    inset: auto 12px 12px auto;
    width: 108px; height: 72px;
  }
  forge-call-view .cv-grid.cv-focus .cv-tile.is-local .cv-avatar-wrap img,
  forge-call-view .cv-grid.cv-focus .cv-tile.is-local .cv-avatar-wrap .avatar-wrap {
    width: 34px !important; height: 34px !important;
  }
  forge-call-view .cv-header-focus { padding: 10px 12px 8px; }
}

/* ── MTG-55 — the Voices row actions ──────────────────────────────────────
 *
 * The cell held up to five buttons on one `white-space: nowrap` line —
 * Make default, Use/Stop transcription, Test, Edit, Delete — and "Stop using
 * for transcription" is 28 characters on its own. The row ran past the card
 * and the last button was clipped mid-word.
 *
 * One visible action and a menu, the same pattern the members table uses.
 * The cell no longer forces nowrap: if a narrow window ever needs the pair to
 * wrap, it wraps rather than overflowing, which is the behaviour that was
 * missing.
 */
forge-speech-providers .sp-actions {
  text-align: right;
  white-space: normal;
}
forge-speech-providers .sp-actions > * {
  vertical-align: middle;
}
/* The CELL wraps; the BUTTON's own label does not. Without this "Make
   default" broke across two lines on a phone and pushed the menu underneath
   it — tidy enough to work, untidy enough to look like the bug it replaced. */
forge-speech-providers .sp-actions .btn-ghost { white-space: nowrap; }
forge-speech-providers .sp-actions .mem-menu { margin-left: 6px; }

/* Phone: the table is already horizontally scrollable, but the actions column
   should not be the reason it has to be. One button and a 28px menu fit. */
@media (max-width: 640px) {
  forge-speech-providers .sp-actions .btn-ghost {
    padding-left: 8px; padding-right: 8px;
  }
}

/* MTG-55 — four columns do not fit a phone.
 *
 * Measured on staging before this: at 375px the actions cell's right edge sat
 * at 468px inside a 327px card, so the buttons were outside the card and
 * unreachable — the desktop bug's phone-sized twin.
 *
 * NOT solved with an overflow-x wrapper, which was the first thing I tried:
 * a scroll container CLIPS the dropdown that opens inside it, because
 * overflow-y: visible is not honoured beside overflow-x: auto. That would
 * have broken the menu on exactly the screens the wrapper was added for.
 *
 * So the two secondary columns step aside instead. Type and API key are both
 * restated in the name cell's detail line (the address, the model, and
 * whether a key is on file), so nothing is actually lost at this width — and
 * the row keeps its name and its actions, which are what you came for.
 */
@media (max-width: 760px) {
  forge-speech-providers .members-table th:nth-child(2),
  forge-speech-providers .members-table td:nth-child(2),
  forge-speech-providers .members-table th:nth-child(3),
  forge-speech-providers .members-table td:nth-child(3) {
    display: none;
  }
  forge-speech-providers .members-table th,
  forge-speech-providers .members-table td { padding: 10px 8px; }
}

/* MTG-60 — what an agent is doing, on its own tile.
 *
 * BigJoe added agents to a call and reported them inert: "no way to see
 * whether they're even listening". The speaking ring already says somebody is
 * talking; this says which of the other three things is happening.
 *
 * --call-ink-sub, not --call-ink-dim: the dim token is 4.14:1 on this surface
 * and fails AA for small text. */
forge-call-view .cv-audio-state {
  margin: 2px 0 0; font-size: 12px; color: var(--call-ink-sub);
  min-height: 15px;
}
forge-call-view .cv-audio-cell .cv-audio-state { font-size: 11px; }
/* MTG-69 — Stop. Visible only while the agent is speaking, so it is never a
   dead control beside a silent agent. It is a real <button> for two reasons:
   app.js's document-level capture handler on [data-user-id] opens the profile
   panel and calls stopImmediatePropagation, and it skips anything inside a
   button — that is what makes this reachable at all — and a labelled control
   is discoverable where a tap on an avatar is not.
   Sized for a thumb: 44px is the minimum comfortable touch target. */
forge-call-view .cv-agent-stop {
  margin: 10px auto 0;
  display: block;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  /* --call-ink-faint, not --call-field-line: the faint lines measure 1.43:1
     against the call surface and a control boundary needs 3:1 (WCAG 1.4.11).
     This measures 4.05:1 light / 4.08:1 dark. The label is 8.97:1 / 8.61:1,
     and 6.36:1 / 6.11:1 on hover. Measured, not assumed. */
  border: 1px solid var(--call-ink-faint);
  background: var(--call-control);
  color: var(--call-ink);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}
forge-call-view .cv-agent-stop:hover { background: var(--call-control-hover); }
forge-call-view .cv-agent-stop:focus-visible {
  outline: 2px solid var(--call-ink); outline-offset: 2px;
}
forge-call-view .cv-agent-stop[hidden] { display: none; }

/* Remove an agent from the call. Stop's measured border and label, so it is
   as visible as Stop; quieter fill, because it is not the urgent one. */
forge-call-view .cv-agent-remove {
  margin: 10px auto 0;
  display: block;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  border: 1px solid var(--call-ink-faint);
  background: transparent;
  color: var(--call-ink);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}
forge-call-view .cv-agent-remove:hover { background: var(--call-control-hover); }
forge-call-view .cv-agent-remove:focus-visible {
  outline: 2px solid var(--call-ink); outline-offset: 2px;
}
forge-call-view .cv-tile-agent .cv-agent-remove,
forge-call-view .cv-audio-cell .cv-agent-remove {
  margin: 0; display: inline-flex; align-items: center;
  min-height: 32px; padding: 0 12px; border-radius: 16px;
  font-size: 12px;
}
forge-call-view .cv-audio-cell .cv-agent-remove { margin-top: 8px; }
/* A person's Remove, for the organiser or an admin only, on a video tile:
   top-left, where an agent's pill sits (the name owns bottom-left, the bars
   top-right). With a mouse it shows on hover or focus, so a ten-person call
   is not ten Remove buttons; on touch it is always there.
   It sits on live VIDEO, which can be a white wall: the 45% scrim gives
   ~2.2:1 there. So it is painted on the call's own OPAQUE surface, never
   on the picture behind it, at rest and on hover. */
forge-call-view .cv-tile > .cv-person-remove {
  position: absolute; top: 8px; left: 8px; z-index: 2; margin: 0;
  display: inline-flex; align-items: center;
  min-height: 32px; padding: 0 12px; border-radius: 16px; font-size: 12px;
  background: var(--call-surface);
}
forge-call-view .cv-tile > .cv-person-remove:hover { background: var(--call-surface-alt); }
/* "Remove X from this call?" — asked inside the call, in the .cv-add host,
   never a page dialog: a fullscreen call would hide one (MTG-37's rule). */
forge-call-view .cv-remove-ask .cv-add-note { margin: 4px 0 0; }
forge-call-view .cv-remove-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
forge-call-view .cv-remove-actions button {
  min-height: 44px; padding: 0 18px; border-radius: 22px;
  border: 1px solid var(--call-ink-faint); background: var(--call-control);
  color: var(--call-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
forge-call-view .cv-remove-actions button:hover { background: var(--call-control-hover); }
forge-call-view .cv-remove-actions button:focus-visible { outline: 2px solid var(--call-ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  forge-call-view .cv-tile > .cv-person-remove { opacity: 0; }
  forge-call-view .cv-tile:hover > .cv-person-remove,
  forge-call-view .cv-tile > .cv-person-remove:focus-visible { opacity: 1; }
}
@media (pointer: coarse) {
  forge-call-view .cv-tile .cv-agent-remove,
  forge-call-view .cv-audio-cell .cv-agent-remove { min-height: 44px; }
}

/* Vibe finding 4 — the agent's tag, state and Stop on a VIDEO tile. Top-left:
   the name owns bottom-left, the connection bars top-right, and in a
   one-to-one call your own camera sits bottom-right over their tile. On a
   scrim, because it sits on whatever the tile shows. Compact, so it still
   fits the 171x81 tiles of the screen-share side column. */
forge-call-view .cv-tile-agent {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px;
  max-width: calc(100% - 16px);
  padding: 3px 8px 3px 4px; border-radius: 999px;
  background: var(--call-video-scrim); color: var(--call-ink);
  font-size: 11px; line-height: 1.3;
}
forge-call-view .cv-tile-agent-tag {
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600;
  padding: 1px 6px; border-radius: 999px;
  background: var(--call-control);
}
forge-call-view .cv-tile-agent-state:empty { display: none; }
forge-call-view .cv-tile-agent .cv-tile-agent-stop {
  margin: 0; display: inline-flex; align-items: center;
  min-height: 32px; padding: 0 12px; border-radius: 16px;
  font-size: 12px;
}
forge-call-view .cv-tile-agent .cv-tile-agent-stop[hidden] { display: none; }
/* In a screen share's side rail the thumbnail can be 171x59, and the tag, the
   state and a face do not all fit: measured, the pill sat across the avatar.
   An agent sends no picture and the pill plus the name already say who and
   what she is, so the face gives way there, and only there. */
forge-call-view .cv-grid.has-screen .cv-tile.is-agent:not(.is-screen) .cv-avatar-wrap { display: none; }

/* MTG-74 — THE OVERFLOW MENU OPENS UPWARD.

   .mem-menu-list drops DOWN (top: 100% + 4px), which is right for a menu
   in the middle of a page. This one hangs off a button on the bottom bar
   of .cv-modal, which is overflow:hidden — so the panel rendered below the
   modal edge and was clipped to a sliver. BigJoe saw the top few pixels of
   it and nothing else, which means SEVEN controls we deliberately moved in
   there were unreachable. That makes it a defect, not a polish item.

   Anchored to the button's top edge instead, so it grows into the call
   rather than out of it, and no portal or overflow surgery is needed.
   Capped and scrollable so a long menu on a short window still resolves
   inside the box rather than reintroducing the same clipping. */
forge-call-view .cv-overflow .mem-menu-list {
  top: auto;
  bottom: calc(100% + 8px);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  /* The call surface is dark in BOTH themes, so the app-level --surface
     would paint a white slab on a dark bar. Call tokens instead: item text
     measures 8.97:1 light / 8.61:1 dark on this background. */
  background: var(--call-surface);
  border-color: var(--call-ink-faint);
}
forge-call-view .cv-overflow .mem-menu-item { color: var(--call-ink); }
forge-call-view .cv-overflow .mem-menu-item:hover { background: var(--call-control-hover); }
forge-call-view .cv-audio-cell .cv-agent-stop { min-height: 32px; padding: 0 12px; font-size: 12px; }
/* The notice about where the audio goes. One sentence, derived at runtime —
   see speechPathNotice(). Wraps rather than truncating: a half-read sentence
   about where somebody's voice is sent is worse than none. */
forge-call-view .cv-audio-notice {
  margin: 8px auto 0; max-width: 42ch;
  font-size: 11px; line-height: 1.45; color: var(--call-ink-sub);
  text-align: center;
}
/* Thinking is the one state with no sound to it, so it gets the only motion:
   a slow pulse, so a silent agent still reads as busy rather than stuck. */
/* THE CLASS LANDS ON DIFFERENT NODES ON DIFFERENT STAGES, so both shapes
 * have to be named.
 *
 * _applyAgentState toggles these on every node carrying the agent's
 * data-user-id. On the SOLO stage that node IS .cv-audio-ring, so a
 * descendant selector can never match — the state sits on the element the
 * rule is looking underneath. On the group stage the node is .cv-audio-cell
 * with the ring inside, where a descendant selector is the only thing that
 * works.
 *
 * The first version had only the descendant form, so the pulse never ran on
 * a one-to-one agent call — which is the only kind BigJoe has made. Four
 * seconds of a completely still "Thinking".
 *
 * Third time in this project: the same never-matches shape as the :has()
 * rule on chat images. When a class is applied by script rather than written
 * into the markup, check WHICH element actually receives it. */
forge-call-view .cv-audio-ring.agent-thinking,
forge-call-view .agent-thinking .cv-audio-ring { animation: cv-agent-think 1.6s ease-in-out infinite; }
@keyframes cv-agent-think {
  0%, 100% { box-shadow: 0 0 0 2px var(--call-line-soft); }
  50% { box-shadow: 0 0 0 4px var(--call-accent), 0 0 18px var(--call-accent-glow); }
}
@media (prefers-reduced-motion: reduce) {
  forge-call-view .cv-audio-ring.agent-thinking,
  forge-call-view .agent-thinking .cv-audio-ring { animation: none; box-shadow: 0 0 0 3px var(--call-accent); }
}

/* === Agent vision capture ===================================================
   "Show her this" — public/js/agent-vision-capture.js. Owned by the
   agent-vision track; nothing outside .avc is styled here.
   Tones: can (enabled), cannot (a definite no — danger), unknown (nobody
   knows — warn). They are deliberately different colours: "cannot see" and
   "can't tell" are different facts. */
.avc { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 260px; }
.avc-show {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--brand); color: var(--on-brand); font-size: 13px; cursor: pointer;
}
.avc-show:hover:not(:disabled) { background: var(--brand-hover); }
.avc-show:disabled { cursor: not-allowed; background: var(--surface-alt); color: var(--text-muted); }
.avc[data-tone="cannot"] .avc-show:disabled { border-color: var(--danger); color: var(--danger-text); }
.avc[data-tone="unknown"] .avc-show:disabled { border-color: var(--warn); color: var(--warn-text); border-style: dashed; }
.avc-note { font-size: 12px; line-height: 1.35; color: var(--text-muted); }
.avc[data-tone="cannot"] .avc-note { color: var(--danger-text); }
.avc[data-tone="unknown"] .avc-note { color: var(--warn-text); }
.avc-retry { padding: 0; border: 0; background: none; color: var(--brand-text); font-size: 12px; text-decoration: underline; cursor: pointer; }
.avc-pending {
  display: grid; grid-template-columns: 72px 1fr; grid-template-rows: auto auto; gap: 2px 8px;
  align-items: center; padding: 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
}
.avc-thumb { grid-row: 1 / span 2; width: 72px; height: auto; max-height: 72px; object-fit: cover; border-radius: 4px; }
.avc-caption { font-size: 12px; color: var(--text); }
.avc-cancel { justify-self: start; padding: 0; border: 0; background: none; color: var(--danger-text); font-size: 12px; cursor: pointer; }
.avc [hidden] { display: none !important; }
/* Inside a call: the call surface is dark in BOTH themes, so the control
   speaks the call palette there rather than the page's. */
/* Readable on both call surfaces (#2a2b37 and darker). Scoped here because
   nothing else in the call needs a danger/warn INK, only fills. */
forge-call-view .avc { --avc-cannot-ink: #ff9d9d; --avc-unknown-ink: #f0cf7a; --avc-unknown-line: #e0b44c; --avc-hairline: rgba(255, 255, 255, 0.16); }
forge-call-view .avc-note { color: var(--call-ink-sub); }
forge-call-view .avc-show:disabled { background: var(--call-surface-alt); color: var(--call-ink-sub); border-color: var(--avc-hairline); }
forge-call-view .avc[data-tone="cannot"] .avc-show:disabled { border-color: var(--call-danger); color: var(--avc-cannot-ink); }
forge-call-view .avc[data-tone="cannot"] .avc-note { color: var(--avc-cannot-ink); }
forge-call-view .avc[data-tone="unknown"] .avc-show:disabled { border-color: var(--avc-unknown-line); color: var(--avc-unknown-ink); }
forge-call-view .avc[data-tone="unknown"] .avc-note { color: var(--avc-unknown-ink); }
forge-call-view .avc-retry { color: var(--call-ink); }
forge-call-view .avc-pending { background: var(--call-surface-alt); border-color: var(--avc-hairline); }
forge-call-view .avc-caption { color: var(--call-ink); }
forge-call-view .avc-cancel { color: var(--avc-cannot-ink); }
/* Aiming, on a voice call: the camera was turned on only for this picture.
   A red live dot + words, so a camera that is on is never mistaken for one
   that is off. NOT mirrored: what he sees is exactly what she will get, which
   matters the moment he holds up anything with writing on it. */
.avc-aim { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; border: 1px solid var(--danger); background: var(--surface); width: 240px; }
.avc-aim-label { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 1.35; color: var(--text); }
.avc-aim-label::before { content: ''; flex: 0 0 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--danger); }
.avc-selfview { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #000; }
.avc-aim-actions { display: flex; gap: 8px; }
.avc-take { flex: 1; padding: 6px 10px; border-radius: 999px; border: 0; background: var(--brand); color: var(--on-brand); font-size: 13px; cursor: pointer; }
.avc-take:hover { background: var(--brand-hover); }
.avc-aim-cancel { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: none; color: var(--text); font-size: 13px; cursor: pointer; }
forge-call-view .avc-aim { background: var(--call-surface-alt); border-color: var(--call-danger); }
forge-call-view .avc-aim-label, forge-call-view .avc-aim-cancel { color: var(--call-ink); }
forge-call-view .avc-aim-label::before { background: var(--call-danger); }
forge-call-view .avc-aim-cancel { border-color: var(--avc-hairline); }
/* === end Agent vision capture ============================================ */

/* === Call notes review =======================================================
   public/js/components/call-notes-page.js — #/call-notes/<runId>. Owned by the
   call-notes track; nothing outside .cn-page is styled here. The heard/unheard
   paragraph is the first and most prominent thing on the page, on purpose. */
.cn-page { max-width: 880px; }
.cn-page .page-head h1 { font-size: 22px; margin: 0 0 4px; }
.cn-page .page-sub { color: var(--text-muted); margin: 0 0 16px; }
.cn-heard { border-left: 4px solid var(--warn); background: var(--warn-tint); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 20px; }
/* The minutes page (2026-10-04): says what it is at the top, with the meeting, who was there and the download. */
.cn-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.cn-kicker { margin: 0 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.cn-attended { margin: 4px 0 0; }
.cn-head-actions { flex: none; }
.cn-minutes h2 { margin: 18px 0 6px; }
.cn-minutes-text { white-space: pre-wrap; line-height: 1.55; background: var(--surface-2); border-radius: var(--radius); padding: 12px 16px; }
.cn-part { margin: 28px 0 8px; }
/* Minutes held back from everyone (2026-10-03): the reason, and the one way to send them on. */
.cn-held { border-left: 4px solid var(--danger); background: var(--surface-2, var(--warn-tint)); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; display: grid; gap: 10px; justify-items: start; }
.cn-held p { margin: 0; }
.cn-heard p { margin: 0; line-height: 1.5; color: var(--text); }
.cn-section { margin: 0 0 24px; }
.cn-section h2 { font-size: 15px; margin: 0 0 8px; color: var(--text); }
.cn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cn-list > li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.cn-who, .cn-note, .cn-basis, .cn-state { color: var(--text-muted); font-size: 13px; }
.cn-note { margin: 4px 0 8px; }
.cn-basis { margin: 0 0 8px; }
.cn-said { margin-top: 6px; font-size: 13px; }
.cn-said summary { cursor: pointer; color: var(--brand-text); }
.cn-said blockquote { margin: 6px 0 0; padding: 4px 10px; border-left: 3px solid var(--border); color: var(--text); }
.cn-said-meta { display: block; color: var(--text-muted); font-size: 12px; }
.cn-action label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); margin: 0 0 8px; }
.cn-action input, .cn-action select, .cn-action textarea {
  font: inherit; color: var(--text); background: var(--bg-input, var(--surface)); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; min-width: 0;
}
.cn-row { display: grid; grid-template-columns: 1fr 1fr 160px; gap: 8px; }
@media (max-width: 640px) { .cn-row { grid-template-columns: 1fr; } }
.cn-action-head { display: flex; flex-direction: column; gap: 2px; }
.cn-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cn-blocker { flex: 1; min-width: 160px; font-size: 13px; color: var(--warn-text); }
.cn-agent-note { margin: 4px 0 0; font-size: 13px; color: var(--brand-text); }
.cn-action.is-confirmed { border-color: var(--success); }
.cn-action.is-discarded { opacity: 0.6; }
.cn-rejected .cn-list > li { background: none; }
/* === end Call notes review =================================================== */

/* === Project Drive (drive-page.js in project scope; files.js mounts it) =====
   #/project/:id/drive. The rows, toolbar and empty state are Drive's own
   (.dr2-*). This section adds only the "Move to" dialog the old tab had,
   on the shared form modal: one radio row per destination, indented by depth,
   44px targets on touch. A place you cannot write to is shown but disabled,
   not hidden, so the tree still makes sense. */
.dr2-move-list {
  display: flex; flex-direction: column; max-height: min(52vh, 420px); overflow-y: auto;
  padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.dr2-move-opt {
  display: flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 0 10px; border-radius: 8px;
  font-size: 14px; color: var(--text); cursor: pointer;
}
/* Indent by depth, in fixed steps (deeper than 6 stays at 6). */
.dr2-move-opt[data-depth="1"] { padding-left: 28px; }
.dr2-move-opt[data-depth="2"] { padding-left: 46px; }
.dr2-move-opt[data-depth="3"] { padding-left: 64px; }
.dr2-move-opt[data-depth="4"] { padding-left: 82px; }
.dr2-move-opt[data-depth="5"] { padding-left: 100px; }
.dr2-move-opt[data-depth="6"] { padding-left: 118px; }
.dr2-move-opt svg { color: var(--brand-text); flex-shrink: 0; }
.dr2-move-opt input { width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }
.dr2-move-opt:hover { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.dr2-move-opt:has(input:checked) { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); box-shadow: inset 3px 0 0 var(--brand-text); }
.dr2-move-opt.is-disabled { cursor: default; color: var(--text-muted); }
.dr2-move-opt.is-disabled svg { color: var(--text-muted); }
.dr2-move-opt.is-disabled:hover { background: transparent; }
.dr2-move-opt > span:not(.dr2-move-here) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr2-move-here {
  margin-left: auto; padding: 1px 8px; border-radius: 999px; background: var(--surface-2);
  font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
@media (max-width: 768px), (hover: none) {
  .dr2-move-opt { min-height: 44px; }
  /* Measured at 375px: Drive's "⋯" was 30px wide, List/Grid 35px and search
     40px tall, under the 44px touch rule (UI audit §2.3: icon buttons
     36 / 44 touch). Additive, and it lifts the Drive page too, which shares
     these classes. */
  .dr2-icon-btn { width: 44px; height: 44px; }
  .dr2-view { min-width: 44px; min-height: 44px; justify-content: center; }
  .dr2-search, .dr2-sort select, .dr2-toggle { min-height: 44px; }
}
/* === end Project Drive ==================================================== */

/* === Support tickets (public/js/components/support-tickets.js) ==============
   #/project/:id/tickets. The page head, filter bar, rows, badges, "⋯" and
   dialogs are the shared list layer (util/ui-list.js); this section lays out
   the rest: the row's type icon and the ticket's own page. No inline styles
   remain in the component (UI audit 2026-09-28, §4.7). */
.tk2 .dash-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 14px; text-decoration: none; }
.tk2 .dash-btn [data-lucide] + *, .tk2 .dash-btn svg + * { margin-left: 0; }
.tk2-lead { display: inline-flex; color: var(--text-muted); }
.tk2-lead.is-urgent { color: var(--danger-ink); }
.tk2-danger-btn { color: var(--danger-text); }
.tk2-danger-btn:hover { border-color: var(--danger-text); }

.tk2-detail { max-width: 880px; display: flex; flex-direction: column; gap: 14px; }
.tk2-back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 4px;
  border: 0; border-radius: 8px; background: transparent; color: var(--brand-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tk2-back:hover { background: var(--row-tint); }
.tk2-card { padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tk2-summary { display: flex; flex-direction: column; gap: 8px; }
.tk2-summary-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tk2-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.tk2-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tk2-title { margin: 0; font-size: 22px; font-weight: 650; line-height: 1.3; color: var(--text); overflow-wrap: anywhere; }
.tk2-meta { margin: 0; font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.tk2-link { color: var(--brand-text); font-weight: 600; }
.tk2-inline-field { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tk2-inline-field .ui-select { min-width: 140px; }
.tk2-label {
  display: flex; align-items: center; gap: 8px; margin: 0 0 6px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted);
}
.tk2-count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; text-align: center; letter-spacing: 0; }
.tk2-body { font-size: 14px; line-height: 1.6; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.tk2-note { margin: 0; font-size: 13px; color: var(--text-muted); }
.tk2-thread { display: flex; flex-direction: column; gap: 8px; }
.tk2-msg { padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tk2-msg--internal { background: color-mix(in srgb, var(--warning) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.tk2-msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; color: var(--text); }
.tk2-msg-when { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.tk2-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tk2-att-size { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.tk2-composer { display: flex; flex-direction: column; gap: 10px; }
.tk2-composer-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tk2-composer-foot .tk2-primary { margin-left: auto; }
.tk2-check { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.tk2-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.tk2-audit { font-size: 13px; color: var(--text-muted); }
.tk2-audit summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; }
.tk2-audit ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12px; }
@media (max-width: 768px) {
  .tk2 .ui-head-actions { width: 100%; }
  .tk2 .ui-head-actions .tk2-primary { width: 100%; justify-content: center; }
  .tk2-actions { width: 100%; }
  .tk2-actions .dash-btn { flex: 1 1 auto; justify-content: center; }
  /* On a phone the ticket reads top to bottom: what it is, then what you can
     do with it. The actions were above the title. */
  .tk2-summary-top { display: contents; }
  .tk2-badges { order: 1; }
  .tk2-title { order: 2; font-size: 20px; }
  .tk2-summary .tk2-meta { order: 3; }
  .tk2-inline-field { order: 4; }
  .tk2-actions { order: 5; margin-top: 4px; }
  .tk2-composer-foot .tk2-primary { width: 100%; justify-content: center; margin-left: 0; }
}
@media (max-width: 768px), (hover: none) {
  .tk2 .dash-btn, .tk2-back, .tk2-check, .tk2-audit summary { min-height: 44px; }
}
/* === end Support tickets ================================================= */

/* === Reports (public/js/components/reports.js) ================================
   #/project/:id/reports, on the shared list layer. Classes are rp2-*: the
   registry page's .reports-list / .report-meta / .reports-empty come later in
   this file with equal specificity and were restyling this page (UI audit
   2026-09-28, §4.9). The layer does the rest; this is the row's author mark. */
.rp2-lead { display: inline-flex; color: var(--brand-text); }
/* === end Reports ========================================================== */

/* === Time (public/js/components/time-report.js) ===============================
   #/project/:id/time. The page head and the by-task rows are the shared list
   layer; the active time is the row's aside. Stat tiles are plain tiles: they
   used .sprint-card, which made them look clickable (hover, pointer) when
   nothing happens on a click (UI audit 2026-09-28, §4.10). */
.tm2 { display: flex; flex-direction: column; gap: 14px; }
.tm2 .ui-head { margin-bottom: 0; }
.tm2-range { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tm2-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.tm2-preset[aria-pressed="true"] { background: var(--row-tint); border-color: var(--brand-text); color: var(--text); }
.tm2-dates { display: flex; gap: 10px; }
.tm2-dates .ui-field { width: 170px; }
.tm2-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tm2-stat {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.tm2-stat-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tm2-stat-value { font-size: 22px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.tm2-stat--total .tm2-stat-value { color: var(--brand-text); font-size: 24px; }
.tm2-stat-note { font-size: 12px; color: var(--text-muted); }
.tm2-label {
  display: flex; align-items: center; gap: 8px; margin: 6px 0 0;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted);
}
.tm2-count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; text-align: center; letter-spacing: 0; }
.tm2-lead { display: inline-flex; color: var(--text-muted); }
.tm2-note { margin: 0; font-size: 13px; color: var(--text-muted); }
@media (max-width: 768px) {
  .tm2-range { flex-direction: column; align-items: stretch; }
  /* The presets stay on one line and scroll inside their own box; the page
     itself never scrolls sideways. */
  .tm2-presets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tm2-presets::-webkit-scrollbar { display: none; }
  .tm2-preset { flex-shrink: 0; }
  .tm2-dates { display: grid; grid-template-columns: 1fr 1fr; }
  .tm2-dates .ui-field { width: auto; }
  .tm2-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px), (hover: none) {
  .tm2-preset { min-height: 44px; }
}
/* === end Time ============================================================= */

/* === Git trail (public/js/components/git-trail.js) ===========================
   #/project/:id/git-trail, on the shared list layer. It borrowed
   .discussions-wrap widened inline, a table.task-list and inline-styled
   filters and modals (UI audit 2026-09-28, §4.12). The layer does the head,
   Filters, rows (static: an entry opens nothing) and dialogs; this section
   does the repository line, the commit codes and the pager. */
.gt2 .dash-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: 14px; }
.gt2 .dash-btn [data-lucide] + *, .gt2 .dash-btn svg + * { margin-left: 0; }
.gt2-repo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -8px 0 16px; font-size: 13px; color: var(--text-muted); }
.gt2-lead { display: inline-flex; color: var(--text-muted); }
.gt2-link { color: var(--brand-text); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.gt2-code, .gt2-mono { font-family: var(--font-mono); }
.gt2-code { font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--code-bg); color: var(--text); }
a.gt2-code { color: var(--brand-text); }
.gt2-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--text-muted); }
.gt2-pager-btns { display: flex; gap: 8px; }
.gt2-secret-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.gt2-secret {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--code-bg); color: var(--text); font-family: var(--font-mono); font-size: 13px;
  overflow-wrap: anywhere; user-select: all;
}
@media (max-width: 768px) {
  .gt2 .ui-head-actions { width: 100%; }
  .gt2 .ui-head-actions .dash-btn { flex: 1 1 0; justify-content: center; }
  .gt2-repo { margin-top: -4px; }
  .gt2-pager { justify-content: center; }
}
@media (max-width: 768px), (hover: none) {
  .gt2 .dash-btn { min-height: 44px; }
}
/* === end Git trail ======================================================== */

/* === API testing (public/js/components/api-testing.js) ========================
   #/project/:id/api-testing. This screen injected a ~350-line <style> on every
   render, and that sheet redefined the GLOBAL .btn-secondary / .btn-danger
   while it was mounted, restyling those buttons app-wide (UI audit 2026-09-28,
   §4.11). Everything here is at2-* and scoped to this screen. Method and
   status colours are the shared token badges; the request bar stacks on a
   phone so Save stays on screen. The page head, badges, inputs and dialogs are
   the shared list layer (util/ui-list.js). */
.at2 { display: flex; flex-direction: column; gap: 14px; }
.at2 .ui-head { margin-bottom: 0; }
.at2 .dash-btn [data-lucide] + *, .at2 .dash-btn svg + * { margin-left: 0; }
.at2 .dash-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; font-size: 14px; }
.at2-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 14px; align-items: start; }
.at2-side, .at2-card {
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 12px;
}
.at2-side { display: flex; flex-direction: column; gap: 14px; }
.at2-side-split { border-top: 1px solid var(--border); padding-top: 14px; }
.at2-panel-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.at2-panel-title h3, .at2-label { margin: 0; font-size: 13px; font-weight: 650; color: var(--text); }
.at2-label { margin-bottom: 10px; }
.at2 .dash-btn.at2-small { min-height: 36px; padding: 0 10px; font-size: 13px; }
.at2-note { margin: 0; font-size: 13px; color: var(--text-muted); }
.at2-note strong { color: var(--text); font-variant-numeric: tabular-nums; }
.at2-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.at2-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  min-height: 44px; padding: 4px 4px 4px 8px; border-radius: 8px; cursor: pointer;
}
.at2-item:hover, .at2-item:focus-within { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.at2-item:focus-visible { outline: none; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); box-shadow: inset 3px 0 0 var(--brand-text); }
.at2-item.is-active { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); box-shadow: inset 3px 0 0 var(--brand-text); }
.at2-item:not(:has(.at2-danger-icon)) { grid-template-columns: auto minmax(0, 1fr); padding-right: 8px; }
.at2-item-name { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at2-item .ui-badge { min-width: 52px; justify-content: center; }
.at2-mono { font-family: var(--font-mono); }
.at2-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.at2-item-name.at2-mono { font-size: 13px; }
.at2-danger-icon:hover, .at2-danger-icon:focus-visible { color: var(--danger-ink); }
.at2-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.at2-request-bar { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.at2-send { display: flex; gap: 8px; }
.at2 .ui-input, .at2 .ui-select { min-height: 40px; }
.at2-tabs { display: flex; gap: 4px; margin: 12px 0 10px; border-bottom: 1px solid var(--border); }
.at2-tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.at2-tab:hover:not(:disabled) { color: var(--text); }
.at2-tab.is-active { color: var(--brand-text); border-bottom-color: var(--brand-text); }
.at2-tab:disabled { cursor: not-allowed; text-decoration: line-through; }
.at2-tab:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; }
.at2-headers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.at2-header-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.at2-body { width: 100%; min-height: 180px; resize: vertical; font-size: 13px; }
.at2-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.at2-pre {
  margin: 0; max-height: 480px; overflow: auto; padding: 12px; border-radius: 8px;
  background: var(--code-bg); color: var(--text); font-family: var(--font-mono); font-size: 13px; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.at2-resp-headers { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 13px; }
.at2-resp-headers dt { font-family: var(--font-mono); color: var(--text-muted); }
.at2-resp-headers dd { margin: 0; font-family: var(--font-mono); color: var(--text); overflow-wrap: anywhere; }
.at2-running, .at2-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 12px; color: var(--text-muted); text-align: center; }
.at2-empty p, .at2-running p { margin: 0; }
.at2-loader {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: at2-spin 0.8s linear infinite;
}
.at2-loader--big { width: 28px; height: 28px; border-width: 3px; color: var(--brand-text); }
@keyframes at2-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .at2-loader { animation-duration: 2.4s; } }
@media (max-width: 1024px) {
  .at2-grid { grid-template-columns: minmax(0, 1fr); }
  .at2-list { max-height: 220px; }
  /* One column: the request and its response first, the saved lists after. */
  .at2-side { order: 2; }
}
@media (max-width: 768px) {
  .at2-request-bar { grid-template-columns: 110px minmax(0, 1fr); }
  .at2-send { grid-column: 1 / -1; }
  .at2-send .dash-btn { flex: 1 1 0; }
  .at2-header-row { grid-template-columns: minmax(0, 1fr) auto; }
  .at2-header-row .header-val { grid-column: 1; }
  .at2-header-row .delete-header-btn { grid-row: 1 / span 2; grid-column: 2; }
  .at2-resp-headers { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .at2-resp-headers dd { margin-bottom: 8px; }
}
@media (max-width: 768px), (hover: none) {
  .at2 .dash-btn, .at2 .dash-btn.at2-small, .at2 .ui-input, .at2 .ui-select, .at2-tab { min-height: 44px; }
  .at2 .tdy-icon-btn { width: 44px; height: 44px; }
}
/* === end API testing ====================================================== */

/* 2026-10-04 — the call's audio is being kept for review (call-audio-keep.js).
   A STANDING notice on every screen while it is on, member call and guest
   page alike, not a passing toast: a person's voice is not kept quietly. */
.cv-audio-keep {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  margin: 6px var(--call-gutter, 16px); padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--danger, #c0392b); background: var(--call-raise, var(--surface, #fff));
  color: var(--call-ink, var(--text, inherit)); font-size: 12px; line-height: 1.4;
}
.cv-audio-keep .cv-minutes-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger, #c0392b); flex: none; }
.cv-audio-keep-head { font-weight: 700; }
.cv-audio-keep-text { flex: 1 1 260px; min-width: 0; }
.cv-audio-keep .cv-minutes-btn {
  padding: 3px 10px; border-radius: 999px; min-height: 28px; cursor: pointer;
  border: 1px solid var(--call-line-soft, currentColor); background: transparent; color: inherit; font: inherit; font-weight: 600;
}

/* DOCS-02 — the Documents section on a task: the project's documents, found
   from the work. Quiet like Attachments above it; 12px is the floor. */
.task-docs .task-doc-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.task-docs .task-doc-list li { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 4px 6px; border-radius: 6px; }
.task-docs .task-doc-list li:hover { background: var(--row-tint); }
.task-docs .task-doc-link { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--text); text-decoration: none; font-size: 14px; }
.task-docs .task-doc-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-docs .task-doc-link:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 4px; }
.task-docs .task-doc-meta { flex: none; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.task-docs .task-doc-none { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.task-docs .task-doc-all { display: inline-block; font-size: 12px; color: var(--link); margin: 0 0 8px 6px; }

/* Show / hide a typed password (util/password-reveal.js). The toggle sits in
   the field's right edge; the field leaves room for it. The icon shows the
   state: an eye while hidden, a struck-out eye while shown. */
.pw-reveal-field { position: relative; display: block; }
.pw-reveal-field input { width: 100%; box-sizing: border-box; padding-right: 44px; }
.pw-reveal-btn {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-muted); cursor: pointer;
}
.pw-reveal-btn:hover { color: var(--text); }
.pw-reveal-btn:focus-visible { outline: 2px solid var(--brand-text, currentColor); outline-offset: 1px; }
.pw-reveal-btn .pw-reveal-eye-off { display: none; }
.pw-reveal-btn[aria-pressed="true"] .pw-reveal-eye { display: none; }
.pw-reveal-btn[aria-pressed="true"] .pw-reveal-eye-off { display: block; }

/* SHEETS-01 — a spreadsheet's tile in the Documents library. */
.mlib-sheet-prev { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--success-text); font-size: 12px; font-weight: 600; }

/* ===================================================================
 * 2026-10-15 — the ticket window, laid out for what it now carries.
 *
 * It was a 720px column holding the sign-off panel, the reviewer's account,
 * the acceptance criteria, the comments and the fields, with empty screen on
 * both sides. BigJoe: "these are too much details for that small box, and at
 * the sides we have a lot of free space." So on a desk-sized screen it takes
 * the width: the ticket and a 280px field column always, and while a gate is
 * waiting the sign-off gets a column of its own beside the ticket, so the
 * person signing reads the account and ticks the criteria side by side.
 * From 1200px each column scrolls on its own, so the fields and the
 * criteria stay in view while the review is read.
 *
 * Scoped to the ticket window (forge-task-modal), not .modal at large, and
 * not the Today's Work card (.tm-as-card), which has its own shape. Below
 * 769px the phone rules further up still stack everything.
 * =================================================================== */
@media (min-width: 769px) {
  forge-task-modal .modal:not(.tm-as-card) {
    max-width: none;
    width: min(1180px, calc(100vw - 48px));
  }
  forge-task-modal .modal:not(.tm-as-card):has(.tm-has-signoff) {
    width: min(1680px, calc(100vw - 48px));
  }
  forge-task-modal .modal:not(.tm-as-card) .modal-body {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 28px;
    padding: 20px 28px;
  }
  forge-task-modal .modal:not(.tm-as-card) .modal-body.tm-has-signoff {
    grid-template-areas: "signoff side" "main side";
  }
  .modal-body.tm-has-signoff > .tm-signoff-col { grid-area: signoff; }
  .modal-body.tm-has-signoff > .tm-main { grid-area: main; }
  .modal-body.tm-has-signoff > .sidebar-info { grid-area: side; }
}
@media (min-width: 1200px) {
  forge-task-modal .modal:not(.tm-as-card) {
    height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
  }
  forge-task-modal .modal:not(.tm-as-card) > header,
  forge-task-modal .modal:not(.tm-as-card) > .tm-locked-banner,
  forge-task-modal .modal:not(.tm-as-card) > div:not(.modal-body) { flex: 0 0 auto; }
  forge-task-modal .modal:not(.tm-as-card) .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }
  forge-task-modal .modal:not(.tm-as-card) .modal-body.tm-has-signoff {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 280px;
    grid-template-areas: "signoff main side";
  }
  forge-task-modal .modal:not(.tm-as-card) .modal-body > * {
    overflow-y: auto;
    min-height: 0;
    padding-right: 6px;
  }
  /* The column rule is the gap's job at this width. */
  forge-task-modal .modal:not(.tm-as-card) .modal-body.tm-has-signoff > .tm-main {
    border-left: 1px solid var(--border);
    padding-left: 28px;
  }
}

/* The sign-off panel's own children kept their natural width, so a long
   GitHub link or a line of the review pushed past the panel's edge and ran
   under the fields column, unreadable. */
.gate-panel > * { min-width: 0; }
.gate-panel a { overflow-wrap: anywhere; }
.gate-panel pre { max-width: 100%; overflow-x: auto; }

/* Agent comments: a header you open and close (ticket-comments.js). */
details.comment.comment-agent {
  display: block;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}
details.comment-agent > summary {
  list-style: none;
  cursor: pointer;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--text-muted);
}
details.comment-agent > summary::-webkit-details-marker { display: none; }
details.comment-agent > summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform 0.15s;
}
details.comment-agent[open] > summary::before { transform: rotate(90deg); }
details.comment-agent > summary:hover { color: var(--text); }
details.comment-agent .ca-who { font-weight: 600; color: var(--text); }
details.comment-agent .ca-stage {
  padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px;
}
details.comment-agent .ca-line {
  flex: 1 1 240px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
details.comment-agent[open] .ca-line { display: none; }
details.comment-agent > .body {
  border: none; border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  background: transparent;
  padding: 8px 12px 10px;
}

/* In its own column the sign-off panel is long, and the decision (the
   send-back questions and the sign-off button) was out of view below the
   review. Pinned to the bottom of the column so it is always in reach. */
@media (min-width: 1200px) {
  .tm-signoff-col .gate-panel .gp-decide {
    position: sticky; bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin: 0 -14px -12px; padding: 10px 14px 12px;
    display: grid; gap: 8px;
    box-shadow: 0 -6px 12px -10px rgba(0, 0, 0, 0.25);
  }
}

/* The acceptance criteria inside the PM sign-off panel (2026-10-15). */
.gate-panel .gp-crits { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gate-panel .gp-crit { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; }
.gate-panel .gp-crit-passed { border-color: color-mix(in srgb, var(--success, #16a34a) 45%, var(--border)); }
.gate-panel .gp-crit-failed { border-color: color-mix(in srgb, var(--danger, #dc2626) 55%, var(--border)); }
.gate-panel .gp-crit-head { display: flex; gap: 8px; align-items: baseline; }
.gate-panel .gp-crit-status {
  flex: 0 0 auto; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--text-muted);
}
.gate-panel .gp-crit-passed .gp-crit-status { color: var(--success-text, #15803d); }
.gate-panel .gp-crit-failed .gp-crit-status { color: var(--danger-text); }
.gate-panel .gp-crit-waived .gp-crit-status { color: var(--brand-text, var(--brand)); }
.gate-panel .gp-crit-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.gate-panel .gp-chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.gate-panel .gp-chip.gp-on { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.gate-panel .gp-waive { display: flex; gap: 6px; flex-wrap: wrap; }
.gate-panel .gp-waive[hidden] { display: none; }
.gate-panel .gp-waive-reason { flex: 1 1 220px; min-width: 0; font: inherit; font-size: 13px; }
.gate-panel .gp-waived { font-size: 12px; color: var(--text-muted); }
.gate-panel .gp-signoff-why { font-size: 13px; color: var(--text); }
.gate-panel button[data-gp="approved"]:disabled { opacity: 0.55; cursor: not-allowed; }
/* History: what stands now, plainly; the rest folded away. */
.gate-panel .gp-earlier > summary { cursor: pointer; font-size: 12px; color: var(--text-muted); }

/* Spreadsheet frozen rows: the sticky offset is measured and set on each
   frozen row at run time (sheet-page.js); this is its declared default. */
.sh-frozen { --fz-top: 0px; }

/* ── 2026-10-21 — raise hand (call-hands.js), member and guest screens ── */
/* The bar button: unmistakably on when your hand is up. */
forge-call-view .cv-btn-hand.on {
  background: var(--call-hand);
  color: var(--call-on-hand);
  border-color: var(--call-hand);
}
forge-call-view .cv-btn-hand.on .cv-btn-label { color: var(--call-on-hand); }
/* "Raised hands", in order: there whether or not anyone's camera is on. */
forge-call-view .cv-hands-host {
  position: absolute;
  top: 64px;
  right: 12px;
  z-index: 7;
  max-width: min(300px, calc(100% - 24px));
  pointer-events: auto;
}
forge-call-view .cv-hands-host[hidden] { display: none; }
forge-call-view .cv-hands {
  background: var(--call-surface);
  color: var(--call-ink);
  border: 1px solid var(--call-line);
  border-left: 3px solid var(--call-hand);
  border-radius: 10px;
  box-shadow: var(--call-shadow-sm);
  padding: 8px 10px 6px;
  font-size: 13px;
}
forge-call-view .cv-hands-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  margin-bottom: 4px;
}
forge-call-view .cv-hands-head .cv-hand-ico { color: var(--call-hand); }
forge-call-view .cv-hands-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--call-ink-dim);
}
forge-call-view .cv-hands-list { list-style: none; margin: 0; padding: 0; }
forge-call-view .cv-hands-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid var(--call-line-soft);
}
forge-call-view .cv-hands-row:first-child { border-top: 0; }
forge-call-view .cv-hands-n {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--call-hand);
  color: var(--call-on-hand);
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
forge-call-view .cv-hands-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
forge-call-view .cv-hands-tag {
  font-size: 11px;
  color: var(--call-ink-dim);
  margin-left: 2px;
}
forge-call-view .cv-hands-lower {
  flex: none;
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--call-field-line);
  background: var(--call-control);
  color: var(--call-ink);
  cursor: pointer;
}
forge-call-view .cv-hands-lower:hover { background: var(--call-control-hover); }
/* A numbered hand on each person who has one up: tile, ring, cell, header face. */
forge-call-view .cv-hand-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  background: var(--call-hand);
  color: var(--call-on-hand);
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  box-shadow: var(--call-shadow-sm);
  pointer-events: none;
}
/* A host's Remove pill sits top-left on a tile: the hand goes under it. */
forge-call-view .cv-tile:has(> .cv-person-remove) > .cv-hand-badge { top: 40px; }
forge-call-view .cv-people-av { position: relative; }
forge-call-view .cv-people-av .cv-hand-badge {
  top: -6px;
  left: auto;
  right: -6px;
  padding: 1px 4px 1px 3px;
  font-size: 10px;
  line-height: 12px;
}
forge-call-view .cv-audio-ring,
forge-call-view .cv-audio-cell { position: relative; }
@media (max-width: 600px) {
  forge-call-view .cv-hands-host { top: 56px; right: 8px; max-width: calc(100% - 16px); }
}

/* ----- Upload panel (components/upload-panel.js, 2026-10-22) ----- */
.upload-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 190;
  width: 380px; max-width: calc(100vw - 32px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
}
.upload-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; }
.upload-head strong { flex: 1; min-width: 0; font-size: 13px; }
.upload-panel:not(.collapsed) .upload-head { border-bottom: 1px solid var(--border); }
.upload-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.upload-icon-btn:hover { background: var(--surface-2); color: var(--text); }
.upload-rows { list-style: none; margin: 0; padding: 4px 12px 10px; max-height: 50vh; overflow-y: auto; }
.upload-row { padding: 8px 0; }
.upload-row + .upload-row { border-top: 1px solid var(--border); }
.upload-row-top { display: flex; align-items: center; gap: 8px; }
.upload-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-cancel {
  flex: none; border: 1px solid var(--border); border-radius: 6px; background: transparent;
  color: var(--text-muted); font-size: 12px; padding: 2px 8px; cursor: pointer;
}
.upload-cancel:hover { color: var(--danger-text); border-color: var(--danger-text); }
.upload-bar { height: 6px; margin: 6px 0 4px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.upload-bar > span { display: block; height: 100%; background: var(--brand); transition: width 0.4s linear; }
/* All sent, being stored: a different colour, so a full bar never reads as stuck. */
.upload-row[data-state="finishing"] .upload-bar > span { background: var(--brand-soft); }
.upload-row[data-state="done"] .upload-bar > span { background: var(--success); }
.upload-line { color: var(--text-muted); font-size: 12px; overflow-wrap: anywhere; }
.upload-row[data-tone="warn"] .upload-line { color: var(--warn-text); }
.upload-row[data-tone="bad"] .upload-line { color: var(--danger-text); }
.upload-row[data-tone="good"] .upload-line { color: var(--success-text); }
@media (max-width: 768px) {
  .upload-panel { right: 8px; left: 8px; width: auto; max-width: none; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}

/* Applicant portal: the staff panel on a card (components/applicant-panel.js). */
.ap-panel .ap-who { font-size: 13px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.ap-panel .ap-muted { color: var(--text-muted); font-size: 12px; }
.ap-panel .ap-sub { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 10px 0 4px; }
.ap-panel .ap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ap-panel .ap-req { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 13px; }
.ap-panel .ap-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--text-muted); flex: none; align-self: center; }
.ap-panel .ap-received .ap-dot { background: var(--brand); border-color: var(--brand); }
.ap-panel .ap-state { color: var(--text-muted); font-size: 12px; }
.ap-panel .ap-link, .ap-panel .ap-file { background: none; border: none; padding: 0; color: var(--brand); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ap-panel .ap-file { font-size: 12px; }
.ap-panel .ap-invite, .ap-panel .ap-ask { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ap-panel .ap-invite input, .ap-panel .ap-ask input { flex: 1 1 200px; min-width: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: inherit; font-size: 13px; }
.ap-panel .ap-invite .ap-row { display: flex; gap: 10px; align-items: center; flex-basis: 100%; }
.ap-panel .ap-btn { padding: 6px 12px; border-radius: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font-size: 12px; cursor: pointer; }
/* The panel is the first thing on an applicant's card, boxed so it reads as a
   section of its own rather than another field. */
.ap-panel { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.ap-panel .ap-offer-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ap-panel .ap-offer-row .ap-muted { flex: 1 1 260px; }
.ap-panel .ap-mail { margin: 6px 0 2px; padding: 6px 10px; border-radius: 6px; font-size: 12.5px; }
.ap-panel .ap-mail-sent { background: rgba(93, 202, 165, 0.10); color: var(--text, #fff); }
.ap-panel .ap-mail-failed { background: rgba(232, 93, 93, 0.14); border: 1px solid rgba(232, 93, 93, 0.5); color: var(--text, #fff); }
/* The work stream's application link, at the top of the panel. */
.ap-panel .ap-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px dashed var(--border); }
.ap-panel .ap-link-row > .ap-muted { flex: 1 1 260px; }
.ap-panel .ap-link-url { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex-basis: 100%; min-width: 0; }
.ap-panel .ap-link-url code { font-size: 12px; padding: 3px 6px; border-radius: 4px; background: var(--surface-alt); overflow-wrap: anywhere; min-width: 0; }

/* 2026-11-05 — "your workspace now requires two-factor": shown to someone
   signed in when an owner turned it on (components/mfa-settings.js). */
.mfa-required-banner {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 900; display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 32px);
  background: var(--surface, #fff); color: var(--text, #1f2328);
  border: 1px solid var(--border, #d0d7de); border-left: 4px solid var(--brand);
  padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  font-size: 13px;
}
.mfa-required-banner .mfa-banner-go { font-weight: 700; white-space: nowrap; color: var(--brand); }
.mfa-required-banner .mfa-banner-dismiss {
  background: none; border: none; color: inherit; font-size: 20px; cursor: pointer; line-height: 1;
}

/* 2026-11-05 — the 2FA ask: two equal choices, side by side, nothing pre-selected. */
.mfa-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.mfa-choice .mfa-choice-btn { width: 100%; }
.mfa-ask-p { text-align: left; }
.mfa-required-banner .mfa-banner-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mfa-required-banner .mfa-banner-actions button { min-width: 92px; }
.mfa-required-banner { max-width: min(640px, calc(100vw - 32px)); align-items: flex-start; flex-wrap: wrap; }
.mfa-required-banner .mfa-banner-text { flex: 1 1 320px; }
.mfa-required-banner .mfa-banner-text p { margin: 6px 0 0; }
.mfa-exemptions table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mfa-exemptions th, .mfa-exemptions td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border, #d0d7de); vertical-align: top; }

/* 2026-11-05 — HattVest support access (components/support-access.js). */
#sa-strip { position: sticky; top: 0; z-index: 1000; padding: 8px 16px; font-size: 13px; font-weight: 600;
  background: var(--danger-tint); color: var(--danger-text); border-bottom: 1px solid var(--danger); text-align: center; }
#sa-strip a { color: inherit; text-decoration: underline; margin-left: 6px; }
.sa-page { max-width: 960px; margin: 32px auto; padding: 0 16px; }
.sa-banner { padding: 12px 16px; margin: 12px 0 16px; border-radius: 8px; background: var(--danger-tint); color: var(--danger-text); line-height: 1.5; }
.sa-banner .btn { margin-top: 8px; }
.sa-form { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.sa-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.sa-form label.sa-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.sa-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.sa-row.sa-head { justify-content: space-between; align-items: center; }
.sa-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.sa-table th, .sa-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.sa-table code { font-size: 11px; word-break: break-all; }
.sa-actions { white-space: nowrap; }
.sa-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--text-muted); }
.sa-pill.sa-live { background: var(--danger-tint); color: var(--danger-text); }
.sa-pill.sa-waiting { background: var(--surface-2); color: var(--text); }
.sa-refused { color: var(--danger-text); font-weight: 600; }
.sa-approve { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sa-approve select.input { width: auto; min-width: 0; padding: 4px 6px; font-size: 12px; }

/* 2026-11-10 — linkDialog (ui.js): a one-time link with a Copy button. */
.forge-link-status { font-weight: 600; }
.forge-link-status.is-warn { color: var(--danger, #b42318); }
.forge-link-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.forge-link-row .forge-link-input { margin-bottom: 0; flex: 1 1 auto; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.forge-link-copy {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); cursor: pointer;
}
.forge-link-copy:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.forge-link-note { margin: 0 0 6px; font-size: 13px; color: var(--text-muted); }
.forge-link-dialog .forge-modal-actions { margin-top: 12px; }

/* ==========================================================================
   2026-11-11 — the phone as a place to work: Mail, Drive and Documents.
   HattVest is leaving Google Workspace, and the day it goes nobody has the
   Gmail, Drive or Docs app on their phone. These rules make Forge's own three
   usable with a thumb: 16px text, 44px targets, one column, no hover.
   ========================================================================== */

/* The focused phone bar never wraps. Title, mark and bell sum to exactly
   360px on a 360px phone, so one pixel of rounding dropped the bell onto a
   second line under the title. The mark is the part that shrinks. */
@media (max-width: 768px) {
  .header.header-focused-mobile { flex-wrap: nowrap; }
  .header.header-focused-mobile .wsmark.has-logo { min-width: 0; }
}

/* The bottom bar's sixth tab opens a sheet: Schedule, Meetings, Settings. */
forge-bottom-nav .tab-more { display: none; }
@media (max-width: 768px) {
  .bottom-nav .tab { font-size: 11px; }
  .bottom-nav button.tab {
    background: none; border: 0; padding: 0; font: inherit; font-size: 11px; font-weight: 500;
    color: var(--text-muted);
  }
  .bottom-nav button.tab.active { color: var(--text); }
  forge-bottom-nav .tab-more { display: flex; }
  .bottom-more { position: fixed; inset: 0; z-index: 9500; }
  .bottom-more[hidden] { display: none; }
  .bottom-more-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.4); }
  .bottom-more-sheet {
    position: absolute; left: 8px; right: 8px;
    bottom: calc(var(--mob-nav-h, 56px) + 8px);
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    padding: 6px; display: flex; flex-direction: column;
  }
  .bottom-more-item {
    display: flex; align-items: center; gap: 14px;
    min-height: 52px; padding: 0 16px; border-radius: 12px;
    color: var(--text); text-decoration: none; font-size: 16px; cursor: pointer;
  }
  .bottom-more-item.active { background: var(--brand-faint); font-weight: 600; }
  .bottom-more-item [data-lucide] { width: 22px; height: 22px; color: var(--text-muted); }

  /* The install banner rides on the bottom bar, whatever its height. */
  .pwa-install-banner.visible { bottom: var(--mob-nav-h, 56px); }
  .pwa-dismiss-btn { min-width: 44px; min-height: 44px; }
  .pwa-install-btn { min-height: 44px; }
}

/* Writing mail on a phone: the whole screen, edge to edge, inside the notch
   and the home bar; inputs at 16px so iOS does not zoom when one is tapped. */
@media (max-width: 768px) {
  .mail-compose {
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: auto !important; height: auto !important;
    border: 0 !important; border-radius: 0 !important;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mail-compose [data-max] { display: none !important; }
  .mail-compose [data-head] { padding: 6px 8px 6px 16px !important; }
  .mail-compose [data-head] button,
  .mail-compose [data-attach], .mail-compose [data-photo], .mail-compose [data-discard] {
    width: 44px !important; height: 44px !important;
  }
  .mail-compose [data-save] { height: 44px !important; }
  .mail-compose [data-send] { min-height: 44px; }
  .mail-compose input, .mail-compose select, .mail-compose [contenteditable] { font-size: 16px !important; }
  .mail-compose label { padding-left: 16px !important; padding-right: 16px !important; }
  /* No height floor here: the composer keeps the signature in view (a87e9a28). */
  .mail-compose [data-editor] { padding: 12px 16px 0 !important; }
  .mail-compose .mail-up .btn { min-height: 36px; }
}

/* No signal. Said once, at the top, instead of a raw "Failed to fetch" in
   whatever was being loaded (app.js toggles body.is-offline). */
.offline-bar { display: none; }
body.is-offline .offline-bar,
body.shows-saved .offline-bar {
  display: block; position: fixed; left: 0; right: 0; top: 0; z-index: 9800;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 16px 6px;
  background: #3a3b45; color: #fff; font-size: 14px; text-align: center;
}

/* Drive on a phone. The page title is already in the bar above; the toolbar
   becomes one search line plus a row of 44px controls; rows are 60px with
   16px names; "⋯" is a 44px target and its menu opens as a sheet from the
   bottom, where it cannot run off the edge of the screen. */
.dr2-photo-btn { display: none; }
.dr-dest { position: fixed; inset: 0; z-index: 9600; display: flex; align-items: center; justify-content: center; }
.dr-dest-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.dr-dest-sheet {
  position: relative; width: min(440px, calc(100vw - 32px)); max-height: 80vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}
.dr-dest-sheet h3 { margin: 0 0 10px; font-size: 17px; }
.dr-dest-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.dr-dest-opt {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: 16px; text-align: left; cursor: pointer;
}
.dr-dest-opt:hover, .dr-dest-opt:focus-visible { border-color: var(--brand-text); outline: none; }
.dr-dest-cancel { width: 100%; min-height: 48px; justify-content: center; }
@media (max-width: 768px) {
  .dr-dest { align-items: flex-end; }
  .dr-dest-sheet {
    width: 100%; border-radius: 16px 16px 0 0; border-bottom: 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .dr2-photo-btn { display: inline-flex; }
  .dr2 .dr2-head { margin-bottom: 10px; align-items: center; }
  .dr2 .dr2-head-text { flex: 1 1 100%; }
  .dr2 .dr2-actions-bar { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
  .dr2 .dr2-actions-bar .dash-btn { min-height: 48px; justify-content: center; font-size: 15px; }
  .dr2 .dr2-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .dr2 .dr2-search { grid-column: 1 / -1; min-height: 44px; }
  .dr2 .dr2-search input { font-size: 16px; }
  .dr2 .dr2-sort select, .dr2 .dr2-toggle { min-height: 44px; font-size: 16px; }
  .dr2 .dr2-sort span { display: none; }
  .dr2 .dr2-view { min-width: 44px; min-height: 44px; }
  .dr2 .dr2-row { min-height: 60px; padding-top: 6px; padding-bottom: 6px; }
  .dr2 .dr2-name { font-size: 16px; }
  .dr2 .dr2-meta { font-size: 13px; }
  .dr2 .dr2-icon-btn { width: 44px; height: 44px; }
  .dr2 .dr-crumbs a { display: inline-flex; min-height: 44px; align-items: center; font-size: 15px; }
  .dr2 .dr2-menu:not([hidden]) {
    position: fixed; left: 8px; right: 8px; top: auto;
    bottom: calc(var(--mob-nav-h, 56px) + 8px); min-width: 0; z-index: 9400;
    border-radius: 14px; padding: 6px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  }
  .dr2 .dr2-menu-item { min-height: 48px; font-size: 16px; }
  .dr2 .dr2-empty-actions .dash-btn { min-height: 48px; }
}

/* Documents on a phone: open to read. The header is one line (back, title,
   status, ⋯) and its actions fold behind ⋯; the A4 sheets go, the text runs
   the width of the screen at 17px; Edit / Done sits bottom right, and the
   toolbar appears only while editing, as one row that scrolls sideways. */
.me-more-btn, .me-edit-toggle { display: none; }
.me-reading .me-edit-toggle { display: inline-flex; }
.me-edit-toggle {
  position: fixed; right: 16px; bottom: 24px; z-index: 60;
  align-items: center; gap: 8px; height: 52px; padding: 0 22px; border-radius: 26px;
  border: 0; background: var(--brand); color: var(--on-brand);
  font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.me-reading .me-bar { display: none; }
@media (max-width: 768px) {
  .me-more-btn { display: inline-flex; width: 44px; height: 44px; flex: 0 0 auto; }
  .me-edit-toggle { display: inline-flex; bottom: calc(var(--mob-nav-h, 56px) + 16px); }
  .me-page:not(.me-reading) .me-edit-toggle {
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
  }
  body.pwa-banner-shown .me-edit-toggle { bottom: calc(var(--mob-nav-h, 56px) + 108px); }
  .me-page .me-top { padding: 6px 8px 6px 12px; gap: 6px; flex-wrap: nowrap; }
  .me-page .me-top .me-back { min-height: 44px; min-width: 44px; justify-content: center; }
  .me-page .me-top .me-back span { display: none; }
  .me-page .me-title { font-size: 18px; }
  .me-page .me-status { flex: 0 0 auto; }
  /* Folded: only voice typing and read aloud stay on the bar (DOCS-VOICE,
     d0d1e0fa). Dictating into a document on the move is the phone job they
     were built for, so they are never one tap further away. */
  .me-page .me-top-right { display: flex; flex: 0 0 auto; margin: 0; gap: 0; flex-wrap: nowrap; }
  .me-page .me-top:not(.open) .me-top-right > :not(#me-dictate):not(#me-read):not(#sh-pa) { display: none; }
  /* DOCS-PA — a spreadsheet has no ⋯ yet, so its Assistant stays on the bar, as an icon. */
  .me-page .me-top #sh-pa { min-width: 44px; min-height: 44px; justify-content: center; }
  .me-page .me-top #sh-pa span { display: none; }
  .me-page .me-top .me-more-btn { order: 3; }
  .me-page .me-top.open { flex-wrap: wrap; }
  .me-page .me-top.open .me-top-right {
    order: 4; flex: 1 1 100%; margin: 4px 0 2px; justify-content: flex-start; gap: 8px; flex-wrap: wrap;
  }
  .me-page .me-top.open .me-top-right .tdy-chip,
  .me-page .me-top.open .me-top-right .tdy-icon-btn,
  .me-page .me-top.open .me-top-right .btn { min-height: 44px; font-size: 15px; }
  .me-page .me-sheets { display: none; }
  .me-page .me-canvas { min-height: 0; background: var(--surface); }
  .me-page .me-canvas > .me-body { min-height: 50vh; }
  .me-page .me-body { font-size: 17px; line-height: 1.6; }
  .me-page .me-canvas-wrap { padding-bottom: 140px; }
  .me-page .me-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .me-page .me-bar .me-ctl { flex: 0 0 auto; }
}

/* Thumb targets the screen check measured under 44px, and the offline bar
   moved to the bottom on a phone so it never covers the page's own title. */
@media (max-width: 768px) {
  body.is-offline .offline-bar,
  body.shows-saved .offline-bar {
    top: auto; bottom: var(--mob-nav-h, 56px); padding: 8px 16px;
  }
  .lightbox-header button { min-width: 44px; min-height: 44px; }
  .lightbox-pdf-bar button { min-width: 44px; min-height: 44px; }
  .pwa-banner-text span { font-size: 16px; }
  .mail-compose input, .mail-compose select { min-height: 44px; }
  .mail-compose .me-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .mail-compose .me-toolbar .me-btn { min-width: 44px; min-height: 44px; flex: 0 0 auto; }
  /* 2026-11-11 — the ⋯ menu holds the signature choices now. In a toolbar that
     scrolls sideways it sat off-screen, and a menu inside the scrolling row
     can be clipped. On a phone ⋯ stays pinned at the end of the row, and its
     menu opens as a sheet at the bottom of the screen, outside the row. */
  .mail-compose .me-toolbar > .me-wrap:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -10px 0 10px -6px var(--surface); }
  .mail-compose .me-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; max-height: 60vh; overflow-y: auto; z-index: 10060; }
  .mail-compose [data-rm], .mail-compose [data-drop] { min-width: 44px; min-height: 44px; }
  .dr2 .dr2-search input { min-height: 44px; }
  .tdy-icon-btn { min-width: 44px; min-height: 44px; }
  .tdy-later { display: inline-flex; align-items: center; min-height: 44px; }
  .me-page .me-title { flex: 1 1 0; }
}

/* ── Recurring meetings, 2026-11 ─────────────────────────────────────────────
   The meeting form's Repeats control, the "this / this and following" choice,
   and the marker that says a meeting repeats. Theme tokens only, so light and
   dark follow the rest of the calendar. */
.rep { display: flex; flex-direction: column; gap: 8px; }
.rep-detail { display: flex; flex-direction: column; gap: 8px; }
.rep-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rep-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.rep-n, .rep-count { width: 5.5em; }
.rep-until { width: auto; min-width: 10em; }
.rep-end, .rep-monthmode { width: auto; max-width: 100%; }
.rep-days { gap: 6px; }
.rep-day { min-height: 36px; min-width: 44px; padding: 0 8px; justify-content: center; }
.rep-day[aria-pressed="true"] { background: var(--tdy-tint, var(--surface-alt)); border-color: var(--brand-text); }
.rep [hidden] { display: none !important; }

.cal-repeat { display: inline-flex; align-items: center; margin-left: 6px; color: var(--text-muted); vertical-align: middle; }
.wks-cell-item .cal-repeat { margin: 0 4px 0 0; }
/* On a phone the month cells hide their meetings (the Work Schedule rule,
   2026-09); without this a month with meetings in it looked empty. A count of
   the meetings still on, phone only; tapping the day opens it. */
.cal-cell-count { display: none; }
@media (max-width: 768px) {
  .cal-cell-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 5px; margin-top: 4px; border-radius: 999px;
    background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700;
  }
}
.cal-repeat-glyph { color: inherit; opacity: 0.85; font-weight: 700; }

/* A chooser on a phone: the hint goes under its label rather than squeezing
   it to an ellipsis ("This and th..." at 360px). Every chooseDialog gains. */
@media (max-width: 480px) {
  .forge-modal-choose .forge-modal-choice { flex-wrap: wrap; row-gap: 2px; }
  .forge-modal-choose .forge-modal-choice-label { white-space: normal; }
  .forge-modal-choose .forge-modal-choice-hint { flex-basis: 100%; padding-left: 23px; }
}
@media (max-width: 480px) {
  .rep-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .rep-day { min-width: 0; padding: 0; font-size: 12px; }
  .rep-until, .rep-end, .rep-monthmode { width: 100%; }
}

/* 2026-11-12 — Drive: a file's Versions and its share links (drive-file-panels.js). */
.dfp-modal { width: min(720px, calc(100vw - 32px)); }
.dfp-body { display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; }
.dfp-actions { display: flex; gap: 8px; }
.dfp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dfp-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border, #2a2b36); border-radius: 8px; }
.dfp-item.is-current { border-color: var(--brand); }
.dfp-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dfp-name { font-weight: 600; overflow-wrap: anywhere; }
.dfp-meta, .dfp-muted { color: var(--text-muted, #9a9caa); font-size: 12px; }
.dfp-badge { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--brand); color: var(--on-brand, #fff); margin-left: 6px; }
.dfp-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dfp-buttons .danger { color: var(--danger-text, #f88); }
.dfp-h { font-size: 13px; margin: 6px 0 0; }
.dfp-history { margin: 0; padding-left: 18px; font-size: 12px; color: var(--text-muted, #9a9caa); display: flex; flex-direction: column; gap: 3px; }
.dfp-error { color: var(--danger-text, #f88); }
.dfp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; align-items: start; }
.dfp-wide { grid-column: 1 / -1; margin: 0; }
.dfp-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.dfp-form input[type="text"], .dfp-form select { width: 100%; }
.dfp-radios { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.dfp-radios label { flex-direction: row; align-items: center; gap: 6px; }
.dfp-form button[type="submit"] { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 600px) {
  .dfp-form { grid-template-columns: 1fr; }
  .dfp-item { flex-direction: column; align-items: stretch; }
  .dfp-buttons { justify-content: flex-start; }
}
/* ── Booking page settings, 2026-11 (components/booking-page-settings.js) ── */
.bkp-link-row { display: flex; gap: 8px; }
.bkp-link-row .ptm-input { flex: 1; min-width: 0; }
.bkp-check { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 14px; color: var(--text); }
.bkp-lens { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.bkp-len[aria-pressed="true"] { background: var(--tdy-tint, var(--surface-alt)); border-color: var(--brand-text); }
@media (max-width: 480px) {
  .bkp-row { flex-direction: column; }
  .bkp-link-row { flex-direction: column; }
  .bkp-link-row .ptm-input { flex: none; width: 100%; }
  .cal-booking span { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   UI-GLASS (2026-11-12) — the app shell and Chat on the design tokens.

   Pieter: everything is too big and heavy. BigJoe: an Apple feel — glass,
   lighter, tighter, more refined — in Forge's own colours. Started with
   the shell (bars, tab bar, sheets) and Chat; the rest of Forge moves onto
   the same tokens later, screen by screen, rather than each screen being
   restyled by hand.

   What "lighter" means here, and what it does not:
     - less chrome: hairlines (--separator) for borders, translucent fills
       (--fill-1/-2) instead of outlined boxes, ghost icon buttons;
     - lighter weights: 600 at most, nothing at 700;
     - tighter: bars and padding on the 4px grid;
     - NOT smaller reading text: --fs-reading is 16px on a phone, and every
       phone control keeps a 44px (--tap) hit box.

   Why this block is at the END of the file and carries !important in
   places: the chat and phone layers above it are themselves !important in
   many rules (several mobile passes stacked). Rewriting them in place would
   touch every older pass at once; this layer wins by position and states
   each override once, on tokens.

   Glass (the material) is one rule per kind — BARS, SHEETS — each with a
   selector list. A surface joins the material by being added to its list,
   not by restating the recipe.
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. The material ─────────────────────────────────────────────── */
/* Opaque first: this is what paints without backdrop-filter, on a device
   that cannot afford blur (html.glass-off — util/glass.js), and when the
   person asked the system for less transparency. */
.bottom-nav,
.chat-header,
.chat-typing,
.chat-input-wrap,
.thread-head,
.thread-input-wrap {
  background: var(--glass-bar-solid) !important;
}
.bottom-more-sheet,
.cs-modal,
.ac-modal,
.cc-modal,
.emoji-picker,
.forge-toast,
.pwa-install-banner,
.offline-bar,
.msg-actions {
  background: var(--glass-sheet-solid) !important;
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  html:not(.glass-off) :is(.bottom-nav, .chat-header, .chat-typing, .chat-input-wrap, .thread-head, .thread-input-wrap) {
    background: var(--glass-bar) !important;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
  html:not(.glass-off) :is(.bottom-more-sheet, .cs-modal, .ac-modal, .cc-modal, .emoji-picker, .forge-toast, .pwa-install-banner, .offline-bar, .msg-actions) {
    background: var(--glass-sheet) !important;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
}
html.glass-off :is(.bottom-nav, .chat-header, .chat-typing, .chat-input-wrap, .thread-head, .thread-input-wrap,
  .bottom-more-sheet, .cs-modal, .ac-modal, .cc-modal, .emoji-picker, .forge-toast, .pwa-install-banner, .offline-bar, .msg-actions) {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
/* Ink on the material: the glass tokens are the ones measured against the
   worst backdrop, so text on a bar uses them, not --text / --text-muted. */
:is(.chat-header, .thread-head) h2,
:is(.chat-header, .thread-head) b { color: var(--glass-ink); }
:is(.chat-header, .thread-head) .desc,
:is(.chat-header, .thread-head) span,
.chat-typing { color: var(--glass-ink-muted); }

/* ── 2. A list that runs under its bars ──────────────────────────── */
/* util/glass.js overlayChrome() writes --chrome-top/--chrome-bottom (the
   heights of the bars above and below the list) onto the host. The list is
   pulled under them by those amounts and pads its content by the same, so
   nothing is hidden at rest and everything scrolls beneath the glass. */
.glass-host > :not(.glass-scroller) { position: relative; z-index: 2; }
.glass-host > .glass-scroller {
  position: relative; z-index: 1;
  margin-top: calc(-1 * var(--chrome-top, 0px));
  margin-bottom: calc(-1 * var(--chrome-bottom, 0px));
  padding-top: calc(var(--chrome-top, 0px) + var(--sp-3)) !important;
  padding-bottom: calc(var(--chrome-bottom, 0px) + var(--sp-3)) !important;
  scroll-padding-top: var(--chrome-top, 0px);
  scroll-padding-bottom: var(--chrome-bottom, 0px);
}

/* ── 3. The app shell ────────────────────────────────────────────── */
/* Desktop app bar: 58 → 48, a hairline instead of a border. */
.header:not(.header-focused-mobile) {
  height: var(--bar-h);
  padding: 0 var(--sp-5);
  border-bottom: var(--hairline) solid var(--separator);
}
/* Sidebar: quieter rows; the selected one is a tint of the brand, not a
   solid brand slab. White on this tint measures 11:1 on Forge violet. */
.sidebar .chat-link,
.sidebar-nav .item {
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-weight: var(--fw-regular);
  margin-bottom: 1px;
}
.sidebar .chat-link.active,
.sidebar-nav .item.active {
  background: color-mix(in srgb, var(--brand) 38%, var(--sidebar-bg));
  color: #ffffff;
  font-weight: var(--fw-medium);
}
.sidebar .chat-link.active:hover { background: color-mix(in srgb, var(--brand) 48%, var(--sidebar-bg)); }
.sidebar-footer { border-top: var(--hairline) solid rgba(255, 255, 255, 0.08); }

@media (max-width: 768px) {
  :root {
    /* Phone bars: 68 → 56 at the top, 56 → 50 at the bottom. The logo mark
       still fills the top bar's height (FRG-220), at 40px instead of 52. */
    --mob-header-h: calc(56px + env(safe-area-inset-top, 0px));
    --mob-nav-h: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  }
  .header.header-focused-mobile {
    background: var(--bg);
    border-bottom: var(--hairline) solid var(--separator);
  }
  .focused-mobile-title {
    font-size: var(--fs-title-3);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-title);
  }

  /* Tab bar: glass (the page scrolls under it), a hairline, no capsule
     behind the active icon. The active tab is the brand-tinted icon and a
     semibold label; the label stays --glass-ink because the brand ink is
     under 4.5:1 on the dark glass over a white backdrop. */
  .bottom-nav { border-top: var(--hairline) solid var(--separator) !important; }
  .bottom-nav .tab {
    font-size: var(--fs-caption) !important;
    font-weight: var(--fw-medium) !important;
    color: var(--glass-ink-muted) !important;
    gap: 2px !important;
  }
  .bottom-nav .tab.active,
  .bottom-nav button.tab.active { color: var(--glass-ink) !important; font-weight: var(--fw-semibold) !important; }
  .bottom-nav .tab.active .icon { background: none !important; padding: 0 !important; color: var(--brand-text); }
  .bottom-nav .tab [data-lucide] { width: 24px !important; height: 24px !important; stroke-width: 1.75; }

  /* The More sheet. */
  .bottom-more-backdrop { background: var(--scrim) !important; }
  .bottom-more-sheet {
    border: var(--hairline) solid var(--glass-edge) !important;
    border-radius: var(--r-xl) !important;
    box-shadow: var(--elev-3) !important;
    padding: var(--sp-1) !important;
  }
  .bottom-more-item { min-height: 48px !important; border-radius: var(--r-lg) !important; }
  .bottom-more-item.active { background: var(--fill-1) !important; font-weight: var(--fw-semibold); }

  /* Install hint and no-signal bar sit on the tab bar, in the same material. */
  .pwa-install-banner { border-top: var(--hairline) solid var(--separator) !important; box-shadow: var(--elev-2) !important; }
  .offline-bar { border-top: var(--hairline) solid var(--separator); color: var(--glass-ink); }
}

/* Toasts: a glass card, hairline edge; the status keeps its coloured edge. */
.forge-toast {
  border: var(--hairline) solid var(--glass-edge);
  border-left-width: 3px;
  border-radius: var(--r-lg);
  box-shadow: var(--elev-2);
  color: var(--glass-ink);
}

/* ── 4. Chat ─────────────────────────────────────────────────────── */
/* The frame: on desktop, a hairline card in a tighter gutter. */
@media (min-width: 769px) {
  .chat-shell {
    margin: var(--sp-3) var(--sp-4) var(--sp-4);
    height: calc(100vh - var(--bar-h) - var(--sp-3) - var(--sp-4));
    border: var(--hairline) solid var(--separator);
    border-radius: var(--r-lg);
    box-shadow: var(--elev-1);
  }
}

/* The list. */
.chat-list {
  border-right: var(--hairline) solid var(--separator);
  padding: var(--sp-2);
}
.chat-list .chat-search {
  background: var(--fill-1);
  border: none;
  border-radius: var(--r-sm);
  height: var(--control-h);
  padding: 0 var(--sp-3);
  font-size: var(--fs-subhead);
  margin-bottom: var(--sp-2);
}
.chat-list .chat-search:focus { box-shadow: 0 0 0 2px var(--brand-soft); }
.chat-list .chat-section-head {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  padding: var(--sp-3) var(--sp-2) var(--sp-1);
}
.chat-list .ch-item,
.chat-list .dm-item {
  border-radius: var(--r-sm);
  padding: 5px var(--sp-2);
}
.chat-list .ch-item:hover,
.chat-list .dm-item:hover { background: var(--fill-1); }
/* Selected: a brand tint, no bar down the side. */
.chat-list .ch-item.active,
.chat-list .dm-item.active {
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  border-left: none;
  padding-left: var(--sp-2);
}
.chat-list .ch-item .hash { font-weight: var(--fw-regular); }
.chat-list .ch-item.unread,
.chat-list .dm-item.unread { font-weight: var(--fw-semibold); }
/* The assistant card: a quiet fill instead of an outlined brand box. */
.chat-pa {
  background: var(--fill-1);
  border: none;
  border-radius: var(--r-md);
}
.chat-pa:hover { background: var(--fill-2); }
.chat-pa.active { background: color-mix(in srgb, var(--brand) 18%, transparent); border: none; }

/* The header: one quiet row of glass. */
.chat-header {
  padding: var(--sp-2) var(--chat-gutter);
  gap: var(--sp-2);
  border-bottom: var(--hairline) solid var(--separator);
  min-height: 52px;
}
.chat-header h2 {
  font-size: var(--fs-headline);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-title);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-header .desc,
.chat-header .member-count-btn { font-size: var(--fs-footnote); }
/* Call, video, settings, back: ghost icon buttons, no outline, no fill. */
.chat-header .chat-vibe-btn,
.chat-header .chat-back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control-h); height: var(--control-h);
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--glass-ink-muted);
}
.chat-header .chat-vibe-btn:hover,
.chat-header .chat-back-btn:hover { background: var(--fill-1); color: var(--glass-ink); }
.chat-header .chat-vibe-btn:first-of-type { margin-left: auto; }
.chat-header .chat-vibe-btn + .chat-vibe-btn { margin-left: 0; }
.chat-facepile {
  background: transparent;
  border: none;
  padding: 2px 6px 2px 2px;
  border-radius: var(--r-pill);
}
.chat-facepile:hover { background: var(--fill-1); }
.chat-facepile > span { font-weight: var(--fw-medium); }

/* Messages: reading text on the token, lighter names, rounder bubbles. */
.chat-messages .msg-row .content,
.thread-body .msg-row .content {
  font-size: var(--fs-reading) !important;
  line-height: var(--lh-reading) !important;
}
.chat-messages .msg-row .head .name,
.thread-body .msg-row .head .name {
  font-size: var(--fs-subhead) !important;
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
}
.chat-messages .msg-row .head .ts,
.thread-body .msg-row .head .ts { font-size: var(--fs-caption) !important; }
.msg-row:not(.system):not(.sysev) .body {
  border-radius: 18px;
  padding: 7px 12px 6px;
}
.msg-row:hover { background: transparent; }
.date-sep { font-weight: var(--fw-semibold); font-size: var(--fs-caption); }
.date-sep::before, .date-sep::after { background: var(--separator); }
.date-sep > span {
  background: var(--fill-1);
  border: none;
  border-radius: var(--r-pill);
  padding: 3px 10px;
}
.thread-teaser { border-radius: var(--r-md); }
/* The hover actions: a small glass capsule. */
.msg-actions {
  border: var(--hairline) solid var(--glass-edge) !important;
  border-radius: var(--r-pill) !important;
  box-shadow: var(--elev-2) !important;
  padding: 2px !important;
}
/* Shape only: the hit box stays the one FRG-028 sized. */
.msg-row .msg-actions button { border-radius: var(--r-pill); }
.msg-row .msg-actions button:hover { background: var(--fill-1); }

/* The composer: glass bar, one rounded field, no outlined box. */
.chat-typing { padding: 2px var(--chat-gutter) 0; min-height: 18px; font-size: var(--fs-footnote); }
/* Nobody typing: the strip takes no room, so no empty band of glass. */
.chat-typing:empty { min-height: 0 !important; padding: 0 !important; }
.chat-input-wrap {
  border-top: var(--hairline) solid var(--separator);
  padding: var(--sp-2) var(--chat-gutter) var(--sp-3);
}
.chat-typing + .chat-input-wrap { border-top: none; }
.chat-format-bar {
  background: var(--fill-1);
  border: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 2px var(--sp-1);
  box-shadow: inset 0 calc(-1 * var(--hairline)) 0 var(--separator);
}
.chat-input {
  background: var(--fill-1);
  border: none;
  border-radius: var(--r-lg);
  padding: var(--sp-1) var(--sp-2);
}
.chat-format-bar + .chat-input { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.chat-input:focus-within,
.chat-format-bar:has(+ .chat-input:focus-within) { border-color: transparent; }
.chat-input:focus-within { box-shadow: 0 0 0 2px var(--brand-soft); }
.chat-format-bar:has(+ .chat-input:focus-within) { box-shadow: 0 0 0 2px var(--brand-soft); clip-path: inset(-2px -2px 0 -2px); }
.chat-format-bar + .chat-input:focus-within { clip-path: inset(0 -2px -2px -2px); }
.chat-input button { border-radius: var(--r-sm); }
.chat-input button:hover { background: var(--fill-2); }
.chat-input button.send {
  border-radius: var(--r-pill);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-subhead);
  padding: 5px 14px;
}
.chat-input button.send:disabled { background: var(--fill-2); color: var(--text-muted); }

/* The thread panel: the same bars. */
.chat-thread-panel { border-left: var(--hairline) solid var(--separator); }
.thread-head {
  height: 52px;
  border-bottom: var(--hairline) solid var(--separator);
}
.thread-head b { font-size: var(--fs-headline); font-weight: var(--fw-semibold); }
.thread-head span { font-size: var(--fs-footnote); }
.thread-close { border-radius: var(--r-sm); }
.thread-close:hover { background: var(--fill-1); }
.thread-count::after { background: var(--separator); }

/* Chat's dialogs (channel settings, archived channels, new channel). */
.modal-backdrop:is(.cs-modal-backdrop, .cc-modal-backdrop):has(> .modal) { background: var(--scrim); }
:is(.cs-modal, .ac-modal, .cc-modal) {
  border: var(--hairline) solid var(--glass-edge);
  border-radius: var(--r-xl);
  box-shadow: var(--elev-3);
}
:is(.cs-modal, .ac-modal, .cc-modal) header { border-bottom: var(--hairline) solid var(--separator); }
:is(.cs-modal, .ac-modal, .cc-modal) header h2,
:is(.cs-modal, .ac-modal, .cc-modal) header h3 { font-weight: var(--fw-semibold); letter-spacing: var(--tracking-title); }
:is(.cs-modal, .ac-modal, .cc-modal) :is(input:not([type=checkbox]):not([type=radio]), textarea, select) {
  background: var(--fill-1);
  border: none;
  border-radius: var(--r-md);
}
:is(.cs-modal, .ac-modal, .cc-modal) :is(input, textarea, select):focus { box-shadow: 0 0 0 2px var(--brand-soft); }

/* ── 5. Chat on a phone ──────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Inside a conversation the conversation's own bar is the only bar:
     back, title, call. The app bar (title, logo, bell) above it cost 68px
     of a 844px screen and said "Chat" twice. */
  body.in-chat forge-header { display: none; }

  .chat-header {
    padding: 4px 6px !important;
    padding-top: max(4px, env(safe-area-inset-top)) !important;
    gap: 2px !important;
    min-height: calc(52px + env(safe-area-inset-top, 0px));
  }
  .chat-header > div:first-child { padding-left: 2px; }
  .chat-header h2 { font-size: var(--fs-title-3) !important; font-weight: var(--fw-semibold) !important; }
  .chat-header .member-count-text { -webkit-line-clamp: 1 !important; }
  /* Back sits first, where a thumb expects it; every control keeps 44px. */
  .chat-shell.viewing-messages .chat-header .chat-back-btn { order: -1; }
  .chat-header .chat-vibe-btn,
  .chat-header .chat-back-btn { width: var(--tap) !important; height: var(--tap) !important; border-radius: var(--r-pill) !important; }
  .chat-header .chat-vibe-btn [data-lucide],
  .chat-header .chat-back-btn [data-lucide] { width: 22px; height: 22px; }
  /* The facepile repeats the member count already under the title. */
  .chat-header .chat-facepile { display: none !important; }

  /* The list: full width on the page, not a card inside it. */
  .chat-list {
    background: var(--bg) !important;
    border-right: none;
    padding: var(--sp-2) var(--sp-3) !important;
  }
  .chat-list .chat-search {
    height: var(--tap);
    border-radius: var(--r-md);
    font-size: 16px; /* also stops iOS zooming into the field */
  }
  .chat-list .ch-item,
  .chat-list .dm-item {
    min-height: var(--tap);
    font-size: var(--fs-body);
    padding: 0 var(--sp-3);
  }
  .chat-list .ch-item.active,
  .chat-list .dm-item.active { padding-left: var(--sp-3); }

  /* Messages: 16px reading text (the phone floor). */
  .chat-messages .msg-row .head .name { font-size: var(--fs-subhead) !important; }

  /* The composer: no outlined box. A pill field on its own row, the
     controls beneath it as 44px ghost targets (FRG-214's two rows). */
  body.in-chat .chat-input-wrap,
  .chat-input-wrap {
    padding: 6px 10px !important;
    padding-bottom: max(6px, env(safe-area-inset-bottom)) !important;
    border-top: var(--hairline) solid var(--separator) !important;
  }
  .chat-input,
  .chat-input:focus-within {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    row-gap: 2px !important;
  }
  .chat-input #chat-ta,
  body.in-chat .chat-input-wrap textarea {
    background: var(--fill-1) !important;
    border: none !important;
    border-radius: 22px !important;
    padding: 11px 16px !important;
    font-size: 16px !important;
    line-height: 22px !important;
  }
  .chat-input #chat-ta:focus,
  body.in-chat .chat-input-wrap textarea:focus { box-shadow: 0 0 0 2px var(--brand-soft) !important; }
  .chat-input .action-btn { color: var(--glass-ink-muted); border-radius: var(--r-pill) !important; }
  .chat-format-bar { border-radius: var(--r-lg) !important; margin-bottom: 4px; }

  /* The thread is full-screen on a phone: same bars as the conversation. */
  .thread-head { padding-top: env(safe-area-inset-top, 0px); height: auto; min-height: calc(52px + env(safe-area-inset-top, 0px)); }
  .thread-close { width: var(--tap); height: var(--tap); border-radius: var(--r-pill); }

  /* Chat's dialogs: a sheet from the bottom edge, full width. The backdrop's
     desktop side padding left the sheet 20px off the left edge. */
  .modal-backdrop:is(.cs-modal-backdrop, .cc-modal-backdrop) { padding: 0 !important; }
  :is(.cs-modal, .ac-modal, .cc-modal) {
    border-radius: var(--r-xl) var(--r-xl) 0 0 !important;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  :is(.cs-modal, .ac-modal, .cc-modal) :is(input:not([type=checkbox]):not([type=radio]), select) { min-height: var(--tap); font-size: 16px; }
  :is(.cs-modal, .ac-modal, .cc-modal) textarea { font-size: 16px; }
}

/* ── The workspace switcher (2026-11-19, BigJoe) ──
   components/workspace-sheet.js. The phone bar's workspace mark is a button
   now; it opens a sheet of the workspaces this person can open. The sheet is
   the same glass material as the More sheet: translucent and blurred where
   the device can afford it (util/glass.js), the opaque --glass-sheet-solid
   everywhere else. */
.wsmark-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 0;
  margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit;
  border-radius: var(--r-md); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-quick) var(--ease-out), opacity var(--dur-quick) var(--ease-out);
}
.wsmark-btn:active { transform: scale(0.94); opacity: 0.8; }
.wsmark-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
/* The mark flexes inside the bar (FRG-220); the button has to let it. */
@media (max-width: 768px) {
  .header.header-focused-mobile .wsmark-btn { flex: 0 1 auto; min-width: 0; max-width: 46%; }
  .header.header-focused-mobile .wsmark-btn .wsmark.has-logo { min-width: 0; width: 100%; }
}

.ws-sheet-root { position: fixed; inset: 0; z-index: 9600; }
.ws-sheet-backdrop {
  position: absolute; inset: 0; background: var(--scrim, rgba(0, 0, 0, 0.32));
  opacity: 0; transition: opacity 220ms var(--ease-out);
}
.ws-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: min(78dvh, 640px); display: flex; flex-direction: column;
  background: var(--glass-sheet-solid);
  border: var(--hairline) solid var(--glass-edge); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--elev-3);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(100%); transition: transform 260ms var(--ease-out);
  color: var(--text);
}
/* Light catching the top edge of the material. */
.ws-sheet::before {
  content: ""; position: absolute; left: var(--r-xl); right: var(--r-xl); top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); pointer-events: none;
}
.ws-sheet-root.is-open .ws-sheet { transform: translateY(0); }
.ws-sheet-root.is-open .ws-sheet-backdrop { opacity: 1; }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  html:not(.glass-off) .ws-sheet {
    background: var(--glass-sheet);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ws-sheet, .ws-sheet-backdrop { transition: none; }
}
.ws-sheet-grabber { width: 36px; height: 5px; margin: 8px auto 0; border-radius: var(--r-pill); background: var(--fill-2); flex: none; }
.ws-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5) var(--sp-2); flex: none; }
.ws-sheet-head h2 { margin: 0; font-size: var(--fs-title-2); font-weight: 700; letter-spacing: var(--tracking-title); color: var(--glass-ink); }
.ws-sheet-done {
  min-height: var(--tap); padding: 0 var(--sp-3); border: 0; border-radius: var(--r-pill); background: var(--fill-1);
  font: inherit; font-size: 15px; font-weight: var(--fw-semibold); color: var(--glass-ink); cursor: pointer;
}
.ws-sheet-done:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ws-sheet-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--sp-3) var(--sp-4); }
.ws-sheet-group { margin: var(--sp-3) var(--sp-2) var(--sp-1); font-size: var(--fs-subhead); font-weight: var(--fw-semibold); color: var(--glass-ink-muted); }
.ws-sheet-note { margin: 0 var(--sp-2) var(--sp-2); font-size: var(--fs-footnote); color: var(--glass-ink-muted); }
.ws-sheet-list {
  margin: 0; padding: var(--sp-1); list-style: none; display: flex; flex-direction: column;
  border-radius: var(--r-lg); background: var(--fill-1);
}
.ws-sheet-row {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 60px;
  padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-md); background: transparent;
  font: inherit; text-align: left; color: var(--text); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ws-sheet-list li + li .ws-sheet-row { box-shadow: 0 calc(-1 * var(--hairline)) 0 var(--glass-edge); }
.ws-sheet-row:active { background: var(--fill-2); }
.ws-sheet-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ws-sheet-row .wsmark { flex: none; max-width: 72px; border-radius: 10px; }
.ws-sheet-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ws-sheet-name { font-size: 17px; font-weight: var(--fw-semibold); line-height: var(--lh-tight); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--glass-ink); }
.ws-sheet-sub { font-size: var(--fs-footnote); color: var(--glass-ink-muted); }
.ws-sheet-tick { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--brand-text); }
.ws-sheet-row.is-current .ws-sheet-sub { color: var(--brand-text); font-weight: var(--fw-medium); }
/* On a wide screen the same sheet floats as a card instead of a bottom sheet. */
@media (min-width: 769px) {
  .ws-sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(440px, 92vw); border-bottom: var(--hairline) solid var(--glass-edge);
    border-radius: var(--r-xl); transform: translate(-50%, -46%) scale(0.98); opacity: 0; transition: transform 220ms var(--ease-out), opacity 220ms var(--ease-out); padding-bottom: var(--sp-2); }
  .ws-sheet-root.is-open .ws-sheet { transform: translate(-50%, -50%); opacity: 1; }
  .ws-sheet-grabber { display: none; }
}

/* Unread mail in other workspaces (2026-11-19). A dot on the bar's mark says
   "something is waiting elsewhere"; the sheet says how much, per workspace.
   Counts only, the person's own (services/mail/elsewhere.ts). */
.wsmark-btn { position: relative; }
.wsmark-mail {
  position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.wsmark-mail[hidden] { display: none; }
.ws-sheet-mail { flex: none; display: inline-flex; align-items: center; }
.ws-sheet-mail-n {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--on-brand); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Settings → Notifications: new mail, by workspace (2026-11-19). */
.push-ws { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 8px 16px; padding-left: 12px; border-left: 2px solid var(--border); }
.push-ws.is-off { opacity: 0.55; }
.push-ws-head { padding: 6px 0; }
.push-ws-head .title { font-weight: 600; }
.push-ws-head .sub { font-size: 13px; color: var(--text-muted); }
.push-ws-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; cursor: pointer; }
.push-ws-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.push-ws-row .toggle { display: inline-block; }

/* ═══════════════════════════════════════════════════════════════════
   UI-GLASS 2 (2026-11-19) — the phone screens on one language.

   BigJoe: "all the screens for the phone need a redesign … apple look and
   feel". UI-GLASS (above) put the shell and Chat on tokens; this extends the
   same tokens to every phone screen instead of restyling each by hand.
   Phone only (max-width 768px): the desktop layouts are not touched.

   The language, in five rules every screen follows:
     1. ONE gutter. #view.content already pads 16px; a page's own shell adds
        nothing on top (Drive and Documents sat at 32px, Meetings at 28px).
     2. Buttons are FILLED, never outlined: --fill-1 for ordinary, the brand
        for the one primary action. 44px tall (--tap).
     3. Fields (search, selects) are a soft fill with rounded corners, no
        border; focus is a brand ring.
     4. A set of choices (Day/Week/Month, list/grid) is ONE segmented
        control: a track with the chosen segment raised.
     5. Lists are grouped: one rounded panel, rows split by hairlines,
        instead of a box around every row.
   Weights stay at 600 or below; reading text stays 16px (UI-GLASS).
   ═══════════════════════════════════════════════════════════════════ */
/* The raised segment: lighter than its track in BOTH themes. */
:root { --seg-on: #ffffff; }
html[data-theme="dark"] { --seg-on: #3a3b47; }
@media (max-width: 768px) {
  /* 1. One gutter. */
  #view.content :is(.page-shell, .mm-shell) {
    padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
  }

  /* 2. Buttons. */
  #view .dash-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    min-height: var(--tap); padding: 0 var(--sp-4);
    border: 0 !important; border-radius: var(--r-md);
    background: var(--fill-1); color: var(--text);
    font-size: 15px; font-weight: var(--fw-semibold);
    -webkit-tap-highlight-color: transparent;
  }
  #view .dash-btn-primary { background: var(--brand); color: var(--on-brand); }
  #view .dash-btn:active { opacity: 0.7; }
  #view .dash-btn svg { width: 17px; height: 17px; }

  /* 3. Fields. */
  #view :is(.dr2-search, .mlib-search, .chat-search, .ws-sheet-search) {
    border: 0 !important; border-radius: var(--r-md) !important; background: var(--fill-1) !important;
    min-height: 40px; color: var(--text-muted);
  }
  #view :is(.dr2-search, .mlib-search):focus-within { box-shadow: 0 0 0 2px var(--brand-soft); }
  #view :is(.dr2-search, .mlib-search) input { background: transparent !important; border: 0 !important; font-size: 16px; }
  #view :is(.dr2-sort select, .mlib-filters select) {
    min-height: 40px; border: 0 !important; border-radius: var(--r-md); background-color: var(--fill-1); color: var(--text); font-size: 15px;
  }

  /* 4. Segmented controls. */
  #view :is(.dr2-views, .wks-views) {
    display: inline-flex; gap: 2px; padding: 2px; border: 0 !important; border-radius: var(--r-md);
    background: var(--fill-1); overflow: visible;
  }
  #view :is(.dr2-views, .wks-views) > button {
    min-height: 36px; min-width: 44px; padding: 0 var(--sp-3);
    border: 0 !important; border-radius: 8px !important; background: transparent !important; box-shadow: none !important;
    color: var(--text-muted); font-size: 14px; font-weight: var(--fw-medium);
  }
  #view .dr2-views > button + button { border-left: 0 !important; }
  #view :is(.dr2-views > button.on, .wks-views > button[aria-pressed="true"]) {
    background: var(--seg-on) !important; color: var(--text); font-weight: var(--fw-semibold);
    box-shadow: var(--elev-1), 0 0 0 var(--hairline) var(--glass-edge) !important;
  }

  /* 5. Grouped lists. */
  #view .dr2-list {
    padding: 0 !important; border: 0 !important; border-radius: var(--r-lg); background: var(--surface); overflow: hidden;
  }
  #view .dr2-list .dr2-row { border-radius: 0 !important; min-height: 56px; }
  #view .dr2-list .dr2-row + .dr2-row { box-shadow: inset 0 var(--hairline) 0 var(--separator); }

  /* ── Drive ── */
  /* "My Drive" repeats the bar's "Drive". Inside a folder the trail is
     navigation and stays. */
  .dr-crumbs:has(> .dr2-here:only-child) { display: none; }
  .dr2-head { margin-bottom: var(--sp-3); }
  .dr2-actions-bar { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-2); width: 100%; }
  .dr2-actions-bar .dash-btn { padding: 0 var(--sp-2); }
  .dr2-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--sp-2); }
  .dr2-toolbar .dr2-search { grid-column: 1 / -1; }
  .dr2-sort select { width: 100%; }
  .dr2-toggle { border: 0 !important; border-radius: var(--r-md) !important; background: var(--fill-1) !important; min-height: 40px; }
  .dr2-name { font-size: var(--fs-headline); font-weight: var(--fw-semibold); }
}
@media (max-width: 768px) {
  /* ── Documents ── */
  /* The bar already says "Documents"; the page's own title and line repeat it. */
  forge-docs-page .mm-head { display: none; }
  .mlib { display: flex; flex-direction: column; gap: var(--sp-3); }
  .mlib > * { margin: 0 !important; }
  .mlib-rulings {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2);
    padding: var(--sp-3) !important; border-radius: var(--r-lg) !important; font-size: var(--fs-subhead); line-height: 1.4;
  }
  .mlib-rulings .mlib-rulings-link { min-height: 32px; }
  /* Create: one row of three filled tiles, not three dashed boxes off the edge. */
  .mlib-top-row { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); overflow: visible !important; }
  .mlib-top-row .mlib-create {
    width: auto !important; min-width: 0 !important; height: auto !important; min-height: 76px; padding: var(--sp-3) var(--sp-2) !important;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1);
    border: 0 !important; border-radius: var(--r-lg) !important; background: var(--fill-1) !important;
  }
  .mlib-create .mlib-create-plus { font-size: 22px; line-height: 1; height: auto; color: var(--brand-text); }
  .mlib-create .mlib-create-label { font-size: var(--fs-subhead); font-weight: var(--fw-medium); color: var(--text); white-space: normal; text-align: center; line-height: 1.25; }
  /* Filters: a two-column grid; the view switch is a segmented control. */
  .mlib-filters { display: grid !important; grid-template-columns: 1fr 1fr; gap: var(--sp-2); padding: 0 !important; border: 0 !important; }
  .mlib-filters .mlib-sel { width: 100%; min-width: 0; }
  .mlib-filters .mlib-spacer { display: none; }
  .mlib-filters #mlib-newfolder { border: 0 !important; border-radius: var(--r-md) !important; background: var(--fill-1) !important; min-height: 40px; justify-content: center; }
  .mlib-viewtoggle { grid-column: 1 / -1; justify-self: start; display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-md); background: var(--fill-1); }
  .mlib-viewtoggle .mlib-vt { min-height: 36px; border-radius: 8px !important; }
  .mlib-viewtoggle .mlib-vt.on { background: var(--seg-on) !important; box-shadow: var(--elev-1), 0 0 0 var(--hairline) var(--glass-edge); color: var(--text); }
  .mlib-empty { padding: var(--sp-6) var(--sp-4) !important; border-radius: var(--r-lg); background: var(--fill-1); color: var(--text-muted); font-size: var(--fs-subhead); }
}
@media (max-width: 768px) {
  /* ── Chips, everywhere on a phone: filled, not outlined ── */
  #view .tdy-chip { border: 0 !important; background: var(--fill-1); font-weight: var(--fw-medium); }
  #view .tdy-chip[aria-pressed="true"]:not(.wks-views > .tdy-chip) { background: var(--brand-faint); color: var(--brand-text); }

  /* ── Meetings and Work Schedule (the calendar shell) ── */
  /* One 16px gutter: Meetings sits in a padded view (its own 12px went on top);
     Work Schedule sits in an unpadded one (its 12px was all it had). */
  forge-meetings-page .cal-page { padding-left: 0 !important; padding-right: 0 !important; }
  forge-work-schedule .cal-page { padding-left: 16px !important; padding-right: 16px !important; }
  .cal-toolbar { gap: var(--sp-2) !important; margin-bottom: var(--sp-2); }
  .cal-toolbar .wks-nav { gap: var(--sp-1); }
  .cal-toolbar .wks-range { font-size: var(--fs-title-3); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-title); margin-left: auto; }
  .cal-toolbar .cal-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: nowrap; }
  .cal-toolbar .cal-actions .wks-views { flex: 1 1 auto; }
  .cal-toolbar .cal-actions .wks-views > .tdy-chip { flex: 1 1 0; justify-content: center; }
  .cal-toolbar .cal-actions > .tdy-chip { min-width: 40px; min-height: 40px; padding: 0 var(--sp-2); justify-content: center; border-radius: var(--r-md); }
  /* New meeting: a floating button above the tab bar, not a row of its own. */
  #mm-new-meeting.cal-new {
    position: fixed; z-index: 40; width: 56px; height: 56px;
    right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--mob-nav-h, 56px) + 16px);
    border-radius: 18px; box-shadow: var(--elev-3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }
  #mm-new-meeting.cal-new svg { width: 24px; height: 24px; }
  .cal-page.panel-open #mm-new-meeting.cal-new { display: none; }
  /* The time-zone line: a quiet line of text, not a box. */
  forge-cal-grid .cal-grid { border-radius: var(--r-lg) !important; border: var(--hairline) solid var(--separator) !important; overflow: hidden; }
}
@media (max-width: 768px) {
  /* ── Settings ── */
  /* The section list: one grouped panel on the page's ground, a chevron per row. */
  .settings-shell .settings-nav { background: var(--bg) !important; border: 0 !important; }
  .settings-shell .settings-nav h5 { margin: var(--sp-4) var(--sp-3) var(--sp-2); font-size: var(--fs-footnote); letter-spacing: 0.04em; }
  .settings-shell .settings-nav a.item {
    position: relative; min-height: 48px; display: flex; align-items: center; gap: var(--sp-3);
    margin: 0 !important; padding: 0 40px 0 var(--sp-4) !important; border-radius: 0 !important;
    background: var(--surface); color: var(--text); font-size: 16px;
  }
  .settings-shell .settings-nav h5 + a.item,
  .settings-shell .settings-nav :not(a.item) + a.item { border-top-left-radius: var(--r-lg) !important; border-top-right-radius: var(--r-lg) !important; }
  .settings-shell .settings-nav a.item:has(+ :not(a.item)),
  .settings-shell .settings-nav a.item:last-child { border-bottom-left-radius: var(--r-lg) !important; border-bottom-right-radius: var(--r-lg) !important; }
  /* The separator starts at the text, as a grouped list does, not at the edge. */
  .settings-shell .settings-nav a.item + a.item::before {
    content: ""; position: absolute; left: 52px; right: 0; top: 0; height: var(--hairline); background: var(--separator);
  }
  .settings-shell .settings-nav a.item::after {
    content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -5px;
    border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(-45deg); opacity: 0.6;
  }
  .settings-shell .settings-nav a.item:active { background: var(--fill-1); }
  .settings-shell .settings-nav .item-icon { color: var(--brand-text); }
  .settings-desktop-note { border: 0 !important; background: none !important; padding: var(--sp-3) var(--sp-3) 0 !important; font-size: var(--fs-footnote); color: var(--text-muted); }
  .settings-mobile-footer { border: 0 !important; padding: var(--sp-6) 0 var(--sp-4) !important; }
  .settings-mobile-footer .settings-logout {
    width: 100%; min-height: var(--tap); justify-content: center; border: 0 !important; border-radius: var(--r-lg) !important;
    background: var(--surface) !important; color: var(--danger-text) !important; font-weight: var(--fw-semibold);
  }

  /* Inside a section: cards are borderless panels; fields are filled. */
  .settings-main > h1 { font-size: var(--fs-title-1); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-title); }
  .settings-main .settings-card {
    border: 0 !important; border-radius: var(--r-lg) !important; padding: var(--sp-4) !important;
    background: var(--surface) !important; box-shadow: none !important;
  }
  .settings-main .perm-info { border: 0 !important; border-radius: var(--r-lg) !important; background: var(--fill-1) !important; font-size: var(--fs-subhead); }
  .settings-main :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea) {
    min-height: var(--tap); border: 0 !important; border-radius: var(--r-md) !important; background-color: var(--fill-1) !important;
    font-size: 16px; color: var(--text);
  }
  .settings-main :is(input, select, textarea):focus { outline: none; box-shadow: 0 0 0 2px var(--brand-soft) !important; }
  .settings-main .form-row label { font-size: var(--fs-footnote); color: var(--text-muted); text-transform: none; letter-spacing: 0; font-weight: var(--fw-medium); }
  .settings-main :is(.btn-primary, .btn-secondary) { min-height: var(--tap); border: 0 !important; border-radius: var(--r-md) !important; font-weight: var(--fw-semibold); }
  .settings-main .btn-secondary { background: var(--fill-1) !important; color: var(--text) !important; }
}
@media (max-width: 768px) {
  /* ── Chat: the list of conversations ── */
  /* One gutter (the view's 16px); the list, its sections and rows added 12px
     and 6px more on top. */
  #view .chat-list { padding-left: 0 !important; padding-right: 0 !important; }
  .chat-list .chat-search { width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
  .chat-list .chat-pa-wrap { margin-left: 0 !important; margin-right: 0 !important; }
  .chat-list .chat-pa { border-radius: var(--r-lg) !important; background: var(--surface) !important; }
  .chat-list .chat-section-head { padding-left: var(--sp-3) !important; padding-right: 0 !important; }
  /* Each section is one grouped panel; rows split by hairlines. */
  .chat-list .chat-section-body {
    border-radius: var(--r-lg); background: var(--surface); overflow: hidden;
  }
  .chat-list .chat-section-body .ch-item {
    margin: 0 !important; min-height: 48px; border-radius: 0 !important; padding: 0 var(--sp-4) !important;
  }
  .chat-list .chat-section-body .ch-item + .ch-item { box-shadow: inset 0 var(--hairline) 0 var(--separator); }
  .chat-list .chat-section-body .ch-item:active { background: var(--fill-1); }
}

/* ── Meetings: the side panel fits the screen; Upcoming scrolls in itself ──
   2026-11-19 (BigJoe): "remove that and move every thing up so that there is
   not big scroll if you have multiple meetings in upcoming". The People
   block left the panel for the toolbar (meetings-page.js peopleButtonHtml),
   and the panel is a column that fits the screen: the mini month and the
   time zones keep their size, and Upcoming / Past shrinks into what is left
   and scrolls inside itself, so the clocks stay in view however many
   meetings there are. Never below ~two rows; a short list keeps its own
   height (shrink only, never grow). On a very short screen the panel itself
   scrolls as the last resort. */
.cal-panel > :is(.cal-mini, forge-world-clock, .cal-panel-close) { flex: none; }
/* Its floor is its tabs plus ~two rows: below that the PANEL scrolls instead of
   the list spilling out over the clocks (seen at 1366x768). */
.cal-panel > .cal-lists { flex: 0 1 auto; min-height: 156px; display: flex; flex-direction: column; }
.cal-panel > .cal-lists > :is(.wks-views, .cal-more) { flex: none; }
.cal-panel > .cal-lists > .cal-list { flex: 0 1 auto; min-height: 112px; overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 1024px) {
  /* Sticky at 16px inside the scrolling view, under the app bar. */
  .cal-panel { max-height: calc(100dvh - var(--bar-h, 48px) - 32px); overflow-y: auto; }
}
/* Phone and tablet: the panel is a full-screen sheet, and the mini month plus
   nine clocks is taller than a phone. The sheet opens on what it is for:
   Upcoming / Past, then the time zones; the mini month moves to the bottom
   (the toolbar above already steps through days). */
@media (max-width: 1023px) {
  .cal-page.panel-open .cal-panel > .cal-panel-close { order: 0; }
  .cal-page.panel-open .cal-panel > .cal-lists { order: 1; }
  .cal-page.panel-open .cal-panel > forge-world-clock { order: 2; }
  .cal-page.panel-open .cal-panel > .cal-mini { order: 3; }
  /* The mini month gives way below the fold, so Upcoming can show more. */
  /* Floor = the tabs (~52px) + the list's floor: lower (0) let the list spill
     over the clocks; content-sized (auto) stopped it shrinking at all. */
  .cal-page.panel-open .cal-panel > .cal-lists { min-height: calc(min(240px, 30dvh) + 52px); }
  .cal-page.panel-open .cal-panel > .cal-lists > .cal-list { min-height: min(240px, 30dvh); }
}
/* A laptop-height screen: a little tighter, so the mini month, two meetings and
   every clock fit at 768px tall instead of the panel scrolling. */
@media (min-width: 1024px) and (max-height: 820px) {
  .cal-panel { gap: 10px; }
  .cal-panel .cal-mini-day { height: 26px; }
  .cal-panel forge-world-clock .cal-clock { min-height: 25px; }
  .cal-panel forge-world-clock .cal-clocks { gap: 4px; }
}

/* The people button in the toolbar, its count, and the search it opens. */
.cal-people-btn { position: relative; justify-content: center; }
.cal-people-btn.is-open { background: var(--brand-faint); color: var(--brand-text); }
.cal-people-n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--on-brand); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.cal-main > .cal-people { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; max-width: 420px; }
.cal-main > .cal-people .cal-people-search input { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.cal-main > .cal-people.is-open { padding: 12px; border-radius: 14px; background: var(--surface); border: 0.5px solid var(--border); box-shadow: var(--elev-2, 0 4px 16px rgba(0,0,0,0.08)); }
@media (max-width: 768px) {
  .cal-main > .cal-people { max-width: none; }
  .cal-people-btn { min-width: 40px; min-height: 40px; border-radius: var(--r-md); }
}

/* ═══ Today, rebuilt (2026-11-19, BigJoe: "it's not working for us") ═══
   components/todays-work.js. One answer to "what do I do next": Now, then
   who is waiting on you, then today in time order, then one Overdue row.
   On the UI-GLASS tokens; phone first, the same layout on a desktop. */
.tdy2 { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 720px; }
.tdy2-dayline { display: flex; flex-direction: column; gap: var(--sp-1); padding: 0 var(--sp-1); }
.tdy2-dayline .tdy-date { font-size: var(--fs-subhead); font-weight: var(--fw-semibold); color: var(--text-muted); }

/* Now: one thing, one button, the reason in small print. */
.tdy2-now {
  display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4);
  border-radius: var(--r-xl); border: var(--hairline) solid color-mix(in srgb, var(--brand) 40%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 10%, var(--surface)), var(--surface) 70%);
  box-shadow: var(--elev-2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.tdy2-now.is-clear { border-color: var(--separator); background: var(--surface); }
.tdy2-now-k { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-text); }
.tdy2-now-h { font-size: var(--fs-title-2); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-title); line-height: var(--lh-tight); color: var(--text); overflow-wrap: anywhere; }
.tdy2-now-why { font-size: var(--fs-subhead); color: var(--text-muted); line-height: 1.4; }
.tdy2-now-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-1); }
.tdy2-now-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 var(--sp-5);
  border: 0; border-radius: var(--r-pill); background: var(--brand); color: var(--on-brand);
  font: inherit; font-size: 15px; font-weight: var(--fw-semibold); text-decoration: none; cursor: pointer;
}
.tdy2-now-btn.is-quiet { background: var(--fill-1); color: var(--text); }
.tdy2-now-btn:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }

/* Waiting on you: each kind marked, so the list does not read as all-equal. */
.tdy2-wait { text-decoration: none; color: inherit; align-items: center; }
.tdy2-kind { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.tdy2-wait.is-approval .tdy2-kind { background: var(--brand-faint); color: var(--brand-text); }
.tdy2-wait.is-signoff .tdy2-kind { background: var(--info-tint); color: var(--info-text); }
.tdy2-wait.is-blocked .tdy2-kind { background: var(--warn-tint); color: var(--warn-ink); }
.tdy2-wait.is-message .tdy2-kind { background: var(--success-tint); color: var(--success-text); }
.tdy2-kind-label {
  flex: none; margin-right: var(--sp-2); padding: 1px 6px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: var(--fw-semibold); letter-spacing: 0.02em; background: var(--fill-1); color: var(--text-muted);
}
.tdy2-wait .tdy-row-title { display: flex; align-items: baseline; min-width: 0; }
.tdy2-wait .tdy-title-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tdy2-wait .tdy-row-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tdy2-age { flex: none; margin-left: auto; font-size: var(--fs-footnote); font-weight: var(--fw-semibold); color: var(--warn-ink); font-variant-numeric: tabular-nums; }
.tdy2-tag { display: inline-block; padding: 0 6px; border-radius: var(--r-xs); background: var(--fill-1); font-size: 11px; font-weight: var(--fw-semibold); }

/* Overdue: one row, never a list on the page. */
.tdy2-overdue {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 52px; padding: 0 var(--sp-4);
  border: 0; border-radius: var(--r-lg); background: var(--fill-1); color: var(--text);
  font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.tdy2-overdue > span { flex: 1; }
.tdy2-overdue b { color: var(--warn-ink); font-weight: var(--fw-semibold); }
.tdy2-overdue:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }

.tdy2-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.tdy2-links .tdy-chip { text-decoration: none; }
.tdy2-elsewhere { display: flex; flex-direction: column; gap: var(--sp-2); }
.tdy2-elsewhere-btn {
  display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-1);
  border: 0; background: none; color: var(--text-muted); font: inherit; font-size: var(--fs-subhead); cursor: pointer; text-align: left;
}
.tdy2-elsewhere-btn > span { flex: 1; }
.tdy2-ws { text-decoration: none; color: inherit; align-items: center; }

/* The overdue sheet: the switcher's glass sheet, from the bottom on a phone. */
.tdy2-sheet-root { position: fixed; inset: 0; z-index: 9600; }
.tdy2-sheet-backdrop { position: absolute; inset: 0; background: var(--scrim); }
.tdy2-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: min(82dvh, 720px); display: flex; flex-direction: column;
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
  border-radius: var(--r-xl) var(--r-xl) 0 0; border: var(--hairline) solid var(--glass-edge); border-bottom: 0;
  background: var(--glass-sheet-solid); box-shadow: var(--elev-3); color: var(--text);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  html:not(.glass-off) .tdy2-sheet { background: var(--glass-sheet); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
}
.tdy2-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.tdy2-sheet-head h2 { margin: 0; font-size: var(--fs-title-2); font-weight: var(--fw-semibold); }
.tdy2-sheet-done { min-height: var(--tap); padding: 0 var(--sp-3); border: 0; border-radius: var(--r-pill); background: var(--fill-1); color: var(--text); font: inherit; font-weight: var(--fw-semibold); cursor: pointer; }
.tdy2-sheet-note { margin: var(--sp-2) 0 var(--sp-3); font-size: var(--fs-footnote); color: var(--text-muted); }
.tdy2-od-list { margin: 0; padding: 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; border-radius: var(--r-lg); background: var(--fill-1); }
.tdy2-od-row { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); }
.tdy2-od-row + .tdy2-od-row { box-shadow: inset 0 var(--hairline) 0 var(--separator); }
.tdy2-od-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.tdy2-od-actions .tdy-chip { min-height: var(--tap); border: 0; background: var(--surface); }
.tdy2-od-pick { position: relative; cursor: pointer; }
.tdy2-od-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
@media (min-width: 769px) {
  .tdy2-sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 92vw); transform: translate(-50%, -50%); border-radius: var(--r-xl); border-bottom: var(--hairline) solid var(--glass-edge); }
}

/* ── DOCS-SHEETS-NAV — Spreadsheets beside Documents ────────────────────
   One store, two lists. Spreadsheets is a sidebar row of its own after
   Documents (a plain .chat-link) and, on a phone, the first item in More.
   A search in one list shows the other kind's matches below, with a way
   across. */
.mlib-other { margin-top: var(--sp-5, 20px); }
.mlib-other-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px; color: var(--text-muted, #8a8b94); font-size: 14px;
}
.mlib-other-head .tdy-chip { text-decoration: none; }

/* ═══ Phone top bar: one control top right (2026-11-20, BigJoe: "drop the
   notification icon and move the workspace icon in there") ═══
   Title on the left, the workspace mark on the right, no bell. The mark's
   badge counts notifications plus mail waiting in other workspaces; its sheet
   lists the notifications above the workspaces (workspace-sheet.js). The bell
   element stays in the bar, hidden: it raises the toast and sound. */
@media (max-width: 768px) {
  .header.header-focused-mobile .focused-mobile-title { flex: 1 1 auto; text-align: left; }
  .header.header-focused-mobile .wsmark-btn { margin-left: auto; max-width: 40%; }
  .header.header-focused-mobile forge-notifications { display: none !important; }
}
.wsmark-mail:not([hidden]) {
  width: auto; min-width: 20px; height: 20px; padding: 0 6px; top: 0; right: -6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--on-danger, #fff); font-size: 12px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  border-radius: var(--r-pill, 999px);
}
.ws-sheet-notes { margin-bottom: 8px; }
.ws-sheet-notes-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ws-sheet-notes-all { font-size: 14px; color: var(--brand-text, var(--brand)); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; }
.ws-note { align-items: flex-start; }
.ws-note .ws-sheet-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.ws-note-dot { flex: none; width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: transparent; }
.ws-note.is-unread .ws-note-dot { background: var(--accent); }
.ws-note.is-unread .ws-sheet-name { font-weight: 700; }

/* 2026-11-20 — the product's sign-in lockup (Mezzor OS pack, stacked). The
   theme is html[data-theme], never the OS preference (theme contract). */
.login-lockup { display: block; height: 112px; width: auto; margin: 4px auto 14px; }
.login-lockup-dark { display: none; }
html[data-theme="dark"] .login-lockup-light { display: none; }
html[data-theme="dark"] .login-lockup-dark { display: block; }

/* ═══ Today, as the investor deck draws it (page 12, 2026-11-20) ═══
   BigJoe: "the top is showing your PA". A greeting and the page's own count,
   the assistant's card first (its summary, then what to do first), short
   status pills, and the agents working now. In the light theme the card is
   the product's navy with paper ink, as the deck has it; in dark it stays on
   the theme's own surface. Measured on navy (2026-11-20): paper 15.4:1,
   muted 8.5:1, brand text 6.3:1, white on the blue button 7.3:1. */
.tdy2-hello { margin: 0; font-size: var(--fs-title-2, 22px); font-weight: var(--fw-semibold, 600); letter-spacing: var(--tracking-title, -0.01em); line-height: 1.2; color: var(--text); }
.tdy2-pa-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.tdy2-pa-head svg { color: var(--accent); flex: none; }
.tdy2-pa .tdy-overnight { margin: 0; font-size: 15px; line-height: 1.45; color: var(--text); }
.tdy2-pa .tdy-overnight svg { display: none; }
.tdy2-pa .tdy-overnight span { white-space: normal; overflow: visible; }
.tdy2-pa .tdy-overnight-agent > span:not(.tdy-sr) { -webkit-line-clamp: 5; }
html[data-theme="light"] .tdy2-pa:not(.is-clear),
html[data-theme="light"] .tdy2-pa.is-clear {
  --text: var(--mz-paper);
  --text-muted: color-mix(in srgb, var(--mz-paper) 72%, var(--mz-navy));
  --brand-text: #7fa0bc;            /* the dark theme's derived brand text: 6.3:1 on navy */
  --fill-1: color-mix(in srgb, #ffffff 12%, var(--mz-navy));
  background: var(--mz-navy); border-color: var(--mz-navy); color: var(--mz-paper);
}
.tdy2-pill {
  flex: none; align-self: center; margin-left: 6px; padding: 2px 8px; border-radius: var(--r-pill, 999px);
  font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.tdy2-pill.is-high { background: var(--danger-tint); color: var(--danger-ink); }
.tdy2-pill.is-agent { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand-text); }
.tdy2-pill.is-due { background: var(--warn-tint); color: var(--warn-ink); }
.tdy2-agents { display: flex; flex-direction: column; gap: var(--sp-2, 8px); }
.tdy2-agent-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tdy2-agent-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; max-width: 100%; padding: 4px 12px;
  border-radius: var(--r-pill, 999px); background: var(--fill-1); color: var(--text); text-decoration: none;
  font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tdy2-agent-live { width: 7px; height: 7px; border-radius: 50%; background: var(--success, #639922); flex: none; }

/* 2026-11-20 — no tab bar for someone who is not signed in (bottom-nav.js
   showsTabs). The phone rules above set display:block, which would beat the
   hidden attribute on its own. */
forge-bottom-nav[hidden] { display: none !important; }
