/* =========================================================
   Easy Wills N Trusts — Custom Design System
   Palette follows the Easy Wills N Trusts design handoff (evergreen, clay, paper).
   ========================================================= */

/* ── CSS Custom Properties ─────────────────────────────── */
:root {
    /* Legacy --ewt-* palette, aliased to the ew roles in ew-tokens.css so the
       old names follow the theme (dark values come from --ew-*). New code uses
       rgb(var(--ew-*)) or the *-ew-* utilities directly. */
    --ewt-primary: rgb(var(--ew-brand));
    --ewt-primary-hover: rgb(var(--ew-ink));
    --ewt-primary-dark: rgb(var(--ew-ink));
    --ewt-primary-light: rgb(var(--ew-brand-soft));
    /* Comma-separated light channels, kept for older rgba() callers outside
       this file. New code writes rgb(var(--ew-brand) / a), which follows dark
       mode. */
    --ewt-primary-rgb: 47, 93, 78;

    /* Accent */
    --ewt-accent: rgb(var(--ew-accent));
    --ewt-accent-hover: rgb(var(--ew-accent));
    --ewt-accent-light: rgb(var(--ew-brand-soft));

    /* Neutrals */
    --ewt-heading: rgb(var(--ew-ink));
    --ewt-body: rgb(var(--ew-ink));
    --ewt-muted: rgb(var(--ew-ink-muted));
    /* Dark-ground caption uses the lighter stone. */
    --ewt-muted-on-dark: #c9ccc6;
    --ewt-border: rgb(var(--ew-border));
    --ewt-bg: rgb(var(--ew-surface));
    --ewt-card-bg: rgb(var(--ew-surface-raised));

    /* Navbar */
    --ewt-nav-bg: rgb(var(--ew-surface));
    --ewt-nav-text: rgb(var(--ew-ink));
    --ewt-nav-hover: rgb(var(--ew-brand));

    /* Shared */
    --ewt-radius: var(--ew-radius-md);
    --ewt-radius-sm: var(--ew-radius-sm);
    --ewt-radius-pill: var(--ew-radius-full);
    --ewt-shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --ewt-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .07), 0 2px 4px -2px rgba(0, 0, 0, .05);
    --ewt-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .08), 0 4px 6px -4px rgba(0, 0, 0, .04);
    --ewt-transition: 150ms ease;

    /* Font */
    --ewt-font: var(--ew-font-sans);
    --ewt-font-serif: var(--ew-font-serif);

    /* Phase 7.2 D-04 / D-05 scope tokens. The handoff has no per-document
       colours, so every scope follows brand / brand-soft in both themes. */
    --ewt-scope-will: rgb(var(--ew-brand));
    --ewt-scope-will-light: rgb(var(--ew-brand-soft));
    --ewt-scope-trust: rgb(var(--ew-brand));
    --ewt-scope-trust-light: rgb(var(--ew-brand-soft));
    --ewt-scope-package: rgb(var(--ew-brand));
    --ewt-scope-package-light: rgb(var(--ew-brand-soft));
    --ewt-scope-poa: rgb(var(--ew-brand));
    --ewt-scope-poa-light: rgb(var(--ew-brand-soft));
}

/* ── Dark-mode overrides ───────────────────────────────── */
/* Colours come from the aliases above (ew-tokens.css flips --ew-*). Only the
   shadows and the scope tokens are restated here. */
[data-bs-theme="dark"] {
    --ewt-shadow: 0 1px 3px rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .15);
    --ewt-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .25), 0 2px 4px -2px rgba(0, 0, 0, .15);

    /* Phase 7.2 D-04 dark scope tokens: same roles as :root. */
    --ewt-scope-will: rgb(var(--ew-brand));
    --ewt-scope-will-light: rgb(var(--ew-brand-soft));
    --ewt-scope-trust: rgb(var(--ew-brand));
    --ewt-scope-trust-light: rgb(var(--ew-brand-soft));
    --ewt-scope-package: rgb(var(--ew-brand));
    --ewt-scope-package-light: rgb(var(--ew-brand-soft));
    --ewt-scope-poa: rgb(var(--ew-brand));
    --ewt-scope-poa-light: rgb(var(--ew-brand-soft));
}

/* ── Global resets ─────────────────────────────────────── */
/* EWT-15 GAP: hard clip so public pages cannot grow document scrollWidth
   even if a nested surface overshoots by a few px (Product MATCH). */
html {
    overflow-x: clip;
}
body {
    font-family: var(--ewt-font);
    color: var(--ewt-body);
    background-color: var(--ewt-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--ewt-font-serif);
    color: var(--ewt-heading);
    font-weight: 600;
}
/* No tracking on headings: the token scale keeps -0.01em for the 44px display
   style only (text-display and the Home hero). C-282. */

/* ── Cards ─────────────────────────────────────────────── */
.card {
    border: 1px solid var(--ewt-border);
    border-radius: var(--ewt-radius);
    box-shadow: var(--ewt-shadow);
    background-color: var(--ewt-card-bg);
    transition: box-shadow var(--ewt-transition), transform var(--ewt-transition);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    /* Clip so box-shadow / wide children cannot expand scrollWidth. */
    overflow-x: clip;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--ewt-border);
    padding: 1rem 1.25rem;
}

.card-hover:hover {
    box-shadow: var(--ewt-shadow-md);
    transform: translateY(-2px);
}

/* EWT-15 GAP: flex alert children need min-width:0 so long copy cannot
   expand scrollWidth on narrow public pages (e.g. /disclaimer/). */
.ewt-alert {
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
    box-sizing: border-box;
}
.ewt-alert > *:not(.ewt-alert__close) {
    min-width: 0;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    border-radius: var(--ewt-radius-sm);
    font-weight: 500;
    padding: .5rem 1.25rem;
    transition: all var(--ewt-transition);
}

/* Text on a brand, ink or accent fill uses on-brand: white in light mode and
   dark green in dark mode, where those fills turn light (mint, cream, clay). */
.btn-primary {
    background-color: var(--ewt-primary);
    border-color: var(--ewt-primary);
    color: rgb(var(--ew-on-brand));
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--ewt-primary-hover);
    border-color: var(--ewt-primary-hover);
}

.btn-success {
    background-color: var(--ewt-accent);
    border-color: var(--ewt-accent);
    color: rgb(var(--ew-on-brand));
}
.btn-success:hover, .btn-success:focus {
    background-color: var(--ewt-accent-hover);
    border-color: var(--ewt-accent-hover);
}

.btn-outline-primary {
    color: var(--ewt-primary);
    border-color: var(--ewt-primary);
}
.btn-outline-primary:hover {
    background-color: var(--ewt-primary);
    border-color: var(--ewt-primary);
    color: rgb(var(--ew-on-brand));
}

.btn-pill {
    border-radius: var(--ewt-radius-pill);
    padding: .5rem 1.75rem;
}

/* Kit primary button: flat brand fill, 12px corners, no gradient or lift. */
.btn-cta {
    background: rgb(var(--ew-brand));
    border: none;
    color: rgb(var(--ew-on-brand));
    border-radius: var(--ew-radius-md);
    padding: .625rem 2rem;
    font-weight: 600;
    box-shadow: none;
}
.btn-cta:hover {
    background: rgb(var(--ew-ink));
    color: rgb(var(--ew-on-brand));
}

/* Form inputs: the crispy class shim lives in forms.css (kit TextField). */

/* ── Badges ────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    letter-spacing: .02em;
}
.badge.rounded-pill {
    padding: .35em .75em;
}

/* ── Navbar ────────────────────────────────────────────── */
.ewt-navbar {
    background-color: var(--ewt-nav-bg);
    padding-top: .75rem;
    padding-bottom: .75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.ewt-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.ewt-navbar .navbar-brand:hover {
    color: #fff;
}

.ewt-navbar .nav-link {
    color: var(--ewt-nav-text);
    font-weight: 500;
    font-size: .9rem;
    padding: .5rem .875rem;
    border-radius: var(--ewt-radius-sm);
    transition: color var(--ewt-transition), background-color var(--ewt-transition);
}
.ewt-navbar .nav-link:hover,
.ewt-navbar .nav-link:focus {
    color: var(--ewt-nav-hover);
    background-color: rgba(255, 255, 255, .08);
}

.ewt-navbar .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, .12);
}

.ewt-navbar .btn-nav-cta {
    background-color: var(--ewt-primary);
    color: rgb(var(--ew-on-brand));
    border-radius: var(--ewt-radius-pill);
    padding: .4rem 1.25rem;
    font-weight: 600;
    font-size: .875rem;
    border: none;
    transition: all var(--ewt-transition);
}
.ewt-navbar .btn-nav-cta:hover {
    background-color: var(--ewt-primary-hover);
    color: rgb(var(--ew-on-brand));
    transform: translateY(-1px);
}

/* User avatar circle */
.ewt-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ewt-primary) 0%, var(--ewt-primary-dark) 100%);
    color: rgb(var(--ew-on-brand));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .02em;
    flex-shrink: 0;
}

/* Admin badge in nav */
.ewt-admin-link {
    color: #fbbf24 !important;
    font-size: .85rem;
}
.ewt-admin-link:hover {
    color: #fcd34d !important;
    background-color: rgba(251, 191, 36, .1) !important;
}

/* ── Footer ────────────────────────────────────────────── */
.ewt-footer {
    background-color: var(--ewt-nav-bg);
    color: var(--ewt-nav-text);
    padding: 3rem 0 0;
    margin-top: 4rem;
}

.ewt-footer h6,
.ewt-footer .ewt-footer-heading {
    color: #fff;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 1rem;
}

.ewt-footer a {
    color: var(--ewt-nav-text);
    text-decoration: none;
    font-size: .875rem;
    transition: color var(--ewt-transition);
}
.ewt-footer a:hover {
    color: #fff;
}

.ewt-footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: 1.25rem 0;
    margin-top: 2rem;
    font-size: .8rem;
    color: var(--ewt-muted-on-dark);
}

/* Disclaimer/UPL block when rendered inside the dark footer needs the
   on-dark muted token to clear WCAG AA (4.5:1) on #0f172a. */
.ewt-footer .ewt-disclaimer-text,
.ewt-footer .ewt-upl-footer {
    color: var(--ewt-muted-on-dark);
}
.ewt-footer .ewt-disclaimer-link {
    color: var(--ewt-muted-on-dark);
}

.ewt-footer .footer-brand {
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
}

/* Site footer from the design handoff. The disclaimer partial keeps its
   locked wording; this only colours the link on the evergreen ground. */
.ew-site-footer .ewt-disclaimer-link {
    color: inherit;
}
/* The brand outline is under 3:1 on the light theme's ink footer, so the
   site footer uses the cream surface there. The dark footer is a raised
   dark surface, where the brand sage passes. */
/* The slim footer's disclaimer is full ink; its link must not fall back to the
   muted link colour set further down (LEGAL-COMPLIANCE 3.5). */
.ew-slim-footer .ewt-disclaimer-link {
    color: inherit;
}
.ew-site-footer .ewt-disclaimer-link:focus-visible {
    outline-color: rgb(var(--ew-surface));
}
[data-bs-theme="dark"] .ew-site-footer .ewt-disclaimer-link:focus-visible {
    outline-color: rgb(var(--ew-brand));
}

/* ── Hero section ──────────────────────────────────────── */
/* Legacy dark hero (no template renders it today). Its white text needs a
   dark ground in both themes, so the last stop is the fixed light-mode ink:
   --ewt-primary-dark would turn it cream in dark mode. */
.ewt-hero {
    background: linear-gradient(135deg, var(--ewt-nav-bg) 0%, #1e293b 50%, #1f2a26 100%);
    color: #fff;
    padding: 5rem 0 4rem;
    /* EWT-15 GAP: no horizontal negative-margin pull-out. #157 dropped 100vw
       but left margin: -1.5rem -1rem 0 which still overshot ~8px at ~390px
       (padding/subpixel/nested container ≠ exactly 1rem). Match home spirit:
       width 100% inside the padded main; only keep vertical top pull. */
    margin: -1.5rem 0 0;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
}

.ewt-hero h1 {
    color: #fff;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.ewt-hero .lead {
    color: #cbd5e1;
    font-size: 1.2rem;
    max-width: 540px;
}

@media (max-width: 767.98px) {
    .ewt-hero {
        padding: 3rem 0 2.5rem;
    }
    .ewt-hero h1 {
        font-size: 2rem;
    }
}

/* ── EWT-26: paper/ink public home (scoped; do not lead with dark) ── */
body:has(.ewt-home-landing--paper) {
    --ewt-paper: #FAF7F2;
    --ewt-ink: #1C1917;
    background-color: var(--ewt-paper);
}
body:has(.ewt-home-landing--paper) .ewt-navbar {
    background-color: #f3efe7;
    backdrop-filter: none;
    border-bottom: 1px solid #e7e5e4;
    color: var(--ewt-ink, #1C1917);
}
body:has(.ewt-home-landing--paper) .ewt-navbar .navbar-brand,
body:has(.ewt-home-landing--paper) .ewt-navbar .nav-link {
    color: #44403c;
}
body:has(.ewt-home-landing--paper) .ewt-navbar .nav-link:hover,
body:has(.ewt-home-landing--paper) .ewt-navbar .nav-link:focus,
body:has(.ewt-home-landing--paper) .ewt-navbar .navbar-brand:hover {
    color: var(--ewt-ink, #1C1917);
}
body:has(.ewt-home-landing--paper) .ewt-navbar .nav-link.active {
    color: var(--ewt-primary);
}
body:has(.ewt-home-landing--paper) .ewt-navbar button[aria-label="Toggle navigation"] {
    color: var(--ewt-ink, #1C1917);
}
body:has(.ewt-home-landing--paper) .ewt-navbar .btn-nav-cta {
    background-color: var(--ewt-primary);
    color: rgb(var(--ew-on-brand));
}

/* ── Public home: full-bleed main + sticky hero scroll-fade ── */
.ewt-home-main {
    max-width: none;
    width: 100%;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0;
}
.ewt-home-main > .messages {
    max-width: 72rem;
    margin-left: auto;
    margin-right: auto;
    padding: 0.75rem 1rem 0;
}

/* Authenticated home: content column ~1150px at 1280 (PageDashboard). */
.ewt-home-auth {
    max-width: none;
    width: 100%;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0;
}
.ewt-home-auth > .messages {
    max-width: 72rem;
    margin-left: auto;
    margin-right: auto;
    padding: 0.75rem 1.25rem 0;
}
.ewt-home-dashboard {
    max-width: 72rem;
    margin: 0 auto;
    padding: 2.5rem 2.5rem 4rem;
}
.ewt-content-wide {
    max-width: 72rem;
}
.ewt-home-dashboard__intro {
    margin-bottom: 1.25rem;
}
.ewt-home-dashboard__other {
    margin: 0.75rem 0 1.5rem;
}
.ewt-home-task {
    margin-bottom: 0.25rem;
    height: auto;
    transition: box-shadow var(--ewt-transition);
}
.ewt-home-task .ewt-document-card__doc-icon {
    align-self: flex-start;
    width: 5.5rem;
    min-height: 0;
    padding: 0.75rem 0.5rem;
}
.ewt-home-task .ewt-document-card__doc-icon > span[aria-hidden="true"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.ewt-home-task .ewt-document-card__doc-icon-pct {
    font-variant-numeric: tabular-nums;
}
.ewt-home-task__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    min-height: 48px;
    white-space: nowrap;
}
.ewt-home-task__type {
    font-size: 14px;
    line-height: 20px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ewt-muted);
    margin-bottom: 0.5rem;
}
@media (max-width: 639.98px) {
    .ewt-home-dashboard {
        padding: 1.5rem 1rem 2.5rem;
    }
    .ewt-home-task > .flex {
        flex-direction: column;
    }
    .ewt-home-task .ewt-document-card__doc-icon {
        flex-direction: row;
        width: auto;
        padding: 0.5rem 0.75rem;
    }
    .ewt-home-task__cta {
        width: 100%;
        white-space: nowrap;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

.ewt-home-landing {
    --ewt-hero-opacity: 1;
    --ewt-navbar-offset: 3.5rem;
}

/* EWT-26 paper hero + product frame + outcome tiles */
.ewt-home-landing--paper {
    --ewt-paper: #FAF7F2;
    --ewt-ink: #1C1917;
}
.ewt-hero--home.ewt-hero--paper {
    background: var(--ewt-paper, #F3EFE7);
    color: var(--ewt-ink, #1C1917);
}
.ewt-hero--home.ewt-hero--paper h1 {
    color: var(--ewt-ink, #1C1917);
    font-size: clamp(1.75rem, 3.2vw, 2.4rem);
    line-height: 1.2;
}
.ewt-hero--home.ewt-hero--paper .lead {
    color: #57534e;
}
.ewt-hero--home.ewt-hero--paper .ewt-hero-secondary {
    border: 1px solid #d6d3d1;
    color: var(--ewt-ink, #1C1917);
    background: #fff;
}
.ewt-hero--home.ewt-hero--paper .ewt-hero-secondary:hover {
    border-color: var(--ewt-primary);
    color: var(--ewt-primary);
}
.ewt-trust-row {
    margin-top: 1.25rem;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: #44403c;
    letter-spacing: 0.01em;
}
.ewt-trust-badge--coming {
    color: #57534e;
    background: #fff;
    border: 1px solid #e7e5e4;
}
.ewt-product-frame {
    background: #fff;
    border: 1px solid #e7e5e4;
    border-radius: 4px;
    box-shadow: none;
    overflow: hidden;
}
.ewt-product-frame__kicker {
    margin: 0;
    padding: 0.55rem 0.9rem;
    background: #f5f5f4;
    border-bottom: 1px solid #e7e5e4;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #78716c;
}
.ewt-product-frame__screen {
    padding: 1.75rem 1.5rem 1.75rem;
    background: var(--ewt-paper, #FAF7F2);
}
.ewt-product-frame__progress {
    font-size: 0.8rem;
    font-weight: 600;
    color: #78716c;
    margin-bottom: 0.75rem;
}
.ewt-product-frame__question {
    font-size: clamp(1.25rem, 2.5vw, 1.6rem);
    font-weight: 700;
    color: var(--ewt-ink, #1C1917);
    line-height: 1.3;
    margin-bottom: 1.25rem;
}
.ewt-product-frame__choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.ewt-product-frame__choice {
    display: block;
    text-align: center;
    padding: 0.9rem 1rem;
    border-radius: 4px;
    border: 1px solid #d6d3d1;
    background: #fff;
    font-weight: 600;
    color: var(--ewt-ink, #1C1917);
}
.ewt-home-quiz__question {
    font-size: clamp(1.25rem, 2.5vw, 1.6rem);
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 1.25rem;
    color: var(--ewt-ink, #1C1917);
}
.ewt-home-quiz__question:focus-visible {
    outline: 2px solid var(--ewt-primary, #4f46e5);
    outline-offset: 3px;
}
.ewt-home-quiz__choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.ewt-home-quiz__choices--state {
    grid-template-columns: 1fr;
}
@media (min-width: 480px) {
    .ewt-home-quiz__choices--state {
        grid-template-columns: 1fr 1fr 1fr;
    }
}
.ewt-home-quiz__choice {
    display: block;
    width: 100%;
    min-height: 44px;
    text-align: center;
    padding: 0.9rem 1rem;
    border-radius: 4px;
    border: 1px solid #d6d3d1;
    background: #fff;
    font-weight: 600;
    color: var(--ewt-ink, #1C1917);
    cursor: pointer;
}
.ewt-home-quiz__choice:hover {
    border-color: #a8a29e;
}
.ewt-home-quiz__choice:focus-visible,
.ewt-home-quiz__back:focus-visible {
    outline: 2px solid var(--ewt-primary, #4f46e5);
    outline-offset: 2px;
}
.ewt-home-quiz__back {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 0.875rem;
    text-decoration: underline;
    cursor: pointer;
    min-height: 44px;
}
.ewt-home-quiz__poa {
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.875rem;
}
.ewt-home-quiz-slot:empty {
    display: none;
}
.ewt-home-quiz-slot {
    max-width: 40rem;
    margin: 0 auto 2rem;
    padding: 0 1rem;
}
.ewt-home-quiz-slot .ewt-home-quiz {
    border: 1px solid #e7e5e4;
    border-radius: 4px;
    background: var(--ewt-paper, #FAF7F2);
    padding: 1.25rem 1.15rem 1.35rem;
}
.ewt-home-quiz-noscript {
    margin: 0 auto 2rem;
}
.ewt-outcome-section {
    padding-top: 3rem;
}
.ewt-outcome-tile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem 1.35rem;
    border: 1px solid #e7e5e4;
    border-radius: 4px;
    background: #fff;
    text-decoration: none;
    color: inherit;
    transition: border-color var(--ewt-transition);
}
.ewt-outcome-tile:hover {
    border-color: #a8a29e;
    box-shadow: none;
    transform: none;
    text-decoration: none;
    color: inherit;
}
.ewt-outcome-tile__title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--ewt-ink, #1C1917);
}
.ewt-outcome-tile__blurb {
    font-size: 0.95rem;
    color: #57534e;
    margin: 0;
    flex-grow: 1;
}
.ewt-outcome-tile__link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ewt-primary);
}
.ewt-home-landing--paper .ewt-home-sheet {
    background: #fff;
    box-shadow: none;
    border-radius: 0;
}
@media (max-width: 767.98px) {
    .ewt-hero--home.ewt-hero--paper h1 {
        font-size: 1.55rem;
    }
    .ewt-product-frame__screen {
        padding: 1.35rem 1.1rem 1.35rem;
    }
}


.ewt-hero-stage {
    position: sticky;
    top: var(--ewt-navbar-offset);
    z-index: 0;
}

.ewt-hero--home {
    /* Full-bleed main: no 100vw / negative-margin hack (avoids horizontal scroll). */
    margin: 0;
    width: 100%;
    max-width: none;
    padding: 3rem 0 2.75rem;
    opacity: var(--ewt-hero-opacity, 1);
    will-change: opacity;
    pointer-events: auto;
    overflow: hidden;
    background:
        radial-gradient(ellipse 55% 70% at 85% 30%, rgba(79, 70, 229, 0.22) 0%, transparent 55%),
        linear-gradient(135deg, var(--ewt-nav-bg) 0%, #1e293b 50%, #1f2a26 100%);
}
.ewt-home-landing[data-hero-faded="true"] .ewt-hero--home {
    pointer-events: none;
}

/* Two-column split uses Tailwind: grid grid-cols-1 lg:grid-cols-12 +
   lg:col-span-6 (regenerate with scripts/build_tailwind.sh after class changes). */

.ewt-hero--home h1 {
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    text-wrap: balance;
    margin-bottom: 0;
}
.ewt-hero--home .lead {
    font-size: 1.15rem;
    line-height: 1.55;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    max-width: 36rem;
}

.ewt-hero-badges--inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-top: 1.5rem;
}
.ewt-hero--home .ewt-hero-badges--inline .ewt-trust-badge {
    color: #e2e8f0;
}

/* Right column illustration — fills the aside, centered content */
.ewt-hero-aside {
    min-width: 0;
}
.ewt-hero--home .ewt-hero-illustration {
    text-align: center;
    padding: 2.25rem 1.75rem 1.75rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 16px 40px rgba(0, 0, 0, 0.22);
}
.ewt-hero--home .ewt-hero-shield-icon {
    font-size: 4.25rem;
    color: var(--ewt-primary);
    opacity: 0.95;
    line-height: 1;
}
.ewt-hero--home .ewt-hero-caption {
    color: #cbd5e1;
    font-size: 0.95rem;
    line-height: 1.45;
}

/* Compact 2×2 suite chips inside the illustration card */
.ewt-hero-suite {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-top: 1.5rem;
    text-align: left;
}
.ewt-hero-suite span {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
}
.ewt-hero-suite i {
    color: #a5b4fc;
    font-size: 1rem;
}

/* Content panel scrolls over the pinned hero */
.ewt-home-sheet {
    position: relative;
    z-index: 1;
    background: var(--ewt-bg);
    border-radius: 1.25rem 1.25rem 0 0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
    /* Pull slightly over the hero so the cover edge is visible early */
    margin-top: -0.75rem;
}

@media (max-width: 767.98px) {
    .ewt-hero--home {
        padding: 2rem 0 1.75rem;
    }
    .ewt-hero--home h1 {
        font-size: 1.85rem;
    }
    .ewt-hero--home .ewt-hero-illustration {
        padding: 1.75rem 1.25rem 1.35rem;
    }
    .ewt-hero--home .ewt-hero-shield-icon {
        font-size: 3.25rem;
    }
    .ewt-home-sheet {
        border-radius: 1rem 1rem 0 0;
        margin-top: -0.5rem;
    }
}

@media (min-width: 768px) {
    .ewt-home-landing--paper .ewt-hero--home {
        max-height: calc(100dvh - var(--ewt-navbar-offset, 4.5rem));
        overflow-y: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ewt-hero-stage {
        position: static;
    }
    .ewt-home-landing--paper .ewt-hero--home {
        max-height: none;
        overflow: hidden;
    }
    .ewt-hero--home {
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    .ewt-home-sheet {
        margin-top: 0;
        box-shadow: none;
    }
}

/* EWT-26 mobile rematch2 (~390×844). Rematch #184 still left both outcome
   tiles ~126px past the ≤50%-viewport scroll budget. Further shrink the
   paper hero + outcome stack so both tiles are fully readable by ~420px
   scroll. Hide the product frame and unpin the stage only ≤767.98px; lg
   keeps the sticky stage and question frame. No 100vh. */
@media (max-width: 767.98px) {
    .ewt-home-landing--paper .ewt-hero-stage {
        position: static;
    }
    .ewt-home-landing--paper .ewt-hero-aside,
    .ewt-home-landing--paper .ewt-hero-aside .ewt-product-frame {
        display: none;
    }
    .ewt-home-landing--paper .ewt-hero .grid {
        gap: 0;
    }
    .ewt-hero--home.ewt-hero--paper {
        padding: 0.75rem 0 0.35rem;
    }
    .ewt-hero--home.ewt-hero--paper h1 {
        font-size: 1.4rem;
        line-height: 1.2;
    }
    .ewt-hero--home.ewt-hero--paper .lead {
        font-size: 1.05rem;
        line-height: 1.45;
        margin-top: 0.5rem;
        margin-bottom: 0.7rem;
    }
    .ewt-hero--home.ewt-hero--paper .btn-cta,
    .ewt-hero--home.ewt-hero--paper .ewt-hero-secondary {
        min-height: 48px;
        padding: 0.5rem 0.9rem;
        font-size: 1rem;
        line-height: 1.25;
    }
    .ewt-hero--home.ewt-hero--paper .ewt-trust-row {
        margin-top: 0.45rem;
        font-size: 0.85rem;
        line-height: 1.35;
    }
    /* Pull sheet slightly over hero; keep empty-band under trust ≤96px. */
    .ewt-home-landing--paper .ewt-home-sheet {
        margin-top: -0.5rem;
    }
    .ewt-home-landing--paper .ewt-outcome-section {
        padding-top: 0.6rem;
        padding-bottom: 1.5rem;
    }
    .ewt-home-landing--paper .ewt-outcome-section .ewt-section-title {
        font-size: 1.35rem;
        margin-bottom: 0.3rem;
    }
    .ewt-home-landing--paper .ewt-outcome-section .ewt-section-subtitle {
        margin-bottom: 0.85rem;
        font-size: 0.92rem;
        line-height: 1.4;
    }
    .ewt-home-landing--paper .ewt-outcome-section .grid {
        gap: 0.65rem;
    }
    .ewt-home-landing--paper .ewt-outcome-tile {
        padding: 0.95rem 1.1rem;
        gap: 0.35rem;
    }
    .ewt-home-landing--paper .ewt-outcome-tile__title {
        font-size: 1.05rem;
    }
    .ewt-home-landing--paper .ewt-outcome-tile__blurb {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* ── Section styles ────────────────────────────────────── */
.ewt-section {
    padding: 4rem 0;
}

.ewt-section-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: .5rem;
}

.ewt-section-subtitle {
    text-align: center;
    color: var(--ewt-muted);
    max-width: 560px;
    margin: 0 auto 2.5rem;
}

/* Feature / value-prop cards */
.ewt-feature-card {
    text-align: center;
    padding: 2rem 1.5rem;
    border: 1px solid var(--ewt-border);
    border-radius: var(--ewt-radius);
    background: var(--ewt-card-bg);
    transition: all var(--ewt-transition);
}
.ewt-feature-card:hover {
    box-shadow: var(--ewt-shadow-md);
    transform: translateY(-4px);
}

.ewt-feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.ewt-feature-icon.indigo {
    background-color: var(--ewt-primary-light);
    color: var(--ewt-primary);
}
.ewt-feature-icon.emerald {
    background-color: var(--ewt-accent-light);
    color: var(--ewt-accent);
}
.ewt-feature-icon.amber {
    background-color: #fef3c7;
    color: #d97706;
}
.ewt-feature-icon.rose {
    background-color: #ffe4e6;
    color: #e11d48;
}

/* How it works steps (no template renders these today) */
.ewt-step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ewt-primary) 0%, var(--ewt-primary-dark) 100%);
    color: rgb(var(--ew-on-brand));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 14px rgb(var(--ew-brand) / .3);
}

/* Connecting line between steps */
.ewt-step-connector {
    position: relative;
}
.ewt-step-connector::after {
    content: '';
    position: absolute;
    top: 24px;
    left: calc(50% + 32px);
    width: calc(100% - 64px);
    height: 2px;
    background: linear-gradient(90deg, var(--ewt-primary), var(--ewt-border));
    z-index: 0;
}
@media (max-width: 767.98px) {
    .ewt-step-connector::after {
        display: none;
    }
}

/* Trust/security badges strip — appears on dark hero/footer AND light auth cards */
.ewt-trust-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--ewt-muted);
    font-size: .85rem;
    font-weight: 500;
}
.ewt-hero .ewt-trust-badge,
.ewt-footer .ewt-trust-badge {
    color: var(--ewt-muted-on-dark);
}
.ewt-trust-badge i {
    color: var(--ewt-accent);
    font-size: 1rem;
}

/* ── Auth pages ────────────────────────────────────────── */
.ewt-auth-wrapper {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.ewt-auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: var(--ewt-radius);
    box-shadow: var(--ewt-shadow-lg);
    background: var(--ewt-card-bg);
    border: 1px solid var(--ewt-border);
    padding: 2.5rem 2rem;
}

.ewt-auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.ewt-auth-brand .brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ewt-primary) 0%, var(--ewt-primary-dark) 100%);
    color: rgb(var(--ew-on-brand));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: .75rem;
}

.ewt-auth-brand h2 {
    font-size: 1.4rem;
    margin-bottom: .25rem;
}

.ewt-auth-brand p {
    color: var(--ewt-muted);
    font-size: .9rem;
    margin-bottom: 0;
}

/* ── Profile page ──────────────────────────────────────── */
.ewt-profile-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: .5rem;
    flex-shrink: 0;
}

/* ── Trust cards (list page) ───────────────────────────── */
.ewt-trust-card {
    border-radius: var(--ewt-radius);
    border: 1px solid var(--ewt-border);
    background: var(--ewt-card-bg);
    padding: 1.5rem;
    transition: all var(--ewt-transition);
    height: 100%;
}
.ewt-trust-card:hover {
    box-shadow: var(--ewt-shadow-md);
    transform: translateY(-2px);
}

.ewt-trust-card.in-progress {
    border: 2px dashed #f59e0b;
    background: rgba(245, 158, 11, .03);
}

/* ── Empty state ───────────────────────────────────────── */
.ewt-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--ewt-muted);
}
.ewt-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: .5;
}

/* Pending questionnaire banner */
.ewt-pending-banner {
    border-left: 4px solid var(--ewt-primary);
    border-radius: var(--ewt-radius-sm);
    background-color: var(--ewt-primary-light);
    padding: 1rem 1.25rem;
}
[data-bs-theme="dark"] .ewt-pending-banner {
    background-color: rgb(var(--ew-brand) / .12);
}

/* ── Progress bar ──────────────────────────────────────── */
.progress {
    border-radius: var(--ewt-radius-pill);
    overflow: hidden;
}
.progress-bar {
    background: linear-gradient(90deg, var(--ewt-primary) 0%, var(--ewt-primary-dark) 100%);
}

/* ── Utility classes ───────────────────────────────────── */
.text-ewt-primary { color: var(--ewt-primary) !important; }
.text-ewt-accent  { color: var(--ewt-accent) !important; }
.text-ewt-muted   { color: var(--ewt-muted) !important; }
.bg-ewt-primary   { background-color: var(--ewt-primary) !important; }
.bg-ewt-light     { background-color: var(--ewt-primary-light) !important; }
.border-ewt       { border-color: var(--ewt-border) !important; }

/* Gradient text */
.ewt-gradient-text {
    background: linear-gradient(135deg, var(--ewt-primary) 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Section gradient bg */
.ewt-section-gradient {
    background: linear-gradient(180deg, var(--ewt-bg) 0%, #fff 100%);
}
[data-bs-theme="dark"] .ewt-section-gradient {
    background: linear-gradient(180deg, var(--ewt-bg) 0%, var(--ewt-card-bg) 100%);
}

/* ── Extracted inline styles (DEBT-05) ───────────────── */

/* Profile icon color variants */
.ewt-profile-icon.emerald { background-color: var(--ewt-accent-light); }
.ewt-profile-icon.emerald i { color: var(--ewt-accent); }
.ewt-profile-icon.amber { background-color: #fef3c7; }
.ewt-profile-icon.amber i { color: #d97706; }
.ewt-profile-icon.slate { background-color: #e2e8f0; }
.ewt-profile-icon.slate i { color: #64748b; }
[data-bs-theme="dark"] .ewt-profile-icon.slate { background-color: #334155; }
[data-bs-theme="dark"] .ewt-profile-icon.slate i { color: #94a3b8; }
.ewt-profile-icon.rose { background-color: #ffe4e6; }
.ewt-profile-icon.rose i { color: #e11d48; }
.ewt-profile-icon.indigo { background-color: var(--ewt-primary-light); }
.ewt-profile-icon.indigo i { color: var(--ewt-primary); }

/* Feature icon size variants */
.ewt-feature-icon-lg { width: 64px; height: 64px; font-size: 1.75rem; }
.ewt-feature-icon-sm { width: 40px; height: 40px; font-size: 1rem; }
.ewt-avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }

/* Hero section overrides */
.ewt-hero-compact { padding: 3.5rem 0 3rem; }
.ewt-hero-title-md { font-size: 2.5rem; }
.ewt-hero-subtitle { max-width: 580px; color: #cbd5e1; }
.ewt-hero-illustration {
    background: rgba(255,255,255,.05);
    border-radius: var(--ewt-radius);
    padding: 3rem 2rem;
    border: 1px solid rgba(255,255,255,.08);
}
.ewt-hero-shield-icon { font-size: 5rem; color: var(--ewt-primary); opacity: .9; }
.ewt-hero-caption { color: var(--ewt-muted); font-size: .9rem; }
[data-bs-theme="dark"] .ewt-hero-caption { color: #94a3b8; }
/* Home hero caption is already on-dark slate. */
[data-bs-theme="dark"] .ewt-hero--home .ewt-hero-caption { color: #cbd5e1; }

/* Max-width utilities */
.ewt-max-w-prose { max-width: 560px; margin: 0 auto; }
.ewt-max-w-auth-split { max-width: 860px; width: 100%; }
.ewt-max-w-footer-desc { max-width: 280px; }

/* Auth sidebar */
.ewt-auth-sidebar { background: var(--ewt-nav-bg); color: #fff; }
.ewt-auth-sidebar h3 { color: #fff; }
.ewt-auth-card-split {
    max-width: 100%;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Password strength meter */
.ewt-pw-meter { display: none; }
.ewt-pw-meter-track {
    flex: 1;
    height: 6px;
    border-radius: 50rem;
    background: rgb(var(--ew-border));
    overflow: hidden;
}
.ewt-pw-meter-fill {
    height: 100%;
    width: 0%;
    border-radius: 50rem;
    background-color: transparent;
    transition: width 300ms ease, background-color 300ms ease;
}
/* password-strength.js sets data-level on the bar and the label. The word
   is always shown beside the bar, so colour is never the only signal. */
.ewt-pw-meter-fill[data-level="weak"] { background-color: rgb(var(--ew-error)); }
.ewt-pw-meter-fill[data-level="fair"] { background-color: rgb(var(--ew-accent)); }
.ewt-pw-meter-fill[data-level="strong"] { background-color: rgb(var(--ew-brand)); }
.ewt-pw-meter-label { min-width: 50px; font-weight: 700; }
.ewt-pw-meter-label[data-level="weak"] { color: rgb(var(--ew-error)); }
.ewt-pw-meter-label[data-level="fair"] { color: rgb(var(--ew-accent)); }
.ewt-pw-meter-label[data-level="strong"] { color: rgb(var(--ew-brand)); }

/* Footer disclaimer */
.ewt-disclaimer-text { color: var(--ewt-muted); font-size: 14px; line-height: 20px; }
.ewt-disclaimer-link { color: var(--ewt-muted); }
/* The footer disclaimer partial is legal copy and stays untouched, so its
   link gets the brand focus ring here. outline-offset leaves a gap in
   whatever ground the footer has (ink on the site footer, surface in the
   questionnaire). */
footer .ewt-disclaimer-link:focus-visible {
    outline: 2px solid rgb(var(--ew-brand));
    outline-offset: 2px;
    border-radius: 2px;
}

/* Wizard progress bar */
.ewt-nav-progress { height: 5px; }

/* Child form minor indicator */
.ewt-minor-indicator { display: none; }

/* ==========================================================================
   Phase 5-01: Focus mode + step summary (D-04, D-08, D-09, D-14)
   ========================================================================== */
.ewt-focus-screen {
    padding: 2rem 1.5rem;
    animation-duration: 280ms;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}
.ewt-slide-in-right { animation-name: ewtSlideInRight; }
.ewt-slide-in-left  { animation-name: ewtSlideInLeft; }
@keyframes ewtSlideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes ewtSlideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .ewt-focus-screen,
    .ewt-slide-in-right,
    .ewt-slide-in-left {
        animation-name: ewtFadeIn;
        animation-duration: 150ms;
        transform: none !important;
    }
    @keyframes ewtFadeIn { from { opacity: 0; } to { opacity: 1; } }
}
.ewt-focus-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}
.ewt-focus-nav .btn { min-width: 140px; }
/* Phase 6.1 D-04: Section-mode nav rhythm mirrors .ewt-focus-nav.
   Two-child horizontal row: Previous (order-1) | Next (order-3).
   Save and Exit lives in the task bar. When .ewt-mobile-nav is present
   (all breakpoints except final-review), questionnaire.css hides this
   in-card row so the sticky bar is the visible Continue. */
@media (min-width: 768px) {
    /* Only when sticky bar is absent (final-review). Sticky owns CTA otherwise. */
    html:not(:has(.ewt-mobile-nav)) .ewt-section-nav {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin-top: 2rem;
        gap: 1rem;
    }
    html:not(:has(.ewt-mobile-nav)) .ewt-section-nav > .order-1,
    html:not(:has(.ewt-mobile-nav)) .ewt-section-nav > .order-2,
    html:not(:has(.ewt-mobile-nav)) .ewt-section-nav > .order-3 {
        display: flex;
        align-items: center;
    }
    .ewt-section-nav .btn-primary,
    .ewt-section-nav .btn-outline-secondary,
    .ewt-section-nav .btn-success {
        min-width: 140px;
    }
}
.ewt-focus-toggle {
    color: var(--ewt-muted, #6b7280);
    font-size: 0.875rem;
    font-weight: 400;
    text-decoration: none;
}
.ewt-focus-toggle:hover {
    color: var(--ewt-primary);
    text-decoration: underline;
}
.ewt-step-summary { padding: 2rem 1.5rem; }
.ewt-summary-group { margin-bottom: 1rem; }
.ewt-summary-group-heading {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ewt-primary);
    border-bottom: 1px solid var(--ewt-border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}
.ewt-summary-row {
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--ewt-border);
}
.ewt-summary-row:last-child { border-bottom: none; }
.ewt-summary-label { width: 40%; }
.ewt-summary-value { flex: 1; }
.ewt-summary-edit {
    color: var(--ewt-primary);
    text-decoration: none;
    font-size: 0.875rem;
}
.ewt-summary-edit:hover { text-decoration: underline; }
@media (max-width: 575.98px) {
    .ewt-summary-row,
    .ewt-fiduciary-row {
        flex-wrap: wrap;
        gap: 0.25rem 0.75rem;
        align-items: flex-start;
    }
    .ewt-summary-label,
    .ewt-summary-value {
        width: auto;
        flex: 1 1 100%;
    }
    .ewt-fiduciary-row__level {
        margin-top: 0.25rem;
    }
}
@media (max-width: 767.98px) {
    .ewt-focus-screen { padding: 1rem 1rem; }
    .ewt-focus-toggle { display: none !important; }  /* D-14 */
}

/* =====================================================================
   Phase 5-02: Mobile responsiveness chrome (QUX-04, D-13..D-20)
   ===================================================================== */
@media (max-width: 767.98px) {
    /* Touch targets (D-15) */
    .form-control, .form-select, .btn,
    .ewt-btn, .ewt-mobile-nav .ewt-btn, .ewt-section-nav .ewt-btn { min-height: 48px; }
    .btn-sm { min-height: 44px; }
    input, select, textarea { font-size: 16px; }  /* prevent iOS auto-zoom */

    /* Hide desktop inline focus nav on mobile — sticky bar takes over (D-20) */
    .ewt-focus-nav { display: none !important; }

    /* Sticky bottom navigation (D-20, Pitfall 8) */
    .ewt-mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
        background: var(--ewt-card-bg, #fff);
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
    }
    .ewt-mobile-nav .btn,
    .ewt-mobile-nav .ewt-btn { min-height: 48px; }
    .ewt-mobile-saved-cluster {
        flex: 1;
        min-width: 0;
        text-align: center;
    }
    .ewt-mobile-saved-slot {
        display: block;
        text-align: center;
        font-size: 0.875rem;
        color: var(--ewt-accent, #059669);
    }
    /* Content padding-bottom so the fixed nav never covers errors / submit (Pitfall 8) */
    .questionnaire-main {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    /* Narrow phones: clip horizontal overflow from crispy columns / cards. */
    .ewt-task-page,
    .questionnaire-main,
    .ewt-task-page .ewt-card,
    .ewt-option-card-grid,
    .ewt-formset-row {
        max-width: 100%;
        min-width: 0;
    }
    .ewt-task-page {
        overflow-x: clip;
    }

    /* Steps lives in the task bar. Do not restore the old fixed FAB
       (it overlapped the sticky task bar at top: 68px). */
    .ewt-task-bar .ewt-sidebar-toggle {
        position: static;
        width: auto;
        height: auto;
        min-height: 40px;
        padding: 0.4rem 0.75rem;
        border-radius: 999px;
        box-shadow: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--ewt-card-bg, #fff);
        border: 1px solid var(--ewt-border, rgba(0, 0, 0, 0.12));
        color: var(--ewt-body, #334155);
    }
    .ewt-sidebar-toggle:hover,
    .ewt-sidebar-toggle:focus {
        background: var(--ewt-bg, #f1f5f9);
    }
    .ewt-sidebar-toggle i { font-size: 1.25rem; }

    /* Hide the desktop fixed sidebar on mobile — offcanvas takes over */
    .questionnaire-sidebar { display: none !important; }

    /* Hide the legacy pre-Phase-5 floating nav toggle + overlay — Phase 5's
       .ewt-sidebar-toggle hamburger + Bootstrap offcanvas replace them on mobile.
       Leaving the legacy button visible overlaps the sticky bottom nav's Back button. */
    .nav-toggle-btn { display: none !important; }
    .nav-overlay { display: none !important; }

    /* In-card section-nav is CSS-hidden whenever the sticky bar is present
       (see the global html:has(.ewt-mobile-nav) rule below). These stacked
       full-width rules apply only on steps that omit the sticky bar
       (final-review). */
    html[data-focus-mode="off"]:not(:has(.ewt-mobile-nav)) .ewt-section-nav {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin-top: 2rem;
    }
    html[data-focus-mode="off"]:not(:has(.ewt-mobile-nav)) .ewt-section-nav > .order-1,
    html[data-focus-mode="off"]:not(:has(.ewt-mobile-nav)) .ewt-section-nav > .order-2,
    html[data-focus-mode="off"]:not(:has(.ewt-mobile-nav)) .ewt-section-nav > .order-3 {
        display: flex;
    }
    html[data-focus-mode="off"]:not(:has(.ewt-mobile-nav)) .ewt-section-nav .btn,
    html[data-focus-mode="off"]:not(:has(.ewt-mobile-nav)) .ewt-section-nav .ewt-btn { width: 100%; }

    html:has(.ewt-mobile-nav)[data-focus-mode="off"] .questionnaire-main {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    /* No sticky bar on section-mode steps, so drop the reserved 80px gap. */
    html[data-focus-mode="off"]:not(:has(.ewt-mobile-nav)) .questionnaire-main {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
}

/* Focus mode owns its own Back/Continue row (.ewt-focus-nav),
   so hide the section-mode nav whenever focus mode is active. */
html[data-focus-mode="on"] .ewt-section-nav {
    display: none !important;
}

/* Sticky bar owns visible Back/Continue at every breakpoint. In-card
   controls stay in the DOM for submitViaSectionNav / gotoPrevStep. */
html:has(.ewt-mobile-nav) .ewt-section-nav,
html:has(.ewt-mobile-nav) .ewt-focus-nav {
    display: none !important;
}

/* Inverse guard: when section mode is active, the focus controller sets the
   [hidden] attribute on .ewt-focus-nav, but Bootstrap's d-md-flex uses
   `display: flex !important` which overrides the UA [hidden] style. Force
   [hidden] to win so the two nav rows don't both render simultaneously. */
.ewt-focus-nav[hidden] {
    display: none !important;
}

/* Sanity block — CSS above closed the @media; re-open a no-op so surrounding
   rules in this file remain unchanged structurally. */
@media (max-width: 767.98px) {

    /* Inline formset cards (D-19, Component 11) */
    .ewt-formset-card,
    .ewt-formset-row {
        padding: 1rem;
        margin-bottom: 0.75rem;
        border: 1px solid var(--ewt-border, #e2e8f0);
        border-radius: var(--ewt-radius-sm, 8px);
        background: var(--ewt-card-bg, #fff);
    }
    .ewt-formset-card > .row,
    .ewt-formset-card > .form-row,
    .ewt-formset-card .col,
    .ewt-formset-card [class^="col-"],
    .ewt-formset-card [class*=" col-"],
    .ewt-formset-row > .row,
    .ewt-formset-row > .form-row,
    .ewt-formset-row .col,
    .ewt-formset-row [class^="col-"],
    .ewt-formset-row [class*=" col-"] {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    .ewt-formset-card .form-group,
    .ewt-formset-card .mb-3,
    .ewt-formset-row .form-group,
    .ewt-formset-row .mb-3 { margin-bottom: 0.75rem; }
    .ewt-formset-add {
        width: 100%;
        min-height: 48px;
        margin-top: 1rem;
    }

    /* Why-we-ask bottom sheet (D-17, Component 9) */
    .ewt-why-sheet {
        max-height: 50vh;
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
    }
    .ewt-why-sheet .offcanvas-body {
        font-size: 16px;
        line-height: 1.5;
    }

    /* Mobile offcanvas step list tidy-up (Component 7) */
    .ewt-mobile-step-list .ewt-mobile-step a { color: var(--ewt-body, #0f172a); }
    .ewt-mobile-step.active > a { background: rgb(var(--ew-brand-soft)); border-radius: 6px; }
    .ewt-mobile-step.completed .nav-step-icon.completed { color: var(--ewt-accent, #059669); }
}

/* ========== Phase 5 / QUX-05: Smart-default visual cue (D-25) ========== */
/* Brand stripe and a light brand-soft wash; both follow the theme. The
   :not(.is-invalid) also lifts these above the wizard's .ewt-task-page input
   rule (0,2,0) so the cue shows in light mode too, and leaves error borders
   alone. */
.ewt-prefilled .form-control:not(.is-invalid),
.ewt-prefilled .form-select:not(.is-invalid) {
    border-left: 3px solid rgb(var(--ew-brand));
    background-color: rgb(var(--ew-brand-soft) / .35);
    transition: border-color 150ms ease, background-color 150ms ease;
}
/* ========== Phase 5-04 / QUX-06: Continue card + resume chrome ========== */
.ewt-continue-card {
    border: 1px solid var(--ewt-border, rgba(0,0,0,0.1));
    border-left: 2px solid var(--ewt-primary, #4f46e5);
    background: var(--ewt-card-bg, #ffffff);
    /* Borders, not shadows (brand guide, Depth). */
    box-shadow: none;
}
.ewt-continue-card .card-body { padding: 2rem; }
@media (max-width: 767.98px) {
    .ewt-continue-card .card-body { padding: 1.5rem; }
}
.ewt-welcome-back {
    background: rgba(5, 150, 105, 0.08);
    border-left: 3px solid rgba(5, 150, 105, 0.35);
    border-radius: var(--ewt-radius-sm, 8px);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}
.ewt-welcome-back .bi-hand-thumbs-up { color: var(--ewt-accent, #059669); }
.ewt-saved-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--ewt-accent, #059669);
    font-size: 0.875rem;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 22rem;
}
.ewt-save-exit { font-size: 0.875rem; }

/* ========== Phase 6 / Plan 6-04: Document-selection card grid ========== */
/* Tokens: reuse Phase 1 (#0f172a slate-900, #334155 slate-700, var(--ewt-border))
   + Phase 5 indigo family (#6366f1 indigo-500, #818cf8 indigo-400 dark,
   #4338ca indigo-700 badge text, rgba(99,102,241,0.10) badge fill).
   No new hex values introduced. */

.ewt-doc-section {
    margin: 1rem 0;
}

.ewt-doc-grid {
    margin: 1rem 0;
}

.ewt-doc-card {
    list-style: none;
}

.ewt-doc-card__label {
    display: block;
    padding: 1rem 1.25rem;
    min-height: 72px;  /* UI-SPEC mobile touch target */
    border: 1px solid var(--ewt-border, rgba(0, 0, 0, 0.1));
    border-radius: 12px;
    background: var(--ewt-card-bg, #ffffff);
    cursor: pointer;
    transition: box-shadow 150ms ease, border-color 150ms ease;
    margin: 0;
    height: 100%;
}

.ewt-doc-card__label:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    border-color: rgba(15, 23, 42, 0.2);
}

.ewt-doc-card__label:focus-within {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    border-color: var(--ewt-primary, #4f46e5);
    outline: none;
}

.ewt-doc-card--recommended .ewt-doc-card__label {
    border-left: 2px solid #6366f1;  /* indigo-500 */
}

[data-bs-theme="dark"] .ewt-doc-card--recommended .ewt-doc-card__label {
    border-left-color: #818cf8;  /* indigo-400 dark-mode */
}

.ewt-doc-card__checkbox {
    float: left;
    margin-right: 0.75rem;
}

.ewt-doc-card__body {
    overflow: hidden;  /* contains the checkbox float */
}

.ewt-doc-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;  /* slate-900 */
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

[data-bs-theme="dark"] .ewt-doc-card__title {
    color: #e2e8f0;  /* inherit dark-mode body color */
}

.ewt-doc-card__purpose {
    font-size: 0.875rem;
    color: #334155;  /* slate-700 */
    margin: 0 0 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[data-bs-theme="dark"] .ewt-doc-card__purpose {
    color: var(--ewt-muted, #94a3b8);
}

.ewt-doc-card__rationale {
    font-size: 0.875rem;
    font-style: italic;
    color: var(--ewt-muted, #94a3b8);
    margin: 0 0 0.5rem 0;
}

.ewt-doc-card__rationale .bi-magic {
    color: #6366f1;  /* indigo-500 */
}

[data-bs-theme="dark"] .ewt-doc-card__rationale .bi-magic {
    color: #818cf8;  /* indigo-400 */
}

.ewt-doc-card-includes {
    font-size: 0.875rem;
    color: var(--ewt-muted, #94a3b8);
    margin: 0.5rem 0 0 0;
    font-style: italic;
}

/* Common-choice badge — no new weight declared (inherits project .btn / 500).
   align-self + max-content keep the pill from stretching full card width
   inside .ewt-option-card__body (column flex, default align-items: stretch). */
.ewt-recommended-badge,
.ewt-common-choice-badge {
    display: inline-flex;
    align-self: flex-start;
    width: max-content;
    max-width: 100%;
    padding: 4px 8px;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
    color: #4338ca;  /* indigo-700 — WCAG AA 7.1:1 on the tinted background */
    background-color: rgba(99, 102, 241, 0.10);  /* indigo-500 @ 10% */
    border-radius: 50rem;
    margin-bottom: 0.25rem;
}

[data-bs-theme="dark"] .ewt-recommended-badge,
[data-bs-theme="dark"] .ewt-common-choice-badge {
    color: #c7d2fe;  /* indigo-200 for dark-mode contrast */
    background-color: rgba(129, 140, 248, 0.15);
}

/* ========== Phase 6 / Plan 6-04: Final review "Your package" list ========== */
.ewt-final-review__header h2 {
    margin-bottom: 0.25rem;
}

.ewt-final-review__edit-link {
    font-size: 0.875rem;
    color: var(--ewt-primary, #4f46e5);
    text-decoration: none;
}

.ewt-final-review__edit-link:hover {
    text-decoration: underline;
}

.ewt-package-list .list-group-item {
    background: transparent;
    border-left: 0;
    border-right: 0;
}

.ewt-package-list .bi-check-circle-fill {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* ========== Phase 6 / Plan 6-06 prep: Doc-diff banner ========== */
/* Sibling of .ewt-welcome-back (D-30 pattern). Plan 6-06 will ship the
   partial + auto-fade JS; Plan 6-04 lays the styles so 6-06 can be a
   pure-template change. */
.ewt-diff-banner {
    background: rgba(5, 150, 105, 0.08);
    border-left: 3px solid rgba(5, 150, 105, 0.35);
    border-radius: var(--ewt-radius-sm, 8px);
    padding: 12px 16px;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #0f172a;
    transition: opacity 600ms ease;
}

[data-bs-theme="dark"] .ewt-diff-banner {
    color: #e2e8f0;
}

.ewt-diff-banner .bi-magic {
    color: #6366f1;  /* indigo-500 — semantic tie to recommendation family */
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

[data-bs-theme="dark"] .ewt-diff-banner .bi-magic {
    color: #818cf8;
}

.ewt-diff-banner .btn-close {
    margin-left: auto;
    min-width: 44px;
    min-height: 44px;
}

/* ========== Phase 6.3 / D-06..D-14: UPL compliance classes ========== */

/* D-07: Persistent above-fold UPL banner */
.ewt-upl-banner {
    background: rgb(var(--ew-brand-soft));
    color: rgb(var(--ew-ink));
    border-bottom: 1px solid rgb(var(--ew-border));
    font-size: 0.75rem;                /* 12px — matches .ewt-disclaimer-text sizing */
    line-height: 1.5;
    max-height: 40px;                  /* Phase 6.2 G2-* mobile height budget */
    overflow: hidden;                  /* EWT-16 slice 9: clip wrap so overflow text
                                          cannot paint a click-stealing overlay over
                                          focus/section controls below. */
    position: relative;                /* UI-SPEC: not sticky — above-fold-on-entry only.
                                          relative (not sticky) so z-index applies and the
                                          wizard's sticky sidebar can't paint over it. */
    z-index: 31;                       /* above .questionnaire-sidebar (z-30), below navbar */
    /* Banner chrome is non-interactive except the disclaimer link. */
    pointer-events: none;
}
.ewt-upl-banner a {
    color: inherit;
    text-decoration: underline;
    pointer-events: auto;
}

/* D-08: Footer inline disclaimer */
.ewt-upl-footer {
    /* Inherits .ewt-disclaimer-text sizing. Namespace-only class for test assertion + future overrides. */
}
[data-bs-theme="dark"] .ewt-upl-footer {
    /* Inherits footer dark palette from .ewt-disclaimer-text; no override needed. */
}

/* D-12: Doc-selection card-grid preamble (framing, not alert) */
.ewt-upl-preamble {
    background: rgba(15, 23, 42, 0.04);   /* subtle neutral tint */
    color: var(--ewt-body, #334155);
    border-left: 3px solid var(--ewt-muted, #94a3b8);  /* neutral gray — NOT indigo accent */
    border-radius: var(--ewt-radius-sm, 8px);
    font-size: 1rem;                       /* 16px body */
    line-height: 1.5;
}
[data-bs-theme="dark"] .ewt-upl-preamble {
    background: rgba(226, 232, 240, 0.06);
    color: #e2e8f0;
    border-left-color: #64748b;
}

/* Preview and pay (G5 PR 2). .ewt-upl-checkout-clickwrap stays on the
   form as the script hook only; it draws no box of its own (C-063). */
.ewt-pay {
    margin: 0 auto;
    max-width: 70rem;
    padding: 2rem 1rem;
    display: grid;
    gap: 2rem;
}
@media (min-width: 1024px) {
    .ewt-pay {
        grid-template-columns: minmax(0, 1fr) 390px;
        gap: 2.5rem;
        padding: 2.5rem 2rem;
        align-items: start;
    }
    .ewt-pay__card {
        position: sticky;
        top: 1.5rem;
    }
}
.ewt-pay__card {
    padding: 1.5rem;
}
.ewt-pay__thumbs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
@media (min-width: 768px) {
    .ewt-pay__thumbs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
/* A sheet of paper: white in both themes (C-065). */
.ewt-pay__sheet {
    position: relative;
    aspect-ratio: 8.5 / 11;
    margin-bottom: 0.75rem;
    padding: 12% 12% 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 7%;
    background: #fff;
    border: 1px solid rgb(var(--ew-border));
    border-radius: 4px;
}
.ewt-pay__sheet span {
    display: block;
    flex: none;
    height: 4px;
    border-radius: 2px;
    background: #c9c4ba;
}
.ewt-pay__sheet .ewt-pay__sheet-title {
    width: 60%;
    height: 7px;
    margin: 0 auto 4%;
    background: #1f2a26;
}
.ewt-pay__sheet .ewt-pay__sheet-short {
    width: 55%;
}
.ewt-pay__sheet::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 35%;
    background: linear-gradient(rgb(255 255 255 / 0), #fff);
}
.ewt-pay__total-label {
    font-size: 17px;
    line-height: 26px;
}
.ewt-pay__total-label small {
    font-size: 14px;
    line-height: 20px;
}
.ewt-pay__total {
    font-size: 34px;
    line-height: 40px;
    font-weight: 600;
}
.ewt-pay__consent {
    padding: 14px;
    background: rgb(var(--ew-surface));
    border: 1px solid rgb(var(--ew-border));
}
.ewt-pay__consent-box {
    flex: none;
    width: 22px;
    height: 22px;
    margin: 1px 0 0;
    accent-color: rgb(var(--ew-brand));
}
.ewt-pay__hint {
    font-size: 14px;
    line-height: 20px;
}

/* Ready-to-pay teaser (trust / will / POA). One package column + one checkout. */
.ewt-teaser {
    max-width: 56rem;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 2.5rem;
}
.ewt-teaser__intro {
    margin-bottom: 1.5rem;
}
.ewt-teaser__kicker {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ewt-muted);
}
.ewt-teaser__title {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    text-wrap: balance;
    color: var(--ewt-heading);
}
.ewt-teaser__lede {
    margin: 0;
    color: var(--ewt-muted);
}
.ewt-teaser__package-name {
    font-weight: 600;
    color: var(--ewt-heading);
}
.ewt-teaser__layout {
    display: grid;
    gap: 1.25rem;
}
@media (min-width: 768px) {
    .ewt-teaser__layout {
        grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem);
        align-items: start;
    }
}
.ewt-teaser__package,
.ewt-teaser__checkout {
    background: var(--ewt-card-bg, #fff);
    border: 1px solid var(--ewt-border, #e2e8f0);
    border-radius: var(--ewt-radius, 12px);
    box-shadow: var(--ewt-shadow);
    padding: 1.25rem 1.35rem;
}
@media (min-width: 768px) {
    .ewt-teaser__checkout {
        position: sticky;
        top: 1rem;
    }
}
.ewt-teaser__section-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--ewt-heading);
}
.ewt-teaser__docs,
.ewt-teaser__perks,
.ewt-teaser__lines {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ewt-teaser__docs li,
.ewt-teaser__perks li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.45rem 0;
    min-width: 0;
}
.ewt-teaser__docs li + li,
.ewt-teaser__perks li + li {
    border-top: 1px solid var(--ewt-border, #e2e8f0);
}
.ewt-teaser__docs i,
.ewt-teaser__perks i {
    margin-top: 0.15rem;
    color: var(--ewt-accent, #059669);
    flex-shrink: 0;
}
.ewt-teaser__perks {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ewt-border, #e2e8f0);
    color: var(--ewt-body);
    font-size: 0.9375rem;
}
.ewt-teaser__empty {
    margin: 0;
    color: var(--ewt-muted);
}
.ewt-teaser__lines {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--ewt-border, #e2e8f0);
}
.ewt-teaser__lines li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem 0;
    font-size: 0.9375rem;
}
.ewt-teaser__amount,
.ewt-teaser__total-amount {
    font-variant-numeric: tabular-nums;
}
.ewt-teaser__included {
    color: var(--ewt-muted);
}
.ewt-teaser__total {
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.ewt-teaser__total-amount {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--ewt-heading);
    line-height: 1.1;
}
.ewt-teaser__total-note {
    font-size: 0.875rem;
    color: var(--ewt-muted);
}
.ewt-teaser__form {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}
.ewt-teaser__consent {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.45;
    min-height: 40px;
}
.ewt-teaser__consent .form-check-input {
    margin-top: 0.2rem;
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}
.ewt-teaser__pay {
    display: flex;
    width: 100%;
    margin-top: 0.9rem;
    justify-content: center;
}
.ewt-teaser__pay:active {
    transform: scale(0.96);
}
.ewt-teaser__secure,
.ewt-teaser__back {
    margin: 0.85rem 0 0;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--ewt-muted);
}
.ewt-teaser__secure i {
    margin-right: 0.25rem;
}
.ewt-teaser__back a {
    color: var(--ewt-muted);
    text-decoration: none;
}
.ewt-teaser__back a:hover {
    color: var(--ewt-primary);
    text-decoration: underline;
}
@media (max-width: 639.98px) {
    .ewt-teaser {
        padding: 1.25rem 1rem 2rem;
    }
    .ewt-teaser__title {
        font-size: 1.5rem;
    }
    .ewt-teaser__total-amount {
        font-size: 1.75rem;
    }
}

/* D-14: Will-card swap transparency toast (mirrors .ewt-welcome-back palette) */
.ewt-upl-swap-toast {
    background: rgba(5, 150, 105, 0.08);
    border-left: 3px solid rgba(5, 150, 105, 0.35);
    border-radius: var(--ewt-radius-sm, 8px);
    padding: 0.75rem 1rem;
    color: #0f172a;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    transition: opacity 400ms ease;
}
.ewt-upl-swap-toast .bi-info-circle { color: #059669; }

[data-bs-theme="dark"] .ewt-upl-swap-toast {
    background: rgba(5, 150, 105, 0.18);
    color: #e2e8f0;
}

@media (prefers-reduced-motion: reduce) {
    .ewt-upl-swap-toast { transition: none; }
}

/* ============================================================
   Phase 7 Plan 7-04 — .ewt-will-state-block + .ewt-validation-error*
   Mirrors Phase 6.3 .ewt-upl-* convention (lines 1164-1247).
   No new design tokens; reuses existing custom properties + Phase 6.3 amber.
   ============================================================ */

/* D-15 Will-only state-block (informational; amber family) */
.ewt-will-state-block {
    background: #fef3c7;              /* amber-100, mirrors .ewt-upl-banner */
    color: #78350f;                    /* amber-900 — WCAG AA ≥ 7:1 */
    border-left: 4px solid #fcd34d;    /* amber-300 — left rail */
    border-radius: 0.25rem;
    line-height: 1.5;
}

.ewt-will-state-block h2 {
    color: #78350f;
    font-weight: 600;
}

[data-bs-theme="dark"] .ewt-will-state-block {
    background: #78350f;
    color: #fef3c7;
    border-left-color: #b45309;        /* amber-700 dark variant */
}

[data-bs-theme="dark"] .ewt-will-state-block h2 {
    color: #fef3c7;
}

/* D-20 Validation error block. The kit error Callout look (surface-raised,
   2px error border, info icon, ink text) comes from the template's ew
   utilities. The fix links are styled here too: the fallback branch of
   _validation_error_block.html marks them with this class only, so this
   rule matches the grouped branch's text-ew-brand underline font-semibold. */
.ewt-validation-error {
    line-height: 1.5;
}

.ewt-validation-error__heading {
    font-weight: 600;
}

.ewt-validation-error__list li {
    line-height: 1.5;
}

.ewt-validation-error__fix-link {
    color: rgb(var(--ew-brand));
    text-decoration-line: underline;
    font-weight: 600;
    padding: 0.625rem 0;       /* 44px touch target on mobile (UI-SPEC §Spacing) */
}

.ewt-validation-error__fix-link:focus-visible {
    outline: 2px solid rgb(var(--ew-brand));
    outline-offset: 2px;
}

/* Reduced-motion: validation-error block auto-fade respects preference. */
@media (prefers-reduced-motion: reduce) {
    .ewt-validation-error {
        transition: none;
    }
}

/* Optional formset row scaffold (used by _will_witnesses_formset.html and
   _will_bequests_formset.html). Keep minimal — Bootstrap .card supplies
   the surface; this hook lets future Phase 7 / Phase 9 styles target rows
   without competing with Bootstrap defaults. */
.ewt-formset-row {
    /* No declarations — class exists as a structural hook. */
}

/* ─────────────────────────────────────────────────────────────────────────
   Phase 7.1 / I2 / D-06 + D-08: ewt-document-card family
   ─────────────────────────────────────────────────────────────────────────
   New unified document/session card class hierarchy. Inherits the existing
   .ewt-trust-card layout (border, padding, hover lift) but adds:
     - 44px touch-target floor on quick-action buttons (deliberate delta
       from trust_list.html .btn-sm) per UI-SPEC §Spacing Exceptions.
     - Three new badge palettes for document-type + status (slate-tint,
       slate-tint-darker for draft, indigo-tint for signed; .bg-success
       for paid is a verbatim Bootstrap reuse).
     - Dark-mode overrides for all new badge classes per UI-SPEC §Dark-Mode
       Contract.
     - .ewt-continue-others-link quiet anchor for Plan 04's home-page link.
   ───────────────────────────────────────────────────────────────────────── */
.ewt-document-card {
    border-radius: var(--ewt-radius);
    border: 1px solid var(--ewt-border);
    background: var(--ewt-card-bg);
    padding: 1.5rem;
    transition: all var(--ewt-transition);
    height: 100%;
}
/* UI-SPEC §Spacing Exceptions: 44px touch-target floor on quick-action buttons.
   Deliberate delta from trust_list.html which uses .btn-sm (~31px). */
.ewt-document-card .btn {
    min-height: 44px;
}

.ewt-document-card--in-progress {
    border: 2px dashed #f59e0b;
    background: rgba(245, 158, 11, .03);
}

/* ── New badge palettes (UI-SPEC §Color §New badge palettes) ─────────────── */
.ewt-doc-type-badge {
    background-color: rgba(15, 23, 42, 0.06);
    color: var(--ewt-body);
    border: none;
    font-weight: 500;
    padding: 4px 10px;
}
[data-bs-theme="dark"] .ewt-doc-type-badge {
    background-color: rgba(241, 245, 249, 0.08);
}

.ewt-status-badge--draft {
    background-color: rgba(15, 23, 42, 0.08);
    color: var(--ewt-body);
    border: none;
    font-weight: 500;
    padding: 4px 10px;
}
[data-bs-theme="dark"] .ewt-status-badge--draft {
    background-color: rgba(241, 245, 249, 0.10);
}

.ewt-status-badge--signed {
    background-color: rgba(79, 70, 229, 0.10);
    color: #4338ca;
    border: none;
    font-weight: 500;
    padding: 4px 10px;
}
[data-bs-theme="dark"] .ewt-status-badge--signed {
    background-color: rgba(129, 140, 248, 0.15);
    color: #c7d2fe;
}

/* ── Continue-N-other-documents quiet anchor (used by Plan 04) ──────────── */
/* Colour and underline come from the template's ew utilities. */

/* ──────────────────────────────────────────────────────────
   Phase 7.2 D-01 + Phase 7.3 D-04 — wizard entry-point chrome
   .ewt-questionnaire-hero (sketch 001-B) + .ewt-questionnaire-hero__switch-link
   ────────────────────────────────────────────────────────── */
.ewt-questionnaire-hero {
    position: relative;
    overflow: hidden;
    padding: 24px;
    margin-bottom: 24px;
    border-radius: var(--ewt-radius);
    color: rgb(var(--ew-on-brand));
    background: rgb(var(--ew-brand));
}

.ewt-questionnaire-hero::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    right: -40px;
    top: -40px;
    border-radius: 50%;
    background: rgb(var(--ew-on-brand) / .05);
    pointer-events: none;
}

.ewt-questionnaire-hero__eyebrow {
    position: relative;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(var(--ew-on-brand) / .9);
    margin-bottom: 8px;
}

.ewt-questionnaire-hero h1 {
    position: relative;
    color: rgb(var(--ew-on-brand));
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 8px;
}

.ewt-questionnaire-hero__subhead {
    position: relative;
    font-size: 1rem;
    line-height: 1.5;
    color: rgb(var(--ew-on-brand) / .92);
    margin-bottom: 16px;
}

.ewt-questionnaire-hero__meta {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 0.875rem;
    color: rgb(var(--ew-on-brand) / .92);
}

.ewt-questionnaire-hero__meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ewt-questionnaire-hero--scope-will {
    /* explicit modifier; the base rule already uses brand */
}

/* Phase 7.3 D-04: hero inline switch link (relocated from deleted
   .ewt-skipped-banner). Thin underlined link, visually subordinate to
   hero copy. Same recovery target as the deleted banner:
   ?wizard_goto_step=documents-to-prepare. */
.ewt-questionnaire-hero__switch-link {
    position: relative;
    display: inline-block;
    margin-top: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(var(--ew-on-brand) / .92);
    text-decoration: underline;
}

.ewt-questionnaire-hero__switch-link:hover,
.ewt-questionnaire-hero__switch-link:focus {
    color: rgb(var(--ew-on-brand));
    text-decoration: underline;
}

/* ──────────────────────────────────────────────────────────
   Phase 7.2 D-03 — summary callout (sketch 002-B)
   .ewt-summary-callout — bordered brand-soft box on will-only summary
   ────────────────────────────────────────────────────────── */
.ewt-summary-callout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 24px;
    margin-top: 16px;
    margin-bottom: 16px;
    border-radius: var(--ewt-radius);
    background: var(--ewt-scope-will-light);
    border: 1px solid rgb(var(--ew-border));
    color: var(--ewt-heading);
}

.ewt-summary-callout > i,
.ewt-summary-callout .bi-bank2 {
    color: var(--ewt-primary);
    flex-shrink: 0;
}

.ewt-summary-callout strong {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--ewt-heading);
    margin-bottom: 4px;
}

.ewt-summary-callout p {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ewt-body);
}

.ewt-summary-callout__cta {
    flex-shrink: 0;
    min-height: 44px;        /* Phase 5-02 D-15 mobile touch target */
    align-self: center;
}

.ewt-summary-callout--scope-will {
    /* explicit modifier; base already inherits scope-will hue */
}

@media (max-width: 767.98px) {
    .ewt-summary-callout {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    .ewt-summary-callout__cta {
        width: 100%;
    }
}

[data-bs-theme="dark"] .ewt-summary-callout {
    background: var(--ewt-scope-will-light);
    border-color: rgb(var(--ew-border));
    color: rgb(var(--ew-ink));
}

[data-bs-theme="dark"] .ewt-summary-callout strong {
    color: rgb(var(--ew-ink));
}

[data-bs-theme="dark"] .ewt-summary-callout p {
    color: rgb(var(--ew-ink-muted));
}

[data-bs-theme="dark"] .ewt-summary-callout > i {
    color: rgb(var(--ew-brand));
}

/* ──────────────────────────────────────────────────────────
   Phase 7.2 D-06 / D-07 — document-icon block (sketch 003-C)
   .ewt-document-card__doc-icon — scope-aware icon-block layout
   ────────────────────────────────────────────────────────── */
.ewt-document-card__doc-icon {
    flex-shrink: 0;
    width: 96px;
    padding: 12px;
    border-radius: var(--ewt-radius-sm);
    border: 1px solid var(--ewt-border);
    background: linear-gradient(135deg, rgb(var(--ew-surface-raised)) 0%, rgb(var(--ew-brand-soft)) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
}

.ewt-document-card__doc-icon i {
    font-size: 2rem;
    line-height: 1;
    color: var(--ewt-primary);
}

.ewt-document-card__doc-icon-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ewt-primary-dark);
}

.ewt-document-card__doc-icon-pct {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ewt-primary);
    line-height: 1.2;
}

/* Scope modifiers — set border + token colors used by inner elements. */
.ewt-document-card__doc-icon--scope-will {
    background: linear-gradient(135deg, rgb(var(--ew-surface-raised)) 0%, var(--ewt-scope-will-light) 100%);
    border-color: var(--ewt-scope-will-light);
}
.ewt-document-card__doc-icon--scope-will i,
.ewt-document-card__doc-icon--scope-will .ewt-document-card__doc-icon-pct {
    color: var(--ewt-scope-will);
}
.ewt-document-card__doc-icon--scope-will .ewt-document-card__doc-icon-label {
    color: var(--ewt-primary-dark);
}

.ewt-document-card__doc-icon--scope-trust {
    background: linear-gradient(135deg, rgb(var(--ew-surface-raised)) 0%, var(--ewt-scope-trust-light) 100%);
    border-color: var(--ewt-scope-trust-light);
}
.ewt-document-card__doc-icon--scope-trust i,
.ewt-document-card__doc-icon--scope-trust .ewt-document-card__doc-icon-pct {
    color: var(--ewt-scope-trust);
}
.ewt-document-card__doc-icon--scope-trust .ewt-document-card__doc-icon-label {
    color: var(--ewt-scope-trust);
}

.ewt-document-card__doc-icon--scope-package {
    background: linear-gradient(135deg, rgb(var(--ew-surface-raised)) 0%, var(--ewt-scope-package-light) 100%);
    border-color: var(--ewt-scope-package-light);
}
.ewt-document-card__doc-icon--scope-package i,
.ewt-document-card__doc-icon--scope-package .ewt-document-card__doc-icon-pct {
    color: var(--ewt-scope-package);
}
.ewt-document-card__doc-icon--scope-package .ewt-document-card__doc-icon-label {
    color: var(--ewt-scope-package);
}

.ewt-document-card__doc-icon--scope-poa {
    background: linear-gradient(135deg, rgb(var(--ew-surface-raised)) 0%, var(--ewt-scope-poa-light) 100%);
    border-color: var(--ewt-scope-poa-light);
}
.ewt-document-card__doc-icon--scope-poa i,
.ewt-document-card__doc-icon--scope-poa .ewt-document-card__doc-icon-pct {
    color: var(--ewt-scope-poa);
}
.ewt-document-card__doc-icon--scope-poa .ewt-document-card__doc-icon-label {
    color: var(--ewt-scope-poa);
}

.ewt-document-card__doc-icon--scope-neutral {
    background: linear-gradient(135deg, rgb(var(--ew-surface-raised)) 0%, rgb(var(--ew-brand-soft)) 100%);
    border-color: rgb(var(--ew-brand-soft));
}
.ewt-document-card__doc-icon--scope-neutral i,
.ewt-document-card__doc-icon--scope-neutral .ewt-document-card__doc-icon-pct {
    color: rgb(var(--ew-brand));
}

/* Card-level scope modifiers (D-07 propagation — orthogonal to --in-progress). */
.ewt-document-card--scope-will {
    border-color: var(--ewt-scope-will-light);
}
.ewt-document-card--scope-trust {
    border-color: var(--ewt-scope-trust-light);
}
.ewt-document-card--scope-package {
    border-color: var(--ewt-scope-package-light);
}
.ewt-document-card--scope-poa {
    border-color: var(--ewt-scope-poa-light);
}

/* Dark mode: the gradients above use ew roles, so they follow the theme. */
[data-bs-theme="dark"] .ewt-document-card__doc-icon {
    border-color: rgb(var(--ew-border));
}

/* Phase 9 Plan 9-03 / D-12 — inline structural-change warning. */
.ewt-structural-warning {
    background: #fef3c7;                  /* amber-100; mirrors .ewt-upl-banner */
    color: #78350f;                       /* amber-900; WCAG AA */
    border-left: 4px solid #d97706;       /* amber-600 (--ewt-scope-trust) */
    border-radius: 0.25rem;
    padding: 0.75rem 1rem;
}
.ewt-structural-warning .bi {
    font-size: 1.1rem;
    color: #d97706;                       /* amber-600 — keep icon in band */
}
[data-bs-theme="dark"] .ewt-structural-warning {
    background: #78350f;                  /* amber-900 bg in dark */
    color: #fef3c7;                       /* amber-100 text */
    border-left-color: #b45309;           /* amber-700 */
}
[data-bs-theme="dark"] .ewt-structural-warning .bi {
    color: #fcd34d;                       /* amber-300 — readable on amber-900 */
}
.ewt-structural-warnings-cluster {
    /* Wrapper-only; no styling — keeps the cluster spaced via mb-4 utility. */
}

/* Home start-document dialog — option cards (wizard.html styles are wizard-only). */
.ewt-option-card-grid {
    display: grid;
    gap: 0.75rem;
}
.ewt-option-card-grid--2 {
    grid-template-columns: 1fr;
}
@media (min-width: 640px) {
    .ewt-option-card-grid--2 {
        grid-template-columns: 1fr 1fr;
    }
}
.ewt-option-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1.5px solid var(--ewt-border, #e2e8f0);
    border-radius: 12px;
    background: var(--ewt-card-bg, #fff);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    margin: 0;
}
.ewt-option-card:hover {
    border-color: rgb(var(--ew-brand) / .45);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.ewt-option-card:has(.ewt-option-card__input:checked),
.ewt-option-card:has(:checked) {
    border-color: rgb(var(--ew-brand));
    background: rgb(var(--ew-brand) / .05);
    box-shadow: 0 0 0 1px rgb(var(--ew-brand));
}
.ewt-option-card:has(.ewt-option-card__input:focus-visible) {
    outline: 2px solid rgb(var(--ew-brand));
    outline-offset: 2px;
}
.ewt-option-card__radio {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    border: 2px solid #94a3b8;
    flex-shrink: 0;
    margin-top: 0.15rem;
    position: relative;
    background: #fff;
}
.ewt-option-card:has(:checked) .ewt-option-card__radio {
    border-color: rgb(var(--ew-brand));
}
.ewt-option-card:has(:checked) .ewt-option-card__radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 999px;
    background: rgb(var(--ew-brand));
}
.ewt-option-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.ewt-option-card__title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ewt-body, #0f172a);
    line-height: 1.3;
}
.ewt-option-card__blurb {
    font-size: 0.825rem;
    color: var(--ewt-muted, #64748b);
    line-height: 1.4;
}
.ewt-option-card__rationale {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--ewt-muted, #475569);
    line-height: 1.4;
}
.ewt-option-card--suggested {
    border-color: rgba(79, 70, 229, 0.45);
}

.ewt-modal-scrollable {
    /* EWT-14: constrain height so nested form + body can scroll on mobile.
       Compiled Tailwind already sets flex/column/max-h/overflow; reinforce here
       with dvh + safe-area-friendly max height, and fix the form flex child. */
    display: flex;
    flex-direction: column;
    max-height: min(85vh, 100dvh);
    overflow: hidden;
    overscroll-behavior: contain;
}

/* Start-document dialog wraps header/body/footer in <form>; without this the
   form grows with content and .ewt-modal-body never gets a constrained height. */
.ewt-modal-scrollable > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    flex: 1 1 auto;
    overflow: hidden;
    width: 100%;
}

.ewt-modal-scrollable .ewt-modal-header,
.ewt-modal-scrollable .ewt-modal-footer {
    flex-shrink: 0;
}

.ewt-modal-scrollable .ewt-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    .ewt-modal-backdrop {
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
        align-items: flex-start;
        overflow-y: auto;
    }

    .ewt-modal-scrollable .ewt-modal-footer button,
    .ewt-modal-scrollable .ewt-modal-footer .btn-cta,
    .ewt-modal-scrollable .ewt-modal-footer .btn-outline-primary,
    .ewt-modal-scrollable .ewt-modal-footer .ewt-btn,
    .ewt-modal-scrollable .ewt-modal-footer a.ewt-btn {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ewt-option-card {
        transition: none;
    }
    .ewt-modal-backdrop,
    .ewt-modal {
        transition: none;
    }
}


/* EWT-24 Wave 3B — package quiz choice cards */
.ewt-option-card--pill {
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 3rem;
    padding: 0.85rem 1rem;
}
.ewt-option-card--pill .ewt-option-card__body {
    align-items: center;
}
.ewt-option-card--pill .ewt-option-card__title {
    font-size: 1rem;
}
.ewt-intake-optional {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--ewt-border, #e7e5e4);
    opacity: 0.92;
}
.ewt-intake-optional .ewt-question-legend {
    font-size: 0.9rem;
    color: var(--ewt-muted, #78716c);
    font-weight: 500;
}
.ewt-package-result .ewt-option-card--suggested {
    border-width: 2px;
    border-color: rgb(var(--ew-brand));
    box-shadow: 0 0 0 1px rgb(var(--ew-brand) / .2);
}
.ewt-package-result .ewt-option-card:not(.ewt-option-card--suggested) {
    opacity: 0.96;
}

/* EWT-30: logged-out public pages: paper ground, forest ink, flat buttons.
   Homepage fold sizes stay in the EWT-26 rules above. Wizard pages do not use
   .ewt-public. Colours come from the ew roles so dark mode carries through;
   the page ground and text come from base.html (bg-ew-surface text-ew-ink). */
body.ewt-public {
    --ewt-primary: rgb(var(--ew-brand));
    --ewt-primary-hover: rgb(var(--ew-ink));
    --ewt-primary-dark: rgb(var(--ew-ink));
    --ewt-primary-light: rgb(var(--ew-brand-soft));
    --ewt-paper: rgb(var(--ew-surface));
    --ewt-ink: rgb(var(--ew-ink));
    --ewt-font: var(--ew-font-sans);
}
body.ewt-public .ewt-navbar {
    box-shadow: none;
    backdrop-filter: none;
}
body.ewt-public .btn-nav-cta,
body.ewt-public .btn-cta,
body.ewt-public .ewt-btn-cta,
body.ewt-public .ewt-btn-primary {
    background: var(--ewt-primary);
    background-image: none;
    box-shadow: none;
    border-radius: 4px;
    transform: none;
}
body.ewt-public .btn-pill,
body.ewt-public .ewt-btn-pill {
    border-radius: 4px;
    box-shadow: none;
}
body.ewt-public .btn-nav-cta:hover,
body.ewt-public .btn-cta:hover,
body.ewt-public .ewt-btn-cta:hover,
body.ewt-public .ewt-btn-primary:hover {
    background: var(--ewt-primary-hover);
    background-image: none;
    box-shadow: none;
    color: rgb(var(--ew-on-brand));
    transform: none;
}
body.ewt-public .ewt-hero-secondary,
body.ewt-public .btn-pill.ewt-hero-secondary {
    background: rgb(var(--ew-surface-raised));
    color: var(--ewt-ink);
}
body.ewt-public .ewt-hero-secondary:hover,
body.ewt-public .btn-pill.ewt-hero-secondary:hover {
    background: rgb(var(--ew-surface-raised));
    color: var(--ewt-primary);
    border-color: var(--ewt-primary);
}
body.ewt-public .ewt-hero:not(.ewt-hero--paper) {
    background: var(--ewt-bg);
    background-image: none;
    color: var(--ewt-heading);
}
body.ewt-public .ewt-hero:not(.ewt-hero--paper) h1,
body.ewt-public .ewt-hero:not(.ewt-hero--paper) .ewt-hero-title-md {
    color: var(--ewt-heading);
}
body.ewt-public .ewt-hero:not(.ewt-hero--paper) .lead,
body.ewt-public .ewt-hero:not(.ewt-hero--paper) .ewt-hero-subtitle {
    color: var(--ewt-body);
}
body.ewt-public .ewt-section-gradient {
    background: var(--ewt-bg);
    background-image: none;
}
body.ewt-public .ewt-auth-card,
body.ewt-public .ewt-faq-item,
body.ewt-public .rounded-ewt,
body.ewt-public .shadow-ewt {
    box-shadow: none;
}
body.ewt-public .ewt-auth-card {
    border-radius: 4px;
}
/* W5.2: split login/signup — keep .ewt-auth-card for lockout-timer.js, no card chrome. */
body.ewt-auth-split .ewt-auth-card {
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    border: 0;
    padding: 0;
}
body.ewt-public .ewt-auth-brand .brand-icon {
    background: var(--ewt-primary);
    background-image: none;
    border-radius: 4px;
    box-shadow: none;
}
body.ewt-public .ewt-auth-sidebar {
    background: transparent;
    color: var(--ewt-body);
    border: 1px solid var(--ewt-border);
    border-right: 0;
    border-radius: 4px 0 0 4px;
}
body.ewt-public .ewt-auth-sidebar h3 {
    color: var(--ewt-heading);
}
body.ewt-public .ewt-footer {
    box-shadow: none;
}
/* Tailwind primary utilities are compiled to indigo, not --ewt-primary. */
body.ewt-public .bg-primary {
    background-color: var(--ewt-primary);
}
body.ewt-public .text-primary {
    color: var(--ewt-primary);
}
body.ewt-public .border-primary {
    border-color: var(--ewt-primary);
}

/* FAQ plus/minus follows the details [open] attribute, so it needs no script. */
.ewt-faq-marker .ewt-faq-minus { display: none; }
.ewt-faq-item[open] .ewt-faq-plus { display: none; }
.ewt-faq-item[open] .ewt-faq-minus { display: block; }

/* Newsletter band on brand green: keep the email input visible. */
.ewt-newsletter-on-brand .form-control,
.ewt-newsletter-on-brand input[type="email"] {
    background: rgb(var(--ew-surface-raised));
    color: rgb(var(--ew-ink));
    border-color: rgb(var(--ew-border-strong));
    min-height: 44px;
}
.ewt-newsletter-on-brand label,
.ewt-newsletter-on-brand .form-label {
    color: rgb(var(--ew-on-brand));
}

/* Auth split: hide crispy's auto label on hCaptcha (no visible label in mockups). */
.ewt-hcaptcha-field label,
.ewt-hcaptcha-field .form-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Brand arch for the About crest and the 404/500 number. Sizes live here
   because tailwind.css is not rebuilt for one-off measurements. */
.ewt-brand-arch,
.ewt-error-arch {
    display: flex;
    width: 100%;
    height: 220px;
    align-items: center;
    justify-content: center;
    border-radius: 140px 140px 12px 12px;
}
.ewt-brand-arch {
    background: rgb(var(--ew-brand-soft));
    height: 240px;
}
.ewt-error-arch {
    background: rgb(var(--ew-brand));
    order: -1;
}
.ewt-brand-arch img {
    height: 140px;
    width: auto;
}
.ewt-error-arch span {
    font-size: 96px;
    line-height: 1;
    font-weight: 600;
    color: rgb(var(--ew-brand-soft));
}
@media (min-width: 1024px) {
    .ewt-brand-arch,
    .ewt-error-arch {
        height: 360px;
        border-radius: 220px 220px 12px 12px;
    }
    .ewt-brand-arch img {
        height: 200px;
    }
    .ewt-error-arch {
        order: 0;
    }
    .ewt-error-arch span {
        font-size: 150px;
    }
}

/* 404 and 500 (G11, C-257, C-258, C-261). One set of rules keeps the two
   pages in step. Two columns start at 701px, as on the boards. */
.ewt-error {
    display: grid;
    align-items: center;
    gap: 32px;
    max-width: 1212px; /* 1100px of content plus the 56px side padding */
    margin: 0 auto;
    /* The site footer adds its own 64px top margin. Desktop adds 32px for
       the board's 96px; phones add none, so the gap is 64px (board: 56px). */
    padding: 32px 16px 0;
}
.ewt-error__code {
    margin: 0;
    font-family: var(--ew-font-serif);
    font-size: 15px;
    line-height: 20px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgb(var(--ew-accent));
}
.ewt-error__title {
    margin: 10px 0 14px;
    font-size: 32px;
    line-height: 40px;
}
.ewt-error__lead {
    margin: 0;
    max-width: 36rem;
    font-size: 19px;
    line-height: 29px;
    color: rgb(var(--ew-ink-muted));
}
/* The arch keeps a full round top at every width; the About crest keeps its
   own shape. Scoped to .ewt-error so these win over the shared arch rules
   wherever those sit in the file. */
.ewt-error .ewt-error-arch {
    border-radius: 220px 220px 12px 12px;
}
.ewt-error .ewt-error-arch span {
    opacity: 0.9;
}
@media (min-width: 701px) {
    .ewt-error {
        grid-template-columns: 1fr 1fr;
        gap: 56px;
        padding: 72px 56px 32px;
    }
    .ewt-error__title {
        font-size: 44px;
        line-height: 52px;
    }
    .ewt-error .ewt-error-arch {
        height: 360px;
        order: 0;
    }
    /* Narrow two-column widths: the numeral stays inside the arch. */
    .ewt-error .ewt-error-arch span {
        font-size: 110px;
    }
}
@media (min-width: 1024px) {
    .ewt-error .ewt-error-arch span {
        font-size: 150px;
    }
}
@media (max-width: 639px) {
    .ewt-pricing-switch {
        display: flex;
        width: 100%;
    }
    .ewt-pricing-switch > button {
        flex: 1 1 0;
        text-align: center;
    }
}

/* Footer links are 44px tap targets below the desktop layout (C-278). The
   list gap goes, so the rows sit as close as the tap height allows. */
@media (max-width: 1023.98px) {
    .ew-footer-links {
        gap: 0;
    }
    .ew-footer-links a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }
}

/* The signed-out header is 85px from lg with the 48px logo (C-279), so
   in-page anchors land 16px below it: 85 + 16. This follows the 97px base
   rule in tailwind.src.css (C-284), which was sized for the 44px logo. */
@media (min-width: 1024px) {
    html {
        scroll-padding-top: 101px;
    }
}

/* G10 C-208: the soft arch behind the Log in side panel (SignIn board).
   Decorative; only where the panel sits beside the form. */
.ewt-auth-side { position: relative; overflow: hidden; }
@media (min-width: 1024px) {
    .ewt-auth-side::before {
        content: "";
        position: absolute;
        right: -80px;
        bottom: -40px;
        width: 360px;
        height: 460px;
        border-radius: 180px 180px 0 0;
        background: rgb(var(--ew-brand-soft));
        opacity: 0.12;
        pointer-events: none;
    }
}
