:root {
  color-scheme: light;
  --paper: #F5F1E8;
  --ink: #1D211C;
  --forest: #315C49;
  --copper: #B7834A;
  --rule: #D9D1C2;
  --bg: var(--paper);
  --surface: #FFFCF5;
  --surface-strong: #FFFCF5;
  --surface-soft: #ECE5D8;
  --muted: #6E746B;
  --line: var(--rule);
  --blue: var(--forest);
  --blue-link: var(--forest);
  --green: var(--forest);
  --red: #B64438;
  --orange: var(--copper);
  --card-shadow: 0 18px 42px rgba(29, 33, 28, 0.08);
}

:root.dark {
  color-scheme: dark;
  --paper: #151914;
  --ink: #F1EEE6;
  --forest: #80B693;
  --copper: #D3A86E;
  --rule: rgba(241, 238, 230, 0.15);
  --bg: var(--paper);
  --surface: #1D211C;
  --surface-strong: #242A23;
  --surface-soft: #292F27;
  --muted: #AAB0A5;
  --line: var(--rule);
  --blue: var(--forest);
  --blue-link: var(--forest);
  --green: var(--forest);
  --red: #E57B70;
  --orange: var(--copper);
  --card-shadow: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: pan-x pan-y;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
}

.auth-screen {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

.auth-panel {
  width: min(100%, 400px);
  padding: 32px 28px 26px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.07), 0 2px 8px rgba(15, 23, 42, 0.03);
}

.auth-brand {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 28px;
  place-items: center;
  border-radius: 11px;
  color: #ffffff;
  background: var(--blue);
  font-size: 23px;
  font-weight: 650;
  user-select: none;
}

.auth-brand:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.auth-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.47;
}

.apple-login-button,
.phone-login-button,
.code-button {
  min-height: 50px;
  border: 0;
  border-radius: 11px;
  font-weight: 600;
}

.apple-login-button {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 30px;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  background: #000000;
  font-size: 17px;
}

.apple-login-button:disabled {
  cursor: default;
  opacity: 0.65;
}

:root.dark .apple-login-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  background: var(--line);
  content: "";
}

.phone-login-form,
.phone-login-form > label {
  display: grid;
  gap: 8px;
}

.phone-login-form {
  gap: 15px;
}

.auth-screen--apple-pending .phone-login-form,
.auth-screen--apple-pending .review-login-form,
.auth-screen--apple-pending .auth-security-note {
  display: none;
}

.auth-screen--apple-pending .auth-status {
  margin-top: 28px;
  color: var(--text);
  font-weight: 600;
}

.review-login-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.review-login-form label {
  display: grid;
  gap: 8px;
}

.review-login-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.phone-login-form > label > span:first-child,
.review-login-form label > span:first-child {
  font-size: 13px;
}

.phone-login-form > label input,
.review-login-form input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface-soft);
}

.code-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.code-button {
  min-width: 104px;
  padding: 0 13px;
  color: var(--blue-link);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.phone-login-button {
  width: 100%;
  color: #ffffff;
  background: var(--blue);
  font-size: 16px;
}

.auth-helper-text {
  margin-top: -5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-agreement {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.login-agreement > input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--blue);
}

.login-agreement label {
  color: inherit;
}

.auth-legal-link {
  min-height: 0;
  border: 0;
  padding: 0;
  color: var(--blue-link);
  background: transparent;
  font-size: inherit;
  line-height: inherit;
}

.auth-legal-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.icp-filing-link {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-decoration: none;
}

.icp-filing-link:hover {
  color: var(--blue-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-icp-filing-link {
  display: block;
  margin-top: -6px;
  text-align: center;
}

.review-login-button {
  width: 100%;
  min-height: 46px;
  justify-content: center;
}

.auth-status,
.privacy-note {
  min-height: 18px;
  margin-top: 13px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.auth-security-note {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, var(--blue) 10%, var(--line));
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  background: color-mix(in srgb, var(--blue) 5%, var(--surface));
  font-size: 12px;
  line-height: 1.45;
}

.auth-security-note strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.auth-security-note span {
  color: inherit;
}

@media (max-width: 420px) {
  .auth-screen {
    padding-inline: 14px;
  }

  .auth-panel {
    padding: 28px 22px 22px;
  }
}

.privacy-note {
  min-height: 0;
  margin-top: 6px;
  color: var(--muted);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.apple-logo {
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: 50px;
  height: 50px;
  transform: translateY(-50%);
  object-fit: contain;
  pointer-events: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom));
}

.app-header,
.hero-topline,
.section-heading,
.snapshot-card,
.toolbar-card,
.settings-row,
.dialog-head,
.account-row,
.progress-line,
.movement-row,
.history-row,
.account-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.app-header {
  align-items: flex-end;
  padding: 10px 2px 22px;
}

.eyebrow,
span,
small {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 12px;
  line-height: 1.33;
  letter-spacing: -0.12px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3,
.amount-display strong,
.detail-hero > strong {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", sans-serif;
}

h1 {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -0.28px;
}

h2 {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: -0.22px;
}

h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.374px;
}

main,
.tab-panel,
.account-tree,
.snapshot-list,
.allocation-list,
.movement-list,
.history-list {
  display: grid;
  gap: 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
}

.tab-panel.active.slide-forward {
  animation: tabSlideForward 260ms cubic-bezier(.2, .8, .2, 1);
}

.tab-panel.active.slide-backward {
  animation: tabSlideBackward 260ms cubic-bezier(.2, .8, .2, 1);
}

@keyframes tabSlideForward {
  from {
    opacity: 0;
    transform: translateX(22px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes tabSlideBackward {
  from {
    opacity: 0;
    transform: translateX(-22px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.hero-card,
.mini-card,
.goal-card,
.chart-card,
.allocation-card,
.movement-card,
.snapshot-card,
.toolbar-card,
.tree-card,
.detail-card,
.settings-card,
.dialog-sheet {
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.hero-card {
  display: grid;
  gap: 20px;
  min-height: 246px;
  padding: 24px;
}

.tone-net {
  color: #1d1d1f;
  background: #ffffff;
}

:root.dark .tone-net {
  color: var(--ink);
  background: #1c1c1e;
}

.tone-net span,
.tone-net small {
  color: #6e6e73;
}

:root.dark .tone-net span,
:root.dark .tone-net small {
  color: var(--muted);
}

.tone-net .amount-display strong {
  color: #1d1d1f;
}

:root.dark .tone-net .amount-display strong {
  color: var(--ink);
}

.amount-display {
  width: 100%;
  padding: 0;
  color: inherit;
  text-align: left;
}

.amount-display strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 58px;
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.28px;
  font-variant-numeric: tabular-nums;
}

.metric-strip,
.change-grid,
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-strip {
  margin-top: auto;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 16px;
}

:root.dark .metric-strip {
  border-top-color: var(--line);
}

.metric-strip div,
.insight-grid div {
  min-width: 0;
}

.metric-strip span,
.mini-card span,
.insight-grid span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.33;
  letter-spacing: -0.12px;
}

.metric-strip strong,
.insight-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.374px;
  font-variant-numeric: tabular-nums;
}

.change-grid {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-card,
.goal-card,
.chart-card,
.allocation-card,
.movement-card,
.snapshot-card,
.toolbar-card,
.tree-card,
.detail-card {
  padding: 18px;
}

.mini-card {
  min-width: 0;
  min-height: 112px;
  background: var(--surface);
}

.mini-card strong {
  display: block;
  color: var(--green);
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.2px;
  overflow: hidden;
  overflow-wrap: normal;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 520px) {
  .mini-card strong {
    font-size: 20px;
  }
}

.mini-card small {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: -0.12px;
}

.goal-card {
  display: grid;
  gap: 14px;
}

.goal-heading {
  margin-bottom: 0;
}

.goal-edit-button {
  min-width: 52px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: var(--blue-link);
  background: color-mix(in srgb, var(--blue) 9%, transparent);
  font-size: 15px;
}

.goal-progress-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.goal-progress-line strong {
  color: var(--blue-link);
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.goal-progress-line span {
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  text-align: right;
}

.goal-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 980px;
  background: var(--surface-soft);
}

.goal-progress-track div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.25s ease;
}

.section-heading {
  align-items: flex-start;
  margin-bottom: 4px;
}

.section-heading span {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  line-height: 1.43;
  letter-spacing: -0.224px;
}

.line-chart {
  width: 100%;
  height: 220px;
  margin-top: 8px;
  overflow: visible;
}

.line-chart text,
.mini-chart text {
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
}

.chart-scrub-hit-area {
  fill: transparent;
  cursor: crosshair;
  touch-action: none;
}

.chart-scrubber[hidden] {
  display: none;
}

.chart-scrub-line {
  stroke: var(--blue);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: .75;
}

.chart-scrub-point {
  fill: var(--surface);
  stroke: var(--blue);
  stroke-width: 3;
}

.chart-scrub-tooltip {
  fill: var(--ink);
  opacity: .94;
}

.chart-scrub-tooltip-text {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 650;
  pointer-events: none;
}

.insight-grid {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.allocation-visual {
  display: grid;
  justify-items: center;
  gap: 16px;
  margin-top: 18px;
}

.allocation-pie {
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}

.allocation-visual .allocation-list {
  width: 100%;
}

.allocation-item,
.movement-row {
  min-height: 44px;
}

.allocation-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.allocation-item strong,
.movement-row strong {
  font-variant-numeric: tabular-nums;
}

.swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.movement-row {
  border-bottom: 1px solid var(--line);
}

.movement-row:last-child {
  border-bottom: 0;
}

.movement-row strong {
  white-space: nowrap;
}

.delta-positive,
html[lang="en-US"] .delta-positive {
  color: var(--green);
}

.delta-negative,
html[lang="en-US"] .delta-negative {
  color: var(--red);
}

html[lang="zh-CN"] .delta-positive {
  color: var(--red);
}

html[lang="zh-CN"] .delta-negative {
  color: var(--green);
}

.delta-neutral {
  color: var(--muted);
}

.note-preview {
  display: none;
  margin-top: 10px;
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.43;
  letter-spacing: -0.224px;
}

.note-preview.active {
  display: block;
}

.snapshot-card {
  align-items: stretch;
}

.tab-panel.has-floating-snapshot {
  padding-bottom: 104px;
}

.snapshot-card.floating-snapshot {
  position: fixed;
  left: 50%;
  bottom: calc(60px + env(safe-area-inset-bottom));
  z-index: 4;
  width: min(calc(100% - 32px), 488px);
  padding: 14px 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

:root.dark .snapshot-card.floating-snapshot {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
}

.snapshot-card > div {
  display: grid;
  gap: 4px;
}

.snapshot-card strong {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
}

.snapshot-card small {
  max-width: 220px;
  font-size: 12px;
  line-height: 1.33;
  letter-spacing: -0.12px;
}

.primary-button,
.secondary-button,
.icon-button,
.tab-button {
  border: 0;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 15px;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.374px;
}

.primary-button {
  color: #ffffff;
  background: var(--blue);
}

.primary-button:active,
.icon-button.filled:active {
  filter: brightness(0.9);
  transform: scale(0.98);
}

.secondary-button {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, transparent);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  font-size: 20px;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.icon-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  transform: translateY(-1px);
}

.icon-button:active:not(:disabled) {
  transform: scale(0.96);
}

.app-header .icon-button {
  background: var(--surface);
}

.icon-button.filled {
  color: #ffffff;
  background: var(--blue);
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 520px);
  min-height: 82px;
  padding: 7px 20px calc(7px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(245, 245, 247, 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

:root.dark .bottom-tabs {
  background: rgba(28, 28, 30, 0.86);
}

.tab-button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  min-width: 64px;
  min-height: 54px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  line-height: 1.2;
  letter-spacing: -0.08px;
}

.tab-button > span:first-child {
  color: inherit;
  font-size: 26px;
  line-height: 1;
  transition: transform 160ms ease, color 160ms ease;
}

.tab-button > span:last-child {
  color: inherit;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
}

.tab-button.active {
  color: var(--blue);
  background: transparent;
}

.tab-button.active > span:first-child {
  transform: translateY(-1px) scale(1.06);
}

.toolbar-card {
  min-height: 82px;
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.toolbar-actions .icon-button:disabled {
  cursor: default;
  opacity: 0.32;
}

.toolbar-card > div span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

.tree-card {
  display: grid;
  gap: 24px;
}

.account-empty-state {
  display: grid;
  gap: 10px;
  padding: 28px 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.account-empty-state h2,
.account-empty-state p {
  margin: 0;
}

.account-empty-state p:not(.eyebrow) {
  max-width: 560px;
  color: var(--muted);
  line-height: 1.55;
}

.account-empty-state .primary-button {
  width: fit-content;
  margin-top: 8px;
}

.tree-card h2 {
  margin-bottom: 8px;
}

.tree-group {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.tree-group:last-child {
  border-bottom: 0;
}

.group-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.group-button span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.group-chevron {
  display: inline-block;
  width: 16px;
  color: var(--muted);
  font-size: 12px;
  transform-origin: 50% 50%;
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1), color 180ms ease;
}

.tree-group:not(.collapsed) .group-chevron {
  transform: rotate(0deg);
  color: var(--blue);
}

.group-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.group-accounts {
  display: grid;
  max-height: 720px;
  padding-bottom: 6px;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 260ms cubic-bezier(.2, .8, .2, 1),
    opacity 180ms ease,
    transform 220ms cubic-bezier(.2, .8, .2, 1),
    padding-bottom 220ms ease;
}

.tree-group.collapsed .group-accounts {
  max-height: 0;
  padding-bottom: 0;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.account-row {
  width: 100%;
  min-height: 66px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.account-row:active {
  background: var(--surface-soft);
}

.account-row.disabled {
  opacity: 0.48;
}

.account-row-main,
.account-row-side {
  display: grid;
  gap: 3px;
}

.account-row-side {
  justify-items: end;
  font-variant-numeric: tabular-nums;
}

.detail-card {
  min-height: 190px;
}

.detail-hero {
  display: grid;
  gap: 9px;
  margin: 14px 0;
  border-bottom: 1px solid var(--line);
  padding: 0 0 16px;
}

.detail-hero > strong {
  display: block;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.28px;
  font-variant-numeric: tabular-nums;
}

.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-chart {
  width: 100%;
  height: 132px;
  margin-bottom: 12px;
}

.history-row {
  min-height: 44px;
  border-top: 1px solid var(--line);
}

.history-row strong {
  font-variant-numeric: tabular-nums;
}

.history-row span {
  display: grid;
  gap: 2px;
}

.history-row small {
  color: var(--muted);
  font-size: 11px;
}

.settings-card {
  display: grid;
  overflow: hidden;
  padding: 0 18px;
}

.account-settings-card {
  margin-bottom: 0;
}

.plan-badge {
  color: var(--muted);
  font-weight: 600;
}

.plan-badge.premium {
  color: var(--blue-link);
}

.cloud-feature-row {
  width: 100%;
}

.cloud-feature-row .cloud-feature-status {
  color: var(--blue-link);
  font-size: 13px;
  font-weight: 500;
}

.cloud-feature-row.unlocked .cloud-feature-status {
  color: var(--green);
}

.cloud-status {
  display: none;
  margin: 0 -18px;
  padding: 11px 18px 13px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.5;
}

.cloud-status:not(:empty) {
  display: block;
}

.cloud-status.cloud-error {
  color: var(--red);
}

.logout-row {
  width: 100%;
  justify-content: flex-start;
  color: var(--red);
}

.danger-row,
.danger-row strong {
  color: var(--red);
}

.settings-row {
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 17px;
  letter-spacing: -0.374px;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row strong {
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.settings-helper {
  margin: -4px 0 16px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.settings-advanced-block {
  padding: 0;
}

.settings-advanced-block summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.settings-advanced-block summary::-webkit-details-marker {
  display: none;
}

.settings-advanced-block summary::after {
  content: "›";
  float: right;
  transform: rotate(90deg);
  color: var(--muted);
}

.settings-advanced-block[open] summary::after {
  transform: rotate(-90deg);
}

.import-preview-file {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  word-break: break-all;
}

.import-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.import-preview-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: var(--surface-soft);
}

.import-preview-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.import-preview-item strong {
  color: var(--ink);
  font-size: 20px;
}

.import-preview-errors {
  border: 1px solid color-mix(in srgb, var(--red) 24%, transparent);
  border-radius: 16px;
  padding: 12px;
  background: color-mix(in srgb, var(--red) 8%, transparent);
  color: var(--red);
  font-size: 13px;
  line-height: 1.55;
}

.import-preview-errors ul {
  margin: 0;
  padding-left: 18px;
}

.development-settings {
  border: 1px solid color-mix(in srgb, var(--orange) 22%, transparent);
}

.developer-test-row {
  width: 100%;
  cursor: pointer;
}

.developer-test-row strong {
  color: var(--orange);
  font-size: 12px;
  font-weight: 600;
}

.settings-choice select {
  min-width: 132px;
  min-height: 44px;
  border: 0;
  padding: 0 28px 0 8px;
  color: var(--muted);
  background-color: transparent;
  font: inherit;
  font-size: 15px;
  text-align: right;
  outline: none;
}

.feedback-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.feedback-field {
  display: grid;
  gap: 9px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.feedback-field textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface-soft);
  font: inherit;
  font-weight: 400;
  line-height: 1.5;
}

.feedback-privacy-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.feedback-submit-button { width: 100%; }

.settings-choice select:focus-visible {
  border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.22);
}

:root.dark .settings-choice select {
  color-scheme: dark;
}

.settings-row input[type="checkbox"],
.switch-line input[type="checkbox"] {
  position: relative;
  width: 51px;
  height: 31px;
  margin: 0;
  border: 0;
  border-radius: 980px;
  appearance: none;
  background: #e9e9eb;
  transition: background 0.2s ease;
}

.settings-row input[type="checkbox"]::before,
.switch-line input[type="checkbox"]::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  content: "";
  transition: transform 0.2s ease;
}

.settings-row input[type="checkbox"]:checked,
.switch-line input[type="checkbox"]:checked {
  background: #34c759;
}

:root.dark .settings-row input[type="checkbox"],
:root.dark .switch-line input[type="checkbox"] {
  background: #39393d;
}

:root.dark .settings-row input[type="checkbox"]:checked,
:root.dark .switch-line input[type="checkbox"]:checked {
  background: #30d158;
}

.settings-row input[type="checkbox"]:checked::before,
.switch-line input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

.file-row {
  cursor: pointer;
}

.file-row input {
  display: none;
}

.app-dialog {
  width: min(100% - 20px, 500px);
  max-height: calc(100vh - 24px);
  border: 0;
  padding: 0;
  background: transparent;
  touch-action: pan-y;
}

.app-dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dialog-sheet {
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 24px);
  padding: 18px;
  overflow: auto;
}

.dialog-head h2 {
  font-size: 28px;
  line-height: 1.14;
}

.upgrade-message {
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
}

.premium-benefits {
  display: grid;
  overflow: hidden;
  border-radius: 11px;
  background: var(--surface-soft);
}

.premium-benefits span {
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  color: var(--ink);
  font-size: 15px;
}

.premium-benefits span:last-child {
  border-bottom: 0;
}

.legal-dialog {
  width: min(100% - 20px, 560px);
}

.legal-sheet {
  gap: 18px;
}

.legal-content {
  display: grid;
  gap: 16px;
}

.legal-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface-soft);
}

.legal-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.3;
}

.legal-section ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.security-card-grid {
  display: grid;
  gap: 10px;
}

.security-info-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 14px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
}

.security-info-card span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--green);
  font-size: 14px;
  font-weight: 700;
}

.security-info-card strong {
  font-size: 15px;
  font-weight: 650;
}

.delete-warning {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.5;
}

.delete-impact-list {
  display: grid;
  gap: 8px;
  margin: 0;
  border-radius: 14px;
  padding: 14px 14px 14px 32px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.45;
}

.delete-account-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.delete-account-status.cloud-error {
  color: var(--red);
}

.danger-button {
  background: var(--red);
  box-shadow: 0 10px 22px rgba(255, 59, 48, 0.2);
}

.sticky-head {
  position: sticky;
  top: -18px;
  z-index: 1;
  margin: -18px -18px 0;
  padding: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.compact-sheet label,
.note-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: -0.12px;
}

.dialog-sheet input,
.dialog-sheet select,
.dialog-sheet textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-soft);
}

/* Keep iOS from zooming the form when any field receives focus. */
.dialog-sheet input:not([type="checkbox"]):not([type="file"]),
.dialog-sheet select,
.dialog-sheet textarea {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.dialog-sheet input,
.dialog-sheet select {
  min-height: 46px;
}

.dialog-sheet textarea {
  padding-top: 12px;
  line-height: 1.47;
  resize: vertical;
}

.snapshot-date-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.snapshot-date-field input {
  color-scheme: light;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.dark .snapshot-date-field input {
  color-scheme: dark;
}

.snapshot-date-field small {
  color: var(--blue);
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 980px;
  background: var(--surface-soft);
}

.progress-track div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.2s ease;
}

.snapshot-input-card {
  display: grid;
  gap: 12px;
  border-radius: 12px;
  padding: 14px;
  background: var(--surface-soft);
}

.snapshot-input-card.done {
  background: color-mix(in srgb, var(--green) 9%, var(--surface));
}

.snapshot-input-card input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.snapshot-amount-field {
  display: block;
}

.snapshot-recognition-button {
  justify-self: start;
  border: 0;
  padding: 7px 0;
  color: var(--blue);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ai-usage-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.snapshot-input-card .ai-usage-label {
  justify-self: start;
  margin-top: -5px;
}

.recognition-usage-note {
  min-height: 18px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.snapshot-input-card input[type="number"]::-webkit-inner-spin-button,
.snapshot-input-card input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.snapshot-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.snapshot-card-head strong,
.snapshot-card-head small {
  display: block;
}

.snapshot-card-head small {
  margin-top: 4px;
}

.completion-pill {
  border-radius: 980px;
  padding: 4px 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 9%, transparent);
  font-size: 12px;
  white-space: nowrap;
}

.snapshot-input-card.done .completion-pill {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, transparent);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.screenshot-recognition {
  display: grid;
  gap: 10px;
  border-radius: 12px;
  padding: 14px;
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
}

.screenshot-recognition-head,
.recognition-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.screenshot-recognition-head strong,
.screenshot-recognition-head small,
.recognition-result-head strong,
.recognition-result-head small {
  display: block;
}

.screenshot-recognition-head small,
.recognition-result-head small,
.recognition-privacy,
.recognition-match {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.recognition-suggestion {
  margin: -4px 0 0;
  color: var(--blue);
  font-size: 12px;
  line-height: 1.45;
}

.recognition-confirm-details {
  display: grid;
  gap: 0;
  margin: 0;
}

.recognition-confirm-details div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.recognition-confirm-details dt {
  color: var(--muted);
  font-size: 13px;
}

.recognition-confirm-details dd {
  margin: 0;
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.recognition-warning {
  border-left: 3px solid var(--orange);
  padding: 10px 12px;
  color: var(--ink);
  background: color-mix(in srgb, var(--orange) 8%, var(--surface));
  font-size: 13px;
  line-height: 1.5;
}

.recognition-preview-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
  color: var(--blue);
  background: transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.recognition-preview-toggle[aria-expanded="true"] span:last-child {
  transform: rotate(180deg);
}

.recognition-preview-toggle span:last-child {
  transition: transform 160ms ease;
}

.recognition-preview-panel {
  display: grid;
  gap: 10px;
}

.recognition-preview-summary {
  display: grid;
  gap: 3px;
}

.recognition-preview-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.recognition-preview-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.recognition-preview-frame img {
  display: block;
  width: 100%;
  max-height: 44vh;
  object-fit: contain;
}

.recognition-bbox {
  position: absolute;
  border: 2px solid var(--blue);
  border-radius: 4px;
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 75%, transparent);
  pointer-events: none;
}

.recognition-preview-error {
  margin: 0;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.recognition-decision-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 8px;
}

.recognition-decision-actions .selected {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, var(--surface));
}

.recognition-edit-amount {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.recognition-overwrite {
  display: grid;
  gap: 5px;
  border-left: 3px solid var(--orange);
  padding: 10px 12px;
  background: color-mix(in srgb, var(--orange) 7%, var(--surface));
  font-size: 13px;
}

.recognition-overwrite span {
  color: var(--muted);
  font-size: 12px;
}

.recognition-confirm-actions {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
}

.compact-action {
  width: auto;
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.recognition-privacy,
.recognition-status,
.recognition-amount,
.recognition-match,
.recognition-confirmed {
  margin: 0;
}

.recognition-status {
  color: var(--blue);
  font-size: 13px;
  line-height: 1.45;
}

.recognition-status:empty {
  display: none;
}

.recognition-status.error {
  color: var(--red);
}

.recognition-slow-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.snapshot-recognition-status {
  min-height: 0;
  color: var(--blue);
  font-size: 12px;
  line-height: 1.4;
}

.snapshot-recognition-status:empty {
  display: none;
}

.snapshot-recognition-button.loading,
.snapshot-recognition-button:disabled,
#uploadScreenshotButton:disabled {
  cursor: wait;
  opacity: 0.68;
}

.recognition-quality-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--muted);
  font-size: 13px;
}

.recognition-quality-toggle input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--blue);
}

.recognition-results {
  display: grid;
  gap: 10px;
}

.recognition-result-card {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.recognition-result-card.confirmed {
  color: var(--green);
}

.recognition-source {
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 10%, transparent);
  font-size: 11px;
}

.recognition-amount {
  color: var(--ink);
  font-size: 24px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.recognition-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.recognition-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.recognition-actions button {
  min-height: 40px;
}

.text-action {
  border: 0;
  padding: 8px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.recognition-confirmed {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}

.quality-test-dialog {
  width: min(100% - 20px, 880px);
}

.quality-test-sheet {
  gap: 18px;
}

.quality-privacy {
  border-left: 3px solid var(--blue);
  padding: 9px 12px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.5;
}

.quality-test-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.35fr);
  align-items: start;
  gap: 22px;
}

.quality-input-section,
.quality-report-section,
.quality-results,
.quality-failures,
.quality-suggestions {
  display: grid;
  gap: 12px;
}

.quality-report-section {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

.quality-section-head,
.quality-result-title,
.quality-failure-item > div:first-child {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.quality-section-head p,
.quality-result-title small,
.quality-failure-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.quality-input-section > label,
.quality-field-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.quality-file-field input {
  padding: 10px 12px;
}

.quality-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quality-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.quality-metric {
  display: grid;
  align-content: space-between;
  min-height: 76px;
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.quality-metric span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.quality-metric strong {
  margin-top: 8px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.quality-result-item,
.quality-failure-item {
  display: grid;
  gap: 11px;
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.quality-result-title > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.quality-comparison {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.quality-comparison div {
  min-width: 0;
}

.quality-comparison dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.quality-comparison dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.quality-result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quality-badge {
  border-radius: 980px;
  padding: 4px 7px;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 9%, transparent);
  font-size: 10px;
  font-weight: 600;
}

.quality-badge.correct {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 9%, transparent);
}

.quality-badge.acceptable {
  color: var(--orange);
  background: color-mix(in srgb, var(--orange) 9%, transparent);
}

.quality-failures,
.quality-suggestions {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.quality-failure-item {
  background: color-mix(in srgb, var(--red) 5%, var(--surface));
}

.quality-failure-item > p,
.quality-suggestions li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.quality-suggestions ul,
.quality-sample-guide ol {
  margin: 0;
  padding-left: 20px;
}

.compact-comparison {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quality-empty {
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  line-height: 1.5;
}

.quality-sample-guide {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.quality-sample-guide summary {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.quality-sample-guide ol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  margin-top: 12px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .quality-test-layout {
    grid-template-columns: 1fr;
  }

  .quality-report-section {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 18px;
    padding-left: 0;
  }

  .quality-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quality-comparison {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .screenshot-recognition-head {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-action {
    width: 100%;
  }

  .quality-field-grid,
  .quality-sample-guide ol {
    grid-template-columns: 1fr;
  }
}

.switch-line {
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 44px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.otp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.form-status {
  min-height: 20px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.account-templates {
  display: grid;
  gap: 10px;
}

.account-templates > span {
  color: var(--muted);
  font-size: 13px;
}

#accountTemplateList,
.template-group {
  display: grid;
  gap: 8px;
}

.template-group small {
  color: var(--muted);
  font-size: 11px;
}

.template-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.template-group button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 13px;
}

.template-group button:hover {
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 8%, var(--surface-soft));
}

.empty-guide-copy,
.example-account-list {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.example-account-list {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 13px;
}

.hidden {
  display: none;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  border-radius: 8px;
  padding: 20px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.43;
  text-align: center;
}

@media (max-width: 359px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .hero-card,
  .goal-card,
  .chart-card,
  .allocation-card,
  .movement-card,
  .snapshot-card,
  .toolbar-card,
  .tree-card,
  .detail-card {
    padding: 16px;
  }

  .amount-display strong {
    font-size: 42px;
  }

  .mini-card {
    padding: 14px;
  }

  .mini-card strong {
    font-size: 16px;
  }

  .snapshot-card {
    display: grid;
  }

  .snapshot-card.floating-snapshot {
    width: calc(100% - 24px);
  }
}

@media (max-width: 420px) and (min-width: 360px) {
  .amount-display strong {
    font-size: 48px;
  }
}

@media (min-width: 460px) {
  .allocation-visual {
    grid-template-columns: 148px minmax(0, 1fr);
    align-items: center;
    justify-items: stretch;
  }

  .allocation-pie {
    width: 148px;
  }

  .tree-card {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .tab-panel.active {
    animation: none !important;
  }

  .group-accounts,
  .group-chevron {
    transition: none !important;
  }
}

/* Visual refresh: iOS finance utility with Stripe-like numeric hierarchy. */
body {
  background:
    radial-gradient(circle at 50% -160px, rgba(10, 132, 255, 0.09), transparent 360px),
    var(--bg);
}

.auth-panel,
.hero-card,
.mini-card,
.goal-card,
.chart-card,
.allocation-card,
.movement-card,
.snapshot-card,
.toolbar-card,
.tree-card,
.detail-card,
.settings-card,
.dialog-sheet,
.account-empty-state {
  border: 1px solid rgba(221, 229, 242, 0.92);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.auth-panel,
.dialog-sheet {
  border-radius: 22px;
}

.auth-brand {
  border-radius: 16px;
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(10, 132, 255, 0.22);
}

.phone-login-form input,
.review-login-form input,
.dialog-sheet input,
.dialog-sheet select,
.dialog-sheet textarea {
  border: 1px solid rgba(221, 229, 242, 0.95);
  border-radius: 14px;
  background: #f7faff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.phone-login-form input:focus,
.review-login-form input:focus,
.dialog-sheet input:focus,
.dialog-sheet select:focus,
.dialog-sheet textarea:focus {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

.primary-button,
.secondary-button,
.phone-login-button,
.review-login-button,
.code-button,
.goal-edit-button,
.template-group button {
  border-radius: 14px;
  font-weight: 650;
  transition: transform 160ms ease, filter 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover:not(:disabled),
.phone-login-button:hover:not(:disabled),
.icon-button.filled:hover:not(:disabled) {
  filter: brightness(1.045);
  box-shadow: 0 12px 24px rgba(10, 132, 255, 0.26);
}

.secondary-button:hover:not(:disabled),
.code-button:hover:not(:disabled),
.goal-edit-button:hover:not(:disabled) {
  background: rgba(10, 132, 255, 0.14);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled),
.phone-login-button:active:not(:disabled),
.review-login-button:active:not(:disabled),
.code-button:active:not(:disabled),
.goal-edit-button:active:not(:disabled),
.template-group button:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.primary-button,
.phone-login-button,
.icon-button.filled {
  background: var(--blue);
  box-shadow: 0 10px 22px rgba(10, 132, 255, 0.22);
}

.secondary-button,
.code-button,
.goal-edit-button {
  color: var(--blue-link);
  background: rgba(10, 132, 255, 0.09);
}

.app-header {
  padding-top: 14px;
}

.app-header .icon-button,
.icon-button {
  border: 1px solid rgba(221, 229, 242, 0.9);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border: 0;
  color: #ffffff;
  background: linear-gradient(160deg, #4f9df8 0%, #2f73d8 100%);
  box-shadow: 0 18px 42px rgba(47, 115, 216, 0.2), 0 5px 14px rgba(15, 23, 42, 0.08);
}

.hero-card::after {
  position: absolute;
  right: -72px;
  top: -96px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  content: "";
}

.tone-net,
:root.dark .tone-net {
  color: #ffffff;
  background: linear-gradient(160deg, #4f9df8 0%, #2f73d8 100%);
}

.tone-net span,
.tone-net small,
:root.dark .tone-net span,
:root.dark .tone-net small {
  color: rgba(255, 255, 255, 0.82);
}

.tone-net .amount-display strong,
:root.dark .tone-net .amount-display strong {
  color: #ffffff;
}

.amount-display strong {
  font-size: 62px;
  font-weight: 750;
  letter-spacing: -0.42px;
}

.metric-strip {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.metric-strip strong {
  color: rgba(255, 255, 255, 0.98);
  font-weight: 700;
}

.tone-net .metric-strip span,
.tone-net .metric-strip small {
  color: rgba(255, 255, 255, 0.82);
}

.tone-net .metric-strip strong {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.mini-card,
.goal-card,
.chart-card,
.allocation-card,
.movement-card,
.snapshot-card,
.toolbar-card,
.tree-card,
.detail-card {
  padding: 20px;
}

.mini-card {
  border-color: rgba(221, 229, 242, 0.82);
}

.mini-card strong,
.goal-progress-line strong,
.insight-grid strong,
.metric-strip strong,
.detail-hero > strong {
  font-weight: 720;
}

.mini-card span,
.metric-strip span,
.insight-grid span,
.settings-row span,
.toolbar-card > div span,
.section-heading span,
.snapshot-card small {
  color: var(--muted);
}

.section-heading h2,
.toolbar-card h2,
.settings-card strong {
  color: var(--ink);
}

.goal-progress-track,
.progress-track,
.snapshot-progress-track {
  background: #e8eef7;
}

.goal-progress-track div,
.progress-track div {
  background: var(--blue);
}

.allocation-pie {
  border: 10px solid #f2f6fb;
  box-shadow: inset 0 0 0 1px rgba(221, 229, 242, 0.88);
}

.movement-row,
.history-row,
.settings-row,
.account-row,
.snapshot-input-card,
.recognition-result-card,
.quality-result-item,
.quality-failure-item,
.template-group button,
.example-account-list,
.empty-state {
  border-radius: 16px;
}

.account-row,
.snapshot-input-card,
.movement-row,
.history-row {
  border-color: rgba(221, 229, 242, 0.84);
  background: #fbfdff;
}

.account-row:hover,
.template-group button:hover {
  background: #f3f8ff;
}

.settings-card {
  padding: 6px 0;
  overflow: hidden;
}

.settings-row {
  min-height: 54px;
  padding: 0 18px;
}

.plan-badge.premium {
  color: #075985;
  background: rgba(10, 132, 255, 0.12);
}

.bottom-tabs {
  width: min(calc(100% - 20px), 500px);
  min-height: 76px;
  margin-bottom: 10px;
  border: 1px solid rgba(221, 229, 242, 0.88);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.tab-button {
  border-radius: 16px;
  font-weight: 650;
}

.tab-button.active {
  color: var(--blue);
  background: rgba(10, 132, 255, 0.1);
}

.app-dialog::backdrop {
  background: rgba(15, 23, 42, 0.34);
}

.dialog-sheet {
  padding: 20px;
}

.sticky-head {
  background: rgba(255, 255, 255, 0.88);
}

.snapshot-card.floating-snapshot {
  border-color: rgba(10, 132, 255, 0.18);
  box-shadow: 0 18px 44px rgba(10, 132, 255, 0.18), 0 4px 14px rgba(15, 23, 42, 0.08);
}

:root.dark {
  --bg: #0f172a;
  --surface: #172033;
  --surface-strong: #1f2937;
  --surface-soft: #111827;
  --ink: #f8fafc;
  --muted: #a8b3c7;
  --line: rgba(148, 163, 184, 0.22);
  --card-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

:root.dark body {
  background:
    radial-gradient(circle at 50% -160px, rgba(10, 132, 255, 0.16), transparent 360px),
    var(--bg);
}

:root.dark .auth-panel,
:root.dark .mini-card,
:root.dark .goal-card,
:root.dark .chart-card,
:root.dark .allocation-card,
:root.dark .movement-card,
:root.dark .snapshot-card,
:root.dark .toolbar-card,
:root.dark .tree-card,
:root.dark .detail-card,
:root.dark .settings-card,
:root.dark .dialog-sheet {
  border-color: rgba(148, 163, 184, 0.2);
  background: var(--surface);
}

:root.dark .phone-login-form input,
:root.dark .review-login-form input,
:root.dark .dialog-sheet input,
:root.dark .dialog-sheet select,
:root.dark .dialog-sheet textarea,
:root.dark .account-row,
:root.dark .snapshot-input-card,
:root.dark .movement-row,
:root.dark .history-row {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.22);
}

:root.dark .bottom-tabs {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(23, 32, 51, 0.86);
}

@media (max-width: 420px) {
  .amount-display strong {
    font-size: 50px;
  }

  .mini-card,
  .goal-card,
  .chart-card,
  .allocation-card,
  .movement-card,
  .snapshot-card,
  .toolbar-card,
  .tree-card,
  .detail-card {
    padding: 18px;
  }
}

/* Net worth trend: iOS-style data card. */
.chart-card {
  border-radius: 20px;
  padding: 22px;
}

.chart-card .section-heading {
  margin-bottom: 12px;
}

.chart-card #growthRate12,
.chart-card #growthRate12.delta-positive,
.chart-card #growthRate12.delta-negative,
.chart-card #growthRate12.delta-neutral {
  color: var(--green);
  font-weight: 650;
}

#netWorthChart {
  height: 230px;
  margin-top: 2px;
}

/* UI density pass: keep the app at device scale while making the primary
   information surfaces easier to scan on small screens. */
.hero-card {
  min-height: 224px;
  padding: 20px;
}

.amount-display strong {
  font-size: 54px;
}

.metric-strip,
.change-grid,
.insight-grid {
  gap: 8px;
}

.metric-strip {
  padding-top: 12px;
}

.mini-card,
.goal-card,
.chart-card,
.allocation-card,
.movement-card,
.snapshot-card,
.toolbar-card,
.tree-card,
.detail-card {
  padding: 16px;
}

.mini-card {
  min-height: 96px;
}

.goal-card {
  gap: 10px;
}

.chart-card {
  border-radius: 18px;
  padding: 18px;
}

.main-content,
main,
.tab-panel,
.account-tree,
.snapshot-list,
.allocation-list,
.movement-list,
.history-list {
  gap: 12px;
}

/* The account dialog switch must not inherit native checkbox geometry. */
.switch-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.compact-sheet label.switch-line {
  gap: 12px;
}

.switch-line input[type="checkbox"] {
  display: block;
  flex: 0 0 auto;
  inline-size: 51px;
  block-size: 31px;
  min-inline-size: 51px;
  min-block-size: 31px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
}

.switch-line input[type="checkbox"]::before {
  inline-size: 27px;
  block-size: 27px;
  transform: translateX(0);
}

.switch-line input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

.switch-line input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

@media (max-width: 420px) {
  .hero-card {
    min-height: 210px;
    padding: 18px;
  }

  .amount-display strong {
    font-size: 48px;
  }

  .mini-card,
  .goal-card,
  .chart-card,
  .allocation-card,
  .movement-card,
  .snapshot-card,
  .toolbar-card,
  .tree-card,
  .detail-card {
    padding: 14px;
  }
}

#netWorthChart .chart-grid-line {
  stroke: rgba(15, 23, 42, 0.065);
  stroke-width: 1;
}

#netWorthChart .chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#netWorthChart .chart-area {
  stroke: none;
}

#netWorthChart .chart-key-point {
  fill: #ffffff;
  stroke: var(--blue);
  stroke-width: 2.2;
}

#netWorthChart .chart-key-point-low {
  stroke: var(--green);
}

#netWorthChart .chart-bubble {
  fill: #ffffff;
  stroke: rgba(221, 229, 242, 0.95);
  stroke-width: 1;
  filter: drop-shadow(0 5px 12px rgba(15, 23, 42, 0.08));
}

#netWorthChart .chart-bubble-current,
#netWorthChart .chart-bubble-high {
  stroke: rgba(10, 132, 255, 0.2);
}

#netWorthChart .chart-bubble-low {
  stroke: rgba(49, 163, 104, 0.2);
}

#netWorthChart .chart-bubble-text {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

#netWorthChart .chart-bubble-text-current,
#netWorthChart .chart-bubble-text-high {
  fill: var(--blue-link);
}

#netWorthChart .chart-bubble-text-low {
  fill: var(--green);
}

#netWorthChart .chart-axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 560;
}

.chart-card .insight-grid {
  gap: 0;
  margin-top: 16px;
  border: 1px solid rgba(221, 229, 242, 0.86);
  border-radius: 16px;
  padding: 13px 0;
  background: #f8fbff;
}

.chart-card .insight-grid div {
  padding: 0 14px;
}

.chart-card .insight-grid div:not(:last-child) {
  border-right: 1px solid rgba(221, 229, 242, 0.82);
}

.chart-card .insight-grid span {
  margin-bottom: 5px;
  color: #6d7685;
}

.chart-card .insight-grid strong {
  color: #121826;
  font-size: 16px;
  font-weight: 720;
}

:root.dark #netWorthChart .chart-grid-line {
  stroke: rgba(226, 232, 240, 0.08);
}

:root.dark #netWorthChart .chart-key-point,
:root.dark #netWorthChart .chart-bubble {
  fill: var(--surface);
}

:root.dark .chart-card .insight-grid {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.34);
}

:root.dark .chart-card .insight-grid div:not(:last-child) {
  border-right-color: rgba(148, 163, 184, 0.18);
}

:root.dark .chart-card .insight-grid span {
  color: var(--muted);
}

:root.dark .chart-card .insight-grid strong {
  color: var(--ink);
}

.danger-row,
.danger-row strong {
  color: var(--red);
}

.danger-button,
.primary-button.danger-button {
  background: var(--red);
  box-shadow: 0 10px 22px rgba(255, 59, 48, 0.2);
}

:root.dark .legal-section,
:root.dark .delete-impact-list {
  background: var(--surface-soft);
}

@media (max-width: 420px) {
  .chart-card {
    padding: 18px;
  }

  #netWorthChart {
    height: 220px;
  }
}

/* Settings hierarchy. */
.settings-view {
  display: none;
  gap: 18px;
  min-width: 0;
}

.settings-view.active {
  display: grid;
  animation: settings-view-in 180ms ease-out;
}

.settings-navigation-bar {
  position: relative;
  display: grid;
  min-height: 44px;
  place-items: center;
}

.settings-navigation-bar h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.settings-back-button {
  position: absolute;
  left: 0;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  color: var(--blue);
  background: transparent;
}

.settings-destination-row {
  width: 100%;
  cursor: pointer;
}

.settings-about-block {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 18px 12px 6px;
  color: var(--muted);
  text-align: center;
}

.settings-about-block > span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.settings-about-block small {
  font-size: 11px;
}

.settings-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
}

.settings-row > span:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.settings-row > strong {
  min-width: 0;
  max-width: 58%;
  flex: 0 1 auto;
  overflow-wrap: anywhere;
  text-align: right;
}

.settings-choice select {
  min-width: 0;
  max-width: 58%;
  flex: 0 1 auto;
}

.settings-danger-section {
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, var(--red) 22%, var(--line));
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.settings-danger-section .danger-row {
  color: var(--red);
}

.settings-legal-content {
  max-height: calc(100dvh - 190px);
  overflow-y: auto;
  padding-bottom: 24px;
}

.premium-benefit-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.premium-benefit-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
}

.premium-benefit-list li > span:first-child {
  color: #34c759;
  font-weight: 700;
}

.premium-ai-usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.premium-ai-usage-row strong {
  color: var(--blue);
  text-align: right;
}

.premium-plan-comparison {
  display: grid;
  gap: 5px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.premium-plan-comparison span,
.premium-plan-comparison small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.iap-product {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.iap-product-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.iap-product-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
}

.iap-product-price {
  color: var(--blue);
  font-size: 18px;
  font-weight: 720;
  white-space: nowrap;
}

.iap-product-price-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.iap-product .cloud-status {
  margin: 0;
}

.iap-product.is-loading .iap-product-name,
.iap-product.is-loading .iap-product-price {
  color: var(--muted);
}

/* Premium conversion page */
[data-settings-view="premium"] {
  gap: 16px;
}

.premium-status-card,
.premium-purchase-card,
.premium-plan-card {
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.premium-status-card {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.premium-eyebrow,
.premium-plan-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.08px;
}

.premium-status-card .plan-badge {
  color: var(--ink);
  font-size: 28px;
  font-weight: 720;
  letter-spacing: -0.6px;
}

.premium-status-card .plan-badge.premium {
  color: var(--blue-link);
}

.premium-ai-usage-row {
  margin-top: 4px;
  border: 0;
  border-radius: 14px;
  padding: 13px 14px;
  background: var(--surface-soft);
}

.premium-ai-usage-row strong {
  color: var(--ink);
}

.premium-status-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.premium-plan-comparison {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 0;
  padding: 0;
}

.premium-plan-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 18px;
}

.premium-plan-card h3 {
  color: var(--ink);
}

.premium-plan-card p {
  color: var(--blue-link);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.premium-plan-card ul {
  display: grid;
  gap: 9px;
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
}

.premium-plan-card li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.premium-plan-card li::before {
  margin-right: 7px;
  color: var(--green);
  content: "✓";
  font-weight: 700;
}

.premium-plan-card--premium {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
  background: color-mix(in srgb, var(--blue) 9%, var(--surface));
}

.premium-plan-card--premium h3,
.premium-plan-card--premium .premium-plan-kicker {
  color: var(--blue-link);
}

.premium-purchase-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.premium-purchase-hero {
  display: grid;
  gap: 7px;
  padding: 8px 4px 2px;
}

.premium-purchase-hero h3 {
  color: var(--ink);
  font-size: 26px;
  letter-spacing: -0.7px;
  line-height: 1.2;
}

.premium-purchase-hero p {
  color: var(--muted);
  font-size: 15px;
}

.premium-comparison-card {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.premium-comparison-grid {
  display: grid;
}

.premium-comparison-row {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(64px, .7fr) minmax(82px, .95fr);
  align-items: center;
  min-height: 52px;
  border-top: 1px solid var(--line);
}

.premium-comparison-row:first-child {
  border-top: 0;
}

.premium-comparison-row > span {
  min-width: 0;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.premium-comparison-row > span:not(:first-child) {
  min-height: 100%;
  border-left: 1px solid var(--line);
  color: var(--ink);
  text-align: center;
}

.premium-comparison-head {
  background: var(--surface-soft);
}

.premium-comparison-head > span {
  color: var(--ink);
  font-weight: 700;
}

.premium-comparison-head > span:last-child,
.premium-comparison-row > span:last-child {
  color: var(--blue-link);
  font-weight: 650;
}

.premium-purchase-bar {
  position: sticky;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 2;
  border-color: color-mix(in srgb, var(--blue) 28%, var(--line));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--ink) 16%, transparent);
}

[data-settings-view="premium"] {
  padding-bottom: 104px;
}

.premium-purchase-intro {
  display: grid;
  gap: 5px;
}

.premium-purchase-intro h3 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.premium-purchase-card .iap-product {
  gap: 8px;
  border: 0;
  padding: 0;
  background: transparent;
}

.iap-product.is-error {
  background: color-mix(in srgb, var(--orange) 10%, var(--surface));
}

.iap-product.is-error .cloud-status {
  color: var(--muted);
}

.premium-primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  color: #ffffff;
  background: var(--orange);
  font-size: 16px;
  font-weight: 700;
}

.premium-primary-action:disabled {
  cursor: default;
  opacity: 0.55;
}

.premium-restore-action {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.premium-restore-action span {
  color: var(--blue-link);
  font-weight: 600;
}

.premium-restore-status {
  margin: -8px 4px 0;
}

@media (max-width: 420px) {
  .premium-plan-comparison {
    grid-template-columns: 1fr;
  }

  .premium-comparison-row {
    grid-template-columns: minmax(0, 1.25fr) minmax(52px, .65fr) minmax(70px, .85fr);
  }

  .premium-comparison-row > span {
    padding: 10px 8px;
    font-size: 12px;
  }
}

:root.dark .settings-navigation-bar {
  border-bottom: 1px solid var(--line);
}

:root.dark .settings-danger-section {
  border-color: color-mix(in srgb, var(--red) 32%, var(--line));
  background: var(--surface);
}

:root.dark .settings-legal-content {
  border-bottom: 1px solid var(--line);
}

@keyframes settings-view-in {
  from {
    opacity: 0;
    transform: translateX(8px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 380px) {
  .settings-row {
    gap: 10px;
  }

  .settings-row > strong,
  .settings-choice select {
    max-width: 62%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .settings-view.active {
    animation: none;
  }
}

/* Editorial Wealth redesign: visual layer only. Existing IDs and state classes stay intact. */
html {
  background: var(--paper);
  font-family: "Source Serif 4", "Noto Serif SC", "Songti SC", serif;
}

body {
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--copper) 13%, transparent), transparent 30rem),
    var(--paper);
}

h1, h2, h3, .amount-display strong, .detail-hero > strong {
  font-family: "Cabinet Grotesk", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

.amount-display strong, .metric-strip strong, .line-chart text, .mini-chart text,
.iap-product-price, #goalPercent, .insight-grid strong {
  font-family: "DM Mono", "SFMono-Regular", "PingFang SC", monospace;
  font-variant-numeric: tabular-nums;
}

button, input, select, textarea { font-family: inherit; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 3px;
}

.auth-screen {
  align-items: start;
  padding: max(52px, env(safe-area-inset-top)) 24px max(36px, env(safe-area-inset-bottom));
  background: transparent;
}

.auth-panel {
  width: min(100%, 456px);
  margin: auto 0;
  border: 0;
  border-top: 1px solid var(--ink);
  border-radius: 0;
  padding: 28px 0 0;
  background: transparent;
  box-shadow: none;
}

.auth-brand {
  display: block;
  width: auto;
  height: auto;
  margin: 0 0 18px;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  font-family: "Cabinet Grotesk", "PingFang SC", sans-serif;
  font-size: clamp(2.2rem, 11vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.09em;
  line-height: 0.95;
}

.auth-wordmark { color: inherit; }
.auth-panel h1, .app-header h1 { max-width: 100%; letter-spacing: -0.055em; }
.auth-panel h1 { font-size: clamp(2.15rem, 10vw, 3.25rem); }
.auth-subtitle { max-width: 25rem; margin-top: 12px; font-size: 1rem; line-height: 1.62; }
.phone-login-form { margin-top: 38px; gap: 18px; }
.phone-login-form > label > span:first-child, .review-login-form label > span:first-child { color: var(--ink); font-size: 0.82rem; font-weight: 600; }

.phone-login-form > label input, .review-login-form input {
  min-height: 52px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  padding: 0 2px;
  background: transparent;
}

.phone-login-form > label input:focus { border-bottom-color: var(--forest); }
.code-button, .secondary-button { border-radius: 0; }
.code-button { min-width: 98px; color: var(--forest); background: color-mix(in srgb, var(--forest) 9%, transparent); }
.phone-login-button, .primary-button { min-height: 52px; border-radius: 0; color: #fffdf6; background: var(--forest); box-shadow: none; }
.apple-login-button { min-height: 52px; border-radius: 0; }
.auth-divider { margin: 28px 0; }
.auth-security-note { border: 0; border-left: 2px solid var(--copper); border-radius: 0; padding: 12px 0 12px 14px; background: transparent; }
.auth-status { color: var(--red); text-align: start; }

.app-shell {
  width: min(100%, 640px);
  padding: max(24px, env(safe-area-inset-top)) 20px calc(118px + env(safe-area-inset-bottom));
}

.app-header {
  align-items: end;
  padding: 12px 0 30px;
  border-bottom: 1px solid var(--rule);
}

.app-header h1 { font-size: clamp(2rem, 9vw, 3.25rem); line-height: 0.96; }
.eyebrow { color: var(--copper); font-family: "DM Mono", monospace; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; }
.icon-button { border: 1px solid var(--rule); border-radius: 50%; color: var(--ink); background: transparent; }
.icon-button svg, .tab-icon svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.tab-icon svg { width: 1.4rem; height: 1.4rem; }

.editorial-main, .tab-panel { gap: 22px; }
.hero-card, .mini-card, .goal-card, .chart-card, .allocation-card, .movement-card, .snapshot-card,
.toolbar-card, .tree-card, .detail-card, .settings-card, .dialog-sheet, .account-empty-state {
  border: 1px solid var(--rule);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface) 93%, transparent);
  box-shadow: none;
}

.editorial-net-worth {
  position: relative;
  overflow: hidden;
  min-height: 292px;
  border: 0;
  padding: 30px;
  color: #F5F1E8;
  background: var(--ink);
}

.editorial-net-worth::after {
  position: absolute;
  inset: auto -10% -45% 35%;
  width: 19rem;
  height: 19rem;
  border: 1px solid color-mix(in srgb, var(--copper) 65%, transparent);
  border-radius: 50%;
  content: "";
  opacity: .55;
}

.editorial-net-worth .hero-topline, .editorial-net-worth .amount-display, .editorial-net-worth .metric-rail { position: relative; z-index: 1; }
.editorial-net-worth span, .editorial-net-worth small { color: color-mix(in srgb, #F5F1E8 72%, transparent); }
.editorial-net-worth .amount-display strong { max-width: 100%; color: #F5F1E8; font-size: clamp(2.65rem, 12vw, 4.9rem); letter-spacing: -0.08em; line-height: .94; }
.metric-rail { gap: 0; border-top-color: color-mix(in srgb, #F5F1E8 20%, transparent); }
.metric-rail > div { padding: 0 12px; border-left: 1px solid color-mix(in srgb, #F5F1E8 18%, transparent); }
.metric-rail > div:first-child { border-left: 0; padding-left: 0; }
.metric-rail strong { color: #F5F1E8; font-size: clamp(.76rem, 3.4vw, .96rem); }

.change-grid { gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.mini-card { border: 0; border-right: 1px solid var(--rule); padding: 18px 0; background: transparent; }
.mini-card:last-child { border-right: 0; padding-left: 18px; }
.mini-card:first-child { padding-right: 18px; }
.mini-card strong { color: var(--ink); font-family: "DM Mono", monospace; font-size: 1.35rem; }

.goal-card, .chart-card, .allocation-card, .movement-card, .snapshot-card { padding: 24px; }
.goal-card { border-left: 3px solid var(--copper); }
.goal-progress-track { height: 4px; border-radius: 0; background: var(--surface-soft); }
.goal-progress-track > div { border-radius: 0; background: var(--forest); }
.editorial-chart-panel { padding-bottom: 20px; }
.editorial-chart-panel .section-heading { align-items: end; }
.line-chart { overflow: visible; }
.chart-grid-line { stroke: color-mix(in srgb, var(--rule) 78%, transparent); }
.chart-line { stroke: var(--forest); }
.chart-scrub-line, .chart-scrub-point { stroke: var(--copper); }
.chart-scrub-tooltip { fill: var(--ink); }
.insight-grid { gap: 0; border-top: 1px solid var(--rule); }
.insight-grid > div { padding: 14px 10px 0; border-left: 1px solid var(--rule); }
.insight-grid > div:first-child { border-left: 0; padding-left: 0; }

.toolbar-card { align-items: center; padding: 20px 0; border-inline: 0; }
.toolbar-card h2 { font-size: 1.7rem; }
.toolbar-card > div span { color: var(--muted); }
.account-empty-state { padding: 28px; border-left: 3px solid var(--copper); }
.account-ledger-panel { gap: 30px; padding: 0; border-inline: 0; }
.account-ledger-panel > div { padding: 22px 0 0; }
.account-ledger-panel > div + div { border-top: 1px solid var(--rule); }
.account-tree { gap: 0; }
.account-group, .account-row, .history-row { border-bottom-color: var(--rule); }
.detail-card { border-inline: 0; padding: 24px 0; }

.bottom-tabs {
  left: 50%;
  width: min(calc(100% - 24px), 616px);
  transform: translateX(-50%);
  border: 1px solid var(--rule);
  border-radius: 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  box-shadow: 0 14px 30px rgba(29, 33, 28, .12);
  backdrop-filter: blur(16px);
}

.tab-button { position: relative; min-height: 62px; border-radius: 0; color: var(--muted); }
.tab-button > span:first-child { display: grid; place-items: center; font-size: inherit; }
.tab-button.active { color: var(--forest); background: transparent; }
.tab-button.active::before { position: absolute; inset: 5px 18px auto; height: 2px; background: var(--copper); content: ""; }
.tab-button.active > span:first-child { transform: none; }

.settings-view { gap: 22px; }
.settings-navigation-bar { padding: 0 0 18px; border-bottom: 1px solid var(--rule); }
.settings-card { border-inline: 0; padding: 0; }
.settings-row { min-height: 60px; padding: 0 2px; border-bottom-color: var(--rule); }
.settings-row strong, .settings-chevron { color: var(--muted); }
.settings-destination-row:hover { background: color-mix(in srgb, var(--forest) 5%, transparent); }
.settings-danger-section { border-left-width: 3px; border-radius: 0; }

.premium-purchase-hero {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: 32px 26px;
  color: #F5F1E8;
  background: var(--ink);
}

.premium-purchase-hero h3 { max-width: 16ch; color: #F5F1E8; font-size: clamp(2rem, 9vw, 3.2rem); letter-spacing: -0.06em; line-height: .98; }
.premium-purchase-hero p { color: color-mix(in srgb, #F5F1E8 72%, transparent); }
.premium-purchase-hero::after { position: absolute; width: 16rem; height: 16rem; right: -7rem; bottom: -9rem; border: 1px solid var(--copper); border-radius: 50%; content: ""; opacity: .7; }
.premium-comparison-grid { border: 1px solid var(--rule); }
.premium-comparison-head { background: var(--surface-soft); }
.premium-purchase-bar { border: 1px solid color-mix(in srgb, var(--copper) 55%, var(--rule)); border-radius: 0; background: var(--surface); }
.premium-primary-action { border-radius: 0; background: var(--forest); }
.premium-restore-action { border-radius: 0; }
.benefit-included { display: inline-grid; width: 1rem; height: 1rem; place-items: center; color: var(--forest); }
.benefit-included svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; }

.app-dialog { align-items: end; padding: 0; background: transparent; }
.app-dialog::backdrop { background: rgba(17, 22, 17, .44); backdrop-filter: blur(3px); }
.dialog-sheet { width: min(100%, 640px); max-height: min(88svh, 800px); margin: 0 auto; border-bottom: 0; border-radius: 18px 18px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }

button, .icon-button, .tab-button, .settings-row, .hero-card, .mini-card, .chart-card, .allocation-card, .movement-card, .snapshot-card {
  transition: transform 180ms ease, color 180ms ease, background-color 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

button:active:not(:disabled), .icon-button:active:not(:disabled) { transform: scale(.97); }

@keyframes editorial-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes chart-reveal {
  from { opacity: .2; transform: scale(.97); }
  to { opacity: 1; transform: scale(1); }
}

.tab-panel.active > * { animation: editorial-rise 520ms cubic-bezier(.2, .8, .2, 1); }
.tab-panel.active > *:nth-child(2) { animation-delay: 50ms; }
.tab-panel.active > *:nth-child(3) { animation-delay: 100ms; }
.tab-panel.active > *:nth-child(4) { animation-delay: 150ms; }
.editorial-chart-panel .line-chart { transform-origin: 50% 50%; animation: chart-reveal 740ms cubic-bezier(.2, .8, .2, 1); }

@media (max-width: 420px) {
  .auth-screen { padding-inline: 18px; }
  .app-shell { padding-inline: 16px; }
  .editorial-net-worth { min-height: 270px; padding: 24px; }
  .editorial-net-worth .amount-display strong { font-size: clamp(2.35rem, 12vw, 3.2rem); }
  .metric-rail > div { padding-inline: 8px; }
  .goal-card, .chart-card, .allocation-card, .movement-card, .snapshot-card { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Keep late legacy dark-mode declarations from overriding the Editorial Wealth palette. */
:root.dark {
  --paper: #151914;
  --ink: #F1EEE6;
  --forest: #80B693;
  --copper: #D3A86E;
  --rule: rgba(241, 238, 230, 0.15);
  --bg: var(--paper);
  --surface: #1D211C;
  --surface-strong: #242A23;
  --surface-soft: #292F27;
  --muted: #AAB0A5;
  --line: var(--rule);
  --blue: var(--forest);
  --blue-link: var(--forest);
  --green: var(--forest);
  --red: #E57B70;
  --orange: var(--copper);
  --card-shadow: none;
}

:root.dark body { background: var(--paper); }
:root.dark .sticky-head { background: color-mix(in srgb, var(--surface) 92%, transparent); }
:root.dark .editorial-net-worth { color: #F5F1E8; background: var(--ink); }
:root.dark .editorial-net-worth .amount-display strong { color: #F5F1E8; }
:root.dark .bottom-tabs { border-color: var(--rule); background: color-mix(in srgb, var(--paper) 92%, transparent); }
:root.dark .tab-button { color: var(--muted); background: transparent; }
:root.dark .tab-button.active { color: var(--forest); background: transparent; }
:root.dark .chart-card, :root.dark .allocation-card, :root.dark .movement-card,
:root.dark .toolbar-card, :root.dark .tree-card, :root.dark .detail-card,
:root.dark .settings-card, :root.dark .dialog-sheet { background: color-mix(in srgb, var(--surface) 93%, transparent); }

/* Apple Lightwealth: visual layer only. Stable DOM and state contracts remain unchanged. */
:root {
  --lw-blue: #0A84FF;
  --lw-mint: #30D158;
  --lw-amber: #FF9F0A;
  --lw-red: #FF453A;
  --lw-bg: #F2F2F7;
  --lw-surface: #FFFFFF;
  --lw-surface-alt: #E5E5EA;
  --lw-ink: #1C1C1E;
  --lw-muted: #6C6C70;
  --lw-line: rgba(60, 60, 67, 0.18);
  --lw-radius-sm: 12px;
  --lw-radius-md: 16px;
  --lw-radius-lg: 20px;
  --lw-space-2: 8px;
  --lw-space-3: 12px;
  --lw-space-4: 16px;
  --lw-space-5: 20px;
  --lw-space-6: 24px;
  --lw-space-8: 32px;
  --lw-ease: cubic-bezier(0.2, 0, 0, 1);
  --lw-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --paper: var(--lw-bg);
  --bg: var(--lw-bg);
  --surface: var(--lw-surface);
  --surface-strong: var(--lw-surface);
  --surface-soft: var(--lw-surface-alt);
  --ink: var(--lw-ink);
  --muted: var(--lw-muted);
  --rule: var(--lw-line);
  --line: var(--lw-line);
  --blue: var(--lw-blue);
  --blue-link: var(--lw-blue);
  --green: var(--lw-mint);
  --orange: var(--lw-amber);
  --red: var(--lw-red);
  --copper: var(--lw-amber);
  --forest: var(--lw-blue);
  --card-shadow: 0 10px 28px rgba(60, 60, 67, 0.10);
}

:root.dark {
  color-scheme: dark;
  --lw-bg: #000814;
  --lw-surface: rgba(28, 37, 54, 0.88);
  --lw-surface-alt: #202A3A;
  --lw-ink: #F2F2F7;
  --lw-muted: #AEB7C6;
  --lw-line: rgba(235, 241, 255, 0.16);
  --paper: var(--lw-bg);
  --bg: var(--lw-bg);
  --surface: var(--lw-surface);
  --surface-strong: var(--lw-surface);
  --surface-soft: var(--lw-surface-alt);
  --ink: var(--lw-ink);
  --muted: var(--lw-muted);
  --rule: var(--lw-line);
  --line: var(--lw-line);
  --blue: var(--lw-blue);
  --blue-link: var(--lw-blue);
  --green: var(--lw-mint);
  --orange: var(--lw-amber);
  --red: var(--lw-red);
  --copper: var(--lw-amber);
  --forest: var(--lw-blue);
  --card-shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
}

html, body, button, input, select, textarea {
  font-family: "PingFang SC", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

body { background: var(--lw-bg); }

h1, h2, h3, .amount-display strong, .detail-hero > strong {
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
}

.lightwealth-numerals {
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
}

.amount-display strong, .metric-strip strong, .mini-card strong, .line-chart text, .mini-chart text,
.iap-product-price, #goalPercent, .insight-grid strong, .account-row strong, .history-row strong,
.detail-hero > strong, #monthRate, #yearRate {
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.settings-destination-row:focus-visible {
  outline: 2px solid var(--lw-blue);
  outline-offset: 3px;
}

button, .icon-button, .tab-button, .settings-destination-row, input, select, textarea {
  min-height: 44px;
  transition: transform 150ms var(--lw-ease), background-color 200ms var(--lw-ease), color 200ms var(--lw-ease), border-color 200ms var(--lw-ease), opacity 150ms var(--lw-ease);
}

button:active:not(:disabled), .icon-button:active:not(:disabled), .tab-button:active:not(:disabled) { transform: scale(.97); }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .55; }

.lightwealth-auth {
  padding: max(40px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  background: var(--lw-bg);
}

.lightwealth-auth .auth-panel {
  width: min(100%, 420px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.lightwealth-auth .auth-brand {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 0 8px;
  place-items: center;
  border-radius: 50%;
  color: transparent;
  background: transparent;
  box-shadow: none;
  font-size: 0;
}
.lightwealth-auth .auth-brand::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lw-blue);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--lw-blue) 12%, transparent);
  content: "";
}

.lightwealth-auth .auth-brand {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: 16px;
  background: transparent;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--lw-blue) 18%, transparent);
}

.lightwealth-auth .auth-brand::before {
  display: none;
}

.auth-brand-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lightwealth-auth h1 { margin: 0; font-size: clamp(2.25rem, 11vw, 2.75rem); line-height: 1.06; }
.lightwealth-auth .eyebrow { margin: 0 0 6px; color: var(--lw-muted); font-family: inherit; font-size: 12px; letter-spacing: 0; text-transform: none; }
.lightwealth-auth .auth-subtitle { margin: 10px 0 0; }
.lightwealth-auth .auth-subtitle, .lightwealth-auth .auth-helper-text, .lightwealth-auth .auth-security-note { color: var(--lw-muted); }
.lightwealth-auth .phone-login-form { gap: 0; overflow: hidden; margin-top: 28px; border: 1px solid var(--lw-line); border-radius: var(--lw-radius-md); background: var(--lw-surface); }
.lightwealth-auth .phone-login-form > label { gap: 6px; padding: 14px 16px; }
.lightwealth-auth .phone-login-form > label + label { border-top: 1px solid var(--lw-line); }
.lightwealth-auth .phone-login-form > label input { min-height: 30px; border: 0; padding: 0; background: transparent; }
.lightwealth-auth .phone-login-form > .auth-helper-text { margin: 0; padding: 12px 16px; border-top: 1px solid var(--lw-line); background: color-mix(in srgb, var(--lw-bg) 75%, transparent); }
.lightwealth-auth .phone-login-button { width: min(100%, 280px); min-height: 48px; justify-self: center; margin: 16px 0 0; border-radius: var(--lw-radius-sm); background: var(--lw-blue); box-shadow: 0 6px 16px color-mix(in srgb, var(--lw-blue) 24%, transparent); }
.lightwealth-auth .code-button { min-height: 44px; border-radius: var(--lw-radius-sm); color: var(--lw-blue); background: color-mix(in srgb, var(--lw-blue) 10%, var(--lw-surface)); }
.lightwealth-auth .apple-login-button { width: min(100%, 280px); min-height: 48px; justify-self: center; margin-top: 0; border-radius: var(--lw-radius-sm); }
.lightwealth-auth .auth-divider { margin: 20px 0; color: var(--lw-muted); }
.lightwealth-auth .login-agreement { margin-top: 18px; }
.lightwealth-auth .auth-security-note { display: block; margin-top: 12px; border: 0; padding: 0; background: transparent; font-size: 11px; line-height: 1.5; }
.lightwealth-auth .auth-security-note strong { display: none; }

.lightwealth-auth .auth-review-trigger {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 0 8px;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.lightwealth-auth .auth-review-trigger:active {
  transform: scale(0.96);
}

.auth-review-trigger-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightwealth-auth .apple-login-button .apple-logo {
  position: static;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  transform: none;
  object-fit: contain;
}

.lightwealth-auth .login-agreement {
  display: flex;
  width: min(100%, 280px);
  align-items: center;
  gap: 9px;
  margin: 18px auto 0;
}

.lightwealth-auth .login-agreement > input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
}

.lightwealth-shell { width: min(100%, 640px); padding: max(22px, env(safe-area-inset-top)) 16px calc(116px + env(safe-area-inset-bottom)); }
.lightwealth-shell .app-header { padding: 6px 4px 24px; border: 0; }
.lightwealth-shell .app-header h1 { font-size: clamp(2rem, 9vw, 2.25rem); letter-spacing: -.045em; }
.lightwealth-shell .eyebrow { color: var(--lw-muted); font-family: inherit; letter-spacing: 0; text-transform: none; }
.lightwealth-shell .icon-button { border: 0; border-radius: 50%; color: var(--lw-blue); background: color-mix(in srgb, var(--lw-blue) 10%, var(--lw-surface)); }

.lightwealth-nav {
  width: min(calc(100% - 24px), 616px);
  border: 1px solid color-mix(in srgb, var(--lw-line) 80%, transparent);
  border-radius: var(--lw-radius-md);
  background: color-mix(in srgb, var(--lw-surface) 84%, transparent);
  box-shadow: 0 12px 30px rgba(60, 60, 67, .16);
  backdrop-filter: blur(20px) saturate(1.35);
}
.lightwealth-nav .tab-button { min-height: 62px; border-radius: 12px; color: var(--lw-muted); }
.lightwealth-nav .tab-button.active { color: var(--lw-blue); }
.lightwealth-nav .tab-button.active::before { inset: 5px 22px auto; height: 3px; border-radius: 999px; background: var(--lw-blue); }

.lightwealth-net-worth {
  isolation: isolate;
  overflow: hidden;
  min-height: 272px;
  border: 0;
  border-radius: var(--lw-radius-lg);
  color: #fff;
  background: linear-gradient(145deg, #148CFF 0%, var(--lw-blue) 50%, #0066D6 100%);
  box-shadow: 0 14px 32px rgba(10, 132, 255, .28);
}
.lightwealth-net-worth::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  backdrop-filter: blur(10px) saturate(1.08);
  content: "";
  pointer-events: none;
}
.lightwealth-net-worth .hero-topline,
.lightwealth-net-worth .amount-display,
.lightwealth-net-worth .metric-rail {
  position: relative;
  z-index: 2;
}
.lightwealth-net-worth::after {
  left: auto;
  right: 16px;
  top: 14px;
  bottom: auto;
  width: 136px;
  height: 136px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 72% 28%, rgba(255, 255, 255, .18) 0%, rgba(255, 255, 255, .07) 38%, rgba(255, 255, 255, 0) 72%);
  opacity: 1;
  z-index: 1;
}
.lightwealth-net-worth span, .lightwealth-net-worth small, .lightwealth-net-worth .amount-display strong, .lightwealth-net-worth .metric-strip strong { color: #fff; }
.lightwealth-net-worth .metric-rail { border-top-color: rgba(255, 255, 255, .28); }
.lightwealth-net-worth .metric-rail > div { border-left-color: rgba(255, 255, 255, .2); }

.lightwealth-metric-grid { gap: 12px; border: 0; }
.lightwealth-metric-grid .mini-card { min-height: 102px; border: 0; border-radius: var(--lw-radius-md); padding: 18px; background: var(--lw-surface); box-shadow: 0 3px 10px rgba(60, 60, 67, .05); }
.lightwealth-metric-grid .mini-card + .mini-card { padding-left: 18px; }

.lightwealth-shell .goal-card, .lightwealth-shell .chart-card, .lightwealth-shell .allocation-card, .lightwealth-shell .movement-card, .lightwealth-shell .snapshot-card, .lightwealth-shell .toolbar-card, .lightwealth-shell .tree-card, .lightwealth-shell .detail-card, .lightwealth-shell .settings-card, .lightwealth-shell .dialog-sheet, .lightwealth-shell .account-empty-state {
  border: 0;
  border-radius: var(--lw-radius-md);
  background: var(--lw-surface);
  box-shadow: 0 3px 12px rgba(60, 60, 67, .06);
}
.lightwealth-shell .goal-card { border-left: 0; }
.lightwealth-shell .goal-progress-track > div { background: var(--lw-blue); }
.lightwealth-chart-card .chart-line { stroke: var(--lw-blue); }
.lightwealth-chart-card .chart-scrub-line, .lightwealth-chart-card .chart-scrub-point { stroke: var(--lw-amber); }
.lightwealth-chart-card .chart-scrub-tooltip { fill: #1C1C1E; }

.lightwealth-shell .toolbar-card h2 { font-size: 22px; line-height: 1.25; }
.lightwealth-account-list { overflow: hidden; border-inline: 0; padding: 0; }
.lightwealth-account-list > div { padding: 0; }
.lightwealth-account-list > div + div { margin-top: 20px; border-top: 1px solid var(--lw-line); }
.lightwealth-account-list .account-group { padding: 14px 16px 4px; background: var(--lw-surface); }
.lightwealth-account-list .account-row, .lightwealth-account-list .history-row { min-height: 64px; padding-inline: 16px; border-bottom-color: var(--lw-line); }
.lightwealth-account-list .account-row-main { font-size: 16px; font-weight: 600; }
.lightwealth-account-list .account-row:last-child, .lightwealth-account-list .history-row:last-child { border-bottom: 0; }
.lightwealth-shell .toolbar-card { padding: 16px; border-inline: 0; }
.lightwealth-shell .toolbar-card .primary-button, .lightwealth-shell .add-account-button { border-radius: 10px; background: var(--lw-blue); }
.lightwealth-shell .detail-card { padding: 20px 16px; border-inline: 0; }
.lightwealth-shell #accountDetail .empty-state { min-height: 152px; }

.lightwealth-shell .settings-view { gap: 20px; }
.lightwealth-shell .settings-navigation-bar { padding: 0 4px 12px; border: 0; }
.lightwealth-shell .settings-card { overflow: hidden; border-inline: 0; padding: 0; }
.lightwealth-shell .settings-row { min-height: 54px; padding: 0 16px; border-bottom-color: var(--lw-line); }
.lightwealth-shell .settings-row:last-child { border-bottom: 0; }
.lightwealth-shell .settings-row strong, .lightwealth-shell .settings-chevron { color: var(--lw-muted); }
.lightwealth-shell .settings-destination-row:hover { background: color-mix(in srgb, var(--lw-blue) 7%, var(--lw-surface)); }
.lightwealth-shell .settings-danger-section { border-left: 0; background: color-mix(in srgb, var(--lw-red) 8%, var(--lw-surface)); }

.lightwealth-premium-hero { border-radius: var(--lw-radius-lg); background: linear-gradient(145deg, #148CFF, #0066D6); box-shadow: 0 14px 32px rgba(10, 132, 255, .24); }
.lightwealth-premium-hero::after { border-color: rgba(255, 255, 255, .28); }
.lightwealth-shell .premium-purchase-bar { border: 0; border-radius: var(--lw-radius-md); background: var(--lw-surface); }
.lightwealth-shell .premium-primary-action { border-radius: var(--lw-radius-sm); background: #FF9F0A; }
.lightwealth-shell .premium-restore-action { border-radius: var(--lw-radius-sm); color: var(--lw-blue); }
.lightwealth-shell .premium-comparison-grid { overflow: hidden; border: 0; border-radius: var(--lw-radius-md); background: var(--lw-surface); }
.lightwealth-shell .premium-comparison-head { background: color-mix(in srgb, var(--lw-blue) 9%, var(--lw-surface)); }

.app-dialog::backdrop { background: rgba(9, 18, 35, .38); backdrop-filter: blur(5px); }
.dialog-sheet { border: 0; border-radius: 20px 20px 0 0; background: var(--lw-surface); box-shadow: 0 -8px 28px rgba(0, 0, 0, .12); }
.dialog-sheet input, .dialog-sheet select, .dialog-sheet textarea { border-color: var(--lw-line); border-radius: 10px; background: color-mix(in srgb, var(--lw-bg) 72%, var(--lw-surface)); }
.account-empty-state { border-left: 0; text-align: center; }

@keyframes lightwealth-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-panel.active > * { animation: lightwealth-rise 360ms var(--lw-ease); }
.lightwealth-chart-card .line-chart { transform-origin: 50% 50%; animation: lightwealth-rise 520ms var(--lw-ease); }

:root.dark body { background: var(--lw-bg); }
:root.dark .lightwealth-net-worth { background: linear-gradient(145deg, #148CFF 0%, var(--lw-blue) 50%, #0066D6 100%); }
:root.dark .lightwealth-nav { background: color-mix(in srgb, #111D31 86%, transparent); border-color: var(--lw-line); }
:root.dark .lightwealth-shell .goal-card, :root.dark .lightwealth-shell .chart-card, :root.dark .lightwealth-shell .allocation-card, :root.dark .lightwealth-shell .movement-card, :root.dark .lightwealth-shell .snapshot-card, :root.dark .lightwealth-shell .toolbar-card, :root.dark .lightwealth-shell .tree-card, :root.dark .lightwealth-shell .detail-card, :root.dark .lightwealth-shell .settings-card, :root.dark .dialog-sheet, :root.dark .lightwealth-metric-grid .mini-card { background: var(--lw-surface); }
:root.dark .lightwealth-account-list > div + div { border-top-color: var(--lw-bg); }

@media (max-width: 420px) {
  .lightwealth-auth { padding-inline: 18px; }
  .lightwealth-shell { padding-inline: 16px; }
  .lightwealth-net-worth { min-height: 250px; padding: 22px; }
  .lightwealth-net-worth .amount-display strong { font-size: clamp(2.3rem, 12vw, 3.15rem); }
}

@media (prefers-reduced-motion: reduce) {
  .tab-panel.active > *, .lightwealth-chart-card .line-chart { animation: none; }
}

.lightwealth-shell button:not(.icon-button) {
  border-radius: var(--lw-radius-sm);
}

.lightwealth-auth button:not(.icon-button),
.dialog-sheet button:not(.icon-button) {
  border-radius: var(--lw-radius-sm);
}

.lightwealth-shell .icon-button,
.lightwealth-auth .icon-button {
  border-radius: 50%;
}

.lightwealth-shell .tab-button {
  border-radius: 12px;
}

.account-dialog-progress {
  margin: -4px 0 4px;
  color: var(--lw-muted);
  font-size: 13px;
  line-height: 1.4;
}
.account-choice-section,
.account-name-section,
.account-details-section {
  display: grid;
  gap: 10px;
}
.account-choice-section > span,
.account-name-section > span,
.account-details-section > span {
  color: var(--lw-ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.account-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.account-category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 8px;
}
.account-choice-card {
  min-height: 44px;
  border: 1px solid color-mix(in srgb, var(--lw-ink) 8%, transparent);
  background: color-mix(in srgb, var(--lw-surface) 80%, transparent);
  color: var(--lw-ink);
  text-align: left;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.account-choice-card {
  min-height: 72px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
}
.account-choice-card.is-selected,
.account-category-card.is-selected .account-category-icon {
  border-color: color-mix(in srgb, var(--lw-blue) 42%, transparent);
  background: color-mix(in srgb, var(--lw-blue) 12%, var(--lw-surface));
  box-shadow: 0 5px 16px color-mix(in srgb, var(--lw-blue) 10%, transparent);
}
.account-choice-card:active,
.account-category-card:active { transform: scale(.985); }
.account-category-card {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 74px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lw-muted);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  transition: color 160ms ease, transform 160ms ease;
}
.account-category-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--lw-ink) 5%, var(--lw-surface));
  color: var(--lw-blue);
  font-size: 20px;
  font-weight: 600;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}
.account-category-icon .lucide {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
}
.account-category-card.is-selected { color: var(--lw-blue); }
.account-category-card.is-selected .account-category-icon { background: var(--lw-blue); color: #fff; box-shadow: 0 5px 16px color-mix(in srgb, var(--lw-blue) 18%, transparent); }
.account-category-label { max-width: 64px; }
.account-name-section,
.account-details-section {
  padding: 14px;
  border-radius: var(--lw-radius-md);
  background: color-mix(in srgb, var(--lw-surface) 72%, transparent);
  box-shadow: 0 3px 12px rgba(60, 60, 67, .04);
}
.account-name-section > label { display: grid; gap: 7px; color: var(--lw-muted); font-size: 13px; }
.account-name-section > label input { min-height: 44px; }
.account-templates { gap: 8px; }
.account-templates > span { color: var(--lw-muted); font-size: 13px; }
.template-group button { min-height: 36px; border-radius: 10px; }
.account-typed-fields {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}
.account-typed-fields label { display: grid; gap: 7px; font-size: 13px; color: var(--lw-muted); }
.account-typed-fields input { min-height: 44px; text-align: right; font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-variant-numeric: tabular-nums; }
.account-valuation-preview { display: block; padding: 14px; border-radius: var(--lw-radius-md); background: color-mix(in srgb, var(--lw-blue) 9%, white); color: var(--lw-ink); font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 420px) { .account-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .account-category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 6px; } }

/* Compact density pass: preserve Apple touch targets while reducing visual dead space. */
.lightwealth-shell {
  padding: max(18px, env(safe-area-inset-top)) 12px calc(102px + env(safe-area-inset-bottom));
}

.lightwealth-shell .app-header {
  padding: 4px 2px 16px;
}

.lightwealth-shell .app-header h1 {
  font-size: clamp(1.875rem, 8vw, 2rem);
}

.lightwealth-shell main,
.lightwealth-shell .tab-panel,
.lightwealth-shell .account-tree,
.lightwealth-shell .snapshot-list,
.lightwealth-shell .allocation-list,
.lightwealth-shell .movement-list,
.lightwealth-shell .history-list {
  gap: 12px;
}

.lightwealth-nav {
  width: min(calc(100% - 20px), 616px);
}

.lightwealth-nav .tab-button {
  min-height: 56px;
}

.lightwealth-net-worth {
  min-height: 214px;
  gap: 14px;
  padding: 18px;
}

.lightwealth-net-worth .amount-display strong {
  font-size: clamp(2.25rem, 10vw, 3.1rem);
}

.lightwealth-net-worth .metric-strip {
  padding-top: 12px;
}

.lightwealth-net-worth .metric-strip span,
.lightwealth-shell .mini-card span,
.lightwealth-shell .insight-grid span {
  margin-bottom: 4px;
}

.lightwealth-metric-grid {
  gap: 10px;
}

.lightwealth-metric-grid .mini-card {
  min-height: 92px;
  padding: 14px;
}

.lightwealth-metric-grid .mini-card + .mini-card {
  padding-left: 14px;
}

.lightwealth-metric-grid .mini-card strong {
  font-size: 21px;
}

.lightwealth-shell .goal-card,
.lightwealth-shell .chart-card,
.lightwealth-shell .allocation-card,
.lightwealth-shell .movement-card,
.lightwealth-shell .snapshot-card,
.lightwealth-shell .tree-card,
.lightwealth-shell .detail-card {
  padding: 14px;
}

.lightwealth-shell .goal-card {
  gap: 10px;
}

.lightwealth-shell .goal-edit-button,
.lightwealth-shell .primary-button,
.lightwealth-shell .secondary-button {
  min-height: 44px;
}

.lightwealth-shell .toolbar-card {
  min-height: 68px;
  padding: 14px;
}

.lightwealth-shell .toolbar-card h2 {
  font-size: 20px;
}

.lightwealth-shell .toolbar-card > div span {
  margin-top: 2px;
  font-size: 12px;
}

.lightwealth-account-list > div + div {
  margin-top: 14px;
}

.lightwealth-account-list .account-group {
  padding: 10px 14px 2px;
}

.lightwealth-account-list .account-row,
.lightwealth-account-list .history-row {
  min-height: 56px;
  padding-inline: 14px;
}

.lightwealth-account-list .account-row-main {
  font-size: 15px;
}

.lightwealth-shell .detail-card {
  padding: 16px 14px;
}

.lightwealth-shell #accountDetail .empty-state {
  min-height: 132px;
}

.lightwealth-shell .settings-view {
  gap: 14px;
}

.lightwealth-shell .settings-navigation-bar {
  padding-bottom: 8px;
}

.lightwealth-shell .settings-row {
  min-height: 48px;
  padding-inline: 14px;
}

.lightwealth-shell .premium-purchase-hero {
  padding: 22px 18px;
}

.lightwealth-shell .premium-purchase-hero h3 {
  font-size: clamp(1.75rem, 8vw, 2.5rem);
}

.lightwealth-shell .premium-comparison-row {
  min-height: 46px;
}

.dialog-sheet {
  gap: 12px;
  padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
}

.lightwealth-shell .dialog-head h2,
.dialog-sheet .dialog-head h2 {
  font-size: 24px;
}

.dialog-sheet .account-choice-section,
.dialog-sheet .account-name-section,
.dialog-sheet .account-details-section {
  gap: 8px;
}

.dialog-sheet .account-choice-grid {
  gap: 8px;
}

.dialog-sheet .account-category-grid {
  gap: 10px 6px;
}

.dialog-sheet .account-choice-card {
  min-height: 60px;
  padding: 12px;
}

.dialog-sheet .account-category-card {
  min-height: 66px;
  gap: 5px;
}

.dialog-sheet .account-category-icon {
  width: 40px;
  height: 40px;
}

.dialog-sheet .account-name-section,
.dialog-sheet .account-details-section,
.dialog-sheet .account-valuation-preview {
  padding: 12px;
}

.dialog-sheet .account-typed-fields {
  gap: 10px;
}

@media (max-width: 420px) {
  .lightwealth-shell {
    padding-inline: 12px;
  }

  .lightwealth-net-worth {
    min-height: 204px;
    padding: 16px;
  }
}

/* Extra compact density: keep hierarchy legible while fitting more of each view above the fold. */
.lightwealth-shell {
  padding-top: max(12px, env(safe-area-inset-top));
}

.lightwealth-shell .app-header {
  padding-bottom: 10px;
}

.lightwealth-shell main,
.lightwealth-shell .tab-panel,
.lightwealth-shell .account-tree,
.lightwealth-shell .snapshot-list,
.lightwealth-shell .allocation-list,
.lightwealth-shell .movement-list,
.lightwealth-shell .history-list {
  gap: 8px;
}

.lightwealth-net-worth {
  min-height: 160px;
  gap: 8px;
  padding: 12px;
}

.lightwealth-net-worth .amount-display strong {
  font-size: clamp(2.1rem, 9vw, 2.75rem);
}

.lightwealth-net-worth .metric-strip {
  padding-top: 9px;
}

.lightwealth-metric-grid {
  gap: 8px;
}

.lightwealth-metric-grid .mini-card {
  min-height: 78px;
  padding: 12px;
}

.lightwealth-metric-grid .mini-card + .mini-card {
  padding-left: 12px;
}

.lightwealth-metric-grid .mini-card strong {
  font-size: 19px;
}

.lightwealth-shell .goal-card,
.lightwealth-shell .chart-card,
.lightwealth-shell .allocation-card,
.lightwealth-shell .movement-card,
.lightwealth-shell .tree-card,
.lightwealth-shell .detail-card {
  padding: 12px;
}

.lightwealth-shell .goal-card {
  gap: 7px;
}

.lightwealth-shell .goal-card strong {
  font-size: 25px;
}

.lightwealth-shell .toolbar-card {
  min-height: 52px;
  padding: 10px;
}

.lightwealth-shell .toolbar-card h2 {
  font-size: 19px;
}

.lightwealth-shell .account-list,
.lightwealth-shell .account-groups {
  gap: 8px;
}

.lightwealth-account-list > div + div {
  margin-top: 6px;
}

.lightwealth-account-list .account-group {
  padding: 6px 10px 0;
}

.lightwealth-account-list .account-row,
.lightwealth-account-list .history-row {
  min-height: 44px;
  padding-inline: 10px;
}

/* Compact account ledger rows: keep the list information-dense without hiding the amount or trend. */
.lightwealth-account-list .group-button {
  min-height: 36px;
}

.lightwealth-account-list .group-button span {
  font-size: 14px;
}

.lightwealth-account-list .group-count {
  font-size: 12px;
}

.lightwealth-account-list .account-row,
.lightwealth-account-list .history-row {
  min-height: 38px;
  padding-block: 6px;
}

.lightwealth-account-list .account-row-main,
.lightwealth-account-list .account-row-side {
  gap: 1px;
}

.lightwealth-account-list .account-row-main {
  font-size: 14px;
}

.lightwealth-account-list .account-row-side strong {
  font-size: 14px;
}

.lightwealth-account-list .account-row-side small {
  font-size: 11px;
}

/* Keep the two account directions visually connected instead of leaving a large grid gap. */
.lightwealth-account-list {
  gap: 0;
}

.lightwealth-account-list > div + div {
  margin-top: 0;
}

.lightwealth-account-list .group-accounts {
  padding-bottom: 0;
}

.lightwealth-shell .settings-view {
  gap: 10px;
}

.lightwealth-shell .settings-navigation-bar {
  padding-bottom: 4px;
}

.lightwealth-shell .settings-row {
  min-height: 44px;
  padding-inline: 12px;
}

.lightwealth-shell .premium-purchase-hero {
  padding: 18px 14px;
}

.lightwealth-shell .premium-comparison-row {
  min-height: 42px;
}

.dialog-sheet {
  gap: 8px;
  padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
}

.dialog-sheet .account-choice-card {
  min-height: 54px;
  padding: 10px;
}

.dialog-sheet .account-category-card {
  min-height: 60px;
}

.dialog-sheet .account-category-icon {
  width: 36px;
  height: 36px;
}

.dialog-sheet .account-name-section,
.dialog-sheet .account-details-section,
.dialog-sheet .account-valuation-preview {
  padding: 10px;
}

@media (max-width: 420px) {
  .lightwealth-net-worth {
    min-height: 152px;
    padding: 11px;
  }
}

/* Bottom navigation: a fixed 44pt control row plus only the system Home Indicator inset. */
.lightwealth-shell {
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

.lightwealth-nav {
  bottom: 0;
  box-sizing: border-box;
  height: calc(46px + env(safe-area-inset-bottom));
  min-height: 0;
  margin-bottom: 0;
  padding: 0 12px env(safe-area-inset-bottom);
  border-radius: 16px 16px 0 0;
}

.lightwealth-nav .tab-button {
  min-height: 44px;
  padding-inline: 10px;
  border-radius: 12px;
}

.lightwealth-nav .tab-button.active::before {
  inset: 3px 20px auto;
  height: 2px;
}

.lightwealth-nav .tab-icon svg {
  stroke-width: 2;
}

/* Compact snapshot action: keep the card readable without wasting bottom space. */
.lightwealth-shell .snapshot-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.lightwealth-shell .snapshot-card > div {
  gap: 2px;
}

.lightwealth-shell .snapshot-card strong {
  font-size: 18px;
  line-height: 1.12;
}

.lightwealth-shell .snapshot-card small {
  font-size: 11px;
  line-height: 1.25;
}

.lightwealth-shell .snapshot-card .primary-button {
  width: 100%;
  min-width: 132px;
  min-height: 38px;
  padding-inline: 12px;
  font-size: 14px;
  white-space: nowrap;
}

/* Keep account creation focused on the choices and fields that require input. */
#accountForm.dialog-sheet {
  gap: 6px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
}

#accountForm .account-choice-section,
#accountForm .account-name-section,
#accountForm .account-details-section {
  gap: 6px;
}

#accountForm .account-choice-section > span,
#accountForm .account-name-section > span,
#accountForm .account-details-section > span {
  font-size: 14px;
}

#accountForm .account-category-grid {
  gap: 8px 4px;
}

#accountForm .account-category-card {
  min-height: 52px;
  gap: 4px;
}

#accountForm .account-category-icon {
  width: 32px;
  height: 32px;
}

#accountForm .account-name-section,
#accountForm .account-details-section,
#accountForm .account-valuation-preview {
  padding: 8px;
}

#accountForm .account-typed-fields {
  gap: 8px;
}

/* Shared chart expansion control and landscape history surface. */
.chart-expand-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--lw-line);
  border-radius: 50%;
  color: var(--lw-blue);
  background: color-mix(in srgb, var(--lw-blue) 8%, var(--lw-surface));
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.chart-expand-button:hover {
  background: color-mix(in srgb, var(--lw-blue) 14%, var(--lw-surface));
  transform: translateY(-1px);
}

.chart-expand-button:active {
  transform: scale(.94);
}

.chart-expand-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mini-chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--lw-muted);
  font-size: 13px;
  font-weight: 600;
}

.mini-chart-heading + .mini-chart {
  margin-top: 2px;
}

.chart-expand-dialog {
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.chart-expand-dialog::backdrop {
  background: rgba(9, 18, 35, .48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chart-expand-sheet {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--lw-bg) 94%, transparent);
}

.chart-expand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(100%, 1120px);
  margin: 0 auto;
}

.chart-expand-header h2 {
  margin: 0;
  color: var(--lw-ink);
  font-size: clamp(20px, 3vw, 28px);
}

.chart-expand-header span:not(.eyebrow) {
  display: block;
  margin-top: 3px;
  color: var(--lw-muted);
  font-size: 13px;
}

.chart-expand-viewport {
  display: flex;
  width: min(100%, 1120px);
  min-height: 0;
  flex: 1;
  align-items: center;
  margin: 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
}

.chart-expand-svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: min(70vh, 400px);
  overflow: visible;
  border-radius: var(--lw-radius-lg);
  background: var(--lw-surface);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .1);
}

.chart-expand-svg .chart-line {
  stroke: var(--lw-blue);
  stroke-width: 3;
  fill: none;
}

.chart-expand-svg .chart-area {
  fill: color-mix(in srgb, var(--lw-blue) 12%, transparent);
}

.chart-expand-svg .chart-grid-line {
  stroke: var(--lw-line);
}

.chart-expand-svg .chart-bubble {
  fill: var(--lw-surface);
  stroke: color-mix(in srgb, var(--lw-blue) 20%, var(--lw-line));
  stroke-width: 1;
}

.chart-expand-svg .chart-bubble-text {
  fill: var(--lw-ink);
  font-size: 11px;
  font-weight: 650;
}

.chart-expand-svg .chart-bubble-text-current,
.chart-expand-svg .chart-bubble-text-high {
  fill: var(--lw-blue);
}

.chart-expand-svg .chart-bubble-text-low {
  fill: var(--lw-mint);
}

.chart-expand-svg .chart-axis-label {
  fill: var(--lw-muted);
  font-size: 11px;
  font-weight: 560;
}

:root.dark .chart-expand-sheet {
  background: color-mix(in srgb, var(--lw-bg) 94%, transparent);
}

:root.dark .chart-expand-svg {
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
}

@media (orientation: portrait) {
  .chart-expand-viewport {
    padding-block: 10px;
  }

  .chart-expand-svg {
    min-width: 900px;
  }
}
