:root {
  --ink: #292d3e;
  --muted: #697083;
  --brand: #555ed3;
  --accent: #555ed3;
  --paper: #f6f7fb;
  --surface: #fff;
  --line: #e7e9f0;
  --in: #b34742;
  --out: #25745c;
  --chart-0: #555ed3;
  --chart-1: #65998f;
  --chart-2: #a7afce;
  --radius: 16px;
  --accent-soft: #eef0fc;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft Yahei",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.65;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 16px;
  background: var(--surface);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover {
  background: #f0f1fa;
  border-color: #c7cbed;
}
button:active {
  background: #e8eafa;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
a {
  color: var(--accent);
  text-decoration: none;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #858be0;
  outline-offset: 3px;
}
h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}
h1,
h2 {
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  letter-spacing: -0.025em;
}
h1 {
  font-size: 25px;
  font-weight: 650;
  margin-bottom: 5px;
}
h2 {
  font-size: 18px;
}
h3 {
  font-size: 16px;
}
small,
.muted {
  color: var(--muted);
}
small {
  font-size: 12px;
}
strong {
  font-weight: 600;
}
.shell { min-height: 100vh; }
.app-header { display:flex; align-items:center; gap:22px; padding:14px max(28px, calc((100vw - 1320px)/2)); background:var(--surface); border-bottom:1px solid var(--line); }
.brand { display:flex; align-items:center; gap:10px; font-size:20px; font-weight:650; color:var(--ink); white-space:nowrap; }
.brand-mark { width:34px; height:34px; display:grid; place-items:center; border-radius:11px; background:var(--accent); color:white; }
.brand-mark svg { width:21px; height:21px; stroke:currentColor; fill:none; stroke-width:1.7; }
.side-nav { display:flex; align-items:center; gap:6px; }
.side-nav a { display:flex; align-items:center; gap:8px; min-height:44px; padding:10px 16px; border-radius:10px; color:var(--muted); white-space:nowrap; }
.side-nav a:hover, .settings-link:hover { background:var(--paper); }
.side-nav a[aria-current] { background:var(--accent-soft); color:var(--accent); font-weight:600; }
.side-nav svg, .bottom-nav svg, .settings-link svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.6; }
.settings-link { margin-left:0; display:flex; align-items:center; gap:7px; color:var(--muted); padding:10px; border-radius:10px; }
.workspace { min-width:0; }
.topbar { margin-left:auto; padding:0; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.scope { display:flex; gap:3px; padding:3px; background:#eceef5; border-radius:12px; }
.scope button { border:0; background:transparent; padding:6px 12px; color:var(--muted); min-height:38px; }
.scope button[aria-pressed="true"] { background:white; color:var(--accent); font-weight:600; box-shadow:0 1px 4px #292d3e0b; }
.mode { font-size:11px; color:var(--muted); white-space:nowrap; }
main {
  max-width: 1320px;
  margin: auto;
  padding: 28px 28px 72px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}
.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.page-head .actions {
  margin: 0;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 22px 0 34px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 26px 0;
}
.metric {
  padding: 0 28px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.metric:last-child {
  border: 0;
}
.metric > span {
  font-size: 13px;
  color: var(--muted);
}
.metric strong {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: clamp(24px, 2.5vw, 34px);
  letter-spacing: -0.04em;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 22px;
}
.section {
  margin: 0 0 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.section-head h2 {
  margin: 0;
}
.section h2 {
  margin-bottom: 18px;
}
.section-foot {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}
.chart svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 170px;
}
.chart text {
  fill: var(--muted);
  font-size: 11px;
  font-family: inherit;
}
.legend {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--muted);
}
.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.chart-points {
  display: flex;
  gap: 5px;
  overflow: auto;
  padding: 5px 0 8px;
}
.chart-points button {
  min-width: 96px;
  font-size: 11px;
  padding: 7px 8px;
}
.chart-points span {
  display: block;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.bars {
  display: grid;
  gap: 15px;
}
.bar {
  border: 0;
  border-radius: 0;
  text-align: left;
  padding: 0;
  background: transparent;
}
.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.bar-track {
  height: 6px;
  border-radius: 6px;
  background: #f0f1f7;
  overflow: hidden;
  display: block;
}
.bar-track i {
  height: 100%;
  display: block;
  background: var(--accent);
  border-radius: 6px;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.toolbar label {
  max-width: 220px;
  flex: 1;
  min-width: 135px;
}
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 25px;
  overflow: auto;
}
.tabs button {
  white-space: nowrap;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  padding: 12px 18px;
}
.tabs button[aria-selected="true"] {
  color: var(--brand);
  border-color: var(--accent);
  font-weight: 600;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
}
.table td {
  padding: 16px 14px;
  border-bottom: 1px solid #edf1f5;
  font-size: 14px;
}
.table tr:last-child td {
  border: 0;
}
.table .number {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.table button.link {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  min-height: 44px;
  color: var(--accent);
}
.table small {
  display: block;
}
.group-label {
  padding: 12px 14px;
  background: #f1f2f8;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  margin-top: 18px;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  background: #f1f2f8;
  border-radius: 5px;
  margin: 2px 4px 2px 0;
  color: #626784;
}
.in {
  color: var(--in);
}
.out {
  color: var(--out);
}
.notice {
  background: #f8f1e4;
  color: #75562f;
  padding: 13px 16px;
  border-radius: 8px;
  margin: 15px 0;
  font-size: 13px;
}
.error,
.dialog-error {
  background: #fff0ee;
  color: #a13b32;
  border: 1px solid #efd0cc;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 10px 0 20px;
}
.empty,
.loading {
  padding: 54px 24px;
  text-align: center;
  color: var(--muted);
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  min-height: 44px;
  border: 1px solid #cbd5df;
  border-radius: 7px;
  background: white;
  min-width: 0;
}
input[type="checkbox"] {
  width: 19px;
  min-height: 19px;
  height: 19px;
  accent-color: var(--accent);
}
.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 13px 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.wide {
  grid-column: 1/-1;
}
.form-section {
  margin: 24px 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
details summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
  color: var(--accent);
  font-size: 13px;
}
dialog {
  width: min(860px, calc(100% - 40px));
  max-height: 90dvh;
  border: 0;
  border-radius: 16px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 28px 100px #13273b35;
}
dialog::backdrop {
  background: #18293b75;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 21px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.dialog-head h2 {
  margin: 0;
}
.icon-btn {
  font-size: 23px;
  border: 0;
  width: 44px;
  padding: 0;
}
.dialog-body {
  padding: 24px 28px 28px;
}
.dialog-error {
  margin: 15px 28px;
}
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  font-size: 13px;
}
.facts div {
  display: flex;
  flex-direction: column;
}
.facts dt {
  color: var(--muted);
  font-size: 12px;
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.diff section {
  padding: 14px;
  background: var(--paper);
  border-radius: 8px;
}
.review-list article {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.review-list article:first-child {
  padding-top: 5px;
}
.review-list h3 {
  margin-bottom: 8px;
}
.record-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.7fr) 145px 140px 150px;
  gap: 14px;
  align-items: center;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}
.record-row > div > small {
  display: block;
}
.direction {
  display: flex;
  gap: 4px;
}
.direction button {
  padding: 7px 13px;
  min-height: 40px;
}
.direction button[aria-pressed="true"][data-dir="in"] {
  background: #f9e9e7;
  color: var(--in);
  border-color: #d7aaa5;
}
.direction button[aria-pressed="true"][data-dir="out"] {
  background: #e9f3ee;
  color: var(--out);
  border-color: #9ec9b6;
}
.record-extra {
  grid-column: 1/-1;
}
.life-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.life-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 8px;
}
.life-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  background: #eaf0f6;
  border-radius: 12px;
  color: var(--accent);
  font-size: 19px;
  margin-bottom: 12px;
}
.life-item strong {
  font-size: 17px;
}
.life-item small {
  line-height: 1.8;
}
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child {
  border: 0;
}
.list-item h3,
.list-item p {
  margin: 0;
}
.list-item p {
  font-size: 13px;
  color: var(--muted);
}
.bottom-nav {
  display: none;
}
.auth {
  max-width: 460px;
  margin: 12vh auto;
  padding: 36px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.auth h1 {
  margin-bottom: 15px;
}
.auth button {
  width: 100%;
  margin-top: 12px;
}
.auth .mode {
  display: inline-block;
  margin-bottom: 22px;
}
.skip {
  position: absolute;
  top: -80px;
  left: 10px;
  z-index: 10;
  background: #fff;
  padding: 10px;
}
.skip:focus {
  top: 10px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 20px);
  max-width: 90vw;
  padding: 12px 20px;
  background: var(--brand);
  color: white;
  border-radius: 9px;
  box-shadow: 0 6px 25px #0002;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin: 20px 0;
}
.code {
  word-break: break-all;
  white-space: pre-wrap;
  background: var(--paper);
  padding: 16px;
  border-radius: 8px;
  font-size: 13px;
}
.row-title {
  font-weight: 600;
}
.coverage-strip {
  display: flex;
  gap: 4px;
  margin-top: 12px;
}
.coverage-strip span {
  flex: 1;
  min-height: 7px;
  background: #dae6ec;
  border-radius: 3px;
}
.coverage-strip span.known {
  background: var(--accent);
}
@media (max-width: 1150px) {
  .app-header { gap:20px; }
  .side-nav a { padding:10px 12px; }
  main {
    padding: 28px;
  }
  .app-header .topbar { padding:0; gap:8px; }
  .app-header .mode { display:none; }
  .life-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .record-row {
    grid-template-columns: minmax(130px, 1fr) 135px 120px 130px;
  }
  .metric {
    padding: 0 20px;
  }
}
@media (max-width: 760px) {
  :root {
    font-size: 15px;
  }
  .shell {
    display: block;
  }
  .side-nav { display:none; }
  .app-header { padding:12px 18px; flex-wrap:wrap; gap:12px; }
  .app-header .topbar { order:3; flex-basis:100%; justify-content:space-between; }
  .app-header .mode { display:inline; }
  .settings-link { margin-left:auto; }
  .brand { font-size:18px; }
  .settings-link span { display:none; }
  .workspace {
    width: 100%;
  }
  .topbar {
    padding: 14px 18px;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }
  .mode {
    font-size: 11px;
  }
  .scope {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow: auto;
  }
  .scope button {
    white-space: nowrap;
    padding: 5px 12px;
  }
  .topbar > .muted {
    display: none;
  }
  main {
    padding: 24px 18px 105px;
  }
  .page-head {
    align-items: flex-start;
    margin-bottom: 22px;
    gap: 14px;
  }
  .page-head .actions {
    gap: 6px;
  }
  .page-head .actions button {
    padding: 8px 12px;
    font-size: 13px;
  }
  .page-head h1 {
    font-size: 25px;
  }
  .page-head p {
    font-size: 12px;
  }
  .metrics {
    padding: 20px 0;
    margin: 18px 0 24px;
    grid-template-columns: 1fr 1fr;
  }
  .metric {
    padding: 0 16px;
  }
  .metric:first-child {
    grid-column: 1/-1;
    border: 0;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
  }
  .metric:first-child strong {
    font-size: 34px;
  }
  .metric strong {
    font-size: 22px;
  }
  .metric > span {
    font-size: 12px;
  }
  .metric small {
    font-size: 11px;
  }
  .section {
    padding: 19px 16px;
    margin-bottom: 22px;
  }
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .section-head h2,
  h2 {
    font-size: 18px;
  }
  .toolbar {
    gap: 10px;
  }
  .toolbar label {
    min-width: 125px;
    max-width: 100%;
  }
  .tabs {
    margin-bottom: 20px;
  }
  .tabs button {
    padding: 10px 14px;
  }
  .table thead {
    display: none;
  }
  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
  }
  .table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    gap: 4px 10px;
  }
  .table td {
    padding: 0;
    border: 0;
    font-size: 13px;
  }
  .table td:first-child {
    grid-column: 1/-1;
  }
  .table td.number {
    grid-column: 2;
    grid-row: 2;
  }
  .table td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--muted);
    font-size: 11px;
  }
  .table small {
    font-size: 11px;
  }
  .group-label {
    padding: 9px 12px;
    margin-top: 10px;
  }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    justify-content: space-around;
    align-items: center;
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    z-index: 5;
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--muted);
    font-size: 10px;
    min-width: 52px;
    min-height: 45px;
  }
  .bottom-nav a[aria-current] {
    color: var(--accent);
    font-weight: 600;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .diff {
    grid-template-columns: 1fr;
  }
  .record-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .record-row > .record-identity {
    grid-column: 1/-1;
  }
  .record-row > .direction {
    grid-column: 1/-1;
  }
  .record-row label {
    font-size: 12px;
  }
  .record-extra {
    grid-column: 1/-1;
  }
  .life-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .life-item {
    padding: 16px;
  }
  .life-item strong {
    font-size: 15px;
  }
  .life-item small {
    font-size: 11px;
  }
  .life-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
    margin-bottom: 5px;
  }
  .facts {
    grid-template-columns: 1fr 1fr;
  }
  dialog {
    width: calc(100% - 16px);
    max-height: 94dvh;
    border-radius: 13px;
  }
  .dialog-head {
    padding: 16px 18px;
  }
  .dialog-body {
    padding: 20px 18px;
  }
  .dialog-error {
    margin: 10px 18px;
  }
  .actions {
    gap: 8px;
  }
  .actions button {
    flex: 1;
  }
  .auth {
    margin: 6vh 16px;
    padding: 27px;
  }
  .list-item {
    gap: 12px;
  }
  .list-item button {
    padding: 8px 10px;
    font-size: 12px;
  }
  #toast {
    bottom: 90px;
  }
  .chart svg {
    min-height: 140px;
  }
  .chart-points button {
    min-width: 88px;
  }
  .chart text {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.chart-selection {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
  margin: 12px 0 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.chart-selection label {
  flex-direction: row;
  align-items: center;
  font-size: 12px;
  white-space: nowrap;
}
.chart-selection select {
  padding: 6px 8px;
  min-height: 38px;
  max-width: 145px;
  font-size: 12px;
}
.plot-point[role="button"] {
  cursor: pointer;
}
.plot-point .point-ring {
  opacity: 0;
}
.plot-point.selected .point-ring,
.plot-point:hover .point-ring,
.plot-point:focus .point-ring {
  opacity: 1;
}
.account-group > summary {
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  padding: 15px 4px;
}
.account-group {
  margin-bottom: 15px;
}
@media (max-width: 760px) {
  .chart-selection {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .section-head {
    flex-wrap: wrap;
  }
  .section-head button {
    font-size: 12px;
  }
}
@media (min-width: 761px) {
  .record-row {
    grid-template-columns: minmax(160px, 1.5fr) 126px 130px 130px 46px;
    gap: 12px;
    padding: 12px 0;
  }
  .record-extra {
    grid-column: 5;
    align-self: center;
  }
  .record-extra > summary {
    font-size: 12px;
    white-space: nowrap;
    list-style: none;
    padding: 10px 4px;
    text-align: center;
  }
  .record-extra[open] {
    grid-column: 1/-1;
  }
  .record-extra[open] > summary {
    text-align: left;
  }
  .record-identity > small:nth-child(2) {
    display: none;
  }
  .record-row label {
    font-size: 11px;
    gap: 3px;
  }
  .record-row input {
    padding: 9px 10px;
  }
  .record-row input:disabled {
    background: #f7f9fb;
    color: var(--muted);
    border-color: #e7ecf2;
  }
  .direction button {
    padding: 7px 12px;
  }
  .record-extra[open] .form-grid {
    background: var(--paper);
    padding: 16px;
    border-radius: 8px;
  }
}
.page-head .actions button {
  white-space: nowrap;
}
.allocations small {
  display: block;
}
@media (max-width: 760px) {
  .page-head {
    flex-wrap: wrap;
  }
  .page-head > .actions {
    margin-left: auto;
  }
  .page-head h1 {
    overflow-wrap: anywhere;
  }
}

/* The amount is the headline; surfaces group tasks, not every individual fact. */
.hero-metrics { background:transparent; border:0; padding:8px 0 10px; grid-template-columns:1.6fr 1fr 1fr; margin:12px 0 28px; align-items:center; }
.hero-metrics .metric:first-child { padding-left:0; }
.hero-metrics .metric:first-child strong { font-size:clamp(38px, 4vw, 52px); letter-spacing:-.045em; font-weight:650; }
.hero-metrics .metric:not(:first-child) strong { font-size:28px; }
.hero-metrics .metric small { max-width:280px; }
.summary-note { font-size:12px; color:var(--muted); margin:-14px 0 24px; }
.section-head h2 { margin-bottom:0; }
.section-head > small { text-align:right; }
.bar { padding:10px 8px; border-radius:8px; }
.bar:hover { background:var(--paper); }
.bar-track { height:7px; }
.bar:nth-child(3n+2) .bar-track i { background:#8e9dbc; }
.bar:nth-child(3n+3) .bar-track i { background:#a69d89; }
.bar-meta { display:flex; justify-content:space-between; color:var(--muted); font-size:11px; margin-top:7px; }
.bar[aria-pressed="true"] { background:var(--accent-soft); }
.inline-notice { display:flex; justify-content:space-between; align-items:center; gap:16px; background:#f0f1fc; color:var(--accent); padding:12px 18px; margin-bottom:22px; border-radius:10px; font-size:13px; }
.account-owner td { background:var(--paper); padding:10px 14px; color:var(--ink); font-weight:600; }
.account-owner small { display:inline; margin-left:8px; font-weight:400; }
.account-table .account-name { min-width:180px; }
.account-table .number { font-size:16px; font-weight:600; }
.account-table td { padding:10px 14px; }
.account-table td:first-child small { color:var(--muted); }
.segmented { display:flex; gap:3px; padding:3px; background:#eceef5; border-radius:10px; }
.segmented button { border:0; background:transparent; color:var(--muted); }
.segmented button[aria-pressed="true"] { background:white; color:var(--accent); box-shadow:0 1px 4px #292d3e0b; }
.period-controls { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:20px; }
.period-controls label { max-width:190px; }
.period-controls input { background:transparent; }
.period-step { display:flex; align-items:center; gap:5px; }
.period-step > button { width:42px; padding:8px; background:transparent; }
.active-filters { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:0 0 16px; font-size:12px; color:var(--muted); }
.active-filters .tag { background:var(--accent-soft); color:var(--accent); font-size:12px; }
#tx-details { scroll-margin-top:24px; }
.record-actions { position:sticky; bottom:0; background:white; border-top:1px solid var(--line); padding:14px 0; z-index:2; }
.record-progress { margin-right:auto; color:var(--muted); font-size:12px; }
.record-help { margin:18px 0 0; color:var(--muted); font-size:13px; }
.record-row[data-idle="true"] > label { visibility:hidden; }
.record-row .movement-field[data-inactive="true"] { visibility:hidden; }
.record-row[data-idle="true"] { opacity:.85; }
.chart path { stroke-linejoin:round; stroke-linecap:round; }
main[aria-busy="true"] { cursor:progress; }
@media (max-width:760px) {
  .hero-metrics { grid-template-columns:1fr 1fr; margin-bottom:22px; }
  .hero-metrics .metric:first-child { padding:0 0 16px; margin-bottom:16px; }
  .hero-metrics .metric:not(:first-child) { padding-left:0; border:0; }
  .hero-metrics .metric:first-child strong { font-size:42px; }
  .hero-metrics .metric:not(:first-child) strong { font-size:24px; }
  .hero-metrics .metric small { font-size:11px; }
  .topbar { padding-bottom:0; }
  .scope button { padding:5px 12px; }
  .mode { font-size:10px; }
  .account-table .account-owner { display:block; padding:8px 10px; background:var(--paper); }
  .account-table .account-owner td { padding:0; font-size:13px; }
  .account-table td { padding:0; }
  .account-table .account-name { min-width:0; }
  .period-controls { gap:8px; }
  .period-controls .segmented { width:100%; }
  .period-controls .segmented button { flex:1; }
  .period-step { width:100%; }
  .period-step label { flex:1; max-width:none; }
  .period-step input { text-align:center; }
  .record-actions { bottom:0; gap:8px; }
  .record-progress { flex-basis:100%; }
  .record-actions button { font-size:13px; }
  .record-row[data-idle="true"] > label, .record-row .movement-field[data-inactive="true"] { display:none; }
  .record-row[data-idle="true"] > .record-extra { display:none; }
  .record-identity > small:nth-child(2) { display:none; }
  .record-row > .direction { grid-column:auto; }
}

#main:focus { outline:none; }
.app-header .mode { max-width:72px; white-space:normal; line-height:1.4; }
.period-step { align-items:end; }
.chart-note summary { padding:8px 0 0; min-height:32px; font-size:12px; color:var(--muted); }
.chart-note .section-foot { border:0; margin-top:0; padding-top:8px; }
.record-row > .direction button { min-height:44px; }
@media (min-width:761px) and (max-width:1000px) { .side-nav svg { display:none; } .side-nav a { padding:10px; } .brand { font-size:17px; } .app-header { gap:14px; } }
@media (max-width:760px) { .app-header .mode { max-width:none; } }

@media (max-width:760px) {
  #record-form > .form-grid { grid-template-columns:1fr 1fr; gap:12px; }
  #record-form > .form-grid input, #record-form > .form-grid select { padding:10px 8px; font-size:12px; }
  .record-actions button { white-space:nowrap; }
  .record-row:has(.movement-field[data-inactive="false"]) > .direction { grid-column:1/-1; }
  .chart text { font-size:12px; }
}

.chart svg { max-height:330px; }

.life-category { color:var(--accent); font-size:12px; margin-bottom:4px; }
.life-item > strong > small { margin-left:7px; font-weight:400; }
.life-tags { display:flex; flex-wrap:wrap; gap:3px; margin-top:4px; }
.life-item { gap:8px; }

/* Business navigation stays identical on desktop and mobile. */
.public-tools { margin-left:auto; display:flex; align-items:center; gap:10px; }
.queue-link { display:flex; align-items:center; gap:6px; min-height:44px; color:var(--muted); padding:8px; border-radius:9px; white-space:nowrap; }
.queue-link svg { width:20px; height:20px; stroke:currentColor; fill:none; stroke-width:1.6; }
.queue-link[aria-current], .settings-link[aria-current] { background:var(--accent-soft); color:var(--accent); }
.count-badge { min-width:19px; height:19px; line-height:19px; text-align:center; border-radius:10px; font-size:11px; color:white; background:var(--accent); }
.count-badge[hidden] { display:none; }
.page-context { max-width:1320px; margin:auto; padding:18px 28px 0; display:flex; align-items:center; justify-content:space-between; gap:14px; }
.scope-control { display:flex; align-items:center; gap:12px; font-size:12px; color:var(--muted); }
.page-context > .mode { margin-left:auto; }
.asset-summary { grid-template-columns:1.6fr 1fr; }
.overview-date { display:flex; justify-content:flex-end; margin-top:-5px; }
.overview-date label { flex-direction:row; align-items:center; gap:12px; white-space:nowrap; }
.overview-date select { width:auto; }
.record-warning { font-size:12px; color:var(--muted); margin-bottom:20px; }
.record-warning summary { color:var(--muted); }
.queue-empty { text-align:center; padding:65px 22px; }
.queue-empty p { color:var(--muted); font-size:14px; }
.tabs:empty { display:none; }
#life-filters[hidden] { display:none; }
.history-context { font-size:13px; color:var(--muted); }
.public-tools a { white-space:nowrap; }
@media (min-width:761px) and (max-width:1080px) {
  .side-nav svg { display:none; }
  .side-nav a { padding:10px 9px; }
  .app-header { gap:12px; padding:12px 20px; }
  .brand { font-size:17px; }
  .public-tools { gap:2px; }
  .settings-link span { display:none; }
}
@media (max-width:760px) {
  .app-header { flex-wrap:nowrap; gap:8px; }
  .public-tools { gap:2px; }
  .queue-link { font-size:12px; padding:7px; }
  .queue-link svg { width:18px; }
  .page-context { padding:14px 18px 0; flex-wrap:wrap; gap:7px; }
  .scope-control { flex-wrap:wrap; gap:6px; width:100%; }
  .scope-control > span { min-width:48px; }
  .scope button { padding:5px 10px; }
  .page-context > .mode { margin-left:0; }
  .asset-summary { grid-template-columns:1fr; }
  .asset-summary .metric:not(:first-child) { padding:0; }
  .overview-date { justify-content:flex-start; }
  .overview-date label { width:100%; justify-content:space-between; }
  .overview-date select { flex:1; max-width:205px; }
  .bottom-nav a { min-width:58px; }
}

/* The chart is the primary date control; its window never follows a point click. */
.trend-ranges { width:max-content; max-width:100%; margin-bottom:18px; }
.trend-ranges button { min-height:40px; }
.focused-trend { min-width:0; }
.trend-svg { width:100%; display:block; overflow:visible; }
.trend-svg text { fill:var(--muted); font-size:12px; font-family:inherit; }
.trend-grid { stroke:var(--line); stroke-dasharray:3 5; }
.trend-zero { stroke:var(--muted); stroke-opacity:.45; }
.trend-line { fill:none; stroke:var(--accent); stroke-width:2.5; stroke-linejoin:round; }
.trend-line.secondary { stroke:#83a49d; stroke-dasharray:6 4; }
.trend-area { fill:var(--accent); fill-opacity:.07; stroke:none; }
.trend-guide { stroke:var(--accent); stroke-opacity:.3; stroke-dasharray:4 4; }
.trend-point { cursor:pointer; outline:none; }
.trend-dot { fill:var(--accent); }
.trend-dot.secondary { fill:#83a49d; }
.trend-ring { fill:white; stroke:var(--accent); stroke-width:2; opacity:0; }
.trend-point.selected .trend-ring,.trend-point:focus .trend-ring,.trend-point:hover .trend-ring { opacity:1; }
.trend-legend { display:flex; gap:18px; flex-wrap:wrap; color:var(--muted); font-size:12px; margin:12px 0; }
.trend-legend span { display:flex; gap:7px; align-items:center; }
.trend-legend i { width:18px; border-top:2px solid var(--accent); }
.trend-legend i.secondary { border-top:2px dashed #83a49d; }
.trend-readout { border-top:1px solid var(--line); padding-top:14px; margin-top:6px; display:flex; gap:12px; justify-content:space-between; align-items:center; flex-wrap:wrap; }
.trend-readout label { font-size:11px; color:var(--muted); min-width:140px; }
.trend-readout select { max-width:100%; min-height:42px; font-size:12px; }
.trend-readout > div { display:flex; gap:20px; flex-wrap:wrap; }
.trend-readout strong { font-size:17px; font-weight:600; font-variant-numeric:tabular-nums; }
.trend-readout small { color:var(--muted); display:block; font-size:11px; }
.trend-readout > small { flex-basis:100%; }
.investment-controls { display:flex; align-items:end; justify-content:space-between; flex-wrap:wrap; gap:14px; }
.investment-controls .trend-ranges { margin:0; }
.investment-controls label { font-size:12px; }
.investment-period { color:var(--muted); font-size:12px; margin:18px 0 0; }
.investment-modes { display:grid; grid-template-columns:repeat(4,1fr); margin:4px 0 16px; width:100%; }
.investment-modes button { font-size:12px; min-height:42px; padding:7px 8px; }
.estimate-note { font-size:12px; color:var(--muted); margin:-8px 0 24px; }
.investment-method { font-size:13px; color:var(--muted); }
.investment-method .check { margin-top:18px; }
#investment-contribution h2 { margin-bottom:8px; }
#investment-contribution .bar-label small { display:block; color:var(--muted); font-weight:400; font-size:11px; margin-top:3px; }
#investment-contribution .bar-track .negative { background:var(--green,#25745c); }
@media(max-width:760px) {
  .investment-controls { display:block; }
  .investment-controls > label { margin-top:14px; }
  .investment-controls select { width:100%; }
  .investment-modes button { font-size:11px; padding:7px 3px; }
  .trend-ranges { display:flex; width:100%; }
  .trend-ranges button { flex:1; padding:7px; font-size:12px; }
  .trend-readout { display:block; }
  .trend-readout label { width:100%; }
  .trend-readout > div { margin-top:12px; gap:18px; }
  .trend-readout > small { margin-top:10px; }
  .investment-summary .metric:first-child { grid-column:1/-1; }
}
@media(max-width:760px) { .trend-svg text { font-size:15px; } }

/* Task-first refinement: one page header, compact results, then evidence. */
:root { --radius:14px; --muted:#626b7c; --paper:#f5f6fa; }
.app-header { padding-top:10px; padding-bottom:10px; }
main { max-width:1280px; padding:24px 32px 64px; }
.business-head { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:28px; margin-bottom:24px; }
.business-head h1 { font-size:24px; margin:0; }
.business-head .scope-control { justify-self:start; gap:8px; }
.business-head .heading-copy p { font-size:12px; margin-top:3px; }
.business-head .actions:empty { display:none; }
.scope { background:transparent; border:1px solid var(--line); border-radius:10px; padding:2px; }
.scope button { min-height:38px; padding:5px 13px; }
.scope button[aria-pressed="true"] { background:var(--accent-soft); box-shadow:none; }
.scope-control > span { font-size:11px; }
.public-tools .mode { font-size:11px; max-width:none; white-space:nowrap; }
.text-action { display:inline-flex; align-items:center; min-height:44px; font-size:13px; }
.hero-metrics { margin:8px 0 18px; padding:0; gap:0; grid-template-columns:1.35fr 1fr 1fr; }
.hero-metrics .metric { padding:4px 24px; gap:4px; }
.hero-metrics .metric:first-child { padding-left:0; }
.hero-metrics .metric:first-child strong { font-size:40px; line-height:1.25; }
.hero-metrics .metric:not(:first-child) strong { font-size:26px; line-height:1.3; }
.hero-metrics .metric small { font-size:12px; }
.asset-summary { grid-template-columns:1.4fr 1fr; }
.record-warning { margin:0 0 14px; }
.record-warning summary { min-height:32px; }
.grid-2 { grid-template-columns:minmax(0,1.9fr) minmax(280px,1fr); gap:18px; align-items:start; }
.section { padding:20px; margin-bottom:20px; box-shadow:none; }
.section-head { margin-bottom:14px; }
.section h2, .section-head h2 { font-size:17px; margin-bottom:0; }
.trend-heading { flex-wrap:wrap; }
.trend-heading .trend-ranges { margin:0 0 0 auto; }
.trend-ranges button { padding:6px 12px; }
.trend-legend { margin:8px 0; }
.trend-readout { padding-top:10px; }
.trend-readout label { display:flex; align-items:center; gap:8px; }
.trend-readout select { width:auto; }
.trend-readout strong { font-size:15px; }
.trend-readout > div { gap:14px; }
.bars { gap:4px; margin-top:12px; }
.bar { padding:12px 5px; }
.bar-track { height:5px; }
.bar-label { margin-bottom:7px; }
.bar-meta { margin-top:5px; }
.investment-controls { align-items:center; }
.investment-controls > label { display:flex; align-items:center; gap:10px; }
.investment-controls select { max-width:260px; }
.investment-period { margin:12px 0; }
.investment-modes { margin:0 0 8px; background:var(--paper); }
.estimate-note { margin:0 0 14px; font-size:12px; }
.investment-method { background:transparent; border:0; padding:0; }
.investment-method summary { min-height:44px; }
#investment-contribution .section-foot { border:0; padding:0; margin:6px 0; }
.investment-visuals > .section > .section-foot { font-size:11px; padding-top:8px; margin-top:10px; }
.tabs { margin-bottom:16px; }
.period-controls { margin-bottom:14px; gap:16px; }
.period-controls label { flex-direction:row; align-items:center; gap:8px; }
.period-step { align-items:center; }
.period-step label { max-width:240px; }
.toolbar { margin-bottom:16px; }
.toolbar label { font-size:12px; }
.toolbar input, .toolbar select { min-height:44px; }
.filter-chips { display:flex; gap:5px; align-items:center; flex-wrap:wrap; }
.filter-chips button { min-height:44px; border:0; padding:8px 14px; background:transparent; color:var(--muted); }
.filter-chips button[aria-pressed="true"] { color:var(--accent); background:var(--accent-soft); font-weight:600; }
.account-tools { justify-content:space-between; align-items:center; }
.account-tools > label { flex:0 1 240px; }
.account-groups { display:grid; gap:20px; }
.account-group { min-width:0; }
.account-group > header { display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--paper); border-radius:8px; }
.account-group h3 { margin:0; font-size:14px; }
.account-group .table { margin:0; table-layout:fixed; }
.account-group th:first-child { width:40%; }
.account-group th:nth-child(2) { width:15%; }
.account-group th:nth-child(3) { width:22%; }
.account-group th:last-child { width:23%; }
.account-group + .account-group thead { visibility:collapse; }
.account-group th { background:transparent; font-size:11px; padding:8px 12px; }
.account-group td { padding:7px 12px; }
.table .link { color:var(--ink); font-weight:550; text-align:left; }
.table .link:hover { color:var(--accent); }
.table small { margin-top:2px; }
.transaction-table td { padding:8px 12px; }
.transaction-table td:first-child { width:47%; }
.transaction-table .link { min-height:32px; padding:3px 0; }
.transaction-table td:first-child > small { font-size:11px; display:flex; gap:4px; flex-wrap:wrap; align-items:center; }
.transaction-table .tag { margin:0; font-size:11px; padding:1px 6px; }
.transaction-table .number { font-weight:550; white-space:nowrap; }
.transaction-table .number small { font-weight:400; }
.expense-composition .bar { padding:9px 4px; }
#tx-filter-form { display:grid; grid-template-columns:minmax(180px,1.5fr) repeat(3,minmax(110px,1fr)) auto; align-items:end; gap:10px; }
#tx-filter-form label { min-width:0; max-width:none; }
.management-overview { display:grid; grid-template-columns:1.1fr 1fr; gap:28px; align-items:start; margin:8px 0 24px; }
.management-metrics { border:0; background:transparent; padding:12px 0; margin:0; display:grid; grid-template-columns:1fr 1fr; }
.management-metrics .metric { padding:0 20px; }
.management-metrics .metric:first-child { padding-left:0; }
.management-metrics strong { font-size:30px; }
.upcoming { border-left:2px solid #d5c7a7; padding:0 0 0 20px; }
.upcoming h2 { font-size:13px; margin:0 0 8px; color:#786344; }
.upcoming h2 small { font-weight:400; margin-left:6px; }
.upcoming > button, .upcoming details button { width:100%; display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:left; padding:7px 0; border:0; background:transparent; }
.upcoming button strong, .upcoming button small { display:block; font-size:12px; }
.upcoming button strong { color:var(--ink); }
.due-label { color:#80633c; font-size:12px; }
.management-list .life-grid { gap:14px; }
.management-list .life-item { border:1px solid var(--line); border-radius:10px; padding:18px; gap:8px; background:var(--surface); box-shadow:none; text-align:left; }
.life-item:hover { border-color:#bfc3df; background:#fbfbfe; }
.life-card-top { display:flex; justify-content:space-between; align-items:center; gap:10px; width:100%; }
.status-label { font-size:11px; background:var(--paper); color:var(--muted); padding:2px 7px; border-radius:5px; white-space:nowrap; }
.life-name { font-size:17px; }
.life-price { display:flex; align-items:baseline; gap:7px; margin-top:5px; }
.life-price strong { font-size:23px; }
.life-card-foot { display:flex; flex-direction:column; gap:6px; border-top:1px solid var(--line); padding-top:12px; margin-top:4px; width:100%; }
.life-card-foot small { font-size:12px; line-height:1.6; }
.life-category { margin:0; }
.life-tags .tag { font-size:11px; }
@media (min-width:761px) and (max-width:1080px) {
  .business-head { gap:14px; }
  .scope-control > span { display:none; }
  .public-tools .mode { display:none; }
}
@media (max-width:760px) {
  main { padding:18px 16px 100px; }
  .app-header { padding:8px 16px; }
  .public-tools .mode { display:none; }
  .business-head { grid-template-columns:1fr auto; gap:12px; margin-bottom:18px; }
  .business-head h1 { font-size:23px; }
  .business-head .heading-copy { grid-column:1; grid-row:1; }
  .business-head .actions { grid-column:2; grid-row:1; gap:6px; }
  .business-head .scope-control { grid-column:1/-1; grid-row:2; width:auto; gap:8px; flex-wrap:nowrap; }
  .scope button { min-height:44px; }
  .scope-control > span { font-size:11px; min-width:0; }
  .hero-metrics { grid-template-columns:1fr 1fr; margin:10px 0 18px; gap:12px; }
  .hero-metrics .metric:first-child { grid-column:1/-1; padding:0; margin:0; border:0; }
  .hero-metrics .metric:first-child strong { font-size:36px; }
  .hero-metrics .metric:not(:first-child) { padding:0; border:0; }
  .hero-metrics .metric:not(:first-child) strong { font-size:22px; }
  .hero-metrics .metric small { font-size:11px; }
  .asset-summary { grid-template-columns:1fr; gap:12px; }
  .asset-summary .metric:not(:first-child) { display:flex; flex-direction:row; align-items:baseline; flex-wrap:wrap; gap:5px 10px; }
  .asset-summary .metric:not(:first-child) strong { font-size:20px; }
  .asset-summary .metric:not(:first-child) small { flex-basis:100%; }
  .grid-2 { grid-template-columns:1fr; gap:0; }
  .section { padding:16px; margin-bottom:16px; }
  .section-head { gap:8px; flex-wrap:wrap; }
  .section-head > small { font-size:11px; }
  .trend-heading { gap:10px; }
  .trend-heading .trend-ranges { margin:0; width:auto; }
  .trend-heading .trend-ranges button { padding:6px 10px; min-height:44px; }
  .trend-ranges { width:100%; }
  .trend-readout { display:flex; }
  .trend-readout label { width:auto; }
  .trend-readout > div { margin:0; }
  .trend-readout strong { font-size:14px; }
  .trend-readout select { max-width:170px; }
  .investment-controls { display:flex; gap:8px; }
  .investment-controls > label { width:100%; margin:0; }
  .investment-controls select { max-width:none; flex:1; }
  .investment-modes button { min-height:44px; font-size:12px; }
  .investment-period { font-size:11px; }
  .period-controls { gap:8px; }
  .period-controls .segmented { width:auto; }
  .period-step { width:auto; flex:1; }
  .period-step label { width:100%; min-width:0; }
  .period-step label > input { width:100%; min-width:0; }
  .period-step label { font-size:0; }
  .period-step input { font-size:14px; padding:8px 4px; }
  .period-step > button { width:32px; min-width:32px; padding:4px; }
  .period-controls .segmented button { padding:7px 10px; }
  .account-tools > label { flex-basis:100%; width:100%; }
  .account-tools label input { font-size:16px; }
  .account-group .table { table-layout:auto; }
  .account-group td { padding:0; }
  .account-group thead { display:none; }
  .account-group td.account-name { grid-column:1; grid-row:1; }
  .account-group td.number { grid-column:2; grid-row:1; align-self:center; }
  .account-group td:nth-child(2) { grid-column:2; text-align:right; }
  .account-group td:nth-child(3) { grid-column:1; grid-row:2; font-size:11px; }
  .account-group .account-name small { font-size:11px; overflow-wrap:anywhere; }
  .account-group .link { min-height:44px; }
  .transaction-table tr { grid-template-columns:minmax(0,1fr) auto; padding:12px 0; }
  .transaction-table td:first-child { grid-column:1; width:auto; grid-row:1; }
  .transaction-table td.number { grid-column:2; grid-row:1; align-self:start; padding-top:7px; }
  .transaction-table td:nth-child(2) { grid-column:1; font-size:11px; display:flex; align-items:center; gap:6px; }
  .transaction-table td:nth-child(3) { grid-column:2; grid-row:2; font-size:11px; color:var(--muted); text-align:right; }
  .transaction-table .link { min-height:44px; font-size:14px; }
  .transaction-table td { padding:0; }
  #tx-filter-form { grid-template-columns:1fr 1fr; gap:8px; }
  #tx-filter-form > label:first-child { grid-column:1; }
  #tx-filter-form > label:last-of-type { grid-column:1; grid-row:3; }
  #tx-filter-form > button { grid-column:2; grid-row:3; }
  #tx-filter-form input, #tx-filter-form select { font-size:16px; padding:8px; }
  .investment-table tr { grid-template-columns:1fr 1fr; }
  .investment-table td:first-child { grid-column:1/-1; }
  .investment-table td:nth-child(2) { grid-column:1/-1; }
  .investment-table td.number { grid-row:auto; grid-column:auto; text-align:left; }
  .investment-table td.number:before { display:block; }
  .management-overview { grid-template-columns:1fr; gap:18px; margin-bottom:18px; }
  .management-metrics { grid-template-columns:1fr 1fr; padding:0; }
  .management-metrics .metric:first-child { grid-column:auto; margin:0; padding:0 12px 0 0; border-bottom:0; }
  .management-metrics .metric { padding:0 0 0 12px; }
  .management-metrics strong { font-size:26px; }
  .upcoming { padding-left:12px; }
  .upcoming > button { min-height:44px; }
  .management-list .life-grid { grid-template-columns:1fr; }
  .management-list .life-item { padding:16px; }
  .life-price strong { font-size:23px; }
  .life-item small { font-size:12px; }
  #life-filters { display:grid; grid-template-columns:1fr 1fr; }
  #life-filters label { min-width:0; }
  #life-filters input, #life-filters select { font-size:16px; padding:8px; }
}
.investment-controls > label { flex-direction:row; white-space:nowrap; }
.period-controls label { white-space:nowrap; }
.trend-legend:has(> span:only-child) { display:none; }
.dialog-head { padding:12px 24px; }
.dialog-body { padding:18px 24px 24px; }
dialog:where(:has(#record-form)) { width:min(1060px,calc(100% - 32px)); }
#record-form .group-label { padding:6px 12px; margin:10px 0 0; font-size:13px; }
#record-form .record-help { margin:12px 0; }
#record-form .record-row { padding-top:10px; padding-bottom:10px; }
@media(max-width:760px) {
  .public-tools .mode { display:block; font-size:10px; white-space:normal; max-width:48px; }
  .app-header .brand { font-size:17px; gap:7px; }
  .app-header .brand-mark { width:30px; height:30px; }
  .public-tools { gap:0; }
  .dialog-head { padding:9px 16px; }
  .dialog-body { padding:14px 16px 20px; }
  #record-form > .form-grid input,#record-form > .form-grid select,.record-row input { font-size:16px; }
}
.table button.link { color:var(--ink); }
.table button.link:hover { color:var(--accent); }
button.link:not(.table button) { border:0; background:transparent; color:var(--accent); padding:6px 0; }
@media(max-width:760px) {
  .trend-heading .trend-ranges button { white-space:nowrap; flex:0 0 auto; }
  #tx-filter-form > label:last-of-type { grid-column:auto; grid-row:auto; }
  #tx-filter-form > button { grid-column:1/-1; grid-row:auto; }
}

/* Detail reading: ownership → category → account, evidence on demand. */
.detail-toolbar { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:end; gap:16px; margin:20px 0 8px; }
.detail-search-sort { display:flex; flex-wrap:wrap; gap:12px; align-items:end; margin:12px 0 20px; }
.detail-toolbar .detail-search-sort { margin:0; }
.detail-search-sort label { min-width:150px; margin:0; }
.detail-search-sort label:first-child { flex:1; }
.detail-search-sort input { width:100%; }
.detail-toolbar .filter-chips small { margin-left:6px; opacity:.7; }
.detail-filter-context { display:flex; justify-content:space-between; align-items:center; min-height:38px; color:var(--muted); font-size:12px; margin-bottom:12px; }
.owner-sheets { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; align-items:start; }
.owner-sheets:has(> :only-child) { grid-template-columns:1fr; }
.owner-sheet,.investment-sheet { border:1px solid var(--line); border-radius:16px; background:#fff; overflow:hidden; min-width:0; }
.owner-sheet-head { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:20px; background:#fafbfe; }
.owner-sheet-head h3 { margin:0 0 5px; font-size:16px; }
.owner-sheet-head small { color:var(--muted); font-size:12px; display:block; }
.owner-amount { text-align:right; }
.owner-amount strong { display:block; margin-top:4px; font-size:22px; font-weight:650; font-variant-numeric:tabular-nums; }
.owner-allocation { display:flex; gap:2px; height:4px; margin:0 20px; overflow:hidden; border-radius:3px; }
.tone-cash { background:#666bd6; }
.tone-invest { background:#7f9b95; }
.tone-fund { background:#a6accb; }
.tone-other { background:#afa593; }
.account-category { padding:0 16px; border:0; }
.account-category+ .account-category { border-top:1px solid var(--line); }
.account-category>summary { display:flex; align-items:center; gap:10px; list-style:none; min-height:64px; cursor:pointer; }
.account-category summary::-webkit-details-marker,.account-disclosure summary::-webkit-details-marker,.investment-disclosure summary::-webkit-details-marker { display:none; }
.category-title { display:flex; align-items:center; gap:8px; font-weight:600; }
.category-title small { color:var(--muted); font-weight:400; }
.category-marker { width:7px; height:7px; border-radius:50%; }
.category-total { margin-left:auto; text-align:right; font-size:14px; font-weight:600; font-variant-numeric:tabular-nums; }
.category-total small { display:block; font-size:11px; font-weight:400; color:var(--muted); }
.detail-chevron { color:var(--muted); font-size:20px; line-height:1; display:block; transition:transform .15s; width:14px; text-align:center; }
details[open]>summary>.detail-chevron { transform:rotate(90deg); }
.account-category-rows { padding-bottom:14px; }
.account-disclosure { border-radius:9px; margin-bottom:4px; background:#f7f8fc; overflow:hidden; }
.account-disclosure>summary { padding:12px; display:grid; grid-template-columns:minmax(0,1fr) auto 12px; gap:12px; align-items:center; list-style:none; cursor:pointer; min-height:70px; }
.account-disclosure>summary:hover,.investment-disclosure>summary:hover { background:#eef0f9; }
.account-identity { min-width:0; }
.account-identity strong { display:block; overflow-wrap:anywhere; font-weight:550; font-size:14px; }
.account-identity small { color:var(--muted); display:block; font-size:11px; margin-top:5px; }
.account-values { text-align:right; font-variant-numeric:tabular-nums; }
.account-values strong { font-size:16px; font-weight:600; white-space:nowrap; }
.account-values small { display:block; margin-top:5px; font-size:11px; }
.account-values small:not(.in):not(.out) { color:var(--muted); }
.account-share { display:block; width:88px; max-width:100%; height:3px; background:#e6e9f1; border-radius:3px; margin-top:9px; overflow:hidden; }
.account-share i { display:block; height:100%; }
.account-identity .detail-flag { color:#916a2f; }
.account-expanded { border-top:1px solid var(--line); padding:16px; background:#fff; }
.detail-facts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px 20px; margin:0; }
.detail-facts div { min-width:0; }
.detail-facts dt { color:var(--muted); font-size:12px; margin-bottom:5px; }
.detail-facts dd { margin:0; font-size:14px; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.detail-note { font-size:12px; color:var(--muted); line-height:1.7; margin:14px 0; white-space:pre-line; overflow-wrap:anywhere; }
.detail-actions { display:flex; flex-wrap:wrap; align-items:center; gap:12px 20px; margin-top:16px; }
.detail-actions a { font-size:13px; min-height:44px; display:inline-flex; align-items:center; }
.investment-sheets { display:grid; gap:20px; }
.investment-disclosure { border-top:1px solid var(--line); }
.investment-disclosure>summary { display:grid; grid-template-columns:minmax(170px,1fr) minmax(110px,.7fr) minmax(110px,.7fr) minmax(90px,.5fr) 14px; gap:18px; align-items:center; padding:16px 20px; min-height:84px; list-style:none; cursor:pointer; }
.investment-cell { text-align:right; font-variant-numeric:tabular-nums; }
.investment-cell small { display:block; color:var(--muted); font-size:11px; margin-bottom:6px; }
.investment-cell strong { font-size:16px; font-weight:600; white-space:nowrap; }
.investment-disclosure .account-expanded { padding:20px; background:#fafbfe; }
.investment-disclosure .detail-facts { grid-template-columns:repeat(4,minmax(0,1fr)); }
.balance-only-note { padding:0 20px; }
.calculation-evidence { margin:14px 0 0; border-top:1px solid var(--line); }
.calculation-evidence>summary { min-height:44px; padding:12px 0; font-size:13px; cursor:pointer; }
.detail-table-scroll { overflow-x:auto; }
.detail-table-scroll table { min-width:540px; }
.flow-evidence-row { padding:12px 0; border-top:1px solid var(--line); font-size:13px; }
.flow-evidence-row p { margin:6px 0 0; white-space:pre-line; color:var(--muted); }
.detail-hero { margin:0 0 24px; padding-bottom:20px; border-bottom:1px solid var(--line); }
.detail-hero>small { display:block; color:var(--muted); margin:0 0 8px; }
.detail-hero>strong { display:block; font-size:30px; font-weight:650; font-variant-numeric:tabular-nums; }
.detail-hero>p { margin:10px 0 0; color:var(--muted); font-size:13px; }
.detail-block { margin:24px 0; }
.detail-block h3 { font-size:14px; margin:0 0 14px; }
.allocation-detail { padding:14px; background:#f6f7fb; border-radius:10px; margin:10px 0; }
.allocation-detail header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.transaction-table tbody tr { cursor:pointer; }
.transaction-table tbody tr:hover { background:#f5f6fc; }
@media(max-width:1000px) {
  .owner-sheets { gap:12px; }
  .owner-sheet-head { padding:16px; }
  .owner-amount strong { font-size:20px; }
}
@media(max-width:760px) {
  .owner-sheets { grid-template-columns:1fr; gap:16px; }
  .detail-toolbar,.detail-search-sort { gap:10px; width:100%; }
  .detail-search-sort label:first-child { min-width:0; flex:1; }
  .detail-search-sort label:last-child { min-width:105px; max-width:125px; }
  .detail-search-sort input,.detail-search-sort select { font-size:16px; min-height:44px; }
  .detail-toolbar .filter-chips { flex-wrap:wrap; }
  .owner-sheet-head { padding:16px; }
  .account-category { padding:0 10px; }
  .account-disclosure>summary { gap:8px; padding:12px 10px; }
  .account-expanded { padding:14px; }
  .account-values strong { font-size:15px; }
  .investment-disclosure>summary { grid-template-columns:repeat(3,minmax(0,1fr)) 12px; gap:14px 8px; padding:16px 12px; }
  .investment-disclosure .account-identity { grid-column:1/4; }
  .investment-disclosure .detail-chevron { grid-column:4; grid-row:1; }
  .investment-cell { text-align:left; grid-row:2; }
  .investment-cell strong { font-size:13px; }
  .investment-disclosure .account-expanded { padding:16px 12px; }
  .investment-disclosure .detail-facts { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .detail-hero>strong { font-size:28px; }
}
@media(prefers-reduced-motion:reduce) { .detail-chevron { transition:none; } }

.account-category>summary,.account-disclosure>summary,.investment-disclosure>summary { color:var(--ink); }
dialog:has(.detail-hero) { width:min(720px,calc(100% - 32px)); }
.dialog-body:has(>.detail-hero)>.actions { position:sticky; bottom:-24px; margin:20px -24px -24px; padding:14px 24px; background:#fff; border-top:1px solid var(--line); }
.bars .bar-track .tone-cash { background:#666bd6; }
.bars .bar-track .tone-invest { background:#7f9b95; }
.bars .bar-track .tone-fund { background:#a6accb; }
@media(max-width:760px) {
  .dialog-body:has(>.detail-hero)>.actions { bottom:-20px; margin:20px -16px -20px; padding:12px 16px; }
}

@media(max-width:760px) {
  .detail-table-scroll .table thead { display:table-header-group; }
  .detail-table-scroll .table tr { display:table-row; }
  .detail-table-scroll .table th,.detail-table-scroll .table td { display:table-cell; padding:12px; }
  .detail-table-scroll .table { table-layout:auto; width:100%; }
}

/* Keep list attribution beside sorting; search gets a full row on phones. */
.detail-search-sort { display:grid; grid-template-columns:minmax(180px,1fr) repeat(2,minmax(130px,auto)); }
.detail-search-sort label { min-width:0; }
.detail-search-sort select { width:100%; min-height:44px; }
@media(max-width:760px) {
  .detail-search-sort { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .detail-search-sort label:first-child { grid-column:1/-1; }
  .detail-search-sort label:last-child { min-width:0; max-width:none; }
  #tx-filter-form, #life-filters { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  #tx-filter-form label, #life-filters label { min-width:0; max-width:none; }
  #tx-filter-form > label:first-child, #life-filters > label:first-child { grid-column:1/-1; }
  #tx-filter-form select, #life-filters select { width:100%; }
}

/* Task-focused refinements: keep the familiar grouping and make actions explicit. */
.summary-details-link { align-self:center; justify-self:end; display:inline-flex; align-items:center; min-height:44px; font-size:13px; white-space:nowrap; }
.asset-summary:has(.summary-details-link) { grid-template-columns:minmax(0,1.6fr) minmax(0,1fr) auto; }
.estimate-actions { display:flex; flex-wrap:wrap; gap:8px 20px; align-items:center; justify-content:space-between; }
.estimate-actions button { min-height:44px; white-space:nowrap; }
.owner-sheet-head { padding:16px 20px; }
.account-category>summary { min-height:56px; }
.account-category-rows { padding-bottom:8px; }
.account-disclosure { background:transparent; border-radius:6px; margin:0; }
.account-disclosure + .account-disclosure { border-top:1px solid var(--line); }
.account-disclosure>summary { min-height:64px; padding:10px 8px; }
.account-expanded { background:var(--paper); border-radius:6px; }
.account-share { width:72px; margin-top:6px; }
.transaction-result-summary { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:6px 20px; margin:0 0 16px; padding:12px 0; border-block:1px solid var(--line); color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums; }
.transaction-result-summary strong { color:var(--ink); font-size:16px; }
.transaction-result-summary>small { flex-basis:100%; }
#tx-filter-form.transaction-filters { display:block; margin:0 0 20px; }
#life-filters.list-filters { display:block; margin:0 0 20px; }
.filter-primary { display:grid; grid-template-columns:minmax(180px,1fr) minmax(150px,.5fr) auto; align-items:end; gap:12px; }
.filter-more { margin-top:4px; }
.filter-more>summary { display:inline-flex; align-items:center; gap:8px; color:var(--muted); }
.filter-more>summary::after { content:'⌄'; font-size:16px; color:var(--accent); }
.filter-more[open]>summary::after { transform:rotate(180deg); }
.filter-secondary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding:12px; background:var(--paper); border-radius:8px; }
.filter-secondary>label { margin:0; }
.refund-bar .bar-label small { display:block; color:var(--out); font-size:11px; }
.bars .refund-bar .bar-track i { background:var(--chart-1); }
.refund-bar strong { color:var(--out); }
.project-metrics { grid-template-columns:1.6fr 1fr; }
.budget-summary { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; margin-bottom:14px; font-size:13px; color:var(--muted); }
.budget-summary strong { color:var(--ink); }
.budget-track { height:10px; margin-bottom:26px; }
.project-trend>summary { padding:0; font-weight:550; }
.project-trend[open]>summary { margin-bottom:18px; }
.history-filters { margin-bottom:16px; }
.history-filter-secondary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding:12px; border-radius:10px; background:var(--surface-soft,#f7f8fc); }
.history-filter-secondary label { min-width:0; margin:0; }
.history-active-filters { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:8px; }
.history-active-filters[hidden],#history-range-error[hidden] { display:none; }
.history-active-filters .active-filters { margin:0; flex:1; }
.history-active-filters button { white-space:nowrap; }
.detail-note-disclosure .detail-note { margin:0 0 14px; }
.history-list-item { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:16px; padding:16px 0; }
.history-list-item > div { min-width:0; }
.history-list-item h3 { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.history-list-item p { margin:6px 0; }
.history-list-item small { display:block; overflow-wrap:anywhere; }
.history-list-item > button { min-width:76px; min-height:44px; white-space:nowrap; }
.empty-onboarding { padding:40px; max-width:760px; }
.empty-onboarding h2 { margin:12px 0; font-size:24px; }
.empty-onboarding p { max-width:48em; color:var(--muted); line-height:1.8; margin:0 0 24px; }
.empty-eyebrow { color:var(--muted); font-size:12px; }
.metric time { white-space:nowrap; }
.investment-coverage-note { display:flex; justify-content:space-between; align-items:center; gap:16px; margin:0 0 20px; color:var(--muted); font-size:12px; line-height:1.7; }
.investment-coverage-note p { margin:2px 0; }
.investment-coverage-note button { flex:none; white-space:nowrap; min-height:44px; }
.life-item-subscriptions .life-cycle-price { margin-top:16px; }
.life-item-subscriptions .life-key-fact { margin-top:12px; }
.life-item-subscriptions .life-key-fact strong { font-size:16px; }
.life-item-subscriptions .life-secondary { line-height:1.6; }
.transaction-table td>small:empty { display:none; }
.project-list .project-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 12px; align-content:start; }
.project-card-title { grid-column:1/-1; overflow-wrap:anywhere; margin-bottom:6px; }
.project-card-amount { grid-column:2; grid-row:2/4; text-align:right; }
.project-card-amount strong,.project-card-amount small { display:block; }
.project-card-amount strong { font-size:20px; margin:0 0 6px; }
.project-card-meta { grid-column:1; grid-row:2; }
.project-card-owners { grid-column:1; grid-row:3; }
@media (max-width:760px) {
  .business-head.project-heading .heading-copy { grid-column:1/-1; }
  .business-head.project-heading .actions { grid-column:1/-1; grid-row:3; justify-content:flex-start; }
  .project-heading h1 { overflow-wrap:anywhere; }
  .project-list { grid-template-columns:1fr; }
  .empty-onboarding { padding:24px; }
  .empty-onboarding h2 { font-size:21px; }
  .management-list .filter-chips { flex-wrap:wrap; gap:6px; }
  .management-list .filter-chips:has([data-life-status="active"]) { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); width:100%; }
  .management-list [data-life-status] { padding:8px 4px; min-height:44px; white-space:nowrap; font-size:12px; }
  .management-list .section-head { flex-wrap:wrap; gap:10px; }
}
.history-account-row { border-bottom:1px solid var(--line); }
.history-account-row>summary { display:grid; grid-template-columns:minmax(160px,1fr) minmax(130px,.7fr) minmax(120px,.7fr) 14px; align-items:center; gap:16px; list-style:none; padding:16px 0; color:var(--ink); }
.history-account-row>summary::-webkit-details-marker { display:none; }
.history-account-row>summary strong,.history-account-row>summary small { display:block; }
.history-account-row>summary small { margin-top:3px; }
.history-account-row>summary>span:not(:first-child) { text-align:right; font-variant-numeric:tabular-nums; }
.history-account-row>summary .detail-chevron { text-align:center; }
.history-account-row .detail-facts { padding:4px 0 18px; }
.history-detail-actions { position:sticky; bottom:-24px; margin:20px -24px -24px; padding:14px 24px; background:var(--surface); border-top:1px solid var(--line); z-index:2; }
[aria-invalid="true"] { border-color:var(--in); background:#fff9f8; }
.field-error { display:block; color:var(--in); font-size:12px; margin:4px 0 0; line-height:1.5; }
.record-row:has([aria-invalid="true"]) { border-left:3px solid var(--in); padding-left:12px; }
.dialog-error a,.dialog-error button { color:inherit; }
.dialog-body input,.dialog-body select,.dialog-body textarea { scroll-margin-block:100px; }
.error-fields { margin:8px 0 0; padding-left:18px; }
.error-fields .error-jump { min-height:32px; padding:3px 0; border:0; background:transparent; text-align:left; text-decoration:underline; text-underline-offset:3px; }
.discard-dialog { width:min(500px,calc(100% - 32px)); }
.discard-dialog .dialog-body p { color:var(--muted); font-size:14px; }
.discard-dialog .actions { gap:8px; }
.diff-summary { color:var(--accent); font-size:13px; margin:10px 0; }
.review-context,.review-note { font-size:13px; margin:12px 0; }
.review-context { color:var(--muted); }
.review-note { padding:12px 14px; background:var(--paper); border-radius:8px; }
.changed-fields { border:1px solid var(--line); border-radius:10px; overflow:hidden; gap:0; }
.changed-fields>section { padding:16px; }
.changed-fields>section:last-child { background:var(--accent-soft); }
.changed-fields h4 { font-size:12px; color:var(--muted); margin-bottom:12px; }
.review-full-record { margin:12px 0; }
dialog.review-dialog .dialog-body>.actions { position:sticky; bottom:-24px; margin:20px -24px -24px; padding:14px 24px; background:var(--surface); border-top:1px solid var(--line); z-index:2; }
dialog.review-dialog[open] { display:flex; flex-direction:column; overflow:hidden; }
dialog.review-dialog .dialog-head { flex:0 0 auto; }
dialog.review-dialog .dialog-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
dialog.review-dialog .dialog-error { flex:0 0 auto; max-height:20dvh; overflow:auto; }
.record-identity>small:nth-child(2) { display:block; color:var(--muted); font-size:11px; }
.life-key-fact { display:flex; flex-direction:column; gap:4px; margin-top:8px; width:100%; }
.life-key-fact strong,.life-cycle-price strong,.life-coverage strong { font-size:20px; font-weight:600; font-variant-numeric:tabular-nums; }
.life-cycle-price,.life-coverage { display:flex; align-items:baseline; flex-wrap:wrap; gap:5px 8px; margin-top:6px; }
.life-secondary { color:var(--muted); font-size:12px; }
.settings-empty { padding:12px 0; color:var(--muted); font-size:13px; }
.settings-disclosure>summary { font-weight:550; color:var(--ink); }
.settings-disclosure:not([open]) { padding-block:14px; }
.settings-advanced { margin-top:16px; border-top:1px solid var(--line); }
dialog.entry-dialog[open] { display:flex; flex-direction:column; overflow:hidden; }
dialog.entry-dialog .dialog-head { flex:0 0 auto; }
dialog.entry-dialog .dialog-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
dialog.entry-dialog .dialog-error { flex:0 0 auto; max-height:20dvh; overflow:auto; }
dialog.entry-dialog .record-actions,dialog.entry-dialog form>.actions:last-child { position:sticky; bottom:-24px; margin:22px -24px -24px; padding:14px 24px; background:var(--surface); border-top:1px solid var(--line); z-index:2; }
dialog.entry-dialog .dialog-body>.actions:last-child { position:sticky; bottom:-24px; margin:22px -24px -24px; padding:14px 24px; background:var(--surface); border-top:1px solid var(--line); z-index:2; }
dialog.entry-dialog .actions button { white-space:nowrap; }
@media(min-width:761px) {
  .record-row { grid-template-columns:minmax(150px,1.3fr) 128px 132px 132px 90px; gap:12px; }
  .record-extra { grid-column:5; }
  .record-extra>summary { font-size:11px; padding-inline:0; }
  .record-row.record-row-inventory,.record-row.record-row-history { grid-template-columns:minmax(150px,1.3fr) 132px 128px 132px 90px; }
}
@media(max-width:760px) {
  .business-head { margin-bottom:14px; }
  .asset-summary:has(.summary-details-link) { grid-template-columns:1fr; gap:8px; }
  .summary-details-link { justify-self:start; }
  .owner-sheet-head { padding:14px 16px; }
  .account-disclosure>summary { gap:8px; }
  .transaction-result-summary { gap:7px; margin-bottom:14px; }
  .transaction-result-summary>span { flex-basis:100%; }
  #tx-filter-form .filter-primary { grid-template-columns:minmax(0,1fr) auto; gap:10px; }
  #tx-filter-form .filter-primary>label:first-child { grid-column:1/-1; }
  #tx-filter-form .filter-primary>label:last-of-type { grid-column:1; }
  #tx-filter-form .filter-primary>button { grid-column:2; }
  #life-filters .filter-primary { grid-template-columns:minmax(0,1fr) auto; gap:10px; }
  #life-filters .filter-primary>label:first-child { grid-column:1/-1; }
  #life-filters .filter-primary>label:last-of-type { grid-column:1; }
  #life-filters .filter-primary>button { grid-column:2; }
  .filter-secondary { grid-template-columns:1fr 1fr; gap:10px; padding:12px; }
  .filter-secondary>label:first-child:last-child { grid-column:1/-1; }
  .filter-more>summary { min-height:44px; }
  .project-metrics { grid-template-columns:1fr; }
  .project-metrics .metric:not(:first-child) { display:flex; flex-direction:row; flex-wrap:wrap; gap:4px 12px; align-items:baseline; }
  .project-metrics .metric:not(:first-child) small { flex-basis:100%; }
  .history-filter-secondary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .history-filter-secondary>label:last-child:nth-child(3) { grid-column:1/-1; }
  .history-filters input,.history-filters select { font-size:16px; padding:10px 8px; }
  .history-account-row>summary { grid-template-columns:minmax(0,1fr) minmax(0,1fr) 14px; gap:10px; }
  .history-account-row>summary>span:first-child { grid-column:1/3; }
  .history-account-row>summary>span:nth-child(2),.history-account-row>summary>span:nth-child(3) { grid-row:2; text-align:left; }
  .history-account-row>summary>.detail-chevron { grid-column:3; grid-row:1; }
  .history-detail-actions { bottom:-20px; margin:20px -16px -20px; padding:12px 16px; }
  dialog.entry-dialog[open] { width:100%; max-width:none; height:100dvh; max-height:100dvh; margin:0; border-radius:0; }
  dialog.entry-dialog .dialog-head { padding:calc(8px + env(safe-area-inset-top)) 16px 8px; }
  dialog.entry-dialog .dialog-body { flex:1; padding:16px 16px 20px; }
  dialog.entry-dialog .dialog-error { margin:10px 16px; }
  dialog.entry-dialog .record-actions,dialog.entry-dialog form>.actions:last-child { bottom:-20px; margin:20px -16px -20px; padding:12px 16px calc(12px + env(safe-area-inset-bottom)); }
  dialog.entry-dialog .dialog-body>.actions:last-child { bottom:-20px; margin:20px -16px -20px; padding:12px 16px calc(12px + env(safe-area-inset-bottom)); }
  dialog.entry-dialog .dialog-head h2 { font-size:18px; }
  dialog.entry-dialog input,dialog.entry-dialog select,dialog.entry-dialog textarea { font-size:16px; }
  dialog.entry-dialog .record-actions .record-progress { flex-basis:100%; }
  .record-row { gap:10px; }
  .record-row.record-row-daily>.direction { grid-column:1/-1; }
  .record-row.record-row-inventory>.direction,.record-row.record-row-history>.direction { grid-column:2; }
  .record-row.record-row-inventory>.movement-field:not([data-inactive="true"]),.record-row.record-row-history>.movement-field:not([data-inactive="true"]) { grid-column:1/-1; }
  .record-row .record-extra { grid-column:1/-1; }
  .record-extra>summary { font-size:12px; }
  dialog.review-dialog .dialog-body>.actions { bottom:-20px; margin:20px -16px -20px; padding:12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .discard-dialog .actions { display:grid; grid-template-columns:1fr 1fr; }
  .discard-dialog [data-save-exit] { grid-column:1/-1; }
  .chart-compact text { font-size:14px; }
}

/* Keep the confirmation requirement next to its action on long review lists. */
.review-actions { flex-wrap:wrap; }
.review-actions>.check { flex-basis:100%; margin:0; font-size:13px; }
.review-account-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.review-account-heading h3 { margin:0; }
.review-account-heading>strong { font-size:20px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.review-account-meta { font-size:12px; margin:6px 0; }
.review-list article .review-account-heading+p { margin:8px 0; font-size:12px; }
@media(max-width:600px) {
  .review-account-heading { flex-direction:column; gap:6px; }
  .review-actions>.check { grid-column:1/-1; }
}
#life-form label[hidden] { display:none; }

/* Focus one financial series without changing its values or the comparison scale. */
.tx-trend-modes { margin-left:auto; }
.tx-trend .section-head { flex-wrap:wrap; }
.single-metric .legend { display:none; }
.tx-mobile-coverage { display:none; }
.compact-filter-top { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:end; }
.compact-filter-top label { margin:0; }
.compact-filter-top button { min-width:76px; }
.compact-filter-panel { padding-top:12px; }
.compact-filter-panel[hidden] { display:none; }
.compact-filter-search { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:end; }
.compact-filter-search label { margin:0; }
.compact-filter-panel .filter-secondary { margin-top:12px; }
@media(max-width:760px) {
  .tx-trend-modes { width:100%; margin:4px 0 0; }
  .tx-trend-modes button { flex:1; }
  .tx-overview-metrics .metric small { display:none; }
  .tx-overview-metrics { margin-bottom:8px; }
  .tx-mobile-coverage { display:block; font-size:12px; color:var(--muted); margin:0 0 18px; }
  #tx-filter-form.transaction-filters,#life-filters.list-filters { margin-bottom:12px; }
  .transaction-result-summary { padding:8px 0; margin-bottom:12px; }
  .active-filters { margin-block:8px; gap:6px; }
}

/* Identity flows retain the app's quiet palette and a single primary action. */
.auth-brand { color:var(--brand); margin-bottom:24px; }
.auth h1:focus { outline:none; }
.auth-help { font-size:13px; line-height:1.65; }
.settings-profile .list-item>div:first-child { min-width:0; overflow-wrap:anywhere; }
.key-actions { flex-shrink:0; margin-top:0; }
.settings-profile .list-item .tag { margin-left:8px; }
@media(max-width:760px) {
  .settings-profile .list-item { flex-wrap:wrap; }
  .settings-profile .key-actions { margin-left:auto; }
  .settings-profile .key-actions button { min-width:60px; }
}

dialog.auth-dialog { max-width:560px; }

.auth .auth-back { background:transparent; border-color:transparent; color:var(--accent); min-height:44px; }
.auth-access-help { margin-top:20px; border-top:1px solid var(--line); padding-top:12px; }
.auth-access-help summary { min-height:44px; display:flex; align-items:center; cursor:pointer; }

.auth form + .auth-help, .auth #passkey-login + .auth-help { margin-top:10px; }

/* Phone use: keep the task readable while data updates and controls within reach. */
.mobile-route-status {
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translateX(-50%);
  z-index:6;
  max-width:calc(100% - 32px);
  padding:10px 16px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  box-shadow:0 4px 18px #292d3e12;
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
  pointer-events:none;
}
.mobile-route-status[hidden] { display:none; }
.mobile-quick-action,.mobile-quick-action[hidden] { display:none; }
.mobile-analysis > summary { color:var(--ink); font-weight:600; }
.mobile-analysis > summary small { font-weight:400; color:var(--muted); }
.mobile-analysis[open] > summary { margin-bottom:16px; }
button.primary:active:not(:disabled) { opacity:.85; }
.bottom-nav a:active,.queue-link:active,.settings-link:active { background:var(--accent-soft); }
dialog[open] { display:flex; flex-direction:column; overflow:hidden; }
dialog .dialog-head { flex:0 0 auto; }
dialog .dialog-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; scroll-padding-block:16px 104px; }
dialog .dialog-error { flex:0 0 auto; max-height:20dvh; overflow-y:auto; }

@media(max-width:760px) {
  :root { font-size:16px; --mobile-nav-height:64px; }
  .shell { min-height:100dvh; }
  .app-header {
    padding:calc(8px + env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 8px max(16px,env(safe-area-inset-left));
  }
  .app-header .brand,.settings-link { min-height:44px; }
  .settings-link { min-width:44px; justify-content:center; }
  .public-tools { gap:4px; }
  .public-tools .mode { font-size:11px; }
  main { padding:16px max(16px,env(safe-area-inset-right)) calc(88px + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
  .business-head { gap:12px; margin-bottom:16px; }
  .business-head .actions { gap:8px; }
  .business-head h1 { font-size:24px; line-height:1.3; }
  .business-head .scope-control { gap:8px; }
  .scope-control > span { font-size:12px; }
  .scope button { min-width:48px; font-size:14px; }
  .hero-metrics .metric > span,.hero-metrics .metric small { font-size:12px; }
  .hero-metrics .metric:first-child strong { font-size:clamp(32px,9vw,40px); }
  .summary-note,.record-warning,.estimate-note,.investment-period,.section-head > small { font-size:12px; }
  .summary-details-link { font-size:14px; }
  .mobile-analysis { margin:0 0 12px; }
  .mobile-analysis > summary {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    min-height:44px;
    padding:8px 16px;
    border:1px solid var(--line);
    border-radius:12px;
    background:var(--surface);
    font-size:14px;
    list-style:none;
  }
  .mobile-analysis > summary::-webkit-details-marker { display:none; }
  .mobile-analysis > summary::after { content:"展开"; color:var(--accent); font-size:12px; font-weight:400; white-space:nowrap; }
  .mobile-analysis[open] > summary::after { content:"收起"; }
  .mobile-analysis > summary:active { background:var(--accent-soft); }
  main:has(#tx-details) .business-head { margin-bottom:12px; }
  main:has(#tx-details) > .tabs { margin-bottom:12px; }
  main:has(#tx-details) > .tabs button { min-height:44px; padding-block:8px; }
  main:has(#tx-details) > .period-controls { margin-bottom:10px; }
  .tx-overview-metrics { margin-top:6px; gap:8px; }
  .tx-mobile-coverage { margin-bottom:12px; }
  #tx-details > .section-head { margin-bottom:12px; }
  #tx-details > .transaction-result-summary { padding-block:6px; margin-bottom:8px; gap:4px; }
  .section { border-radius:14px; }
  .section h2,.section-head h2 { font-size:18px; }
  .section-head button { font-size:13px; }
  .period-step > button { width:44px; min-width:44px; min-height:44px; }
  .trend-ranges button,.trend-readout select,.chart-selection select,.investment-modes button { min-height:44px; }
  .trend-readout label,.trend-readout small { font-size:12px; }
  .trend-readout select { max-width:100%; }
  .trend-readout label { flex-wrap:wrap; }
  .chart-note summary,.record-warning summary,.error-fields .error-jump { min-height:44px; }
  .chart-note summary { padding:10px 0; }
  body :is(input:not([type="checkbox"]),select,textarea) { font-size:16px; }
  label,.record-row label { font-size:14px; }
  .check { min-height:44px; }
  input[type="checkbox"] { flex-shrink:0; }
  .table small,.transaction-table td:first-child > small,.transaction-table td:nth-child(2),.transaction-table td:nth-child(3) { font-size:12px; }
  .account-identity small,.account-values small,.category-total small,.record-identity > small:nth-child(2) { font-size:12px; }
  .account-identity strong,.transaction-table .link { font-size:15px; }
  .account-values strong { font-size:16px; }
  .transaction-table td.number { padding-top:9px; }
  .bottom-nav {
    min-height:calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    padding:6px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
  }
  .bottom-nav a { flex:1; min-width:0; min-height:52px; justify-content:center; gap:4px; padding:4px 2px; border-radius:10px; font-size:12px; line-height:1.4; }
  .bottom-nav svg { width:22px; height:22px; }
  .bottom-nav a[aria-current] { background:var(--accent-soft); }
  #toast,.mobile-route-status { bottom:calc(var(--mobile-nav-height) + 12px + env(safe-area-inset-bottom)); }
  .mobile-route-status { width:max-content; text-align:center; }
  .mobile-quick-action {
    display:inline-flex;
    position:fixed;
    right:max(16px,env(safe-area-inset-right));
    bottom:calc(var(--mobile-nav-height) + 12px + env(safe-area-inset-bottom));
    z-index:4;
    align-items:center;
    justify-content:center;
    min-height:48px;
    max-width:calc(100% - 32px);
    padding:12px 18px;
    border:1px solid var(--brand);
    border-radius:24px;
    background:var(--brand);
    box-shadow:0 4px 18px #292d3e24;
    color:white;
    font-size:14px;
    font-weight:600;
    line-height:1.4;
    white-space:nowrap;
  }
  .mobile-quick-action:hover { background:var(--brand); border-color:var(--brand); }
  .mobile-quick-action:active:not(:disabled) { opacity:.85; }
  body:has(.mobile-quick-action) main,body:has(.mobile-quick-action) .site-filing { padding-bottom:calc(148px + env(safe-area-inset-bottom)); }
  body:has(.mobile-quick-action:not([hidden])) :is(#toast,.mobile-route-status) { bottom:calc(var(--mobile-nav-height) + 72px + env(safe-area-inset-bottom)); }
  .auth { margin:24px 16px; padding:24px; }
  .auth-help { font-size:14px; }
  dialog[open] {
    position:fixed;
    top:calc(var(--app-viewport-top,0px) + var(--app-viewport-height,100dvh) / 2);
    bottom:auto;
    margin:0 auto;
    transform:translateY(-50%);
    max-height:calc(var(--app-viewport-height,100dvh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  dialog .dialog-head { padding:10px 16px; gap:12px; }
  dialog .dialog-head h2 { font-size:18px; line-height:1.4; }
  dialog .dialog-head .icon-btn { flex-shrink:0; }
  dialog .dialog-body { padding:16px 16px 20px; }
  dialog .dialog-error { max-height:calc(var(--app-viewport-height,100dvh) * .2); margin:8px 16px; }
  dialog.entry-dialog[open] {
    top:var(--app-viewport-top,0px);
    transform:none;
    height:var(--app-viewport-height,100dvh);
    max-height:var(--app-viewport-height,100dvh);
  }
  dialog.entry-dialog .dialog-head { padding-top:calc(8px + env(safe-area-inset-top)); }
  dialog .dialog-body > .actions:last-child,
  dialog .dialog-body form > .actions:last-child,
  dialog .dialog-body .record-actions,
  dialog .dialog-body > .history-detail-actions {
    position:sticky;
    bottom:-20px;
    margin:20px -16px -20px;
    padding:12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top:1px solid var(--line);
    background:var(--surface);
    z-index:2;
  }
  dialog .actions button { min-height:48px; font-size:14px; }
  dialog .dialog-body input,dialog .dialog-body select,dialog .dialog-body textarea { scroll-margin-block:24px 120px; }
  .review-actions > .check { font-size:14px; line-height:1.5; }
  body .site-filing { padding-bottom:calc(88px + env(safe-area-inset-bottom)); }
}
@media(min-width:430px) and (max-width:760px) {
  main { padding-inline:max(20px,env(safe-area-inset-left)) max(20px,env(safe-area-inset-right)); }
}
@media(min-width:761px) {
  .mobile-analysis[open] > summary { display:none; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation:none !important; scroll-behavior:auto !important; transition:none !important; }
}

.site-filing { padding:16px 16px calc(16px + env(safe-area-inset-bottom)); text-align:center; font-size:12px; }
.site-filing a { color:var(--muted); text-decoration:underline; text-underline-offset:3px; }
