/* ============================================================
   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. The SAME type as the row labels under them, one step
   bolder (Steve 2026-11-22: they were 14px with no letter spacing under 15px
   rows spaced 0.6px, so a heading was smaller than its rows and read as another
   font): --text-medium, the box's own letter spacing (inherited), semibold. */
body.ui-quiet .content-box-v3 .content-section-title {
    font-size: var(--text-medium, 15px) !important;
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: inherit !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 .hsa-main-container .hsa-label,
body.ui-quiet .hsa-main-container .hsa-until-label,
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;
    }

    /* An open HEADING's arrow (a section that rests open); a fold's round arrow always shows (section 5). */
    body.ui-quiet .content-box-v3 .content-section:not(.collapsed):not(.cs-fold) > .content-section-header .section-collapse-icon {
        opacity: 0;
    }

    body.ui-quiet .content-box-v3 .content-section:not(.collapsed):not(.cs-fold) > .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;
    }
}

/* ------------------------------------------------------------
   4. Box headers (boxheaders option F; Stephen 2026-11-17: the dark
      headers "seem unnecessarily bulky", most of all collapsed; he
      picked F from .automation/planning/boxheaders/options.html).

   The dark bar is kept for the box that is OPEN, 18px slimmer. A
   collapsed box rests as a plain 44px row on the column: its icon, its
   title, the + at the right, a hairline under it. A run of collapsed
   boxes takes 45px each where it took 80px.

   Things that sit on a header (the Optimizer status, "Do not count",
   the rename pencil, the + itself) were drawn white for the dark bar;
   on a collapsed row they take the row's own text colour.
   ------------------------------------------------------------ */

/* No tray (Stephen 2026-11-17: "try removing the space between the boxes").
   Each box sat in a light grey rounded tray with its own shadow, and the
   trays stood 14px apart, so two open boxes were 56px from card to card.
   The tray is gone: a box is its bar and its card, 16px from the next.
   The box still clips (overflow: hidden), so the card's shadow is a small
   one that fits in the 8px below it. */
body.ui-quiet .content-box-v2.content-box-v3 {
    margin-bottom: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

body.ui-quiet .content-box-v2.content-box-v3 > .content-box-body:not(.collapsed) {
    margin-bottom: 8px;
    box-shadow: 0 1px 6px rgba(var(--color-ui-shadow-rgb), 0.1);
}

/* The open box: the same bar, slimmer, and 8px below whatever is above it
   (no tray, above). */
body.ui-quiet .content-box-v2.content-box-v3 > .content-box-header {
    min-height: 50px;
    margin: 8px 14px 0;
    box-shadow: none;
    padding: 0 16px;
    font-size: calc(var(--text-medium, 15px) + 1px);
    letter-spacing: 0.4px;
}

body.ui-quiet .content-box-v3 > .content-box-header .box-title {
    letter-spacing: inherit;
}

body.ui-quiet .content-box-v3 > .content-box-header .cb-header-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: var(--text-small, 14px);
}

body.ui-quiet .content-box-v3 > .content-box-header .cb-header-avatar svg {
    width: 17px;
    height: 17px;
}

/* The collapsed box: no tray, no bar. A row and a hairline. */
body.ui-quiet .content-box-v2.content-box-v3:has(> .content-box-body.collapsed) {
    margin-bottom: 0;
    border-color: transparent;
    border-radius: 0;
    box-shadow: none;
    background: linear-gradient(var(--ui-borders-borderDefault), var(--ui-borders-borderDefault)) no-repeat 14px 100% / calc(100% - 28px) 1px;
}

body.ui-quiet .content-box-v2.content-box-v3:has(> .content-box-body.collapsed) > .content-box-header {
    min-height: 44px;
    margin: 0 14px;
    padding: 0 10px;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    font-size: var(--text-medium, 15px);
    font-weight: 600;
    letter-spacing: 0;
    color: color-mix(in srgb, var(--ui-text-primaryText) 80%, var(--ui-text-secondaryText));
}

body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header .box-title {
    color: inherit;
}

body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header .cb-header-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-color: transparent;
    background: transparent;
    font-size: var(--text-2xs, 11px);
    color: var(--ui-text-secondaryText);
}

/* A name initial keeps its ring, so it still reads as a person. */
body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header .cb-header-avatar:not(:has(svg)) {
    border: 1.5px solid currentColor;
}

body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header .cb-header-avatar svg {
    width: 19px;
    height: 19px;
}

body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header :is(.toggle-button, .optbox-summary, [id$="edit-name-btn"], .roth-help-icon) {
    color: var(--ui-text-secondaryText);
}

/* The Roth Conversions "?" is styled inline for the dark bar (white on a
   white veil), hence !important. */
body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header .roth-help-icon {
    background: transparent !important;
    color: var(--ui-text-secondaryText) !important;
}

body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header .cb-scope-btn:not(.is-excluded) {
    border-color: var(--ui-borders-borderDefault);
    color: var(--ui-text-secondaryText);
}

body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header .cb-scope-btn:not(.is-excluded):hover {
    background: var(--color-gray-100);
}

/* The "Not counted" pill was yellow on white, made to be read on the dark
   bar's edge; on a light row it takes a darker shade of the same warning. */
body.ui-quiet .content-box-v3:has(> .content-box-body.collapsed) > .content-box-header .cb-scope-btn.is-excluded {
    border-color: var(--color-semantic-warning);
    color: color-mix(in srgb, var(--color-semantic-warning) 62%, var(--ui-text-primaryText));
}

/* Not counted, collapsed: the title steps back; the pill says why. */
body.ui-quiet .content-box-v2.content-box-v3.plan-scope-excluded:has(> .content-box-body.collapsed) > .content-box-header {
    background: transparent;
    color: var(--ui-text-secondaryText);
}

/* A finger needs 44px on the glass, and the column is drawn smaller than
   life (--left-column-zoom, 0.6 on a phone). */
@media (pointer: coarse) {
    body.ui-quiet .content-box-v2.content-box-v3:has(> .content-box-body.collapsed) > .content-box-header {
        min-height: calc(44px / var(--left-column-zoom, 1));
    }
}

@media (hover: hover) and (pointer: fine) {
    body.ui-quiet .content-box-v2.content-box-v3:has(> .content-box-body.collapsed) > .content-box-header:hover {
        background: var(--ui-backgrounds-cardBg);
        box-shadow: 0 1px 4px rgba(var(--color-ui-shadow-rgb), 0.1);
        color: var(--ui-text-primaryText);
    }
}

/* ------------------------------------------------------------
   5. Fold rows (spendingboxclean direction B; Stephen 2026-11-22:
      "Build B", from .automation/planning/spendingboxclean/mockups.html).

   A fold row did not look clickable: the same size and grey as the
   text around it, its small arrow hidden. Now every FOLD is a soft
   grey bar: its title at the left in the main text colour, its value
   at the right, the arrow in a small round white button that always
   shows. Opening it grows the same soft panel around what it holds,
   so an open fold (the Retirement Year Detail) is one piece and never
   runs into what is above or below it.

   The rule a member learns without reading: white is what you set,
   soft grey is what the plan shows you or opens in place, an outline
   opens a window. The grey is the Returns box's rate band.

   A fold is a section CollapsibleSections.make() marks .cs-fold (it
   rests folded, or the caller says fold: true). A section that rests
   OPEN (Profile, Tax Settings, Salary & Savings) stays a heading, and
   takes the bar only while a member has folded it (.collapsed), so a
   folded thing always looks like something to open. One rule for
   every box: no box draws its own.
   ------------------------------------------------------------ */

body.ui-quiet {
    --qb-soft: color-mix(in srgb, var(--color-gray-100) 75%, var(--color-white-1));
    --qb-soft-hover: color-mix(in srgb, var(--color-gray-200) 65%, var(--color-white-1));
}

body.ui-quiet .content-box-v3 .content-box-body .content-section:is(.cs-fold, .collapsed) {
    margin-top: 14px;
    padding: 0;
    border-radius: 12px;
    background: var(--qb-soft);
}

/* A run of folds stands 8px apart; a fold that opens the box sits at its top. */
body.ui-quiet .content-box-v3 .content-box-body .content-section:is(.cs-fold, .collapsed) + .content-section:is(.cs-fold, .collapsed) {
    margin-top: 8px;
}

body.ui-quiet .content-box-v3 .content-box-body > .content-section:is(.cs-fold, .collapsed):first-child {
    margin-top: 2px;
}

/* The bar. CollapsibleSections sets the header's flex, wrap and margin inline, hence !important on those. */
body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header {
    min-height: 50px;
    margin: 0 !important;
    padding: 0 9px 0 14px;
    gap: 10px;
    flex-wrap: nowrap !important;
    align-items: center !important;
    border-radius: 12px;
    transition: background-color 0.15s ease;
}

body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header:hover {
    background: var(--qb-soft-hover);
}

body.ui-quiet .content-box-v3 .content-section.cs-fold:not(.collapsed) > .content-section-header {
    border-radius: 12px 12px 0 0;
}

/* The title in the main text colour: it is the thing to press. */
body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header .content-section-title {
    color: var(--ui-text-primaryText);
    white-space: nowrap;
}

/* The value at the right of the bar (no separator dot there); hidden while the fold is open, its room kept, so a
   click anywhere on the line still lands on the header (fold-header-click). */
body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header .section-collapse-summary {
    flex: 1 1 auto;
    margin-left: 12px;
    text-align: right;
}

body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header .section-collapse-sep {
    display: none;
}

body.ui-quiet .content-box-v3 .content-section.cs-fold:not(.collapsed) > .content-section-header .section-collapse-summary {
    visibility: hidden;
}

/* The arrow: a chevron in a small round white button, always showing; down to open, up to close. */
body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header .section-collapse-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--ui-borders-borderDefault);
    border-radius: 50%;
    background: var(--color-white-1);
    color: var(--ui-text-primaryText);
    box-shadow: 0 1px 2px rgba(var(--color-ui-shadow-rgb), 0.08);
    opacity: 1;
    transform: none;
    transition: transform 0.25s ease, border-color 0.15s ease;
}

body.ui-quiet .content-box-v3 .content-section.cs-fold:not(.collapsed) > .content-section-header .section-collapse-icon {
    transform: rotate(180deg);
}

body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header:hover .section-collapse-icon {
    border-color: color-mix(in srgb, var(--ui-borders-borderDefault) 40%, var(--ui-text-secondaryText));
    background: var(--color-white-1);
}

body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header .section-collapse-icon .sci-tri {
    display: none;
}

body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header .section-collapse-icon .sci-chev {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* What an open fold holds sits inside the same panel. */
body.ui-quiet .content-box-v3 .content-section.cs-fold:not(.collapsed) > .content-section-body {
    padding: 4px 14px 14px;
}

/* A soft surface inside the panel would vanish into it: the Returns box's rate band turns white there, and a light
   choice (SegmentedControl) takes the darker track the band uses (returns-box.css section 5). */
body.ui-quiet .content-box-v3 .content-section.cs-fold .rtn-band {
    background: var(--color-white-1);
}

body.ui-quiet .content-box-v3 .content-section.cs-fold .seg-control {
    background: color-mix(in srgb, var(--color-gray-300) 40%, var(--color-gray-200));
}

/* A finger needs 44px on the glass (the column is drawn smaller than life, as in section 4). */
@media (pointer: coarse) {
    body.ui-quiet .content-box-v3 .content-section:is(.cs-fold, .collapsed) > .content-section-header {
        min-height: max(50px, calc(44px / var(--left-column-zoom, 1)));
    }
}

/* The two folds a box draws by hand take the same bar: Milestones' "Automatic milestones" (a <details>) and the
   What's Counted box's categories (buttons that open a list). Both inline-styled, hence !important on those. */
body.ui-quiet #milestones-auto-section {
    margin-top: 14px !important;
    padding: 0 !important;
    border-top: 0 !important;
    border-radius: 12px;
    background: var(--qb-soft);
}

body.ui-quiet #milestones-auto-section > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 9px 0 14px !important;
    border-radius: 12px;
    list-style: none;
    font-size: var(--text-medium, 15px) !important;
    color: var(--ui-text-primaryText) !important;
    transition: background-color 0.15s ease;
}

body.ui-quiet #milestones-auto-section > summary::-webkit-details-marker {
    display: none;
}

body.ui-quiet #milestones-auto-section > summary:hover {
    background: var(--qb-soft-hover);
}

body.ui-quiet #milestones-auto-section[open] > summary {
    border-radius: 12px 12px 0 0;
}

body.ui-quiet #milestones-auto-section > #milestones-auto-list {
    margin: 0 !important;
    padding: 4px 14px 14px;
}

body.ui-quiet .ms-auto-arrow,
body.ui-quiet .content-box-v3 .wc-cat-head i {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    margin-left: auto;
    border: 1px solid var(--ui-borders-borderDefault);
    border-radius: 50%;
    background: var(--color-white-1);
    color: var(--ui-text-primaryText);
    box-shadow: 0 1px 2px rgba(var(--color-ui-shadow-rgb), 0.08);
    transition: transform 0.25s ease, border-color 0.15s ease;
}

body.ui-quiet .ms-auto-arrow svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.ui-quiet #milestones-auto-section[open] > summary .ms-auto-arrow {
    transform: rotate(180deg);
}

/* A category is also a .content-section, so this outranks section 1's frameless section. */
body.ui-quiet .content-box-v3 .content-box-body .content-section.wc-cat {
    margin-top: 8px;
    padding: 0;
    border-radius: 12px;
    background: var(--qb-soft);
}

body.ui-quiet .content-box-v3 .wc-cat-head {
    min-height: 50px;
    padding: 0 9px 0 14px;
    gap: 10px;
    border-radius: 12px;
    font-size: var(--text-medium, 15px);
    transition: background-color 0.15s ease;
}

body.ui-quiet .content-box-v3 .wc-cat-head:hover {
    background: var(--qb-soft-hover);
}

body.ui-quiet .content-box-v3 .wc-cat-head[aria-expanded="true"] {
    border-radius: 12px 12px 0 0;
}

/* The category's arrow is its Font Awesome chevron (right when closed, down when open), moved to the end and turned
   so it reads like every other fold: down to open, up to close. */
body.ui-quiet .content-box-v3 .wc-cat-head i {
    order: 2;
    font-size: var(--text-2xs, 11px);
}

body.ui-quiet .content-box-v3 .wc-cat-head i.fa-chevron-right {
    transform: rotate(90deg);
}

body.ui-quiet .content-box-v3 .wc-cat-head i.fa-chevron-down {
    transform: rotate(180deg);
}

body.ui-quiet .content-box-v3 .wc-cat-body {
    padding: 2px 14px 12px;
}
