/* =================================================================
   WF Portal — Global Design Tokens (Light Theme Defaults)
   -----------------------------------------------------------------
   All design tokens live under --theme-*. These are the only values
   you need to change to retheme the application.

   Per-tenant runtime overrides are injected by Theme.razor using the
   same --theme-* variable names. Theme.razor emits a <style> block
   that overrides specific variables — the browser cascade handles
   the rest.

   There is no separate theme.css file. root.css is the single
   source of truth for defaults. Dark themes are just another
   tenant override.
   ================================================================= */

:root {
    /* The scheme lives on :root (it used to sit on <body>, which overrode the dark value Theme.razor
       emits on :root for everything inside the page - dark tenants got light date pickers, selects and
       scrollbars, and light-dark() could never resolve dark). Theme.razor emits `dark` for a dark tenant. */
    color-scheme: light;

    /* ── Backgrounds ──────────────────────────────────────────────── */

    --theme-background:               #ffffff;
    --theme-background-subtle:        #f1f4f7;
    --theme-background-raised:        #ffffff;
    --theme-background-float:         #ffffff;
    --theme-background-hover:         #e8ecf0;
    --theme-background-active:        #dde2e8;

    /* ── Surfaces ─────────────────────────────────────────────────────
       Aliases of the tenant-aware background tokens above. The app
       references --theme-surface (and a few variants) in ~12 stylesheets
       but they were never DEFINED here, so every `var(--theme-surface,#fff)`
       fell back to white — invisible/broken on dark tenant themes. Because
       these alias the background tokens (which Theme.razor overrides per
       tenant), surfaces now track light AND dark themes automatically.
       Light defaults resolve to the same whites the old fallbacks produced,
       so light mode is unchanged. (--theme-surface-raised is intentionally
       NOT aliased: its one consumer is a deliberately-dark contrast chip
       that keeps its own #333 fallback.) */

    --theme-surface:                  var(--theme-background-raised);
    --theme-surface-2:                var(--theme-background-subtle);
    --theme-surface-alt:              var(--theme-background-subtle);
    --theme-surface-sunken:           var(--theme-background-subtle);
    --theme-surface-hover:            var(--theme-background-hover);
    --theme-surface-muted:            var(--theme-background-subtle);

    /* ── Borders ──────────────────────────────────────────────────── */

    --theme-border:                   #e2e6eb;
    --theme-border-subtle:            #cdd3db;

    /* ── Primary brand (forest green) ────────────────────────────── */

    --theme-primary:                  #1a6b3c;
    /* (--theme-primary-rgb / --theme-info-rgb are retired, 2026-10-01: every consumer mixes the colour
       itself - color-mix(in srgb, var(--theme-primary) N%, transparent) - because a stored triple can
       disagree with the colour it shadows. Tests/ShellTokensOnlyTests keeps them gone.) */
    --theme-primary-hover:            #1e7d46;
    --theme-primary-muted:            rgba(26, 107, 60, .12);
    --theme-text-on-primary:          #ffffff;
    /* Signature ink — brand-primary by default so on-form signatures
       carry tenant identity. Tenant-theme overrides at runtime via
       Theme.razor; this root.css default keeps the pad drawable even
       when the tenant CSS hasn't loaded yet (new-tenant wizard path). */
    --theme-signature-stroke:         #1a6b3c;

    /* ── Accent (warm orange) ────────────────────────────────────────
       The house accent, deepened from #e26500 on 2026-10-01 (Kirk's decision 3) so its
       white label clears AA (4.52:1; white on #e26500 was 3.45:1). Lockstep with
       ThemeCss.DefaultAccent (Tests/HouseDefaultAccentTests). A tenant's own accent is
       never touched. The hover is the theme engine's own derivation (22% white). */

    --theme-accent:                   #c45500;
    --theme-accent-hover:             #d17a38;
    --theme-accent-muted:             rgba(196, 85, 0, .12);
    /* Foreground color to use ON TOP of --theme-accent (buttons, badges).
       Theme.razor overrides per-tenant based on accent luminance so light
       accents get black text and dark accents get white — always readable. */
    --theme-text-on-accent:           #ffffff;

    /* ── Offset (violet) ─────────────────────────────────────────── */

    --theme-offset:                   #5b21b6;
    --theme-offset-hover:             #6d28d9;
    /* Same pattern as --theme-text-on-accent — driven by --theme-offset's
       luminance so the .btn-info (which paints itself with --theme-offset)
       always has a readable label. */
    --theme-text-on-offset:           #ffffff;
    --theme-offset-muted:             rgba(91, 33, 182, .10);

    /* ── Semantic ─────────────────────────────────────────────────── */

    --theme-success:                  #16a34a;
    --theme-success-muted:            rgba(22, 163, 74, .12);
    /* Labels ON the solid success / danger fills (.btn-success, .btn-danger). They used to borrow
       --theme-text-on-primary, which is BLACK for a grey or pastel primary - black on red fails AA. */
    --theme-text-on-success:          #ffffff;
    --theme-text-on-danger:           #ffffff;
    /* ...and on the solid info fill (white on #2563eb is 5.2:1). Every on-colour belongs to ITS fill:
       Tests/OnPrimaryLabelsSitOnThePrimaryTests keeps --theme-text-on-primary on the primary. */
    --theme-text-on-info:             #ffffff;
    --theme-warning:                  #d97706;
    --theme-warning-muted:            rgba(217, 119, 6, .12);
    --theme-danger:                   #dc2626;
    --theme-danger-muted:             rgba(220, 38, 38, .12);
    --theme-info:                     #2563eb;
    --theme-info-muted:               rgba(37, 99, 235, .12);

    /* ── Text ─────────────────────────────────────────────────────── */

    --theme-text:                     #1e2a38;
    --theme-text-secondary:           #4a5668;
    /* WCAG AA (4.5:1) — was #7a8898 at 3.62:1 on white, which failed on every surface.
       Muted text is the platform's most common hint colour: .form-text and .text-muted
       both resolve here, ~330 usages across 23 stylesheets, so one token is the whole fix.
       #565f6a measures 6.48 / 5.87 / 5.46 / 4.97 against background / -subtle / -hover /
       -active, and is EXACTLY what Theme.razor's derivation now produces for the default
       text+background pair, so a themed tenant and an unthemed one finally match.
       Hierarchy still reads text < secondary < muted < placeholder. */
    --theme-text-muted:               #565f6a;
    --theme-text-emphasis:            #111827;
    --theme-text-placeholder:         #9aa5b3;

    /* ── Navigation ───────────────────────────────────────────────── */

    --theme-nav-background:           #1a6b3c;
    --theme-nav-border:               #155c33;
    /* The first paint's rail ink = what the theme engine writes for the house green (NavInk: AA at rest and on
       hover) - Tests/TheRailReadsAtAaTests holds them equal. */
    --theme-nav-text:                 rgba(255, 255, 255, .77);
    --theme-nav-text-hover:           rgba(255, 255, 255, 1);
    --theme-nav-text-active:          #ffffff;
    --theme-nav-hover-background:     rgba(255, 255, 255, .10);
    --theme-nav-dropdown-background:  #155c33;
    --theme-nav-dropdown-hover:       #1a6b3c;
    --theme-nav-divider:              rgba(255, 255, 255, .12);

    /* ── Shape & shadow ───────────────────────────────────────────── */

    --theme-shadow:                   0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .04);
    --theme-shadow-lg:                0 1px 2px rgba(0, 0, 0, .04), 0 6px 16px rgba(0, 0, 0, .06);
    --theme-radius:                   0.625rem;
    --theme-radius-button:            0.5rem;

    /* ── Focus ────────────────────────────────────────────────────── */

    --theme-focus-ring:               0 0 0 3px rgba(26, 107, 60, .18);

    /* ── Typography ───────────────────────────────────────────────── */

    --theme-font:                     'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --theme-font-mono:                'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    --theme-font-size-xs:             0.75rem;
    --theme-font-size-sm:             0.8125rem;
    --theme-font-size-base:           0.875rem;
    --theme-font-size-lg:             1rem;
    --theme-font-size-xl:             1.25rem;
    --theme-font-size-2xl:            1.5rem;
    --theme-font-size-3xl:            1.875rem;

    /* ── Spacing ──────────────────────────────────────────────────── */

    --theme-page-padding:             1.5rem 2rem;
    --theme-section-gap:              1.5rem;

    /* ── Transitions ──────────────────────────────────────────────── */

    --theme-transition:               150ms ease;

}

/* =================================================================
   THE --wf-* TOKENS (portal-look-and-feel.md section 3.2) - the shell
   and the shared components read ONLY these and --theme-* / --conv-*.
   -----------------------------------------------------------------
   Every value DERIVES from a tenant --theme-* token (color-mix / calc
   / max / min / light-dark), so a tenant theme - dark, grey, sharp or
   pill - re-skins all of it for free. No hex, no rgb(), no hsl(), no
   colour keyword except black / white / transparent as a color-mix()
   target (Tests/ShellTokensOnlyTests reads the region below).
   ================================================================= */
/* @tokens-only */
:root {
    /* Surfaces: the frame (brand), the sheet (where pages live), the card (what you touch). */
    --wf-frame: var(--theme-nav-background);
    --wf-sheet: var(--theme-background-subtle);
    --wf-card: var(--theme-background-raised);
    --wf-card-hover: color-mix(in srgb, var(--theme-background-raised), var(--theme-text) 4%);
    --wf-inset: color-mix(in srgb, var(--theme-background-subtle), black 4%);
    --wf-line: color-mix(in srgb, var(--theme-border) 85%, transparent);
    --wf-line-strong: var(--theme-border-subtle);

    /* INK - colour you READ. Mixing toward the emphasis text always raises contrast against the page
       (darker on light themes, lighter on dark), so a grey or pastel brand still reads. Raw --theme-*
       hues are for FILLS only. */
    --wf-primary-ink: color-mix(in oklab, var(--theme-primary) 62%, var(--theme-text-emphasis));
    --wf-accent-ink: color-mix(in oklab, var(--theme-accent) 56%, var(--theme-text-emphasis));
    --wf-success-ink: color-mix(in oklab, var(--theme-success) 66%, var(--theme-text-emphasis));
    --wf-warning-ink: color-mix(in oklab, var(--theme-warning) 60%, var(--theme-text-emphasis));
    --wf-danger-ink: color-mix(in oklab, var(--theme-danger) 70%, var(--theme-text-emphasis));

    /* SOFT - tinted fills for tiles, chips, selected rows, status pills. */
    --wf-primary-soft: color-mix(in srgb, var(--theme-primary) 13%, var(--wf-card));
    --wf-accent-soft: color-mix(in srgb, var(--theme-accent) 15%, var(--wf-card));
    --wf-success-soft: color-mix(in srgb, var(--theme-success) 13%, var(--wf-card));
    --wf-warning-soft: color-mix(in srgb, var(--theme-warning) 14%, var(--wf-card));
    --wf-danger-soft: color-mix(in srgb, var(--theme-danger) 12%, var(--wf-card));
    --wf-neutral-soft: color-mix(in srgb, var(--theme-text-muted) 12%, var(--wf-card));

    /* DATA - one hue per chart. --theme-data is OPTIONAL (no default here): a tenant points it at
       another colour through the Theme Editor's Readability card; otherwise charts draw in brand ink -
       the primary inked toward the text, so the mark clears 3:1 on a card in every preset (a grey
       primary and the dark house green included). Brightness carries emphasis: the window you picked
       is --wf-data, context is --wf-data-quiet. */
    --wf-data-base: var(--theme-data, var(--theme-primary));
    --wf-data: color-mix(in oklab, var(--wf-data-base) 72%, var(--theme-text));
    --wf-data-quiet: color-mix(in srgb, var(--wf-data) 27%, var(--wf-card));
    --wf-data-soft: color-mix(in srgb, var(--wf-data) 11%, transparent);
    --wf-data-grid: color-mix(in srgb, var(--theme-border) 80%, transparent);

    /* The ONE brand wash per page: three tenant hues at low strength, so a grey primary still gets a
       warm page (the home's hello band, empty-state art, the loading quote). */
    --wf-brand-wash:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--theme-primary) 15%, transparent), transparent 58%),
        radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--theme-accent) 13%, transparent), transparent 62%),
        radial-gradient(80% 110% at 55% 135%, color-mix(in srgb, var(--theme-offset) 10%, transparent), transparent 72%);

    /* SPACING - the 8px grid, derived from --theme-section-gap (1.5rem = 24px): one density knob
       (4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 px at the default). */
    --wf-space-1: calc(var(--theme-section-gap) / 6);
    --wf-space-2: calc(var(--theme-section-gap) / 3);
    --wf-space-3: calc(var(--theme-section-gap) / 2);
    --wf-space-4: calc(var(--theme-section-gap) * 2 / 3);
    --wf-space-5: var(--theme-section-gap);
    --wf-space-6: calc(var(--theme-section-gap) * 4 / 3);
    --wf-space-7: calc(var(--theme-section-gap) * 2);
    --wf-space-8: calc(var(--theme-section-gap) * 8 / 3);

    /* RADIUS - one scale from the tenant's two radii. Sharp (0) squares everything, pills included;
       the big steps are capped so a Pill tenant never balloons, and never drop below the tenant's own
       card radius. */
    --wf-radius-xs: calc(var(--theme-radius-button) / 2);
    --wf-radius-sm: var(--theme-radius-button);
    --wf-radius-md: var(--theme-radius);
    --wf-radius-lg: max(var(--theme-radius), min(calc(var(--theme-radius) * 1.6), 1.25rem));
    --wf-radius-xl: max(var(--theme-radius), min(calc(var(--theme-radius) * 2.2), 1.75rem));
    --wf-radius-pill: calc(var(--theme-radius-button) * 999);
    --wf-radius-tile: calc(var(--theme-radius) * .85);

    /* ELEVATION - a shadow ink strong enough to read on a dark theme, plus a 1px top highlight that
       exists only in dark (a shadow alone cannot lift a surface off a near-black page). */
    --wf-shadow-ink: light-dark(color-mix(in srgb, black 8%, transparent), color-mix(in srgb, black 55%, transparent));
    --wf-highlight: inset 0 1px 0 light-dark(transparent, color-mix(in srgb, var(--theme-text) 7%, transparent));
    --wf-elev-1: 0 1px 2px var(--wf-shadow-ink), var(--wf-highlight);
    --wf-elev-2: 0 2px 4px var(--wf-shadow-ink), 0 8px 24px var(--wf-shadow-ink), var(--wf-highlight);
    --wf-elev-3: 0 4px 10px var(--wf-shadow-ink), 0 20px 44px var(--wf-shadow-ink), var(--wf-highlight);
    /* Every backdrop: modals, the palette, the mobile drawer. */
    --wf-scrim: color-mix(in srgb, black 48%, transparent);

    /* TYPE - the tenant's font, set with intent. Sentence case everywhere. Inter's friendlier
       alternates ("cv05", "cv11") are OFF by default (Kirk's decision 5) - a tenant opt-in later. */
    --wf-font-features: normal;
    --wf-text-display: clamp(1.625rem, 1.1rem + 1.6cqi, 2.125rem);
    --wf-text-h1: 1.5rem;
    --wf-text-h2: 1.1875rem;
    --wf-text-h3: 0.9375rem;
    --wf-text-sm: 0.8125rem;
    --wf-text-xs: 0.75rem;
    --wf-figure: 2.5rem;
    --wf-figure-md: 1.75rem;
    --wf-figure-sm: 1.375rem;

    /* FRAMES - content max widths by page type (.wf-content-page + .wf-frame-narrow / -wide). */
    --wf-frame-narrow: 880px;
    --wf-frame-default: 1200px;
    --wf-frame-wide: 1440px;

    /* THE SHELL BAR - the 56px bar at the top of the sheet (nav-side.css), and where a PAGE's own sticky bar sits:
       0px here (no shell bar - the builder, a page with <ShellBarHidden />, a phone); the sheet raises it to the bar's
       height while the bar is on screen. Page stylesheets write top: var(--wf-sticky-top) (or a calc() on it), never
       top: 0, so their bars never slide under the shell bar (Tests/ShellLayoutTests). */
    --wf-shellbar-h: 56px;
    --wf-sticky-top: 0px;

    /* THE SHELL'S SHAPE - frame (default) or island, a per-tenant choice in the Theme Editor (Kirk's
       decision 1). Theme.razor emits the tenant's value; the shell reads AuthState.ShellShape and sets
       .wf-shell--frame / .wf-shell--island. */
    --wf-shell-shape: frame;

    /* MOTION */
    --wf-ease: cubic-bezier(.2, .7, .2, 1);
    --wf-motion: var(--theme-transition);
    --wf-motion-panel: 220ms var(--wf-ease);

    /* THE FOUR FAMILIES - promoted from .conv-builder to :root (bible section 11): Ask, Say, Act and
       Flow mean the same on every page. A --conv-* hue appears ONLY on something that IS a moment or a
       family. The values equal the builder's own block in conv-builder.css (which still overrides them
       inside the builder until that block is retired). */
    --conv-ask: var(--theme-primary);
    --conv-say: var(--theme-info);
    --conv-act: var(--theme-accent);
    --conv-flow: var(--theme-offset);
    --conv-end: var(--theme-text-muted);
    --conv-ask-soft: color-mix(in srgb, var(--conv-ask) 12%, var(--wf-card));
    --conv-say-soft: color-mix(in srgb, var(--conv-say) 12%, var(--wf-card));
    --conv-act-soft: color-mix(in srgb, var(--conv-act) 12%, var(--wf-card));
    --conv-flow-soft: color-mix(in srgb, var(--conv-flow) 12%, var(--wf-card));
    --conv-end-soft: color-mix(in srgb, var(--conv-end) 12%, var(--wf-card));
    --conv-ask-ink: color-mix(in oklab, var(--conv-ask) 62%, var(--theme-text-emphasis));
    --conv-say-ink: color-mix(in oklab, var(--conv-say) 66%, var(--theme-text-emphasis));
    --conv-act-ink: color-mix(in oklab, var(--conv-act) 56%, var(--theme-text-emphasis));
    --conv-flow-ink: color-mix(in oklab, var(--conv-flow) 62%, var(--theme-text-emphasis));
}
/* @end-tokens-only */

/* =================================================================
   Base element styles
   ================================================================= */

html {
    height: 100%;
    overflow: hidden;
}

body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--theme-background);
    color: var(--theme-text);
    font-family: var(--theme-font);
    font-size: var(--theme-font-size-base);
    font-feature-settings: var(--wf-font-features);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* (color-scheme moved to :root above - here it overrode the tenant's dark scheme for every
       element inside the page.) */
}

#app {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ⚠️ DO NOT re-add `#app > div:first-child { display: contents }`.
   It was here to let the height chain flow through to wf-main, and it did
   that by dissolving whatever div Blazor renders first under #app — which
   is NOT always the layout shell. `.wf-shell` already owns its own
   `display: flex !important` (see nav-side.css, which had to defend itself
   against this exact rule), so the rule only ever reached the render paths
   that must stay real boxes: App.razor's unauthenticated branches
   (`.login-wrapper` on Login + AcceptInvite) and the session-restore
   spinner. On the login page it silently deleted the wrapper's padding,
   min-height AND `overflow-y: auto` — so the card went full-bleed and the
   page could not be scrolled at all on a phone: the Continue button and
   the workspace list sat below the fold with body{overflow:hidden}
   clipping them, unreachable. Any page rendered directly under #app is
   responsible for its own flex chain (`flex: 1; min-height: 0`). */

h1, h2, h3, h4, h5, h6 {
    color: var(--theme-text-emphasis);
    font-weight: 600;
}

/* Links read in PRIMARY INK (the primary mixed toward the emphasis text), not the raw primary: a grey
   or pastel brand (HelloFresh's #969491 measures 3.0:1 on white) still gives readable links. */
a {
    color: var(--wf-primary-ink);
    transition: color var(--theme-transition);
}
/* Generic link-hover color is intentionally scoped AWAY from .btn — when
   an <a> wears a .btn class (e.g. the Data Studio "Upload a file" CTA,
   the Integrations "Open the wizard" links, the Crossover "Save as
   recurring sync" success-screen anchor), the button's own text-color
   rule is what should govern. The bare `a:hover` rule was making
   .btn-primary text invisible on hover across the Integrations area
   (Kirk's bug report 2026-04-28). Excluding .btn keeps real text-link
   hover semantics intact while letting buttons own their typography.

   AND IT NEVER REACHES THE SHELL'S CHROME (Kirk, 2026-10-03: "all left nav roll overs don't work. All tenants ...
   it is currently dimmed"). At specificity 0,2,1 this rule outranked the rail's own .wf-sidebar-link:hover (0,2,0)
   and the top bar's .wf-nav-link:hover, so every hovered nav item was repainted in the PRIMARY ink - dark on a dark
   rail (1.01:1 on Acme's navy, 1.20:1 on Sal's red, 2.24:1 on the house green). The rail, the top bar and the
   phone bar own their hover colours (nav-side.css / nav.css); the exclusion sits inside :where(), so its
   specificity is zero and every PAGE link hovers exactly as before. Tests/TheRailHoverReadsStrongTests. */
a:not(.btn):where(:not(.wf-sidebar *, .wf-navbar *, .wf-sidebar-mobilebar *)):hover { color: color-mix(in oklab, var(--wf-primary-ink) 78%, var(--theme-text-emphasis)); }

/* Keyboard focus: a 2px primary-ink outline that clears 3:1 on every preset. Components with their
   own focus treatment (form controls, the builder canvas) keep it - they are more specific. */
:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 2px; }

/* -- Scrollbar --------------------------------------------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--theme-background); }
::-webkit-scrollbar-thumb { background: var(--theme-border-subtle); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--theme-text-muted); }

/* =================================================================
   Utility classes
   ================================================================= */
.text-accent        { color: var(--wf-accent-ink)         !important; }
.text-offset        { color: color-mix(in oklab, var(--theme-offset) 62%, var(--theme-text-emphasis)) !important; }
.text-primary-wf    { color: var(--wf-primary-ink)        !important; }
.text-secondary-wf  { color: var(--theme-text-secondary)  !important; }
.bg-surface         { background-color: var(--theme-background-subtle)  !important; }
.bg-raised          { background-color: var(--theme-background-raised)  !important; }
.border-wf          { border-color: var(--theme-border)   !important; }

/* =================================================================
   Reusable Component Styles
   ================================================================= */

/* -- Widget / dashboard card -------------------------------------
   A card on the sheet: --wf-card, a hairline, the tenant radius, elevation 1 at rest and
   elevation 2 on hover. The title is sentence case (no UPPERCASE labels anywhere). */
.wf-widget {
    background-color: var(--wf-card);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    box-shadow: var(--wf-elev-1);
    padding: 1.25rem;
    transition: border-color var(--theme-transition), box-shadow var(--theme-transition);
}
.wf-widget:hover {
    border-color: var(--wf-line-strong);
    box-shadow: var(--wf-elev-2);
}
.wf-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.wf-widget-title {
    font-size: var(--wf-text-h3);
    font-weight: 650;
    color: var(--theme-text-emphasis);
}
.wf-widget-value {
    font-size: var(--wf-figure-md);
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--theme-text-emphasis);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* -- Page header (portal-look-and-feel 3.7) ----------------------
   No ruled line under it - space (or the tabs' own baseline) separates it from the content.
   The class names stay, so every existing hand-rolled header improves without markup churn;
   Components/Common/PageHeader renders the full shape (icon tile, one-sentence subtitle,
   actions on the right, tabs under a hairline). */
.wf-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 16px;
    margin-bottom: var(--wf-space-6);
}
.wf-page-title {
    margin: 0;
    color: var(--theme-text-emphasis);
    font-size: var(--wf-text-h1);
    font-weight: 650;
    letter-spacing: -0.018em;
    line-height: 1.25;
}
.wf-page-subtitle {
    max-width: 68ch;
    margin: 0.25rem 0 0;
    color: var(--theme-text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}
/* The component's shape: a stack of the crumbs, the main row and the tabs. */
.wf-page-header.is-stacked { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 12px; }
.wf-page-header.is-stacked.has-tabs { margin-bottom: var(--wf-space-5); }
.wf-page-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--theme-text-muted); font-size: 13px; font-weight: 500; }
.wf-page-crumbs a { color: var(--theme-text-muted); text-decoration: none; }
.wf-page-crumbs a:hover { color: var(--wf-primary-ink); }
.wf-page-header-main { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 16px; }
.wf-page-header-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: var(--wf-radius-tile);
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
    font-size: 20px;
}
.wf-page-header-text { flex: 1 1 20rem; min-width: 0; }
.wf-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.wf-page-tabs { border-bottom: 1px solid var(--wf-line); }
.wf-page-tabs .wf-tabs { border-bottom: 0; }

/* -- Stub page placeholder --------------------------------------- */
.wf-stub {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
}
.wf-stub-icon {
    font-size: 3.5rem;
    color: var(--theme-text-muted);
    margin-bottom: 1rem;
}
.wf-stub-title {
    font-size: var(--theme-font-size-xl);
    font-weight: 600;
    color: var(--theme-text-secondary);
}
.wf-stub-text {
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text-muted);
    max-width: 28rem;
    margin-top: 0.5rem;
}

/* =================================================================
   Responsive — Page padding
   ================================================================= */

@media (max-width: 991.98px) {
    :root { --theme-page-padding: 1.25rem 1.25rem; }
}

@media (max-width: 767.98px) {
    :root { --theme-page-padding: 1rem; }
    .wf-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    /* On a phone the icon tile hides and the actions wrap under the subtitle. */
    .wf-page-header.is-stacked { align-items: stretch; }
    .wf-page-header-icon { display: none; }
    .wf-page-actions { flex-basis: 100%; margin-left: 0; }
}

/* ── Loading Spinner + Joke Quote ─────────────────────────────── */

.wf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    gap: 2rem;
}

.wf-loading-quote {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 36rem;
    padding: 1rem 1.5rem;
    border-radius: var(--wf-radius-lg);
    /* The brand wash (three tenant hues at low strength) over the card - it used to be a light
       hsla() gradient keyed off a --theme-primary-hue nobody set, which glowed pale on dark tenants. */
    background: var(--wf-brand-wash), var(--wf-card);
    border: 1px solid var(--wf-line);
    font-style: italic;
    font-size: 0.85rem;
    color: var(--theme-text);
    line-height: 1.5;
}

.wf-loading-quote-icon {
    flex-shrink: 0;
    font-size: 1.3rem;
    color: var(--wf-primary-ink);
    font-style: normal;
}

.wf-loading-quote-text {
    flex: 1;
}

.wf-loading-spinner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
}

.wf-loading-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    animation: wf-spin 1.2s linear infinite;
}

.wf-loading-ring circle {
    stroke: var(--theme-primary);
    stroke-dasharray: 80, 200;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    opacity: 0.35;
}

.wf-loading-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--theme-text-muted);
    letter-spacing: 0.02em;
}

@keyframes wf-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
