/* =================================================================
   WF Portal — Page-specific styles (Global)
   -----------------------------------------------------------------
   Consolidated from scoped .razor.css files into global CSS to
   avoid Blazor CSS-isolation issues with child components.
   ================================================================= */

/* =================================================================
   Layout — Main & Footer
   ================================================================= */

/* THE PAGE AREA (portal-look-and-feel.md 3.6 / 3.8). main.wf-main - THE SHEET, owned by nav-side.css - is the
   viewport boundary and the one scroll container. Its first child is the sticky shell bar; its second is THIS:
   MainLayout's @key wrapper, which owns the page padding, carries flex: 1; min-height: 0 so an APP page fills the
   sheet exactly, and is the size container every @container query reads.

   ⚠ Never target ".wf-main > div" or ".wf-main > div:first-child": the shell bar is a child of .wf-main too and
   would inherit the wrapper's flex: 1 (every app page breaks). Name .wf-page-area. Tests/ShellLayoutTests holds it. */
.wf-page-area {
    container: page / inline-size;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
    /* The Theme Editor's Page Padding (--theme-page-padding, default 1.5rem 2rem - root.css narrows it on smaller
       screens): the tenant's sides and bottom; the top is the shell bar's (4px under it). */
    padding: var(--theme-page-padding);
    padding-top: 4px;
}

/* AN INNER SCROLL BOX on a page (a list with its own max-height + overflow): a sticky inside it sticks to the BOX's
   top, not under the shell bar, so the box resets --wf-sticky-top (nav-side.css raises it on the sheet). */
.wf-own-scroll { --wf-sticky-top: 0px; }

/* A CONTENT page grows with its content (the sheet scrolls it), so the bottom padding stays under its last card. */
.wf-page-area:has(> .wf-content-page) {
    flex: 1 0 auto;
}

/* A phone has no shell bar (nav-side.css) - the page area takes its whole padding from the token again. */
@media (max-width: 767.98px) {
    .wf-page-area { padding: var(--theme-page-padding); }
}

/* ── Stat Cards ─────────────────────────────────────────────────────
   A figure on the card fill; the label is sentence case (no UPPERCASE). */

.wf-stat-card {
    flex: 1;
    min-width: 6rem;
    text-align: center;
    padding: 0.75rem 0.75rem;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-card);
    box-shadow: var(--wf-elev-1);
}
.wf-stat-value {
    color: var(--theme-text-emphasis);
    font-size: var(--wf-figure-sm);
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.wf-stat-label { color: var(--theme-text-muted); font-size: 0.78125rem; font-weight: 500; }

/* ── Tabs (portal-look-and-feel 3.7) ──────────────────────────────────
   One tab bar for every page: 40px tabs, 13.5/600, the selected one in
   emphasis text with a 2px primary-ink underline and a neutral count
   pill, a hairline under the row. Both markups are served: a <ul> of
   <li class="active"> (the old .wf-tabs li form) and .wf-tab buttons. */

.wf-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0 4px;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid var(--wf-line);
}
.wf-tabs li,
.wf-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 40px;
    margin-bottom: -1px;
    padding: 0 0.75rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    /* An unselected tab reads in SECONDARY ink: the tab row sits on the sheet, where muted measured 4.23:1 (#64748b on
       #eef2f6, 2026-10-03). The selected one is emphasis + the underline, so the two still read apart. */
    color: var(--theme-text-secondary);
    font-family: inherit;
    font-size: 0.84375rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 120ms, border-color 120ms;
}
.wf-tabs li:hover,
.wf-tab:hover { color: var(--theme-text-emphasis); }
.wf-tabs li.active,
.wf-tab.active,
.wf-tab[aria-selected="true"] {
    color: var(--theme-text-emphasis);
    border-bottom-color: var(--wf-primary-ink);
}
.wf-tab:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: -2px; border-radius: var(--wf-radius-xs); }

/* =================================================================
   Dashboard
   ================================================================= */

.wf-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.wf-widget-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
    color: var(--wf-primary-ink);
    text-decoration: none;
}
.wf-widget-link:hover {
    color: color-mix(in oklab, var(--wf-primary-ink) 78%, var(--theme-text-emphasis));
}

/* -- Quick access cards ------------------------------------------
   A card that is wholly a link: the card fill, elevation 1, and on hover elevation 2 and a
   1px lift (the shadow used to be a hard-coded black at 35%, a smear on a dark tenant). */
.wf-quick-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    background-color: var(--wf-card);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    box-shadow: var(--wf-elev-1);
    text-decoration: none;
    color: var(--theme-text);
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}
.wf-quick-card:hover {
    border-color: var(--wf-line-strong);
    box-shadow: var(--wf-elev-2);
    transform: translateY(-1px);
    color: var(--theme-text);
    text-decoration: none;
}
.wf-quick-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--wf-radius-tile);
    font-size: 1.25rem;
    flex-shrink: 0;
}
.wf-quick-title {
    font-weight: 600;
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text-emphasis);
}
.wf-quick-desc {
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-secondary);
    margin-top: 0.125rem;
}

/* -- News feed --------------------------------------------------- */
.wf-news-feed {
    display: flex;
    flex-direction: column;
}
.wf-news-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--theme-border);
}
.wf-news-item:last-child {
    border-bottom: none;
}
.wf-news-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.4rem;
}
.wf-news-headline {
    font-size: var(--theme-font-size-sm);
    font-weight: 500;
    color: var(--theme-text-emphasis);
}
.wf-news-date {
    font-size: var(--theme-font-size-xs);
    color: var(--theme-text-muted);
    margin-top: 0.125rem;
}

/* =================================================================
   Entity Builder — Palette + Canvas
   ================================================================= */

.wf-palette {
    background-color: var(--theme-background-subtle);
    border-right: 1px solid var(--theme-border);
    width: 220px;
    min-width: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.wf-palette-header {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--theme-border);
}

.wf-palette-section {
    padding: 0.75rem 0.75rem 0.25rem;
    font-size: var(--theme-font-size-xs);
    font-weight: 600;
    color: var(--theme-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wf-palette-item {
    padding: 0.35rem 0.75rem;
    font-size: var(--theme-font-size-sm);
    color: var(--theme-text);
    cursor: grab;
    user-select: none;
    border-radius: var(--theme-radius-button);
    transition: background-color 120ms ease;
}
.wf-palette-item:hover {
    background-color: var(--theme-background-hover);
    color: var(--theme-text-emphasis);
}

.wf-palette-group-header {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    font-size: var(--theme-font-size-sm);
    font-weight: 600;
    color: var(--theme-text-muted);
    cursor: pointer;
    user-select: none;
    border-radius: var(--theme-radius-button);
    transition: background-color 120ms ease;
}
.wf-palette-group-header:hover {
    background-color: var(--theme-background-hover);
    color: var(--theme-text-emphasis);
}
.wf-palette-group-header.expanded {
    color: var(--theme-text);
}

/* Group drop-target highlight */
.wf-palette-group.drop-active {
    outline: 2px dashed var(--theme-primary);
    outline-offset: -2px;
    background-color: var(--theme-primary-muted);
    border-radius: var(--theme-radius-button);
}

/* Remove button on group property items (visible on hover) */
.wf-remove-btn {
    opacity: 0;
    transition: opacity 120ms ease;
    line-height: 1;
    color: var(--theme-text-muted);
}
.wf-palette-item:hover .wf-remove-btn {
    opacity: 0.6;
}
.wf-remove-btn:hover {
    opacity: 1 !important;
    color: var(--theme-danger) !important;
}

.wf-drop-zone {
    border: 2px dashed var(--theme-border-subtle);
    border-radius: var(--theme-radius-button);
    padding: 0.5rem;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-text-muted);
    font-size: var(--theme-font-size-sm);
    transition: all 150ms ease;
}
.wf-drop-zone.active {
    border-color: var(--theme-primary);
    background-color: var(--theme-primary-muted);
    color: var(--theme-primary);
}

/* =================================================================
   Responsive — Tablet
   ================================================================= */

@media (max-width: 991.98px) {
    .wf-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =================================================================
   Responsive — Mobile
   ================================================================= */

@media (max-width: 767.98px) {
    .wf-dashboard-grid {
        grid-template-columns: 1fr;
    }
    .wf-quick-card {
        padding: 0.75rem;
    }
    .wf-palette {
        width: 100%;
        min-width: unset;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--theme-border);
    }
    /* Stack entity builder vertically on mobile */
    .wf-builder-layout {
        flex-direction: column !important;
        height: auto !important;
    }
}

/* =================================================================
   Content Page — scrollable wrapper for non-app pages
   Forces the page content to size to its natural height so wf-main
   scrolls it, rather than clamping to viewport like app pages.
   ================================================================= */

.wf-content-page {
    flex: 0 0 auto;
    /* THE CONTENT FRAME (portal-look-and-feel 3.8): content no longer runs edge to edge on a big
       monitor. Default 1200px, centred; .wf-frame-narrow (880px: settings, forms, profile) and
       .wf-frame-wide (1440px: the home, the Answer Center, data grids). App pages stay full bleed. */
    width: 100%;
    max-width: var(--wf-frame-default);
    margin-inline: auto;
}
.wf-content-page.wf-frame-narrow { max-width: var(--wf-frame-narrow); }
.wf-content-page.wf-frame-wide { max-width: var(--wf-frame-wide); }
.wf-content-page.wf-frame-full { max-width: none; }

/* =================================================================
   "Run opened in its own window" card — the settled state a launch
   host page (WorkflowLaunchPage / LaunchByCode) shows after the run
   pops out, instead of an abandoned spinner behind a dead dialog.
   ================================================================= */

.wf-popped {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    max-width: 480px;
    margin: 3.5rem auto 0;
    padding: 2.25rem 2rem;
    text-align: center;
    background: var(--theme-background);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    box-shadow: 0 12px 36px color-mix(in srgb, var(--theme-text) 10%, transparent);
}

.wf-popped-icon {
    font-size: 2.75rem;
    color: var(--theme-primary);
}

.wf-popped-title {
    margin: 0.25rem 0 0;
}

.wf-popped-hint {
    margin: 0;
    color: var(--theme-text-muted);
}

.wf-popped-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* =================================================================
   Sticky Save Bar — Theme Editor
   ================================================================= */

/* THE SAVE BAR is a FLOATING PILL centred at the bottom of the sheet (portal-look-and-feel 3.11):
   "You have unsaved changes · Reset · Save", elevation 3, shown only when something changed. It
   replaces the full-width slab with its hard-coded rgba(0,0,0,.15) shadow. */
.wf-sticky-bar {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: max-content;
    max-width: calc(100vw - 2rem);
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    background-color: var(--theme-background-float);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-pill);
    box-shadow: var(--wf-elev-3);
    color: var(--theme-text-emphasis);
    font-size: 0.84375rem;
    transform: translateX(-50%);
    animation: wf-sticky-bar-in var(--wf-motion-panel) both;
}
.wf-sticky-bar > .ms-auto { margin-inline-start: 0.75rem !important; }
@keyframes wf-sticky-bar-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .wf-sticky-bar { animation: none; }
}

/* =================================================================
   Admin Tabs — used on All Users, Tenant Users, etc. The bar itself is
   the one tab style above (.wf-tabs / .wf-tab); the count is a neutral
   pill (it read --theme-card-bg, a token that never existed, so it was
   transparent, and the active one was a solid primary slab).
   ================================================================= */
.wf-tab .wf-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 7px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--wf-radius-pill);
    background: var(--wf-neutral-soft);
    color: var(--theme-text-secondary);
    font-variant-numeric: tabular-nums;
}

.wf-tab.active .wf-tab-count {
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
}

/* =================================================================
   Admin Tree View — collapsible tenant → user hierarchy
   ================================================================= */
.wf-tree-node {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius, 6px);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.wf-tree-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--theme-card-bg);
    cursor: pointer;
    user-select: none;
    transition: background 120ms;
}

.wf-tree-header:hover {
    background: var(--theme-hover);
}

.wf-tree-chevron {
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    transition: transform 120ms;
    flex-shrink: 0;
}

.wf-tree-chevron.expanded {
    transform: rotate(90deg);
}

.wf-tree-title {
    font-weight: 600;
    font-size: 0.875rem;
    flex: 1;
    min-width: 0;
}

.wf-tree-badge {
    font-size: 0.7rem;
}

.wf-tree-body {
    border-top: 1px solid var(--theme-border);
}

.wf-tree-body .table {
    margin-bottom: 0;
}

.wf-tree-body .table th {
    font-size: 0.75rem;
}

.wf-tree-body .table td {
    font-size: 0.8125rem;
}

/* ── Advanced Theme Editor ─────────────────────────────────── */

.cursor-pointer { cursor: pointer; }

/* ── The kept-turn card (mtc-*), the replay head and the Overview's cleanup card moved to message-center.css
   (the Message Center in the new frame, portal-look-and-feel 3.18). ── */

/* JSON explorer (JsonBlock + recursive JsonTree) */
.jt-block {
    background: rgba(0,0,0,.04);
    border-radius: 6px;
    padding: .25rem .5rem;
    margin-bottom: .5rem;
}

.jt-bar { display: flex; justify-content: flex-end; align-items: center; gap: .4rem; }

.jt-root {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .72rem;
    max-height: 42vh;
    overflow: auto;
}

.jt-toggle { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: .25rem; }
.jt-toggle > .bi { font-size: .6rem; opacity: .6; }

.jt-children {
    margin-left: 1rem;
    border-left: 1px dashed var(--theme-border, rgba(0,0,0,.15));
    padding-left: .5rem;
}

.jt-leaf { line-height: 1.5; }
.jt-key { font-weight: 600; }
.jt-punc { opacity: .8; }
.jt-str { color: color-mix(in oklch, var(--theme-success, #198754) 55%, var(--theme-text, #212529)); }
.jt-num { color: color-mix(in oklch, var(--theme-primary, #0d6efd) 60%, var(--theme-text, #212529)); }
.jt-bool { color: color-mix(in oklch, var(--theme-accent, #6f42c1) 75%, var(--theme-text, #212529)); }
.jt-null { opacity: .8; font-style: italic; }

/* ── The springboard / intro language (.mci-*) ─────────────────────
   The hero carries the page's ONE brand wash; the cards are real cards
   on the sheet (card fill, hairline, elevation 1, and elevation 2 with
   a 1px lift on hover); the art paints from the primary in INK so a
   grey brand still draws a readable picture. */

.mci-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    border-radius: var(--wf-radius-xl);
    background: var(--wf-brand-wash), var(--wf-card);
    border: 1px solid var(--wf-line);
    box-shadow: var(--wf-elev-1);
}

.mci-hero-art { flex: 0 0 auto; color: var(--wf-primary-ink); }
.mci-hero-art svg { width: 120px; height: 96px; }
.mci-hero-title { margin: 0 0 .25rem; color: var(--theme-text-emphasis); font-weight: 650; letter-spacing: -0.012em; }
.mci-hero-sub { max-width: 68ch; margin: 0; color: var(--theme-text-secondary); }

.mci-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1rem;
}

.mci-card {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: .4rem;
    padding: 1.125rem;
    border-radius: var(--wf-radius-md);
    border: 1px solid var(--wf-line);
    background: var(--wf-card);
    box-shadow: var(--wf-elev-1);
    color: inherit;
    cursor: pointer;
    transition: transform var(--wf-motion-panel), box-shadow var(--wf-motion-panel), border-color .12s ease;
}

.mci-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--wf-elev-2);
    border-color: color-mix(in srgb, var(--wf-primary-ink) 40%, var(--wf-line));
}
.mci-card:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 2px; }

.mci-art { color: var(--wf-primary-ink); margin-bottom: .25rem; }
.mci-art svg { width: 96px; height: 64px; }
.mci-title { color: var(--theme-text-emphasis); font-weight: 650; }
.mci-desc { flex: 1 1 auto; color: var(--theme-text-secondary); font-size: .8125rem; }
.mci-open { color: var(--wf-primary-ink); font-size: .8125rem; font-weight: 600; }

/* Theme-aware SVG paint classes for the intro illustrations */
.mci-fill-soft { fill: color-mix(in oklch, var(--theme-primary) 18%, transparent); }
.mci-fill-accent { fill: color-mix(in oklch, var(--wf-primary-ink) 65%, transparent); }
.mci-stroke { stroke: var(--wf-primary-ink); }
.mci-stroke-faint { stroke: color-mix(in oklch, var(--wf-primary-ink) 40%, transparent); }
.mci-stroke-light { stroke: var(--wf-card); }

/* Springboard section heading -- groups a grid under a titled band (Define / Operate). */
.mci-section {
    margin: 2rem 0 .75rem;
}
.mci-section:first-of-type { margin-top: .5rem; }
.mci-section-title {
    margin: 0;
    color: var(--theme-text-emphasis);
    font-size: var(--wf-text-h2);
    font-weight: 650;
    letter-spacing: -0.012em;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.mci-section-title i { color: var(--wf-primary-ink); }
.mci-section-sub {
    margin: .15rem 0 0;
    color: var(--theme-text-secondary);
    font-size: .8125rem;
}

/* Compact icon-card variant -- the "sub-tools" tier: a big themed icon instead of a
   bespoke illustration, in a tighter grid. Reads as a lower rank than the illustrated
   .mci-card "kings". */
.mci-grid-sm {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: .75rem;
}
.mci-card-sm {
    flex-direction: row;
    align-items: center;
    gap: .65rem;
    padding: .75rem .85rem;
}
.mci-art-icon {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--wf-radius-tile);
    background: var(--wf-primary-soft);
    color: var(--wf-primary-ink);
    font-size: 1.2rem;
}
.mci-card-sm .mci-title { font-size: .9rem; }

/* -- Admin Dashboard control-center extras (.adm-*) --
   Warm greeting chip, the "start here" ladder, and the at-a-glance
   stats strip. All paint from --theme-* tokens via color-mix so they
   track the tenant theme and read correctly in dark mode (no hardcoded
   light colors). Built on top of the shared .mci-* springboard. */

/* Tenant chip inside the hero subtitle. */
.adm-tenant-chip {
    display: inline-flex;
    align-items: center;
    padding: .1rem .55rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--theme-primary, #0d6efd);
    background: color-mix(in oklch, var(--theme-primary, #0d6efd) 12%, transparent);
    border: 1px solid color-mix(in oklch, var(--theme-primary, #0d6efd) 24%, transparent);
}

/* "New here? Start with these" -- the platform spine ladder. */
.adm-starthere {
    margin: 1rem 0 .25rem;
    padding: 1rem 1.25rem;
    border-radius: var(--theme-radius, 8px);
    background: color-mix(in oklch, var(--theme-accent, #6f42c1) 7%, var(--theme-surface, #fff));
    border: 1px solid var(--theme-border, rgba(0,0,0,.1));
}
.adm-starthere-head {
    font-weight: 700;
    display: flex;
    align-items: center;
}
.adm-starthere-head i { color: var(--theme-accent, #6f42c1); }
.adm-starthere-sub {
    margin: .15rem 0 .75rem;
    font-size: .82rem;
    color: var(--theme-text, #495057);
    opacity: .8;
}
.adm-ladder {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: .65rem;
}
.adm-ladder-step {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}
.adm-ladder-num {
    flex: 0 0 auto;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    color: var(--theme-surface, #fff);
    background: var(--theme-accent, #6f42c1);
}
.adm-ladder-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.adm-ladder-title {
    font-weight: 600;
    font-size: .9rem;
    color: var(--theme-text, #212529);
}
.adm-ladder-link:hover .adm-ladder-title { color: var(--theme-primary, #0d6efd); }
.adm-ladder-desc {
    font-size: .78rem;
    color: var(--theme-text, #495057);
    opacity: .8;
}

/* At-a-glance stats strip -- small clickable count tiles. */
.adm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: .75rem;
    margin: 1rem 0 .25rem;
}
.adm-stat {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem .85rem;
    border-radius: var(--theme-radius, 8px);
    border: 1px solid var(--theme-border, rgba(0,0,0,.1));
    background: var(--theme-surface, #fff);
    color: inherit;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.adm-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    border-color: var(--theme-primary, #0d6efd);
}
.adm-stat-icon {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--theme-radius, 8px);
    background: color-mix(in oklch, var(--theme-primary, #0d6efd) 14%, transparent);
    color: var(--theme-primary, #0d6efd);
    font-size: 1.2rem;
}
.adm-stat-body { display: flex; flex-direction: column; line-height: 1.15; }
.adm-stat-num {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--theme-text, #212529);
}
.adm-stat-label {
    font-size: .78rem;
    color: var(--theme-text, #495057);
    opacity: .8;
}

/* Remember-where-you-were status chip (AreaResetButton with StatusLabel) */
.area-remember-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .78rem;
    line-height: 1.2;
    color: var(--theme-text, #495057);
    background: color-mix(in oklch, var(--theme-primary, #0d6efd) 8%, transparent);
    border: 1px solid color-mix(in oklch, var(--theme-primary, #0d6efd) 22%, transparent);
    transition: background .12s ease, border-color .12s ease;
}

.area-remember-chip:hover {
    background: color-mix(in oklch, var(--theme-primary, #0d6efd) 14%, transparent);
    border-color: var(--theme-primary, #0d6efd);
}

.area-remember-pin {
    color: var(--theme-primary, #0d6efd);
    font-size: .72rem;
}

.area-remember-text {
    white-space: nowrap;
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.area-remember-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0 0 0 .1rem;
    color: var(--theme-text-muted, #6c757d);
    font-size: .7rem;
    line-height: 1;
    opacity: .65;
    transition: opacity .12s ease, color .12s ease;
}

.area-remember-clear:hover {
    opacity: 1;
    color: var(--theme-danger, #dc3545);
}

/* Data Studio intro -- non-link container cards + recent chips + coming-soon box */
.dsi-static-card { cursor: default; }

.dsi-static-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--theme-border, rgba(0, 0, 0, .1));
}

.dsi-recent { margin-top: .5rem; }

.dsi-recent-label {
    font-size: .72rem;
    font-weight: 600;
    color: var(--theme-text-muted, #6c757d);
    margin-bottom: .3rem;
}

.dsi-recent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.dsi-recent-chip {
    border: 1px solid color-mix(in oklch, var(--theme-primary, #0d6efd) 25%, transparent);
    background: color-mix(in oklch, var(--theme-primary, #0d6efd) 8%, transparent);
    color: var(--theme-text, #495057);
    border-radius: 999px;
    padding: .12rem .55rem;
    font-size: .76rem;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, transform .12s ease;
}

.dsi-recent-chip:hover {
    background: color-mix(in oklch, var(--theme-primary, #0d6efd) 18%, transparent);
    border-color: var(--theme-primary, #0d6efd);
    transform: translateY(-1px);
}

.dsi-soon { opacity: .72; }

.dsi-soon-tag {
    align-self: flex-start;
    margin-top: .25rem;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--theme-text-muted, #6c757d);
    background: color-mix(in oklch, var(--theme-text, #495057) 8%, transparent);
    border-radius: 4px;
    padding: .1rem .4rem;
}


/* =================================================================
   Page-header action menu — the platform's dropdown for a PAGE
   (as opposed to wf-dropdown, which is the NAV's).
   -----------------------------------------------------------------
   There is no Bootstrap CSS and no bootstrap.bundle.js in this app:
   .dropdown / .dropdown-menu / .dropdown-item do not exist and
   data-bs-toggle is an inert attribute. A menu is a C# bool that
   renders the list, plus a fixed-inset backdrop that catches the
   outside click without a document-level JS listener.

   Deliberately NOT built on wf-dropdown: that set paints
   --theme-nav-dropdown-background / --theme-nav-text-hover, which
   Theme.razor derives from the tenant's NAV colour — a dark panel
   with white text, correct on the nav bar and wrong on a page. These
   rules use the general surface tokens instead, so the menu tracks
   the PAGE in every tenant theme. Worked precedent: .copilot-menu
   in copilot.css.

   z-index budget: backdrop 1030 < toggle 1031 < list 1032, all
   BELOW .modal-backdrop (1050, wf.css) so a confirm dialog always
   wins, and below .wf-dropdown-menu (1040, nav.css) so the nav wins.
   ================================================================= */

.wf-action-menu {
    position: relative;
    display: inline-flex;
}

/* Above the backdrop WHILE OPEN, so clicking the toggle while the menu is open runs
   the toggle's own handler (closing it) rather than being swallowed by the
   click-catcher. Closed, it carries no z-index - a standing 1031 painted it over
   the shell bar, the rail's New menu and the bell (the shell lane's verifier). */
.wf-action-menu > .wf-action-menu-toggle {
    position: relative;
}

.wf-action-menu > .wf-action-menu-toggle.open {
    z-index: 1031;
}

/* Invisible click-catcher. Behind the list, above the rest of the page. */
.wf-action-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1030;
}

/* A MENU INSIDE A CARD (Kirk, 2026-10-04: the conversations list's ⋯ menu went behind the cards). A card that lifts
   on hover or focus (a transform), animates in, or carries a z-index is a STACKING CONTEXT, so the menu's 1030-1032
   above count only INSIDE it: every card painted after it covers the open menu - and a transform also makes the card
   the containing block of the fixed click-catcher, which shrinks to the card. So the element that holds a menu in a
   grid or a list of its own kind carries .wf-action-menu-host: while its menu is open (the list exists only then) it
   rises to the click-catcher's own level - above its neighbours and the page, still below the nav menus (1040) and
   every dialog (1050). The host is positioned (or a flex / grid item), and a host that lifts on hover holds still
   while its menu is open (its own stylesheet says so - Tests/MenuHostsRiseAboveTheirNeighboursTests). */
.wf-action-menu-host:has(.wf-action-menu-list) {
    z-index: 1030;
}

.wf-action-menu-chevron {
    font-size: 0.55rem;
    opacity: 0.5;
    transition: transform 200ms ease, opacity 150ms ease;
}

.wf-action-menu-toggle.open .wf-action-menu-chevron {
    transform: rotate(180deg);
    opacity: 0.85;
}

.wf-action-menu-list {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 1032;
    min-width: 13rem;
    max-width: 20rem;
    /* An operator can be on many tenants; scroll inside rather than running the
       menu off the bottom of the viewport. */
    max-height: min(60vh, 22rem);
    overflow-y: auto;
    /* Kills the UA <ul> bullets + indent. Their absence is what made the
       original Bootstrap markup render as a bulleted list. */
    margin: 0;
    padding: 6px;
    list-style: none;
    /* A menu floats: the float surface, radius lg, elevation 3, a 120ms fade + 4px rise
       (portal-look-and-feel 3.13). */
    background: var(--theme-background-float);
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-lg);
    box-shadow: var(--wf-elev-3);
    animation: wf-action-menu-in 120ms var(--wf-ease) both;
}

/* Right-align under a header button that sits at the right edge of the page. */
.wf-action-menu-list.wf-action-menu-end {
    left: auto;
    right: 0;
}

@keyframes wf-action-menu-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* The header names the subject, in sentence case. */
.wf-action-menu-header {
    margin-bottom: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--wf-line);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wf-action-menu-divider {
    height: 0;
    margin: 4px 6px;
    border-top: 1px solid var(--wf-line);
    list-style: none;
}

/* 34px items with an icon (and a key on the right); the destructive one is last, in danger ink. */
.wf-action-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 0.8125rem;
    text-align: left;
    color: var(--theme-text);
    background: none;
    border: none;
    border-radius: var(--wf-radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background 120ms ease;
}

.wf-action-menu-item:hover {
    background: var(--wf-card-hover);
    color: var(--theme-text-emphasis);
}

.wf-action-menu-item:focus-visible {
    outline: 2px solid var(--wf-primary-ink);
    outline-offset: -2px;
    box-shadow: none;
}

.wf-action-menu-item i {
    font-size: 0.9375rem;
    width: 18px;
    text-align: center;
    color: var(--theme-text-secondary);
    flex: 0 0 auto;
}
.wf-action-menu-item kbd,
.wf-action-menu-item .wf-action-menu-key { margin-left: auto; color: var(--theme-text-muted); font-size: 0.71875rem; }
.wf-action-menu-item.is-danger,
.wf-action-menu-item.is-danger i { color: var(--wf-danger-ink); }

@media (prefers-reduced-motion: reduce) {
    .wf-action-menu-list { animation: none; }
}

/* =================================================================
   The global user page - Add to a workspace (/ops/user/{id}, Components/Ops/AddToWorkspaceDialog). Every uws-* class is
   owned by this block alone; the presets are the house .wf-choice cards (components.css). Tokens only. A tick list
   (2026-11-12): one workspace or several, Select all / Deselect all, and a run over several that says each step.
   ================================================================= */
.uws-intro { margin: 0 0 var(--wf-space-4); color: var(--theme-text-secondary); font-size: 0.8125rem; line-height: 1.5; }
.uws-bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px var(--wf-space-2);
    margin: var(--wf-space-3) 0 6px;
}
.uws-count {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    margin: 0;
    color: var(--theme-text-muted);
    font-size: 0.78125rem;
}
.uws-selected { color: var(--wf-primary-ink); font-weight: 600; }
.uws-bulk-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.uws-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: min(18rem, 40vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-inset);
}
.uws-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--wf-radius-sm);
    background: transparent;
    color: var(--theme-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.uws-option:hover { background: var(--wf-card-hover); }
.uws-option:focus-visible { outline: 2px solid var(--wf-primary-ink); outline-offset: 1px; }
.uws-option[aria-checked="true"] { border-color: var(--wf-primary-ink); background: var(--wf-primary-soft); }
.uws-option-box { color: var(--theme-text-muted); font-size: 1rem; line-height: 1; }
.uws-option[aria-checked="true"] .uws-option-box { color: var(--wf-primary-ink); }
.uws-option-name { min-width: 0; overflow: hidden; color: var(--theme-text-emphasis); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.uws-option-sub {
    max-width: 14rem;
    overflow: hidden;
    color: var(--theme-text-secondary);
    font-family: var(--theme-font-mono);
    font-size: 0.78125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.uws-skel { padding: 12px 10px; }
.uws-empty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--wf-space-2);
    margin: var(--wf-space-3) 0 0;
    padding: 12px 14px;
    border: 1px dashed var(--wf-line-strong);
    border-radius: var(--wf-radius-md);
    color: var(--theme-text-secondary);
}
.uws-preset-label { display: block; margin-top: var(--wf-space-5); }
/* The Add button names the workspace - a long name ellipsises (its whole text is the button's title) instead of pushing
   the footer wider than the dialog on a phone. */
.uws-add { min-width: 0; max-width: 100%; }
.uws-add-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The run over several workspaces: where it is (or its verdict), a bar, the tallies, then one row per workspace. */
.uws-run { margin: 0 0 var(--wf-space-3); }
.uws-run-text { margin: 0 0 var(--wf-space-2); color: var(--theme-text-emphasis); font-weight: 600; }
.uws-run-bar { display: block; width: 100%; height: 8px; accent-color: var(--wf-primary-ink); }
.uws-tally { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--wf-space-3) 0 0; padding: 0; list-style: none; }
.uws-tally-item {
    padding: 2px 10px;
    border-radius: var(--wf-radius-sm);
    background: var(--wf-inset);
    color: var(--theme-text-secondary);
    font-size: 0.78125rem;
    font-weight: 600;
}
.uws-tally-item.is-added { background: var(--wf-success-soft); color: var(--wf-success-ink); }
.uws-tally-item.is-failed { background: var(--wf-danger-soft); color: var(--wf-danger-ink); }
.uws-results {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: min(22rem, 50vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-inset);
    list-style: none;
}
.uws-result {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: var(--wf-radius-sm);
    color: var(--theme-text);
}
.uws-result-icon { color: var(--theme-text-muted); }
.uws-result-name { min-width: 0; overflow: hidden; color: var(--theme-text-emphasis); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.uws-result-says { max-width: 22rem; color: var(--theme-text-secondary); font-size: 0.8125rem; text-align: right; }
.uws-result.is-adding { background: var(--wf-primary-soft); }
.uws-result.is-adding .uws-result-icon { color: var(--wf-primary-ink); }
.uws-result.is-added .uws-result-icon,
.uws-result.is-added .uws-result-says { color: var(--wf-success-ink); }
.uws-result.is-failed .uws-result-icon,
.uws-result.is-failed .uws-result-says { color: var(--wf-danger-ink); }
.uws-result.is-waiting,
.uws-result.is-not-tried { color: var(--theme-text-muted); }
/* A phone: the subdomain - and a row's words - move under the name instead of squeezing it. */
@media (max-width: 480px) {
    .uws-option { grid-template-columns: auto minmax(0, 1fr); }
    .uws-option-sub { grid-column: 2; grid-row: 2; max-width: none; }
    .uws-result { grid-template-columns: auto minmax(0, 1fr); }
    .uws-result-says { grid-column: 2; grid-row: 2; max-width: none; text-align: left; }
}
@media (pointer: coarse) {
    .uws-option { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    .uws-result-icon.spinner-border { animation-duration: 2s; }
}

/* =================================================================
   Theme Editor - the Readability card (/ops/theme, portal-look-and-feel 3.1-6)
   ================================================================= */
.wf-read-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.wf-read-row { display: flex; align-items: center; gap: 12px; }
.wf-read-swatch {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 32px;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-sm);
    font-size: 14px;
    font-weight: 700;
}
.wf-read-text { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.3; }
.wf-read-label { color: var(--theme-text-emphasis); font-size: 0.8125rem; font-weight: 600; }
.wf-read-hint { color: var(--theme-text-muted); font-size: 0.75rem; }
.wf-read-ratio { color: var(--theme-text-secondary); font-size: 0.8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wf-read-note {
    padding: 12px 14px;
    border: 1px solid var(--wf-line);
    border-radius: var(--wf-radius-md);
    background: var(--wf-neutral-soft);
    color: var(--theme-text-secondary);
    font-size: 0.8125rem;
}
