/* ============================================================
   Quiet boxes (profilecleanup, option D; Stephen 2026-11-14:
   "Build Option D for the Primary and Spouse profile ... if shared
   classes are involved, it's certainly ok to make the same kind of
   updates to all of the other content boxes").

   Members said the planner's inputs column was overwhelming. Option D
   keeps every control and every value but lets the controls rest:

   1. One card. A box's body is ONE white card; its sections are parts
      of it (a title and some air), not separate floating cards.
   2. Fewer marks. No hairlines between rows, section titles in their
      own case (no uppercase tracking), lighter labels and values, the
      bucket tags and the age as plain grey text.
   3. Two-step reveal (pointer devices only). At rest a value reads as
      text. When the pointer enters a box (or focus does) every value
      field gets a faint outline and the "?" icons come up; the row
      under the pointer gets its full controls: the field's border,
      the chevron, the - / + steppers, the dropdown carets.

   Everything here is under `body.ui-quiet`: the class is set before the
   first paint by the inline line in views/index.ejs (localStorage
   `rarQuietBoxes`, per device, never plan content; `?quiet=0` / `?quiet=1`
   switches it, as does QuietBoxes.setEnabled in contentBoxV3.js), so the
   old look is one switch away. No markup depends on it.

   Touch screens have no hover, so the reveal never happens there: the
   rest-state hiding is inside `@media (hover: hover) and (pointer: fine)`
   and a touch screen keeps every control showing (with 1 and 2).

   The reveal has no reduced-motion override on purpose: the transitions
   are short fades, and with Windows "Animation effects" off Stephen saw
   no motion at all (the same rule as the tap-to-edit sliders).
   ============================================================ */

body.ui-quiet {
    /* Row labels: between the primary and the secondary text, so a label
       stays above the notes (secondary, 14px) and below its value. */
    --qb-label: color-mix(in srgb, var(--ui-text-primaryText) 60%, var(--ui-text-secondaryText));
    --qb-fade: 0.2s ease;
}

/* ------------------------------------------------------------
   1. One card per box
   ------------------------------------------------------------ */

/* The body is the card (it was a grey tray holding one card per section). */
body.ui-quiet .content-box-v2.content-box-v3 > .content-box-body {
    margin: 0 14px 14px;
    padding: 12px 16px 16px;
    background: var(--color-white-1);
    border: 1px solid rgba(var(--color-blue-7-rgb), 0.35);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 12px 34px rgba(var(--color-ui-shadow-rgb), 0.12);
}

body.ui-quiet .content-box-v2.content-box-v3 > .content-box-body.collapsed {
    margin-bottom: 0;
    padding: 0;
    border-width: 0;
    box-shadow: none;
}

/* Sections are parts of the card: no frame of their own, a title and air. */
body.ui-quiet .content-box-v3 .content-box-body .content-section {
    margin: 0;
    padding: 18px 0 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

body.ui-quiet .content-box-v3 .content-box-body > .content-section:first-child,
body.ui-quiet .content-box-v3 .content-box-body > .content-section:first-child[style*="display: none"] + .content-section {
    padding-top: 2px;
}

body.ui-quiet .content-box-v3 .content-section-header {
    margin-bottom: 6px;
}

/* Titles in their own case: "Profile", "Investment Returns". A few titles
   are styled inline (the Social Security Children section), hence !important;
   their colour is kept. */
body.ui-quiet .content-box-v3 .content-section-title {
    font-size: var(--text-small, 14px) !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

/* ------------------------------------------------------------
   2. Fewer marks
   ------------------------------------------------------------ */

/* No hairlines between rows. */
body.ui-quiet .content-box-v3 .slider-tap + .slider-tap {
    background-image: none;
}

body.ui-quiet .cb-profile-top .cb-bd-quiet,
body.ui-quiet .cb-profile-top .cb-loc-row,
body.ui-quiet .cb-profile-top .cb-detail-row {
    border-bottom-color: transparent;
}

body.ui-quiet .cb-profile-top .retirement-month-control {
    border-top-color: transparent;
}

/* The same hairlines in the boxes that draw their own rows: Employment
   Income (rows, switch rows, Works until, the Roth catch-up block and the
   footnote), the Annuity amounts, the Pensions box, the Returns box's
   combined-return block. Ledgers and sum lines (the Retirement Year Detail,
   Saved to cash) keep theirs: there a line means "adds up to". */
body.ui-quiet .content-box-v3 .ei-row.slider-tap,
body.ui-quiet .ei-box .ei-switch-row,
body.ui-quiet .ei-box .ei-until,
body.ui-quiet .content-box-v3 .an-rows .slider-tap,
body.ui-quiet .content-box-v3 .an-tax-row.slider-tap {
    background-image: none;
}

body.ui-quiet .an-box .an-rows,
body.ui-quiet .ei-box .ei-roth,
body.ui-quiet .ei-box .ei-foot,
body.ui-quiet .content-box-v3 .pbx-row,
body.ui-quiet .content-box-v3 .combined-return-display {
    border-top-color: transparent;
}

/* Milestones' "Automatic milestones" fold-out: a title like the others, no
   rule above it (both set inline, hence !important). */
body.ui-quiet #milestones-auto-section {
    border-top-color: transparent !important;
}

body.ui-quiet #milestones-auto-section > summary {
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* Sub-headings inside a section, in their own case like the titles. */
body.ui-quiet .ei-box .ei-subhead {
    font-size: var(--text-small, 14px);
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

/* Lighter labels. */
body.ui-quiet .cb-profile-top .cb-bd-row .slider-label,
body.ui-quiet .cb-profile-top .cb-loc-label,
body.ui-quiet .cb-profile-top .cb-detail-label label,
body.ui-quiet .cb-age-timeline .cb-at-label,
body.ui-quiet .content-box-v3 .slider-tap.slider-container > .slider-label,
body.ui-quiet .content-box-v3 .slider-v3 > .slider-label,
body.ui-quiet .content-box-v3 .slider-tap .compact-slider-label-text,
body.ui-quiet .content-box-v3 .ei-row.slider-tap .slider-label,
body.ui-quiet .ei-box .ei-row-title,
body.ui-quiet #retirement-calculator .cb-spouse-label {
    font-weight: 400;
    color: var(--qb-label);
}

/* Values: still the strongest text in a row, one step lighter. */
body.ui-quiet .content-box-v3 .slider-tap.slider-container .slider-input input,
body.ui-quiet .content-box-v3 .slider-tap .compact-slider-input,
body.ui-quiet #primary-accounts-list .compact-slider-input,
body.ui-quiet #spouse-accounts-list .compact-slider-input,
body.ui-quiet #master-cash-account-container .compact-slider-input,
body.ui-quiet .content-box-v3 .slider-tap .ei-unit,
body.ui-quiet .cb-profile-top .cb-quiet-field,
body.ui-quiet .cb-profile-top .cb-loc-row .icon-dropdown-text,
body.ui-quiet .cb-profile-top .cb-loc-row .cb-select-label,
body.ui-quiet .cb-profile-top .cb-detail-group .cb-select-label,
body.ui-quiet .cb-profile-top .retirement-month-row .icon-dropdown-text,
body.ui-quiet .cb-age-timeline .cb-at-value {
    font-weight: 600;
}

/* The age beside the birth date: plain grey text, not a pill. */
body.ui-quiet .cb-profile-top .cb-bd-quiet .cb-age-pill {
    padding: 0;
    background: transparent;
    font-size: var(--text-small, 14px);
    font-weight: 400;
    color: var(--ui-text-secondaryText);
}

/* An account's bucket: plain grey text before the balance, not a coloured
   tag (the dot keeps the bucket's colour). The colour is set inline by
   CompactSlider, hence !important. */
body.ui-quiet .content-box-v3 .slider-tap .compact-slider-bucket-label {
    min-width: 0;
    padding: 0;
    background: transparent;
    font-size: var(--text-xs, 12px);
    font-weight: 400;
    color: var(--ui-text-secondaryText) !important;
}

/* The retirement month moves from under the timeline to the "Retire in"
   row it comes from (profileAgeTimeline.js writes both; one shows). */
.cb-rm-when {
    display: none;
}

body.ui-quiet .cb-profile-top .cb-rm-when {
    display: inline;
    margin-left: auto;
    font-size: var(--text-small, 14px);
    color: var(--ui-text-secondaryText);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

body.ui-quiet .cb-profile-top .cb-rm-when:empty {
    display: none;
}

body.ui-quiet .cb-profile-top .retirement-month-row .slider-label {
    flex: 1 0 auto;
}

body.ui-quiet .cb-age-timeline .cb-at-when {
    display: none;
}

/* One column of values. A slider row's value text ends 48px in from the
   section's edge (the chevron's 28px column, its 10px gap, the field's
   padding); the profile rows end theirs at the same line. Measured with
   .automation/planning/profilecleanup/measure-values.cjs: each field type
   has its own inside space (a caret, the calendar icon, a stepper), so
   each row takes its own padding. */
body.ui-quiet .cb-profile-top .cb-bd-quiet .cb-bd-row {
    padding-right: 4px;
}

body.ui-quiet .cb-profile-top .cb-loc-row,
body.ui-quiet .cb-profile-top .cb-detail-row {
    padding-right: 22px;
}

body.ui-quiet .cb-profile-top .cb-at-head {
    padding-right: 20px;
}

body.ui-quiet .cb-profile-top .retirement-month-row {
    padding-right: 24px;
}

/* Employment Income's "Works until" value, on the same line as the slider
   values above and below it (its chevron sits 24px further out, where a
   slider row's chevron is). */
body.ui-quiet .ei-box .ei-until-value {
    margin-right: 24px;
    font-weight: 600;
}

/* The invested total under the account values it adds up. */
body.ui-quiet .content-box-v3 .allocation-bar-meta {
    padding-right: 48px;
}

/* The account links: no icons; plain text until the box wakes. */
body.ui-quiet :is(#primary-account-actions, #spouse-account-actions) button i {
    display: none;
}

body.ui-quiet :is(#primary-account-actions, #spouse-account-actions) button {
    color: var(--ui-text-linkText) !important;
}

/* ------------------------------------------------------------
   3. Two-step reveal (pointer devices)
   ------------------------------------------------------------ */
@media (hover: hover) and (pointer: fine) {

    /* --- Slider rows (both slider classes, every box) --- */

    /* At rest the value reads as text. */
    body.ui-quiet .content-box-v3 .slider-tap.slider-container .slider-input input:not(:focus),
    body.ui-quiet .content-box-v3 .slider-tap .compact-slider-input:not(:focus) {
        border-color: transparent;
        background-color: transparent;
        transition: border-color var(--qb-fade), background-color var(--qb-fade), box-shadow 0.15s ease;
    }

    /* The pointer is in the box: a faint outline on every value. */
    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .slider-tap.slider-container .slider-input input:not(:disabled):not(:focus),
    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .slider-tap .compact-slider-input:not(:disabled):not(:focus) {
        border-color: var(--ui-borders-borderLight);
    }

    /* The row under the pointer (or open, or holding focus): the field. */
    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .slider-tap:is(:hover, :focus-within, .is-open).slider-container .slider-input input:not(:disabled):not(:focus),
    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .slider-tap:is(:hover, :focus-within, .is-open) .compact-slider-input:not(:disabled):not(:focus),
    body.ui-quiet .content-box-v3 .slider-tap.is-open.slider-container .slider-input input:not(:disabled):not(:focus),
    body.ui-quiet .content-box-v3 .slider-tap.is-open .compact-slider-input:not(:disabled):not(:focus) {
        border-color: var(--ui-borders-borderDefault);
        background-color: var(--ui-backgrounds-cardBg);
    }

    /* Read-only and disabled values stay plain text in every state. */
    body.ui-quiet .content-box-v3 .slider-tap.slider-readonly .compact-slider-input,
    body.ui-quiet .content-box-v3 .slider-tap.slider-readonly.slider-container .slider-input input {
        border-color: transparent !important;
        background-color: transparent !important;
    }

    /* The row's chevron: only on the row under the pointer. */
    body.ui-quiet .content-box-v3 .slider-tap::after {
        opacity: 0;
        transition: opacity var(--qb-fade), transform 0.2s ease, margin 0.2s ease;
    }

    body.ui-quiet .content-box-v3 .slider-tap:is(:hover, :focus-within, .is-open)::after {
        opacity: 1;
    }

    /* --- Profile rows: birth date, location, its details, "Retire in" --- */

    body.ui-quiet .cb-profile-top .cb-quiet-field,
    body.ui-quiet .cb-profile-top .cb-loc-row :is(.icon-dropdown-selected, .cb-select-trigger),
    body.ui-quiet .cb-profile-top .cb-detail-group .cb-select-trigger,
    body.ui-quiet .cb-profile-top .retirement-month-row .icon-dropdown-selected {
        transition: border-color var(--qb-fade), box-shadow 0.15s ease;
    }

    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .cb-profile-top :is(.cb-quiet-field, .icon-dropdown-selected, .cb-select-trigger):not(:focus):not(.open):not(.cb-select-open) {
        border-color: var(--ui-borders-borderLight);
    }

    body.ui-quiet .cb-profile-top :is(.cb-bd-quiet, .cb-loc-row, .cb-detail-row, .retirement-month-control):is(:hover, :focus-within) :is(.cb-quiet-field, .icon-dropdown-selected, .cb-select-trigger):not(:focus):not(.open):not(.cb-select-open) {
        border-color: var(--ui-borders-borderDefault);
    }

    /* Carets and the calendar icon: only on the row under the pointer. */
    body.ui-quiet .cb-profile-top :is(.icon-dropdown-arrow, .cb-select-chevron) {
        opacity: 0;
        transition: opacity var(--qb-fade), transform 0.2s ease;
    }

    body.ui-quiet .cb-profile-top .cb-quiet-field::-webkit-calendar-picker-indicator {
        opacity: 0;
        transition: opacity var(--qb-fade);
    }

    body.ui-quiet .cb-profile-top :is(.cb-bd-quiet, .cb-loc-row, .cb-detail-row, .retirement-month-control):is(:hover, :focus-within) :is(.icon-dropdown-arrow, .cb-select-chevron),
    body.ui-quiet .cb-profile-top :is(.icon-dropdown-selected.open, .cb-select-open) :is(.icon-dropdown-arrow, .cb-select-chevron) {
        opacity: 1;
    }

    body.ui-quiet .cb-profile-top .cb-bd-quiet:is(:hover, :focus-within) .cb-quiet-field::-webkit-calendar-picker-indicator {
        opacity: 0.7;
    }

    /* --- The ages: steppers on the row, small handles at rest --- */

    body.ui-quiet .cb-age-timeline .cb-at-step {
        opacity: 0;
        transition: opacity var(--qb-fade), background-color 0.13s ease, color 0.13s ease;
    }

    body.ui-quiet .cb-age-timeline:is(:hover, :focus-within) .cb-at-step:not(:disabled) {
        opacity: 1;
    }

    body.ui-quiet .cb-age-timeline:is(:hover, :focus-within) .cb-at-step:disabled {
        opacity: 0.4;
    }

    body.ui-quiet .cb-age-timeline .cb-at-handle {
        transform: scale(0.56);
        box-shadow: none;
        transition: left 0.15s ease, transform var(--qb-fade), box-shadow var(--qb-fade);
    }

    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .cb-age-timeline .cb-at-handle {
        transform: none;
    }

    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .cb-age-timeline .cb-at-handle:not(:focus-visible) {
        box-shadow: 0 1px 3px rgba(var(--color-ui-shadow-rgb), 0.25);
    }

    body.ui-quiet .cb-age-timeline.is-dragging .cb-at-handle {
        transition: none;
    }

    /* --- Help icons (.help-icon, InlineHelp's button, and .qb-help for a one-off "?"): up when the box
       wakes, full on their row or under the pointer --- */

    body.ui-quiet .content-box-v3 :is(.help-icon, .inline-help-btn, .qb-help) {
        opacity: 0;
        transition: opacity var(--qb-fade), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    body.ui-quiet .content-box-v3:is(:hover, :focus-within) :is(.help-icon, .inline-help-btn, .qb-help) {
        opacity: 0.55;
    }

    body.ui-quiet .content-box-v3 :is(.slider-tap, .cb-bd-quiet, .cb-loc-row, .cb-detail-row, .cb-at-group, .content-section-header, .content-box-header, .ei-switch-row, .ei-until-head, .ei-roth-head):is(:hover, :focus-within) :is(.help-icon, .inline-help-btn, .qb-help),
    body.ui-quiet .content-box-v3 :hover > :is(.help-icon, .inline-help-btn, .qb-help),
    body.ui-quiet .content-box-v3 :is(.help-icon, .inline-help-btn, .qb-help):is(:hover, :focus-visible) {
        opacity: 1;
    }

    /* --- Every other value field in a box: dropdowns, typed fields, selects.
       Same three steps; the "row" is the field's own parent. Many of these
       fields set their border inline (the Deferred Comp selects, the name
       fields, 72(t)), hence !important on the colour only. A field that
       still needs a choice (Employment Income's pending Roth catch-up) or is
       marked invalid keeps its own border. --- */

    /* The field list and its exceptions sit in :where() (no specificity), so
       the three steps rank by their own selectors: rest < box < row. */
    body.ui-quiet .content-box-v3 .content-box-body :where(.icon-dropdown-selected, .cb-select-trigger, .hc-money, input[type="text"], input[type="number"], input[type="date"], select):where(:not(.slider-tap *, .cb-profile-top *, .is-pending *, .is-invalid, [aria-invalid="true"], :focus, .open, .cb-select-open)) {
        border-color: transparent !important;
        transition: border-color var(--qb-fade), box-shadow 0.15s ease;
    }

    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .content-box-body :where(.icon-dropdown-selected, .cb-select-trigger, .hc-money, input[type="text"], input[type="number"], input[type="date"], select):where(:not(.slider-tap *, .cb-profile-top *, .is-pending *, .is-invalid, [aria-invalid="true"], :disabled, :focus, .open, .cb-select-open)) {
        border-color: var(--ui-borders-borderLight) !important;
    }

    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .content-box-body :is(:hover, :focus-within) > :where(.hc-money, input[type="text"], input[type="number"], input[type="date"], select):where(:not(.slider-tap *, .cb-profile-top *, .is-pending *, .is-invalid, [aria-invalid="true"], :disabled, :focus)),
    body.ui-quiet .content-box-v3:is(:hover, :focus-within) .content-box-body :is(:hover, :focus-within) > :where(.icon-dropdown-wrapper, .cb-select) > :where(.icon-dropdown-selected, .cb-select-trigger):where(:not(.slider-tap *, .cb-profile-top *, .open, .cb-select-open)) {
        border-color: var(--ui-borders-borderDefault) !important;
    }

    /* Dropdown carets and Works until's chevron: on their row only. */
    body.ui-quiet .content-box-v3 .content-box-body .icon-dropdown-selected:not(.open) .icon-dropdown-arrow,
    body.ui-quiet .content-box-v3 .content-box-body .cb-select-trigger:not(.cb-select-open) .cb-select-chevron,
    body.ui-quiet .ei-box .ei-until:not(.is-open) .ei-chev {
        opacity: 0;
        transition: opacity var(--qb-fade), transform 0.2s ease, margin 0.2s ease;
    }

    body.ui-quiet .content-box-v3 .content-box-body :is(:hover, :focus-within) > .icon-dropdown-wrapper .icon-dropdown-arrow,
    body.ui-quiet .content-box-v3 .content-box-body :is(:hover, :focus-within) > .cb-select .cb-select-chevron,
    body.ui-quiet .content-box-v3 .cb-profile-top :is(.cb-bd-quiet, .cb-loc-row, .cb-detail-row, .retirement-month-control):is(:hover, :focus-within) :is(.icon-dropdown-arrow, .cb-select-chevron),
    body.ui-quiet .ei-box .ei-until-head:is(:hover, :focus-visible) .ei-chev {
        opacity: 1;
    }

    /* --- The header's rename pencil and an open section's collapse arrow --- */

    body.ui-quiet .content-box-v3 .content-box-header [id$="edit-name-btn"] {
        opacity: 0;
        transition: opacity var(--qb-fade);
    }

    body.ui-quiet .content-box-v3 .content-box-header:is(:hover, :focus-within) [id$="edit-name-btn"] {
        opacity: 1;
    }

    body.ui-quiet .content-box-v3 .content-section:not(.collapsed) > .content-section-header .section-collapse-icon {
        opacity: 0;
    }

    body.ui-quiet .content-box-v3 .content-section:not(.collapsed) > .content-section-header:is(:hover, :focus-within) .section-collapse-icon {
        opacity: 1;
    }

    /* --- The account links: grey until the box wakes --- */

    body.ui-quiet :is(#primary-account-actions, #spouse-account-actions) button {
        color: var(--ui-text-secondaryText) !important;
        transition: color var(--qb-fade) !important;
    }

    body.ui-quiet .content-box-v3:is(:hover, :focus-within) :is(#primary-account-actions, #spouse-account-actions) button {
        color: var(--ui-text-linkText) !important;
    }
}
