/* ============================================================================
   wellbeing.css - CFPB Financial Well-Being Scale block
   ============================================================================
   A separate file for the same reason referral.css is one: design-system.css
   exists in four hand-synced copies (repo root, pro/, cloud/, priority/), so
   anything added there has to be applied four times or the copies drift.
   Nothing here defines a token - every value below is a var() resolving against
   design-system.css - so there is nothing to sync.

   Loaded by calculator.html.

   The site is light-only ([data-theme="fpn"] sets color-scheme: light and there
   is not one prefers-color-scheme rule anywhere), so there is no dark variant
   here either.
   ========================================================================== */

.wb-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    font-family: var(--font-sans);
}

.wb-eyebrow {
    font-size: var(--text-2xs);
    font-weight: var(--weight-semi);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-primary);
    margin: 0;
}

.wb-title {
    font-size: var(--text-md);
    font-weight: var(--weight-semi);
    color: var(--color-text-strong);
    margin: var(--space-2) 0 0;
    line-height: var(--leading-snug);
}

.wb-desc {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin: var(--space-2) 0 0;
    max-width: var(--measure-text);
}

.wb-optional {
    font-size: var(--text-xs);
    line-height: var(--leading-relaxed);
    color: var(--color-text-muted);
    margin: var(--space-2) 0 0;
    max-width: var(--measure-text);
}

/* ---------- One five-point block ---------------------------------------- */

.wb-block {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}

.wb-block-prompt {
    font-size: var(--text-sm);
    font-weight: var(--weight-semi);
    color: var(--color-text-strong);
    margin: 0;
    line-height: var(--leading-snug);
}

.wb-block-lead {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin: var(--space-1) 0 0;
}

/* ---------- One item ----------------------------------------------------- */

.wb-item {
    margin-top: var(--space-5);
}

.wb-item-text {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text);
    margin: 0 0 var(--space-2);
    max-width: var(--measure-text);
}

/* Five options across on a wide screen, stacked on a narrow one. The options
   are words rather than numbers, so they need real width; a five-column grid
   at phone width would clip them. */
.wb-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-1);
}

@media (min-width: 640px) {
    .wb-options {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: var(--space-2);
    }
    .wb-options-two {
        grid-template-columns: repeat(2, minmax(0, 14rem));
    }
}

.wb-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-border-input);
    border-radius: var(--radius-sm);
    background-color: var(--color-bg);
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.wb-option:hover {
    border-color: var(--color-border-strong);
}

.wb-option-label {
    font-size: var(--text-xs);
    line-height: var(--leading-snug);
    color: var(--color-text-secondary);
}

.wb-radio {
    flex: none;
    margin: 0;
    accent-color: var(--color-primary);
}

.wb-option:has(.wb-radio:checked) {
    border-color: var(--color-primary);
    background-color: var(--color-primary-subtle);
}

.wb-option:has(.wb-radio:checked) .wb-option-label {
    color: var(--color-text-strong);
    font-weight: var(--weight-semi);
}

/* :has() is widely supported now, but the focus ring must not depend on it. */
.wb-option:focus-within {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

/* ---------- Score readout ------------------------------------------------ */

.wb-score {
    margin-top: var(--space-6);
    padding: var(--space-6);
    border-radius: var(--radius-md);
    background-color: var(--color-primary-subtle);
    border: 2px solid var(--color-primary);
}

.wb-score-label {
    font-size: var(--text-2xs);
    font-weight: var(--weight-semi);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin: 0;
}

.wb-score-value {
    font-size: 56px;
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    color: var(--color-text-muted);
    margin: var(--space-1) 0 0;
    font-variant-numeric: tabular-nums;
}

.wb-score-value[data-complete="true"] {
    color: var(--color-primary);
}

.wb-score-note {
    font-size: var(--text-xs);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin: var(--space-2) 0 0;
    max-width: var(--measure-text);
}

/* ---------- Footnotes ---------------------------------------------------- */

.wb-footnote {
    font-size: var(--text-xs);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin: var(--space-4) 0 0;
    max-width: var(--measure-text);
}

.wb-attribution {
    font-size: var(--text-2xs);
    line-height: var(--leading-relaxed);
    color: var(--color-text-muted);
    margin: var(--space-2) 0 0;
    max-width: var(--measure-text);
}

/* The questions are for the person at the screen. The score is the part a
   coach wants on paper, and it is printed by the PDF builder rather than by
   the browser, so the whole block is left out of print. */
@media print {
    .wb-card { display: none; }
}

/* ---------- Results tabs -------------------------------------------------
   Lives here rather than in design-system.css for the same four-copies reason
   as everything else in this file, and because the strip only ever appears
   when the well-being panel does.
   ------------------------------------------------------------------------ */

.rt-tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--color-border);
}

.rt-tab {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.rt-tab:hover {
    color: var(--color-text-strong);
}

.rt-tab[aria-selected="true"] {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: var(--weight-semi);
}

.rt-tab:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: -2px;
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}

/* The well-being card already carries the accent rule that set it apart when
   it sat under the fee results. In its own tab that is redundant chrome. */
#panelWellbeing .wb-card {
    border-left-width: 1px;
}

/* A hidden panel must stay hidden when printing too - but both panels are
   printed from the PDF builder, not the page, so neither is a print concern. */
@media print {
    .rt-tabs { display: none; }
}

/* The "you have not finished" line under Run. Colour alone is not the signal
   - the wording changes too - so this is emphasis, not the message. */
.wb-run-error {
    color: var(--color-danger);
    font-weight: var(--weight-semi);
}

/* ---------- Preview banner ---------------------------------------------
   Warning tokens, not primary: this must read as "not live", not as a
   feature. It names the organization and says they have not signed up. */

.preview-banner {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    font-family: var(--font-sans);
}

.preview-banner-eyebrow {
    font-size: var(--text-sm);
    font-weight: var(--weight-semi);
    color: var(--color-text-strong);
    margin: 0;
}

.preview-banner-body {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text);
    margin: var(--space-1) 0 0;
    max-width: var(--measure-text);
}

/* ---------- Well-being results block (above the questions) ------------- */

.wb-results {
    margin-bottom: var(--space-7);
}

.wb-sample-note {
    font-size: var(--text-xs);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin: var(--space-2) 0 0;
}

/* ---------- Check-in: consent, knowledge, confidence (checkin.js) ------- */

.ci-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    font-family: var(--font-sans);
}

.ci-consent {
    border: 2px solid var(--color-primary);
}

.ci-title {
    font-size: var(--text-md);
    font-weight: var(--weight-semi);
    color: var(--color-text-strong);
    margin: 0;
}

.ci-desc {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin: var(--space-2) 0 0;
    max-width: var(--measure-text);
}

.ci-fine {
    font-size: var(--text-xs);
    line-height: var(--leading-relaxed);
    color: var(--color-text-muted);
    margin: var(--space-3) 0 0;
    max-width: var(--measure-text);
}

.ci-consent-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-top: var(--space-4);
    cursor: pointer;
}

.ci-checkbox {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

.ci-consent-text {
    font-size: var(--text-sm);
    font-weight: var(--weight-semi);
    color: var(--color-text-strong);
    line-height: var(--leading-snug);
}

.ci-item {
    border: 0;
    margin: var(--space-5) 0 0;
    padding: var(--space-4) 0 0;
    border-top: 1px solid var(--color-border);
    min-width: 0;
}

.ci-item-text {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text);
    font-weight: var(--weight-medium);
    padding: 0;
    margin-bottom: var(--space-3);
    max-width: var(--measure-text);
}

.ci-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
}

.ci-scale {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-1);
}

@media (min-width: 640px) {
    .ci-scale { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); }
}

.ci-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    min-height: 48px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg, 8px);
    background-color: var(--color-surface);
    cursor: pointer;
    transition: border-color .12s, background-color .12s;
}

.ci-option:hover { border-color: var(--color-border-strong); }
.ci-option:focus-within { outline: 2px solid var(--color-border-focus); outline-offset: 2px; }

.ci-option:has(.ci-radio:checked) {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
    background-color: var(--color-primary-subtle);
}

.ci-option:has(.ci-radio:checked) .ci-option-label {
    color: var(--color-text-strong);
    font-weight: var(--weight-semi);
}

.ci-radio { flex: none; margin: 0; width: 18px; height: 18px; accent-color: var(--color-primary); }

.ci-option-label {
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    color: var(--color-text-secondary);
}

/* Return-code card - shown in the results block, after the score. */
.ci-code-card {
    margin: var(--space-5) 0 0;
    border: 2px solid var(--color-primary);
    background-color: var(--color-primary-subtle);
}

.ci-code-eyebrow {
    font-size: var(--text-2xs);
    font-weight: var(--weight-semi);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--color-primary);
    margin: 0;
}

.ci-code-value {
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--color-text-strong);
    letter-spacing: var(--tracking-wide);
    margin: var(--space-2) 0 0;
    overflow-wrap: anywhere;
}

.ci-code-btn { margin-top: var(--space-4); }

/* A <legend> normally sits ON its fieldset's top border, cutting through the
   divider line. Floating it moves it inside the box like ordinary text. */
.ci-item-text { float: left; width: 100%; }
.ci-item-text + * { clear: both; }
