/* Forest-and-gold themes share the same structure, type and spacing. */

/*
 * One root scale for every size on every page.
 *
 * CSS pixels are absolute, so the same 16px body copy is physically larger on
 * a 1600px panel than on a 1280px one, and larger again on a dense panel driven
 * at 200% OS scaling — which reports a wide viewport while showing less. Rather
 * than clip each component, every font size, line height and letter spacing in
 * the stylesheets is authored in `rem`, and this scale moves them together.
 *
 * Wide panels step down twice; dense panels one step further, because at the
 * same CSS width they are the ones sitting closest to the eye.
 */
:root {
    --ui-scale: 1;
}
html {
    font-size: calc(16px * var(--ui-scale));
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
@media (min-width: 1024px) {
    :root {
        --ui-scale: 0.97;
    }
}
@media (min-width: 1280px) {
    :root {
        --ui-scale: 0.95;
    }
}
@media (min-width: 1600px) {
    :root {
        --ui-scale: 0.93;
    }
}
@media (min-width: 1920px) {
    :root {
        --ui-scale: 0.9;
    }
}
@media (min-resolution: 2dppx) and (min-width: 1280px) {
    :root {
        --ui-scale: 0.93;
    }
}
@media (min-resolution: 2dppx) and (min-width: 1600px) {
    :root {
        --ui-scale: 0.9;
    }
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #b6c6bb;
    border-radius: 50%;
    background: transparent;
    color: #175138;
    cursor: pointer;
}
.theme-toggle:hover {
    background: #eaf2ec;
}
.theme-toggle:focus-visible {
    outline: 2px solid #b58e33;
    outline-offset: 3px;
}
.auth-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
}
.login-theme-toggle {
    position: absolute;
    /* The content column is the viewport minus the 42% art panel; sit on its
       inner edge, on the brand's line, so the toggle reads as page chrome. */
    right: calc(42% + 5.5%);
    top: 62px;
    z-index: 4;
}
@media (max-width: 1000px) {
    .login-theme-toggle {
        right: calc(35% + 35px);
    }
}
@media (max-width: 600px) {
    .login-theme-toggle {
        top: 26px;
        right: 24px;
    }
}
/*
 * Dark theme — design.md §3.1. The brand green brightens so it can carry text
 * on a dark canvas; the gold stays an accent.
 */
html:root[data-theme='dark'] {
    color-scheme: dark;

    /* Named tokens */
    --brand: #48b78b;
    --brand-deep: #d5f3e3;
    --accent: #e9b84d;
    --canvas: #0c1612;
    --surface: #13231c;
    --elevated: #192b23;
    --text: #f1f6f2;
    --text-muted: #afc2b7;
    --border-subtle: #344d40;
    --focus-ring: #79dfaf;
    --shadow-popover: 0 16px 40px rgb(0 0 0 / 30%);

    /* The marketing stylesheets read these */
    --theme-page: #0c1612;
    --theme-surface: #13231c;
    --theme-raised: #192b23;
    --theme-text: #f1f6f2;
    --theme-muted: #afc2b7;
    --theme-border: #344d40;
    --theme-accent: #e9b84d;

    /* Channel triplets */
    --color-ink: 241 246 242;
    --color-forest: 213 243 227;
    --color-navy: 72 183 139;
    --color-wax: 233 184 77;
    --color-gold: 233 184 77;
    --color-cream: 12 22 18;
    --color-panel: 19 35 28;
    --color-night: 12 22 18;
    --color-neutral-50: 19 35 28;
    --color-neutral-100: 25 43 35;
    --color-neutral-200: 52 77 64;
    --color-neutral-300: 74 102 88;
    --color-neutral-400: 128 150 138;
    --color-neutral-500: 175 194 183;
    --color-neutral-600: 190 205 196;
    --color-neutral-700: 205 219 209;
    --color-neutral-800: 222 234 226;
    --color-neutral-900: 241 246 242;
    --color-success: 102 211 160;
    --color-warn: 241 197 107;
    --color-danger: 255 149 138;

    --background: 155 34% 7%;
    --foreground: 140 22% 95%;
    --card: 155 21% 10%;
    --card-foreground: 140 22% 95%;
    --popover: 155 21% 11%;
    --popover-foreground: 140 22% 95%;
    --secondary: 150 25% 13%;
    --secondary-foreground: 140 22% 95%;
    --muted: 150 25% 13%;
    --muted-foreground: 143 15% 72%;
    --accent: 42 78% 60%;
    --accent-foreground: 155 34% 7%;
    --border: 149 20% 24%;
    --input: 149 20% 24%;
    --ring: 154 52% 71%;
    background: var(--theme-page);
}
html:root[data-theme='dark'] body {
    background: var(--theme-page);
    color: var(--theme-text);
}
html:root[data-theme='dark'] :is(.marketing-page, .auth-page.ref-auth, .ref-auth .auth-card) {
    background: var(--theme-page);
    color: var(--theme-text);
}
/* The workspace carries the same wordmark, so it darkens with everything else. */
html:root[data-theme='dark'] :is(.marketing-page, .ref-auth, .workspace-frame) :is(h1, h2, h3, h4, label, .brand, .ref-price) {
    color: var(--theme-text);
}
html:root[data-theme='dark']
    :is(.marketing-page, .ref-auth)
    :is(
        p,
        li,
        td,
        small,
        .copyright,
        .auth-description,
        .auth-field-hint,
        .auth-selection-count,
        .auth-options,
        .auth-footer,
        .ref-search-status
    ) {
    color: var(--theme-muted);
}
html:root[data-theme='dark'] .marketing-page :is(.site-header, .site-footer, .site-nav) {
    background: var(--theme-page);
    border-color: var(--theme-border);
}
html:root[data-theme='dark']
    .marketing-page
    :is(
        .site-nav a,
        .login-link,
        .mobile-menu,
        .site-footer a,
        .ref-faq-topics a,
        .ref-faq-topics button,
        .ref-connect a
    ) {
    color: var(--theme-text);
}
html:root[data-theme='dark']
    .marketing-page
    :is(.ref-section-tint, .ref-impact, .ref-steps, .ref-help, .ref-billing, .ref-faq-topics) {
    background: var(--theme-surface);
    border-color: var(--theme-border);
}
html:root[data-theme='dark']
    .marketing-page
    :is(
        .ref-benefit-grid article,
        .ref-plans article,
        .ref-faq-answers .ds-accordion-item,
        .ds-contact-form,
        .ref-connect article,
        .ref-faq-search input,
        .ref-table-scroll,
        .ref-floating-stat
    ) {
    background: var(--theme-surface);
    border-color: var(--theme-border);
    box-shadow: 0 8px 24px #0002;
}
html:root[data-theme='dark'] .marketing-page .ref-plans article.featured {
    background: #252d20;
    border-color: var(--theme-accent);
}
html:root[data-theme='dark'] .marketing-page :is(.ref-icon, .ref-step-icon, .ref-included, .ref-preview-row > svg) {
    color: #a9d9b8;
    background: var(--theme-raised);
}
html:root[data-theme='dark'] .marketing-page .ref-steps article h3 {
    color: var(--theme-text);
}
html:root[data-theme='dark']
    .marketing-page
    :is(
        .ref-plans ul,
        .ref-comparison th,
        .ref-comparison td,
        .site-footer > div:first-child,
        .copyright,
        .ds-accordion-item,
        .ds-accordion-panel
    ) {
    border-color: var(--theme-border);
}
html:root[data-theme='dark']
    .marketing-page
    :is(
        .ref-comparison thead,
        .ref-comparison tr:nth-child(even),
        .ref-faq-topics button[aria-pressed='true'],
        .ds-accordion-trigger[aria-expanded='true']
    ) {
    background: var(--theme-raised);
}
html:root[data-theme='dark']
    .marketing-page
    :is(
        .ref-comparison th,
        .ds-accordion-trigger,
        .ref-faq-search input,
        .ds-contact-fields input,
        .ds-contact-fields textarea,
        .ds-contact-fields select
    ) {
    color: var(--theme-text);
}
html:root[data-theme='dark']
    .marketing-page
    :is(.ref-faq-search input, .ds-contact-fields input, .ds-contact-fields textarea, .ds-contact-fields select) {
    background: var(--theme-surface);
    border-color: #769581;
}
html:root[data-theme='dark'] .marketing-page .ref-billing button {
    background: var(--theme-surface);
    color: var(--theme-text);
}
html:root[data-theme='dark'] .marketing-page .ref-billing button[aria-pressed='true'] {
    background: #23704a;
    color: white;
}
html:root[data-theme='dark'] .marketing-page :is(.bs-button.outline, .ref-help .bs-button) {
    color: var(--theme-text);
    border-color: #789b83;
    background: var(--theme-surface);
}
html:root[data-theme='dark'] .marketing-page .ref-preview {
    background: var(--theme-raised);
    border-color: var(--theme-border);
}
html:root[data-theme='dark'] .marketing-page .ref-preview-body {
    background: var(--theme-raised);
}
html:root[data-theme='dark'] .marketing-page .ref-preview-row {
    background: var(--theme-surface);
    color: var(--theme-text);
}
html:root[data-theme='dark'] .marketing-page .ref-preview-row strong {
    color: var(--theme-text);
}
html:root[data-theme='dark'] .marketing-page .ref-preview-row small {
    background: #294d37;
    color: #c6ead0;
}
html:root[data-theme='dark'] .marketing-page .ref-floating-stat strong {
    color: #b7e3c4;
}
html:root[data-theme='dark'] .marketing-page .ref-sun {
    opacity: 0.35;
}
html:root[data-theme='dark'] .marketing-page :is(.ref-cta h2, .ref-cta p) {
    color: white;
}
html:root[data-theme='dark'] .marketing-page .ref-cta .bs-button {
    color: #173923;
}
html:root[data-theme='dark']
    .ref-auth
    :is(
        .auth-label,
        .auth-progress,
        .ref-auth-back,
        .auth-footer a,
        .auth-options a,
        .auth-csd-copy h2,
        .auth-multi-option,
        .auth-multi-trigger,
        .auth-multi-trigger span
    ) {
    color: var(--theme-text);
}
html:root[data-theme='dark'] .ref-auth :is(.auth-field input, .auth-multi-control, .auth-multi-panel, .auth-csd-card) {
    background: var(--theme-surface);
    color: var(--theme-text);
    border-color: #769581;
}
html:root[data-theme='dark']
    .ref-auth
    :is(.auth-multi-option:has(:checked), .auth-multi-option:hover, .auth-selection-chip, .auth-password-toggle:hover) {
    background: #244c36;
    color: #d6eedc;
}
html:root[data-theme='dark']
    .ref-auth
    :is(.auth-multi-footer, .auth-manual-divider::before, .auth-manual-divider::after) {
    border-color: var(--theme-border);
}
html:root[data-theme='dark']
    .ref-auth
    :is(.auth-manual-divider, .auth-field > svg, .auth-password-toggle, .auth-multi-footer .nt-button:first-child) {
    color: var(--theme-muted);
}
html:root[data-theme='dark'] .ref-auth .auth-manual-divider::before,
html:root[data-theme='dark'] .ref-auth .auth-manual-divider::after {
    background: var(--theme-border);
}
html:root[data-theme='dark'] .ref-auth :is(.auth-csd-icon, .ref-auth-benefits > div > span) {
    background: #cfe5d4;
    color: #145a38;
}
html:root[data-theme='dark']
    .ref-auth
    :is(.auth-csd-upload .nt-button, .join-actions > button:first-child:not(:only-child)) {
    background: var(--theme-surface);
    color: var(--theme-text);
    border-color: #769581;
}
html:root[data-theme='dark'] .ref-auth :is(.auth-error, .auth-field-error) {
    color: #ffc4b8;
}
html:root[data-theme='dark'] .ref-auth .auth-error {
    background: #3f2520;
    border-color: #a56255;
}
html:root[data-theme='dark'] .ref-auth :is(.auth-art h2, .auth-art h3, .auth-art p) {
    color: white;
}
html:root[data-theme='dark'] .ref-auth .auth-field > img,
html:root[data-theme='dark'] .ref-auth .auth-password-toggle img {
    filter: brightness(0) invert(0.85);
}
html:root[data-theme='dark'] :is(.marketing-page, .ref-auth) input::placeholder,
html:root[data-theme='dark'] :is(.marketing-page, .ref-auth) textarea::placeholder {
    color: #a2b4a8;
    opacity: 1;
}
html:root[data-theme='dark'] .theme-toggle {
    color: #ead18d;
    border-color: var(--theme-border);
}
html:root[data-theme='dark'] .theme-toggle:hover {
    background: var(--theme-raised);
}
html:root[data-theme='dark'] :is(.marketing-page, .ref-auth) :focus-visible {
    outline-color: #dfc475;
}
@media (max-width: 600px) {
    html:root .marketing-page .site-header-inner {
        gap: 10px;
    }
    html:root .marketing-page .site-header-actions {
        gap: 8px;
    }
    html:root .marketing-page .site-header .bs-button {
        padding-inline: 12px;
    }
    .site-header-actions .theme-toggle {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
    }
}
html:root[data-theme='light'] {
    color-scheme: light;
}
html:root[data-theme='dark'] .marketing-page .ref-tint {
    background: var(--theme-surface);
}
html:root[data-theme='dark'] .marketing-page :is(.quiet-link, .ref-impact strong) {
    color: #c4e4cd;
}
html:root[data-theme='dark']
    .marketing-page
    :is(
        .ref-price > span,
        .ref-comparison caption,
        .ref-impact span,
        .ref-floating-stat span,
        .ref-illustration-label
    ) {
    color: var(--theme-muted);
}
html:root[data-theme='dark'] .marketing-page .ref-faq-topics :is(button, a) {
    background: var(--theme-surface);
}
html:root[data-theme='dark'] .marketing-page .ref-faq-topics button[aria-pressed='true'] {
    background: var(--theme-raised);
}
html:root[data-theme='dark']
    .marketing-page
    :is(
        .market-band,
        .market-dossier,
        .market-source-note,
        .market-fields,
        .market-dossier-top,
        .market-coverage,
        .marketing-coverage-note
    ) {
    background: var(--theme-surface);
    border-color: var(--theme-border);
}
html:root[data-theme='dark']
    .marketing-page
    :is(.market-dossier dl div, .market-fields dl div, .market-task-list > a, .market-principles > div) {
    border-color: var(--theme-border);
}
html:root[data-theme='dark']
    .marketing-page
    :is(dt, dd, .market-task-list a span, .market-process-note, .market-dossier-top, .market-source-note) {
    color: var(--theme-muted);
}
html:root[data-theme='dark']
    .marketing-page
    :is(.market-task-list a span:last-child, .market-process > li > span, .market-dossier strong) {
    color: #c4e4cd;
}
html:root[data-theme='dark'] .marketing-page .market-process > li > span {
    background: var(--theme-raised);
}
html:root[data-theme='dark'] .marketing-page .feature-card {
    background: var(--theme-surface);
    border-color: var(--theme-border);
}
html:root[data-theme='dark'] .marketing-page .feature-icon {
    background: var(--theme-raised);
    color: #b8dfc2;
}
html:root[data-theme='dark'] .ref-auth [class*='text-ink/50'] {
    color: var(--theme-muted);
}
html:root[data-theme='dark'] .marketing-page .feature-detail-grid > article {
    background: var(--theme-surface);
    border-color: var(--theme-border);
}
html:root[data-theme='dark'] .marketing-page :is(.cta-banner h2, .cta-banner p) {
    color: white;
}
@media (max-width: 380px) {
    html:root .marketing-page .site-header-inner {
        gap: 8px;
    }
    html:root .marketing-page .site-header-actions {
        gap: 6px;
    }
    html:root .marketing-page .site-header .brand {
        font-size: 1.25rem;
        gap: 6px;
    }
    html:root .marketing-page .site-header .bs-button {
        font-size: .6875rem;
        padding-inline: 8px;
        min-height: 40px;
    }
    html:root .marketing-page .site-header .theme-toggle {
        flex-basis: 32px;
        width: 32px;
        height: 36px;
    }
    html:root .marketing-page .site-header .mobile-menu {
        width: 28px;
        padding-inline: 2px;
    }
}
@media (max-width: 380px) {
    html:root .marketing-page .site-header-inner {
        width: calc(100% - 24px);
    }
}
html:root[data-theme='dark'] .ref-auth .auth-field input[aria-invalid='true'] {
    border-color: #efa58d;
    background: #30231e;
}

/* ---------------------------------------------------------------------------
 * Workspace surfaces in dark mode.
 *
 * The tender list, the tender detail and their filters are the only workspace
 * pages still painted with fixed colours; everything else already uses the
 * shared tokens. These overrides keep them legible in the dark theme instead of
 * leaving white cards behind light text.
 * ------------------------------------------------------------------------- */
html:root[data-theme='dark'] :is(.tender-list-row, .detail-summary article, .detail-panel) {
    background: rgb(var(--color-panel));
    border-color: rgb(var(--color-neutral-200));
}
html:root[data-theme='dark'] .tender-list-row:hover {
    background: rgb(var(--color-neutral-100));
    border-color: rgb(var(--color-neutral-300));
}
html:root[data-theme='dark'] .tender-list-row p,
html:root[data-theme='dark'] .list-message,
html:root[data-theme='dark'] .list-pagination,
html:root[data-theme='dark'] .detail-back,
html:root[data-theme='dark'] .detail-meta,
html:root[data-theme='dark'] .detail-summary span,
html:root[data-theme='dark'] .detail-contact,
html:root[data-theme='dark'] .matching-filter {
    color: rgb(var(--color-ink) / 0.62);
}
html:root[data-theme='dark'] .list-message h2,
html:root[data-theme='dark'] .detail-tab-content h2,
html:root[data-theme='dark'] .detail-tab-content h3 {
    color: rgb(var(--color-ink));
}
html:root[data-theme='dark'] .detail-tab-content {
    color: rgb(var(--color-ink) / 0.78);
}
html:root[data-theme='dark'] .detail-contact a {
    color: #8ed3ad;
}
html:root[data-theme='dark'] :is(.search-control input, .tender-filters select) {
    border-color: rgb(var(--color-neutral-300));
    background: rgb(var(--color-panel));
    color: rgb(var(--color-ink));
}
html:root[data-theme='dark'] .search-control svg {
    color: rgb(var(--color-ink) / 0.55);
}
html:root[data-theme='dark'] .search-control input::placeholder {
    color: rgb(var(--color-ink) / 0.45);
}
html:root[data-theme='dark'] .list-pagination button {
    border-color: rgb(var(--color-neutral-300));
    background: rgb(var(--color-panel));
    color: rgb(var(--color-ink) / 0.8);
}
html:root[data-theme='dark'] .detail-tabs {
    border-color: rgb(var(--color-neutral-200));
}
html:root[data-theme='dark'] .detail-tabs button {
    color: rgb(var(--color-ink) / 0.62);
}
html:root[data-theme='dark'] .detail-tabs button[aria-selected='true'] {
    background: rgb(var(--color-navy));
    color: #fff;
}
html:root[data-theme='dark'] .detail-summary article > svg {
    color: rgb(var(--color-wax));
}

/*
 * Outline buttons and inline links inside the workspace. The gold-outline
 * button is tuned for cream; on a dark page it needs a lighter rule and text or
 * it disappears into the surface.
 */
html:root[data-theme='dark'] .workspace-frame .bs-button.outline {
    background: transparent;
    border-color: rgb(230 200 130 / 0.45);
    color: #e6c882;
}
html:root[data-theme='dark'] .workspace-frame .bs-button.outline:hover {
    background: rgb(230 200 130 / 0.12);
    border-color: rgb(230 200 130 / 0.7);
}
html:root[data-theme='dark'] .workspace-frame .bs-button {
    background: #1f6b45;
    border-color: #1f6b45;
    color: #fff;
}
html:root[data-theme='dark'] .workspace-frame .bs-button:hover {
    background: #247a4e;
}
html:root[data-theme='dark'] .workspace-frame .detail-tab-content a {
    color: #8ed3ad;
}
html:root[data-theme='dark'] .workspace-frame .nt-button {
    border-color: rgb(var(--color-neutral-300));
    color: rgb(var(--color-ink));
}
html:root[data-theme='dark'] .workspace-frame .detail-source-link {
    border-color: rgb(230 200 130 / 0.45);
    color: #e6c882;
}
html:root[data-theme='dark'] .workspace-frame .detail-source-link:hover {
    background: rgb(230 200 130 / 0.12);
    border-color: rgb(230 200 130 / 0.7);
}
html:root[data-theme='dark'] .workspace-frame .detail-provenance p {
    color: rgb(var(--color-ink) / 0.6);
}
html:root[data-theme='dark'] .ref-comparison thead tr {
    border-color: rgb(var(--color-neutral-300));
}
html:root[data-theme='dark'] .ref-comparison tbody tr {
    border-color: rgb(var(--color-neutral-200) / 0.6);
}
html:root[data-theme='dark'] .ref-included {
    background: rgb(72 183 139 / 0.16);
    color: #8ed3ad;
}
