/* Gruvbox Dark Hard is the default theme; Gruvbox Light Hard is the light one. */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d2021;
  --surface: #282828;
  --line: #ebdbb20d;
  --line-strong: #ebdbb21f;
  --text: #ebdbb2;
  --muted: #a89984;
  --accent: #fabd2f;
  --on-accent: #1d2021;
  --pos: #b8bb26;
  --neg: #fb4934;
  --warn: #fabd2f;
  --track: #ebdbb214;
  --fill: #fabd2f;
  --fillbg: #fabd2f1f;
  --overbg: #fb493421;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f9f5d7;
  --surface: #f2e5bc;
  --line: #3c38360f;
  --line-strong: #3c383624;
  --text: #3c3836;
  --muted: #665c54;
  --accent: #b57614;
  --on-accent: #f9f5d7;
  --pos: #79740e;
  --neg: #9d0006;
  --warn: #b57614;
  --track: #3c383614;
  --fill: #b57614;
  --fillbg: #b5761424;
  --overbg: #9d00061a;
}

:root {
  --font: "Fira Code", "FiraCode Nerd Font", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 3px;
  --row: 25px;
  --control: 32px;
  font-family: var(--font);
  font-size: 13px;
  font-feature-settings: "liga" 0, "calt" 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 0; background: var(--bg); }
body { min-width: 0; min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); line-height: 1.4; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 19px; font-weight: 650; line-height: 1.15; }
small { font-size: 11.5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.amount, .num, .fig, time, td.r { font-variant-numeric: tabular-nums; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

/* App bar */
.app-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 52px;
  align-items: stretch;
  gap: 28px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
}
.workspace-nav { display: flex; gap: 4px; }
.workspace-nav a {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 550;
  text-decoration: none;
}
.workspace-nav a:hover { color: var(--text); }
.workspace-nav a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--text); }
.bar-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.bar-tools select { width: auto; }
.bell { position: relative; }
.icon-button { display: grid; width: 32px; height: 32px; padding: 0; place-items: center; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover, .icon-button[aria-expanded="true"] { background: var(--surface); color: var(--text); }
.icon-button svg { width: 18px; height: 18px; }
.popover {
  position: absolute;
  z-index: 30;
  top: 40px;
  right: 0;
  width: 320px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong), 0 18px 50px rgb(0 0 0 / 45%);
}
.popover-title { margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.popover-empty { color: var(--muted); }

/* Page */
main { max-width: 1656px; margin: 0 auto; padding: 24px 28px; }
.workspace { min-width: 0; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.eyebrow, .field, .compact-field, .col-head, th, .stat-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.eyebrow { display: block; margin-bottom: 6px; font-size: 11px; letter-spacing: .12em; }
.head-note { color: var(--muted); font-size: 12px; }
.head-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 12px; }
.compact-field { display: flex; align-items: center; gap: 8px; }
.compact-field input { width: auto; }

/* Blocks: a rule, no background */
.block { min-width: 0; margin-bottom: 22px; padding-top: 10px; border-top: 2px solid var(--line-strong); }
.block > h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.block > h2 small, .block-head small { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.block h3 { margin: 14px 0 6px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

/* Stat tiles are the only filled surfaces */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-grid-six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat-grid:empty { display: none; }
.stat { min-width: 0; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); }
.stat-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .fig { display: block; margin-top: 4px; font-size: 22px; font-weight: 600; white-space: nowrap; }
.fig small { color: var(--muted); font-size: .7em; }
.stat .sub { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.stat.neg .fig { color: var(--neg); }
.stat.warn .fig { color: var(--warn); }
.stat.pos .fig { color: var(--pos); }
.stat .fig.small-fig { font-size: 15px; }

/* Forms */
.stack { display: grid; min-width: 0; gap: 10px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field { display: grid; min-width: 0; gap: 5px; letter-spacing: .06em; }
.hint { min-height: 0; color: var(--muted); font-size: 11.5px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.hint:empty { display: none; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 18px; }
.inline-form .field { min-width: 160px; }
.inline-form .field:first-child { min-width: 240px; }
input, select {
  width: 100%;
  min-width: 0;
  height: var(--control);
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  outline: 0;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input-big { height: 42px; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
input[type="file"] { padding: 4px; line-height: 24px; }
input[type="file"]::file-selector-button { height: 24px; margin-right: 8px; border: 0; border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; }
input[type="checkbox"] { width: 14px; height: 14px; box-shadow: none; accent-color: var(--accent); }
.checkbox-field { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 12px; }

button {
  display: inline-flex;
  height: var(--control);
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { cursor: wait; opacity: .55; }
.button-secondary, .row-button {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text);
}
.button-danger { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--neg) 50%, transparent); color: var(--neg); }
.button-secondary:hover, .row-button:hover, .button-danger:hover { background: var(--surface); filter: none; }
.row-button { height: 24px; padding: 0 8px; font-size: 11.5px; }
.row-button.button-danger { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--neg) 50%, transparent); color: var(--neg); }
.row-actions button, td button, .movement button, .holding-records button {
  height: 24px;
  padding: 0 8px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text);
  font-size: 11.5px;
}
.row-actions .button-danger, td .button-danger, .holding-records .button-danger { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--neg) 50%, transparent); color: var(--neg); }
.block > h2 .row-actions button { font-weight: 600; }
.holding-records { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
.holding-records span { display: inline-flex; align-items: center; gap: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#recent, #net-worth-components, #holding-decomposition, .project details { overflow-x: auto; }
.button-full { width: 100%; }
.chip-field { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; }
.chips { display: contents; margin: 0; padding: 0; list-style: none; }
.chips li { display: contents; }
.chip { height: 24px; padding: 0 8px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text); font-size: 11.5px; font-weight: 600; }
.chip-field input { flex: 1 1 180px; width: auto; }
.suggestions { position: absolute; top: 100%; right: 0; left: 0; z-index: 5; max-height: 220px; margin: 4px 0 0; padding: 4px 0; overflow-y: auto; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); list-style: none; }
.suggestions li { padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.suggestions li[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 20%, transparent); }
#month-remaining [data-filter-category] { cursor: pointer; }
#month-remaining [aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--accent); }
.pager { display: flex; align-items: center; justify-content: end; gap: 8px; margin-top: 8px; font-size: 12px; }
.pager button:disabled { cursor: default; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-actions .button-full { flex: 1; }
.segmented { display: inline-flex; padding: 2px; border-radius: calc(var(--radius) + 2px); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.segmented button { height: 28px; padding: 0 12px; background: transparent; color: var(--muted); font-size: 12px; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.message { color: var(--muted); font-size: 12px; }
.message:empty { display: none; }
.message:not(:empty) { margin: 8px 0; padding: 6px 10px; border-radius: var(--radius); background: var(--surface); }
.message.error { color: var(--neg); }
.message.success { color: var(--pos); }
.empty { color: var(--muted); font-size: 12px; }

/* Tables and dense rows */
.data-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.data-table th { height: 24px; padding: 0 8px; border-bottom: 1px solid var(--line-strong); text-align: left; white-space: nowrap; }
.data-table td { height: var(--row); padding: 0 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table .r { text-align: right; }
.data-table .dim, .dim { color: var(--muted); }
.data-table td.desc { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; }
.data-table .detail td { height: auto; padding: 2px 8px 6px; color: var(--muted); font-size: 11.5px; white-space: normal; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.row-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 6px; }
td .row-actions { flex-wrap: nowrap; }
td select { width: 150px; height: 22px; padding: 0 6px; font-size: 11.5px; }
.tag { display: inline-block; max-width: 180px; padding: 0 6px; overflow: hidden; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--muted); font-size: 11px; line-height: 17px; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.tag.project { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.tag.ok { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pos) 45%, transparent); color: var(--pos); }
.status {
  display: inline-block;
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}
.status.good { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pos) 55%, transparent); color: var(--pos); }
.status.bad { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--neg) 55%, transparent); color: var(--neg); }

.taxonomy-row, .budget-row {
  display: grid;
  min-width: 0;
  min-height: var(--row);
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  border-top: 1px solid var(--line);
}
.taxonomy-row { grid-template-columns: minmax(0, 1fr) auto; }
.budget-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.row-primary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-primary small { margin-left: 8px; color: var(--muted); }
.budget-row > strong, .budget-row > .num { font-weight: 600; text-align: right; white-space: nowrap; }
.budget-row > small { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; }
.muted, .muted .row-primary { color: var(--muted); }
.taxonomy-row.muted .row-primary strong { text-decoration: line-through; }

/* Row fill: the consumed share of a Budget */
.fill { background: linear-gradient(90deg, var(--fillbg) var(--p, 0%), transparent var(--p, 0%)); }
.fill.over { background: var(--overbg); }
.fill.over > .rem, .fill.over > .state { color: var(--neg); }
.fill.unbudgeted { background: none; }
.fill.unbudgeted > .state { color: var(--warn); }
.budget-row > .state { font-size: 11px; }

.meter { height: 4px; overflow: hidden; border-radius: 2px; background: var(--track); }
.meter i { display: block; height: 100%; background: var(--fill); }
.meter i.over { background: var(--neg); }
.meter-big { height: 10px; }

/* Activity */
.activity-grid { display: grid; grid-template-columns: 400px minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
#month-remaining .budget-row { grid-template-columns: minmax(0, 1fr) 100px 78px; }

/* Budgets */
.theme-columns { columns: 2; column-gap: 16px; }
.theme-block { margin-bottom: 16px; padding-top: 9px; border-top: 2px solid var(--line-strong); break-inside: avoid; }
.theme-block .block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 4px; }
.theme-block h2 { font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.theme-block .block-head b { color: var(--text); font-weight: 600; }
.theme-block .block-head b.neg { color: var(--neg); }
.theme-block .meter { margin: 2px 0 8px; }
.col-head { display: grid; min-height: 24px; align-items: center; gap: 10px; padding: 0 6px; }
.col-head .num { text-align: right; }
.month-row, .month-head { grid-template-columns: minmax(0, 1fr) 104px 104px 110px 96px; }
.year-row, .year-head { grid-template-columns: minmax(0, 1fr) 100px 100px 104px 300px; }
.year-head .num { white-space: nowrap; }
.year-head .axis { display: grid; grid-template-columns: repeat(12, 1fr); letter-spacing: 0; text-align: center; }
.axis .now { color: var(--text); }
.year-detail > summary { padding: 0 6px; color: inherit; font-size: inherit; list-style: none; }
.year-detail > summary::-webkit-details-marker { display: none; }
.year-detail > summary.muted { color: var(--muted); }
.year-detail[open] > summary { border-bottom: 1px solid var(--line-strong); }
.year-months { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; padding: 6px 6px 8px; font-size: 11px; }
.year-month { display: grid; gap: 2px; padding: 3px 4px; border-radius: 3px; text-align: right; white-space: nowrap; }
.year-month.now > .dim { color: var(--text); }
.year-month.idle { box-shadow: inset 0 0 0 1px var(--warn); }
.year-month a { color: inherit; font-weight: 600; }
.spend-curve { display: block; width: 100%; height: 22px; margin-top: 6px; overflow: visible; }
.spend-curve .pace { fill: none; stroke: var(--muted); stroke-dasharray: 3 3; stroke-width: 1; opacity: .7; vector-effect: non-scaling-stroke; }
.spend-curve .area { fill: color-mix(in srgb, var(--fill) 18%, transparent); }
.spend-curve .line { fill: none; stroke: var(--fill); stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spend-curve.over .area { fill: color-mix(in srgb, var(--neg) 18%, transparent); }
.spend-curve.over .line { stroke: var(--neg); }
.year-line { display: block; width: 100%; height: 22px; overflow: visible; }
.year-line .budget, .year-chart .budget { fill: none; stroke: var(--muted); stroke-dasharray: 3 3; stroke-width: 1; opacity: .8; vector-effect: non-scaling-stroke; }
.year-line .spent, .year-chart .spent { fill: none; stroke: var(--fill); stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.year-line .now { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.year-line circle, .year-chart circle { fill: var(--neg); }
.year-chart circle.ok { fill: var(--fill); }
.year-chart { padding-bottom: 6px; }
.year-chart svg { display: block; width: 100%; height: 96px; overflow: visible; }
.year-chart .area { fill: color-mix(in srgb, var(--fill) 14%, transparent); }
.year-chart .grid { stroke: var(--line); vector-effect: non-scaling-stroke; }
.year-chart .axis { display: grid; grid-template-columns: repeat(12, 1fr); margin-top: 6px; color: var(--muted); font-size: 11px; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.legend b { display: inline-block; width: 14px; height: 2px; margin-right: 6px; background: var(--fill); vertical-align: middle; }
.legend b.dashed { background: repeating-linear-gradient(90deg, var(--muted) 0 3px, transparent 3px 6px); }

/* Projects */
.project-figures { display: grid; grid-template-columns: repeat(3, 180px) minmax(0, 1fr); gap: 20px; align-items: end; margin-bottom: 10px; }
.project-figures .fig { display: block; margin-top: 3px; font-size: 20px; font-weight: 600; }
.meter-caption { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; color: var(--muted); font-size: 11px; }
.block > h2 .row-actions { flex-wrap: wrap; letter-spacing: 0; text-transform: none; }
summary { min-height: var(--row); padding: 4px 0; color: var(--muted); cursor: pointer; font-size: 12px; }

/* Closing */
.closing-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; align-items: start; }
.movement { min-width: 0; padding: 4px 6px 6px; border-top: 1px solid var(--line); }
.movement-line { display: grid; grid-template-columns: auto 90px minmax(0, 1fr) 110px auto; gap: 10px; align-items: center; min-height: var(--row); }
.movement-line .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movement-line .amount { font-weight: 600; text-align: right; }
.movement-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.movement-actions [data-match] { max-width: 100%; height: auto; min-height: 24px; padding: 3px 8px; text-align: left; white-space: normal; }
.movement-actions label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.movement-actions select { width: 300px; height: 24px; font-size: 11.5px; }
.movement .hint { display: block; margin-top: 4px; }
.movement .checkbox-field { margin-top: 4px; }
#closing-unresolved .budget-row { grid-template-columns: minmax(0, 1fr) auto 110px 60px; }
#closing-unresolved .budget-row select { width: 150px; height: 22px; font-size: 11.5px; }

/* Wealth */
.wealth-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 36px; align-items: end; margin-bottom: 18px; }
.net-worth-total { font-size: 40px; font-weight: 600; line-height: 1.1; white-space: nowrap; }
.net-worth-total small { color: var(--muted); font-size: .55em; }
.hero-meta { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.timeline svg { display: block; width: 100%; height: 90px; overflow: visible; }
.timeline .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.timeline .area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.timeline circle { fill: var(--accent); }
.timeline .axis { display: flex; justify-content: space-between; margin-top: 4px; color: var(--muted); font-size: 11px; }
.allocation { display: flex; height: 8px; margin: 10px 0 4px; overflow: hidden; border-radius: 2px; background: var(--track); }
.allocation i { display: block; height: 100%; }
.allocation-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; color: var(--muted); font-size: 11.5px; }
.allocation-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; }
.wealth-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 28px; align-items: start; }
.wealth-grid .inline-form { margin-bottom: 10px; }
.holding-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
#holding-form { margin: 10px 0; }
#instrument-list, #unit-value-history, #valuation-history { margin-top: 10px; }

/* Manage */
.manage-forms { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 28px; align-items: start; }
.manage-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }

@media (max-width: 90rem) {
  .activity-grid { grid-template-columns: 360px minmax(0, 1fr); }
  .activity-grid > :nth-child(3) { grid-column: 1 / -1; }
  .year-row, .year-head { grid-template-columns: minmax(0, 1fr) 96px 96px 100px 200px; }
}

@media (max-width: 64rem) {
  .theme-columns { columns: 1; }
  .closing-grid, .wealth-grid, .manage-forms, .manage-lists, .wealth-hero { grid-template-columns: minmax(0, 1fr); }
  .stat-grid-six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .project-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .project-figures > :last-child { grid-column: 1 / -1; }
  .head-note { display: none; }
}

@media (max-width: 52rem) {
  .app-bar { gap: 12px; padding: 0 16px; }
  .workspace-nav {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    border-top: 1px solid var(--line-strong);
    background: var(--bg);
  }
  .workspace-nav a { min-width: 0; min-height: 48px; justify-content: center; padding: 0 2px; border-bottom: 0; border-top: 2px solid transparent; font-size: clamp(9px, 2.6vw, 11px); }
  .workspace-nav a[aria-current="page"] { border-top-color: var(--accent); }
  main { padding: 16px 16px 80px; }
  .page-head { flex-wrap: wrap; align-items: start; }
  .head-controls { justify-content: start; }
  .activity-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stat-grid, .stat-grid-six { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .fig { font-size: 19px; }
  .inline-form .field, .inline-form .field:first-child { min-width: 0; flex: 1 1 100%; }
  .month-row, .month-head { grid-template-columns: minmax(0, 1fr) 90px 96px; }
  .month-row > :nth-child(2), .month-head > :nth-child(2), .month-row > :nth-child(5), .month-head > :nth-child(5) { display: none; }
  .year-row, .year-head { grid-template-columns: minmax(0, 1fr) 90px 96px; }
  .year-row > :nth-child(2), .year-head > :nth-child(2), .year-row > :nth-child(5), .year-head > :nth-child(5) { display: none; }
  .year-months { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .project-figures { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .movement-line { grid-template-columns: minmax(0, 1fr) auto; }
  .movement-line .label { grid-column: 1 / -1; }
  .movement-actions select { width: 100%; }
  #closing-unresolved .budget-row { grid-template-columns: minmax(0, 1fr) auto; }
  .popover { position: fixed; top: 56px; right: 16px; left: 16px; width: auto; }
  .data-table .hide-phone { display: none; }
  button { min-height: 44px; }
  .row-button, .segmented button, td button, .movement button { min-height: 32px; }
}

@media (max-width: 38rem) {
  .brand strong { display: none; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .taxonomy-row { grid-template-columns: minmax(0, 1fr); padding: 4px 6px; }
  .row-actions { justify-content: start; }
  .net-worth-total { font-size: 30px; }
  .stat-grid-six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
