/* ============================================================================
   Contribution Planner, compact redesign (layout 2a).
   .automation/planning/contributionplannerredesign/ (PRD sections 4 and 8).

   This project's OWN stylesheet (PRD D15): css/styles2.css belongs to another
   lane, so every new component here uses the `cpx-` prefix and loads after it
   (views/layout.ejs). The behaviour-bearing `cp-*` classes (cp-row, cp-row-grip,
   cp-simple-locked, cp-two-col, ...) keep their styles2.css rules.

   Colours are tokens only (CLAUDE.md colour rule), so the dark theme follows
   from master-colors.css. Widths: the page toggles `.cpx-stack` on
   `.cp-page` below 1,000px of CONTENT width (a ResizeObserver in
   contributionPlannerPage.js). Not a container query: `container-type` would
   make the page a containing block for every fixed-position popup inside it.
   ============================================================================ */

/* ---- shared bits --------------------------------------------------------- */

.cpx-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* P6 (2026-09-25), contrast in BOTH themes. The dark theme's --color-brand-dark
   is a background shade (#1E3A5C), so brand-dark TEXT vanished there: the
   yearly total read at 1.04:1. Text that wants the brand navy mixes it with
   the theme's primary text instead: navy in the light theme, a readable steel
   blue in the dark one (4.5:1 or better on cards and step badges). */
.cpx-page { --cpx-brand-text: color-mix(in srgb, var(--color-brand-dark) 50%, var(--ui-text-primaryText)); }

.cpx-step {
    flex: none;
    width: 22px; height: 22px;
    border-radius: 6px;
    background: var(--color-brand-light);
    color: var(--cpx-brand-text);
    font-size: 12px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
}

.cpx-card {
    background: var(--ui-backgrounds-cardBg);
    border: 1px solid var(--ui-borders-borderLight);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(var(--color-gray-900-rgb), 0.05),
        0 4px 14px rgba(var(--color-gray-900-rgb), 0.04);
}

/* ---- header (PRD 8.1, D12) ---------------------------------------------- */

.cpx-head { display: flex; flex-direction: column; gap: 6px; }
.cpx-eyebrow {
    font-size: var(--text-2xs, 11px); font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--ui-text-linkText);
}
.cpx-title-row {
    display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap;
}
.cpx-title {
    margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -0.6px;
    color: var(--ui-text-primaryText); line-height: 1.2;
}
.cpx-subtitle { font-size: 14px; color: var(--ui-text-secondaryText); }
.cpx-head-hint {
    margin-left: auto;
    font-size: var(--text-xs, 12px); font-style: normal;
    color: var(--ui-text-secondaryText);
}

/* Notices stack: Simple banner, Planner+ note, promotion, cleanup (8.1). */
#cp-head .cp-simplebanner { margin: 14px 0 0; }
#cp-gate:not(:empty) { margin-top: 12px; }
#cpx-notices:empty { display: none; }

/* ---- the control card (PRD 8.2) ----------------------------------------- */

#cp-summary.cpx-control { margin-top: 16px; overflow: hidden; }

.cpx-control-main,
.cpx-control-foot {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}
.cpx-control-inputs { border-right: 1px solid var(--ui-borders-borderLight); min-width: 0; }
.cpx-control-results { min-width: 0; }

.cpx-control-head {
    min-height: 58px;
    display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap;
    padding: 10px 22px;
    border-bottom: 1px solid var(--ui-borders-borderLight);
    box-sizing: border-box;
}
.cpx-control-title {
    font-size: 15.5px; font-weight: 800; letter-spacing: -0.2px;
    color: var(--ui-text-primaryText);
}
.cpx-head-meta { font-size: var(--text-xs, 12px); color: var(--ui-text-secondaryText); font-variant-numeric: tabular-nums; }
.cpx-control-head .cpx-cal { color: var(--ui-text-secondaryText); font-size: 14px; }

/* "One row grid" (the mockup's rule): every label on one line, every control
   and value in one 40px band, every note on the line below, across ALL the
   cells of a half. Each cell is a `display: contents` wrapper (so a test can
   still read `[data-cp-stat]` as one element) whose three children flow down
   the grid's columns; a long label wraps and the whole label row grows with
   it, so the values never drift out of line. */
.cpx-cells {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: auto auto auto;
    grid-auto-columns: minmax(0, 1fr);
    padding: 16px 22px;
}
.cpx-cells--inputs { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 1.1fr); }
/* The salary-driven modes: the total and the mode's own control (one
   percentage per earner, D-4.3, or the ledger link). No increase and no
   timing there: the engine ignores both in those modes (D8 as amended). */
.cpx-cells--inputs.cpx-cells--two { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.cpx-cell { display: contents; }
.cpx-cell-label {
    font-size: var(--text-2xs, 11px); font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: var(--ui-text-secondaryText);
    line-height: 1.35; padding-bottom: 6px;
    align-self: end;
}
.cpx-cell-value {
    min-height: 40px;
    display: flex; align-items: center; gap: 7px;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}
/* A note wraps to a second line rather than losing its end: at a 1512 window
   the cells are 140 to 200px wide, and "+ $3,600/yr employer match" cut to
   "+ $3,600/yr employ..." says less than two lines do. Two at most. */
.cpx-cell-sub {
    padding-top: 4px;
    font-size: var(--text-small, 14px); line-height: 1.35; color: var(--ui-text-secondaryText);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden;
    font-variant-numeric: tabular-nums;
    min-width: 0;
}
.cpx-cell-sub.is-warn { color: var(--color-semantic-warning-deep); }
.cpx-cell:not(:first-child) > * {
    border-left: 1px solid var(--ui-borders-borderLight);
    padding-left: 18px;
}
.cpx-cell:not(:last-child) > * { padding-right: 14px; }

.cpx-big {
    font-size: 26px; font-weight: 800; letter-spacing: -0.7px;
    color: var(--cpx-brand-text); white-space: nowrap;
}
.cpx-stat-value {
    font-size: 24px; font-weight: 800; letter-spacing: -0.6px;
    color: var(--ui-text-primaryText); white-space: nowrap;
}
.cpx-stat-value.is-muted { color: var(--ui-text-secondaryText); }
.cpx-stat-value.is-success { color: var(--color-semantic-success); }
.cpx-unit {
    font-size: 13px; font-weight: 600; letter-spacing: 0;
    color: var(--ui-text-secondaryText); margin-left: 3px;
}

/* Number fields, one shape (38px, the mockup's control height). */
.cpx-num {
    width: 70px; height: 38px; box-sizing: border-box;
    padding: 0 10px;
    font-family: inherit; font-size: 16px; font-weight: 700;
    text-align: right; font-variant-numeric: tabular-nums;
    border: 1px solid var(--ui-borders-borderDefault);
    border-radius: 8px; outline: none;
    background: var(--ui-backgrounds-cardBg); color: var(--ui-text-primaryText);
}
.cpx-num:focus { border-color: var(--color-blue-6); box-shadow: 0 0 0 3px rgba(var(--color-blue-6-rgb), 0.18); }
.cpx-num--sm { width: 58px; }
.cpx-affix { font-size: 14px; font-weight: 700; color: var(--ui-text-secondaryText); }
.cpx-pct-pair { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; min-width: 0; }
.cpx-pct-one { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.cpx-pct-name { font-size: 12.5px; font-weight: 700; color: var(--ui-text-secondaryText); max-width: 90px; overflow: hidden; text-overflow: ellipsis; }

/* Segmented pills: the funding mode (a radio group) and the deposit timing. */
.cpx-seg-group {
    display: inline-flex; gap: 3px; padding: 3px;
    border-radius: 999px;
    background: var(--ui-backgrounds-pageBg);
    border: 1px solid var(--ui-borders-borderLight);
    max-width: 100%;
}
.cpx-seg-group--fill { display: flex; width: 100%; box-sizing: border-box; }
.cpx-seg {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 30px; padding: 0 13px; margin: 0;
    border: none; border-radius: 999px;
    background: transparent; color: var(--ui-text-secondaryText);
    font-family: inherit; font-size: 13px; font-weight: 700;
    white-space: nowrap; cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.cpx-seg-group--fill .cpx-seg { flex: 1 1 0; min-width: 0; padding: 0 8px; height: 32px; }
.cpx-seg:hover:not(.is-on):not(.is-disabled) { background: rgba(var(--color-blue-6-rgb), 0.08); color: var(--ui-text-primaryText); }
/* P7 (2026-09-25, Stephen: "proceed using your best recommendations"): a selected
   pill or badge is the theme's LINK blue with the CARD colour as its text, so its
   contrast is a link's on a card in every theme (5.9:1 light; dark on light blue in
   the dark theme). White on --color-blue-6 read 3.85:1 light and 2.09:1 dark, under
   AA's 4.5:1 at 13px bold. The app's house pill (styles2.css) is lane U's to follow. */
.cpx-seg.is-on { background: var(--ui-text-linkText); color: var(--ui-backgrounds-cardBg); }
.cpx-seg.is-disabled { opacity: 0.5; cursor: not-allowed; }
.cpx-seg:focus-within { outline: 2px solid var(--color-blue-6); outline-offset: 1px; }
button.cpx-seg:focus { outline: none; }
button.cpx-seg:focus-visible { outline: 2px solid var(--color-blue-6); outline-offset: 1px; }
/* The stored mode is inert (its prerequisite is gone): the pill still shows
   what is stored, with a dot, and the amount cell says why (F-E2). */
.cpx-seg-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--color-semantic-warning);
    box-shadow: 0 0 0 2px var(--ui-backgrounds-cardBg);
}
.cpx-mode-reason {
    font-size: 12.5px; color: var(--color-semantic-warning-deep);
    min-width: 0;
}
.cpx-mode-reason:empty { display: none; }

.cpx-link-btn {
    border: none; background: none; padding: 0; cursor: pointer;
    font-family: inherit; font-size: 13.5px; font-weight: 700;
    color: var(--ui-text-linkText); text-align: left;
}
.cpx-link-btn:hover { text-decoration: underline; }

/* ---- the status footer --------------------------------------------------- */

.cpx-control-foot { border-top: 1px solid var(--ui-borders-borderLight); }
.cpx-control-foot.is-single #cp-solve { grid-column: 1 / -1; }
/* `hidden` must win over the cell's own `display: flex` (author CSS beats the
   browser's [hidden] rule), or an empty budget cell keeps its 48px row. */
.cpx-foot-cell[hidden], #cpx-budget-line[hidden] { display: none; }
.cpx-foot-cell {
    min-height: 48px; box-sizing: border-box;
    display: flex; align-items: center; gap: 8px 10px;
    padding: 8px 22px;
    min-width: 0;
}
#cpx-budget-line { border-right: 1px solid var(--ui-borders-borderLight); }
#cp-solve { min-width: 0; }
#cp-solve > .cpx-foot-cell { height: 100%; }
.cpx-foot--ok { background: rgba(var(--color-semantic-success-rgb), 0.07); }
.cpx-foot--warn, .cpx-foot--need, .cpx-foot--stop { background: rgba(var(--color-semantic-warning-rgb), 0.08); }
.cpx-foot-icon { flex: none; font-size: 15px; line-height: 1; color: var(--ui-text-secondaryText); }
.cpx-foot--ok .cpx-foot-icon { color: var(--color-semantic-success); }
.cpx-foot--warn .cpx-foot-icon, .cpx-foot--need .cpx-foot-icon, .cpx-foot--stop .cpx-foot-icon { color: var(--color-semantic-warning); }
.cpx-foot-icon--orange { color: var(--color-orange-3) !important; }
.cpx-foot-text { display: flex; align-items: baseline; gap: 4px 9px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.cpx-foot-head {
    font-size: 13.5px; font-weight: 700; white-space: nowrap;
    color: var(--ui-text-primaryText); font-variant-numeric: tabular-nums;
}
.cpx-foot--ok .cpx-foot-head { color: var(--color-semantic-success-deep); }
.cpx-foot--warn .cpx-foot-head, .cpx-foot--need .cpx-foot-head, .cpx-foot--stop .cpx-foot-head { color: var(--color-semantic-warning-deep); }
.cpx-foot-fact {
    font-size: 12.5px; color: var(--ui-text-secondaryText);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
    font-variant-numeric: tabular-nums;
}
.cpx-foot-link {
    margin-left: auto; flex: none;
    font-size: 13px; font-weight: 700; white-space: nowrap;
    color: var(--ui-text-linkText); text-decoration: none;
    background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
}
.cpx-foot-link:hover { text-decoration: underline; }
.cpx-foot-cell .help-icon { flex: none; }
.cpx-foot-cell .rs-pill-muted { flex: none; }

/* ---- under the card: the over-limit alert and the leftover ledger -------- */

#cpx-cap-alert:not(:empty) { margin-top: 12px; }

#cp-leftover-band:not(:empty) { margin-top: 12px; }
.cpx-disclosure { overflow: hidden; }
.cpx-disclosure-toggle {
    width: 100%; box-sizing: border-box;
    display: flex; align-items: center; gap: 10px;
    padding: 13px 22px;
    border: none; background: none; cursor: pointer; text-align: left;
    font-family: inherit; font-size: 14.5px; font-weight: 800; letter-spacing: -0.2px;
    color: var(--ui-text-primaryText);
}
.cpx-disclosure-toggle:hover { background: rgba(var(--color-blue-6-rgb), 0.04); }
.cpx-disclosure-toggle:focus-visible { outline: 2px solid var(--color-blue-6); outline-offset: -2px; }
.cpx-disclosure-chev { color: var(--ui-text-secondaryText); font-size: 12px; transition: transform 0.15s ease; }
.cpx-disclosure.is-open .cpx-disclosure-chev { transform: rotate(90deg); }
.cpx-disclosure-flag {
    font-size: 12px; font-weight: 700;
    color: var(--color-semantic-warning-deep);
    background: rgba(var(--color-semantic-warning-rgb), 0.12);
    padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.cpx-disclosure-body { padding: 0 22px 18px; border-top: 1px solid var(--ui-borders-borderLight); }
.cpx-disclosure-body[hidden] { display: none; }

/* ---- Steps 2 and 3 side by side (PRD 4.1, 8.4, 8.8; D1, D13, D20) ------- */

.cpx-page #cp-steps { margin-top: 16px; }
.cpx-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
/* Equal halves: at a 1512 window (1,051px of content) the list needs every
   pixel it can get for account names beside two chips and the amount. */
.cpx-steps.cpx-steps--two { grid-template-columns: minmax(420px, 1fr) minmax(460px, 1fr); }
.cpx-steps > div { min-width: 0; }
#cp-step-overtime:empty { display: none; }

/* D20: the open row points into the editor beside it. */
.cpx-page:not(.cpx-stack) .cpx-steps--two #cp-step-where .cpx-row.is-selected { position: relative; }
.cpx-page:not(.cpx-stack) .cpx-steps--two #cp-step-where .cpx-row.is-selected::after {
    content: '';
    position: absolute; top: 50%; right: -8px;
    width: 12px; height: 12px; margin-top: -6px;
    background: var(--ui-backgrounds-cardBg);
    box-shadow: inset 0 0 0 20px rgba(var(--color-blue-6-rgb), 0.07);
    border-top: 1.5px solid var(--color-blue-6);
    border-right: 1.5px solid var(--color-blue-6);
    transform: rotate(45deg);
    pointer-events: none;
}

/* ---- Step 3, the editor (PRD 8.4) --------------------------------------- */

.cpx-editor { overflow: hidden; border-color: var(--color-blue-6); }
.cpx-editor.cpx-editor--empty { border-color: var(--ui-borders-borderLight); }
.cpx-editor--empty .cpx-editor-body { padding: 16px 18px; }
.cpx-editor-head {
    display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
    padding: 13px 18px 12px;
    border-bottom: 1px solid var(--ui-borders-borderLight);
}
.cpx-step.is-active { background: var(--ui-text-linkText); color: var(--ui-backgrounds-cardBg); }
/* The title keeps room for the account's name: when the picker (stacked
   layout) and the shortcuts cannot fit beside it, they wrap under it rather
   than squeezing the name to a letter or two. */
.cpx-editor-title { flex: 1 1 340px; min-width: min(340px, 100%); display: flex; flex-direction: column; gap: 3px; }
.cpx-editor-title .cpx-eyebrow { font-size: var(--text-2xs, 11px); letter-spacing: 1.2px; }
/* P6: whose ages the axis runs in shares the eyebrow's line, so the name has
   the title's full width; a long name takes a second line, not an ellipsis. */
.cpx-editor-eyebrow-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
.cpx-editor-name-row { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.cpx-editor-name-row .cpx-dot { margin-top: 6px; }
.cpx-editor-name {
    min-width: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.2px; line-height: 20px;
    color: var(--ui-text-primaryText);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden; overflow-wrap: anywhere;
}
.cpx-editor-whose { font-size: 12px; color: var(--ui-text-secondaryText); white-space: nowrap; }
.cpx-editor-name-row .help-icon { flex: none; cursor: pointer; margin-top: 1px; }
.cpx-editor-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
/* D13: beside the list the rows ARE the selector; under it, the picker returns. */
.cpx-editor-select { display: none; }
.cpx-stack .cpx-editor-select { display: inline-flex; }
.cpx-editor-select select {
    font: inherit; font-size: 13px; font-weight: 700; color: var(--cpx-brand-text);
    background: var(--ui-backgrounds-cardBg);
    border: 1.5px solid var(--ui-borders-borderDefault); border-radius: 9px;
    padding: 6px 10px; cursor: pointer;
}
/* D6: the shortcuts, outlined pills. */
.cpx-sc {
    height: 30px; padding: 0 12px;
    border-radius: 999px; border: 1px solid var(--ui-borders-borderDefault);
    background: var(--ui-backgrounds-cardBg); color: var(--ui-text-primaryText);
    font: inherit; font-size: 12.5px; font-weight: 700; line-height: 1;
    white-space: nowrap; cursor: pointer;
}
.cpx-sc:hover:not(:disabled) { border-color: var(--color-blue-6); color: var(--color-blue-6); }
.cpx-sc:focus-visible { outline: 2px solid var(--color-blue-6); outline-offset: 2px; }
.cpx-sc:disabled { opacity: 0.5; cursor: not-allowed; }

.cpx-editor-body { padding: 10px 18px 4px; }
.cpx-editor-line { margin: 2px 0 8px; font-size: 13px; color: var(--ui-text-secondaryText); }
.cpx-editor-line.is-warn { color: var(--color-semantic-warning-deep); }
.cpx-graph { position: relative; }

/* D19: how to edit, and what the graph adds up to. */
.cpx-editor-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap;
    padding: 10px 18px; border-top: 1px solid var(--ui-borders-borderLight);
}
.cpx-editor-hint {
    flex: 1 1 260px; min-width: 0;
    display: inline-flex; align-items: flex-start; gap: 8px;
    font-size: var(--text-small, 14px); line-height: 1.45; color: var(--ui-text-secondaryText);
}
.cpx-editor-hint-icon { flex: none; margin-top: 2px; color: var(--color-blue-6); }
.cpx-editor-total { font-size: 12.5px; color: var(--ui-text-secondaryText); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cpx-editor-total strong { color: var(--ui-text-primaryText); font-weight: 800; }

/* The rows that have them: an age range, the mega backdoor graph and card. */
.cpx-editor-extras {
    display: flex; flex-direction: column; gap: 12px;
    padding: 12px 18px 16px; border-top: 1px solid var(--ui-borders-borderLight);
}
.cpx-editor-extras > .cpx-editor-line { margin: 0; }
.cpx-editor-window { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.cpx-editor-window label { display: block; margin-bottom: 4px; color: var(--ui-text-secondaryText); }
.cpx-editor-window-note { flex: 1; min-width: 180px; color: var(--ui-text-secondaryText); }
.cpx-editor-leg-title { margin-bottom: 2px; font-weight: 700; color: var(--ui-text-primaryText); }
.cpx-editor-leg-note { margin-bottom: 6px; color: var(--ui-text-secondaryText); }

/* D7: the pot editor. */
.cpx-editor-para { margin: 8px 0 0; font-style: normal; }
.cpx-editor--pot .cpx-editor-body { padding-bottom: 14px; }
.cpx-pot-share { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; margin: 4px 0 6px; }
.cpx-pot-share-pct { font-size: 13px; font-weight: 700; color: var(--ui-text-secondaryText); }

/* ---- Step 4, the outcome card (PRD 8.5; D19) ----------------------------- */

.cpx-outcome-head {
    display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
    padding: 14px 20px 12px;
    border-bottom: 1px solid var(--ui-borders-borderLight);
}
.cpx-outcome-title { font-size: 16px; font-weight: 800; letter-spacing: -0.2px; color: var(--ui-text-primaryText); white-space: nowrap; }
.cpx-outcome-controls { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.cpx-outcome-body { padding: 12px 20px 16px; }
/* The legend of the chart on screen: the chart's own labels, wrapping, on a
   row of its own under the title and the controls (P6: squeezed between them
   it became a column of long account names). */
.cpx-legend { flex: 1 1 100%; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; margin-left: -7px; }
.cpx-legend:empty { display: none; }
/* P7: a short legend shares the header row (placeOutcomeLegend moves it there). */
.cpx-outcome-head.is-inline .cpx-legend { flex: 0 1 auto; margin-left: 2px; }
.cpx-legend-item {
    display: inline-flex; align-items: center; gap: 6px; max-width: min(100%, 380px);
    padding: 3px 7px; border: none; border-radius: 6px; background: transparent;
    font: inherit; font-size: 12.5px; color: var(--ui-text-secondaryText); cursor: pointer;
}
.cpx-legend-item:hover { background: var(--ui-backgrounds-pageBg); color: var(--ui-text-primaryText); }
.cpx-legend-item:focus-visible { outline: 2px solid var(--color-blue-6); outline-offset: 1px; }
.cpx-legend-swatch { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.cpx-legend-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpx-legend-item.is-hidden { opacity: 0.5; }
.cpx-legend-item.is-hidden .cpx-legend-label { text-decoration: line-through; }

/* D18: no per-year editor in this country, one line under the list. */
.cpx-editor-note { padding: 2px 4px 0; font-size: 13px; color: var(--ui-text-secondaryText); }

/* ---- Step 2, the list (PRD 8.3) ---------------------------------------- */

.cpx-list-hint { font-size: var(--text-xs, 12px); font-weight: 600; color: var(--ui-text-secondaryText); cursor: help; }
.cpx-pot-total { font-size: 13px; color: var(--ui-text-secondaryText); white-space: nowrap; }
.cpx-pot-total strong { font-size: 15px; font-weight: 800; color: var(--cpx-brand-text); margin-left: 4px; font-variant-numeric: tabular-nums; }

.cpx-rows { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; }
/* Two lines, about 60px: the grip and rank, the account (name, whose, what
   kind; the fill bar and the caption under it), and this year's amount. */
.cpx-row {
    display: flex; align-items: center; gap: 10px;
    /* P7 (2026-09-25): 73px to about 61px. The amount column set the height
       (a 36px field and its label under it); the field is 32px now and the
       label sits snug under it, so nothing on the row went. */
    min-height: 56px; box-sizing: border-box;
    padding: 6px 12px 6px 6px;
    border: 1.5px solid var(--ui-borders-borderLight);
    border-radius: 11px;
    background: var(--ui-backgrounds-cardBg);
    cursor: pointer;
}
.cpx-row:hover { border-color: rgba(var(--color-blue-6-rgb), 0.4); }
.cpx-row.is-selected { border-color: var(--color-blue-6); background: rgba(var(--color-blue-6-rgb), 0.07); }
.cpx-row:focus { outline: none; }
.cpx-row:focus-visible { outline: 2px solid var(--color-blue-6); outline-offset: 2px; }
.cpx-rank {
    flex: none; width: 20px; height: 20px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums;
    background: var(--ui-backgrounds-pageBg); color: var(--ui-text-secondaryText);
}
.cpx-row.is-selected .cpx-rank { background: var(--ui-text-linkText); color: var(--ui-backgrounds-cardBg); }
.cpx-row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.cpx-row-line1, .cpx-row-line2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cpx-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.cpx-row-name {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 14.5px; font-weight: 700; color: var(--ui-text-primaryText);
}
.cpx-row.is-unfunded .cpx-row-name { color: var(--ui-text-secondaryText); }
.cpx-owner {
    flex: none; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 11.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px;
    background: var(--ui-backgrounds-pageBg); color: var(--ui-text-primaryText);
}
/* R3-CON-14 / R3-CON-02: an IRA row above an income limit; a button that
   opens the full sentence (so a click on it never selects the row). */
.cpx-chip-warn {
    flex: none; display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 7px; border-radius: 6px;
    border: 1px solid rgba(var(--color-semantic-warning-rgb), 0.45);
    background: rgba(var(--color-semantic-warning-rgb), 0.10);
    color: var(--color-semantic-warning-deep);
    font: inherit; font-size: 11px; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.cpx-chip-warn i { font-size: 10px; color: var(--color-semantic-warning); }
.cpx-chip-warn:hover { background: rgba(var(--color-semantic-warning-rgb), 0.18); }
.cpx-chip-warn:focus-visible { outline: 2px solid var(--color-blue-6); outline-offset: 1px; }

/* D4: only a row with a statutory limit has a bar, against that limit. */
.cpx-fill {
    flex: none; width: 72px; height: 5px; border-radius: 999px; overflow: hidden;
    background: var(--ui-borders-borderLight);
}
.cpx-fill-bar { display: block; height: 100%; border-radius: 999px; }
.cpx-row-caption {
    min-width: 0; overflow: hidden;
    /* Two lines at most: a capped row names where the rest went, and that half
       is the point of the caption (R3-CON-07). Most captions stay on one. */
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    line-height: 1.35;
    font-size: var(--text-small, 14px); color: var(--ui-text-secondaryText); font-variant-numeric: tabular-nums;
}
.cpx-row-caption.is-warn { color: var(--color-semantic-warning-deep); }
.cpx-row-warn { font-size: 12px; color: var(--color-semantic-warning-deep); font-variant-numeric: tabular-nums; }
.cpx-row-warn i { color: var(--color-semantic-warning); margin-right: 3px; }

/* D2: this year's amount, typed on the row. */
.cpx-row-amount { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; cursor: default; }
.cpx-amt-wrap {
    display: inline-flex; align-items: center; gap: 2px;
    height: 32px; box-sizing: border-box; padding: 0 8px 0 10px;
    border: 1px solid var(--ui-borders-borderDefault); border-radius: 8px;
    background: var(--ui-backgrounds-cardBg);
}
.cpx-amt-wrap:focus-within { border-color: var(--color-blue-6); box-shadow: 0 0 0 3px rgba(var(--color-blue-6-rgb), 0.18); }
.cpx-amt-cur { font-size: 13px; font-weight: 700; color: var(--ui-text-secondaryText); }
.cpx-amt {
    width: 68px; padding: 0; border: none; outline: none; background: transparent;
    font-family: inherit; font-size: 15px; font-weight: 800; text-align: right;
    color: var(--ui-text-primaryText); font-variant-numeric: tabular-nums;
}
.cpx-row.is-unfunded .cpx-amt { color: var(--ui-text-secondaryText); }
.cpx-amt-wrap.is-readonly { background: var(--ui-backgrounds-pageBg); border-color: transparent; cursor: default; }
.cpx-amt-wrap.is-readonly .cpx-amt { color: var(--ui-text-secondaryText); cursor: default; }
.cpx-amt-note { font-size: var(--text-xs, 12px); line-height: 1.1; color: var(--ui-text-secondaryText); }

.cpx-list-note { margin: 6px 20px 0; }
.cpx-list-note.is-warn { color: var(--color-semantic-warning-deep); }

/* ---- narrow content: stack (PRD 8.8) ------------------------------------ */

/* Below 1,300px of content the footer's two one-line answers cannot both fit
   beside each other without cutting their numbers (a 1512 window gives the
   page 1,051px), so each takes the card's full width. */
.cpx-foot-stack .cpx-control-foot { grid-template-columns: minmax(0, 1fr); }
.cpx-foot-stack #cpx-budget-line { border-right: none; border-bottom: 1px solid var(--ui-borders-borderLight); }

/* Below 1,000px the card's two halves stack too, and so do the list and the
   editor (the editor under the list, full width, its picker shown: D13). */
.cpx-stack .cpx-control-main { grid-template-columns: minmax(0, 1fr); }
.cpx-stack .cpx-steps.cpx-steps--two { grid-template-columns: minmax(0, 1fr); }
.cpx-stack .cpx-control-inputs { border-right: none; border-bottom: 1px solid var(--ui-borders-borderLight); }
.cpx-stack .cpx-head-hint { margin-left: 0; flex-basis: 100%; }
