:root {
  --navy: #0b2e63;
  --blue: #1565e8;
  --cyan: #11b8e6;
  --green: #158466;
  --red: #b84646;
  --ink: #152033;
  --muted: #5e6b7d;
  --quiet: #8792a2;
  --line: #dce3eb;
  --soft: #f3f7fc;
  --paper: #ffffff;
  --bg: #f7f9fc;
  --radius: 8px;
  --content: 1040px;
  --topbar: rgba(255, 255, 255, .96);
  --control: #ffffff;
  --control-line: #bdc9d8;
  --active: #eaf2ff;
  --grid: #e5eaf0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --navy: #80b7ff;
  --blue: #68a7ff;
  --cyan: #42c7e8;
  --green: #55c5a0;
  --red: #f08a8a;
  --ink: #edf3fb;
  --muted: #b2bfd0;
  --quiet: #8493a8;
  --line: #2a394c;
  --soft: #1a2635;
  --paper: #121c29;
  --bg: #0d1520;
  --topbar: rgba(13, 21, 32, .96);
  --control: #172332;
  --control-line: #3c4c61;
  --active: #1c3453;
  --grid: #29384a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
}
.topbar-inner {
  width: min(var(--content), calc(100% - 40px));
  height: 68px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; color: var(--navy); }
.brand img { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; }
.brand span { font-size: 16px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav-button {
  min-height: 38px;
  padding: 8px 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.nav-button:hover { background: var(--soft); color: var(--ink); }
.nav-button.active { background: var(--active); color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--control); color: var(--ink); font-size: 19px; line-height: 1; }
.theme-toggle:hover { background: var(--soft); }

.main { width: min(var(--content), calc(100% - 40px)); margin: 0 auto; padding: 54px 0 90px; }
.view[hidden] { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 34px; }
.page-actions { display: flex; gap: 8px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 12px; font-weight: 750; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 32px; line-height: 1.14; }
h2 { font-size: 18px; line-height: 1.25; }
.intro { max-width: 620px; margin: 0; color: var(--muted); font-size: 15px; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 17px;
  font-size: 14px;
  font-weight: 700;
}
.button-primary { background: var(--navy); color: white; }
.button-primary:hover { background: #124583; }
.button-secondary { border-color: var(--control-line); background: var(--control); color: var(--navy); }
.button-secondary:hover { background: var(--soft); }
.button-danger { border-color: #8f5151; background: var(--control); color: var(--red); }
.button-quiet { border-color: var(--line); background: var(--control); color: var(--muted); }
.button-small { min-height: 36px; padding: 7px 11px; font-size: 12px; }
a.button { text-decoration: none; }

.summary {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}
.metric { min-height: 136px; padding: 25px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-value { display: block; color: var(--ink); font-size: 29px; font-weight: 760; line-height: 1.1; }
.metric-primary .metric-value { color: var(--navy); font-size: 36px; }
.metric-note { display: block; margin-top: 8px; color: var(--quiet); font-size: 12px; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.chart-section, .composition-section, .change-section { margin-top: 26px; padding: 25px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.section-head span { color: var(--quiet); font-size: 12px; }
.chart-wrap { position: relative; width: 100%; height: 290px; }
#progressChart { display: block; width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--quiet); font-size: 14px; text-align: center; }

.last-note { display: flex; gap: 18px; margin-top: 20px; padding: 18px 0 0; border-top: 1px solid var(--line); }
.last-note time { flex: 0 0 96px; color: var(--quiet); font-size: 12px; }
.last-note p { margin: 0; color: var(--muted); font-size: 14px; }

.composition-list { display: grid; gap: 15px; }
.allocation-row { display: grid; grid-template-columns: 9px minmax(140px, 1.2fr) minmax(100px, 2fr) 92px 54px; align-items: center; gap: 12px; font-size: 13px; }
.allocation-row strong { font-size: 13px; }
.allocation-dot { width: 9px; height: 9px; border-radius: 50%; }
.allocation-track { height: 6px; overflow: hidden; border-radius: 3px; background: var(--soft); }
.allocation-track span { display: block; height: 100%; border-radius: 3px; }
.allocation-value { text-align: right; font-variant-numeric: tabular-nums; }
.allocation-percent { color: var(--quiet); text-align: right; font-size: 12px; }
.change-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.change-item { min-width: 0; padding: 2px 22px; border-right: 1px solid var(--line); }
.change-item:first-child { padding-left: 0; }
.change-item:last-child { padding-right: 0; border-right: 0; }
.change-item span, .change-item strong, .change-item small { display: block; }
.change-item span { color: var(--muted); font-size: 12px; }
.change-item strong { margin: 5px 0 2px; font-size: 22px; }
.change-item small { color: var(--quiet); font-size: 11px; }
.monthly-insight { max-width: 680px; margin: 0 0 20px; color: var(--ink); font-size: 14px; line-height: 1.65; }
.monthly-context { margin: 16px 0 0; color: var(--quiet); font-size: 12px; line-height: 1.6; }
.monthly-detail { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.monthly-detail summary { color: var(--ink); font-size: 13px; font-weight: 650; cursor: pointer; }
.monthly-detail .review-categories { max-width: 540px; }
.monthly-detail .review-category { font-size: 13px; }
.account-button { min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--control); color: var(--ink); font-size: 12px; font-weight: 650; white-space: nowrap; }
.account-notice { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.account-notice span { min-width: 0; overflow-wrap: anywhere; }
.account-notice button { flex-shrink: 0; }
.account-logo { width: 40px; height: 40px; object-fit: cover; margin-bottom: 14px; border-radius: 6px; }
.account-submit { width: 100%; }
.account-mode { display: block; margin: 14px auto 0; padding: 6px 0; border: 0; background: transparent; color: var(--blue); font-size: 12px; }
.account-message { color: var(--ink); font-size: 13px; line-height: 1.6; }
.account-saving { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 90%, transparent); color: var(--ink); font-size: 15px; }
#accountIdentity { overflow-wrap: anywhere; }
.account-dialog { z-index: 120; }
.account-privacy { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.account-privacy a, .site-footer a, .legal-body a { color: var(--blue); }
.site-footer { width: min(var(--content), calc(100% - 40px)); margin: 0 auto; padding: 18px 0 32px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.legal-body { max-width: 760px; }
.legal-body section { padding: 28px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 90px; }
.legal-body p, .legal-body li { color: var(--muted); font-size: 14px; line-height: 1.75; }
.legal-body h2 { margin: 0 0 16px; }
.legal-body h3 { margin: 22px 0 6px; font-size: 15px; }
.legal-review { padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .site-footer { padding-bottom: 98px; } }

.history-shell, .settings-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.history-table { width: 100%; border-collapse: collapse; }
.history-table th { padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--soft); color: var(--quiet); font-size: 11px; text-align: left; text-transform: uppercase; }
.history-table td { padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.history-table tr:last-child td { border-bottom: 0; }
.history-table td:nth-child(2), .history-table td:nth-child(3) { font-variant-numeric: tabular-nums; }
.row-action { border: 0; background: transparent; color: var(--blue); font-size: 12px; font-weight: 700; }
.empty-state { padding: 58px 22px; text-align: center; }
.empty-state h2 { margin-bottom: 7px; }
.empty-state p { margin: 0 auto 20px; max-width: 440px; color: var(--muted); font-size: 14px; }

.settings-section { padding: 24px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 26px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.setting-row:first-child { padding-top: 0; }
.setting-row:last-child { padding-bottom: 0; border-bottom: 0; }
.setting-copy h2 { margin: 0 0 4px; font-size: 15px; }
.setting-copy p { margin: 0; color: var(--muted); font-size: 13px; }
.setting-actions { display: flex; gap: 8px; flex-shrink: 0; }
.theme-choice { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); }
.theme-choice button { min-height: 34px; padding: 6px 13px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.theme-choice button.active { background: var(--control); color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 22px 70px rgba(11, 46, 99, .24); }
.dialog::backdrop { background: rgba(15, 28, 47, .48); }
.dialog-form { padding: 26px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.dialog-head h2 { margin-bottom: 5px; font-size: 21px; }
.dialog-head p { margin: 0; color: var(--muted); font-size: 13px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--control); color: var(--muted); font-size: 22px; line-height: 1; }
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; color: var(--ink); font-size: 13px; font-weight: 700; }
.field-hint { display: block; margin-top: 5px; color: var(--quiet); font-size: 11px; }
.input-wrap { position: relative; }
.input-wrap span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--quiet); font-size: 13px; }
input, textarea { width: 100%; border: 1px solid var(--control-line); border-radius: 7px; background: var(--control); color: var(--ink); outline: 0; }
input { height: 46px; padding: 10px 45px 10px 13px; }
textarea { min-height: 82px; resize: vertical; padding: 11px 13px; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 101, 232, .10); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 25px; }
.form-error { min-height: 19px; margin: -7px 0 10px; color: var(--red); font-size: 12px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 20px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--soft); }
.mode-switch button { min-height: 36px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.mode-switch button.active { background: var(--control); color: var(--navy); box-shadow: 0 1px 3px rgba(11,46,99,.10); }
.category-editor { display: grid; gap: 10px; margin-bottom: 12px; }
.category-input-row { display: grid; grid-template-columns: 9px minmax(120px, 1fr) 150px 30px; gap: 9px; align-items: center; }
.category-input-row label { color: var(--ink); font-size: 12px; font-weight: 650; }
.category-input-row input { height: 40px; padding-right: 42px; }
.remove-category { width: 30px; height: 30px; border: 0; background: transparent; color: var(--quiet); font-size: 20px; }
.add-category-row { display: flex; gap: 8px; }
.add-category-row select { min-width: 0; flex: 1; border: 1px solid var(--control-line); border-radius: 7px; padding: 7px 10px; background: var(--control); color: var(--ink); }
.category-total { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 19px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; }
.category-total strong { color: var(--navy); font-size: 18px; }
.import-dialog { max-width: 610px; }
.import-explanation { margin-bottom: 18px; padding: 16px; border-left: 3px solid var(--blue); background: var(--soft); }
.import-explanation strong { display: block; margin-bottom: 5px; font-size: 13px; }
.import-explanation p { margin: 0; color: var(--muted); font-size: 12px; }
.template-downloads { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; margin-bottom: 18px; }
.template-downloads div { min-width: 0; }
.template-downloads strong, .template-downloads span { display: block; }
.template-downloads strong { font-size: 12px; }
.template-downloads span { color: var(--quiet); font-size: 11px; }
.file-drop { min-height: 128px; display: grid; place-content: center; gap: 5px; border: 1px dashed var(--control-line); border-radius: var(--radius); background: var(--control); color: var(--navy); text-align: center; cursor: pointer; }
.file-drop:hover { border-color: var(--blue); background: #fbfdff; }
.file-drop strong, .file-drop span { display: block; }
.file-drop span { color: var(--quiet); font-size: 12px; font-weight: 500; }
.import-file-meta { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.import-file-meta strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.import-file-meta span { flex-shrink: 0; color: var(--quiet); font-size: 12px; }
.mapping-details { margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.mapping-details summary { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; padding: 0 0 14px; color: var(--navy); cursor: pointer; }
.mapping-details summary span { font-size: 12px; font-weight: 750; }
.mapping-details summary small { color: var(--quiet); font-size: 10px; font-weight: 500; }
.mapping-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; padding-top: 4px; }
.mapping-grid select { width: 100%; min-height: 42px; border: 1px solid var(--control-line); border-radius: 7px; background: var(--control); color: var(--ink); padding: 8px 10px; }
.mapping-grid label span { color: var(--quiet); font-weight: 500; }
.import-summary { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 15px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.import-summary > div { padding: 15px; }
.import-summary > div + div { border-left: 1px solid var(--line); }
.import-summary span, .import-summary strong { display: block; }
.import-summary span { margin-bottom: 4px; color: var(--quiet); font-size: 11px; }
.import-summary strong { color: var(--navy); font-size: 20px; }
.import-breakdown { display: flex; flex-wrap: wrap; gap: 6px; margin: -3px 0 18px; }
.import-breakdown span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 11px; }
.import-corrections { margin: 0 0 18px; padding: 14px; border: 1px solid #d6a554; border-radius: var(--radius); background: color-mix(in srgb, #d6a554 8%, var(--paper)); }
.correction-title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.correction-title strong { font-size: 12px; }
.correction-title span { color: var(--quiet); font-size: 10px; }
.correction-block + .correction-block { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.correction-block > strong, .correction-block > span { display: block; }
.correction-block > strong { margin-bottom: 3px; font-size: 11px; }
.correction-block > span { margin-bottom: 9px; color: var(--muted); font-size: 10px; }
.currency-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.currency-mode button { min-height: 33px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.currency-mode button.active { background: var(--control); color: var(--navy); }
.currency-rates { display: grid; gap: 7px; margin-top: 9px; }
.currency-rate { display: grid; grid-template-columns: 1fr 92px; align-items: center; gap: 10px; font-size: 10px; }
.currency-rate input { height: 34px; padding: 6px 9px; }
.duplicate-group { margin-top: 8px; }
.duplicate-group > strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 10px; }
.duplicate-row { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 7px; min-height: 28px; color: var(--muted); font-size: 10px; }
.duplicate-row input { width: 15px; height: 15px; margin: 0; padding: 0; }
.duplicate-row em { color: var(--quiet); font-style: normal; }
.import-review { margin-top: 20px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); }
.import-review-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.import-review-head span, .import-review-head strong { display: block; }
.import-review-head span { color: var(--blue); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.import-review-head strong { margin-top: 2px; font-size: 14px; }
.import-review-head small { color: var(--quiet); font-size: 10px; }
.review-metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.review-metric { padding: 13px 10px; border-right: 1px solid var(--line); }
.review-metric:first-child { padding-left: 0; }
.review-metric:last-child { border-right: 0; }
.review-metric span, .review-metric strong { display: block; }
.review-metric span { color: var(--quiet); font-size: 10px; }
.review-metric strong { margin-top: 3px; font-size: 16px; }
.review-categories { display: grid; gap: 7px; margin-top: 14px; }
.review-category { display: grid; grid-template-columns: 1fr auto; gap: 15px; font-size: 11px; }
.review-category span { color: var(--muted); }
.review-category strong { font-weight: 700; }
.review-warning { margin-top: 13px; padding: 10px 12px; border-left: 3px solid #d38b28; background: var(--paper); color: var(--muted); font-size: 11px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 340px; padding: 12px 15px; border-radius: 7px; background: var(--ink); color: white; font-size: 13px; box-shadow: 0 10px 35px rgba(21, 32, 51, .22); }
.bottom-nav { display: none; }

.onboarding { position: fixed; inset: 0; z-index: 100; overflow-y: auto; background: var(--bg); padding: 34px 20px; }
.onboarding-shell { width: min(660px, 100%); min-height: calc(100vh - 68px); margin: auto; display: flex; flex-direction: column; }
.onboarding-brand { display: flex; align-items: center; gap: 9px; color: var(--navy); font-weight: 750; }
.onboarding-brand img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.onboarding-brand small { margin-left: auto; color: var(--quiet); font-size: 12px; font-weight: 650; }
.onboarding-account { margin-left: auto; display: flex; gap: 8px; }
.welcome-content { text-align: center; padding: 16px 0 32px; }
.welcome-logo { width: 96px; height: 96px; object-fit: contain; border-radius: 8px; margin-bottom: 24px; }
.welcome-content h1 { max-width: none; font-size: 40px; margin: 0 0 18px; }
.welcome-copy { color: var(--muted); font-size: 20px; line-height: 1.65; margin: 0 0 34px; }
.welcome-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.welcome-actions .button-primary { min-width: 180px; }
.welcome-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 14px; font-size: 11px; }
.welcome-legal a { color: var(--muted); text-decoration: none; }
.welcome-legal a:hover { text-decoration: underline; }
.onboarding-progress { height: 3px; margin: 22px 0 0; overflow: hidden; background: var(--line); }
.onboarding-progress span { display: block; height: 100%; background: var(--blue); transition: width .2s ease; }
.onboarding-body { width: 100%; margin: auto 0; padding: 54px 0 34px; }
.onboarding-body h1 { max-width: 540px; margin-bottom: 10px; font-size: 36px; }
.onboarding-intro { max-width: 550px; margin-bottom: 30px; color: var(--muted); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-card { min-height: 122px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--control); color: var(--ink); text-align: left; }
.choice-card:hover { border-color: #9bb7da; }
.choice-card.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(21,101,232,.10); }
.choice-card strong, .choice-card span { display: block; }
.choice-card strong { margin-bottom: 7px; font-size: 16px; }
.choice-card span { color: var(--muted); font-size: 13px; }
.onboarding-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; }
.onboarding-actions .button-primary { min-width: 130px; }
.onboarding-actions button:disabled { opacity: .45; cursor: default; }
.onboarding-privacy { margin: 0; color: var(--quiet); font-size: 11px; text-align: center; }
.onboarding-contributed { margin-top: 18px; }
.onboarding-categories { display: grid; gap: 9px; margin-bottom: 12px; }
.onboarding-category { display: grid; grid-template-columns: 9px minmax(145px, 1fr) 170px 30px; align-items: center; gap: 10px; }
.onboarding-category label { font-size: 13px; font-weight: 650; }
.onboarding-category input { height: 42px; }
.onboarding-category > button { width: 30px; height: 30px; border: 0; background: transparent; color: var(--quiet); font-size: 20px; }
.onboarding-result { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--control); }
.onboarding-result span, .onboarding-result strong, .onboarding-result small { display: block; }
.onboarding-result span { color: var(--muted); font-size: 12px; font-weight: 650; }
.onboarding-result strong { margin: 7px 0; color: var(--navy); font-size: 36px; }
.onboarding-result small { color: var(--quiet); }

@media (max-width: 720px) {
  .topbar-inner, .main { width: min(100% - 28px, var(--content)); }
  .topbar-inner { height: auto; min-height: 68px; flex-wrap: wrap; gap: 10px; padding: 12px 0; }
  .topbar-actions { margin-left: auto; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar .nav { display: none; }
  .main { padding: 34px 0 96px; }
  .page-head { align-items: stretch; flex-direction: column; gap: 20px; margin-bottom: 25px; }
  .page-head .button { width: 100%; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  h1 { font-size: 27px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 116px; padding: 20px; }
  .metric-primary { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:nth-child(2) { border-right: 1px solid var(--line); }
  .metric-value, .metric-primary .metric-value { font-size: 27px; }
  .chart-section, .composition-section, .change-section { padding: 19px 14px 14px; }
  .change-grid { grid-template-columns: 1fr; }
  .change-item, .change-item:first-child, .change-item:last-child { padding: 12px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .change-item:last-child { border-bottom: 0; }
  .chart-wrap { height: 240px; }
  .last-note { flex-direction: column; gap: 5px; }
  .last-note time { flex-basis: auto; }
  .history-shell { overflow-x: auto; }
  .history-table { min-width: 650px; }
  .setting-row { align-items: flex-start; flex-direction: column; }
  .setting-actions { width: 100%; }
  .setting-actions .button { flex: 1; }
  .allocation-row { grid-template-columns: 9px 1fr 80px 48px; gap: 9px; }
  .allocation-track { display: none; }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
    background: var(--topbar);
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  }
  .bottom-nav .nav-button { min-height: 44px; }
  .onboarding { padding: 20px 16px; }
  .onboarding-shell { min-height: calc(100vh - 40px); }
  .onboarding-body { padding: 38px 0 28px; }
  .onboarding-body h1 { font-size: 29px; }
  .choice-grid { grid-template-columns: 1fr; }
  .choice-card { min-height: 94px; }
  .onboarding-category { grid-template-columns: 9px 1fr 30px; }
  .onboarding-category .input-wrap { grid-column: 2 / 3; }
  .onboarding-category > button { grid-column: 3; grid-row: 1 / 3; }
  .mapping-grid { grid-template-columns: 1fr; }
  .template-downloads { grid-template-columns: 1fr 1fr; }
  .template-downloads div { grid-column: 1 / -1; }
  .review-metrics { grid-template-columns: 1fr; }
  .review-metric, .review-metric:first-child { padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .review-metric:last-child { border-bottom: 0; }
}

@media (max-width: 430px) {
  .summary { grid-template-columns: 1fr; }
  .metric, .metric:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .dialog-form { padding: 21px; }
  .category-input-row { grid-template-columns: 9px 1fr 30px; }
  .category-input-row .input-wrap { grid-column: 2 / 3; }
  .category-input-row .remove-category { grid-column: 3; grid-row: 1 / 3; }
}
.import-table-scroll { overflow-x: auto; max-height: 280px; }
.import-table-scroll table { width: 100%; font-size: 12px; }
.import-table-scroll th, .import-table-scroll td { padding: 8px; text-align: left; }
.import-table-scroll td:first-child { min-width: 100px; overflow-wrap: anywhere; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 20px 0 28px; font-size: 14px; }
.legal-table-scroll { overflow-x: auto; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 12px 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.legal-table th { font-weight: 600; }
.legal-table td:first-child { width: 24%; }
.legal-table code { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 600px) { .legal-table { font-size: 12px; } .legal-table th, .legal-table td { padding: 10px 5px; } }
