/* GENERATED by tools/css/build-css-bundles.mjs from suite.css: do not edit. Change the source files and
   run "node tools/css/build-css-bundles.mjs". This is the live portals (SiteScribe AI, BuildProof), linked by both index.html files; components/*.css is left out until a portal screen uses a tp- component.
   One request instead of suite.css and its imports. Files: base/reset.css, tokens/primitives.css, tokens/semantic.css, tokens/themes.css, tokens/components.css, legacy/portal.legacy.css, base/elements.css, base/a11y.css, patterns/landing.css, patterns/install-banner.css, utilities.css. */

@layer reset, tokens, vendor, legacy, base, layout, components, patterns, modules, utilities;

/* ---- base/reset.css ---- */
@layer reset {
/* Reset layer: the few document defaults every page of the suite starts from (docs/designs/design-system.md,
   section 3). Imported into layer(reset), the lowest layer, by suite.css, and inlined into both portals'
   index.html with the tokens and patterns/landing.css (tools/css/build-css-bundles.mjs), so the static
   landing paints on these defaults before the stylesheet bundle arrives. The legacy layer sets the same
   values, so nothing that renders today changes. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body { margin: 0; }
}

/* ---- tokens/primitives.css ---- */
@layer tokens {
/* Tier 1: primitive colours (docs/designs/design-system.md, section 2). Raw values only, named
   --tp-{ramp}-{step}; a higher step is darker. Components never read these: they read the roles in
   semantic.css, themes.css and components.css. Imported into layer(tokens) by suite.css and mirrored in
   Tokens/SuiteTokens.cs (tests/TechnoPulse.Ui.Tests/Tokens/TokenParityTests.cs compares the two). */

:where(:root) {
    /* Neutral */
    --tp-neutral-0: #FFFFFF;
    --tp-neutral-50: #F5F6F9;
    --tp-neutral-100: #EEF1F6;
    --tp-neutral-125: #EDEFF3;
    --tp-neutral-150: #E8EAF0;
    --tp-neutral-200: #DDE1E9;
    --tp-neutral-300: #C3C9D5;
    --tp-neutral-400: #9AA2B3;
    --tp-neutral-475: #7C869B;
    --tp-neutral-500: #7A8397;
    --tp-neutral-600: #5A6272;
    --tp-neutral-700: #3A4152;
    --tp-neutral-800: #2C3245;
    --tp-neutral-850: #24272E;
    --tp-neutral-900: #232838;
    --tp-neutral-950: #1B1F2B;
    --tp-neutral-1000: #12141B;
    --tp-neutral-black: #000000;
    --tp-neutral-ink: #1A1E28;

    /* Navy and amber (SiteScribe AI) */
    --tp-navy-700: #2E4372;
    --tp-navy-800: #24365C;
    --tp-navy-900: #16233F;
    --tp-amber-100: #FDEBCF;
    --tp-amber-400: #F5B547;
    --tp-amber-500: #F5A623;
    --tp-amber-800: #9A5B00;
    --tp-amber-900: #6B3F00;

    /* Teal, orange and teal-tinted neutrals (BuildProof). Orange 600 is the risk "High" fill. */
    --tp-teal-700: #186A87;
    --tp-teal-900: #0E4D64;
    --tp-teal-grey-50: #F4F7F7;
    --tp-teal-grey-900: #1F2C31;
    --tp-teal-grey-950: #182226;
    --tp-teal-grey-1000: #101719;
    --tp-orange-100: #FDE6D8;
    --tp-orange-300: #FF9F66;
    --tp-orange-500: #F26B1D;
    --tp-orange-600: #E8730A;
    --tp-orange-800: #A8470B;
    --tp-orange-900: #7A3200;

    /* Ink and indigo (the suite: TechnoPulse Projects) */
    --tp-ink-800: #1F2937;
    --tp-ink-900: #111827;
    --tp-indigo-50: #ECEEFC;
    --tp-indigo-300: #A5B0FF;
    --tp-indigo-400: #8491F7;
    --tp-indigo-600: #4353D9;
    --tp-indigo-700: #3A49C4;
    --tp-indigo-800: #2A36A8;

    /* Status: green (success), red (danger), yellow (warning), blue (info) */
    --tp-green-50: #E6F3E7;
    --tp-green-300: #81C784;
    --tp-green-600: #2E7D32;
    --tp-green-700: #1B6B2A;
    --tp-green-900: #0B4F16;
    --tp-green-950: #16321B;
    --tp-red-50: #FCEBE9;
    --tp-red-300: #F28B82;
    --tp-red-600: #C62828;
    --tp-red-700: #B3261E;
    --tp-red-900: #8E1111;
    --tp-red-950: #3A1B1A;
    --tp-yellow-50: #FFF1DE;
    --tp-yellow-200: #FFD08A;
    --tp-yellow-500: #E8A400;
    --tp-yellow-800: #7A4A00;
    --tp-yellow-900: #5C3A00;
    --tp-yellow-950: #3A2A10;
    --tp-blue-50: #E7F0FA;
    --tp-blue-300: #8AB4F8;
    --tp-blue-600: #1F6FB2;
    --tp-blue-700: #175A91;
    --tp-blue-900: #0B3F6E;
    --tp-blue-950: #14293D;
}
}

/* ---- tokens/semantic.css ---- */
@layer tokens {
/* Tier 2: semantic roles (docs/designs/design-system.md, sections 2 and 3). Components read these, the
   theme roles in themes.css and the component tokens in components.css; never the --tp-* primitives.

   Scopes. data-scheme="light|dark|sunlight" is set on <html> before first paint by the scheme script in
   each index.html (the gallery sets it on its story frame instead, under an <html> without one).
   data-theme="suite|sitescribe|buildproof" names a whole product and data-accent="suite|rams|qa" a module
   region inside one. Every selector here is wrapped in :where(), so every token declaration has zero
   specificity and the order of the blocks decides: light first, then dark, then sunlight.

   - Scale tokens are the same everywhere and are declared once, on the root.
   - Scheme colours are declared on the root, on [data-scheme] and on [data-theme] (a theme resets the
     tinted neutrals of an outer theme), and never on [data-accent]: an accent changes accent roles only.
   - A [data-theme] inside a dark or sunlight scope is matched by the descendant selectors below, so it
     takes that scheme's values. Scheme scopes do not nest: one per page.

   Mirrored in Tokens/SuiteTokens.cs; TokenParityTests resolves these files and compares. */

/* ---- scales ------------------------------------------------------------------------------------- */
:where(:root) {
    /* Type: rem, with a 12px floor; inputs never below --font-size-md. The system stack is kept. */
    --font-family-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --font-numeric-data: tabular-nums;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.75rem;
    --font-size-display: clamp(2rem, 7vw, 2.75rem);
    --line-height-tight: 1.2;
    --line-height-snug: 1.35;
    --line-height-normal: 1.5;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Space: a 4px grid. */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Radius: controls sm, cards md, sheets and dialogs lg. */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* Z layers. Dialogs, sheets, popovers and toasts use the browser's top layer and need none. */
    --z-raised: 1;
    --z-sticky: 100;
    --z-bar: 200;
    --z-chrome: 300;
    --z-tray: 400;
    --z-banner: 500;
    --z-fatal: 1000;

    /* Motion */
    --motion-duration-xs: 80ms;
    --motion-duration-sm: 150ms;
    --motion-duration-md: 200ms;
    --motion-duration-lg: 300ms;
    --motion-ease: cubic-bezier(0.2, 0, 0, 1);

    /* Breakpoints are for page layout only and cannot be custom properties in a media query:
       sm 480px, md 768px, lg 1024px, xl 1280px, 2xl 1536px (SuiteTokens.Breakpoints). Components use
       container queries. */

    /* Risk bands (identical to AiRams.Shared/Models/RiskBanding.cs, so screen and PDF agree) and RAG.
       Always shown with a label and a shape as well as the colour. */
    --color-risk-low: var(--tp-green-600);
    --color-on-risk-low: var(--tp-neutral-0);
    --color-risk-medium: var(--tp-yellow-500);
    --color-on-risk-medium: var(--tp-neutral-ink);
    --color-risk-high: var(--tp-orange-600);
    --color-on-risk-high: var(--tp-neutral-ink);
    --color-risk-very-high: var(--tp-red-600);
    --color-on-risk-very-high: var(--tp-neutral-0);
    --color-rag-red: var(--tp-red-600);
    --color-rag-amber: var(--tp-yellow-500);
    --color-rag-green: var(--tp-green-600);
    --color-rag-not-started: var(--tp-neutral-600);
    --color-rag-complete: var(--tp-blue-600);
}

@media (prefers-reduced-motion: reduce) {
    :where(:root) {
        --motion-duration-xs: 0ms;
        --motion-duration-sm: 0ms;
        --motion-duration-md: 0ms;
        --motion-duration-lg: 0ms;
    }
}

/* ---- light (the default) ------------------------------------------------------------------------- */
:where(:root, [data-scheme], [data-theme]) {
    color-scheme: light;
    --color-bg: var(--tp-neutral-50);
    --color-surface: var(--tp-neutral-0);
    --color-surface-2: var(--tp-neutral-100);
    --color-text: var(--tp-neutral-ink);
    --color-text-muted: var(--tp-neutral-600);
    --color-border: var(--tp-neutral-200);
    --color-border-strong: var(--tp-neutral-500);
    --border-width: 1px;
    --border-strong-width: 1px;
    --color-focus: var(--tp-blue-600);
    --color-focus-halo: transparent;
    --focus-width: 3px;

    --color-success-text: var(--tp-green-700);
    --color-success-subtle: var(--tp-green-50);
    --color-success-solid: var(--tp-green-600);
    --color-on-success-solid: var(--tp-neutral-0);
    --color-danger-text: var(--tp-red-700);
    --color-danger-subtle: var(--tp-red-50);
    --color-danger-solid: var(--tp-red-600);
    --color-on-danger-solid: var(--tp-neutral-0);
    --color-warning-text: var(--tp-yellow-800);
    --color-warning-subtle: var(--tp-yellow-50);
    --color-warning-solid: var(--tp-yellow-500);
    --color-on-warning-solid: var(--tp-neutral-ink);
    --color-info-text: var(--tp-blue-700);
    --color-info-subtle: var(--tp-blue-50);
    --color-info-solid: var(--tp-blue-600);
    --color-on-info-solid: var(--tp-neutral-0);

    /* Elevation: 0 border only, 1 card (today's --shadow), 2 sticky bar, 3 popover, 4 dialog. */
    --shadow-0: none;
    --shadow-1: 0 1px 2px rgba(22, 35, 63, 0.06), 0 4px 16px rgba(22, 35, 63, 0.06);
    --shadow-2: 0 -6px 18px rgba(0, 0, 0, 0.08);
    --shadow-3: 0 10px 30px rgba(0, 0, 0, 0.18);
    --shadow-4: 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* ---- dark ---------------------------------------------------------------------------------------- */
:where([data-scheme="dark"], [data-scheme="dark"] [data-theme]) {
    color-scheme: dark;
    --color-bg: var(--tp-neutral-1000);
    --color-surface: var(--tp-neutral-950);
    --color-surface-2: var(--tp-neutral-900);
    --color-text: var(--tp-neutral-150);
    --color-text-muted: var(--tp-neutral-400);
    --color-border: var(--tp-neutral-800);
    --color-border-strong: var(--tp-neutral-475);
    --color-focus: var(--tp-blue-300);

    --color-success-text: var(--tp-green-300);
    --color-success-subtle: var(--tp-green-950);
    --color-danger-text: var(--tp-red-300);
    --color-danger-subtle: var(--tp-red-950);
    --color-warning-text: var(--tp-yellow-200);
    --color-warning-subtle: var(--tp-yellow-950);
    --color-info-text: var(--tp-blue-300);
    --color-info-subtle: var(--tp-blue-950);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ---- sunlight: maximum contrast, 2px borders, no shadows ----------------------------------------- */
:where([data-scheme="sunlight"], [data-scheme="sunlight"] [data-theme]) {
    color-scheme: light;
    --color-bg: var(--tp-neutral-0);
    --color-surface: var(--tp-neutral-0);
    --color-surface-2: var(--tp-neutral-125);
    --color-text: var(--tp-neutral-black);
    --color-text-muted: var(--tp-neutral-850);
    --color-border: var(--tp-neutral-700);
    --color-border-strong: var(--tp-neutral-black);
    --border-width: 2px;
    --border-strong-width: 2px;
    --color-focus: var(--tp-neutral-black);
    --color-focus-halo: var(--tp-neutral-0);
    --focus-width: 4px;

    --color-success-text: var(--tp-green-900);
    --color-success-subtle: var(--tp-neutral-0);
    --color-success-solid: var(--tp-green-900);
    --color-danger-text: var(--tp-red-900);
    --color-danger-subtle: var(--tp-neutral-0);
    --color-danger-solid: var(--tp-red-900);
    --color-warning-text: var(--tp-yellow-900);
    --color-warning-subtle: var(--tp-neutral-0);
    --color-info-text: var(--tp-blue-900);
    --color-info-subtle: var(--tp-neutral-0);
    --color-info-solid: var(--tp-blue-900);

    --shadow-1: none;
    --shadow-2: none;
    --shadow-3: none;
    --shadow-4: none;
}
}

/* ---- tokens/themes.css ---- */
@layer tokens {
/* Product themes and module accents (docs/designs/design-system.md, section 2, "Themes and module accents").
   Read semantic.css first: the same scope rules and the same zero-specificity ordering apply.

   - data-theme on <html> names the product: chrome (--color-brand*), accent roles and, for BuildProof,
     tinted neutrals. No data-theme at all means the suite theme.
   - data-accent="suite|rams|qa" on a module region or nav item changes the accent roles only, so the
     portal can show SiteScribe amber (rams) or BuildProof orange (qa) actions inside indigo chrome.
     data-accent and data-theme are never put on the same element.
   - Scheme variants are explicit compound selectors: the element is, or is inside, a [data-scheme] scope
     and is itself a theme or accent scope. They come after the light blocks, so they win by order.

   Contrast (WCAG, computed): accent text is at least 4.6:1 on every light background and subtle, at
   least 7:1 in dark and sunlight; text on the accent fill 5.5:1 or better. Mirrored in SuiteTokens.cs. */

/* ---- chrome: data-theme only --------------------------------------------------------------------- */
:where(:root, [data-theme="suite"]) {
    --color-brand: var(--tp-ink-900);
    --color-brand-hover: var(--tp-ink-800);
    --color-on-brand: var(--tp-neutral-0);
}

:where([data-theme="sitescribe"]) {
    --color-brand: var(--tp-navy-900);
    --color-brand-hover: var(--tp-navy-800);
    --color-on-brand: var(--tp-neutral-0);
}

:where([data-theme="buildproof"]) {
    --color-brand: var(--tp-teal-900);
    --color-brand-hover: var(--tp-teal-700);
    --color-on-brand: var(--tp-neutral-0);
}

/* ---- accent roles, light ------------------------------------------------------------------------- */
:where(:root, [data-theme="suite"], [data-accent="suite"]) {
    --color-accent: var(--tp-indigo-600);
    --color-on-accent: var(--tp-neutral-0);
    --color-accent-text: var(--tp-indigo-700);
    --color-accent-subtle: var(--tp-indigo-50);
}

:where([data-theme="sitescribe"], [data-accent="rams"]) {
    --color-accent: var(--tp-amber-500);
    --color-on-accent: var(--tp-neutral-ink);
    --color-accent-text: var(--tp-amber-800);
    --color-accent-subtle: var(--tp-amber-100);
}

:where([data-theme="buildproof"], [data-accent="qa"]) {
    --color-accent: var(--tp-orange-500);
    --color-on-accent: var(--tp-neutral-ink);
    --color-accent-text: var(--tp-orange-800);
    --color-accent-subtle: var(--tp-orange-100);
}

/* ---- accent roles, dark -------------------------------------------------------------------------- */
/* The suite's indigo fill is too dark on a near-black page: it lifts to indigo 400 with ink text. The
   first selector covers an <html> with a dark scheme and no data-theme (suite by default). */
:where(:root[data-scheme="dark"]:not([data-theme]),
       :is([data-scheme="dark"], [data-scheme="dark"] *):is([data-theme="suite"], [data-accent="suite"])) {
    --color-accent: var(--tp-indigo-400);
    --color-on-accent: var(--tp-neutral-ink);
    --color-accent-text: var(--tp-indigo-300);
}

:where(:is([data-scheme="dark"], [data-scheme="dark"] *):is([data-theme="sitescribe"], [data-accent="rams"])) {
    --color-accent-text: var(--tp-amber-400);
}

:where(:is([data-scheme="dark"], [data-scheme="dark"] *):is([data-theme="buildproof"], [data-accent="qa"])) {
    --color-accent-text: var(--tp-orange-300);
}

/* ---- accent roles, sunlight ---------------------------------------------------------------------- */
:where(:root[data-scheme="sunlight"]:not([data-theme]),
       :is([data-scheme="sunlight"], [data-scheme="sunlight"] *):is([data-theme="suite"], [data-accent="suite"])) {
    --color-accent-text: var(--tp-indigo-800);
}

:where(:is([data-scheme="sunlight"], [data-scheme="sunlight"] *):is([data-theme="sitescribe"], [data-accent="rams"])) {
    --color-accent-text: var(--tp-amber-900);
}

:where(:is([data-scheme="sunlight"], [data-scheme="sunlight"] *):is([data-theme="buildproof"], [data-accent="qa"])) {
    --color-accent-text: var(--tp-orange-900);
}

/* ---- BuildProof tinted neutrals: data-theme only (an accent changes accent roles only) ------------ */
/* Its card shadow is the teal one in every scheme but sunlight: elevation 1 is "today's --shadow", and
   today BuildProof's teal shadow applies in the dark scheme too. */
:where([data-theme="buildproof"]) {
    --color-bg: var(--tp-teal-grey-50);
    --shadow-1: 0 1px 2px rgba(14, 77, 100, 0.06), 0 4px 16px rgba(14, 77, 100, 0.06);
}

:where(:is([data-scheme="dark"], [data-scheme="dark"] *)[data-theme="buildproof"]) {
    --color-bg: var(--tp-teal-grey-1000);
    --color-surface: var(--tp-teal-grey-950);
    --color-surface-2: var(--tp-teal-grey-900);
}

:where(:is([data-scheme="sunlight"], [data-scheme="sunlight"] *)[data-theme="buildproof"]) {
    --color-bg: var(--tp-neutral-0);
    --shadow-1: none;
}
}

/* ---- tokens/components.css ---- */
@layer tokens {
/* Tier 3: component tokens, named --{component}-{part}-{property} (docs/designs/design-system.md,
   section 3, rule 3), plus the density switch they share. Each component adds its tokens here as it is
   built, declared on :where(:root, [data-theme], [data-accent], [data-scheme]) when they alias a role, so
   that they re-resolve inside a nested theme or accent scope (a var() resolves where it is declared).

   Density: data-density="comfortable" (the default: 44px controls, 52px rows) or "compact" (36px controls
   and rows, small text). Compact applies only with a fine pointer; touch keeps 44px targets. */

:where(:root, [data-density="comfortable"]) {
    --control-height: 44px;
    --row-height: 52px;
    --density-font-size: var(--font-size-md);
}

@media (pointer: fine) {
    :where([data-density="compact"]) {
        --control-height: 36px;
        --row-height: 36px;
        --density-font-size: var(--font-size-sm);
    }
}

:where(:root) {
    /* Touch target: 44px is the aim, 24px the floor (WCAG 2.5.8). */
    --target-size: 44px;
    --target-size-min: 24px;
    --focus-offset: 2px;

    /* Icon (Components/Icon.razor). Inherit follows the text around the icon. */
    --icon-size-inherit: 1.25em;
    --icon-size-sm: 1rem;
    --icon-size-md: 1.25rem;
    --icon-size-lg: 1.5rem;
    --icon-size-xl: 2rem;

    /* Overlays (Components/Overlays, css/components/overlays.css). */
    --overlay-scrim: rgb(0 0 0 / 0.45);
    --dialog-width: 32rem;
    --sheet-width: 28rem;
    --popover-width: 22rem;
    --menu-min-width: 12rem;
    --tooltip-width: 16rem;
}
}

/* ---- legacy/portal.legacy.css ---- */
@layer legacy {
/* Shared mobile-first stylesheet for the SiteScribe AI and BuildProof portals (AiRams.Portal.Shared).
   Its custom properties alias the suite tokens (../tokens/*.css), whose values follow data-theme and data-scheme on <html>. */

:where(:root, [data-theme], [data-accent], [data-scheme]) { /* aliases, re-declared on every scope (design section 3, rule 2) */
    --navy: var(--color-brand);
    --navy-light: var(--color-brand-hover);
    --amber: var(--color-accent);
    --amber-dark: var(--color-accent-text); /* text-only amber: 5.4:1 on white (the old #C97F0A was 3.2:1) */
    --bg: var(--color-bg);
    --surface: var(--color-surface);
    --surface-2: var(--color-surface-2);
    --text: var(--color-text);
    --text-secondary: var(--color-text-muted);
    --border: var(--color-border);
    --risk-low: var(--color-risk-low);
    --risk-medium: var(--color-risk-medium);
    --risk-high: var(--color-risk-high);
    --risk-veryhigh: var(--color-risk-very-high);
    --danger: var(--color-danger-solid);
    --success: var(--color-success-solid);
    --info: var(--color-info-solid);
    --warning: var(--color-warning-solid);
    /* Text colours for status messages on tinted backgrounds (the fills above stay for buttons/bars):
       the suite's status text roles since DS-F11, at least 4.5:1 on every pill and alert in light and
       dark (they were #2E7D32, #C62828, #1F6FB2 in light, 4.1 to 4.2:1 on the success and info pills,
       and #5AA9E6 for info in dark). Warning is its own role; the accent no longer doubles as it. */
    --success-text: var(--color-success-text);
    --danger-text: var(--color-danger-text);
    --info-text: var(--color-info-text);
    --warning-text: var(--color-warning-text);
    --focus: var(--color-focus);            /* keyboard focus ring: 5.3:1 on white */
    --radius: var(--radius-md);             /* --radius-sm (8px) is the suite token of that name */
    --shadow: var(--shadow-1);
}
:where(:root) { /* literals: no suite token has the same value (color-scheme now comes from the tokens) */
    --border-strong: #8A93A6;    /* form control edges: 3.1:1, visible in sunlight */
    --topbar-h: 56px;
    --tabbar-h: 64px;
    --gutter: 16px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

/* Dark: data-scheme="dark" on <html>, set before first paint by index.html, replaces @media (prefers-color-scheme: dark). */
:where([data-scheme="dark"]) {
    --border-strong: #6B7488;
}
/* The other dark values this block used to set now come through the aliases above: --bg #12141B,
   --surface #1B1F2B, --surface-2 #232838, --text #E8EAF0, --text-secondary #9AA2B3, --border #2C3245,
   --focus #8AB4F8, --amber-dark #F5B547 (BuildProof #FF9F66), the status texts and --shadow 0 1px 2px
   rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3) (BuildProof keeps its teal --shadow, as it did when
   its :root override came after this block). --border-strong has no identical token and stays a literal.
   Every dark rule in this file is ":where([data-scheme="dark"]) <selector>": :where() adds no
   specificity, so the order of rules decides, as it did inside the old media queries. A dark rule must
   therefore come after the light rule it overrides: the "lift" rules for selected chips, table headers
   and the user's chat bubbles sat here, above their light rules, and never applied (fixed in DS-F11:
   they now follow those rules). The aliases, the literals and this block all have zero specificity too,
   so this block wins by coming later. */


/* ---- focus: one visible ring for keyboard users, never on mouse clicks ---------------------- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.topbar :focus-visible { outline-color: #fff; }
/* FocusOnNavigate puts focus on the page heading after every route change - no box for that. */
h1:focus { outline: none; }
/* The skip link moves focus to <main> (TechnoPulse.Ui ui.js focusTarget): no box round the whole page either. */
.page:focus { outline: none; }

/* ---- reset & base ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 0.35rem; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.6rem; }
a { color: var(--amber-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
/* A link in running text is underlined, so colour is not all that marks it (WCAG 1.4.1); links that are
   controls (nav, buttons, cards, chips) all have a class and keep their own look. In an alert a link takes
   the alert's text colour, which already meets 4.5:1 on its tint. */
:where(p, li, dd, td, small, figcaption, label, .alert, .banner) a:not([class]) { text-decoration: underline; text-underline-offset: 2px; }
.alert a:not(.btn) { color: inherit; }
ul, ol { margin: 0.25rem 0 0.5rem 1.25rem; padding: 0; }
img { max-width: 100%; height: auto; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 0 0.3em; border-radius: 4px; }

.muted { color: var(--text-secondary); }
.small { font-size: 0.82rem; }
.error-text { color: var(--danger-text); font-size: 0.82rem; }
.danger-text { color: var(--danger-text); }
.prose { white-space: pre-wrap; max-width: 75ch; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- app shell ---------------------------------------------------------------------------- */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: calc(var(--topbar-h) + var(--safe-top));
    padding: var(--safe-top) var(--gutter) 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--navy);
    color: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand { color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; white-space: nowrap; }
.brand span, .splash-brand span { color: var(--amber); } .login-brand span { color: var(--color-accent-text); } /* wordmark accent per background (owner, 2026-11-30): bright on the dark bar and splash, the theme's accent text shade on the card */
.brand:hover { text-decoration: none; }

.topnav { display: none; gap: 0.25rem; margin-left: 0.5rem; }
.topnav a { color: rgba(255, 255, 255, 0.78); padding: 0.4rem 0.7rem; border-radius: var(--radius-sm); font-weight: 500; }
.topnav a:hover { background: rgba(255, 255, 255, 0.08); text-decoration: none; }
.topnav a.active { color: #fff; background: rgba(255, 255, 255, 0.14); font-weight: 600; box-shadow: inset 0 -3px 0 currentColor; } /* shown by a bar and weight, not colour alone (WCAG 1.4.1) */

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.topbar .btn-ghost { color: rgba(255, 255, 255, 0.85); }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.net-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.25); }
.net-dot.offline { background: var(--risk-high); box-shadow: 0 0 0 3px rgba(232, 115, 10, 0.25); }

.page {
    flex: 1;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding-block: 1rem calc(var(--tabbar-h) + var(--safe-bottom) + 1rem);
    padding-inline: var(--gutter);
}

.tabbar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 30;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: grid;
    /* one equal column per tab, however many there are - a fixed repeat(n) silently wraps the
       nth+1 tab onto a second row below the bar */
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-secondary); font-size: 0.7rem; font-weight: 600; min-height: 44px; min-width: 0; padding-inline: 2px; white-space: nowrap; overflow: hidden; }
.tabbar a > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 359px) { .tabbar a { font-size: 0.62rem; } .tab-icon { font-size: 1.1rem; } }
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--navy); font-weight: 700; box-shadow: inset 0 3px 0 currentColor; } /* a bar along the top edge and weight, not colour alone (WCAG 1.4.1) */
:where([data-scheme="dark"]) .tabbar a.active { color: var(--amber); }
.tab-icon { font-size: 1.25rem; line-height: 1; }

@media (min-width: 768px) {
    :root { --gutter: 24px; }
    .topnav { display: flex; }
    .tabbar { display: none; }
    .page { padding-block: 1.5rem 3rem; }
    h1 { font-size: 1.75rem; }
}

/* ---- banners, alerts, toasts ------------------------------------------------------------- */
.banner { padding: 0.55rem var(--gutter); font-size: 0.88rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.banner-offline { background: #FFF1DE; color: #7A4A00; }
.banner-info { background: #E7F0FA; color: #133E66; }
.banner-update { background: #E8F5E9; color: #1B5E20; }
/* dark scheme */
:where([data-scheme="dark"]) .banner-offline { background: #3A2A10; color: #FFD59A; }
:where([data-scheme="dark"]) .banner-info { background: #14293D; color: #BBD8F4; }
:where([data-scheme="dark"]) .banner-update { background: #163A1B; color: #B9E5BD; }


.alert { padding: 0.75rem 0.9rem; border-radius: var(--radius-sm); margin-bottom: 0.9rem; font-size: 0.92rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.alert-error { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger-text); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.alert-success { background: color-mix(in srgb, var(--success) 12%, var(--surface)); color: var(--success-text); border: 1px solid color-mix(in srgb, var(--success) 35%, transparent); }
.alert-warning { background: color-mix(in srgb, var(--warning) 16%, var(--surface)); color: var(--warning-text); border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent); } /* warning role, not the accent (DS-F11) */
.alert-info { background: color-mix(in srgb, var(--info) 12%, var(--surface)); color: var(--info-text); border: 1px solid color-mix(in srgb, var(--info) 35%, transparent); }

.job-tray {
    position: fixed;
    right: var(--gutter);
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
    z-index: 25;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(360px, calc(100vw - 2 * var(--gutter)));
}
@media (min-width: 768px) { .job-tray { bottom: 20px; } }
.job-chip { display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--amber); border-radius: var(--radius-sm); padding: 0.55rem 0.75rem; box-shadow: var(--shadow); color: var(--text); }
.job-chip:hover { text-decoration: none; }
.job-chip.done { border-left-color: var(--success); }
.job-chip.failed { border-left-color: var(--danger); }
.job-chip-text { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; color: inherit; }
a.job-chip-text:hover { text-decoration: none; }
.job-chip-text small { color: var(--text-secondary); font-size: 0.75rem; }

/* ---- buttons --------------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    min-height: 44px; padding: 0.55rem 1rem;
    border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 0.95rem;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background 0.15s, transform 0.05s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--amber); color: #1A1E28; }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--amber) 86%, #fff); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.danger-text, .btn.danger-text:hover:not(:disabled) { color: var(--danger-text); }
.btn-link { background: none; color: var(--amber-dark); padding: 0 0.25rem; min-height: 0; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { min-height: 36px; padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-lg { min-height: 52px; font-size: 1.02rem; }
.btn-block { width: 100%; }

/* ---- forms ---------------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; min-width: 0; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field small { line-height: 1.35; }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="tel"],
.field input[type="number"], .field input[type="date"], .field input[type="time"], .field input[type="search"],
.field textarea, .field select, .search, .choice-detail, .location-field input[type="text"] {
    width: 100%; min-height: 44px; padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 1rem;
}
.field input:focus, .field textarea:focus, .field select:focus, .search:focus, .choice-detail:focus, .location-field input:focus {
    outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus);
}
.field textarea { resize: vertical; min-height: 88px; }
.field input[type="color"] { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.field input[type="file"]::file-selector-button { min-height: 44px; padding: 0.5rem 1rem; margin-right: 0.75rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.field-row.tight { grid-template-columns: 1fr 1fr auto; align-items: end; gap: 0.5rem; }
.field-row.tight .field { margin-bottom: 0.5rem; }
.field-row.wrap { display: flex; flex-wrap: wrap; align-items: end; }
@media (max-width: 639px) {
    .field-row.tight:not(.wrap) { grid-template-columns: minmax(0, 1fr) auto; }
    .field-row.tight:not(.wrap) > .field:first-child { grid-column: 1 / -1; }
    .locked-row-hint { white-space: normal; }
}
.req { color: var(--danger); margin-left: 2px; }
.form-field.invalid input, .form-field.invalid textarea { border-color: var(--danger); }
label.check { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
label.check input { width: 20px; height: 20px; }
/* Sign-off confirmation: a 44px tap target that wraps its long label instead of overflowing. */
label.check.confirm-check { display: flex; align-items: flex-start; min-height: 44px; margin: 0.75rem 0; }
label.check.confirm-check input { flex: 0 0 auto; margin-top: 0.1rem; }
.finalize-card .send-heading { margin-top: 1.25rem; }

@media (min-width: 640px) {
    .field-row { grid-template-columns: 1fr 1fr; }
}

.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.hstack { display: flex; align-items: center; gap: 0.5rem; }
.hstack.wrap { flex-wrap: wrap; }
.hstack.end { justify-content: flex-end; }
.hstack.center { justify-content: center; }

/* ---- cards & layout blocks ---------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card > h2 { margin-bottom: 0.75rem; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
details.card summary { cursor: pointer; }

.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.page-header p { margin: 0; }

.toolbar { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.chip-row { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

.empty-state { text-align: center; padding: 2.5rem 1rem; }
.empty-state .btn { margin-top: 0.75rem; }
.loading-block { display: flex; align-items: center; gap: 0.75rem; justify-content: center; padding: 2rem; color: var(--text-secondary); }

.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); z-index: 5; display: flex; gap: 0.5rem; padding: 0.5rem 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.sticky-actions .btn { flex: 1 1 0; white-space: normal; }
@media (min-width: 768px) { .sticky-actions { bottom: 8px; } }

.settings-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .settings-grid { grid-template-columns: 3fr 2fr; align-items: start; } .settings-grid aside { position: sticky; top: calc(var(--topbar-h) + 16px); } }

dialog.legacy-dialog[open] { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; background: rgba(0, 0, 0, 0.45); color: inherit; overflow: visible; display: flex; align-items: flex-end; justify-content: center; padding: 1rem; } dialog.legacy-dialog::backdrop { background: transparent; } dialog.legacy-dialog:focus-visible { outline: none; } /* was .modal-backdrop (DS-F09: TechnoPulse.Ui Dialog, Skin=Legacy). The full-screen dialog paints the scrim itself, as the old div did, so the pixels match; the top layer replaces z-index 50. */
.modal { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
@media (min-width: 640px) { dialog.legacy-dialog[open] { align-items: center; } }

/* ---- pills -------------------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.pill-neutral { background: var(--surface-2); color: var(--text-secondary); }
.pill-warning { background: color-mix(in srgb, var(--warning) 22%, var(--surface)); color: var(--warning-text); } /* warning role, not the accent (DS-F11) */
.pill-info { background: color-mix(in srgb, var(--info) 16%, var(--surface)); color: var(--info-text); }
.pill-success { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: var(--success-text); }
.pill-danger { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger-text); }
.pill-risk-low { background: var(--risk-low); color: #fff; }
.pill-risk-medium { background: var(--risk-medium); color: #1A1E28; }
.pill-risk-high { background: var(--risk-high); color: #1A1E28; }
.pill-risk-veryhigh { background: var(--risk-veryhigh); color: #fff; }

/* ---- spinner ------------------------------------------------------------------------------ */
.spinner { width: 16px; height: 16px; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; flex: none; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Reduced motion: nothing spins. The ring becomes a still "working" mark, three dots in the same box (the
   text next to every spinner still says what is happening). After the spinner rules, which it overrides. */
@media (prefers-reduced-motion: reduce) {
    .spinner { animation: none; border: 0; border-radius: 0; background: radial-gradient(circle closest-side, currentColor 85%, transparent) 0 50% / 33.34% 33.34% repeat-x; }
}

.splash { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; background: var(--navy); color: #fff; }
.splash-brand { font-size: 1.6rem; font-weight: 700; }
.splash .spinner { color: var(--amber); }

/* ---- document list ------------------------------------------------------------------------ */
.doc-list { display: flex; flex-direction: column; gap: 0.6rem; }
.doc-card { display: flex; align-items: center; gap: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 0.9rem; color: var(--text); box-shadow: var(--shadow); }
.doc-card:hover { text-decoration: none; border-color: var(--amber); }
.doc-card-main { flex: 1; min-width: 0; }
.doc-card-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.doc-ref { font-weight: 700; }
.doc-project { font-size: 1rem; margin-top: 0.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { display: flex; gap: 0.35rem; font-size: 0.8rem; flex-wrap: wrap; }
.doc-card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.doc-delete { font-size: 1rem; }
.doc-next { font-size: 0.85rem; margin-top: 0.2rem; color: var(--text-secondary); }
.doc-next.todo { color: var(--amber-dark); font-weight: 600; }
.doc-next.ready { color: var(--success-text); font-weight: 600; }

/* A card whose title link covers the whole card, so other controls in it (the ⋯ menu) stay real
   buttons instead of being nested inside a link. */
.has-stretched-link { position: relative; }
.has-stretched-link:hover { border-color: var(--amber); }
.stretched-link { color: inherit; }
.stretched-link:hover { text-decoration: none; }
.stretched-link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.stretched-link:focus-visible { outline: none; }
.stretched-link:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 2px; }
.has-stretched-link .overflow-menu, .has-stretched-link .doc-card-side button { position: relative; z-index: 2; }
/* An open menu must sit above the next card's ⋯ button (both would otherwise be z-index 2). */
.has-stretched-link .overflow-menu.open { z-index: 46; }

@media (min-width: 768px) {
    .doc-list { gap: 0.5rem; }
    .doc-card-side { flex-direction: row; align-items: center; }
}

/* ---- tables -------------------------------------------------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.grid th, table.grid td { padding: 0.5rem 0.6rem; border: 1px solid var(--border); text-align: left; vertical-align: top; }
table.grid th { background: var(--navy); color: #fff; font-weight: 600; }
:where([data-scheme="dark"]) table.grid th { background: #2E4372; border-color: #2E4372; } /* navy lifted off the near-black page */
table.grid.matrix th { text-align: center; }
dl.kv { display: grid; grid-template-columns: minmax(110px, 35%) 1fr; gap: 0.35rem 0.75rem; margin: 0; }
dl.kv dt { font-weight: 600; color: var(--navy); }
:where([data-scheme="dark"]) dl.kv dt { color: var(--amber); }
dl.kv dd { margin: 0; }
@media (min-width: 768px) {
    dl.kv { grid-template-columns: 200px 1fr; }
    .add-component select { flex: 0 1 280px; }
}

/* ---- chips (answers) ------------------------------------------------------------------------- */
.chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    min-height: 40px; padding: 0.4rem 0.85rem;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip.selected { background: var(--navy); color: #fff; border-color: var(--navy); }
/* Dark: a navy chip on a near-black page measured 1.05:1, so the selected one turns accent with ink text.
   Choice chips keep their own selected look below (navy tint, accent border and tick). */
:where([data-scheme="dark"]) .chip.selected:not(.choice) { background: var(--amber); border-color: var(--amber); color: #1A1E28; }
.chip-grid { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin-bottom: 0.5rem; }
.chip-grid.two { grid-template-columns: 1fr 1fr; }
.chip.choice { position: relative; flex-direction: column; align-items: flex-start; text-align: left; white-space: normal; border-radius: 12px; padding: 0.65rem 2rem 0.65rem 0.9rem; min-height: 48px; gap: 0.15rem; }
.chip.choice.big { align-items: center; justify-content: center; font-size: 1.05rem; min-height: 56px; }
.chip.choice.selected { background: color-mix(in srgb, var(--navy) 92%, #fff); border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.chip.choice.selected::before { content: "✓"; position: absolute; right: 12px; top: 10px; color: var(--amber); font-weight: 700; }
.chip-label { font-weight: 600; }
.chip:disabled { opacity: 0.55; cursor: not-allowed; }
.chip.selected:disabled { opacity: 0.85; }
.chip-detail { font-size: 0.8rem; opacity: 0.8; font-weight: 400; line-height: 1.3; }
.chip.choice.selected .chip-detail { opacity: 0.9; }
@media (min-width: 640px) { .chip-grid { grid-template-columns: 1fr 1fr; } }

/* ---- signature pad (sign / finalise cards) ------------------------------------------------ */
.signature-pad { display: flex; flex-direction: column; gap: 0.35rem; }
.signature-pad canvas {
    display: block; width: 100%; height: 160px; box-sizing: border-box;
    touch-action: none; -webkit-user-select: none; user-select: none; cursor: crosshair;
    background: #fff linear-gradient(to top, transparent 34px, #C9CED8 34px, #C9CED8 35px, transparent 35px);
    border: 2px dashed var(--border-strong); border-radius: var(--radius-sm);
}
.signature-pad.disabled canvas { pointer-events: none; opacity: 0.6; }
.signature-actions { align-items: center; }
.hstack.between { justify-content: space-between; }

/* ---- builder: mode picker ----------------------------------------------------------------- */
.mode-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.mode-card { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; cursor: pointer; font: inherit; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.35rem; }
.mode-card:hover { border-color: var(--amber); }
.mode-card.featured { border-color: var(--amber); background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--amber) 8%, var(--surface))); }
.mode-card h2 { margin: 0; }
.mode-card p { margin: 0; color: var(--text-secondary); }
.mode-icon { font-size: 1.8rem; }
@media (min-width: 640px) { .mode-grid { grid-template-columns: 1fr 1fr; } }

/* ---- builder: chat ------------------------------------------------------------------------ */
.builder-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.75rem; }
.builder-head h1 { font-size: 1.2rem; }
.builder-head p { margin: 0; }
.chat-transcript { display: flex; flex-direction: column; gap: 0.5rem; padding-bottom: 1rem; }
.chat-transcript.compact { max-height: 40vh; overflow-y: auto; }
.bubble { max-width: 92%; padding: 0.65rem 0.85rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.bubble.agent { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.user { align-self: flex-end; background: var(--navy); color: #fff; border-color: var(--navy); border-bottom-right-radius: 4px; }
:where([data-scheme="dark"]) .bubble.user { background: #2E4372; border-color: #2E4372; } /* navy lifted off the near-black page */
.bubble.thinking { display: flex; gap: 0.5rem; align-items: center; color: var(--text-secondary); }
.bubble-text { white-space: pre-wrap; }
.reg-note { margin-top: 0.4rem; padding: 0.4rem 0.6rem; border-left: 3px solid var(--amber); background: color-mix(in srgb, var(--amber) 12%, var(--surface)); font-size: 0.82rem; border-radius: 0 6px 6px 0; color: var(--text); }
.agent-note { padding: 0.6rem 0.85rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 0.75rem; }
@media (min-width: 768px) { .bubble { max-width: 75%; } }

.action-sheet {
    position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom));
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
    padding: 0.75rem; margin: 0 calc(-1 * var(--gutter)) calc(-1 * (var(--tabbar-h) + var(--safe-bottom) + 1rem));
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    display: flex; flex-direction: column; gap: 0.5rem;
}
.action-sheet textarea { width: 100%; min-height: 56px; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.action-hint { margin: 0; font-size: 0.8rem; }
@media (min-width: 768px) {
    .action-sheet { position: static; margin: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
}

/* ---- builder: expert form ----------------------------------------------------------------- */
.form-step { padding: 1.1rem; }
.form-step-header { margin-bottom: 1rem; }
.step-badge { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--amber-dark); margin-bottom: 0.25rem; }
.form-field { padding: 0.75rem 0; border-top: 1px solid var(--border); margin-bottom: 0; }
.form-field:first-of-type { border-top: 0; }
.form-field > label { font-size: 1rem; }
.form-step-actions { margin-top: 1rem; }
.choice-detail { margin-top: 0.25rem; }
/* An untouched AI-suggested answer pre-filled into a text/number box: readable and fully editable, just marked. */
.form-field input.suggested, .form-field textarea.suggested { border-left: 3px solid var(--amber); background: color-mix(in srgb, var(--amber) 7%, var(--surface)); }
.transcript-details { padding: 0.75rem 1rem; }
.transcript-details summary { font-weight: 600; cursor: pointer; }
.transcript-details .chat-transcript { margin-top: 0.75rem; }

.location-field { display: flex; flex-direction: column; gap: 0.5rem; }
.action-sheet .location-field { margin-bottom: 0.25rem; }
.autocomplete-host { min-height: 44px; }
.autocomplete-host gmp-place-autocomplete, .gmp-autocomplete { width: 100%; display: block; --gmpx-color-surface: var(--surface); }
.location-summary { padding: 0.5rem 0.75rem; background: var(--surface-2); border-radius: 8px; font-size: 0.9rem; }

.upload-field { display: flex; flex-direction: column; gap: 0.5rem; }
.upload-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem; padding: 1rem; border: 2px dashed var(--border); border-radius: 12px; text-align: center; cursor: pointer; background: var(--surface-2); }
.upload-drop input[type="file"] { width: 100%; font-size: 0.85rem; }
.upload-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.upload-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.upload-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-icon { font-size: 1.1rem; }

.install-steps { margin: 0 0 1rem; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.92rem; }

/* ---- progress pages ----------------------------------------------------------------------- */
.progress-page { display: flex; justify-content: center; padding-top: 1rem; }
.progress-card { max-width: 520px; width: 100%; text-align: center; padding: 2rem 1.25rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.progress-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-2); font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.progress-icon .spinner { color: var(--amber); }
.progress-icon.done { background: var(--success); color: #fff; }
.progress-icon.failed { background: var(--danger); color: #fff; }
.progress-stage { font-weight: 600; }
.progress-steps { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; text-align: left; margin: 0.5rem 0 0.75rem; font-size: 0.9rem; color: var(--text-secondary); }
.progress-step { display: flex; align-items: center; gap: 0.5rem; }
.progress-step .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.progress-step.active { color: var(--text); font-weight: 600; }
.progress-step.active .dot { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 30%, transparent); }
.progress-step.done { color: var(--success-text); }
.progress-step.done .dot { background: var(--success); }

/* ---- document detail ---------------------------------------------------------------------- */
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; align-items: flex-start; margin-bottom: 0.75rem; }
.detail-head h1 { margin: 0; }
.detail-head p { margin: 0.25rem 0 0; }
/* The chip strip scrolls horizontally: swipe on touch, and on desktop (no swipe gesture) via a
   visible thin scrollbar, the wheel-to-horizontal handler in app.js (.hscroll) and arrow buttons. */
.section-nav-wrap { position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: 20; display: flex; align-items: center; gap: 0.25rem; margin: 0 0 0.75rem; background: var(--bg); }
.section-nav { flex: 1; min-width: 0; display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.5rem 4px; scrollbar-width: none; overscroll-behavior-x: contain; }
.section-nav::-webkit-scrollbar { display: none; }
.section-nav-arrow { display: none; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0; }
.section-nav-arrow:hover { border-color: var(--amber); color: var(--text); }
@media (hover: hover) and (pointer: fine) {
    .section-nav { scrollbar-width: thin; scrollbar-color: var(--border) transparent; padding-bottom: 0.35rem; }
    .section-nav::-webkit-scrollbar { display: block; height: 6px; }
    .section-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    .section-nav::-webkit-scrollbar-track { background: transparent; }
}
@media (min-width: 768px) and (pointer: fine) { .section-nav-arrow { display: inline-flex; align-items: center; justify-content: center; } }
.section-nav-wrap > .chip, .section-nav-wrap > .autosave-status { flex: none; }
.section-title:focus-visible { outline-offset: -3px; }
.section-nav .chip { flex: 0 0 auto; min-height: 34px; padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.section-nav .chip:hover { text-decoration: none; border-color: var(--amber); }

.doc-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.75rem; box-shadow: var(--shadow); overflow: hidden; }
.doc-section:has(.overflow-menu.open) { overflow: visible; }
.section-title { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.85rem 1rem; background: none; border: 0; border-left: 4px solid var(--amber); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.section-title h2 { margin: 0; font-size: 1.05rem; }
/* A RAMS section's heading holds its collapse button (heading, then button: WCAG 1.3.1). The heading takes
   the look of the section around it and the title text inside the button the look of the old inner h2. */
.section-heading { margin: 0; font: inherit; letter-spacing: normal; }
.section-title-text { margin: 0; font-size: 1.05rem; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
.section-meta { font-size: 0.8rem; white-space: nowrap; }
.chev { margin-left: 0.35rem; }
.section-body { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: 0.75rem; }

.component-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; background: var(--bg); }
.component-card.editing { border-color: var(--amber); background: var(--surface); }
.component-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.5rem; }
.component-title { display: flex; flex-direction: column; line-height: 1.2; }
.component-actions { display: flex; gap: 0.25rem; flex: none; }
.component-save { margin-top: 0.75rem; }
.add-component { display: flex; gap: 0.5rem; align-items: center; }
.sections-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.sections-head h2 { margin: 0; font-size: 1rem; }
.restore-actions { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.5rem 0; }
.restore-confirm { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); background: var(--surface-2); }
@media (max-width: 767.98px) { .hide-phone { display: none !important; } }
@media (min-width: 768px) { .show-phone { display: none !important; } }
.add-component select { flex: 1; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0.4rem 0.6rem; font: inherit; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.checklist li { display: flex; gap: 0.5rem; align-items: flex-start; }
.checklist li.na { opacity: 0.6; }
.checklist .tick { color: var(--amber-dark); font-weight: 700; flex: none; width: 1rem; }
.checklist-edit { display: grid; grid-template-columns: 1fr; gap: 0.4rem; padding: 0.5rem; border: 1px solid var(--border); border-radius: 8px; }
.checklist-edit .field { margin: 0; }
@media (min-width: 640px) { .checklist-edit { grid-template-columns: auto 1fr 1fr auto; align-items: center; } }
.table-row-edit { display: grid; grid-template-columns: 1fr; gap: 0.35rem; padding: 0.5rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.5rem; }
.table-row-edit .field { margin: 0; }
@media (min-width: 640px) { .table-row-edit { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; } }

.hazard-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; background: var(--surface); }
.hazard-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; }
.hazard-scores { display: flex; gap: 0.4rem; }
.score { display: inline-flex; flex-direction: column; align-items: center; min-width: 56px; padding: 0.25rem 0.5rem; border-radius: 8px; font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.score small { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; opacity: 0.9; }
.measures { margin-top: 0.5rem; }
.hazard-edit { border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; background: var(--surface); display: flex; flex-direction: column; gap: 0.25rem; }
.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }
@media (min-width: 640px) { .score-grid { grid-template-columns: repeat(4, 1fr); } }

.doc-image { margin: 0.25rem 0; text-align: center; }
.doc-image img { max-height: 420px; border-radius: 8px; border: 1px solid var(--border); }
.doc-image figcaption { font-size: 0.82rem; margin-top: 0.25rem; }
.emergency-block { display: flex; flex-direction: column; gap: 0.75rem; }
.emergency-summary { margin-top: 0.25rem; padding: 0.6rem 0.75rem; border-radius: 8px; background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-left: 3px solid var(--danger); font-size: 0.92rem; }
.attachments { margin-top: 0.75rem; }
.finalize-card { border-color: var(--amber); }

/* ---- autosave, revisions, sign checklist ------------------------------------------------- */
/* Keyboard focus and jump links stay clear of the sticky top bar (WCAG 2.4.11): the scroll padding is the
   height of the top bar (and of the RAMS section strip below it). Jump links (section chips, the sign
   checklist) land below that by their scroll margin; padding plus margin is what the margin alone used to
   be (top bar + 84px; + 16px beside the side rail), so every jump lands where it did. */
html:has(.app-shell) { scroll-padding-top: calc(var(--topbar-h) + var(--safe-top)); }
[id] { scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 84px); }
.app-shell [id] { scroll-margin-top: 84px; }
@media (max-width: 1199.98px) { /* the section strip shows only below the side rail's breakpoint */
    html:has(.app-shell .section-nav-wrap) { scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 52px); }
    .app-shell:has(.section-nav-wrap) [id] { scroll-margin-top: 32px; }
}

.detail-head-main { min-width: 0; }
.detail-head-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; }
@media (max-width: 639px) { .detail-head-actions { align-items: flex-start; width: 100%; } }
/* Phones: when the actions are just the "⋯" menu, it sits beside the title instead of on a row of its own. */
@media (max-width: 767.98px) {
    .detail-head { position: relative; }
    .detail-head:has(.detail-head-actions > .show-phone) .detail-head-main { padding-right: 44px; }
    .detail-head-actions:has(> .show-phone) { position: absolute; top: -2px; right: -6px; width: auto; }
}

/* "Saving… / Saved / Saved on this device / Not saved": always visible while editing, never a button. */
.autosave-status { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 28px; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); background: var(--surface-2); }
.autosave-status .spinner { width: 12px; height: 12px; }
.autosave-status.state-idle { background: transparent; padding-inline: 0; font-weight: 500; }
.autosave-status.state-saved { color: var(--success-text); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.autosave-status.state-offline, .autosave-status.state-retrying { color: var(--amber-dark); background: color-mix(in srgb, var(--amber) 16%, var(--surface)); }
.autosave-status.state-error { color: var(--danger-text); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.autosave-rejections ul { margin: 0.25rem 0 0.25rem 1.1rem; width: 100%; }
/* Focus traps (signature overlay, photo viewer): invisible, focusable ends that wrap Tab around. */
.focus-sentinel { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.autosave-wrap { position: relative; display: inline-flex; }
.autosave-live { display: inline-flex; }
.autosave-popover {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; width: min(340px, calc(100vw - 32px));
    padding: 0.75rem; background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); font-size: 0.9rem; text-align: left;
}
.autosave-popover ul { margin: 0.35rem 0 0.35rem 1.1rem; padding: 0; }
.autosave-popover p { margin: 0 0 0.5rem; }
/* The popover sits inside the navy top bar: undo the bar's white-on-navy button and focus colours. */
.topbar .autosave-popover .btn-ghost { color: var(--text-secondary); }
.topbar .autosave-popover .btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.topbar .autosave-popover :focus-visible { outline-color: var(--focus); }
.autosave-hint { white-space: nowrap; }

.completeness { margin: 0.25rem 0 0.75rem; padding: 0.75rem 0.85rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.completeness-title { font-weight: 700; margin: 0 0 0.35rem; }
.completeness-ok { margin: 0; color: var(--success-text); font-weight: 600; }
.completeness-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.completeness-list.warnings { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.completeness-list li { position: relative; padding-left: 1.4rem; font-size: 0.9rem; }
.completeness-list li.blocker::before { content: "○"; position: absolute; left: 0.2rem; top: 0.55rem; line-height: 1; color: var(--danger-text); font-weight: 700; }
.completeness-list li.warning::before { content: "!"; position: absolute; left: 0.35rem; top: 0.55rem; line-height: 1; color: var(--amber-dark); font-weight: 800; }
.completeness-list li.warning { color: var(--text-secondary); }
.completeness-link { min-height: 36px; padding: 0.25rem 0; text-align: left; white-space: normal; color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.sign-hint { margin: 0.5rem 0 0; text-align: center; }

.revision-banner { border-color: var(--amber); border-left: 4px solid var(--amber); }
.revision-banner-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.revision-banner h2 { margin: 0; }
.rule-indicator { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0.5rem 0 0.35rem; font-size: 0.9rem; }
.rule-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.rule-item.changed { color: var(--amber-dark); }
.lock-note { margin: 0; padding: 0.45rem 0.6rem; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--amber) 12%, var(--surface)); color: var(--text); font-size: 0.85rem; line-height: 1.35; }
.component-card.locked { background: var(--surface-2); }
.locked-row-hint { align-self: center; white-space: nowrap; }
.readonly-value { margin: 0; padding: 0.6rem 0.75rem; min-height: 44px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); }
.field input[readonly], .field textarea[readonly] { background: var(--surface-2); color: var(--text-secondary); }

.revise-block { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.revise-block h3 { margin-bottom: 0.25rem; }
.revision-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.revision-item { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.revision-item .pill { margin-left: 0.35rem; }
.revision-item.current-draft { border-style: dashed; }

.emergency-card { border-left: 4px solid var(--danger); }
.emergency-card a[href^="tel:"], .emergency-block a[href^="tel:"] { color: var(--text); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.emergency-summary-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-bottom: 0.75rem; }
.emergency-thumb { width: 100%; max-width: 360px; border-radius: 8px; border: 1px solid var(--border); }
@media (min-width: 768px) { .emergency-summary-grid { grid-template-columns: 1fr minmax(0, 320px); align-items: start; } }
.hospital-picker { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.hospital-picker > label { font-weight: 600; font-size: 0.9rem; }

.btn-icon { min-width: 44px; padding-inline: 0.5rem; }
.chip.chip-accent { border-color: var(--amber); font-weight: 600; }
.col-name { min-width: 120px; }
.field.narrow { max-width: 220px; }
.hex-input { max-width: 120px; }
.signout-confirm { display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; color: #fff; }

/* ---- settings preview --------------------------------------------------------------------- */
.logo-preview { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.logo-preview img { max-width: 180px; max-height: 80px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: #fff; }
.pdf-preview { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; color: #1A1E28; font-size: 0.78rem; }
.pdf-banner { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem; color: #fff; }
.pdf-banner img { max-width: 72px; max-height: 40px; background: #fff; border-radius: 4px; padding: 2px; }
.pdf-banner-text { flex: 1; min-width: 0; }
.pdf-eyebrow { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; }
.pdf-title { font-size: 1.05rem; font-weight: 700; }
.pdf-sub { font-size: 0.72rem; opacity: 0.9; }
.pdf-company { align-self: flex-end; font-weight: 600; font-size: 0.7rem; }
.pdf-info { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid #DDE1E9; }
.pdf-info small { display: block; font-size: 0.55rem; color: #5A6272; letter-spacing: 0.04em; }
.pdf-info strong { font-size: 0.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.pdf-contact { padding: 0.35rem 0.75rem; font-size: 0.62rem; border-bottom: 1px solid #DDE1E9; min-height: 1.2rem; }
.pdf-section-title { margin: 0.75rem 0.75rem 0; padding-bottom: 0.2rem; border-bottom: 2px solid; font-weight: 700; font-size: 0.85rem; }
.pdf-footer { display: flex; justify-content: space-between; padding: 1rem 0.75rem 0.5rem; font-size: 0.6rem; }
/* The letterhead preview is a white page in every scheme: its muted text keeps the light grey (dark's was 2.6:1 on it). */
.pdf-preview .muted { color: #5A6272; }

/* ---- login ---------------------------------------------------------------------------------- */
.login-page { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: radial-gradient(1200px 600px at 20% -10%, var(--navy-light), var(--navy)); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 1.75rem 1.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.login-brand { font-size: 1.5rem; font-weight: 700; text-align: center; }
.login-card .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 1.25rem; }

/* The landing sign-in (ad traffic lands here) is static HTML in each index.html since DS-C02, styled by
   TechnoPulse.Ui's patterns/landing.css. */
/* small print must stay readable: the global amber-dark link colour is too faint at this size */
.consent-banner a, .legal-page a, #privacy a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* ---- cookie consent (PECR): equal-weight Accept / Reject, shown until a choice is stored ---------- */
.consent-banner {
    position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--safe-bottom) + 0.75rem); width: min(calc(100% - 1.5rem), 640px);
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; padding: 0.9rem 1rem;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.consent-banner.in-shell { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 0.75rem); }
.consent-banner p { margin: 0; flex: 1 1 280px; font-size: 0.88rem; }
.consent-actions { display: flex; gap: 0.5rem; flex: 1 1 200px; }
.consent-actions .btn { flex: 1; min-height: 44px; }
@media (min-width: 768px) { .consent-banner.in-shell { bottom: 1rem; } }

/* ---- legal pages (/privacy, /cookies) ------------------------------------------------------ */
.legal-page { max-width: 760px; margin: 0 auto; padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 1rem 3rem; }
.legal-page .card { padding: 1.5rem 1.25rem; }
.legal-page h1 { margin-top: 0; }
.legal-page h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.legal-page table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0.5rem 0 1rem; }
.legal-page th, .legal-page td { text-align: left; vertical-align: top; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border); }
.legal-page .placeholder { background: color-mix(in srgb, var(--amber) 25%, transparent); padding: 0 0.2rem; border-radius: 3px; }

/* ---- markdown (regulation digest) --------------------------------------------------------- */
.md h2 { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.md h3 { margin-top: 1rem; }
.md ul { margin-bottom: 0.75rem; }
.md table.grid { margin: 0.5rem 0 1rem; font-size: 0.85rem; }
.source-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.source-list li { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ---- blazor error UI -------------------------------------------------------------------- */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; padding: 0.6rem 1.25rem 0.75rem 1.25rem; background: lightyellow; color: #1A1E28; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: var(--danger); color: #fff; padding: 1rem; border-radius: 8px; }
.blazor-error-boundary::after { content: "An error has occurred."; }
.loading-progress-text { font-size: 0.85rem; }

/* ---- touch input: every control reaches the 44 px floor, whatever the screen width ---------------- */
@media (pointer: coarse) {
    .btn-sm, .chip, .section-nav .chip, .completeness-link, .add-component select, .attachments .btn-link, .btn-link.btn-sm { min-height: 44px; }
    .btn-icon { min-width: 44px; }
    .component-actions, .doc-card-side { gap: 0.5rem; }
    .section-nav { padding-block: 0.35rem; }
    .emergency-card a[href^="tel:"], .emergency-block a[href^="tel:"] { display: inline-flex; align-items: center; min-height: 44px; }
}

/* The save pill in the sticky section strip: icon only on narrow phones (problems keep their words). */
@media (max-width: 479px) {
    .section-nav-wrap .autosave-status:not(.state-error):not(.state-offline) > span:not([aria-hidden]):not(.spinner) {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
    }
    .section-nav-wrap .autosave-status { padding-inline: 0.45rem; }
}
.section-nav-wrap .autosave-status.state-idle { display: none; }

/* ---- shared utilities ---------------------------------------------------------------------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- top bar: save status; Sign out lives in Settings on phones ----------------------------- */
.topbar .autosave-status { background: rgba(255, 255, 255, 0.12); color: #fff; }
.topbar .autosave-status.state-saved { color: #B9E5BD; background: rgba(255, 255, 255, 0.08); }
.topbar .autosave-status.state-error { color: #FFB4AE; }
.autosave-status { border: 0; font: inherit; font-size: 0.8rem; font-weight: 600; cursor: default; }
.autosave-status:not(:disabled) { cursor: pointer; }
.autosave-status:not(:disabled):hover { filter: brightness(0.96); }
.autosave-status.compact .autosave-text { white-space: nowrap; }
@media (max-width: 767px) {
    .signout-topbar { display: none !important; }
    .topbar .autosave-status.compact { padding-inline: 0.45rem; }
}
@media (max-width: 380px) {
    .topbar .autosave-status.compact .autosave-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---- action rail: sticky "next step" bar below 1200 px, side rail from 1200 px -------------- */
:root { --actionbar-h: 0px; }
body:has(.action-rail .rail-step) { --actionbar-h: 64px; }
.action-rail .rail-outline, .action-rail .rail-status { display: none; }
.action-rail .rail-step {
    position: fixed; z-index: 28; left: 0; right: 0;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom));
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem max(var(--gutter), env(safe-area-inset-left, 0px));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
}
.rail-step-detail { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-step-button { flex: 0 1 auto; margin-left: auto; max-width: 100%; white-space: normal; }
.rail-step:not(:has(.rail-step-detail)) .rail-step-button { flex: 1; }
.page:has(.action-rail .rail-step) { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--actionbar-h) + 1rem); }
body:has(.action-rail .rail-step) .job-tray { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--actionbar-h) + 12px); }
body:has(.action-rail .rail-step) .consent-banner.in-shell { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--actionbar-h) + 0.75rem); }
html.kb-open .action-rail .rail-step { display: none; }
@media (min-width: 768px) and (max-width: 1199px) {
    .action-rail .rail-step { bottom: 0; padding-bottom: calc(0.5rem + var(--safe-bottom)); }
    .page:has(.action-rail .rail-step) { padding-bottom: calc(var(--actionbar-h) + 2rem); }
    body:has(.action-rail .rail-step) .job-tray { bottom: calc(var(--actionbar-h) + 20px); }
    body:has(.action-rail .rail-step) .consent-banner.in-shell { bottom: calc(var(--actionbar-h) + 1rem); }
}
@media (min-width: 1200px) {
    .page:has(.with-rail) { max-width: 1340px; }
    .with-rail { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.5rem; align-items: start; }
    .with-rail > .rail-main { min-width: 0; }
    .with-rail > .action-rail {
        position: sticky; top: calc(var(--topbar-h) + var(--safe-top) + 16px);
        max-height: calc(100dvh - var(--topbar-h) - var(--safe-top) - 32px); overflow-y: auto;
        display: flex; flex-direction: column; gap: 0.75rem;
        padding: 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    }
    .action-rail .rail-outline, .action-rail .rail-status { display: block; }
    .action-rail .rail-step { position: static; padding: 0; border: 0; box-shadow: none; background: transparent; flex-direction: column; align-items: stretch; gap: 0.35rem; }
    .rail-step-detail { white-space: normal; }
    .rail-step-button { width: 100%; margin: 0; }
    body:has(.action-rail .rail-step) { --actionbar-h: 0px; }
    .with-rail .section-nav-wrap { display: none; }
    .with-rail [id] { scroll-margin-top: calc(var(--topbar-h) + var(--safe-top) + 16px); }
    .app-shell .with-rail [id] { scroll-margin-top: 16px; } /* + the top bar's scroll padding */
}
.rail-title { margin: 0 0 0.35rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); }
.rail-outline ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.rail-link { display: grid; grid-template-columns: 12px 1fr; align-items: center; gap: 0.15rem 0.5rem; padding: 0.4rem 0.5rem; border-radius: var(--radius-sm); color: var(--text); font-size: 0.88rem; line-height: 1.3; }
.rail-link:hover { background: var(--surface-2); text-decoration: none; }
.rail-link.active { background: color-mix(in srgb, var(--amber) 14%, var(--surface)); font-weight: 600; }
.rail-detail { grid-column: 2; font-size: 0.78rem; color: var(--text-secondary); }
.rail-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; border: 2px solid var(--border-strong); }
.rail-link.state-ok .rail-dot { background: var(--success); border-color: var(--success); }
.rail-link.state-warning .rail-dot { background: var(--amber); border-color: var(--amber); }
.rail-link.state-blocker .rail-dot { background: var(--danger); border-color: var(--danger); }
.rail-status { padding-top: 0.5rem; border-top: 1px solid var(--border); }

/* ---- overflow (⋯) menu ---------------------------------------------------------------------- */
.overflow-menu { position: relative; display: inline-flex; }
.overflow-toggle { font-size: 1.3rem; line-height: 1; }
.overflow-backdrop { position: fixed; inset: 0; z-index: 44; }
.overflow-list {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 45; min-width: 200px;
    display: flex; flex-direction: column; padding: 0.35rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.overflow-menu.align-start .overflow-list { right: auto; left: 0; }
.overflow-item { justify-content: flex-start; width: 100%; background: transparent; border: 0; color: var(--text); }
.overflow-item:hover:not(:disabled) { background: var(--surface-2); }
.overflow-item.danger-text { color: var(--danger-text); }

/* ---- signature: inline pad placeholder, touch thumbnail and full-screen pad ------------------ */
.signature-pad.pending { height: 190px; }
.signature-touch { display: flex; flex-direction: column; gap: 0.5rem; }
.signature-thumb { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.signature-thumb img { max-height: 90px; width: auto; align-self: flex-start; }
.signature-overlay {
    position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: auto 1fr auto; gap: 0.5rem;
    padding: calc(0.75rem + var(--safe-top)) max(0.75rem, env(safe-area-inset-right, 0px)) calc(0.75rem + var(--safe-bottom)) max(0.75rem, env(safe-area-inset-left, 0px));
    background: var(--bg);
}
.signature-overlay-head h2 { margin: 0; }
.signature-overlay-canvas {
    width: 100%; height: 100%; min-height: 180px; touch-action: none; -webkit-user-select: none; user-select: none;
    background: #fff linear-gradient(to top, transparent 25%, #C9CED8 25%, #C9CED8 calc(25% + 1px), transparent calc(25% + 1px));
    border: 2px dashed var(--border-strong); border-radius: var(--radius-sm);
}
.signature-overlay-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.signature-overlay-actions .btn-primary { min-width: 120px; }
}

/* ---- base/elements.css ---- */
@layer base {
/* Base layer: foundations shared by every component (docs/designs/design-system.md, sections 3 and 6).
   Imported into layer(base) by suite.css. Element selectors added here later apply only inside
   [data-ui="2"] (section 3, rule 4); class rules use the tp- prefix, so nothing here can reach a legacy
   screen. */

/* Icon (Components/Icon.razor): an SVG sprite symbol drawn in currentColor. */
.tp-icon {
    display: inline-block;
    flex: none;
    width: var(--icon-size, var(--icon-size-inherit));
    height: var(--icon-size, var(--icon-size-inherit));
    vertical-align: -0.25em;
    overflow: visible;
}

.tp-icon[data-size="sm"] { --icon-size: var(--icon-size-sm); }
.tp-icon[data-size="md"] { --icon-size: var(--icon-size-md); }
.tp-icon[data-size="lg"] { --icon-size: var(--icon-size-lg); }
.tp-icon[data-size="xl"] { --icon-size: var(--icon-size-xl); }
}

/* ---- base/a11y.css ---- */
@layer base {
/* Base layer: accessibility foundations (docs/designs/design-system.md, sections 6 and 11). Imported into
   layer(base) by suite.css. Class rules use the tp- prefix only, so nothing here reaches a legacy screen
   until its markup opts in. */

/* Skip link: the first tab stop of the shell, out of sight until it has focus (WCAG 2.4.1). Its target
   takes focus through ui.js focusTarget. Hidden by clipping, not by moving it off the page, so it never
   adds scrollable overflow. */
.tp-skip-link {
    position: fixed;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    z-index: var(--z-banner);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-3);
    font-weight: var(--font-weight-semibold);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.tp-skip-link:not(:focus) {
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
}

/* ---- patterns/landing.css ---- */
@layer patterns {
/* Pattern: the static landing and the boot screens of the two portals (docs/designs/design-system.md,
   sections 8 and 12; step DS-C02). Imported into layer(patterns) by suite.css, and inlined with the reset
   and the tokens into the <style id="tp-critical-css"> block of both portals' index.html by
   tools/css/build-css-bundles.mjs, so the landing paints before the stylesheet bundle, and long before
   any WebAssembly, arrives. These rules must stand on their own: every property the legacy element rules
   (body, h1, p, ul, a, img) would change once the bundle loads is set here, so nothing moves when it does.

   Which screen shows is data-boot on <html>, set before first paint by the boot script in index.html:
     landing  the static landing (#landing, outside #app): anyone without a live token. js/landing.js drives its
              sign-in area (and its in-app browser panel, DS-C04); Login.razor keeps it on screen and hides it
              when the user leaves the page (app.js landing)
     shell    a shell skeleton in #app: a returning user with a live token never sees the landing (nor one who
              signed in on the landing before the app had started: landing.js switches to it)
     splash   the wordmark and the load progress in #app: /privacy and /cookies without a token
     app      neither: Blazor shows a page other than the sign-in page
   No data-boot at all (no script) shows the landing. The boot screens live inside #app, so Blazor's first
   render replaces them.

   Load progress: while it downloads the app, Blazor sets --blazor-load-percentage ("45%") and
   --blazor-load-percentage-text ('"45%"', a string) on <html>. */

:root[data-boot]:not([data-boot="landing"]) .tp-landing { display: none; }
:root:not([data-boot="shell"], [data-boot="splash"]) .tp-boot { display: none; }
/* While the landing shows, the portals' app shell (AiRams.Portal.Shared PortalShell) does not: signed out, it
   only renders for a moment on the way to /login (RedirectToLogin), and its fixed tab bar would flash over
   the landing. */
:root[data-boot="landing"] .app-shell { display: none; }

/* ---- landing ------------------------------------------------------------------------------------- */
.tp-landing {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(1.25rem + env(safe-area-inset-top, 0px)) 1rem calc(7rem + env(safe-area-inset-bottom, 0px));
    background: radial-gradient(1200px 600px at 20% -10%, var(--color-brand-hover), var(--color-brand));
    color: var(--color-text);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-md);
    line-height: var(--line-height-normal);
    -webkit-font-smoothing: antialiased;
}

.tp-landing__inner {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    display: grid;
    gap: 1.5rem;
}

.tp-landing__copy {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.25rem;
    box-shadow: var(--shadow-4);
}

.tp-landing__brand {
    margin: 0 0 0.9rem;
    font-size: 1.15rem;
    font-weight: var(--font-weight-bold);
}

.tp-landing__brand span { color: var(--color-accent-text); }

.tp-landing__headline {
    margin: 0 0 0.6rem;
    font-size: clamp(1.9rem, 7vw, 2.6rem);
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.tp-landing__subline {
    margin: 0 0 1rem;
    color: var(--color-text-muted);
    font-size: 1.02rem;
}

.tp-landing__bullets {
    list-style: none;
    margin: 0 0 1.1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.tp-landing__bullets li {
    position: relative;
    padding-left: 1.9rem;
    font-size: 0.98rem;
    line-height: var(--line-height-snug);
}

.tp-landing__bullets li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    top: 0.05rem;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--color-brand);
    background: var(--color-accent);
}

.tp-landing__offer {
    display: inline-block;
    margin: 0 0 1rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-pill);
    font-weight: var(--font-weight-bold);
    font-size: 0.95rem;
    color: var(--color-brand);
    background: color-mix(in srgb, var(--color-accent) 22%, var(--color-surface));
    border: 1px solid var(--color-accent);
}

/* The accent fill as text was 3.9:1 on BuildProof's tint; accent text is 5.9:1. */
:where([data-scheme="dark"]) .tp-landing__offer { color: var(--color-accent-text); }

/* Sign-in area. data-state, set by TechnoPulse.Ui js/landing.js (DS-C03): loading (or no data-state: Google's
   script is still loading; a button-shaped placeholder with the app's load progress), ready (the Google
   button), busy (exchanging the credential), failed (Google's script did not load, or not within 8 seconds:
   the "could not load" line shows, with "Try again" under it). The alert above the button is written by
   landing.js; an empty one is hidden. */
.tp-landing__signin [hidden] { display: none; }

.tp-landing__google {
    display: flex;
    justify-content: flex-start;
    min-height: var(--target-size);
}

.tp-landing__busy {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tp-landing__signin:not([data-state="busy"]) .tp-landing__busy,
.tp-landing__signin:not([data-state="failed"]) .tp-landing__failed,
.tp-landing__signin:not([data-state="failed"]) .tp-landing__retry,
.tp-landing__signin[data-state="failed"] .tp-landing__pending { display: none; }

.tp-landing__failed { margin: 0 0 0.6rem; }

/* Button-shaped placeholder while the app boots: the size of Google's large button, filled by the load progress. */
.tp-landing__pending {
    position: relative;
    width: min(100%, 320px);
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    background: var(--color-surface-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.tp-landing__pending::after { content: "\00a0" var(--blazor-load-percentage-text, ""); }

.tp-landing__pending .tp-boot__fill {
    position: absolute;
    inset: auto 0 0;
    height: 3px;
}

/* In-app browser panel (DS-C04). In the Facebook, Instagram, TikTok... apps' own browsers, where Google sign-in
   does not work, landing.js sets data-inapp (android, ios, other) on the sign-in area and shows this panel in
   place of everything else in it: an intent link to Chrome on Android, the steps to Safari on iOS, the link to
   copy (and, behind a flag, to email) and "Continue anyway". */
.tp-landing__signin[data-inapp] > :not(.tp-landing__inapp) { display: none; }

.tp-landing__inapp {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface-2);
}

.tp-landing__inapp p,
.tp-landing__inapp form { margin: 0; }

.tp-landing__inapp-title {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-snug);
    letter-spacing: normal;
}

.tp-landing__steps {
    margin: 0;
    padding: 0 0 0 1.4rem;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.tp-landing__share,
.tp-landing__email {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.tp-landing__share label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.tp-landing__row {
    display: flex;
    gap: var(--space-2);
}

.tp-landing__field {
    flex: 1;
    min-width: 0;
    min-height: var(--target-size);
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: var(--font-size-sm);
}

.tp-landing__action {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--target-size);
    padding: 0 var(--space-4);
    border: 1px solid var(--color-brand);
    border-radius: var(--radius-sm);
    background: var(--color-brand);
    color: var(--color-on-brand);
    font: inherit;
    font-weight: var(--font-weight-bold);
    text-decoration: none;
    cursor: pointer;
}

.tp-landing__action--secondary {
    border-color: var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text);
}

.tp-landing__action:disabled { cursor: default; opacity: 0.6; }

.tp-landing__inapp-status {
    font-size: var(--font-size-sm);
    color: var(--color-text);
}

/* Empty, the live region stays in place (so what is written into it is announced) without the gap above it. */
.tp-landing__inapp-status:empty { margin-top: calc(-1 * var(--space-2)); }

.tp-landing__continue {
    align-self: flex-start;
    min-height: var(--target-size);
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text);
    font: inherit;
    font-size: var(--font-size-sm);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.tp-landing__inapp :focus-visible,
.tp-landing__retry:focus-visible {
    outline: var(--focus-width) solid var(--color-focus);
    outline-offset: var(--focus-offset);
}

.tp-landing__legal {
    margin: 1rem 0 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Small print must stay readable: the accent link colour is too faint at this size. */
.tp-landing__legal a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tp-landing__preview {
    display: flex;
    justify-content: center;
}

.tp-landing__preview img {
    width: min(78vw, 340px);
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45));
}

@media (min-width: 900px) {
    .tp-landing {
        align-items: center;
        padding-block: 2rem;
    }

    .tp-landing__inner {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
        align-items: center;
        gap: 3rem;
    }

    .tp-landing__inner--text-only {
        grid-template-columns: minmax(0, 560px);
        justify-content: center;
    }

    .tp-landing__copy { padding: 2.25rem 2.25rem 2rem; }

    .tp-landing__preview img { width: min(100%, 400px); }
}

/* ---- boot screens: the shell skeleton and the splash ---------------------------------------------- */
.tp-boot {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family-sans);
    font-size: var(--font-size-md);
    line-height: var(--line-height-normal);
    -webkit-font-smoothing: antialiased;
}

.tp-boot__bar {
    flex: none;
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 16px 0;
    display: flex;
    align-items: center;
    background: var(--color-brand);
    color: var(--color-on-brand);
}

.tp-boot__wordmark {
    margin: 0;
    font-size: 1.05rem;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* The wordmark accent on the product colour, as on the shell's top bar (owner, 2026-11-30): SiteScribe's
   amber fill; BuildProof's orange fill is 3.05:1 on its teal, so it takes the lighter orange (4.6:1), the
   value BuildProof's css/app.css gives its bar. */
.tp-boot__wordmark span { color: var(--color-accent); }
:where([data-theme="buildproof"]) .tp-boot__wordmark span { color: var(--tp-orange-300); }

.tp-boot__main {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: var(--space-5) 16px;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.tp-boot__main > .tp-boot__wordmark { display: none; }

.tp-boot__progress {
    height: 4px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--color-surface-2);
}

.tp-boot__fill {
    display: block;
    width: var(--blazor-load-percentage, 0%);
    height: 100%;
    background: var(--color-accent);
    transition: width var(--motion-duration-md) var(--motion-ease);
}

.tp-boot__status {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.tp-boot__status::after { content: "\00a0" var(--blazor-load-percentage-text, ""); }

.tp-boot__card {
    height: 5.5rem;
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-1);
}

/* The splash: the product's colour, the wordmark and the progress, centred (no skeleton: the page is not
   the app shell). */
:root[data-boot="splash"] .tp-boot {
    align-items: center;
    justify-content: center;
    background: var(--color-brand);
    color: var(--color-on-brand);
}

:root[data-boot="splash"] .tp-boot__bar,
:root[data-boot="splash"] .tp-boot__card { display: none; }

:root[data-boot="splash"] .tp-boot__main {
    flex: none;
    width: min(100%, 240px);
    align-items: center;
    gap: var(--space-4);
}

:root[data-boot="splash"] .tp-boot__main > .tp-boot__wordmark {
    display: block;
    font-size: 1.6rem;
}

:root[data-boot="splash"] .tp-boot__progress {
    align-self: stretch;
    background: color-mix(in srgb, var(--color-on-brand) 20%, transparent);
}

:root[data-boot="splash"] .tp-boot__status { color: var(--color-on-brand); }
}

/* ---- patterns/install-banner.css ---- */
@layer patterns {
/* Pattern: the portals' "add to home screen" banner (AiRams.Portal.Shared Layout/InstallPromptBanner.razor; step
   DS-C08, docs/designs/design-system.md, section 8 "First run"). It replaced a modal that opened over the first
   screen: a strip under the top bar, in the page flow, offered after the first drafted RAMS or analysed report or
   on the third visit, on a phone browser only. Imported into layer(patterns) by suite.css, so it is in the portal
   bundle. It sits among the legacy shell's banners and uses the legacy buttons (.btn), so their sizes are set here
   only where the touch floor needs it. Colours come from the semantic roles, so the dark and sunlight schemes
   follow. */

.tp-install-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) var(--gutter, var(--space-4));
  border-bottom: var(--border-width) solid var(--color-border);
  background: var(--color-info-subtle);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-snug);
}

.tp-install-banner__text {
  flex: 1 1 18rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.tp-install-banner__text p { margin: 0; }

.tp-install-banner__title { font-weight: var(--font-weight-bold); }

.tp-install-banner__steps {
  margin: var(--space-1) 0 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.tp-install-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tp-install-banner__actions .btn { min-height: var(--target-size); }
}

/* ---- utilities.css ---- */
@layer utilities {
/* Utilities: single-purpose classes that must win over component rules. Imported into layer(utilities),
   the last layer, by suite.css; tp- classes only. */

/* Read by screen readers, never shown (Components/VisuallyHidden). Clipped rather than moved off the
   page, so it never adds scrollable overflow. */
.tp-visually-hidden {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}
}
