/* Shared TEST palette from How It Works and Daily Entry. */
html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) {
    --recomp-canvas: #eff6f6;
    --recomp-header: #f8fdfd;
    --recomp-panel: #fff;
    --recomp-panel-raised: #f1f8f9;
    --recomp-border: #b6d3d7;
    --recomp-text: #10252c;
    --recomp-muted: #47646b;
    --recomp-accent: #006c7c;
    --recomp-action: linear-gradient(110deg, #19ddff, #7dff24);
    --recomp-glow: rgba(0,108,124,.13);
    --recomp-grid: rgba(0,108,124,.10);
    --recomp-heading: #103b45;
    --recomp-shadow: 0 10px 30px rgba(0,32,42,.08);

    --ink: var(--recomp-text);
    --muted: var(--recomp-muted);
    --line: var(--recomp-border);
    --surface: var(--recomp-panel);
    --background: var(--recomp-canvas);
    color: var(--recomp-text);
    background: radial-gradient(ellipse at 85% 0, var(--recomp-glow), transparent 44rem), var(--recomp-canvas);
}

/* The signed-in preview and the public marketing layouts have dark canvases. */
html:has([data-recomp-reference]) :is(html[data-theme="dark"] body, body.test-live-preview.app-shell, html:has([data-reference-marketing="true"]) body):not(:has(.hiw-shell)) {
    --recomp-canvas: #020508;
    --recomp-header: #060e13;
    --recomp-panel: #08141b;
    --recomp-panel-raised: #0d2028;
    --recomp-border: #25505a;
    --recomp-text: #f0faff;
    --recomp-muted: #b9cbd2;
    --recomp-accent: #19ddff;
    --recomp-glow: rgba(25,221,255,.19);
    --recomp-grid: rgba(25,221,255,.10);
    --recomp-heading: #19ddff;
    --recomp-shadow: 0 12px 32px rgba(0,0,0,.25);
    --live-bg: var(--recomp-canvas);
    --live-bg-deep: var(--recomp-header);
    --live-panel: var(--recomp-panel);
    --live-panel-raised: var(--recomp-panel-raised);
    --live-panel-soft: #142b32;
    --live-border: var(--recomp-border);
    --live-border-bright: #337481;
    --live-text: var(--recomp-text);
    --live-muted: var(--recomp-muted);
    --live-blue: var(--recomp-accent);
    --live-blue-soft: #90edfa;
    --live-green: #7dff24;
    --live-green-soft: #b5f486;

    color-scheme: dark;
}

html:has([data-recomp-reference]) body.test-live-preview.app-shell:not(:has(.hiw-shell)) {
    background: radial-gradient(ellipse at 85% 0, var(--recomp-glow), transparent 44rem), var(--recomp-canvas) !important;
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) :is(.topbar, .app-nav.app-menu) {
    background: var(--recomp-header) !important;
    border-color: var(--recomp-border) !important;
    color: var(--recomp-text);
    box-shadow: var(--recomp-shadow);
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) .topbar :is(.brand a, .public-nav a:not(.public-nav-create)) {
    color: var(--recomp-text);
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main :is(.app-page-head, .page-head, .admin-heading, .page-header, .coach-photo-heading, .card, .kpi, .dash-panel, .dash-section, .dash-fuel-card, .d2-panel, .d3-instrument, .d3-workout-card, .admin-card) {
    background: linear-gradient(145deg, var(--recomp-panel-raised), var(--recomp-panel)) !important;
    border-color: var(--recomp-border) !important;
    box-shadow: var(--recomp-shadow);
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main :is(.app-kicker, .app-section-label, .dash-panel-label) {
    color: var(--recomp-accent);
    letter-spacing: .08em;
    font-weight: 850;
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main :is(.app-page-head, .page-head, .admin-heading, .page-header, .coach-photo-heading):not([data-reference-hero]) {
    padding: clamp(1.25rem, 3vw, 2.6rem);
    border: 1px solid var(--recomp-border);
    border-top: 2px solid var(--recomp-accent);
    border-radius: 12px;
    box-shadow: var(--recomp-shadow);
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main :is(.app-page-head, .page-head, .admin-heading, .page-header, .coach-photo-heading, .d3-date-panel):where(:not([data-reference-hero])) {
    background:
        radial-gradient(ellipse at 95% 0, var(--recomp-glow), transparent 70%),
        repeating-linear-gradient(90deg, var(--recomp-grid) 0 1px, transparent 1px 48px),
        linear-gradient(145deg, var(--recomp-panel), var(--recomp-canvas)) !important;
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main [data-reference-title] {
    color: var(--recomp-heading) !important;
    font-size: clamp(2rem, 5vw, 4rem);
    font-style: italic;
    font-weight: 950;
    letter-spacing: -.055em;
    line-height: 1;
    overflow-wrap: anywhere;
    text-transform: uppercase;
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main :is(.d3-row-heading, .d3-training-section, .d3-coaches-section, .admin-card, .section-heading-with-help) > h2 {
    font-style: italic;
    letter-spacing: -.025em;
    text-transform: uppercase;
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main :is(.d3-team-header, .d3-instrument, .d3-workout-card, .d2-panel, .admin-card, .daily-entry-section) {
    border: 1px solid var(--recomp-border);
    border-top-color: var(--recomp-accent);
    box-shadow: inset 0 1px var(--recomp-grid), var(--recomp-shadow);
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main :is(.d3-eyebrow, .app-kicker, .admin-card-status) {
    color: var(--recomp-accent);
    letter-spacing: .18em;
    text-transform: uppercase;
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main :is(.d3-eyebrow, .app-kicker)::before {
    content: "";
    display: inline-block;
    width: 2rem;
    height: 2px;
    margin-inline-end: .6rem;
    vertical-align: middle;
    background: var(--recomp-action);
}

@media (max-width: 650px) {
    html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) main [data-reference-title] {
        font-size: clamp(1.65rem, 8vw, 2.8rem);
    }
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) :is(main .primary, main .admin-primary-button, main .learn12wr-primary-button, main .d3-date-form button, .topbar .public-nav-create) {
    background: var(--recomp-action) !important;
    color: #061316 !important;
}

html:has([data-recomp-reference]) body.test-live-preview.app-shell:not(:has(.hiw-shell)) .app-quick-nav a:is(:hover, :focus-visible) {
    background: var(--recomp-action) !important;
    color: #061316 !important;
}

html:has([data-recomp-reference]) body:not(:has(.hiw-shell)) :is(.topbar, main) :focus-visible {
    outline: 2px solid var(--recomp-accent);
    outline-offset: 3px;
}

/* Shared treatment for the existing page headers, including older layouts. */
html:has([data-recomp-reference]) body main [data-reference-hero]:has([data-reference-title]) {
    --reference-shade: rgba(2, 5, 8, .42);
    position: relative;
    isolation: isolate;
    min-width: 0;
    padding: clamp(1.15rem, 4vw, 3rem);
    border: 1px solid #25505a !important;
    border-radius: 1.25rem;
    background:
        linear-gradient(rgba(25, 221, 255, .075) 1px, transparent 1px) 0 0 / 54px 54px,
        linear-gradient(90deg, rgba(25, 221, 255, .075) 1px, transparent 1px) 0 0 / 54px 54px,
        linear-gradient(90deg, #020508 8%, var(--reference-shade) 100%),
        linear-gradient(0deg, #020508, transparent 78%),
        var(--reference-photo, none) center 43% / cover no-repeat,
        #020508 !important;
    color: #f0faff;
    box-shadow: var(--recomp-shadow);
}

html:has([data-recomp-reference^="nutrition-"]) body main [data-reference-hero] {
    --reference-photo: url('../images/nutrition-meal-prep-trainer.png');
}

html:has([data-recomp-reference^="detailedworkout-"], [data-recomp-reference^="todayworkout-"], [data-recomp-reference^="workouts-"]) body main [data-reference-hero] {
    --reference-photo: url('../images/workout-detail-gym-20260929.jpg');
}

html:has([data-recomp-reference="dailyentry-checkin"], [data-recomp-reference^="progress-"]) body main [data-reference-hero] {
    --reference-photo: url('../images/marketing-v13/evidence-gym-group-clean.jpg');
}

html:has([data-recomp-reference]) body main [data-reference-hero]:has([data-reference-title])::before {
    position: absolute;
    inset: auto 0 0;
    height: 2px;
    background: linear-gradient(90deg, #19ddff, #7dff24, transparent);
    border-radius: inherit;
    pointer-events: none;
    content: "";
}

html:has([data-recomp-reference]) body main [data-reference-hero]:has([data-reference-title]) > [data-reference-photo] {
    position: absolute;
    z-index: -2;
    inset: 0;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    margin: 0;
    border: 0;
    border-radius: inherit;
    object-fit: cover;
    object-position: center 43%;
    filter: saturate(1.1) contrast(1.06) brightness(.64);
}

html:has([data-recomp-reference]) body main [data-reference-hero]:has([data-reference-title]):has(> [data-reference-photo])::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    height: auto;
    border-radius: inherit;
    background:
        linear-gradient(rgba(25, 221, 255, .09) 1px, transparent 1px) 0 0 / 54px 54px,
        linear-gradient(90deg, rgba(25, 221, 255, .09) 1px, transparent 1px) 0 0 / 54px 54px,
        linear-gradient(90deg, rgba(2, 5, 8, .94), rgba(2, 5, 8, .34) 74%),
        linear-gradient(0deg, #020508, transparent 78%);
    pointer-events: none;
    content: "";
}

html:has([data-recomp-reference]) body main [data-reference-hero] [data-reference-title] {
    margin-block: 0 .25em;
    color: #19ddff !important;
    font-style: italic;
    line-height: .95;
    text-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}

html:has([data-recomp-reference]) body main [data-reference-hero]:has([data-reference-title]) :is(p, .lede, .small):where(:not([style*="color"])) {
    color: #b9cbd2 !important;
}

html:has([data-recomp-reference]) body main [data-reference-hero]:has([data-reference-title]) :is(.eyebrow, .app-kicker, .tw-eyebrow, .snap-eyebrow, .d3-eyebrow):where(:not([style*="color"])) {
    color: #19ddff !important;
    letter-spacing: .17em;
    text-transform: uppercase;
}

html:has([data-recomp-reference]) body main [data-reference-hero]:has([data-reference-title]) label {
    color: #f0faff;
}

html:has([data-recomp-reference]) body main [data-reference-title="plain"] {
    padding-block-end: .38em;
    border-image: linear-gradient(90deg, #19ddff, #7dff24, transparent) 1;
    border-block-end: 2px solid transparent;
}

html:has([data-recomp-reference]) body :is(main, .wr-paths) [data-reference-card] {
    --reference-card-accent: #19ddff;
    border-color: color-mix(in srgb, var(--reference-card-accent) 46%, var(--recomp-border)) !important;
    background:
        radial-gradient(ellipse at 8% 0, color-mix(in srgb, var(--reference-card-accent) 13%, transparent), transparent 74%),
        linear-gradient(145deg, var(--recomp-panel-raised), var(--recomp-panel)) !important;
    box-shadow: var(--recomp-shadow);
}

html:has([data-recomp-reference]) body :is(main, .wr-paths) [data-reference-card="green"] {
    --reference-card-accent: #7dff24;
}

html:has([data-recomp-reference]) body :is(main, .wr-paths) [data-reference-card="violet"] {
    --reference-card-accent: #a865ff;
}

html:has([data-recomp-reference]) body :is(main, .wr-paths) [data-reference-card] :is(h2, h3) {
    font-style: italic;
    letter-spacing: -.025em;
}

html:has([data-reference-marketing="true"]) body :is(.wr-nav, .rg-nav) {
    border-color: #25505a;
    background-color: #060e13;
}

html:has([data-reference-marketing="true"]) body :is(.wr-hero, .rg-hero) h1 {
    color: #19ddff;
    text-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}

html:has([data-reference-marketing="true"]) body :is(.wr-hero, .rg-hero) h1 span {
    color: #7dff24;
}
