/* Design System - Data Analyst Portal v2 */

:root {
    /* Colors — `--primary` is the canonical app-wide brand colour
       (blue), used across nav, buttons, links, and active states on
       login, dashboard, catalog, marketplace, admin, etc. The /home
       redesign opted into a green/navy palette via local
       `.home-mock` / `.advanced-mock` overrides; those scopes set
       their own `--hp-primary` so the green only applies where the
       redesign explicitly opts in. Everything else inherits blue. */
    --primary: #0073D1;
    --primary-light: rgba(0, 115, 209, 0.1);
    --primary-dark: #005BA3;
    --brand-accent: #4F9DEB;
    --hero-bg: #0f1b3a;
    --hero-ink: #f3f6ff;
    --text-primary: #0e1525;
    --text-secondary: #4a5168;
    --background: #f6f7fa;
    --surface: #ffffff;
    --surface-dim: #f0f2f6;
    --border: #e4e7ee;
    --border-light: #f0f2f6;
    --border-dark: #c4c4c4;
    --success: #10B77F;
    --warning: #F59F0A;
    --error: #EA580C;
    --info-bg: #eef3ff;
    --info-ink: #1c3994;
    --info-line: #4f7cf2;
    --warn-bg: #fff8e6;
    --warn-ink: #6e4d00;
    --warn-line: #f5c84b;

    /* Typography — system stack matching the CEO mock so weight +
       letterforms render identically on macOS (San Francisco) and
       Windows (Segoe UI). Inter remains a graceful fallback in the
       cascade. */
    --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", system-ui, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Font sizes */
    --text-xs: 10px;
    --text-sm: 12px;
    --text-base: 14px;
    --text-md: 16px;
    --text-lg: 18px;
    --text-xl: 24px;
    --text-2xl: 30px;

    /* Font weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Extra text colors — referenced by inline page styles that should
       eventually migrate (home hero used --hp-text-muted, etc.) */
    --text-muted: #9CA3AF;
    --text-disabled: #D1D5DB;

    /* Spacing — 4-multiple scale. Gaps filled to cover dashboard /home
       inline-style values (28px / 40px / 48px / 64px). */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-9: 40px;
    --space-10: 48px;
    --space-12: 64px;

    /* App header — single source of truth for the sticky header height so
       page-level sticky sub-toolbars can offset off it (var, not magic
       numbers). Kept in sync with `.app-header` padding + content height. */
    --app-header-height: 57px;

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: var(--radius-lg);
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* Shadows. --shadow-card is the canonical card elevation;
       --shadow-elevated lifts hero blocks. Shadow tints aligned with
       the new green/navy palette so heavy elevations don't carry a
       leftover blue cast. */
    --shadow-sm: rgba(15, 27, 58, 0.05) 0px 1px 2px 0px, rgba(15, 27, 58, 0.06) 0px 1px 3px 0px;
    --shadow-md: rgba(15, 27, 58, 0.08) 0px 4px 16px 0px;
    --shadow-card: 0 1px 3px 0 rgba(15, 27, 58, 0.06), 0 1px 2px -1px rgba(15, 27, 58, 0.05);
    --shadow-elevated: 0 8px 24px rgba(15, 27, 58, 0.14);

    /* Focus + interaction — alpha brand-green below uses color-mix on
       var(--ds-primary) so it follows the active theme (light/blue/dark);
       these were hardcoded brand-green rgba() literals (#497 §5). */
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--ds-primary) 25%, transparent);
    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 320ms ease;

    --width-narrow: 800px;
    --width-page: 1400px;
    --width-app: var(--width-page);
    --width-wide: var(--width-page);

    /* Legacy token aliases — keep absorbed style.css rules rendering
       until Task 16 cleanup. Each legacy name maps onto its modern
       equivalent so every absorbed selector resolves to a real value
       instead of falling back to `unset`. */
    --bg: var(--background);
    --card-bg: var(--surface);
    --text: var(--text-primary);
    --text-light: var(--text-secondary);
    --secondary: var(--text-secondary);
    --radius: var(--radius-lg);

    /* Intermediate font sizes used by the legacy absorbed section.
       These fill gaps in the 10/12/14/16/18/24/30px scale. Added in
       the design-token migration pass (issue #400) so rem literals
       in legacy selectors resolve through a named token and follow
       operator overrides. */
    --text-13: 13px;   /* 0.8125rem — help text, small labels, code snippets */
    --text-15: 15px;   /* 0.9375rem — slightly-larger body copy */
    --text-22: 22px;   /* 1.375rem  — logo / brand lockup heading */
    --text-28: 28px;   /* 1.75rem   — login card h2 display size */

    /* Card accent surface tints — applied as background on .card-error,
       .card-highlight, .card-ai, .card-success. Operator overrides to
       the corresponding --ds-accent-* set automatically flow through. */
    --card-error-bg:     #fff8f8;
    --card-highlight-bg: #f8faff;
    --card-ai-bg:        #f8fdf8;
    --card-success-bg:   #f8fdf8;

    /* Badge role colors — semantic fills for .badge-analyst / .badge-privileged /
       .badge-admin. These live outside the --ds-accent-* family because they map
       to UX roles rather than alert severity, but operator overrides apply. */
    --badge-success-bg:  #e8f5e9;
    --badge-success-ink: #2e7d32;
    --badge-warn-bg:     #fff3e0;
    --badge-warn-ink:    #ef6c00;
    --badge-info-bg:     #e3f2fd;
    --badge-info-ink:    #1565c0;

    /* Flash message fills — success / error / info / warning. Kept separate
       from --ds-accent-* so an operator can tune the flash palette independently
       of card accents. Names follow the existing .flash-{variant} class family. */
    --flash-success-bg:     #e8f5e9;
    --flash-success-ink:    #2e7d32;
    --flash-success-border: #c8e6c9;
    --flash-error-bg:       #ffebee;
    --flash-error-ink:      #c62828;
    --flash-error-border:   #ffcdd2;
    --flash-info-bg:        #e3f2fd;
    --flash-info-ink:       #1565c0;
    --flash-info-border:    #bbdefb;
    --flash-warn-bg:        #fff3e0;
    --flash-warn-ink:       #ef6c00;
    --flash-warn-border:    #ffe0b2;
    /* v2 flash ink shades (slightly darker than .flash-* for the v2 family). */
    --flash-success-v2-ink: #0d9668;
    --flash-error-v2-ink:   #c2410c;

    /* Code-block dark surface — the pre-highlight dark code panel used in the
       legacy Quick Start / SSH setup cards. Distinct from the page surface
       tokens (which are light) so dark-on-light and light-on-dark don't
       accidentally share the same token. */
    --code-dark-bg:     #1a1a2e;
    --code-dark-ink:    #e4e4e7;
    --code-dark-border: #2d2d44;
    /* Pure white for .code-block inside .code-block-wrapper (dark translucent
       surface) — distinct from --code-dark-ink so contrast there is maximal. */
    --code-wrapper-ink: #fff;

    /* Form placeholder — the medium-grey used in text inputs and textareas. */
    --placeholder-color: #9aa0a6;

    /* Username box — sky-blue highlight panel on the dashboard setup page.
       The copy-button family reuses the same blue so the panel reads
       as one coherent block. */
    --username-box-bg:   #f0f9ff;
    --username-box-line: #0ea5e9;
    --username-ink:      #0369a1;
    --btn-copy-bg:       #0ea5e9;
    --btn-copy-hover:    #0284c7;
    --btn-copy-success:  #22c55e;

    /* Info box — subtle surface used for hint / info panels in forms. */
    --info-box-bg:     #f8fafc;
    --info-box-border: #e2e8f0;

    /* CC setup card gradient — purple-to-indigo used by the Claude Code
       setup card. Exposed as tokens so an operator can swap the gradient
       without editing the rule directly. */
    --cc-gradient-from: #667eea;
    --cc-gradient-to:   #764ba2;

    /* Support info panel — same surface as --info-box-bg; named separately
       so the .support-info component can be themed independently. */
    --support-info-bg: var(--info-box-bg);

    /* Username preview text — slate-grey used in .username-preview label. */
    --username-preview-color: #64748b;
}

/* The reset sits in a cascade layer so it ranks below `@keboola/design`'s own
   layers (base, utilities) on SPA pages. Unlayered, it beat every DS utility
   regardless of specificity and stripped the padding off SearchInput and
   friends. This file loads first, so `agnes-reset` is the lowest layer
   declared; it still overrides UA defaults and, having zero specificity,
   already lost to every other legacy rule, so Jinja pages render as before. */
@layer agnes-reset {
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
}

body {
    font-family: var(--font-primary);
    background-color: var(--background);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.5;
    min-height: 100vh;
}

:root[data-theme="dark"] ::selection {
    background-color: color-mix(in srgb, var(--ds-accent) 38%, var(--ds-surface));
    color: var(--ds-text-primary);
}

/* =====================================================
   Absorbed from the deleted app/web/static/style.css.
   Kept verbatim here so legacy classes used by login/auth
   pages, error pages, and password-setup pages keep
   rendering. Individual rules retire in the design-pass
   migration tasks; final cleanup in Task 16 removes the
   ones no template references after that sweep.
   ===================================================== */

.container {
    /* Canonical page-shell width + gutters. Pages inherit this
       directly — no per-page max-width / padding override needed.
       The 16px / 48px asymmetric vertical padding gives a tight gap
       between the sticky nav and the first hero (matches /home) and
       generous breathing room above the footer. Side gutters are
       32px so dense tables / grids align to the same vertical rules
       as the canonical `.page-header--hero`.
       Pages that genuinely need narrower line-length (setup wizards,
       single-form flows) opt in via .container--narrow; wide tables
       opt in via .container--wide. */
    max-width: calc(var(--width-page) + 64px);
    margin: 0 auto;
    padding: 16px 32px 48px;
}
/* Strip default `<main>` padding/margin when it sits inside our
   canonical `.container`. The container already owns the gutters,
   so the `<main>` element is a pure flow container. */
.container > main {
    margin: 0;
    padding: 0;
}

/* Width modifiers — opt-in alternatives to the default page shell. */
.container--narrow { max-width: var(--width-narrow); }   /* 800px — long-form reading, setup flows */
.container--full   { --page-gutter: var(--space-8); max-width: none; padding-left: var(--page-gutter); padding-right: var(--page-gutter); }
.container--full > .site-footer { max-width: var(--width-page); margin-inline: auto; }
@media (max-width: 640px) { .container--full { --page-gutter: var(--space-4); } }

body:has(.container--app-screen) { overflow: hidden; }
.container.container--app-screen { max-width: none; padding: 0; }
.container.container--app-screen > footer { display: none; }
.container.container--app-screen > main { margin: 0; padding: 0; }

:where(a, button, summary, [role="tab"], [role="button"],
       input[type="checkbox"], input[type="radio"]):focus-visible {
    outline: var(--ds-focus-outline);
    outline-offset: var(--ds-focus-outline-offset);
}

/* ── A content page as a white SHEET ──────────────────────────────────────
   `.idx` below (index pages) and `.container--full` in admin_page.css (every
   admin page) both paint their shell `--ds-surface`, and both say why in their
   own comments: a page left on the app background reads as a different product
   from the one it was reached from. Content pages on base_page.html /
   base_ds.html had no way to say the same thing, which is how the semantic
   layer and the metrics list ended up as the grey stop in a white app — you
   reach them from the Library's Definitions block, and the canvas changes
   colour on the way (#1898).

   Opt in per page: `{% block body_attrs %}class="page-sheet"{% endblock %}`.

   FULL BLEED, on the body rather than on `.container`: the container is padded
   and max-width'd, so painting that would leave grey gutters beside a white
   column — an oversized card, not a page. This is the same choice `.idx`
   documents ("no grey gutters beside the centred header either").

   `body.detail-page` is in the same rule rather than opting in template by
   template: the nine detail pages (data package, table, recipe, plugin,
   marketplace item, data app, collection, file, memory domain) already carry
   that class for their footer treatment, so it is the marker for this family
   and one selector keeps all nine from drifting apart. Cards-on-grey was their
   look, and cards on a sheet is the look every index page they are reached from
   already has — the cards keep their own borders either way.

   `html body.…` carries the extra element on purpose: the rule these have to
   beat is `[data-theme="paper"] body` in paper-skin.css (the sheet that paints
   the grey), which ties on specificity, and sheet order is not a thing a page
   should have to reason about. */
html body.page-sheet,
html body.detail-page { background: var(--ds-surface); }

/* Index / resource-list page layout (#896 prototype) — used via
   base_index.html by My Stack, Catalog, and similar list pages. The
   header zone (title + description + actions + search + tabs) and the
   full-width band below it that carries the card grid are one unbroken
   surface, running to the foot of the page. Shared here so pages carry
   no per-page background/border styling. Structure/spacing/backgrounds
   only. */
.idx {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* The header zone reads as part of the page surface, not as a grey
       band above it: paint the whole shell --ds-surface so the app
       background never shows behind the title/description/actions row
       (full-width, so no grey gutters beside the centred header either). */
    background: var(--ds-surface);
}
/* The global `footer` rule adds a 48px top margin for breathing room on
   content pages; inside the index shell that margin opened a grey gap
   between the white band and the footer (the band's flex-grow stops at
   the margin). Zero it so the white band runs flush to the footer. The
   hairline `border-top` divider is dropped too — the white band already
   provides the visual break above the credit. */
.idx > footer {
    margin-top: 0;
    border-top: none;
    background: var(--ds-surface);
}

/* Catalog detail pages (package / table / recipe) drop the footer's
   hairline divider so the credit sits flush below the page body. Rail-
   scoped so the default topnav chrome renders byte-identically. */
html[data-ui-layout="rail"] body.detail-page footer {
    border-top: none;
}

/* Dashboard */
.dashboard h2 {
    font-size: var(--text-xl);
    font-weight: var(--fw-600, 600);
    margin-bottom: 24px;
    color: var(--text);
}

a.logo { text-decoration: none; color: inherit; display: block; }
a.logo:hover h1 { color: var(--primary); }

.logo h1 {
    font-size: var(--text-22);
    font-weight: var(--fw-600, 600);
    color: var(--text);
    margin: 0;
    letter-spacing: -0.02em;
}

.logo .subtitle {
    font-size: var(--text-13);
    color: var(--text-light);
    margin-top: 2px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-base);
    color: var(--text-light);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: var(--text-base);
    font-weight: var(--fw-500, 500);
    text-decoration: none;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.btn-primary {
    /* Primary action buttons across the app share /home's green CTA
       fill (`--ds-primary`) so users see one consistent "do it"
       affordance everywhere. The brand-blue `--primary` stays as
       the link / accent colour elsewhere; only the filled button
       background flips to green. */
    background-color: var(--ds-action);
    color: var(--ds-primary-ink);
    font-weight: var(--fw-500, 500);
    transition: all 0.15s ease;
}

.btn-primary:hover {
    background-color: var(--ds-primary-hover, var(--ds-primary-dark));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--ds-action) 30%, transparent);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: transparent;
    color: var(--secondary);
    border: 1px solid var(--border);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: var(--text-sm);
}

.btn-google {
    background-color: white;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 14px 28px;
    font-size: var(--text-md);
    font-weight: var(--fw-500, 500);
    width: 100%;
    max-width: 280px;
    transition: all 0.2s ease;
}

.btn-google:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: var(--border-dark);
    background-color: var(--background);
}

.btn-google:active {
    transform: scale(0.98);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--ds-radius-card);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
}

.card h3 {
    font-size: var(--text-md);
    font-weight: var(--fw-600, 600);
    margin-bottom: 16px;
    color: var(--text);
    letter-spacing: -0.01em;
}

.card p {
    color: var(--text-light);
    margin-bottom: 12px;
}

.card-error {
    border-left: 4px solid var(--error);
    background-color: var(--card-error-bg);
}

.card-highlight {
    border-left: 4px solid var(--primary);
    background-color: var(--card-highlight-bg);
}

.card-ai {
    border-left: 4px solid var(--success);
    background-color: var(--card-ai-bg);
}

.card-error h3 {
    color: var(--error);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: var(--text-sm);
    font-weight: var(--fw-500, 500);
    border-radius: 4px;
    background-color: var(--bg);
    color: var(--text-light);
    margin-right: 4px;
}

/* Code blocks */
code {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--border-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px var(--space-1);
    color: var(--text-primary);
}

/* Label qualifiers — optional, default, hint text next to form labels */
.label-qualifier,
.optional {
    font-size: var(--text-sm);
    font-weight: var(--font-normal);
    color: var(--text-secondary);
    margin-left: var(--space-1);
}

/* Radio option cards — visual selected state */
.sync-option-card:has(input:checked) {
    border-color: var(--primary) !important;
    background: var(--primary-light) !important;
}

.code-block {
    background-color: var(--code-dark-bg);
    color: var(--code-dark-ink);
    padding: 14px 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid var(--code-dark-border);
}

.code-block code,
.code-block pre {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: var(--text-13);
    color: inherit;
    line-height: 1.6;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Command rows for Quick Start */
.command-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.command-row .command-label {
    font-weight: var(--fw-500, 500);
    font-size: var(--text-base);
    min-width: 70px;
    color: var(--text-light);
}

.command-row .code-block {
    flex: 1;
    margin: 0;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: var(--fw-500, 500);
    margin-bottom: 8px;
}

.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
    font-size: var(--text-13);
    line-height: 1.5;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    min-height: 100px;
    background-color: var(--card-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.form-group textarea::placeholder {
    color: var(--placeholder-color);
}

/* Flash messages */
.flash-messages {
    margin-bottom: 24px;
}

.flash {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: var(--text-base);
    font-weight: var(--fw-500, 500);
}

.flash-success {
    background-color: var(--flash-success-bg);
    color: var(--flash-success-ink);
    border: 1px solid var(--flash-success-border);
}

.flash-error {
    background-color: var(--flash-error-bg);
    color: var(--flash-error-ink);
    border: 1px solid var(--flash-error-border);
}

.flash-info {
    background-color: var(--flash-info-bg);
    color: var(--flash-info-ink);
    border: 1px solid var(--flash-info-border);
}

.flash-warning {
    background-color: var(--flash-warn-bg);
    color: var(--flash-warn-ink);
    border: 1px solid var(--flash-warn-border);
}

/* Inline steps for compact layout */
.steps-inline {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* AI hint inline */
.ai-hint {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: var(--text-13);
    color: var(--text-light);
}

.ai-hint code {
    display: inline;
    font-size: var(--text-sm);
    color: var(--primary);
}

/* Footer */
footer {
    margin-top: 48px;
    padding-top: 20px;
    padding-bottom: 8px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-light);
    font-size: var(--text-13);
}

/* Shared footer partial (`_footer.html`): product name, running build, then
   the operator credit when configured. Only the INSIDE is styled here — the
   outer `<footer>` keeps the rule above plus every chrome-specific override
   that keys on the element or on `footer_class` (`.idx > footer`,
   `body.chat-page-body .container > footer`, the rail detail-page rule, and
   `.cloud-chat-empty-foot`), so no existing footer treatment moves.
   Inline spans, not a flex row — see the comment in the partial: inline flow
   inherits each chrome's own centering and needs no width, which a flex row
   would have to be given separately in each of the six layout contexts. */
.site-footer__line {
    margin: 0;
}
.site-footer__brand {
    font-weight: var(--fw-600, 600);
    color: var(--ds-text-secondary);
}
.site-footer__build,
.site-footer__deploy,
.site-footer__privacy {
    color: var(--ds-text-muted);
}
.site-footer__privacy a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--ds-border);
}
.site-footer__privacy a:hover {
    color: var(--ds-text-secondary);
}
/* Separators ride the segments they precede, so each one disappears with its
   own segment — no dangling bullet when /api/version is unreachable or when
   the instance configures no credit. */
.site-footer__build::before,
.site-footer__deploy::before,
.site-footer__privacy::before {
    content: '·';
    margin: 0 6px;
}
.site-footer__build[hidden] {
    display: none;  /* explicit: `hidden` alone loses to any inline reset */
}

.btn-copy {
    background: var(--btn-copy-bg);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: var(--fw-600, 600);
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.5px);
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: var(--btn-copy-hover);
}

.btn-copy:active {
    transform: scale(0.98);
}

.btn-copy.copied {
    background: var(--btn-copy-success);
}

.btn-copy-inline {
    background: var(--btn-copy-bg);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--text-sm);
    margin-left: 8px;
    transition: background 0.15s ease;
}

.btn-copy-inline:hover {
    background: var(--btn-copy-hover);
}

.btn-copy-block {
    background: var(--btn-copy-bg);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: var(--fw-600, 600);
    width: 100%;
    transition: all 0.2s ease;
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.5px);
}

.btn-copy-block:hover {
    background: var(--btn-copy-hover);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.btn-copy-block:active {
    transform: scale(0.98);
}

.btn-copy-block.copied {
    background: var(--btn-copy-success);
}

.card-success {
    border-left: 4px solid var(--success);
    background-color: var(--card-success-bg);
}

.btn-block {
    width: 100%;
}

.btn-link {
    background: transparent;
    color: var(--primary);
    border: none;
    padding: 8px 4px;
    font-size: var(--text-base);
    cursor: pointer;
    text-decoration: none;
}

.btn-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Request access form */
.request-access-form,
.reset-form {
    display: inline;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-light);
    font-size: var(--text-base);
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: var(--border);
}

.divider span {
    padding: 0 16px;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
}


.user-info-v2 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Buttons */
.btn-v2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--space-3);
    height: 36px;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    text-decoration: none;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary-v2 {
    background-color: var(--primary);
    color: var(--ds-primary-ink);
}

.btn-primary-v2:hover {
    background-color: var(--primary-dark);
}

.btn-secondary-v2 {
    background-color: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary-v2:hover {
    background-color: var(--border);
}

.btn-ghost-v2 {
    background-color: transparent;
    color: var(--text-secondary);
}

.btn-ghost-v2:hover {
    background-color: rgba(243, 244, 246, 0.5);
}

/* Cards */
.card-v2 {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ds-radius-card);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.card-v2 h3 {
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.card-v2 p {
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

/* AI Setup Card - Primary CTA */
.ai-setup-card {
    background: linear-gradient(135deg, var(--primary) 0%, #0056A3 100%);
    border: none;
    color: white;
    padding: var(--space-6);
    margin-bottom: var(--space-5);
}

.ai-setup-card h3 {
    color: white;
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
}

.ai-setup-card .setup-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--text-base);
    line-height: 1.6;
    margin-bottom: var(--space-4);
}

.ai-setup-card .btn-copy-v2 {
    background: white;
    color: var(--primary);
    font-weight: var(--font-semibold);
    padding: var(--space-3) var(--space-6);
    height: 44px;
    width: 100%;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: var(--text-base);
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.5px);
    transition: all 0.2s ease;
}

.ai-setup-card .btn-copy-v2:hover {
    background: linear-gradient(var(--ds-state-hover), var(--ds-state-hover)), white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ai-setup-card .btn-copy-v2.copied {
    background: var(--success);
    color: white;
}

/* Flash messages */
.flash-messages-v2 {
    margin-bottom: var(--space-5);
}

.flash-v2 {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.flash-success-v2 {
    background: rgba(16, 183, 127, 0.1);
    color: var(--flash-success-v2-ink);
    border: 1px solid rgba(16, 183, 127, 0.3);
}

.flash-error-v2 {
    background: rgba(234, 88, 12, 0.1);
    color: var(--flash-error-v2-ink);
    border: 1px solid rgba(234, 88, 12, 0.3);
}

.flash-info-v2 {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--ds-primary) 30%, transparent);
}

/* Data Link Card */
.data-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ds-radius-card);
    text-decoration: none;
    transition: all 0.15s ease;
    margin-bottom: var(--space-5);
}

.data-link-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.data-link-content {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.data-link-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.data-link-text h3 {
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: 2px;
}

.data-link-text p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
}

.data-link-stats {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--background);
    border-radius: var(--radius-md);
}

.data-stat {
    text-align: center;
    padding: 0 var(--space-2);
}

.data-stat .value {
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.data-stat .label {
    font-size: var(--fs-10, 10px);
    color: var(--text-secondary);
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.3px);
}

.data-stat-divider {
    width: 1px;
    background: var(--border);
}

.data-link-arrow {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.data-link-card:hover .data-link-arrow {
    background: var(--primary);
    color: white;
    transform: translateX(2px);
}

.data-categories {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.category-tag {
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: var(--font-medium);
}

.category-tag.finance { background: var(--ds-accent-success-bg); color: var(--ds-accent-success-ink); }
.category-tag.hr { background: rgba(139, 92, 246, 0.1); color: #7c3aed; }
.category-tag.sales { background: color-mix(in srgb, var(--ds-primary) 10%, transparent); color: var(--primary); }
.category-tag.telemetry { background: rgba(245, 159, 10, 0.1); color: #b45309; }
.category-tag.support { background: rgba(234, 88, 12, 0.1); color: #EA580C; }
.category-tag.revenue { background: color-mix(in srgb, var(--ds-primary) 10%, transparent); color: var(--primary); }
.category-tag.customers { background: rgba(139, 92, 246, 0.1); color: #7c3aed; }
.category-tag.marketing { background: rgba(245, 159, 10, 0.1); color: #b45309; }

.data-highlights {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.data-highlight {
    display: flex;
    align-items: center;
    gap: 4px;
}

.data-highlight strong {
    color: var(--text-primary);
    font-weight: var(--font-semibold);
}

.full-width {
    grid-column: 1 / -1;
}

/* Setup steps styling */
.setup-steps {
    margin: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.code-block {
    flex: 1;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: var(--text-13);
    /* Pure white (not --code-dark-ink's #e4e4e7): this .code-block sits inside
       .code-block-wrapper's dark translucent surface and needs max contrast. */
    color: var(--code-wrapper-ink);
    background: transparent;
    border: none;
    white-space: pre;
    overflow-x: auto;
}

.btn-copy-code {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.btn-copy-code:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-copy-code.copied {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

.btn-copy-code svg {
    width: 16px;
    height: 16px;
}

/* Compact setup banner (existing users) */
.setup-compact {
    background: linear-gradient(135deg, var(--primary) 0%, #0056A3 100%);
    border: none;
    color: white;
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.setup-compact h3 {
    color: white;
    margin-bottom: 0;
    font-size: var(--text-base);
}

.setup-compact p {
    color: rgba(255, 255, 255, 0.85);
    margin: 4px 0 0 0;
    font-size: var(--text-sm);
}

.setup-compact .btn-copy-v2 {
    background: white;
    color: var(--primary);
    font-weight: var(--font-semibold);
    padding: var(--space-2) var(--space-5);
    height: 40px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-size: var(--text-sm);
    white-space: nowrap;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.setup-compact .btn-copy-v2:hover {
    background: linear-gradient(var(--ds-state-hover), var(--ds-state-hover)), white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.setup-compact .btn-copy-v2.copied {
    background: var(--success);
    color: white;
}

.btn-sm-v2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: 0 var(--space-3);
    height: 32px;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    text-decoration: none;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-sm-primary {
    background-color: var(--primary);
    color: white;
}

.btn-sm-primary:hover {
    background-color: var(--primary-dark);
}

.btn-sm-secondary {
    background-color: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-sm-secondary:hover {
    background-color: var(--border);
}

@media (max-width: 640px) {
    .setup-compact {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .setup-compact .btn-copy-v2 {
        width: 100%;
    }
}

/* Live dot animation */
.live-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
    display: inline-block;
}

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

/* Disabled category tag */
.category-tag.disabled {
    background: var(--background);
    color: var(--text-secondary);
}

/* ========== Login Page Split Layout ========== */
.login-page {
    min-height: 100vh;
    background: var(--background);
}

.feature-card {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--ds-radius-card);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.pre-auth-privacy-link a {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--ds-surface);
    color: var(--ds-text-secondary);
}

.login-page .divider {
    display: flex;
    align-items: center;
    margin: var(--space-5) 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.login-page .divider::before,
.login-page .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: var(--border);
}

.login-page .divider span {
    padding: 0 var(--space-4);
}

/* Google button styling */
.login-page .btn-google {
    background-color: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 14px 28px;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    width: 100%;
    max-width: 280px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
}

.login-page .btn-google:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: var(--border-dark);
    background-color: var(--background);
}

.login-page .btn-google:active {
    transform: scale(0.98);
}

/* Email magic link button styling */
.login-page .btn-email {
    background-color: #4361ee;
    color: white;
    border: 1px solid #3a56d4;
    padding: 14px 28px;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    border-radius: var(--radius-md);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.login-page .btn-email:hover {
    background-color: #3a56d4;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.login-page .btn-email:active {
    transform: scale(0.98);
}

.login-page .btn-secondary {
    padding: 14px 28px;
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    border-radius: var(--radius-md);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.version-badge {
    position: fixed;
    bottom: 0.5rem;
    right: 0.75rem;
    font-size: var(--fs-11-2, 0.7rem);
    color: var(--ds-text-muted);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    z-index: 9999;
    pointer-events: auto;
}

.pre-auth-privacy-link {
    position: fixed;
    bottom: 0.5rem;
    left: 0.75rem;
    font-size: var(--fs-11-2, 0.7rem);
    z-index: 9999;
}

@media (max-width: 1024px) {
    .feature-card {
        padding: var(--space-3);
    }
}

@media (max-width: 640px) {
    .version-badge,
    .pre-auth-privacy-link {
        position: static;
        width: fit-content;
        margin: var(--space-2) var(--space-3);
    }

    .feature-card {
        padding: var(--space-3);
        gap: var(--space-3);
    }
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    color: var(--success);
}

/* ─── Shared modern header (used by base.html + future pages) ─── */
/* Mirrors the inline header styles in dashboard.html so all pages share chrome. */

/* Adaptive header. Narrow/medium screens: a compact two-row layout —
     Row 1 (.app-header-bar) — product name (left) + search / help / user (right).
     Row 2 (.app-header-nav) — primary navigation, left-aligned under the name.
   Wide screens (≥1200px, see media query below): everything collapses onto a
   single compact row so the header isn't unnecessarily tall.
   A subtle 1px bottom border separates the header from page content. */
/* Single horizontal band: [logo] [primary nav ····] ⟨spacer⟩ [search]
   [Admin*] [help] [user]. The nav grows to fill the middle and hands overflow
   to the "More" menu (priority-plus in app.js) so the row never wraps on
   desktop/laptop widths. `flex-wrap` is the graceful fallback for very narrow
   (mobile) viewports where even a minimal nav + the actions cluster can't
   share a line with the logo — the actions cluster wraps below rather than
   clipping. */
.app-header {
    background: var(--surface, #fff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    margin-bottom: 0;
    padding: var(--space-2) var(--space-8);   /* 8px 32px — compact single row */
    display: flex;
    flex-direction: row;
    /* nowrap so a tight width squeezes the nav (which then sheds items into
       "More" via priority-plus) instead of wrapping the actions cluster to a
       second row. Mobile (<640px) flips this to `wrap` for a deliberate
       two-row layout. */
    flex-wrap: nowrap;
    align-items: center;
    column-gap: var(--space-6);
    row-gap: var(--space-2);
    text-align: left;
    min-height: var(--app-header-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Logo pinned left — never shrinks. */
.app-header-logo { flex: 0 0 auto; }

/* `.app-header-left` — kept for the `ds.primary_nav` macro (_components.html),
   scaffolding for a topnav refactor that never landed before the topnav
   chrome itself was retired (Wave 0, 2026-08); the macro has no current
   caller. Left in place rather than deleted since it's inert CSS with no
   render cost. */
.app-header-left { display: inline-flex; align-items: center; gap: var(--space-3); flex: 0 0 auto; }

/* Primary nav — the flexible middle. Grows to fill, shrinks toward zero
   (handing items to "More") so the actions cluster keeps its space. */
.app-header-nav {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    gap: var(--space-1);
    /* Never let the nav grow past the header (otherwise a too-wide nav
       overflows the page instead of being measured as overflow). Combined
       with `.is-priority`'s `overflow:hidden`, this makes clientWidth track
       the available width so the priority-plus logic can detect overflow. */
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;   /* no-JS fallback: links wrap rather than clip */
}
.app-header-nav.is-priority {
    flex-wrap: nowrap;
    overflow: hidden;
}

/* Right cluster — search + Admin + help + user. Pinned right (margin-left
   auto so it hugs the far edge even when the nav shrinks), never shrinks its
   own gaps; the search inside it does the shrinking. */
.app-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 0 0 auto;
    margin-left: auto;
    justify-content: flex-end;
    min-width: 0;
}

.app-header-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    font-weight: var(--fw-600, 600);
    font-size: var(--fs-16, 16px);
}
.app-header-logo svg {
    display: block;
    max-height: 40px;
    width: auto;
}
a.app-header-logo:focus-visible {
    outline: var(--ds-focus-outline);
    outline-offset: 2px;
    border-radius: 4px;
}

.app-header-subtitle {
    font-size: var(--fs-11, 11px);
    font-weight: var(--fw-500, 500);
    color: var(--text-secondary, #6b7280);
    letter-spacing: var(--ls-label, 0.4px);
    text-transform: var(--tt-label, uppercase);
    margin-top: 2px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    /* `.app-header` now uses `justify-content: flex-start` (was
       space-between), so the legacy `primary_nav` macro that still uses
       this class keeps its right alignment via an explicit auto margin. */
    margin-left: auto;
}

.app-header-email {
    font-size: var(--fs-13, 13px);
    color: var(--text-secondary, #6b7280);
    font-weight: var(--fw-500, 500);
}

.app-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light, #eef2ff);
    color: var(--primary, #6366f1);
    font-size: var(--fs-13, 13px);
    font-weight: var(--fw-600, 600);
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.3px;
}

.app-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border, #e5e7eb);
}

/* Top-nav entries. Both <a class="app-nav-link"> and
   <button class="app-nav-link app-nav-menu-trigger"> share this rule
   so the Admin dropdown trigger renders identical to its siblings —
   same font, color, padding, hover, active state. The button-element
   resets (background/border/font-family) flow from here, so
   .app-nav-menu-trigger no longer needs to strip <button> chrome
   separately. */
.app-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--fs-14, 14px);
    font-weight: var(--fw-500, 500);
    font-family: inherit;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    cursor: pointer;
    line-height: 1.2;
    /* Keep each label on one line so a tight nav row overflows horizontally
       (→ items move into the "More" menu) instead of wrapping its text. */
    white-space: nowrap;
    transition: all 0.15s ease;
}
.app-nav-link:hover {
    color: var(--primary-dark);
    background: var(--ds-state-hover);
}
.app-nav-link.is-active,
.app-nav-link[aria-expanded="true"] {
    color: var(--primary-dark);
    background: var(--primary-light);
}
.app-nav-link:focus { outline: none; }
.app-nav-link:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.app-btn-logout {
    font-size: var(--fs-13, 13px);
    font-weight: var(--fw-500, 500);
    color: var(--text-secondary, #6b7280);
    background: none;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-block;
}
.app-btn-logout:hover {
    color: var(--text-primary, #111827);
    border-color: #d1d5db;
    background: var(--ds-state-hover);
}

/* ── User menu (dropdown) ── */
.app-user-menu { position: relative; display: inline-flex; align-items: center; }
.app-user-menu-trigger {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: 1px solid transparent;
    border-radius: 999px; padding: 4px 10px 4px 4px;
    cursor: pointer; transition: all 0.15s ease;
}
.app-user-menu-trigger:hover { background: var(--ds-state-hover); border-color: var(--border, #e5e7eb); }
.app-user-menu-trigger[aria-expanded="true"] { background: var(--border-light, #f3f4f6); border-color: var(--border, #e5e7eb); }
.app-user-menu-chevron { color: var(--text-secondary, #6b7280); transition: transform 0.15s ease; }
.app-user-menu-trigger[aria-expanded="true"] .app-user-menu-chevron { transform: rotate(180deg); }
.app-user-menu-panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    min-width: 240px;
    /* The Admin sections now live in here, so cap the height and scroll
       rather than run off the bottom of the viewport. */
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 6px;
    z-index: 50;
}
.app-user-menu-panel[hidden] { display: none; }
/* Admin block inside the user dropdown — the collapsible <details> groups
   reuse the .app-nav-menu-* look; this just labels the block and nudges the
   nested section headers to line up with the flat items above them. */
.app-user-menu-admin-label { padding-left: 12px; }
.app-user-menu-admin .app-nav-menu-group > summary.app-nav-menu-section { padding-left: 12px; }
.app-user-menu-admin .app-nav-menu-item { padding-left: 20px; }
.app-user-menu-header {
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    margin-bottom: 4px;
}
.app-user-menu-email { font-size: var(--fs-13, 13px); font-weight: var(--fw-500, 500); color: var(--ds-text-primary); word-break: break-all; }
.app-user-menu-role { font-size: var(--fs-11, 11px); color: var(--ds-text-secondary); margin-top: 2px; text-transform: var(--tt-label, uppercase); letter-spacing: var(--ls-label, 0.3px); }
.app-user-menu-item {
    display: block; padding: 8px 12px;
    font-size: var(--fs-13, 13px); color: var(--ds-text-primary);
    text-decoration: none; border-radius: 6px;
}
.app-user-menu-item:hover { background: var(--ds-state-hover); }
.app-user-menu-item.is-active { background: var(--ds-state-selected-bg); color: var(--ds-state-selected-ink); font-weight: var(--fw-500, 500); }
/* Onboarding launcher — the "?" help icon in the header that re-opens the
   guided tour. Borderless icon button that sits next to the user menu. */
.app-onboarding-launch {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0;
    border: 0; border-radius: 8px; background: transparent;
    color: var(--text-secondary, #6b7280); cursor: pointer;
}
.app-onboarding-launch:hover { background: var(--ds-state-hover); color: var(--text-primary, #111827); }
.app-onboarding-launch:focus-visible { outline: var(--ds-focus-outline); outline-offset: var(--ds-focus-outline-offset); }

/* ── Theme toggle — Light / Dark / System segmented control in the user menu.
   One row: the "Theme" label reads like a menu item, the three choices sit
   opposite it as an icon-only pill (markup: _theme_toggle.html) — the stacked
   label-over-full-width-buttons layout cost two rows for the same three
   choices. Built only from tokens that flip under [data-theme="dark"]
   (--surface, --surface-dim, --border, --text-*, --shadow-sm), so it themes
   itself in both modes with no dark-specific rules.
   Wiring: app.js → window.__agnesTheme. ── */
.app-user-menu-sep { height: 1px; background: var(--border-light, #f3f4f6); margin: 6px 4px; }
.app-theme-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 4px 12px 6px;
}
.app-theme-toggle-label {
    font-size: var(--fs-13, 13px); line-height: 1.4;
    color: var(--text-primary, #111827);
}
.app-theme-toggle-options {
    display: inline-flex; gap: 2px; padding: 2px;
    background: var(--surface-dim, #f0f2f6);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 999px;
}
.app-theme-toggle-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; padding: 0;
    border: 1px solid transparent; border-radius: 999px;
    color: var(--text-secondary, #6b7280);
    background: transparent; cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
/* Sized here (not on the inline SVGs) so the icons can't inherit a stray
   page-level `svg { width: 100% }` and blow the pill apart. */
.app-theme-toggle-btn svg { width: 15px; height: 15px; display: block; }
/* Idle hover = a ghost of the active chip (ink + ring, no fill). A fill would
   need a token between --surface-dim and --surface, and the two are a hair
   apart in light mode — the ring reads in both themes. */
.app-theme-toggle-btn:hover { color: var(--text-primary, #111827); }
.app-theme-toggle-btn:not(.is-active):hover { border-color: var(--border, #e5e7eb); }
.app-theme-toggle-btn.is-active {
    background: var(--surface, #fff);
    border-color: var(--border, #e5e7eb);
    color: var(--text-primary, #111827);
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.08));
}
.app-theme-toggle-btn:focus-visible { outline: var(--ds-focus-outline); outline-offset: 2px; }

/* ── Admin nav dropdown — same vocabulary as user menu, scoped under nav links ── */
.app-nav-menu { position: relative; display: inline-flex; }
/* The "More" overflow container is toggled via the `hidden` attribute by
   app.js; the class `display:inline-flex` above would otherwise defeat the
   native `[hidden]`, so restore it explicitly. */
.app-nav-more[hidden] { display: none; }
/* .app-nav-menu-trigger styling flows entirely from .app-nav-link above.
   The trigger class is kept in markup as a hook for app.js dropdown
   wiring and for targeting the chevron rotation below. */
.app-nav-menu-chevron { color: currentColor; transition: transform 0.15s ease; }
.app-nav-menu-trigger[aria-expanded="true"] .app-nav-menu-chevron { transform: rotate(180deg); }
.app-nav-menu-panel {
    position: absolute; top: calc(100% + 8px); right: 0;
    min-width: 200px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 6px;
    z-index: 50;
}
.app-nav-menu-panel[hidden] { display: none; }
.app-nav-menu-item {
    display: block; padding: 8px 12px;
    font-size: var(--fs-13, 13px); color: var(--ds-text-primary);
    text-decoration: none; border-radius: 6px;
}
.app-nav-menu-item:hover { background: var(--ds-state-hover); }
.app-nav-menu-item.is-active { background: var(--ds-state-selected-bg); color: var(--ds-state-selected-ink); font-weight: var(--fw-500, 500); }

/* ── Admin mega-menu — first-class, admin-only. The trigger reuses
   `.app-nav-link`; this styles its wide multi-column panel so all admin
   domains are visible at once (vs. the old one-at-a-time accordion buried in
   the user menu). Panel is right-anchored under the trigger and capped to the
   viewport so it never runs off-screen. ── */
.app-admin-menu { position: relative; display: inline-flex; }
.app-admin-menu-trigger .app-nav-menu-chevron { margin-left: 2px; }
.app-admin-menu-panel {
    /* Override the narrow single-column `.app-nav-menu-panel` width. */
    width: min(680px, 94vw);
    min-width: 0;
    max-height: calc(100vh - var(--app-header-height) - 24px);
}
.app-admin-menu-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 4px 8px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}
.app-admin-menu-title {
    font-size: var(--fs-11, 11px);
    font-weight: var(--fw-700, 700);
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.5px);
    color: var(--text-secondary, #6b7280);
}
.app-admin-menu-hub {
    font-size: var(--fs-12, 12px);
    font-weight: var(--fw-500, 500);
    color: var(--primary-dark);
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 6px;
}
.app-admin-menu-hub:hover { background: var(--ds-state-hover); }
.app-admin-menu-hub.is-active { background: var(--primary-light); }
.app-admin-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px var(--space-4);
}
.app-admin-menu-col { min-width: 0; }
/* Column section header — small-caps label, no background band (the columns
   already separate the groups visually). First label in a column has no top
   margin; subsequent ones (a column holding two groups) get breathing room. */
.app-admin-menu-section {
    padding: 6px 12px 2px;
    font-size: var(--fs-10, 10px);
    font-weight: var(--fw-700, 700);
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.5px);
    color: var(--text-muted, #9ca3af);
}
.app-admin-menu-col > .app-admin-menu-section:first-child { padding-top: 0; }
.app-admin-menu-panel .app-nav-menu-item { padding: 6px 12px; }
@media (max-width: 720px) {
    .app-admin-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Primary-nav links relocated into the "More" overflow menu by app.js: render
   the pill links as full-width block rows so they read as menu items. Their
   hover / active / focus states come from `.app-nav-link` above, unchanged. */
.app-nav-more-panel .app-nav-link {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    padding: 8px 12px;
    border-radius: 6px;
}
/* One-line explainer under a nav item (#755 "Sources" group — Data sources
   vs. MCP sources were visually indistinguishable, which is exactly the
   confusion the issue reported). Muted, wraps under the link label. */
.app-nav-menu-item-desc {
    display: block;
    font-size: var(--fs-11, 11px);
    font-weight: var(--fw-400, 400);
    color: var(--text-secondary, #6b7280);
    margin-top: 1px;
    white-space: normal;
}
.admin-menu-separator { margin: 4px 8px; border: 0; border-top: 1px solid var(--border, #e5e7eb); }
/* Section header inside the admin dropdown — non-clickable, small-caps,
   sitting in a light gray band so each named group (Activity Center /
   Users & Access / Data / Agent Experience / Server) reads as a
   visually contained cluster. The negative horizontal margins extend
   the band edge-to-edge inside the panel (panel has 6px padding;
   matching -6px here). Rounded top corners on the first header line
   up with the panel's own border-radius so the first band tucks
   into the top of the panel cleanly. */
.app-nav-menu-section {
    background: var(--border-light, #f3f4f6);
    margin: 8px -6px 4px;
    padding: 6px 12px;
    font-size: var(--fs-10, 10px);
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.5px);
    color: var(--text-secondary, #6b7280);
    font-weight: var(--fw-700, 700);
}
.app-nav-menu-section:first-child {
    margin-top: -6px;
    border-radius: 10px 10px 0 0;
}
.app-nav-menu-section + .app-nav-menu-item { margin-top: 4px; }

/* <details data-section=...> group wrapper — visually identical to the
   pre-collapse render, but each section can fold up. <summary> reuses
   the .app-nav-menu-section style and gets a chevron via :before that
   rotates 90deg when [open] (no JS for the visual). */
.app-nav-menu-group { margin: 0; }
.app-nav-menu-group > summary.app-nav-menu-section {
    cursor: pointer;
    user-select: none;
    list-style: none;       /* hide native disclosure triangle (most browsers) */
    display: flex;
    align-items: center;
    gap: 6px;
}
.app-nav-menu-group > summary.app-nav-menu-section::-webkit-details-marker {
    display: none;          /* WebKit fallback */
}
.app-nav-menu-group > summary.app-nav-menu-section::before {
    content: "›";
    font-size: var(--fs-12, 12px);
    line-height: 1;
    color: var(--text-secondary, #6b7280);
    transition: transform 0.12s ease;
}
.app-nav-menu-group[open] > summary.app-nav-menu-section::before {
    transform: rotate(90deg);
}
/* First-section rounded corners stayed on the original first-child rule,
   but the wrapper <details> is now the first child — re-apply on the
   nested <summary>. */
.app-nav-menu-group:first-of-type > summary.app-nav-menu-section {
    margin-top: -6px;
    border-radius: 10px 10px 0 0;
}

/* Mobile — a single row can't hold logo + nav + the full actions cluster, so
   deliberately wrap into two rows: row 1 is logo + actions (search / Admin /
   help / user), row 2 is the primary nav full-width beneath. This is the only
   width at which the header is intentionally multi-row. */
@media (max-width: 640px) {
    .app-header {
        flex-wrap: wrap;
        padding-left: var(--space-4);
        padding-right: var(--space-4);
        column-gap: var(--space-4);
    }
    .app-header-logo { order: 1; }
    .app-header-actions { order: 2; flex: 0 0 auto; margin-left: auto; gap: var(--space-1); }
    .app-header-nav { order: 3; flex-basis: 100%; }
    /* initPriorityNav() adds .is-priority regardless of viewport (it only
       reacts to overflow, not screen width), which would otherwise force
       flex-wrap: nowrap here and fight the two-row mobile layout above —
       the nav needs to wrap on its own row, not overflow into "More". */
    .app-header-nav.is-priority { flex-wrap: wrap; overflow: visible; }
    .app-nav-link { padding: 6px 10px; }
}

/* ── Standard page shell ─────────────────────────────────────────────
   Shared layout container for pages that extend base.html. Matches the
   dashboard's `.main` dimensions so /dashboard, /marketplace, and the
   marketplace detail pages all align. Add `page-shell` to a page's root
   wrapper to opt in. */


/* ==============================================================
   News content vocabulary (shared)
   --------------------------------------------------------------
   Used by: /news (full content), /home (perex slot via .home-news-body),
            /admin/news preview pane.

   Author classes documented in docs/operator/news-content-guide.md:
     .news-hero, .callout, .callout-{info,warn,success,danger},
     .video-embed, .news-section, .news-grid-2, .news-grid-3, .news-cta.

   Selectors are scope-free where the class itself is the marker
   (.callout, .news-hero, .video-embed, .news-grid-*, .news-cta) so
   authors can drop them anywhere — /home perex, /news body,
   /admin/news preview, future admin pages.

   The table / pre / code overrides ARE scoped to .news-content because
   `<table>` / `<pre>` / inline `<code>` exist on plenty of other pages
   that should not inherit this styling.
   ============================================================== */

/* Callouts — boxed inline notice with colored left border. */
.callout {
    border-left: 4px solid var(--primary);
    background: var(--primary-light);
    color: #111827;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 12px 0;
}
.callout-info    { border-left-color: var(--primary); background: var(--primary-light); }
/* warn/success/danger backgrounds ride the --ds-accent-* family (dark-theme
   safe) instead of raw hex; ink flips alongside so the pair stays readable
   under dark (#1625) — the border-left accent stays the pre-existing literal,
   it is decorative and not a text/background contrast pair. */
.callout-warn    { border-left-color: #C2410C; background: var(--ds-accent-warn-bg); color: var(--ds-accent-warn-ink); }
.callout-success { border-left-color: #047857; background: var(--ds-accent-success-bg); color: var(--ds-accent-success-ink); }
.callout-danger  { border-left-color: #B91C1C; background: var(--ds-accent-danger-bg); color: var(--ds-accent-danger-ink); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child  { margin-bottom: 0; }

/* 16:9 wrapper for YouTube/Vimeo/Loom iframes. */
.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    margin: 14px 0;
    background: black;
}
.video-embed iframe,
.video-embed video,
.video-embed a {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}
.video-embed a {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: underline;
}

/* Section divider — subtle top margin to separate topics. */
.news-section { margin-top: 28px; }
.news-section:first-child { margin-top: 0; }

/* 2- / 3-column responsive grids. */
.news-grid-2,
.news-grid-3 {
    display: grid;
    gap: 16px;
    margin: 12px 0;
}
.news-grid-2 { grid-template-columns: repeat(2, 1fr); }
.news-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) {
    .news-grid-2,
    .news-grid-3 { grid-template-columns: 1fr; }
}

/* Anchor styled as primary button. */
a.news-cta {
    display: inline-block;
    background: var(--primary);
    color: white !important;       /* override link colors on /home */
    text-decoration: none !important;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: var(--fs-14, 14px);
    font-weight: var(--fw-500, 500);
    margin: 8px 0;
    transition: background 120ms ease;
}
a.news-cta:hover { background: #0056A3; }

/* --- .news-content scope: tables, code, pre, blockquote, headings ---
   Anything inside the long-form body needs these refinements; they
   would over-style chrome elsewhere on the site so we scope them. */

/* Every color below is a --ds-* token (#1625): .news-content renders inside
   .news-card, whose background is var(--surface) and DOES flip under dark
   theme, so a literal ink here (e.g. the previous `color: #111827`) went
   invisible the moment the card flipped — measured at 1.16:1 on the dark
   surface, the exact bug class this file is being swept for. */
.news-content { font-size: var(--fs-15, 15px); line-height: 1.6; color: var(--ds-text-primary); }
.news-content h1 { font-size: var(--fs-24, 24px); margin: 24px 0 12px; line-height: 1.25; }
.news-content h2 { font-size: var(--fs-20, 20px); margin: 22px 0 10px; line-height: 1.3; }
.news-content h3 { font-size: var(--fs-17, 17px); margin: 18px 0 8px; }
.news-content p  { margin: 0 0 12px; }
.news-content ul,
.news-content ol { margin: 0 0 12px 24px; }
.news-content li { margin: 4px 0; }
.news-content blockquote {
    border-left: 4px solid var(--ds-border);
    padding: 6px 16px;
    margin: 14px 0;
    color: var(--ds-text-secondary);
    font-style: italic;
    background: var(--ds-surface-dim);
    border-radius: 0 6px 6px 0;
}

/* Code: inline = light gray pill; block = dark navy with amber text.
   The :not(pre code) split keeps inline code from overriding the
   pre>code dark scheme — earlier versions had pre>code inheriting
   the light background from the inline rule, producing the
   "yellow-on-silver" unreadable combo. */
.news-content code {
    background: var(--ds-surface-dim);
    color: var(--ds-text-primary);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: var(--fs-13, 13px);
}
/* .news-content pre stays a deliberate always-dark code panel (like the
   /home terminal mock) — navy bg + amber ink, legible under every theme
   without flipping, so it is not part of the #1625 sweep. */
.news-content pre {
    background: #0F172A;
    color: #FBBF24;
    padding: 14px 18px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 14px 0;
    line-height: 1.55;
}
.news-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: var(--fs-13, 13px);
    border-radius: 0;
}

/* Tables: border-collapse, header band, zebra rows on hover, compact
   padding. Authors get a presentable default without writing custom
   classes; .news-grid-2 / .news-grid-3 covers the layout-grid use case. */
.news-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: var(--fs-14, 14px);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 8px;
    overflow: hidden;
}
.news-content thead { background: var(--ds-surface-dim); }
.news-content th {
    text-align: left;
    padding: 10px 14px;
    font-weight: var(--fw-600, 600);
    color: var(--ds-text-secondary);
    border-bottom: 1px solid var(--ds-border);
}
.news-content td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ds-border-light);
    vertical-align: top;
}
.news-content tbody tr:last-child td { border-bottom: none; }
.news-content tbody tr:hover { background: var(--ds-state-hover); }
.news-content table code {
    /* Same tint as the inline-code pill above — the original's slightly
       lighter #EEF2F7 vs #F3F4F6 was a marginal, unintentional-looking
       difference not worth a second token. */
    background: var(--ds-surface-dim);
}

/* Reusable hero block — blue gradient, eyebrow + title + lead.
   Defined AFTER the .news-content overrides so its `color: white` on
   nested headings wins source-order ties (both selectors share
   specificity 0,1,1 since they're "one class + one type"). Authors
   drop `<section class="news-hero">` anywhere — /home perex, /news
   body, /admin/news preview. */
.news-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #0056A3 100%);
    color: white;
    border-radius: 16px;
    padding: 28px 32px;
    margin: 18px 0;
    box-shadow: 0 8px 24px rgba(31, 138, 94, 0.18);
}
.news-hero .eyebrow {
    font-size: var(--fs-11, 11px);
    font-weight: var(--fw-600, 600);
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.8px);
    opacity: 0.85;
    margin-bottom: 10px;
    color: white;
}
.news-hero h1,
.news-hero h2,
.news-hero h3 {
    color: white;
    margin: 0 0 8px;
    font-weight: var(--fw-600, 600);
    line-height: 1.25;
}
.news-hero h1 { font-size: var(--fs-26, 26px); letter-spacing: -0.4px; }
.news-hero h2 { font-size: var(--fs-20, 20px); }
.news-hero h3 { font-size: var(--fs-17, 17px); }
.news-hero .lead,
.news-hero p {
    font-size: var(--fs-15, 15px);
    opacity: 0.94;
    line-height: 1.55;
    margin: 0;
    color: white;
}
.news-hero a {
    color: #FBBF24;
    text-decoration: underline;
}
.news-hero code {
    background: rgba(15, 23, 42, 0.55);
    color: #FBBF24;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: var(--fs-12-5, 12.5px);
}

/* /home perex slot: the same callout / video-embed / hero classes
   work inside .home-news-body without selector duplication, since the
   rules above don't depend on a parent. The home-specific chrome
   (margin, header strip) lives in home_not_onboarded.html. */


/* ==============================================================
   Marketplace format guide page (/marketplace/format-guide).
   Renders curator-facing markdown via markdown-it-py; the rules
   below scope the document chrome to .format-guide so we don't
   override <h1>/<pre>/<table> styling on other pages. Dark <pre>
   matches the JSON snippets the guide includes.
   ============================================================== */
.format-guide {
    max-width: 880px;
    margin: 0 auto;
    padding: 0;
    line-height: 1.55;
}
.format-guide h1 {
    font-size: var(--fs-28, 28px); font-weight: var(--fw-700, 700);
    margin: 0 0 8px;
    color: var(--text-primary, #111827);
}
.format-guide .lead {
    font-size: var(--fs-15, 15px); color: var(--ds-text-secondary);
    margin-bottom: 32px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.format-guide h2 {
    font-size: var(--fs-20, 20px); font-weight: var(--fw-600, 600);
    margin: 32px 0 12px;
    color: var(--text-primary, #111827);
}
.format-guide h3 {
    font-size: var(--fs-16, 16px); font-weight: var(--fw-600, 600);
    margin: 24px 0 8px;
    color: var(--text-primary, #111827);
}
.format-guide p {
    margin: 0 0 12px;
    color: var(--text-primary, #111827);
}
.format-guide a { color: var(--primary, #6366f1); text-decoration: none; }
.format-guide a:hover { text-decoration: underline; }
.format-guide code {
    background: var(--surface-alt, #f3f4f6);
    padding: 2px 6px; border-radius: 4px;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: var(--fs-13, 13px);
}
.format-guide pre {
    background: #0f172a; color: #e2e8f0;
    padding: 16px; border-radius: 8px; overflow-x: auto;
    font-size: var(--fs-13, 13px);
    font-family: var(--font-mono, ui-monospace, monospace);
    line-height: 1.5;
}
.format-guide pre code { background: none; color: inherit; padding: 0; }
.format-guide table {
    width: 100%; border-collapse: collapse;
    margin: 12px 0 20px;
    font-size: var(--fs-13-5, 13.5px);
}
.format-guide th, .format-guide td {
    text-align: left; padding: 8px 12px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}
.format-guide thead th {
    background: var(--ds-surface);
    font-weight: var(--fw-500, 500); font-size: var(--fs-12, 12px); line-height: 16px;
    color: var(--ds-text-muted);
}
.format-guide ul, .format-guide ol {
    margin: 0 0 12px; padding-left: 24px;
}
.format-guide li { margin-bottom: 6px; }
.format-guide blockquote {
    border-left: 3px solid var(--primary, #6366f1);
    margin: 12px 0; padding: 4px 12px;
    background: var(--surface-alt, #f9fafb);
    border-radius: 0 8px 8px 0;
}
.format-guide .back-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: var(--text-secondary, #6b7280);
    font-size: var(--fs-13, 13px);
    margin-bottom: 16px;
}
.format-guide .back-link:hover { color: var(--primary, #6366f1); }

/* =====================================================
   Canonical button family (Task 4)
   .btn + .btn-primary | .btn-secondary | .btn-ghost | .btn-danger
                       + .btn-sm | .btn-lg

   Base .btn, .btn-primary, .btn-secondary, .btn-sm come from the
   absorbed style.css block above (no change needed — they already use
   the new tokens via the legacy-alias layer). This section appends
   selector-list aliases for legacy class names (   .btn-secondary-v2, .btn-ghost-v2, .modal-btn) and defines the new
   variants (.btn-ghost, .btn-danger, .btn-lg) that the legacy stylesheet
   didn't ship.

   Aliases removed in Task 16 once templates migrate to canonical names.
   Cascade-order note: this section is the LAST in the file, so it wins
   over both the absorbed legacy rules AND any earlier v2-suffixed rules
   (e.g. .btn-primary-v2 hover color in the absorbed block). Adding
   per-page <style> overrides will still beat this on equal-specificity
   selectors due to source order — Tasks 8–14 strip those.
   ===================================================== */

.btn-primary {
    background-color: var(--ds-action);
    color: var(--ds-primary-ink);
    border: 1px solid var(--ds-action);
    transition: all 0.15s ease;
}
.btn-primary:hover,
.btn-primary-v2:hover {
    background-color: var(--ds-primary-hover, var(--ds-primary-dark));
    border-color: var(--ds-primary-hover, var(--ds-primary-dark));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--ds-action) 30%, transparent);
}

.btn-secondary {
    background-color: var(--ds-primary-tint);
    color: var(--ds-action);
    border-width: 1px;
    border-style: solid;
    border-color: transparent;
}
.btn-secondary:hover,
.btn-secondary-v2:hover {
    background: color-mix(in srgb, var(--ds-primary) 16%, transparent);
    color: var(--ds-primary-dark, var(--ds-primary));
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.btn-ghost:hover,
.btn-ghost-v2:hover {
    background-color: var(--ds-state-hover);
    color: var(--text-primary);
}

/* When the ds.button macro composes variant='ghost' with klass='btn-link'
 * (the 3 auth pages — login_email, password_reset, password_setup —
 * use this combo for "Forgot Password?" / "Back to Login" affordances
 * that should look like links, not buttons), the cascade default would
 * let .btn-ghost (defined later in this file) override .btn-link's
 * blue with text-secondary grey. Boost specificity (0,0,3,0 beats the
 * single-class rules above) to keep the link color in that case.
 * Devin review on PR #375 flagged this contrast regression. */
.btn.btn-ghost.btn-link {
    color: var(--primary);
}
.btn.btn-ghost.btn-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
    background-color: transparent;
}

.btn-danger {
    background-color: var(--surface);
    color: var(--error);
    border: 1px solid var(--error);
}
.btn-danger:hover {
    background-color: var(--error);
    color: #fff;
}

/* `.btn-warning` removed — the single use in admin_marketplaces.html
   (system-confirm modal Confirm button) was destructive in spirit (fans
   out a forced grant to every principal) and now renders via .btn-danger.
   The 4 canonical variants (primary / secondary / ghost / danger) cover
   every honest CTA without inventing a 5th amber-fill axis. */

.btn-required {
    background: var(--ds-accent-warn-bg);
    color: var(--ds-accent-warn-ink);
    border: 1px solid var(--ds-accent-warn-line);
    cursor: not-allowed;
}

.btn-lg { padding: 12px 20px; font-size: var(--text-md); }

/* `:disabled` is enough for a <button> — the browser refuses the activation
   itself. `[aria-disabled]` is ADVISORY: it tells a screen reader the control
   is off and stops nothing, so an <a class="btn"> painted at half opacity
   still navigates on click. `pointer-events: none` is what makes the two
   spellings mean the same thing, which is the whole point of them sharing a
   rule. Pair it with `tabindex="-1"` at the call site (as `ds.button` does)
   so the keyboard cannot reach what the pointer cannot. */
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-disabled="true"] { pointer-events: none; }

.btn:focus { outline: none; }
.btn:focus-visible { outline: var(--ds-focus-outline); outline-offset: var(--ds-focus-outline-offset); }
.btn-primary:focus-visible {
    outline: var(--ds-focus-outline);
    outline-offset: var(--ds-focus-outline-offset);
}

@media (max-width: 640px) {
    :is(
        input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"],
                  [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"]),
        textarea,
        select
    ) {
        font-size: var(--fs-16, 16px) !important;
    }
}

/* =====================================================
   Canonical form controls (Task 5)
   .search-input | .filter-bar | .filter-pill | .form-input

   Selector-list aliases for legacy per-page classes (   .marketplaces-search, .kb-search, .filters-card, .pill) so existing
   markup keeps rendering until migration tasks swap them out.
   ===================================================== */

.filter-bar input[type="search"],
.filter-bar input[type="text"],
.filter-bar select {
    height: 36px;
    padding: 0 var(--space-3);
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.filter-bar input::placeholder { color: var(--text-muted); }

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 var(--space-3);
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    text-decoration: none;
}

.filter-pill:hover {
    background: var(--ds-state-hover);
    color: var(--text-primary);
}

.filter-pill.is-active,
.filter-pill[aria-pressed="true"] {
    background: var(--ds-state-selected-bg);
    color: var(--ds-state-selected-ink);
    border-color: transparent;
}

/* chip-input widget — set font on the container so the inner input's
   `font: inherit` inline style picks up the right value */
.chip-input {
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    color: var(--text-primary);
}

/* =====================================================
   Page-header primitive (Task 6)
   .page-header + __main / __title / __subtitle / __actions / __eyebrow
   + variants: .page-header--hero | .page-header--compact
   + .tab-strip (paired tab row for marketplace tabs etc.)
   ===================================================== */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin: var(--space-6) 0 var(--space-5);
    flex-wrap: wrap;
}

.page-header__main { min-width: 0; flex: 1 1 auto; }

.page-header__title {
    margin: 0;
    font-size: var(--fs-22, 22px);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    line-height: 1.2;
    overflow-wrap: break-word;
}

.page-header__subtitle {
    margin: var(--space-2) 0 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

.page-header__eyebrow {
    margin: 0 0 var(--space-1);
    font-size: var(--fs-12, 12px);
    line-height: 16px;
    font-weight: var(--font-medium);
    color: var(--ds-text-muted);
}

.page-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Plain variant — the INDEX-PAGE head: a name, a sentence, and nothing
   drawn around them.

   This is the treatment /library, /agents and /chats already run by hand
   (`.lib-head`, `.ag-head`, `.ch-head` — a 22–24px title over a muted
   lede capped at 68ch), lifted onto the shared primitive so a page can
   opt in with one variable (`page_hero_plain`) instead of a fourth
   private copy. The lede's own type scale is shared too — see
   `.page-lede` below, which those three heads now ride as well.

   Use it where the page is a WORKSPACE the reader stays in — a list they
   filter, a table they act on, a two-pane editor. A gradient (or, under
   paper, a bordered white card) around the title is chrome the reader
   scrolls past on every visit, and on a page whose body is already made of
   cards it puts a card above the cards. The hero variant below stays right
   where a page is a DESTINATION that has to introduce itself: /home, an
   install walkthrough, a marketing-adjacent surface.

   Only three declarations differ from the base primitive — the type scale,
   the measure, and the link colour (there is no global `a` rule, so an
   unstyled link in the lede renders as UA blue). Everything else is
   inherited, which is what keeps this from becoming a second header
   component: the theme's own `h1` rule still owns the weight and the
   tracking, exactly as it does for the three hand-built heads above. */
.page-header--plain {
    display: block;
    margin: 8px 0 0;
    /* Padding, not margin: the head's clearance must not collapse-adjoin a
       following notice or tab strip, both of which carry their own top
       edge. */
    padding: 0 0 22px;
}

/* ── The page title ───────────────────────────────────────────────────
   The other half of the head, on the same terms as `.page-lede` below:
   one size, named once, for the `<h1>` a page puts above its lede.

   22px — the /library size, the smaller of the two that were in the
   tree. It is chosen as a PAIR with the 13px lede rather than on its
   own: /library sized both together and the result is the head the rest
   of the app is being matched to. 24px was the majority (the plain
   header and every hand-built head but one) and is a one-line change
   here if that ever reverses.

   Only `margin` and `font-size` — weight, tracking and colour stay with
   the theme's own `h1` rule, the same division the plain variant above
   keeps. Layout a particular head needs (a flex row for a badge beside
   the name, `overflow-wrap` for a name that can be one long token)
   stays page-local: it is that page's anatomy, not the type scale. */
.page-header--plain .page-header__eyebrow {
    margin: 0 0 4px;
    font-size: var(--fs-12, 12px);
    font-weight: var(--fw-500, 500);
    line-height: 16px;
    color: var(--ds-text-muted);
}

.page-header--plain .page-header__title {
    margin: 0;
    font-size: var(--fs-22, 22px);
    line-height: 1.2;
}

/* ── The page lede ────────────────────────────────────────────────────
   ONE type scale for the sentence under a page title, wherever that
   sentence is written: the shared header's `page_hero_subtitle` on a
   plain-variant page, or a hand-built head's own `<p>`.

   It is the /library scale — 13px, muted, capped at 68ch — because a
   lede is orientation the reader needs once and then scrolls past on
   every later visit, and at body size it competed with the rows the
   page exists to show. It used to be three sizes: 15px `--ds-text-
   secondary` here, 15px in `.ag-head`/`.ch-head`, and — on any page
   that wrote a bare `<p class="lede">` with no rule behind it —
   whatever the UA gave a paragraph, which was the largest of the
   three.

   `.page-lede` is the one name — deliberately NOT an alias on the bare
   `.lede` the hand-built heads used to carry, because /home writes that
   same class for its marketing hero and would have been dragged down to
   13px muted with them. A page head opts in by name; nothing opts in by
   accident.

   No `font-weight`/`font-family` here — a lede inherits the body's, so
   a mid-page section lede that reaches for this class (e.g.
   /marketplace/guide) keeps whatever its section gives it. */
.page-header--plain .page-header__subtitle {
    margin: 4px 0 0;
    font-size: var(--fs-13, 13px);
    line-height: 1.45;
    color: var(--ds-text-muted);
    max-width: 68ch;
}
.page-header--plain a {
    color: var(--ds-primary-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.page-header--plain a:hover { color: var(--ds-accent-text); }

/* Tab strip — the secondary row pattern used by /marketplace?tab=… and
   similar tabbed pages.

   Its rules moved to css/components.css, where the flow variant (Data's
   pipeline) and the Library's strip could join them: four copies of one look
   had drifted onto two token sets, and this was the copy on the legacy ones
   (`--primary`, `--text-secondary`, `--border`), which is why People and
   Access did not match Data. Nothing here now — the selector is defined once,
   on --ds- tokens, in the global component sheet. */

/* =====================================================
   Data display + feedback primitives (Task 7)
   .data-table (+ --compact) | .empty-state | .toast | .stat-card

   Selector-list aliases for legacy per-page tables (   .gp-table, .marketplaces-table, .audit-table) so existing markup
   keeps rendering until migration tasks swap them out.
   ===================================================== */

.data-table,
.subs-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-variant-numeric: tabular-nums;
}

.data-table thead,
.subs-table thead {
    background: var(--ds-surface);
}

.data-table th,
.subs-table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--fs-12, 12px);
    line-height: 16px;
    font-weight: var(--font-medium);
    color: var(--ds-text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td,
.subs-table td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr:last-child td,
.subs-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover,
.subs-table tbody tr:hover {
    background: var(--ds-state-hover);
}

/* Compact modifier — for dense lists like /admin/activity (audit log). */
.data-table--compact th,
.data-table--compact td {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

/* =====================================================
   .empty-state — for "no records" / "no results" panels
   ===================================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
}

.empty-state__icon {
    font-size: var(--fs-32, 32px);
    opacity: 0.5;
    line-height: 1;
}

.empty-state__title {
    margin: 0;
    font-size: var(--text-md);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

.empty-state__description {
    margin: 0;
    max-width: 480px;
    font-size: var(--text-sm);
    line-height: 1.5;
}

.empty-state__actions {
    margin-top: var(--space-3);
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    justify-content: center;
}

/* =====================================================
   .toast — global notification surface
   Paired with window.appToast({kind, msg, timeout}) in app.js
   ===================================================== */

.toast-container {
    position: fixed;
    right: var(--space-5);
    bottom: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 9999;
    pointer-events: none;
}

/* Surface, border, radius, type and the icon layout come from
   `.notice--floating` (app.js composes both classes). What is left is what
   makes it a TOAST: it can be clicked away, it is capped so a long receipt
   wraps instead of spanning the window, and it has a floor so a two-word
   receipt is not a tiny chip. */
.toast {
    pointer-events: auto;
    min-width: 240px;
    max-width: 380px;
    margin: 0;
    cursor: pointer;
    animation: toast-in 200ms ease;
}

/* A receipt can be a sentence ("Loaded SKILL.md — filled in name and
   description"), so it wraps rather than clipping. */
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* Dismiss. Low-contrast until hovered — present, never louder than the
   message it sits beside. */
/* The dismiss control is styled with `.notice__x` above (one rule, both
   hooks). The four `border-left: 3px solid` tone stripes that used to sit
   here are gone with them: the stripe was this component's version of
   repainting per outcome, and the glyph says the same thing without turning
   a receipt into an alarm. */

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

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

/* ═══════════════════════════════════════════════════════════════════════
   Design-system additions driven by .interface-design/system.md
   ─────────────────────────────────────────────────────────────────────
   Net-new canonical class families consumed by the `ds.button`,
   `ds.panel`, `ds.tabs`, and `ds.table` macros in _components.html.
   Append-only; nothing above this block was modified. Order:
     1. `.btn--icon`           — icon-only square modifier
     2. `.ds-card` family      — canonical card/panel surface + accent
     3. `.ds-table` family     — canonical table + 15 legacy aliases
     4. `.badge--*` modifiers  — accent vocabulary for badges
     5. `.code-inline`         — mint inline-code chip
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Icon-only button modifier ────────────────────────────────────────
   Squares the button so an icon glyph (✕, ↡, etc.) sits centred without
   the default 10×20 padding making it rectangular. Composes with any
   .btn-* variant: `.btn .btn-ghost .btn--icon .btn-sm`. */
.btn--icon {
    width: 32px;
    height: 32px;
    padding: 0;
    flex-shrink: 0;
}
.btn--icon.btn-sm { width: 28px; height: 28px; }

/* ─── Tables — canonical .ds-table family ─────────────────────────────
   `.ds-table`            border-collapse, 1px row borders, 8px radius
                          on the wrapping border, sticky header,
                          `--ds-surface-dim` row hover (matches button
                          hover), tabular-nums.
   `.ds-table--dense`     reduced cell padding for reference tables.
   `.ds-table--zebra`     optional row striping for long lists.
   `td.num` / `th.num`    right-aligned monospace column.
   Legacy aliases below   so admin pages can keep their existing class
                          names while inheriting the canonical look. */
.ds-table,
:is(.data-table, .subs-table, .versions) {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-variant-numeric: tabular-nums;
}
.ds-table thead th,
:is(.data-table, .subs-table, .versions) thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    padding: var(--space-3) var(--space-4);
    background: var(--ds-surface);
    border-bottom: 1px solid var(--ds-border);
    font-weight: var(--font-medium);
    color: var(--ds-text-muted);
    font-size: var(--fs-12, 12px);
    line-height: 16px;
    white-space: nowrap;
}
.ds-table tbody td,
:is(.data-table, .subs-table, .versions) tbody td {
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    color: var(--ds-text-primary);
}
.ds-table tbody tr:last-child td,
:is(.data-table, .subs-table, .versions) tbody tr:last-child td {
    border-bottom: none;
}
.ds-table tbody tr:hover,
:is(.data-table, .subs-table, .versions) tbody tr:hover {
    background: var(--ds-state-hover);
}
.ds-table th.num,
.ds-table td.num,
:is(.data-table, .subs-table, .versions) th.num,
:is(.data-table, .subs-table, .versions) td.num {
    text-align: right;
    font-family: var(--ds-font-mono);
    font-variant-numeric: tabular-nums;
}

.data-table--compact thead th { padding: var(--space-1) var(--space-3); }
.data-table--compact tbody td  { padding: 6px var(--space-3); }

/* `.data-table-wrap` — the wrapper ten admin pages put around a `.data-table`
   (semantic sources, users, sync, marketplaces, mcp_sources,
   knowledge_digests, linked_apps, initial_workspace, data_apps, tables) so a
   wide/many-column table scrolls horizontally instead of taking the whole
   page with it. No CSS rule ever backed the class (#1707 A6), so the
   overflow silently landed on the page instead of the table.
   `admin_tables.html` is the odd one out: its wrap holds a JS-hydrated
   layout host (`#adminTablesLayoutRows`), not a literal `<table
   class="data-table">` markup — the hydrator injects one once
   `/api/admin/registry` resolves. It still gets `overflow-x: auto` for
   free from this same rule once that happens.

   Decision (PR #1823 review): overflow-x: auto makes overflow-y compute to
   auto too, which turns the wrap into a NEW scrolling ancestor closer than
   the viewport — so `.data-table thead th`'s `position: sticky` (below)
   would silently re-target that ancestor instead. The wrap is never given a
   height cap, so it never actually scrolls vertically, meaning the header
   would stop sticking at all instead of degrading gracefully, and the same
   ancestor change is what triggers the well-known "rounded corners vanish
   under a stuck thead" clipping bug the `.cloud-chat-table-wrap` recipe in
   chat.css works around for its own tables. Rather than adopt that recipe's
   border-transfer here too (all ten pages would need touching, and
   `admin_tables.html`'s wrap would gain a border around its
   `#adminTablesLayoutRows` "Loading tables…" placeholder even before a
   real table exists inside it — a visual change out of scope for this
   fix), sticky is disabled outright for any thead wrapped in
   `.data-table-wrap`: an unambiguous "off" instead of a silently
   non-functional "on". A bounded,
   internally-scrolling table with real in-wrap sticky is a legitimate
   follow-up for a page that wants it, not a rule that belongs on every
   consumer of this class today. */
.data-table-wrap {
    overflow-x: auto;
    position: relative;
    /* A visible scrollbar, not an overlay one. `auto` still means "only when
       it overflows", so a table that fits draws nothing — but the ones that
       DO overflow had no affordance at all on macOS, where the overlay bar is
       painted only while the pointer is already scrolling. On Marketplaces
       that hid the row's own verbs (Sync now / Details / Edit) past the right
       edge with nothing on screen to say they were there (#1956 item 8).

       Deliberately NOT paired with the standard `scrollbar-width` /
       `scrollbar-color`: Chrome honours one model or the other, and setting
       `scrollbar-width` makes it drop these `::-webkit-*` rules and go back
       to an overlay bar, which is the bug. Firefox and the rest fall through
       to their own always-visible default. */
}
.data-table-wrap::-webkit-scrollbar { height: 8px; }
.data-table-wrap::-webkit-scrollbar-track { background: transparent; }
.data-table-wrap::-webkit-scrollbar-thumb {
    background: var(--ds-border);
    border-radius: 4px;
}
.data-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--ds-text-disabled); }
.data-table-wrap:focus-visible {
    outline: var(--ds-focus-outline);
    outline-offset: calc(-1 * var(--ds-focus-outline-offset));
}

/* Firefox gets the same affordance through the STANDARD properties, gated so
   Chrome never sees them. The note above is right that pairing the two
   unconditionally is a regression — Chrome honours one model or the other and
   `scrollbar-width` makes it drop the `::-webkit-*` rules for an overlay bar.
   It is wrong that Firefox falls through to an always-visible default: on
   macOS Firefox follows the OS "show scroll bars automatically" setting, so
   on a trackpad it paints an overlay bar too, and a table without pinned
   actions hides columns with nothing on screen to say so (Devin Review on
   #1989).

   `@supports not selector(::-webkit-scrollbar)` is the discriminator: engines
   that implement the pseudo-element skip this block entirely and keep the
   rules above, and the ones that do not — Firefox — get the standard pair. */
@supports not selector(::-webkit-scrollbar) {
    .data-table-wrap {
        scrollbar-width: thin;
        scrollbar-color: var(--ds-border) transparent;
    }
}
.data-table-wrap thead th {
    position: static;
}

/* ── "There is more this way" — the cue AT the cut ────────────────────────
   The scrollbar above is an affordance in the wrong PLACE: it sits under the
   last row, so on a twelve-row table it is 400px below the reader's eye and
   on a long one it is off-screen. A table cut mid-column then looks
   complete — /admin/data-packages at a 900px window simply had no "Shared
   with", with nothing near the cut to say one had been taken away.

   `js/table_scroll_cue.js` sets `is-cue-left` / `is-cue-right` on the wrap
   for whichever side still has content behind it (globally, no page opt-in);
   these rules are what those classes draw. Two mechanisms, because the two
   edges are not symmetrical:

   * the LEFT edge, and the right edge of a table with no pinned column, get
     a fade — the mask is in the wrap's own box coordinates, so it stays at
     the edge while the content scrolls under it, and it needs no extra
     element inside a scroll container (where an absolutely-positioned one
     would scroll away and a sticky pseudo-element is not reliable);
   * a table WITH `.data-table--pinned-actions` must not fade its right edge:
     that is where the pin holds the row's verbs, and a mask applies to
     sticky children too — it would fade out exactly the button the pin
     exists to keep. That side gets a shadow under the pinned column instead,
     which is the same statement ("something is hidden beneath this") in the
     one form that leaves the button legible.

   One mask declaration driven by two custom properties rather than four
   selector combinations: a side that is not cut resolves to `0px`, which
   puts both of that side's colour stops at the same offset and draws no
   fade. The selector still excludes a pinned table's right-only state
   outright, so a wrap with nothing to fade carries no mask — and no
   compositing layer — rather than an inert one. */
.data-table-wrap {
    --dtw-fade-left: 0px;
    --dtw-fade-right: 0px;
}
.data-table-wrap.is-cue-left { --dtw-fade-left: 56px; }
.data-table-wrap.is-cue-right:not(:has(.data-table--pinned-actions)) {
    --dtw-fade-right: 56px;
}
.data-table-wrap.is-cue-left,
.data-table-wrap.is-cue-right:not(:has(.data-table--pinned-actions)) {
    -webkit-mask-image: linear-gradient(to right,
        transparent 0, black var(--dtw-fade-left),
        black calc(100% - var(--dtw-fade-right)), transparent 100%);
            mask-image: linear-gradient(to right,
        transparent 0, black var(--dtw-fade-left),
        black calc(100% - var(--dtw-fade-right)), transparent 100%);
}

/* ── The pinned column's own cue, at the weight a frozen pane wants ──────
   Three passes got this wrong in both directions, so the reasoning is worth
   keeping. A `-8px` spread against a 12px blur painted a ~4px feather nobody
   could see. Answering that with 42% ink and a 34% border painted a grey
   slab down the middle of a white table — heavier than every rule and
   divider around it, which is not "visible", it is loud.

   What a frozen column wants is PRECISION, not weight: one crisp hairline
   at a step above the table's own dividers, and a narrow, soft shading to
   its right so the edge reads as an edge rather than another cell border.
   The tones sit between `--ds-border` and `--ds-text-muted` — visible
   against surface at any width, quiet enough that the eye goes to the rows.

   The inset layer is the one that always works: the outer shadow and the
   slide-under band below both paint over the NEIGHBOURING column, so they
   are only as visible as whatever is in it, and the width this was reported
   from had Category next door — "—" and one short word per row, i.e. white
   fading into white. Inset paints on the pinned column's own background, so
   it survives a blank neighbour. It is narrow (6px) and light on purpose:
   its job is to define the edge, not to shade the column. */
.data-table-wrap.is-cue-right .data-table--pinned-actions tbody td:last-child:not([colspan]),
.data-table-wrap.is-cue-right .data-table--pinned-actions thead th:last-child {
    box-shadow:
        inset 6px 0 6px -6px color-mix(in srgb, var(--ds-text-muted) 26%, transparent),
        -8px 0 10px -8px color-mix(in srgb, var(--ds-shadow-color) 14%, transparent);
    /* One step above the table's own dividers — enough to read as the edge
       of a frozen pane, not enough to compete with the header rule. */
    border-left-color: color-mix(in srgb, var(--ds-text-muted) 42%, transparent);
}

/* The slide-under band — the pretty half, where there is content to fade.
   A shadow says "raised", which a reader can take for one more piece of
   chrome; what says "the table continues beneath this" is seeing the
   neighbouring column's text DISSOLVE into the pinned column's own
   background, the way a frozen column reads in a spreadsheet. It is not
   sufficient on its own — a blank neighbour has nothing to dissolve, which
   is what the edge above is for — but where there IS text it is the part
   that reads as designed rather than as an effect.

   It has to be a pseudo-element on the pinned cell rather than a mask on the
   wrap: a mask would take the button with it (see the note above the
   `is-cue-*` mask rules). The cell is `position: sticky`, which is a
   positioned box, so `right: 100%` parks the band immediately to its left
   and it travels with the pin — down every row, at whatever scroll offset,
   which is the whole point when the scrollbar is a screen and a half below.

   `--dtw-pin-bg` is set beside each of the three background declarations
   above, so the band fades to the cell's ACTUAL colour in `thead`, at rest,
   and under the cursor — a band that guessed would show the guess as a seam
   the moment anyone hovered a row. */
.data-table-wrap.is-cue-right .data-table--pinned-actions tbody td:last-child:not([colspan])::before,
.data-table-wrap.is-cue-right .data-table--pinned-actions thead th:last-child::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 100%;
    width: 24px;
    background: linear-gradient(to left,
        var(--dtw-pin-bg, var(--ds-surface)),
        color-mix(in srgb, var(--dtw-pin-bg, var(--ds-surface)) 0%, transparent));
    /* Decoration only — the cell under it stays clickable. */
    pointer-events: none;
}

/* ── A pinned actions column — `.data-table--pinned-actions` ──────────────
   Opt-in, on the TABLE, for the admin tables whose last column is the row's
   own verbs (Sync now · Details · Edit, the `⋯` menu). Those are the one
   thing a reader cannot recover by scrolling to a different column: a
   destination has a header to scan back to, an action that is off-screen is
   simply unavailable, and on Marketplaces they were the first thing the
   overflow took (#1956 item 8).

   Sticky HORIZONTALLY only. The sibling rule above disables the sticky
   `thead` for everything in a `.data-table-wrap`, for the reason its own
   note gives — the wrap is an unbounded scroll container, so a vertically
   stuck header would silently re-target it and stop working. Nothing here
   revisits that: `right` binds to the wrap's horizontal axis, which is the
   one that actually scrolls, and `top` is never set.

   Opt-in rather than `td:last-child` everywhere, because "the last column"
   is a count, not a meaning — several of these tables end on a timestamp or
   a status, and pinning those would just narrow the table for nothing.

   The background is what makes it a pin instead of a transparent overlap, so
   it has to track the row's own: surface at rest, the shared hover tint on
   hover, and the header band in `thead`. The left hairline is deliberate and
   permanent — it marks the column as pinned, and a divider that appeared
   only once you had already scrolled would arrive after the moment it was
   needed. */
/* `clip`, not the `hidden` the base rule sets for the rounded corners.
   `overflow: hidden` gives the TABLE a scrolling box, and a sticky cell is
   constrained by the nearest ancestor that has one — so the cells below were
   `position: sticky` against a box that never scrolls, which is a no-op, and
   they rode off the right edge exactly as before. `clip` clips identically
   (the corners still work) but establishes no scrolling box, so the pin
   resolves against `.data-table-wrap`, the element that actually scrolls.
   A browser without `clip` drops this line, keeps `hidden`, and gets today's
   unpinned behaviour rather than a broken one. */
.data-table--pinned-actions { overflow: clip; }

/* `:not([colspan])` excludes the full-width cells these tables use for their
   own empty and loading states — "No matches for …", "Loading tables…". A
   `<td colspan="8">` is also a `td:last-child`, and while it cannot actually
   travel (its sticky rect is the row it already fills) it would still draw
   the pinned column's divider as a stray hairline down the left edge of every
   such row.

   `top: auto` because the reset above only ever overrode `position`: the
   canonical `.data-table th { top: 0 }` is still in the cascade, and
   re-establishing `position: sticky` here at a higher specificity would
   quietly re-arm the vertical stickiness that reset exists to prevent. It is
   inert only while no `.data-table-wrap` has a height cap — which is a fact
   about today, not a guarantee. */
.data-table--pinned-actions tbody td:last-child:not([colspan]),
.data-table--pinned-actions thead th:last-child {
    position: sticky;
    right: 0;
    top: auto;
    border-left: 1px solid var(--ds-border);
}
.data-table--pinned-actions tbody td:last-child:not([colspan]) {
    background: var(--ds-surface);
    --dtw-pin-bg: var(--ds-surface);
}
.data-table--pinned-actions thead th:last-child {
    background: var(--ds-surface);
    --dtw-pin-bg: var(--ds-surface);
}
.data-table--pinned-actions tbody tr:hover td:last-child:not([colspan]) {
    background: var(--ds-state-hover-solid);
    --dtw-pin-bg: var(--ds-state-hover-solid);
}

/* ─── Badges — accent vocabulary ──────────────────────────────────────
   The canonical .badge above gets neutral chrome (chip on
   `--ds-surface-dim`). These modifiers add the cross-pattern accent
   vocabulary so a "success" badge reads identically to a
   `.ds-card--success` accent and a `.flash-success`. */
.badge--info {
    background: var(--ds-accent-info-bg);
    color: var(--ds-accent-info-ink);
}
.badge--success {
    background: var(--ds-accent-success-bg);
    color: var(--ds-accent-success-ink);
}
.badge--warn {
    background: var(--ds-accent-warn-bg);
    color: var(--ds-accent-warn-ink);
}
.badge--danger {
    background: var(--ds-accent-danger-bg);
    color: var(--ds-accent-danger-ink);
}

.group-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
}
.group-row .group-name {
    font-size: var(--text-base);
    font-weight: var(--fw-600, 600);
    color: var(--text-primary);
    min-width: 0;
    flex: 0 1 auto;
}
.group-row .group-id {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    word-break: break-all;
    flex: 1 1 auto;
}
.grant-list, .group-roles-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.grant-row, .group-roles-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    flex-wrap: wrap;
}
.grant-row .grant-key, .group-roles-row .group-roles-name {
    font-family: var(--font-mono);
    font-size: var(--fs-13, 13px);
    font-weight: var(--fw-600, 600);
    color: var(--text-primary);
}
.group-roles-row .group-roles-name { font-family: var(--font-primary); }
.grant-row .grant-source {
    font-size: var(--fs-11-5, 11.5px);
    text-transform: var(--tt-label, uppercase);
    letter-spacing: var(--ls-label, 0.4px);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    background: rgba(107, 114, 128, 0.12);
    color: var(--text-secondary);
    font-weight: var(--fw-600, 600);
}
.grant-row .grant-source.source-direct { background: color-mix(in srgb, var(--ds-accent) 12%, transparent); color: var(--primary); }
.grant-row .grant-source.source-auto { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.grant-row .grant-meta {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-left: auto;
}
.group-roles-row .group-roles-arrow { color: var(--text-secondary); font-weight: var(--fw-400, 400); }
.empty-state {
    padding: 20px 0 4px;
    color: var(--text-secondary);
    font-size: var(--text-base);
    line-height: 1.55;
}
.empty-state .empty-title {
    font-weight: var(--fw-600, 600);
    color: var(--text-primary);
    margin-bottom: 4px;
}

/* Group chip — semantic role pill used on /me/profile and /admin/users.
   Name-match wins: Admin/Everyone keep their canonical color even when
   their server-side origin is google_sync.

   is-admin/is-everyone/is-google_sync ride the --ds-accent-* and
   --ds-border-light family (dark-theme safe, #1625). The base + is-custom violet pair is left
   as raw hex on purpose: no --ds-* token represents a neutral "other/custom
   group" violet without borrowing --ds-kind-agent (entity-kind semantic) or
   --ds-readonly (sharing-state semantic) — either would misattribute meaning.
   See the allowlist note in tests/test_design_system_contract.py. */
.group-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--fw-500, 500);
    background: #ede9fe;
    color: #6d28d9;
}
.group-chip.is-admin       { background: var(--ds-accent-warn-bg); color: var(--ds-accent-warn-ink); font-weight: var(--fw-600, 600); }
.group-chip.is-everyone    { background: var(--ds-border-light); color: var(--ds-text-secondary); }
.group-chip.is-google_sync { background: var(--ds-accent-success-bg); color: var(--ds-accent-success-ink); }
.group-chip.is-custom      { background: #ede9fe; color: #6d28d9; }

/* =====================================================
   .notice — the one inline-status component

   Three surfaces were saying the same kind of thing in three visual
   languages: a transcript note (fully tinted pill, centred text, coloured
   ink), an upload dialog's error slot (tinted box, coloured ink) and a toast
   (white card with a 3px coloured stripe). Same message, three looks, and all
   three read as an alarm because the TINT did the talking — a rate limit that
   clears itself arrived in the same saturated red as a crashed runner.

   One component instead, and the tone is carried by a 16px glyph, not by the
   surface. Nothing else changes between tones: same ground, same hairline,
   same ink. Only 5xx-class trouble gets a coloured glyph at all — the same
   rule the error pages follow.

   Two placements, because a floating element and an in-flow one have
   genuinely different jobs:
     .notice--inline    sits IN the content (transcript, dialog). Recessed
                        onto --ds-surface-dim so it reads as an aside rather
                        than as another message in the conversation.
     .notice--floating  sits OVER the content (toast). White and lifted, or
                        it looks like a hole in the page.

   Radius comes from --radius-* (style-custom.css): --ds-radius-md/-lg are NOT
   in the token set, and a var() to an undefined property with no fallback
   voids the whole declaration — the trap already documented on
   .cloud-chat-system-note and the agent dropdown.
   ===================================================== */
.notice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    /* Left padding is 2px lighter than the right to compensate for the 3px
       stripe, so the glyph sits the same distance from the edge as the
       dismiss control on the other side. */
    padding: 10px 12px 10px 10px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--ds-border);
    border-left: 3px solid var(--ds-border);
    background: var(--ds-surface-dim);
    font-size: var(--text-sm);
    line-height: 1.5;
    /* Body ink, never the tone's own ink. Coloured TEXT on a coloured ground
       is most of what made these read as alarms, and it is the part that
       costs legibility — the stripe, the tint and the glyph carry the tone
       between them without touching the sentence. */
    color: var(--ds-text-primary);
    text-align: left;
}
.notice--inline { margin: var(--space-2) 0; }
.notice--floating { box-shadow: var(--ds-shadow-md); }
/* The glyph. `currentColor` on the svg, so a tone only has to set `color`
   here — no per-tone fill to keep in step. margin-top optically seats a 16px
   square against a 1.5-line-height first line. */
.notice__icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    color: var(--ds-text-muted);
}
.notice__icon svg { display: block; width: 100%; height: 100%; }
.notice__msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* An action inside the note: the one control that resolves what the note
   says, for the cases where the sentence would otherwise ask the reader to
   type it. Seated on the FIRST line (`flex-start`, not centred) so a message
   that wraps to two lines does not drag the button down past the glyph it
   answers to. Styling is the global `.btn` — this rule only places it. */
.notice__action { flex-shrink: 0; align-self: flex-start; }
/* Dismiss: present, never louder than the message beside it. `.toast-x` is
   the same control under its established name (app.js sets it, and
   tests/test_web_studio.py pins it) — one rule, two hooks, rather than the
   two identical blocks that used to sit in this file. */
.toast-x {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0;
    margin: 1px 0 0;
    font: inherit;
    font-size: var(--fs-13, 13px);
    line-height: 1;
    color: var(--ds-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.toast-x:hover { color: var(--ds-text-primary); }
.toast-x:focus-visible { outline: var(--ds-focus-outline); outline-offset: 2px; }

/* Tone: a light ground, a stripe down the left edge, and the glyph. Three
   quiet signals instead of one loud one — the old version repainted the
   whole element in a saturated tint AND set the text in the matching ink,
   which is why a rate limit that clears itself looked like a crash.

   The surrounding hairline stays `--ds-border` in every tone, and only
   `border-left-color` is touched. Painting all four edges in a tone token
   does not survive the themes: `--ds-accent-danger-line` is the SOFT red in
   the light palette and the FULL one in dark, so a rule that reads well on
   paper drew a bright outline around the whole element on the dark theme —
   the exact loudness this component removes. A neutral hairline plus a
   coloured stripe reads the same in both. */
.notice.is-warn,
.notice.is-wait {
    background: var(--ds-accent-warn-bg);
    border-left-color: var(--ds-accent-warn-ink);
}
.notice.is-warn .notice__icon,
.notice.is-wait .notice__icon { color: var(--ds-accent-warn-ink); }

.notice.is-error {
    background: var(--ds-accent-danger-bg);
    border-left-color: var(--ds-accent-danger-ink);
}
.notice.is-error .notice__icon { color: var(--ds-accent-danger-ink); }

.notice.is-ok,
.notice.is-success {
    background: var(--ds-accent-success-bg);
    border-left-color: var(--ds-accent-success-ink);
}
.notice.is-ok .notice__icon,
.notice.is-success .notice__icon { color: var(--ds-accent-success-ink); }

.notice.is-info {
    background: var(--ds-accent-info-bg);
    border-left-color: var(--ds-accent-info-ink);
}
.notice.is-info .notice__icon { color: var(--ds-accent-info-ink); }

/* =====================================================================
   Modal — global structural styles (#497 §1).

   Promoted verbatim from the page-local <style> in admin_users.html so
   the shared modal helper (static/js/modal.js → window.confirmModal /
   alertModal / promptModal) renders correctly on EVERY page, not just
   the three admin pages that hand-rolled these rules. admin_users.html /
   admin_tokens.html / admin_marketplaces.html still ship identical
   page-local copies; those are redundant now but harmless (same rules)
   and can be stripped in a later cleanup pass.

   Buttons inside .modal-actions use the canonical .btn / .btn-* variants
   (via the ds.button macro or modal.js), so no .modal-btn rules here.
   ===================================================================== */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
    display: none; align-items: center; justify-content: center; z-index: 1000;
    padding: 16px;
}
.modal-backdrop.is-open { display: flex; }
.modal-card {
    background: var(--surface, #fff); border-radius: var(--ds-radius-2xl);
    padding: 24px; width: 100%; max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.modal-card h3 { margin: 0 0 6px; font-size: var(--fs-17, 17px); font-weight: var(--fw-600, 600); }
.modal-card p.sub { margin: 0 0 18px; font-size: var(--fs-13, 13px); color: var(--ds-text-secondary); }
.modal-card label { display: block; font-size: var(--fs-12, 12px); font-weight: var(--fw-500, 500); color: var(--ds-text-secondary); margin: 12px 0 6px; }
.modal-card input[type="text"], .modal-card input[type="email"], .modal-card input[type="password"], .modal-card select {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px; font-size: var(--fs-13, 13px); box-sizing: border-box;
    background: var(--surface, #fff); color: var(--text-primary, #111827);
}
.modal-card input:focus, .modal-card select:focus { outline: var(--ds-focus-outline); outline-offset: -1px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
/* Preserve newlines in helper-supplied messages — native alert/confirm/
   prompt rendered \n as line breaks (e.g. bulleted error lists).
   OPT-IN, via the attribute modal.js stamps on the cards it builds. The
   rule used to be unscoped, and the comment already knew that was wrong
   ("the page-local admin_users copy never needed this") — it just had no
   way to say so in a selector. Unscoped, it also hit STATIC modal copy in
   templates, where the newlines and indentation are source formatting: a
   helper paragraph written across three template lines rendered as three
   jaggedly-indented lines instead of one wrapped paragraph (#1171). */
.modal-card[data-preserve-newlines] h3,
.modal-card[data-preserve-newlines] p.sub { white-space: pre-wrap; }

/* --wide: a scrollable content card (e.g. the privacy popup) instead of a
   short confirm/alert/prompt dialog. Same backdrop/open mechanics, just a
   bigger, scrolling card with room for a dismiss button in the corner. */
.modal-card--wide {
    max-width: 620px; max-height: 82vh; overflow-y: auto; position: relative;
}
.modal-card__close {
    position: absolute; top: 14px; right: 14px; width: 28px; height: 28px;
    display: grid; place-items: center; border: none; background: transparent;
    color: var(--ds-text-muted); font-size: var(--fs-20, 20px); line-height: 1;
    cursor: pointer; border-radius: 6px;
}
.modal-card__close:hover { background: var(--ds-state-hover); }

/* Privacy content (_privacy_content.html) — shared by the bare /privacy
   page and the in-app popup (_privacy_modal.html). Lives here rather than
   in the partial's own <style> block because the partial now renders in
   the BODY of every chrome that carries the footer or the pre-auth popup;
   repo convention keeps page CSS out of the body. Colors ride --ds-*
   tokens only. */
.pv-eyebrow { font-size: var(--fs-12, 12px); font-weight: var(--fw-700, 700); letter-spacing: var(--ls-label, 0.06em); text-transform: var(--tt-label, uppercase); color: var(--ds-text-muted); margin: 0 0 6px; }
.pv-title { font-size: var(--fs-30, 30px); line-height: 1.2; margin: 0 0 14px; color: var(--ds-text-primary); }
.pv-lede { font-size: var(--fs-16, 16px); line-height: 1.6; color: var(--ds-text-secondary); margin: 0 0 26px; }
.pv-card { border: 1px solid var(--ds-border); border-radius: var(--ds-radius-card); background: var(--ds-surface); padding: 6px 18px; }
.pv-row { display: flex; gap: 12px; align-items: flex-start; padding: 15px 0; line-height: 1.6; color: var(--ds-text-secondary); }
.pv-row + .pv-row { border-top: 1px solid var(--ds-border); }
.pv-row strong { color: var(--ds-text-primary); }
.pv-mark { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-13, 13px); background: var(--ds-accent-success-bg); color: var(--ds-accent-success-ink); }
/* An arrow, not a tick: this row describes what DOES travel. */
.pv-mark.is-flow { background: var(--ds-info-bg); color: var(--ds-info-ink); }
.pv-code { background: var(--ds-surface-sunken); border: 1px solid var(--ds-border); border-radius: 4px; padding: 1px 6px; font-family: var(--ds-font-mono, monospace); font-size: var(--fs-13, 13px); }
.pv-note { margin-top: 30px; color: var(--ds-text-secondary); line-height: 1.65; }
.pv-h2 { font-size: var(--fs-17, 17px); margin: 0 0 8px; color: var(--ds-text-primary); }
.pv-note p { margin: 0 0 10px; }
.pv-page { padding: 56px 20px 72px; }
.pv-wrap { max-width: 68ch; margin: 0 auto; }
/* In the popup, the content sits inside .modal-card--wide's own padding —
   the bare /privacy page's .pv-wrap max-width/centering does not apply, so
   nothing here assumes a fixed reading width. */

/* Shared inline-icon glyphs (macros/_icon.html) — replaces the pictographic
   emoji we used to inline. Nudge the baseline so an icon sits centered next
   to heading/label text. Block-level empty-state icons ignore this. */
.ui-ico { vertical-align: -0.18em; }

@keyframes cld-agent-enter {
    0% {
        opacity: 0;
        transform: scale(0.4) rotate(-40deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.12) rotate(6deg);
    }
    100% {
        transform: scale(1) rotate(0);
    }
}

/* ---- The recompose ----
   Switching agents must not blink between two unrelated layouts. The orb and
   the composer never move; the four things that DO change — the name, the
   description, the reach line and the starters — settle together, lifting a
   few pixels as they arrive.

   A one-shot ANIMATION rather than a transition between two class states: a
   transition needs the start state painted before the end state, which means
   deferring the content into a frame callback, and `requestAnimationFrame`
   does not fire in a hidden tab. Content must never wait on an animation, so
   chat.js paints synchronously and restarts this with a reflow. */
@keyframes cldSettle {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: none; }
}

/* The hoverable shell `ds.button` puts around a DISABLED LINK. The anchor
   inside is `pointer-events: none` (that is what makes `aria-disabled` bite on
   an <a>), which also takes it out of hit-testing — so the reason the control
   is off has to live out here or it can never be shown. Inline-flex so the
   wrapper is exactly the button's own box and nothing shifts. */
.ds-disabled-wrap { display: inline-flex; }
