/* Colours, type and shapes come from the --rp-* tokens in instrument-theme.css
   (docs/design-reference/README.md). This file lays out the pages and styles the
   app's own components with those tokens; it adds no colours of its own. */
:root {
    --page-padding: 22px;
}

.font-mono {
    font-family: var(--rp-mono);
    font-variant-numeric: tabular-nums;
}

/* App bar (component rule 1): instrument-theme.css styles it. These are the parts
   it leaves to the app: the right-hand group, the sign-out form and phone widths. */
.rp-appbar {
    flex-wrap: nowrap;
    gap: 16px; /* keeps "Sign out" clear of the links when a phone squeezes them together */
    white-space: nowrap;
}

.rp-appbar-end {
    display: flex;
    align-items: center;
    gap: 16px;
}

.rp-appbar .rp-user {
    gap: 6px;
    margin: 0;
}

.rp-appbar .rp-user .app-link-button:hover {
    color: var(--rp-on-dark);
}

/* A form button that looks like plain text links */
.app-link-button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
}

.app-link-button:hover {
    color: var(--rp-ink);
}

.app-main {
    padding: var(--page-padding);
}

.rp-appbar .nav {
    flex-wrap: nowrap;
    min-width: 0;
}

.rp-appbar .nav-link,
.rp-appbar .rp-user {
    flex-shrink: 0;
}

/* The brand gives way first: on the narrowest phones its name ends in "…". */
.rp-appbar .navbar-brand {
    min-width: 0;
}

.rp-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The 10000 Futures lockup (design README rule 1): tile, name, divider, tagline.
   On the dark bar the tile is the accent blue with app-bar-dark lines. */
.rp-brand-tile {
    flex: none;
}

.rp-brand-tile rect {
    fill: var(--rp-appbar-accent);
}

.rp-brand-tile path {
    fill: none;
    stroke: var(--rp-appbar);
    stroke-width: 2.25;
    stroke-linecap: round;
}

.rp-brand-tagline {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 400;
    color: var(--rp-on-dark-muted);
}

.rp-brand-tagline::before {
    content: "";
    width: 1px;
    height: 14px;
    background: var(--rp-ink-2);
}

/* Phones: the email doesn't fit next to the nav; "Sign out" stays. */
@media (max-width: 767.98px) {
    .rp-appbar {
        gap: 12px;
        padding: 0 16px;
    }

    .rp-appbar .nav {
        gap: 12px;
    }

    .rp-user-email {
        display: none;
    }

    /* "10000 Futures" alone where space is tight (BUILD-SPEC header). */
    .rp-brand-tagline {
        display: none;
    }
}

/* Cards, buttons and form fields are styled by instrument-theme.css. */
.text-faint {
    color: var(--rp-faint);
}

/* Page header: title and subtitle on the left, primary action on the right */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 16px;
}

.page-subtitle {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--rp-muted);
}

.page-footnote {
    margin: 14px 2px 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--rp-muted);
}

/* Success-rate colours: README bands, see the success_band filter */
.rate-success { color: var(--rp-success); }
.rate-caution { color: var(--rp-caution); }
.rate-danger  { color: var(--rp-danger); }

/* Scenario list */
/* A one-line note after an action, above the list. */
.page-note {
    margin: 0 0 12px;
    padding: 9px 14px;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    background: var(--rp-surface);
    color: var(--rp-ink-2);
}

.scenario-row {
    display: grid;
    /* Fixed widths: each row is its own grid, so an auto column would size
       differently in the header row (empty) than in the data rows. */
    grid-template-columns: minmax(0, 1fr) 160px 300px 140px 230px;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-top: 1px solid var(--rp-rule);
}

.scenario-row--header {
    padding-top: 10px;
    padding-bottom: 10px;
    border-top: 0;
    border-bottom: 1px solid var(--rp-border);
    /* Rounded to match the card, rather than overflow: hidden on the card,
       which would also clip each row's "···" menu. */
    border-radius: var(--rp-radius-card) var(--rp-radius-card) 0 0;
    background: var(--rp-surface-2);
}

.scenario-row--header + .scenario-row {
    border-top: 0;
}

/* The baseline's chip is the theme's .badge.rp-baseline (2-scenario-list.png). */
.scenario-name .rp-baseline {
    margin-left: 6px;
    vertical-align: 2px;
}

/* The Compare tick sits before the name (2-scenario-list.png); the header keeps an
   empty one, so "Scenario" lines up with the names. */
.scenario-name-cell,
.scenario-name-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.scenario-name-cell > div {
    min-width: 0;
}

.scenario-tick {
    flex: none;
    display: flex;
    width: 16px;
}

.scenario-tick .form-check-input {
    margin: 0;
}

.scenario-name {
    font-size: 13.5px;
    font-weight: 500;
}

.scenario-summary {
    margin-top: 2px;
    font-size: 12px;
    color: var(--rp-muted);
}

.scenario-rate {
    font: 500 19px var(--rp-mono);
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.scenario-status,
.scenario-last-run {
    color: var(--rp-muted);
}

.scenario-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* A link and a <button> centre their text differently once they are taller
   than their content (the 44px phone minimum), e.g. Open/Edit next to Duplicate. */
.scenario-actions .btn,
.page-actions .btn {
    display: inline-flex;
    align-items: center;
}

/* The row's "···" menu: the theme styles it; this keeps it narrow and in body type. */
.scenario-actions .dropdown-menu {
    --bs-dropdown-font-size: 13px;
    --bs-dropdown-min-width: 8rem;
}

.dropdown-item-danger {
    color: var(--rp-danger);
}

/* Delete confirmation */
.confirm-card {
    max-width: 520px;
    padding: 16px 18px;
}

.confirm-card h1 {
    margin: 0 0 8px;
}

.confirm-card p {
    color: var(--rp-ink-2);
}

.confirm-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 767.98px) {
    .confirm-actions .btn {
        display: inline-flex;
        align-items: center;
        min-height: 44px; /* spec §7: hit targets never below 44px */
    }
}

/* Narrower than the five columns need (§4.3, chosen 2026-10-04): the sparkline moves to a
   row of its own under the others, and drops out of the header. */
@media (max-width: 1199.98px) {
    .scenario-row {
        grid-template-columns: minmax(0, 1fr) 160px 140px 230px;
    }

    .scenario-row--header > :nth-child(3) {
        display: none;
    }

    .scenario-name-cell { order: 1; }
    .scenario-rate-cell { order: 2; }
    .scenario-last-run { order: 3; }
    .scenario-actions { order: 4; }

    .scenario-spark-cell {
        order: 5;
        grid-column: 1 / -1;
    }

    .scenario-spark-cell.is-empty {
        display: none;
    }
}

/* Phones: name on its own line, rate and last run side by side, the sparkline, then actions */
@media (max-width: 767.98px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .scenario-row {
        grid-template-columns: auto 1fr;
        gap: 8px 16px;
    }

    .scenario-row--header {
        display: none;
    }

    .scenario-name-cell,
    .scenario-actions {
        grid-column: 1 / -1;
    }

    .scenario-actions {
        justify-content: flex-start;
        order: 6;
    }

    .scenario-actions .btn {
        min-height: 44px; /* spec §7: hit targets never below 44px */
    }

    /* A 44px target around the 16px box, without moving the name. */
    .scenario-tick {
        padding: 14px;
        margin: -14px;
    }
}

/* Empty state: first run, before any scenario (3-empty-state.png) */
.empty-state {
    max-width: 620px;
    margin: 40px auto 0;
    padding: 34px 32px 28px;
    text-align: center;
}

.empty-state-eyebrow {
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--rp-muted);
}

.empty-state h1 {
    margin-bottom: 10px;
}

.empty-state-lede {
    max-width: 340px;
    margin: 0 auto 22px;
    line-height: 1.5;
    color: var(--rp-muted);
}

.empty-state-form {
    display: flex;
    gap: 8px;
    width: 100%; /* .card is a flex column, where auto margins would shrink-wrap the form */
    max-width: 420px;
    margin: 0 auto;
}

.empty-state-form .form-control {
    flex: 1;
}

.empty-state-help {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--rp-muted);
}

.empty-state-tips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--rp-rule);
    text-align: left;
    font-size: 12px;
    line-height: 1.5;
    color: var(--rp-muted);
}

.empty-state-tips p {
    margin: 0;
}

@media (max-width: 767.98px) {
    .empty-state {
        margin-top: 0;
        padding: 24px 18px;
    }

    .empty-state-tips {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .empty-state-form .form-control,
    .empty-state-form .btn {
        min-height: 44px; /* spec §7: hit targets never below 44px */
    }
}

/* Sign in (not designed: spec §4, kept to the app's existing styles) */
.auth-card {
    max-width: 360px;
    margin: 40px auto 0;
    padding: 28px 28px 24px;
}

.auth-card h1 {
    margin-bottom: 16px;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form .form-label {
    margin-bottom: 6px;
    color: var(--rp-ink-2);
}

/* "No account yet? Create one" and back: the save dialog's switch line (.save-dialog-switch) */
.auth-switch {
    margin: 14px 0 0;
    text-align: center;
    font: 400 13px var(--rp-sans);
    color: var(--rp-ink-2);
}

.auth-switch a {
    font-weight: 500;
}

/* Scenario editor (4-editor.png, 7-new-scenario.png) */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 14px;
}

.editor-title {
    flex: 1;
    min-width: 0;
}

/* .rp-breadcrumb is styled by instrument-theme.css; its link reads as plain text. */
.rp-breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.rp-breadcrumb a:hover {
    color: var(--rp-ink);
}

/* The name reads as the page title; the border shows on hover and focus. */
.form-control.editor-name-input {
    max-width: 420px;
    margin-left: -11px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
    border-color: transparent;
    background: transparent;
}

.form-control.editor-name-input:hover {
    border-color: var(--rp-control);
}

.form-control.editor-name-input:focus {
    background: var(--rp-surface);
}

/* The Baseline box beside "Saved …" (4-editor.png). */
.editor-header-side {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.editor-baseline {
    margin: 0;
    min-height: 0;
}

/* Locked on the baseline itself: a status, not an unavailable option, so Bootstrap's
   half-opacity for disabled boxes would misread. Full strength, as in 4-editor.png. */
.editor-baseline .form-check-input:disabled,
.editor-baseline .form-check-input:disabled ~ .form-check-label {
    opacity: 1;
    cursor: default;
}

.editor-status {
    margin: 0;
    color: var(--rp-muted);
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    align-items: start;
}

.editor-section + .editor-section {
    border-top: 1px solid var(--rp-rule);
}

.editor-section-toggle {
    display: flex;
    align-items: baseline;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    border: 0;
    background: none;
    text-align: left;
    color: var(--rp-ink);
}

.editor-section-title {
    font-size: 13px;
    font-weight: 600;
}

.editor-section-summary {
    margin-left: auto;
    padding-left: 12px;
    font-size: 12px;
    color: var(--rp-muted);
    text-align: right;
}

/* A text cue, not colour alone (§4.2b): defaults render in normal ink. The chip
   itself is .rp-default-tag from the theme. */
.rp-default-tag {
    display: inline-block;
    margin-right: 6px;
}

.timeline {
    display: grid;
    gap: 6px;
    margin: 0 0 10px;
    font-size: 12px;
}

.timeline-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.timeline dt {
    font-weight: 400;
    color: var(--rp-ink-2);
}

.timeline dd {
    margin: 0;
    color: var(--rp-muted);
}

.editor-section-body {
    padding: 0 18px 18px;
}

.editor-section-intro {
    margin: 0 0 14px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--rp-muted);
}

.editor-form-error {
    margin: 14px 18px 0;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.field-label {
    margin-bottom: 6px;
    color: var(--rp-ink-2);
}

.field-help {
    margin: 5px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--rp-muted);
}

.field-error {
    margin: 5px 0 0;
    font-size: 11.5px;
    color: var(--rp-danger);
}

.field.has-error .form-control {
    border-color: var(--rp-danger);
}

/* Editor §01: a row per person under column headings, then plan-to age (7-new-scenario.png) */
.people-grid,
.people-plan {
    display: grid;
    grid-template-columns: 110px repeat(3, minmax(0, 1fr));
    gap: 8px 14px;
    align-items: start;
}

.people-col-head {
    color: var(--rp-ink-2);
}

.people-row-label {
    grid-column: 1; /* each person starts a new row; the fourth column stays empty */
    margin: 0;
    padding-top: 9px; /* level with a 38px input; a label that wraps stays tight */
    line-height: 20px;
    font-weight: 500;
    color: var(--rp-ink);
}

.people-plan {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--rp-rule);
}

.people-plan-help {
    grid-column: span 2;
    margin: 10px 0 0;
}

.people-note {
    margin-top: 14px;
}

/* Editor §03: contributions, a row per person under column headings (4-editor.png) */
.contrib-grid {
    display: grid;
    grid-template-columns: 110px repeat(2, minmax(0, 1fr)) minmax(0, 1.2fr);
    gap: 8px 14px;
    align-items: start;
}

.contrib-head {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rp-rule);
}

.contrib-row {
    display: contents; /* its cells sit in .contrib-grid's columns */
}

.contrib-stops {
    position: relative; /* for the Stops menu, as a stream's Ends */
}

.contrib-note {
    margin-top: 14px;
}

/* Editor 05: Social Security, a row per person (§3.5) */
.ss-grid {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 8px 14px;
    align-items: start;
}

.ss-row {
    display: contents; /* its cells sit in .ss-grid's columns */
}

.ss-head {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rp-rule);
}

.ss-claim-control {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px; /* level with the money field beside it */
}

.ss-claim-control .form-range {
    flex: 1;
    min-width: 0;
}

.ss-claim-control output {
    width: 2ch;
    font-variant-numeric: tabular-nums;
}

.ss-readout {
    margin: 0;
    padding-top: 9px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--rp-ink);
    font-variant-numeric: tabular-nums;
}

.ss-note {
    margin-top: 12px;
}

/* Editor 05: "If benefits are cut" (§3.5, 19-C1) */
.ss-cut {
    margin: 16px 0 0;
    padding: 14px 0 0;
    border: 0;
    border-top: 1px solid var(--rp-rule);
}

.ss-cut-legend {
    margin-bottom: 10px; /* Bootstrap floats a legend so it sits below the fieldset's rule */
}

.ss-cut .form-check {
    margin-bottom: 8px;
}

.ss-cut-help {
    margin: 2px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--rp-muted);
}

.ss-cut-custom {
    display: inline-flex; /* beside its radio */
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.ss-cut-custom .form-control {
    font-family: var(--rp-mono);
}

.ss-cut-custom .ss-cut-pct {
    width: 64px;
}

.ss-cut-custom .ss-cut-year {
    width: 76px;
}

.ss-cut-note {
    margin-top: 4px;
}

/* Editor §04: income stream rows (4-editor.png) */
/* Editor 07: other expense rows use the stream rows' styles, with their own columns.
   Amount has room for "$18,000" and its "/yr"; Year and Until for a year each. */
.stream-head.expense-head,
.stream-row.expense-row {
    grid-template-columns: minmax(0, 1.6fr) minmax(124px, 1.2fr) minmax(70px, .7fr) minmax(76px, .7fr) 32px;
}

.expense-amount {
    display: flex;
    align-items: center;
    gap: 6px;
}

.expense-amount .form-control {
    min-width: 0;
}

.expense-per-year {
    font: 400 12px var(--rp-mono);
    color: var(--rp-muted);
}

/* "10 years" under Until (4-editor.png); takes no room when there's nothing to say. */
.expense-years {
    margin: 4px 0 0;
    font: 400 11.5px var(--rp-mono);
    color: var(--rp-muted);
}

.expense-years:empty {
    display: none;
}

.stream-head,
.stream-row {
    display: grid;
    /* minmax(…): every row gets the same widths whatever its content, so the rows,
       each its own grid, line up. The minimums fit the figures and choices: "$165,000",
       a year, Ends' longest chip "● At partner's retirement ▾" (169px) and "No (flat)"
       beside its arrow. In a narrow editor only the label, which scrolls, gives way. */
    grid-template-columns: minmax(0, 1.7fr) minmax(88px, 1.1fr) minmax(70px, .8fr) minmax(170px, 1.5fr) minmax(98px, 1fr) 32px;
    gap: 10px;
    align-items: start;
}

.stream-head {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rp-rule);
}

.stream-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--rp-rule);
}

/* A warning that never blocks anything (§4.2 row 04): the amber notice box. Not a
   coloured left border, which the design README rules out. */
.plan-warning {
    margin: 8px 0 14px;
    padding: 8px 12px;
    border: 1px solid var(--rp-notice-border);
    border-radius: var(--rp-radius);
    background: var(--rp-notice-bg);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--rp-ink);
}

/* On the results page it sits under the header, spaced like the saved bar. */
.page-header ~ .plan-warning {
    margin: 0 0 16px;
}

/* Ends (10-end-year-control.png): the posted select and year box, and the menu
   end_year.js draws over them. Without JavaScript the two controls show instead. */
.stream-cell--end_year {
    position: relative;
}

.ends-fallback {
    display: grid;
    gap: 4px;
}

.ends-enhanced .ends-fallback {
    display: none;
}

/* C: a fixed year is a plain white field with a caret (10-end-year-control.png). */
.ends-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 5px;
    font: 400 13px var(--rp-mono);
    font-variant-numeric: tabular-nums;
    max-width: 100%; /* wraps rather than widen its column, if it ever doesn't fit */
    text-align: left;
}

/* Its colours at zero specificity (:where), so the theme's .rp-linked colours win. */
:where(.ends-button) {
    border: 1px solid var(--rp-control);
    background: var(--rp-surface);
    color: var(--rp-ink);
}

/* A: linked to retirement, the theme's tinted .rp-linked chip with its dot. */
.ends-button.rp-linked {
    font: 500 12px var(--rp-sans);
}

.ends-button[aria-expanded="true"] {
    border-color: var(--rp-primary);
    box-shadow: var(--rp-focus);
}

.ends-button-caret {
    font-size: 10px;
    color: var(--rp-muted);
}

.ends-button.rp-linked .ends-button-caret {
    color: inherit;
}

.ends-note {
    width: fit-content; /* so the "moved" highlight hugs the text */
    margin: 4px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--rp-muted);
}

.ends-note--year {
    font-family: var(--rp-mono);
}

/* C: running past retirement is allowed, so amber, not red: the darker amber for
   small text. */
.ends-note--caution {
    color: var(--rp-caution-ink);
}

/* E: a linked end that just moved with retirement, briefly. */
.ends-note--moved {
    margin-left: -4px;
    padding: 0 4px;
    border-radius: 3px;
    background: var(--rp-notice-bg);
    color: var(--rp-ink);
    transition: background-color .3s;
}

/* E: the notice under People when retirement moves (10-end-year-control.png). */
.retirement-moved {
    display: flex;
    gap: 9px;
    margin: 12px 0 0;
    padding: 9px 12px;
    border-radius: 6px;
    background: var(--rp-primary-tint);
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--rp-ink);
}

.retirement-moved::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--rp-primary);
}

.ends-relink {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--rp-primary);
}

.ends-menu {
    position: absolute;
    z-index: 10;
    top: 42px;
    right: 0;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 8px;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-card);
    background: var(--rp-surface);
    box-shadow: var(--rp-shadow-pop);
}

.ends-option {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.ends-option:has(input[type="radio"]:checked) {
    background: var(--rp-primary-tint);
}

.ends-option-head {
    display: contents; /* its radio and title sit in the option's grid */
}

.ends-option input[type="radio"] {
    margin-top: 3px;
}

.ends-option-title {
    font-weight: 500;
    color: var(--rp-ink);
}

.ends-option-text {
    grid-column: 2;
    font-size: 12px;
    line-height: 1.45;
    color: var(--rp-muted);
}

.ends-menu-year {
    grid-column: 2;
    margin-top: 8px;
    font-family: var(--rp-mono);
}

.ends-menu-year:invalid {
    border-color: var(--rp-danger);
}

.ends-menu-footer {
    margin: 6px 0 0;
    padding: 8px 12px 2px;
    border-top: 1px solid var(--rp-rule);
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--rp-muted);
}

.stream-cell.has-error .form-control,
.stream-cell.has-error .form-select {
    border-color: var(--rp-danger);
}

/* The column headers label the cells on wide screens; the captions stay for screen readers. */
.stream-cell-caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.stream-row-error {
    grid-column: 1 / -1;
    margin-top: 0;
}

.stream-cell--remove {
    display: flex;
    justify-content: center;
}

.stream-remove-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 34px;
    border-radius: var(--rp-radius);
    font-size: 16px;
    color: var(--rp-muted);
    cursor: pointer;
}

.stream-remove-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.stream-remove-toggle:hover {
    color: var(--rp-danger);
}

.stream-remove-toggle:has(input:focus-visible) {
    outline: 2px solid var(--rp-primary);
    outline-offset: 1px;
}

/* A row marked for removal stays visible, struck through, until saved. Clicking × again keeps it. */
.stream-row:has(.stream-remove-toggle input:checked) .stream-cell:not(.stream-cell--remove) {
    opacity: .45;
    text-decoration: line-through;
}

.stream-row:has(.stream-remove-toggle input:checked) .stream-remove-toggle {
    color: var(--rp-danger);
}

/* "+ Add stream", "+ Add expense": the theme's dashed .rp-btn-add, spaced below its rows. */
.add-row-button {
    margin-top: 12px;
}

.streams-note {
    margin-top: 12px;
}

/* Phones: two columns per row, and each cell shows its own label instead of the header. */
@media (max-width: 767.98px) {
    .stream-head {
        display: none;
    }

    .stream-row,
    .stream-row.expense-row {
        grid-template-columns: 1fr 1fr;
        padding: 12px 0;
    }

    .stream-cell--label {
        grid-column: 1 / -1;
    }

    /* Ends sits in the left column here, so the menu opens rightwards. */
    .ends-menu {
        right: auto;
        left: 0;
    }

    .stream-cell--remove {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    .stream-remove-toggle {
        width: 44px;
    }

    /* Social Security (05) on phones: the same, the readout on its own line. */
    .ss-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ss-head {
        display: none;
    }

    .ss-grid .people-row-label,
    .ss-readout {
        grid-column: 1 / -1;
    }

    /* §03 on phones: amounts side by side, captions instead of the headings. */
    .contrib-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .contrib-head {
        display: none;
    }

    .contrib-grid .people-row-label,
    .contrib-stops {
        grid-column: 1 / -1;
    }

    .stream-cell-caption {
        position: static;
        width: auto;
        height: auto;
        margin-bottom: 4px;
        overflow: visible;
        clip: auto;
        white-space: normal;
        font-size: 11.5px;
        color: var(--rp-ink-2);
    }

    .stream-row .form-control,
    .stream-row .form-select,
    .stream-remove-toggle {
        min-height: 44px; /* spec §7 */
    }
}

/* Editor §07: market assumptions (§4.2c, 4-editor.png) */
.field-grid.market-grid {
    grid-template-columns: repeat(2, 1fr);
}

.market-taxes {
    margin-top: 14px;
}

/* Fees, inflation and the two fixed rates in one row (design 2b) */
.field-grid.market-rates,
.field-grid.accounts-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.market-rates-note {
    margin-top: 12px;
}

/* Editor §02: four buckets, the total, then the home (design 2a) */
.accounts-note {
    margin-top: 12px;
}

.accounts-basis {
    margin-top: 14px;
}


.accounts-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--rp-rule);
    border-bottom: 1px solid var(--rp-rule);
    color: var(--rp-ink-2);
}

.accounts-total output {
    font-size: 13px;
    font-weight: 500;
    color: var(--rp-ink);
}

.accounts-property {
    margin-top: 16px;
}

.accounts-property-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 600;
}

/* The grey micro-chip (8-A2): no new token. */
.property-chip {
    font: 500 10.5px var(--rp-mono);
    color: var(--rp-muted);
    background: var(--rp-bg);
    padding: 2px 7px;
    border-radius: 3px;
}

.market-split .slider-head {
    margin-bottom: 6px;
}

.market-split-ends {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--rp-muted);
}

.market-outlook {
    margin: 18px 0;
    padding: 18px 0;
    border-top: 1px solid var(--rp-rule);
    border-bottom: 1px solid var(--rp-rule);
}

.market-outlook-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.market-outlook-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.market-outlook-range,
.market-outlook-description {
    margin: 0;
    font-size: 12px;
    color: var(--rp-muted);
}

.market-outlook-description {
    margin: 4px 0 12px;
}

.outlook-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* A card that is one choice of several: a label with a visually hidden radio inside,
   so the picked look is pure CSS and the arrow keys move between them. Used by the
   editor's outlook cards and the results page's path cards. */
.choice-card {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-card);
    background: var(--rp-surface);
    cursor: pointer;
}

.choice-card:hover {
    border-color: var(--rp-control);
}

/* Selected: a 2px primary ring on the primary tint (design README, rule 11). The
   inset shadow adds the second pixel without moving the card's contents. */
.choice-card:has(input:checked) {
    border-color: var(--rp-primary);
    background: var(--rp-primary-tint);
    box-shadow: inset 0 0 0 1px var(--rp-primary);
}

.choice-card:has(input:focus-visible) {
    outline: 2px solid var(--rp-primary);
    outline-offset: 2px;
}

.outlook-card-name {
    font-weight: 600;
    color: var(--rp-ink);
}

.outlook-card-rate {
    font: 500 18px var(--rp-mono);
    letter-spacing: -.02em;
}

/* While the editor recalculates the rates (§4.2c). */
.outlook-cards[data-updating] .outlook-card-rate {
    opacity: 0.45;
}

/* The dash before the first run; a real rate is coloured by its band (.rate-*). */
.outlook-card-rate--none {
    color: var(--rp-muted);
}

.outlook-card-summary {
    font-size: 11.5px;
    color: var(--rp-muted);
}

.market-values {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    column-gap: 12px; /* the space between rows of fields is .market-value's margin */
    margin-top: 12px;
    padding: 14px 16px;
    border: 1px solid var(--rp-rule);
    border-radius: var(--rp-radius-card);
    background: var(--rp-surface-2);
}

/* Each field shares the section's rows (label, number, range, errors), so the numbers
   line up even when a label like "Stock return after inflation" takes two lines. */
.market-value {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    row-gap: 0;
    align-content: start;
}

.market-value-label {
    display: block;
    margin-bottom: 4px;
}

.market-value-input {
    display: flex;
    align-items: baseline;
    gap: 3px;
    font-family: var(--rp-mono);
}

.market-value-input .form-control {
    width: 8ch; /* room for "-12.00", and keeps the % next to the number */
    padding: 4px 6px;
    font-family: var(--rp-mono);
}

/* Where supported, size each input to its value so the % sits right after it. */
@supports (field-sizing: content) {
    .market-value-input .form-control {
        field-sizing: content;
        width: auto;
        min-width: 5ch;
    }
}

/* A preset's values read as plain text: no box, no spinner. */
.market-values[data-market-editable="false"] .form-control {
    padding-left: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    appearance: textfield;
    -moz-appearance: textfield;
}

.market-values[data-market-editable="false"] .form-control::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.market-value-range {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--rp-muted);
}

.market-values[data-market-editable="false"] .market-value-range {
    display: none;
}

/* §4.2c: an out-of-range Custom value gets a red border; the range is shown beside it. */
.market-values[data-market-editable="true"] .form-control:out-of-range,
.market-value.has-error .form-control {
    border-color: var(--rp-danger);
}

.market-values-note {
    margin-top: 8px;
}

.market-customise {
    color: var(--rp-primary);
}

@media (max-width: 767.98px) {
    .outlook-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .market-values {
        grid-template-columns: repeat(2, 1fr);
    }

    .market-value {
        margin-bottom: 12px; /* between the rows of fields, now there are several */
    }

    .field-grid.market-grid {
        grid-template-columns: 1fr;
    }

    .field-grid.market-rates,
    .field-grid.accounts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

.editor-rail {
    display: grid;
    gap: 14px;
}

.rail-card {
    padding: 16px 18px;
}

.rail-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
}

.rail-text {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--rp-muted);
}

.rail-text:last-child {
    margin-bottom: 0;
}

.rail-divider {
    padding-top: 10px;
    border-top: 1px solid var(--rp-rule);
}

.rail-actions {
    display: grid;
    gap: 8px;
    margin-top: 4px;
}

.rail-actions .btn {
    padding-top: 9px;
    padding-bottom: 9px;
}

.rail-discard {
    padding: 6px 0 0;
    text-align: center;
    color: var(--rp-muted);
    text-decoration: none;
}

@media (max-width: 991.98px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .editor-header {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .people-grid,
    .people-plan {
        grid-template-columns: 64px repeat(2, minmax(0, 1fr));
    }

    .people-plan-help {
        grid-column: 1 / -1;
        margin-top: 0;
    }

    .editor-section-toggle,
    .rail-actions .btn {
        min-height: 44px; /* spec §7: hit targets never below 44px */
    }
}

/* Results page (1-results.png) */
/* Buttons keep one line and their own height: some sit in a <form> or wrapper,
   which a stretched flex row would leave shorter than the bare ones. On a narrow
   screen the title wraps first, then the buttons move to a second row. */
.page-actions {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

.page-actions .btn {
    white-space: nowrap;
}

.page-actions form {
    margin: 0;
}

/* The metric strip, segmented tabs and bridge panel are styled by
   instrument-theme.css (component rules 2-4). These are the app's additions. */
.rp-metrics {
    margin-bottom: 16px;
}

/* In the results column (16-C1), the column's 18px gap spaces it. */
.results-main > .rp-metrics {
    margin-bottom: 0;
}

/* The two tab groups sit where the one track did; the tracks inside lose its margin.
   Each track stays on one row and scrolls sideways when it doesn't fit (phones), and
   Past markets wraps under Simulated futures. */
.rp-tab-groups.chart-tabs {
    margin: 12px 14px 0;
}

.chart-tabs .rp-seg {
    flex-wrap: nowrap;
    max-width: 100%;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.chart-tabs .rp-seg::-webkit-scrollbar {
    display: none;
}

@media (max-width: 575.98px) {
    .rp-tab-divider {
        display: none; /* the groups are stacked, so there's nothing to divide */
    }
}

.rp-seg .nav-link {
    white-space: nowrap;
}

.chart-body {
    padding: 16px 18px 18px;
}

.chart-caption {
    max-width: 720px;
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--rp-muted);
}

/* Money left (§4.1, charts/1): two histograms, stacked, with a rule between. */
.chart-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--rp-ink);
}

.outcomes-section + .outcomes-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--rp-rule);
}

/* Year by year: the three path cards (8-year-by-year.png), each a .choice-card. */
.path-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
}

.path-card {
    padding: 10px 14px; /* a little tighter than .choice-card: two lines, not three */
}

.path-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--rp-ink);
}

.path-card-summary {
    font-size: 12px;
    color: var(--rp-muted);
}

@media (max-width: 575.98px) {
    .path-cards {
        grid-template-columns: 1fr;
    }
}

/* Historical tab (§4.1, 20-historical.png): the lead line with Any year on the right,
   then four named-year cards, three lines each. */
.history-pick-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 12px;
    margin: 0 0 10px;
}

.history-pick-lead {
    margin: 0;
    font-size: 12.5px;
    color: var(--rp-ink-2);
}

.history-any-year {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--rp-ink-2);
}

.history-any-year .form-select {
    width: auto;
    font-family: var(--rp-mono);
}

.history-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.history-card-note {
    font-size: 11.5px;
    color: var(--rp-muted);
}

.path-card-summary.is-runs-out {
    color: var(--rp-phase-unfunded-ink); /* the shortfall red: --rp-danger is under 4.5:1 on the picked card's tint */
}

.history-footnote {
    margin-top: 12px;
}

@media (max-width: 767.98px) {
    .history-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Year by year: the chart's legend (HTML, §4.1), in the design's order. */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    color: var(--rp-ink-2);
}

.chart-legend li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 11px;
    height: 11px;
    border-radius: 2px;
}

.legend-swatch--added { background: var(--rp-chart-added); }
.legend-swatch--gain { background: var(--rp-chart-gain); }
.legend-swatch--out { background: var(--rp-chart-out); }
.legend-swatch--loss { background: var(--rp-chart-loss); }

/* A short bar, as the shortfall mark along the chart's bottom edge is. */
.legend-swatch--shortfall {
    height: 4px;
    border-radius: 0;
    background: var(--rp-chart-unfunded);
}

/* Historical tab (§4.1, design 3b): the history and typical lines as short lines, the
   band and bridge as the fan chart fills them, and the market strip. */
.legend-swatch--history,
.legend-swatch--typical {
    width: 16px;
    height: 3px;
    border-radius: 0;
}
.legend-swatch--history { background: var(--rp-ink); }
.legend-swatch--typical { background: var(--rp-primary); }
.legend-swatch--band { background: color-mix(in srgb, var(--rp-primary) 15%, transparent); }
.legend-swatch--bridge { background: var(--rp-chart-bridge); }
/* Year by year: "Home sold" under the sale year's Added (8-B19). */
.year-by-year-table .row-note {
    display: block;
    font-size: 11px;
    color: var(--rp-chart-property-ink);
}

/* 8-A2: the home's hatch, as on Balance over time. */
.legend-swatch--property {
  border: 1px solid var(--rp-chart-property);
  background: repeating-linear-gradient(135deg, var(--rp-chart-property-fill) 0 2px, color-mix(in srgb, var(--rp-chart-property) 50%, transparent) 2px 3px);
}

/* Money left's heading with "Plus your home" on its right (8-B18). */
.chart-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.chart-title-note {
    margin: 0;
    font-size: 12.5px;
    color: var(--rp-ink-2);
}
.legend-swatch--market-up { background: var(--rp-chart-market-up); }
.legend-swatch--market-down { background: var(--rp-chart-market-down); }

/* Year by year: the detail table (8-year-by-year.png). It scrolls sideways
   inside its own box, never the page. */
.year-by-year-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 22px 0 10px;
}

.year-by-year-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.year-by-year-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

/* Scrolls both ways inside itself, so the header row and the Year column can
   stay put (§4.1): sticky cells stick to their nearest scrolling box. */
.year-by-year-scroll {
    max-height: 480px;
    overflow: auto;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-card);
}

.year-by-year-scroll:focus-visible {
    outline: 2px solid var(--rp-primary);
    outline-offset: 2px;
}

.year-by-year-table {
    width: 100%;
    /* separate, not collapse: collapsed borders don't move with sticky cells. */
    border-collapse: separate;
    border-spacing: 0;
    white-space: nowrap;
    font-family: var(--rp-mono);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.year-by-year-table th,
.year-by-year-table td {
    padding: 7px 12px;
    border-top: 1px solid var(--rp-rule);
    text-align: left;
    font-weight: 400;
}

.year-by-year-table thead th {
    border-top: 0;
    border-bottom: 1px solid var(--rp-border);
    background: var(--rp-surface-2);
    font-family: var(--rp-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--rp-muted);
}

.year-by-year-table thead + tbody tr:first-child > * {
    border-top: 0;
}

.year-by-year-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* The Year column: a line on its right shows where rows slide under it. */
.year-by-year-table th:first-child {
    position: sticky;
    left: 0;
    background: var(--rp-surface);
    box-shadow: inset -1px 0 0 var(--rp-rule);
}

.year-by-year-table thead th:first-child {
    z-index: 2; /* the corner stays above both */
    background: var(--rp-surface-2);
}

.year-by-year-table .numeric {
    text-align: right;
}

/* §4.1: unfunded rows get a light red background. */
.year-by-year-table tr.is-unfunded > * {
    background: var(--rp-row-unfunded);
}

/* Working phases are ink on grey; the tinted ones have their own tokens (each ≥ 6.5:1). */
.phase-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--rp-rule);
    font-family: var(--rp-sans);
    font-size: 11.5px;
    color: var(--rp-ink-2);
}

.phase-tag--bridge {
    background: var(--rp-phase-bridge-bg);
    color: var(--rp-phase-bridge-ink);
}

.phase-tag--social-security {
    background: var(--rp-phase-ss-bg);
    color: var(--rp-phase-ss-ink);
}

.phase-tag--shortfall {
    background: var(--rp-phase-unfunded-bg);
    color: var(--rp-phase-unfunded-ink);
}

.year-by-year-footnote {
    margin: 8px 0 0;
}

/* Axis labels in mono, like every other figure (README). */
.chart-body svg text {
    font-family: var(--rp-mono);
}

/* Names on a chart, such as the Stocks vs. bonds outlooks, are words: sans, as in design 1c. */
.chart-body svg text.is-sans {
    font-family: var(--rp-sans);
}

/* The charts' hover note: a popover (README shape and elevation), not a dark box,
   since nothing below the app bar is dark. */
.chart-tooltip {
    position: fixed;
    z-index: 1000;
    padding: 6px 10px;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius);
    background: var(--rp-surface);
    box-shadow: var(--rp-shadow-pop);
    font-size: 12px;
    color: var(--rp-ink);
    white-space: nowrap;
    pointer-events: none;
}

/* Phones: hit targets never below 44px (§7). */
@media (max-width: 575.98px) {
    .page-actions .btn,
    .chart-tabs .nav-link,
    .year-by-year-header .btn {
        min-height: 44px;
    }
}

/* Results: charts beside the assumption sliders (1fr 300px, README) */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 18px;
    align-items: start;
}

.results-grid > * {
    min-width: 0; /* let the chart card shrink instead of overflowing the grid */
}

/* The rail: the Inputs card, then the slider card (§4.1). */
.results-rail {
    display: grid;
    gap: 14px;
    min-width: 0;
}

/* The charts, with the bridge callout under them (1-results.png). */
.results-main {
    display: grid;
    gap: 18px;
    min-width: 0;
}

/* One slider in the results rail: .rp-slider-head and .form-range come from the theme. */
.slider {
    margin: 18px 0;
}

/* A couple's sliders for one setting (§4.1, 19-C1): the row's label, then You and
   Partner side by side, or one full width when the other's has gone. */
.rp-slider-pair {
    margin: 18px 0;
}

.rp-slider-row-label {
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--rp-ink-2);
}

.rp-slider-pair-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.rp-slider-pair.is-single .rp-slider-pair-grid {
    grid-template-columns: minmax(0, 1fr);
}

.rp-slider-pair .slider {
    margin: 0;
}

.rp-slider-pair .rp-slider-head {
    margin-bottom: 8px;
}

.rp-slider-sub {
    font-size: 11.5px;
    color: var(--rp-muted);
}

/* Under a claim slider: the yearly benefit at that age. */
.rp-slider-note {
    margin: 6px 0 0;
    font: 400 11px var(--rp-mono);
    color: var(--rp-muted);
}

/* The editor's stocks / bonds slider: label and value on one line (4-editor.png). */
.slider-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    color: var(--rp-ink-2);
}

.slider-head output {
    font-weight: 500;
    color: var(--rp-ink);
    font-variant-numeric: tabular-nums;
}

/* Centred under the save buttons (1-results.png), with Reset beside it when dirty */
.slider-status {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    padding-top: 4px;
}

/* .rp-dirty (the theme) sets its type and colour; a validation message can wrap. */
.slider-status p {
    margin: 0;
}

.slider-status .app-link-button {
    font-size: 11.5px;
    color: var(--rp-primary);
}

@media (max-width: 991.98px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .form-range {
        height: 44px; /* spec §7: hit targets never below 44px */
    }
}


/* Compare (§4.4, 9-compare.png): one column per scenario, the baseline first. */
.compare-card {
    overflow-x: auto;
}

.compare-table {
    width: 100%;
    /* separate, not collapse: collapsed borders don't move with the sticky label column. */
    border-collapse: separate;
    border-spacing: 0;
}

.compare-table th,
.compare-table td {
    padding: 12px 18px;
    border-top: 1px solid var(--rp-rule);
    text-align: left;
    vertical-align: top;
    font-weight: 400;
}

.compare-table tbody th[scope="row"] {
    width: 22%;
    color: var(--rp-ink-2);
}

.compare-table thead th,
.compare-table thead td {
    border-top: 0;
    border-bottom: 1px solid var(--rp-border);
    background: var(--rp-surface-2);
}

.compare-table thead th + th,
.compare-table tbody td {
    border-left: 1px solid var(--rp-rule);
}

/* The name line: name, then the baseline's chip right after it, or × at the far right. */
.compare-head-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.compare-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--rp-ink);
    text-decoration: none;
}

.compare-name:hover {
    text-decoration: underline;
}

.compare-remove {
    margin-left: auto;
    padding: 0 4px;
    font-size: 16px;
    line-height: 1;
    color: var(--rp-muted);
    text-decoration: none;
}

.compare-remove:hover {
    color: var(--rp-ink);
}

.compare-head .rp-baseline {
    margin: 0;
}

.compare-head .scenario-summary {
    margin-top: 4px;
    font-weight: 400;
}

/* "Outcomes", "Assumptions": .rp-micro labels across the table. */
.compare-table .compare-section th {
    padding-top: 16px;
    padding-bottom: 8px;
    font-weight: 500; /* .rp-micro's weight, which .compare-table th would otherwise reset */
}

.compare-outcome {
    font: 500 18px var(--rp-mono);
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.compare-note {
    margin-left: 8px;
    font: 400 11.5px var(--rp-mono);
    color: var(--rp-ink-2);
}

/* An assumption that differs from the baseline: tinted, and tagged in words too. */
.compare-table td.is-changed {
    background: var(--rp-changed-bg);
}

.changed-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border: 1px solid var(--rp-changed-border);
    border-radius: 10px;
    font: 500 10px var(--rp-sans);
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--rp-changed-ink);
    vertical-align: 1px;
}

/* + Add scenario: a column of its own until there are two others (§4.4). Its button
   opens a modal listing the scenarios to add, each a link (changed 2026-09-30). */
.compare-add {
    vertical-align: middle;
}

.compare-add .add-row-button {
    margin-top: 0;  /* the editor's spacing above it doesn't apply in a header */
}

.compare-add-title {
    font-size: 15px;
    font-weight: 600;
}

.compare-add-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.compare-add-list li {
    padding: 10px 16px;
    border-top: 1px solid var(--rp-rule);
}

.compare-add-list li:first-child {
    border-top: 0;
}

.compare-add-choice {
    font-weight: 600;
    color: var(--rp-ink);
    text-decoration: none;
}

.compare-add-choice:hover {
    text-decoration: underline;
}

/* The compare chart card (9-compare.png): title and legend on one line. */
.compare-chart-card {
    margin-top: 16px;
    padding: 16px 18px 18px;
}

.compare-chart-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px 16px;
    margin-bottom: 6px;
}

.compare-chart-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.compare-legend {
    margin: 0;
}

.compare-chart-card svg text {
    font-family: var(--rp-mono);
}

/* A short thick line, as the chart draws lines, not blocks. */
.legend-swatch--line {
    height: 3px;
    width: 16px;
    border-radius: 2px;
}

.legend-swatch.compare-colour-1 { background: var(--rp-cmp-1); }
.legend-swatch.compare-colour-2 { background: var(--rp-cmp-2); }
.legend-swatch.compare-colour-3 { background: var(--rp-cmp-3); }

/* The results rail's note when Compare meets unsaved slider changes (§4.4). */
.unsaved-compare-note {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--rp-notice-border);
    border-radius: var(--rp-radius-card);
    background: var(--rp-notice-bg);
}

.unsaved-compare-note[hidden] {
    display: none;
}

.unsaved-compare-note p {
    margin: 0;
    color: var(--rp-ink);
}

/* §4.4 on a phone: the label column stays put while the scenario columns scroll
   sideways inside the card. Harmless when nothing scrolls. */
.compare-table tbody th[scope="row"],
.compare-table .compare-corner {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--rp-surface);
    box-shadow: inset -1px 0 0 var(--rp-rule);
}

.compare-table .compare-corner {
    background: var(--rp-surface-2);
}

/* Equal scenario columns, as in 9-compare.png, whatever their text: without this a
   long "Other inputs" list widens its own column. Phones keep the scrolling layout. */
@media (min-width: 576px) {
    .compare-table {
        table-layout: fixed;
    }

    /* Fixed layout takes widths from the first row, the header, so the label column's
       width goes on its corner cell. */
    .compare-table .compare-corner {
        width: 22%;
    }
}

@media (max-width: 575.98px) {
    .compare-table tbody th[scope="row"] {
        width: auto;
        min-width: 120px;
    }

    /* The scenario columns only: the corner cell is part of the label column. */
    .compare-table tbody td,
    .compare-table thead th {
        min-width: 180px;
    }
}

/* "Outcomes" and "Assumptions" span every column, so the cell scrolls with them;
   the text inside is pinned instead, so it stays readable. */
.compare-section-label {
    position: sticky;
    left: 18px;
}

/* The risk curve's draggable marker (asked for 2026-09-30). Only the handle stops the
   page scrolling on touch, so the rest of the chart still scrolls it. */
.risk-handle {
    cursor: grab;
    touch-action: none;
}

#risk-chart[data-dragging] .risk-handle,
#risk-chart[data-dragging] svg {
    cursor: grabbing;
}

#risk-chart svg rect[data-tooltip] {
    cursor: pointer;
}

/* §3.7 "When": curves older than the run on screen, until the run with new ones lands. */
#risk-chart.is-stale svg { opacity: .5; }

/* ── An anonymous scenario's pages (§4.5, §4.7, design 16) ── */
.anonymous-bar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.anonymous-bar-label {
    font: 400 12px var(--rp-mono);
    color: var(--rp-on-dark-muted);
}

.rp-appbar .anonymous-sign-in {
    --bs-btn-color: var(--rp-on-dark);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--rp-on-dark-rule);
    --bs-btn-hover-color: var(--rp-on-dark);
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: var(--rp-on-dark-muted);
}

.anonymous-strip {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
    padding: 11px var(--page-padding);
    background: var(--rp-surface);
    border-bottom: 1px solid var(--rp-border);
}

.anonymous-strip p {
    margin: 0;
    font: 400 13px var(--rp-sans);
    color: var(--rp-ink-2);
}

.anonymous-strip strong {
    font-weight: 600;
    color: var(--rp-ink);
}

/* Take the tour (§4.5): a primary text link, as in design 3a; .btn-link alone is the theme's muted grey. */
.anonymous-strip .rp-tour-restart {
    font: 500 12px var(--rp-sans);
    color: var(--rp-primary);
    vertical-align: baseline;
}

.anonymous-strip-trials {
    flex: none;
    font: 400 11.5px var(--rp-mono);
    color: var(--rp-muted);
}

@media (max-width: 767.98px) {
    .anonymous-bar-label,
    .anonymous-strip-trials {
        display: none;
    }
}

/* "Save this plan" (§4.7, design 17) and the bar after it (design 18). */
.rp-saved-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 11px 16px;
    background: var(--rp-success-tint);
    border: 1px solid var(--rp-success);
    border-radius: var(--rp-radius-card);
    font: 400 13px var(--rp-sans);
    color: var(--rp-ink);
}

.rp-saved-bar::before {
    content: "";
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--rp-success);
}

#save-dialog .modal-dialog {
    max-width: 460px;
}

.save-dialog {
    overflow: hidden;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-card);
    box-shadow: var(--rp-shadow-pop);
}

.save-dialog-body {
    display: flex;
    flex-direction: column;
    padding: 20px 22px;
}

.save-dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.save-dialog-title {
    margin: 0 0 4px;
    font: 600 17px var(--rp-sans);
    color: var(--rp-ink);
}

.save-dialog-help {
    margin: 0 0 16px;
    font: 400 13px/1.5 var(--rp-sans);
    color: var(--rp-ink-2);
}

.save-dialog-plan {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--rp-surface-2);
    border: 1px solid var(--rp-rule);
    border-radius: var(--rp-radius);
}

.save-dialog-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.save-dialog-chips li {
    padding: 2px 7px;
    background: var(--rp-surface);
    border: 1px solid var(--rp-control);
    border-radius: 4px;
    font: 400 11.5px var(--rp-mono);
    color: var(--rp-ink-2);
}

.save-dialog-form {
    display: flex;
    flex-direction: column;
}

.save-dialog-form[hidden] {
    display: none;
}

.save-dialog-form > .form-label {
    margin-top: 12px;
}

.save-dialog-error {
    margin-top: 5px;
    font: 400 12.5px var(--rp-sans);
    color: var(--rp-danger);
}

.save-dialog-error:empty {
    display: none;
}

.save-dialog-form > .btn-primary {
    margin-top: 18px;
}

.save-dialog-switch {
    margin: 12px 0 0;
    text-align: center;
    font: 400 13px var(--rp-sans);
    color: var(--rp-ink-2);
}

.save-dialog-switch .app-link-button {
    font-weight: 500;
    color: var(--rp-primary);
}

.save-dialog-switch .app-link-button:hover {
    color: var(--rp-primary-hover);
}

/* The plan just saved by signing in, on the list (design 19): the selected-row tint. */
.scenario-row.is-new {
    background: var(--rp-primary-tint);
}

.badge.rp-new {
    background: transparent;
    border: 1px solid var(--rp-primary);
    color: var(--rp-primary);
}

.save-dialog-foot {
    margin: 0;
    padding: 14px 22px;
    background: var(--rp-surface-2);
    border-top: 1px solid var(--rp-rule);
    font: 400 12px/1.5 var(--rp-sans);
    color: var(--rp-muted);
}

/* ── Front page and the access-code dialog (§4.5 design 5a, §4.6 designs 12–15) ── */
/* The content is 1120px wide with 80px gutters at the 1280px design width, centred on
   wider screens; full-width bands (What's different, the closing band) pad to match. */
.front-main {
    --front-gutter: max(80px, calc((100% - 1120px) / 2));
    padding: 0;
}

/* The front page's nav is a little taller, with a 20px tile (BUILD-SPEC header). */
.rp-appbar.is-front {
    height: 56px;
    padding: 0 40px;
}

.rp-appbar.is-front .navbar-brand {
    gap: 10px;
    font-size: 14px;
}

.rp-appbar.is-front .rp-brand-tile {
    width: 20px;
    height: 20px;
}

.front-appbar-end {
    display: flex;
    align-items: stretch;
    gap: 28px;
    height: 100%;
}

.front-appbar-end > :not(.nav-link) {
    align-self: center;
}

.front-plan-form {
    margin: 0;
}

/* White buttons on the dark nav and closing band. */
.front-nav-plan,
.front-closing-plan {
    --bs-btn-color: var(--rp-ink);
    --bs-btn-bg: var(--rp-surface);
    --bs-btn-border-color: var(--rp-surface);
    --bs-btn-hover-color: var(--rp-ink);
    --bs-btn-hover-bg: var(--rp-surface-2);
    --bs-btn-hover-border-color: var(--rp-surface-2);
    --bs-btn-font-weight: 500;
}

.front-closing-plan {
    --bs-btn-padding-y: 11px;
    --bs-btn-padding-x: 18px;
    --bs-btn-font-size: 14px;
}

.front-welcome {
    padding: 11px 24px;
    background: var(--rp-primary-tint);
    border-bottom: 1px solid var(--rp-primary-tint-edge);
    font: 400 13.5px var(--rp-sans);
    color: var(--rp-ink-2);
}

.front-welcome strong {
    font-weight: 500;
    color: var(--rp-ink);
}

.front-eyebrow {
    margin: 0;
    font: 500 11px var(--rp-mono);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--rp-muted);
}

.front-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    padding: 64px var(--front-gutter) 0;
    text-align: center;
}

.front-headline {
    max-width: 820px;
    margin: 0;
    font: 600 52px/1.06 var(--rp-sans);
    letter-spacing: -.02em;
    color: var(--rp-ink);
    text-wrap: balance;
}

.front-lede {
    max-width: 620px;
    margin: 0;
    font: 400 17px/1.55 var(--rp-sans);
    color: var(--rp-ink-2);
}

.front-hero-action {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.front-hero-plan {
    --bs-btn-padding-y: 11px;
    --bs-btn-padding-x: 18px;
    --bs-btn-font-size: 14px;
    --bs-btn-font-weight: 500;
}

.front-hero-note {
    font: 400 13px var(--rp-sans);
    color: var(--rp-muted);
}

/* The planner, 16:9: the poster image until the clip is recorded (§4.5). The design's
   --rp-border-strong is --rp-control here, as for the old screenshot. */
/* The hero images (§4.5, 8a): the planner screenshot, with the Historical card over its
   top right and the Ask card over its bottom left. The cards hang past its edges. The
   Ask card hangs 100px below the screenshot, not the design's 56px, so most of the
   chart's red "ran out" bar stays in view (2026-10-11). */
.front-collage {
    position: relative;
    max-width: 1040px;
    margin: 68px auto 0;
    padding-bottom: 100px;
}

.front-collage-shot {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background: var(--rp-surface);
    border: 1px solid var(--rp-control);
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(20, 24, 31, .18);
}

.front-collage-card {
    position: absolute;
    margin: 0;
    background: var(--rp-surface);
    border: 1px solid var(--rp-control);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(20, 24, 31, .2);
}

.front-collage-card.is-history {
    top: -36px;
    right: -64px;
    width: 342px;
    overflow: hidden;
}

.front-collage-card.is-history figcaption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
    padding: 0 14px;
    border-bottom: 1px solid var(--rp-rule);
    font: 500 12px var(--rp-sans);
    color: var(--rp-ink);
}

.front-collage-card.is-history img {
    display: block;
    width: 100%;
    height: auto;
}

.front-collage-eyebrow {
    font: 500 10.5px var(--rp-mono);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--rp-muted);
}

.front-collage-eyebrow.is-primary {
    letter-spacing: .04em;
    color: var(--rp-primary);
}

.front-collage-card.is-ask {
    bottom: 0;
    left: -64px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 420px;
    padding: 16px;
}

.front-collage-ask-q {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--rp-control);
    border-radius: 6px;
    font: 400 13.5px var(--rp-sans);
    color: var(--rp-ink);
}

.front-collage-ask-ran {
    margin: 0;
    font: 400 11.5px/1.5 var(--rp-mono);
    color: var(--rp-muted);
}

.front-collage-ask-answer {
    margin: 0;
    font: 400 14px/1.5 var(--rp-sans);
    color: var(--rp-ink);
    text-wrap: pretty;
}

.front-collage-ask-actions {
    display: flex;
    gap: 8px;
    pointer-events: none;
}

/* 992–1199: the cards tuck inside the page margins. */
@media (max-width: 1199.98px) {
    .front-collage {
        margin-inline: 24px;
    }

    .front-collage-card.is-history {
        top: -24px;
        right: -16px;
        width: 300px;
    }

    .front-collage-card.is-ask {
        left: -16px;
        width: 380px;
    }
}

/* Below 992: the screenshot, then the Ask card in the flow; no Historical card. */
@media (max-width: 991.98px) {
    .front-collage {
        margin: 40px 16px 0;
        padding-bottom: 0;
    }

    .front-collage-card.is-history {
        display: none;
    }

    .front-collage-card.is-ask {
        position: static;
        width: auto;
        margin-top: 16px;
    }
}

/* What's different: a white band, three groups of three points. */
.front-diff {
    margin-top: 64px;
    padding: 56px var(--front-gutter);
    background: var(--rp-surface);
    border-top: 1px solid var(--rp-border);
    border-bottom: 1px solid var(--rp-border);
}

.front-diff .front-eyebrow {
    margin-bottom: 32px;
}

.front-diff-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
}

.front-diff-group {
    margin: 0 0 20px;
    padding-top: 12px;
    border-top: 2px solid var(--rp-ink);
    font: 600 13px var(--rp-sans);
    color: var(--rp-ink);
}

.front-diff-title {
    margin: 0 0 6px;
    font: 600 15px var(--rp-sans);
    color: var(--rp-ink);
}

.front-diff-groups p {
    margin: 0 0 20px;
    font: 400 13.5px/1.55 var(--rp-sans);
    color: var(--rp-ink-2);
}

.front-diff-groups p:last-child {
    margin-bottom: 0;
}

.front-closing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 44px var(--front-gutter);
    background: var(--rp-appbar);
}

.front-closing-title {
    margin: 0 0 6px;
    font: 600 24px var(--rp-sans);
    color: var(--rp-on-dark);
}

.front-closing-note {
    margin: 0;
    font: 400 14px var(--rp-sans);
    color: var(--rp-on-dark-muted);
}

.front-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px var(--front-gutter);
    font: 400 11.5px var(--rp-mono);
    color: var(--rp-muted);
}

/* The access-code dialog: a Bootstrap modal holding the code and request forms. */
#gate-dialog .modal-dialog {
    max-width: 440px;
}

.front-gate-card {
    overflow: hidden;
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-card);
    box-shadow: var(--rp-shadow-pop);
}

.front-gate-body {
    padding: 20px 22px 18px;
}

.front-gate-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.front-gate-eyebrow {
    font: 500 10.5px var(--rp-mono);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--rp-primary);
}

.front-gate-title {
    margin: 0 0 6px;
    font: 600 17px var(--rp-sans);
    color: var(--rp-ink);
}

.front-gate-help {
    margin: 0 0 14px;
    font: 400 13px/1.5 var(--rp-sans);
    color: var(--rp-ink-2);
}

.front-gate-form {
    display: flex;
    flex-direction: column;
}

.front-gate-row {
    display: flex;
    gap: 8px;
}

.front-gate-row .form-control {
    flex: 1;
    min-width: 0;
}

.front-gate-code {
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .08em;
}

/* The red border is enough (design 13); Bootstrap's "!" icon would crowd a short code. */
.front-gate-code.is-invalid {
    padding-right: 11px;
    background-image: none;
}

.front-gate-error {
    margin-top: 6px;
    font: 400 12.5px var(--rp-sans);
    color: var(--rp-danger);
}

.front-gate-error:empty {
    display: none;
}

.front-gate-request {
    padding: 16px 22px 18px;
    background: var(--rp-surface-2);
    border-top: 1px solid var(--rp-rule);
}

.front-gate-thanks {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font: 400 12.5px var(--rp-sans);
    color: var(--rp-ink-2);
}

.front-gate-thanks[hidden] {
    display: none;
}

.front-gate-thanks strong {
    font: 500 14px var(--rp-sans);
    color: var(--rp-ink);
}

/* Below about 900px (§4.5): the groups and the captions stack, and the headline shrinks. */
@media (max-width: 899.98px) {
    .front-headline {
        font-size: 36px;
    }

    .front-diff-groups {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }
}

@media (max-width: 767.98px) {
    .rp-appbar.is-front {
        padding: 0 16px;
    }

    .front-appbar-end {
        gap: 12px;
    }

    /* Phones keep the brand, the chip, Sign in and the planner button. */
    .front-appbar-end .nav-link:not(.front-sign-in) {
        display: none;
    }

    .front-main {
        --front-gutter: 16px;
    }

    .front-hero {
        padding-top: 36px;
    }

    .front-headline {
        font-size: 32px;
    }

    .front-lede {
        font-size: 16px;
    }

    .front-diff {
        margin-top: 44px;
        padding-block: 36px;
    }

    .front-closing {
        flex-direction: column;
        align-items: flex-start;
        padding-block: 36px;
    }

    .front-footer {
        flex-direction: column;
        padding-block: 14px;
    }

    .front-gate-row {
        flex-wrap: wrap;
    }
}

/* What moves it (§4.1): the layout around the theme's .rp-sens-* rows. The group
   header uses the rows' columns, so "Hurts" and "Helps" sit either side of the axis. */
.rp-sens-head + .chart-caption { margin-top: 10px; }
.rp-sens { margin: 18px 0 14px; }
.rp-sens-group + .rp-sens-group { margin-top: 22px; }
.rp-sens-header {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) minmax(0, 1fr);
    padding-bottom: 8px;
}
.rp-sens-header .is-hurts { text-align: right; padding-right: 12px; }
.rp-sens-header .is-hurts + .rp-micro { padding-left: 12px; }
.rp-sens-list { list-style: none; margin: 0; padding: 0; }
.rp-sens-label { padding: 6px 12px 6px 0; }
/* Room between the axis's neighbours and the words at the half's far end. */
.rp-sens-side.is-hurts { padding-left: 8px; }
.rp-sens-side.is-helps { padding-right: 8px; }
.rp-sens-bar { flex: none; }
/* The Grow intro scales each bar out from the axis (growRows()). */
.rp-sens-side.is-hurts .rp-sens-bar { transform-origin: right center; }
.rp-sens-side.is-helps .rp-sens-bar { transform-origin: left center; }
/* "under 1 point either way", alone on the helps side: off the axis like a bar's label. */
.rp-sens-side.is-helps > .rp-sens-dir:first-child { padding-left: 8px; }
@media (max-width: 600px) {
    .rp-sens-header { grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr); }
    /* A half is about 100px wide: the words ("Conservative") go on a line of their own
       under the bar and its points, at the half's far edge, rather than past the card. */
    .rp-sens-side { flex-wrap: wrap; align-content: center; row-gap: 2px; padding-top: 6px; padding-bottom: 6px; }
    .rp-sens-side .rp-sens-dir { flex-basis: 100%; order: 1; }
    .rp-sens-side.is-hurts .rp-sens-dir { text-align: right; padding-right: 6px; }
    .rp-sens-side.is-helps .rp-sens-dir { padding-left: 6px; }
}

/* Share link (§4.10 1a; README-CHANGES A3): a popover under the button, no backdrop. */
.share-link {
    position: relative;
}

.share-link > .btn {
    white-space: nowrap;
}

.share-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    width: min(400px, calc(100vw - 32px));
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--rp-surface);
    border: 1px solid var(--rp-border);
    border-radius: var(--rp-radius-card);
    box-shadow: var(--rp-shadow-pop);
    text-align: left;
}

.share-popover[hidden] {
    display: none;
}

.share-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 10px;
    height: 10px;
}

.share-title {
    margin: 0;
    padding-right: 24px;
    font-size: 14px;
    font-weight: 600;
}

.share-text,
.share-contains p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--rp-ink-2);
}

.share-row {
    display: flex;
    gap: 8px;
}

.share-link-field {
    font-family: var(--rp-mono);
    font-size: 12.5px;
}

.share-row .btn {
    flex: none;
    width: 96px;
}

.share-error {
    margin: 0;
    font-size: 12px;
    color: var(--rp-danger);
}

.share-unsaved {
    margin: 0;
    padding: 7px 10px;
    border: 1px solid var(--rp-notice-border);
    border-radius: var(--rp-radius);
    background: var(--rp-notice-bg);
    font-size: 12px;
    line-height: 1.45;
    color: var(--rp-ink-2);
}

.share-unsaved strong {
    font-weight: 600;
    color: var(--rp-caution-ink);
}

.share-contains {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--rp-rule);
}

.share-contains-title {
    margin: 0;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--rp-muted);
}
