/* ---- Theme: Evolv ----
   Warm umber surfaces, amber accent, quiet underline navigation,
   ruled sections, and fine-tuned variable typography weights. ---- */
/* ---- UI refresh: calmer surfaces ----
   One accent, used for meaning and focus; warm neutrals instead of navy; the page's main figure sits on the page
   itself, and secondary blocks are ruled sections rather than a grid of identical boxes. ---- */
:root {
  --bg-primary: #151413;
  --bg-surface: #1d1b19;
  --bg-card: #272421;
  --border-color: rgba(255, 244, 228, 0.15);
  --border-hover: rgba(255, 244, 228, 0.28);
  --text-main: #f1ede6;
  --text-muted: #9d968a;
  --text-secondary: #c2bbae;
  --color-accent: #e2b365;
  --color-accent-hover: #edc47f;
  --divider: rgba(255, 244, 228, 0.14);
  --rule: rgba(255, 244, 228, 0.5);
  --nav-active: #302c27;
  --nav-hover: #25221f;
  --scope-mine: #e2b365;
  --scope-partner: #a773db;
  --scope-together: #2eada3;
  --color-pos: #7fc18a;
  --color-neg: #ec8b7e;
  --color-liab: #e59a62;
}

/* The app icon in the header (see .brand-icon in core.css): one palette for light and dark, so it stays the same icon. */
:root {
  --mark-tile: #e8a23a;
  --mark-bars: #1d1b19;
  --mark-coin: #f6efe2;
  --mark-dollar: #1d1b19;
}

[data-theme="light"] {
  --bg-primary: #f5f2ec;
  --bg-surface: #fdfbf7;
  --bg-card: #efebe3;
  --border-color: rgba(60, 40, 10, 0.1);
  --border-hover: rgba(60, 40, 10, 0.22);
  --text-main: #211e1a;
  --text-muted: #6e675c;
  --text-secondary: #4a443b;
  --color-accent: #8f5f12;
  --color-accent-hover: #744b0b;
  --divider: rgba(60, 40, 10, 0.16);
  --rule: rgba(60, 40, 10, 0.1);
  --nav-active: #e6e0d4;
  --nav-hover: #eee9df;
  --scope-mine: #8f5f12;
  --scope-partner: #72659A;
  --scope-together: #1f6f6b;
  --color-pos: #2f7a3e;
  --color-neg: #b4372a;
  --color-liab: #b4571c;
}

.brand-icon {
  box-shadow: 0 0 0 1px #6e675c69;
}


.btn-primary {
  color: #1d1b19;
}

[data-theme="light"] .btn-primary {
  color: #fdfbf7;
}

/* Navigation is text with an underline, not a pill. */
.tab,
.tab:hover {
  background: none;
}

.tab {
  border-radius: 0;
  padding: 0.45rem 0.15rem;
  margin: 0 0.6rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
}

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

.tab[aria-current="page"] {
  background: none;
  color: var(--text-main);
  border-bottom-color: var(--color-accent);
  /* Same weight as the others: a heavier label is wider, which nudged every tab after it sideways. */
  font-weight: var(--w-medium);
}

[data-layout="rail"] .app-header .tab {
  border-radius: 0;
  padding: 0.45rem 0.15rem;
}

[data-layout="rail"] .app-header .tabs {
  gap: 0;
  margin-left: 0;
}

/* Time ranges are quiet text toggles. */
.ranges {
  gap: 0.1rem;
}

.range {
  border-color: transparent;
  background: none;
  padding: 0.2rem 0.5rem;
  font-variant-numeric: tabular-nums;
}

.range:hover {
  color: var(--text-main);
}

.range[aria-pressed="true"] {
  background: none;
  border-color: transparent;
  color: var(--text-main);
  font-weight: var(--w-semi);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

/* The page's main figure has no box. */
.card.hero {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0.25rem 0 0.5rem;
  overflow: visible;
}

.card.hero .card-head h2 {
  font-size: var(--fs-sm);
  font-weight: var(--w-medium);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Secondary blocks are ruled sections. */
[data-layout="rail"] .tile {
  background: none;
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  padding: 3rem 0 0.25rem;
}

[data-layout="rail"] .overview-grid,
[data-layout="rail"] .overview-col {
  gap: 1.75rem;
}

[data-layout="rail"] .overview-grid {
  column-gap: 2.5rem;
}

.tile .card-head h2 {
  font-size: var(--fs-sm);
  font-weight: var(--w-semi);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.chart-axis {
  fill: var(--text-muted);
}

.chart-area {
  opacity: 0.12;
}

/* ---- Type weights ----
   Hanken Grotesk is variable, so weights are tokens and can sit between the usual steps. Everything above uses these. */
/* Wide steps on purpose: light large figures, plain body, firm labels and headings, so the hierarchy shows in the
   weight alone. Albert Sans is variable, so any of these can sit between the usual steps. */
:root {
  --w-regular: 400;
  --w-medium: 560;
  --w-semi: 700;
  --w-bold: 800;
  --w-figure: 440;
}

[data-theme="light"] {
  --w-regular: 400;
  --w-medium: 540;
  --w-semi: 680;
  --w-figure: 420;
}

strong,
b,
th {
  font-weight: var(--w-semi);
}

.hero-value,
.hv-amount,
.rail-value,
.invest-hero-stat .num,
.invest-hero-val {
  font-weight: var(--w-figure);
  letter-spacing: -0.035em;
}

.num {
  letter-spacing: -0.005em;
}

.brand h1 {
  font-weight: var(--w-semi);
  letter-spacing: -0.03em;
}

/* ---- Emphasis: a loud net worth, firm titles, solid buttons ---- */
:root {
  --rail-w: 330px;
}

[data-layout="rail"] .app-body {
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

/* The top line: the biggest, heaviest thing on the screen, on its own tinted block. */
.rail-net {
  padding: 1.5rem 1.4rem 1.25rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 11%, transparent), transparent);
  border-bottom: 1px solid var(--rule);
}

.rail-label {
  color: var(--color-accent);
  font-weight: var(--w-bold);
  letter-spacing: 0.1em;
}

.rail-value {
  font-size: 2.45rem;
  font-weight: var(--w-bold);
  letter-spacing: -0.045em;
  line-height: 1;
  margin: 0.15rem 0 0.35rem;
}

/* Titles. */
.card h2,
.card-head h2,
.tile .card-head h2 {
  font-size: var(--fs-xl);
  font-weight: var(--w-bold);
  letter-spacing: -0.025em;
  text-transform: none;
  color: var(--text-main);
}

.tile .card-head h2 {
  font-size: var(--fs-lg);
}

.card.hero .card-head h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--w-bold);
  letter-spacing: -0.03em;
  text-transform: none;
  color: var(--text-main);
}

.card-head {
  margin-bottom: 0.9rem;
}

.hero-change {
  font-weight: var(--w-medium);
}

/* Buttons: larger, heavier, and the primary one is solid. */
.btn {
  padding: 0.6rem 1.15rem;
  font-size: var(--fs-md);
  font-weight: var(--w-semi);
  border-radius: var(--radius-md);
  letter-spacing: -0.005em;
}

.btn-small {
  padding: 0.4rem 0.85rem;
  font-size: var(--fs-base);
}

.btn-secondary {
  border-color: var(--border-hover);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
}

.link-btn {
  font-weight: var(--w-semi);
  color: var(--color-accent);
}

/* ---- Sidebar alignment: one gutter for everything, group titles flush left, every figure flush right ---- */
.rail {
  --rail-pad: 1.4rem;
}

.rail-net {
  padding-inline: var(--rail-pad);
}

.rail-group summary {
  padding-inline: var(--rail-pad);
}

.rail-group summary::before,
.rail-group:not([open]) summary::before {
  content: none;
}

.rail .acct-row {
  margin: 0;
  padding-inline: var(--rail-pad);
}

.rail-group summary .num,
.rail .acct-row .num,
.rail-split-row strong {
  text-align: right;
}

/* ---- Pages beside the sidebar: ruled sections instead of boxes ----
   Cards inside the main pane lose their surface and become sections divided by a hairline. The first one on a
   page sits straight on the background, like the Overview's chart. Danger cards keep a box so they still stand out. */
[data-layout="rail"] .app-main .card:not(.hero):not(.danger):not(.tile) {
  background: none;
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  padding: 1.25rem 0 0.5rem;
  overflow: visible;
}

[data-layout="rail"] .app-main .stack>.card:first-child:not(.danger),
[data-layout="rail"] .app-main>.card:first-child:not(.danger) {
  border-top: 0;
  padding-top: 0.25rem;
}

[data-layout="rail"] .app-main .stack {
  gap: 1.75rem;
}

/* Primary buttons are gold-tinted rather than solid, so they lead without shouting. */
.btn.btn-primary {
  background-color: color-mix(in srgb, var(--color-accent) 16%, transparent);
  color: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 55%, transparent);
}

.btn.btn-primary:hover {
  background-color: color-mix(in srgb, var(--color-accent) 26%, transparent);
  border-color: var(--color-accent);
}

[data-theme] .btn.btn-primary {
  color: var(--color-accent);
}

/* ---- Single column (narrow windows): the same header and sections, without the sidebar ---- */
[data-layout="single"] .app-header {
  border-bottom: 0;
  padding-bottom: 0.25rem;
  margin-bottom: 1.25rem;
}

[data-layout="single"] .app-header .tabs {
  background: none;
  border: 0;
  padding: 0;
  gap: 0;
}

[data-layout="single"] .tab {
  margin: 0 0.45rem;
}

[data-layout="single"] .app-main .card:not(.hero):not(.danger):not(.tile),
[data-layout="single"] .tile {
  background: none;
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  padding: 1.25rem 0 0.5rem;
  overflow: visible;
}

[data-layout="single"] .app-main .stack>.card:first-child:not(.danger),
[data-layout="single"] .app-main>.card:first-child:not(.danger) {
  border-top: 0;
  padding-top: 0.25rem;
}

[data-layout="single"] .app-main .stack {
  gap: 1.75rem;
}

[data-layout="single"] .hero-value {
  font-weight: var(--w-bold);
  font-size: clamp(2.25rem, 9vw, 3rem);
  letter-spacing: -0.045em;
  line-height: 1.05;
}

/* Account rows bleed 0.5rem past their column on both sides (the hover wash), so the base row's max-width must not
   clip the right side, or their amounts sit short of the group total above. */
.acct-row {
  max-width: none;
}

/* ---- Budget page ---- */
/* The summary leads with what is left, then what came in and went out, then how the whole budget is going. */
.budget-summary .split {
  align-items: baseline;
  gap: 0.5rem 2.5rem;
  margin-top: 0.5rem;
}

.budget-summary .split div span {
  font-size: var(--fs-sm);
  font-weight: var(--w-medium);
}

.budget-summary .split div strong {
  font-size: var(--fs-xl);
  font-weight: var(--w-semi);
}

.budget-summary .split .summary-lead strong {
  font-size: var(--fs-4xl);
  font-weight: var(--w-bold);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.summary-budget {
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
}

.summary-budget .meter {
  height: 0.5rem;
}

.summary-budget p,
.budget-summary>p {
  margin: 0 0 0.35rem;
}

/* The pace chart stays full width; it just sits closer to its neighbours. */
.pace-card {
  padding-top: 0.9rem !important;
  padding-bottom: 0 !important;
}

.pace-card .card-head {
  margin-bottom: 0.15rem;
}

.pace-card p {
  margin-bottom: 0.4rem;
}

.pace-card p:last-child {
  margin: 0.25rem 0 0.5rem;
}

[data-layout] .app-main .stack:has(.pace-card) {
  gap: 1.25rem;
}

/* Paid bills are told apart by a check mark and a quieter name and amount, not by fading the whole row, which left
   the small text below readable contrast. */
.bill-row.is-paid {
  opacity: 1;
}

.bill-row.is-paid .bill-name,
.bill-row.is-paid .bill-name-btn,
.bill-row.is-paid .bill-amount {
  color: var(--text-secondary);
}

.bill-row.is-paid .bill-when {
  color: var(--text-muted);
}

.bill-row.is-paid .bill-when::before {
  content: "✓";
  margin-right: 0.35em;
  color: var(--color-pos);
}

.bill-dismiss-btn {
  padding: 0.4rem 0.55rem;
  font-size: var(--fs-base);
}

.bills-refresh {
  color: var(--text-muted);
  font-weight: var(--w-medium);
  font-size: var(--fs-base);
}

.bills-refresh:hover {
  color: var(--text-main);
}

.bcell-status {
  font-size: var(--fs-xs);
}

/* Headings that no rule sizes fall on the scale rather than the browser's 1.17em. */
h3,
h4 {
  font-size: var(--fs-lg);
}

@media (max-width: 600px) {
  .budget-summary .split {
    gap: 0.75rem 2rem;
  }

  .budget-summary .split .summary-lead {
    flex-basis: 100%;
  }
}

/* ---- Transactions page ---- */
:root {
  --tx-head-h: 2.25rem;
}

/* Sticky column and month headers stick to the pane's scroll, so the wrapper must not be a scroll container itself
   (a horizontal overflow of auto would make it one, and the headers would never stick). */
.tx-scroll {
  overflow-x: clip;
}

.tx-table thead th {
  height: var(--tx-head-h);
  padding-block: 0;
  background: var(--bg-primary);
}

.tx-month-row td {
  top: var(--tx-head-h);
  padding: 1rem 0.5rem 0.35rem;
  background: var(--bg-primary);
}

/* Rows are centred and compact: one 40px line, not a 55px box. */
.tx-table tbody td {
  padding-block: 0.4rem;
  vertical-align: middle;
}

.tx-table .tx-desc-line {
  min-height: 1.5rem;
}

/* Category reads as text; the border and caret appear only when the row is hovered or the control has focus. */
.tx-table .cat-picker {
  height: 1.75rem;
  max-width: 100%;
}

.tx-table .tx-category-col {
  min-width: 13rem;
}

/* An uncategorized row is a to-do, so it is flagged softly rather than greyed out. */
.cat-picker.tx-inline-cat.is-uncat {
  font-style: normal;
  color: var(--color-accent);
  background-color: color-mix(in srgb, var(--color-accent) 12%, transparent);
  border-radius: 999px;
}

/* The pane's top gap is a spacer, not padding, so sticky headers lock to the very top of the pane instead of
   sitting below a strip that scrolling rows show through. */
[data-layout="rail"] .app-main {
  padding-top: 0;
}

[data-layout="rail"] .app-main::before {
  content: "";
  display: block;
  height: 1.5rem;
}

/* ---- Forms and dialogs ---- */
:root {
  --field-border: rgba(255, 244, 228, 0.22);
}

[data-theme="light"] {
  --field-border: rgba(60, 40, 10, 0.3);
}

/* Fields need an outline you can see before you focus them. */
input,
select,
textarea {
  border-color: var(--field-border);
}

input[type="checkbox"] {
  border-color: var(--field-border);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

/* The Cancel / Save row stays in view when a dialog scrolls (the wide dialogs already did this). */
.dialog form .actions {
  position: sticky;
  bottom: -1.5rem;
  margin: 1rem -1.5rem -1.5rem;
  padding: 0.85rem 1.5rem 1.5rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--rule);
  z-index: 1;
}

/* "Original from import": the three parts wrap as units instead of stranding a dot at a line's end. */
.tx-original-card {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.75rem;
}

.tx-original-sep {
  display: none;
}

/* ---- Transactions: calmer controls and chart ---- */
/* The date range is a neutral control; the label already says what it is set to. */
.month-picker-wrap .date-filter-btn.has-filter {
  border-color: var(--border-hover);
  color: var(--text-main);
  font-weight: var(--w-medium);
}

/* Bars are muted until you point at one; the selected bar keeps the full accent. */
.bar-rect.dim {
  opacity: 0.8;
}

/* ---- Planner ---- */
/* The table's sticky first column takes the page's colour, not the old surface colour. */
.plan-table tbody th,
.plan-table tfoot th {
  background: var(--bg-primary);
}

/* Assumptions sit under each account type's name instead of taking a column of their own. */
.plan-table .plan-col-rate {
  display: none;
}

.plan-bucket-sub {
  display: block;
}

/* The earliest retirement date leads on its own row; the three supporting figures share the next one. */
.planner-hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem 2rem;
  margin-top: 0.5rem;
}

.planner-hero-metrics>.invest-hero-stat:first-child {
  grid-column: 1 / -1;
}

.planner-hero-metrics>.invest-hero-stat:first-child .invest-hero-val {
  font-size: var(--fs-4xl);
  font-weight: var(--w-bold);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.planner-hero-metrics .invest-hero-sub {
  font-size: var(--fs-xl);
  font-weight: var(--w-semi);
}

@media (max-width: 700px) {
  .planner-hero-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* Cash runway and withdrawals: the reserve, then three figures side by side. */
.planner-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 2rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.planner-stat {
  display: grid;
  gap: 0.15rem;
  align-content: start;
}

.planner-stat-val {
  text-align: left;
  font-size: var(--fs-xl);
  font-weight: var(--w-semi);
  letter-spacing: -0.02em;
}

@media (max-width: 700px) {
  .planner-stats {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Investments ---- */
/* The hero leads with the total value; cost basis is ordinary ink, and the gain stacks dollars over percent. */
.invest-hero-metrics:not(.planner-hero-metrics) {
  align-items: flex-end;
}

.invest-hero-metrics:not(.planner-hero-metrics)>.invest-hero-stat:first-child .invest-hero-val {
  font-size: var(--fs-4xl);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.invest-hero-gain {
  display: flex;
  flex-direction: column;
}

.invest-hero-gain-pct {
  font-size: var(--fs-base);
  font-weight: var(--w-medium);
}

/* Allocation legend: name, amount and share on one line; the US / international split is small print beside it. */
.alloc-item {
  gap: 0.4rem 0.45rem;
}

.alloc-sub {
  margin-left: 0.25rem;
}

.alloc-sub .alloc-swatch:not(:first-child) {
  margin-left: 0.55rem;
}

/* One holdings table for every account: fixed columns that line up, one header that stays in view. */
.holdings-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.holdings-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: var(--tx-head-h);
  padding-block: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--divider);
}

.holdings-table .col-holding {
  width: auto;
  min-width: 0;
}

.holdings-table .col-shares {
  width: 9%;
  min-width: 0;
}

.holdings-table .col-price {
  width: 11%;
  min-width: 0;
}

.holdings-table .col-value {
  width: 15%;
  min-width: 0;
}

.holdings-table .col-basis {
  width: 14%;
  min-width: 0;
}

.holdings-table .col-gain {
  width: 14%;
  min-width: 0;
}

.holdings-table tbody td {
  padding-block: 0.5rem;
  vertical-align: middle;
}

.holdings-account-row th,
.holdings-account-row td {
  padding: 1.4rem 0.65rem 0.5rem;
  background: var(--bg-primary);
  border-bottom: 2px solid var(--divider);
  vertical-align: bottom;
}

.holdings-account-row th {
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  font-weight: var(--w-regular);
  font-size: inherit;
  color: var(--text-main);
}

.holdings-account-row th:first-child,
.holdings-account-row td:first-child {
  padding-left: 0;
}

.holdings-account-row td:last-child {
  padding-right: 0;
}

.holdings-account-row .invest-account-title {
  display: block;
}

.holdings-table .gl-dollars,
.holdings-table .gl-pct {
  display: block;
  white-space: nowrap;
}

.holdings-table .gl-pct {
  font-size: var(--fs-sm);
  opacity: 0.85;
}

.sortable-th[aria-sort="ascending"],
.sortable-th[aria-sort="descending"] {
  color: var(--text-main);
}

.sortable-th:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* Columns give way by the card's own width, not the window's: shares and price move under the name first, then cost basis
   goes. The card is a size container, so this works in the sidebar layout and the single column alike. */
.invest-holding-sub {
  display: none;
}

@container (max-width: 720px) {

  .holdings-table .col-shares,
  .holdings-table .col-price {
    display: none;
  }

  .holdings-table .col-value {
    width: 20%;
  }

  .holdings-table .col-basis,
  .holdings-table .col-gain {
    width: 18%;
  }

  .invest-holding-sub {
    display: block;
  }
}

@container (max-width: 480px) {
  .holdings-table .col-basis {
    display: none;
  }

  .holdings-table .col-value {
    width: 30%;
  }

  .holdings-table .col-gain {
    width: 28%;
  }
}

@container (max-width: 640px) {
  .activity-table .hide-mobile {
    display: none;
  }
}

/* ---- Planner in Together and Partner views ---- */
.planner-person-sections {
  display: grid;
  gap: 1.5rem;
}

.planner-person-section+.planner-person-section {
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.planner-person-name {
  margin-bottom: 0.6rem;
  font-size: var(--fs-md);
  font-weight: var(--w-semi);
  letter-spacing: -0.01em;
}

.planner-person-section>p {
  margin: 0;
}

.tile .household-notes {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.9rem;
  color: var(--text-muted);
}

.tile .household-notes p {
  margin: 0;
}

/* A choice beside its explanation: the select keeps its own width so the text beside it does not get squeezed. */
.planner-option select {
  flex: 0 0 min(19rem, 45%);
  width: auto;
}

.planner-option .row-main span {
  white-space: normal;
}

/* A warning that a figure is incomplete: the same band as the setup prompt, in the warning colour. */
.planner-caution {
  border-color: color-mix(in srgb, var(--color-warn) 55%, transparent);
  background: color-mix(in srgb, var(--color-warn) 10%, transparent);
}

@container (max-width: 560px) {
  .planner-option {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .planner-option select {
    flex: none;
    width: 100%;
  }
}

/* Settings is read line by line, so its content keeps a comfortable width instead of stretching across a wide window. */
.settings-layout {
  max-width: 64rem;
}

/* ---- Page width and a quieter net worth block ---- */
:root {
  --page-max: 60rem;
}

/* Beside the sidebar, a page keeps a comfortable width and sits centred in the space, instead of stretching across a very wide
   window. (Settings sets its own width below, since it has a section list inside it.) */
[data-layout="rail"] .app-main> :not(.settings-page) {
  max-width: var(--page-max);
  margin-inline: auto;
}

[data-layout="rail"] .app-main>.settings-page {
  max-width: 64rem;
  margin-inline: auto;
}

/* The top of the table has no band of its own: it was a lighter strip with labels touching its ends, so they looked clipped. */
.plan-table thead {
  background: var(--bg-primary);
}

/* The net worth block is flat. The gold label and the large figure already say "this is the headline". */
.rail-net {
  background: none;
}

/* The household combine choices: the closed line sits beside the title and wraps under it on a narrow card. */
.planner-combine>summary {
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
}

.planner-combine>summary>.muted {
  text-align: right;
  min-width: 0;
}

.planner-combine[open]>summary {
  margin-bottom: 0.25rem;
}

/* The people in a shared plan sit side by side, one column each, and stack on a narrow card. */
.planner-people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem 2.5rem;
  padding-bottom: 0.9rem;
}

.planner-person-col {
  display: grid;
  gap: 0.15rem;
  align-content: start;
  font-size: var(--fs-base);
}

.planner-person-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.planner-person-head strong {
  font-size: var(--fs-md);
  font-weight: var(--w-semi);
}

/* ---- Settings review ---- */
.settings-title {
  margin: 0 0 1rem;
  font-size: var(--fs-xl, 1.5rem);
  font-weight: var(--w-bold, 700);
}

/* The options for a setting (such as how long to stay unlocked) read as one control, with the chosen one filled in. */
.setting .ranges {
  gap: 0;
  border: 1px solid var(--field-border, var(--border-color));
  border-radius: 999px;
  padding: 0.15rem;
}

.setting .ranges .range {
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  text-decoration: none;
  white-space: nowrap;
}

.setting .ranges .range[aria-pressed="true"] {
  background: var(--nav-active);
  color: var(--text-main);
  text-decoration: none;
}

@media (max-width: 800px) {

  /* A fade on the right edge says there is more to scroll to. */
  .settings-nav {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
    padding-right: 1.5rem;
  }
}

/* A page that scrolls and one that does not leave the same width, so the header and tabs never move between them. */
html {
  scrollbar-gutter: stable;
}

/* On a phone all five tabs fit across, so the row never scrolls and no tab moves between pages. */
@media (max-width: 520px) {
  [data-layout] .app-header .tabs {
    overflow: visible;
    justify-content: space-between;
    margin-left: 0;
    gap: 0;
  }

  [data-layout] .app-header .tab {
    flex: 0 0 auto;
    margin: 0;
    padding: 0.45rem 0.1rem;
    font-size: clamp(0.7rem, 3.3vw, 0.9rem);
  }
}

/* ---- Review follow-ups ---- */

/* Touch: small controls keep their look but get a hit area of about 44px. */
@media (pointer: coarse) {
  .btn-small:not(.edit-btn) {
    min-height: 2.5rem;
  }

  .edit-btn,
  .link-btn,
  .linkbtn,
  .range,
  .bill-dismiss-btn,
  .bcell-status,
  .budget-amt-btn {
    position: relative;
  }

  .edit-btn::after,
  .link-btn::after,
  .linkbtn::after,
  .range::after,
  .bill-dismiss-btn::after,
  .bcell-status::after,
  .budget-amt-btn::after {
    content: '';
    position: absolute;
    inset: -0.75rem -0.4rem;
  }

  .cat-picker {
    min-height: 2.25rem;
  }
}

/* The Planner's top section on a phone: the date first, then the other figures as short rows, so the timeline is on the first screen. */
@media (max-width: 520px) {
  .planner-hero-metrics {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .planner-hero-metrics .invest-hero-stat:not(:first-child) {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--rule, var(--border-color));
  }

  .planner-hero-metrics .invest-hero-stat:not(:first-child) .planner-hero-note {
    display: none;
  }

  .planner-hero-metrics .invest-hero-stat:not(:first-child) .hero-label,
  .planner-hero-metrics .invest-hero-stat:not(:first-child) .invest-hero-sub {
    margin: 0;
  }
}

/* The page puts the reader's scroll position back itself after it redraws, so the browser must not also move it. */
#view {
  overflow-anchor: none;
}

/* A new version is ready: floats above the page, so showing it never moves anything. */
.update-notice {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.35);
  font-size: var(--fs-sm);
}

/* The sign-in notice floats over the page instead of taking space at the top of it, so it showing up when a session expires (which
   can be minutes after the page loaded) moves nothing. */
.session-banner {
  position: fixed;
  bottom: 5rem;
  /* above the new-version notice, which sits at the very bottom */
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  width: min(40rem, calc(100vw - 2rem));
  margin: 0;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.35);
}

/* Theme dropdown selector */
.theme-dropdown-trigger {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.theme-dropdown-menu {
  background: var(--bg-surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}