:root {
  color-scheme: light;
  --bg: #f3f8ff;
  --bg-band: #e7f0ff;
  --surface: #ffffff;
  --surface-2: #f7faff;
  --ink: #071943;
  --ink-soft: #173568;
  --muted: #5f7194;
  --line: #dbe7fb;
  --line-strong: #b8cae8;
  --brand: #0969ff;
  --brand-2: #16b6ff;
  --violet: #6d2dff;
  --income: #00a96b;
  --expense: #ff3457;
  --warning: #ff9f1c;
  --danger: #e82f48;
  --success-soft: #e2fff0;
  --expense-soft: #fff0f3;
  --brand-soft: #e7f0ff;
  --violet-soft: #f0e8ff;
  --shadow: 0 18px 45px rgba(28, 88, 180, .14);
  --radius: 8px;
  --tap: 44px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071329;
  --bg-band: #0b1c3d;
  --surface: #0e1d38;
  --surface-2: #132746;
  --ink: #f5f7fb;
  --ink-soft: #dbe7ff;
  --muted: #94a9cf;
  --line: #223960;
  --line-strong: #395988;
  --brand: #4f6cff;
  --brand-2: #1fd5ff;
  --violet: #9b5cff;
  --income: #19d891;
  --expense: #ff6374;
  --warning: #ffbd4a;
  --danger: #ff6374;
  --success-soft: rgba(0, 205, 128, .18);
  --expense-soft: rgba(255, 75, 99, .20);
  --brand-soft: rgba(79, 108, 255, .18);
  --violet-soft: rgba(155, 92, 255, .20);
  --shadow: 0 18px 46px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-band) 100%);
  font-family: Inter, Aptos, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }
button {
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
button:active { transform: translateY(1px); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: 44px; line-height: 1; letter-spacing: 0; }
h2 { margin-bottom: 14px; font-size: 20px; line-height: 1.18; letter-spacing: 0; }
h3 { margin-bottom: 12px; font-size: 15px; line-height: 1.25; letter-spacing: 0; }

.app-shell { min-height: 100vh; }

.onboarding {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  align-items: center;
  gap: 28px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 20px;
}

.brand-panel {
  min-height: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, #4268f2 0%, #198fc7 52%, #8d48e8 100%);
  box-shadow: var(--shadow);
}

.brand-mark,
.wordmark .logo-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  color: #fff;
  background: rgba(10, 20, 36, .9);
  font-weight: 800;
}

.brand-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 26px;
}
.brand-mark svg,
.brand-mark img,
.wordmark .logo-mark svg,
.wordmark .logo-mark img {
  width: 82%;
  height: 82%;
  display: block;
}

.eyebrow {
  margin: 0 0 10px;
  color: rgba(255,255,255,.78);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lead {
  max-width: 570px;
  margin-bottom: 0;
  color: rgba(255,255,255,.86);
  font-size: 18px;
  line-height: 1.55;
}

.setup-panel, .modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.setup-panel { padding: 22px; }
.panel {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

body[data-theme="dark"] .panel,
body[data-theme="dark"] .balance-strip,
body[data-theme="dark"] .theme-toggle {
  background: linear-gradient(180deg, rgba(18, 39, 72, .96), rgba(12, 28, 57, .98));
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 15px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-2);
}

input::placeholder { color: var(--muted); }
input:focus, select:focus, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 22%, transparent);
  outline-offset: 2px;
}

.field-note, .empty, .small-note {
  color: var(--muted);
  line-height: 1.5;
}
.field-note { font-size: 13px; }
.small-note { font-size: 12px; margin-bottom: 0; }
.empty { margin-bottom: 0; font-size: 14px; }

.form-error {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.primary-btn, .secondary-btn, .danger-btn, .ghost-btn, .quick-action {
  min-height: var(--tap);
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
}

.primary-btn {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--brand) 24%, transparent);
}
.primary-btn:hover { background: color-mix(in srgb, var(--brand) 82%, #000); }
.secondary-btn {
  color: var(--ink);
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 15%, transparent);
}
.danger-btn {
  color: #fff;
  background: var(--danger);
}
.ghost-btn {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line);
}
.full-action { width: 100%; margin-top: 10px; }

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 22px 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

body[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #0b1c3c, #091732);
}

.topbar { display: flex; align-items: center; justify-content: space-between; }
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
}
.wordmark strong {
  display: block;
  font-size: 15px;
  font-weight: 850;
}
.wordmark small {
  display: block;
  max-width: 145px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: grid;
  align-content: start;
  gap: 8px;
}
.tab {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}
.tab svg { width: 18px; height: 18px; }
.tab.active {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 18%, transparent);
  box-shadow: inset 3px 0 0 var(--brand);
}
.sidebar-action { width: 100%; }

.content {
  width: min(100%, 1120px);
  padding: 30px 28px;
}
.view { display: none; }
.view.active { display: block; }

.dashboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.dashboard-head h2 {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 27px;
  font-weight: 900;
}
.section-subtitle {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}
.panel-note {
  max-width: 520px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.38;
}
.mobile-app-head { display: none; }
.mobile-logo-mark { display: none; }
.theme-toggle {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 13px;
  font-weight: 850;
  box-shadow: var(--shadow);
}
.theme-toggle svg { width: 18px; height: 18px; }
.inline-fab {
  position: static;
  width: 48px;
  height: 48px;
  font-size: 28px;
}

.balance-strip {
  min-height: 104px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.balance-label svg {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-left: 4px;
}
.balance-label {
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}
.balance-value {
  max-width: 100%;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: clamp(29px, 3.4vw, 38px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.balance-breakdown {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.balance-caption { display: none; }
.balance-wave {
  height: 76px;
  overflow: hidden;
  border-radius: var(--radius);
  color: var(--brand);
  background: linear-gradient(135deg, #dcecff, #bfe6ff);
}
.balance-wave path:first-child { fill: rgba(9, 105, 255, .22); }
.balance-wave path:last-child { stroke: rgba(9, 105, 255, .38); }
body[data-theme="dark"] .balance-wave {
  background: linear-gradient(135deg, rgba(79, 108, 255, .24), rgba(31, 213, 255, .16));
}
body[data-theme="dark"] .balance-wave path:first-child { fill: rgba(31, 213, 255, .24); }
body[data-theme="dark"] .balance-wave path:last-child { stroke: rgba(150, 190, 255, .42); }
.balance-wave svg { width: 100%; height: 100%; display: block; }
.hero-actions { display: none; }

.month-panel { margin-bottom: 14px; }
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-row h2 { margin-bottom: 0; }
.period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.period-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink-soft);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 850;
}
.period-tabs button.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 26%, transparent);
}
.grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr .95fr .72fr;
  gap: 14px;
  margin-top: 14px;
}
.goals-panel { grid-column: 1 / -1; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.metric {
  min-height: 82px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  padding: 15px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.income-metric {
  color: var(--brand);
  background: linear-gradient(135deg, #edf7ff, #e2f3ff);
  border-color: #cbe5ff;
}
.expense-metric {
  color: var(--expense);
  background: linear-gradient(135deg, #fff0f3, #ffe8ee);
  border-color: #ffd2dc;
}
.net-metric {
  color: var(--violet);
  background: linear-gradient(135deg, #f4edff, #ece3ff);
  border-color: #dbcaff;
}
body[data-theme="dark"] .income-metric {
  background: linear-gradient(135deg, rgba(0, 180, 255, .22), rgba(0, 90, 170, .18));
  border-color: rgba(31, 213, 255, .32);
}
body[data-theme="dark"] .expense-metric {
  background: linear-gradient(135deg, rgba(255, 99, 116, .22), rgba(150, 35, 58, .18));
  border-color: rgba(255, 99, 116, .35);
}
body[data-theme="dark"] .net-metric {
  background: linear-gradient(135deg, rgba(155, 92, 255, .25), rgba(76, 48, 190, .18));
  border-color: rgba(155, 92, 255, .36);
}
.metric-icon {
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: currentColor;
  background: color-mix(in srgb, currentColor 16%, #fff);
}
body[data-theme="dark"] .metric-icon {
  background: color-mix(in srgb, currentColor 20%, transparent);
}
.metric-icon svg {
  width: 22px;
  height: 22px;
}
.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.metric strong {
  color: currentColor;
  font-size: 20px;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.metric-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.link-btn {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--brand);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
}

.history-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.history-head h2 {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
}
.history-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.history-segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 10px 22px rgba(28, 88, 180, .07);
}
.history-segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
}
.history-segmented button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 32%, transparent);
}
.history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.history-panel {
  padding: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
body[data-theme="dark"] .history-panel,
body[data-theme="dark"] .history-segmented {
  background: linear-gradient(180deg, rgba(18, 39, 72, .96), rgba(12, 28, 57, .98));
}
.history-table-head {
  display: grid;
  grid-template-columns: 100px minmax(240px, 1fr) 210px 150px;
  gap: 12px;
  padding: 10px 14px;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--brand-soft) 70%, var(--surface));
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 850;
}
.history-list {
  display: grid;
}
.history-date-row {
  padding: 10px 14px 8px;
  color: var(--ink);
  background: color-mix(in srgb, var(--brand-soft) 42%, transparent);
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 900;
}
.history-date-row:first-child { border-top: 0; }
.history-row {
  display: grid;
  grid-template-columns: 84px minmax(240px, 1fr) 210px 150px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
}
.history-row time {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}
.history-desc {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.category-badge {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
}
.category-badge svg {
  width: 17px;
  height: 17px;
}
.category-badge.income { background: linear-gradient(135deg, var(--income), #12c9a7); }
.category-badge.expense { background: linear-gradient(135deg, var(--expense), #ff8763); }
.history-category {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-amount {
  min-width: 0;
  justify-self: end;
  padding-inline: 10px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 900;
}
.history-amount.income { color: var(--income); }
.history-amount.expense { color: var(--expense); }
.history-empty {
  min-height: 260px;
  border-top: 1px solid var(--line);
}

.recent-list {
  display: grid;
  margin-top: 2px;
}
.recent-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.recent-row:first-child {
  border-top: 0;
  padding-top: 2px;
}
.recent-copy {
  min-width: 0;
}
.recent-row .row-title {
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
}
.recent-row .row-meta {
  font-size: 12px;
  font-weight: 600;
}
.recent-amount {
  min-height: auto;
  min-width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.2;
  white-space: nowrap;
}
.recent-amount.income { color: var(--income); }
.recent-amount.expense { color: var(--expense); }

.analysis-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.analysis-head h2 {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
}
.analysis-periods {
  margin-bottom: 14px;
}
.analysis-filter {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.analysis-filter .analysis-periods {
  margin-bottom: 0;
}
.analysis-range-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--brand-soft) 50%, var(--surface));
  font-size: 13px;
  font-weight: 700;
}
.analysis-range-status svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}
.analysis-range-status strong {
  color: var(--ink);
  font-weight: 900;
}
.analysis-range-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto minmax(180px, .85fr);
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand-soft) 58%, var(--surface));
}
.analysis-range-panel label {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}
.date-field {
  min-height: 42px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.date-field svg {
  justify-self: center;
  width: 18px;
  height: 18px;
  color: var(--brand);
}
.date-field input {
  min-height: 40px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 750;
}
.date-field input:focus {
  outline: 0;
}
.analysis-range-panel .primary-btn {
  min-height: 42px;
  min-width: 124px;
}
.analysis-range-panel p {
  margin-bottom: 0;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
}
body[data-theme="dark"] .analysis-range-status,
body[data-theme="dark"] .analysis-range-panel {
  background: linear-gradient(180deg, rgba(19, 39, 70, .96), rgba(10, 25, 52, .98));
}
body[data-theme="dark"] .date-field {
  background: rgba(14, 29, 56, .92);
}
.analysis-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.analysis-card {
  min-height: 184px;
}
.analysis-card h3 {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}
.trend-analysis h3 {
  margin-bottom: 3px;
}
.trend-caption {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.trend-chart {
  min-height: 138px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
}
.trend-axis {
  display: grid;
  align-content: space-between;
  padding: 3px 0 20px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-align: right;
}
.trend-bars {
  min-height: 132px;
  display: grid;
  align-items: end;
  gap: 10px;
  padding: 4px 0 0;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.trend-day {
  height: 124px;
  display: grid;
  align-content: end;
  justify-items: center;
  gap: 6px;
}
.trend-bar {
  display: block;
  width: min(100%, 34px);
  min-height: 0;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #ff7f91, var(--expense));
  box-shadow: 0 8px 18px rgba(255, 52, 87, .18);
}
.trend-bar.empty {
  box-shadow: none;
  background: transparent;
}
.trend-day small {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.trend-empty {
  min-height: 138px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.insight-card,
.advice-card,
.small-expense-card {
  min-height: 104px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.insight-card.warning {
  background: linear-gradient(135deg, #fff8df, #fff1bf);
  border-color: #ffe08a;
}
.insight-card.calm {
  background: linear-gradient(135deg, #e9fff4, #e4f7ff);
  border-color: #c7f3df;
}
body[data-theme="dark"] .insight-card.warning {
  background: linear-gradient(135deg, rgba(255, 189, 74, .24), rgba(145, 91, 20, .16));
  border-color: rgba(255, 189, 74, .34);
}
body[data-theme="dark"] .insight-card.calm,
body[data-theme="dark"] .advice-card,
body[data-theme="dark"] .small-expense-card {
  background: linear-gradient(135deg, rgba(25, 216, 145, .16), rgba(31, 213, 255, .12));
  border-color: rgba(25, 216, 145, .28);
}
.insight-icon,
.advice-icon,
.small-expense-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #071943;
  background: var(--warning);
  font-size: 24px;
  font-weight: 950;
}
.advice-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--income), #16b6ff);
}
.advice-icon svg {
  width: 24px;
  height: 24px;
}
.small-expense-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #eef8ff, #f2edff);
  border-color: #d6e7ff;
}
.small-expense-card.active {
  background: linear-gradient(135deg, #e7fbff, #eef3ff);
  border-color: rgba(31, 213, 255, .42);
}
.small-expense-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--violet));
}
.small-expense-icon svg {
  width: 24px;
  height: 24px;
}
body[data-theme="dark"] .small-expense-card.active {
  background: linear-gradient(135deg, rgba(31, 213, 255, .16), rgba(124, 92, 255, .16));
  border-color: rgba(31, 213, 255, .36);
}
.small-expense-detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
}
.advice-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}
.advice-card li::marker {
  color: var(--brand);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filters select { width: auto; min-width: 132px; }

.list, .goal-list, .goal-preview {
  display: grid;
  gap: 10px;
}
.goal-preview {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.row, .category-admin-row, .mini-goal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.row > div, .mini-goal > div:last-child { min-width: 0; }
.row-title {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.row-meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.amount {
  min-width: 120px;
  white-space: nowrap;
}
.amount.income { color: var(--income); background: var(--success-soft); }
.amount.expense { color: var(--expense); background: var(--expense-soft); }
.editable-row {
  cursor: pointer;
}
.editable-row:hover {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  box-shadow: 0 12px 24px color-mix(in srgb, var(--brand) 10%, transparent);
}
.editable-row:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 22%, transparent);
  outline-offset: 2px;
}

.bar-row {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}
.bar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}
.bar-head span:last-child { color: var(--muted); text-align: right; }
.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 74%, transparent);
}
.bar span {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--violet));
}

.donut-wrap {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 150px;
}
.donut {
  width: 132px;
  height: 132px;
  transform: rotate(-90deg);
}
.donut circle {
  fill: none;
  stroke-width: 7.2;
}
.donut-a { stroke: var(--violet); }
.donut-b { stroke: #ff6b63; }
.donut-c { stroke: var(--brand-2); }
.donut-d { stroke: #aab2ff; }
.donut-hole {
  fill: var(--surface);
  stroke: transparent;
}
.donut-empty-ring {
  stroke: var(--line);
  stroke-width: 7.2;
}
.legend {
  display: grid;
  gap: 9px;
}
.legend-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}
.legend-row span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend-row strong {
  color: var(--muted);
  font-size: 12px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.c0 { background: var(--violet); }
.legend-dot.c1 { background: #ff6b63; }
.legend-dot.c2 { background: var(--brand-2); }
.legend-dot.c3 { background: #ffd15c; }
.legend-dot.c4 { background: #9aa8bd; }
.chart-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 150px;
  text-align: center;
}
.chart-empty .donut { width: 112px; height: 112px; }

.signal-card {
  min-height: 150px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
}
.mini-bars {
  height: 56px;
  display: flex;
  align-items: end;
  gap: 6px;
}
.mini-bars span {
  width: 9px;
  border-radius: 999px 999px 2px 2px;
  background: var(--line-strong);
}
.mini-bars .bar-0 { background: #ff6b63; }
.mini-bars .bar-1 { background: #ff817b; }
.mini-bars .bar-2 { background: #ffa29e; }
.mini-bars .bar-3 { background: #b8c8e8; }
.mini-bars .bar-4 { background: var(--brand); }

.goals-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 2px 0 14px;
}
.goals-head h2 {
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.05;
}
.new-goal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 16px;
}
.new-goal-btn svg {
  width: 18px;
  height: 18px;
}
.goals-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.goal-summary-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.goal-summary-card p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.goal-summary-card strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}
.goal-summary-card.active .metric-icon {
  color: var(--income);
  background: var(--success-soft);
}
.goal-summary-card.saved .metric-icon {
  color: var(--brand);
  background: var(--brand-soft);
}
.goal-summary-card.remaining .metric-icon {
  color: var(--expense);
  background: var(--expense-soft);
}
.goal-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.goal-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 134px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-2) 72%, transparent));
  box-shadow: var(--shadow);
}
.goal-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.goal-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}
.goal-target {
  display: block;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.2;
}
.goal-delete {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--expense);
  background: var(--expense-soft);
  border-color: color-mix(in srgb, var(--expense) 24%, transparent);
}
.goal-actions {
  display: flex;
  gap: 6px;
}
.goal-edit {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
}
.goal-edit svg {
  width: 16px;
  height: 16px;
}
.goal-delete svg {
  width: 17px;
  height: 17px;
}
.goal-progress-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.goal-progress-line strong {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1;
}
.goal-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 78%, transparent);
}
.goal-progress span {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.goal-home .goal-progress span,
.goal-savings .goal-progress span {
  background: linear-gradient(90deg, var(--brand), var(--violet));
}
.goal-travel .goal-progress span,
.goal-health .goal-progress span {
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
}
.goal-emergency .goal-progress span {
  background: linear-gradient(90deg, var(--warning), var(--expense));
}
.goal-education .goal-progress span,
.goal-tech .goal-progress span {
  background: linear-gradient(90deg, var(--violet), var(--brand));
}
.goal-vehicle .goal-progress span {
  background: linear-gradient(90deg, var(--income), var(--brand-2));
}
.goal-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.goal-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.goal-meta-row svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}
.goal-art {
  width: 108px;
  height: 86px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #d9f0ff, #fff0c7);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.goal-art.small {
  width: 68px;
  height: 52px;
}
.goal-art svg {
  width: 100%;
  height: 100%;
  display: block;
}
.goal-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.goal-scene {
  transform-origin: 50% 60%;
  animation: goal-scene-in 420ms ease both;
}
.art-a { fill: #80d7ff; }
.art-b { fill: #2ed6a1; }
.art-c { fill: #ffd15c; }
.art-line {
  stroke: #126bff;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body[data-theme="dark"] .goal-art {
  background: linear-gradient(135deg, rgba(31, 213, 255, .22), rgba(255, 189, 74, .18));
}
body[data-theme="dark"] .art-a { fill: #39c8ff; }
body[data-theme="dark"] .art-b { fill: #19d891; }
body[data-theme="dark"] .art-c { fill: #ffbd4a; }
body[data-theme="dark"] .art-line { stroke: #7ea7ff; }
body[data-theme="dark"] .goal-summary-card,
body[data-theme="dark"] .goal-card,
body[data-theme="dark"] .goal-note-panel {
  background: linear-gradient(180deg, rgba(19, 39, 70, .96), rgba(10, 25, 52, .98));
}
body[data-theme="dark"] .goal-summary-card.active .metric-icon {
  background: rgba(25, 216, 145, .16);
}
body[data-theme="dark"] .goal-summary-card.saved .metric-icon {
  background: rgba(31, 213, 255, .16);
}
body[data-theme="dark"] .goal-summary-card.remaining .metric-icon {
  background: rgba(255, 99, 116, .16);
}

@keyframes goal-scene-in {
  from { opacity: .72; transform: translateY(2px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .goal-scene { animation: none; }
}
.mini-goal {
  justify-content: start;
  background: var(--violet-soft);
}
.goal-empty-panel {
  min-height: 220px;
}
.goal-note-panel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.goal-note-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--income));
}
.goal-note-icon svg {
  width: 20px;
  height: 20px;
}
body[data-theme="dark"] .goal-note-icon {
  color: #071329;
  background: linear-gradient(135deg, #ffda5f, var(--brand-2));
}
.goal-note-panel p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}
.empty-visual {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  text-align: center;
}
.empty-visual.compact {
  min-height: 150px;
  align-content: center;
  color: var(--brand);
}
.empty-visual.compact .empty {
  display: grid;
  gap: 4px;
  color: var(--ink-soft);
}
.empty-visual.compact .empty span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.empty-doc {
  width: 86px;
  height: 74px;
  color: var(--brand);
}

.settings-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 2px 0 16px;
}
.settings-head h2 {
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.05;
}
.settings-theme-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.settings-theme-toggle button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
}
.settings-theme-toggle button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 24%, transparent);
}
.settings-theme-toggle svg {
  width: 16px;
  height: 16px;
}
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(320px, .85fr);
  align-items: start;
  gap: 14px;
}
.settings-main {
  display: grid;
  gap: 14px;
}
.settings-profile-card,
.settings-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.settings-profile-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 14px;
  padding: 14px;
}
.settings-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 24px;
  font-weight: 900;
}
.settings-profile-card strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.1;
  font-weight: 900;
}
.settings-profile-card label,
.settings-row label {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.settings-profile-card input,
.settings-row input,
.settings-row select {
  min-height: 38px;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 650;
}
.settings-edit-icon {
  display: grid;
  place-items: center;
  color: var(--brand);
}
.settings-edit-icon svg {
  width: 18px;
  height: 18px;
}
.settings-group {
  padding: 14px;
}
.settings-group h3 {
  margin-bottom: 12px;
  font-size: 17px;
  font-weight: 900;
}
.settings-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.settings-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.settings-row-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
}
.settings-row-icon svg {
  width: 20px;
  height: 20px;
}
.settings-row-icon.money {
  color: var(--income);
  background: var(--success-soft);
}
.settings-row-icon.currency {
  color: var(--violet);
  background: var(--violet-soft);
}
.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.settings-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.settings-action-btn svg,
.compact-action svg {
  width: 18px;
  height: 18px;
}
.settings-save {
  min-height: 48px;
  width: 100%;
}
.settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.settings-section-head h3 {
  margin-bottom: 0;
}
.compact-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  font-size: 12px;
}
.settings-category-list {
  display: grid;
  gap: 0;
  max-height: 360px;
  overflow: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.settings-category-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.settings-category-row:first-child {
  border-top: 0;
}
.settings-category-icon {
  display: grid;
  place-items: center;
}
.settings-category-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}
.settings-category-icon.expense { color: var(--expense); }
.settings-category-icon.income { color: var(--income); }
.settings-category-row strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.15;
  font-weight: 850;
}
.settings-type-pill,
.settings-category-action {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 5px 9px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 850;
}
.settings-type-pill.expense {
  color: var(--expense);
  background: var(--expense-soft);
}
.settings-type-pill.income {
  color: var(--income);
  background: var(--success-soft);
}
.settings-category-action {
  color: var(--expense);
  background: var(--expense-soft);
  border-color: color-mix(in srgb, var(--expense) 28%, transparent);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
body[data-theme="dark"] .settings-theme-toggle,
body[data-theme="dark"] .settings-profile-card,
body[data-theme="dark"] .settings-group,
body[data-theme="dark"] .settings-category-row {
  background: linear-gradient(180deg, rgba(19, 39, 70, .96), rgba(10, 25, 52, .98));
}
body[data-theme="dark"] .settings-avatar {
  background: rgba(31, 213, 255, .16);
}
body[data-theme="dark"] .settings-row-icon.money {
  background: rgba(25, 216, 145, .16);
}
body[data-theme="dark"] .settings-row-icon.currency {
  background: rgba(155, 92, 255, .18);
}
body[data-theme="dark"] .settings-type-pill.expense,
body[data-theme="dark"] .settings-category-action {
  background: rgba(255, 99, 116, .16);
}
body[data-theme="dark"] .settings-type-pill.income {
  background: rgba(25, 216, 145, .16);
}
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 850;
}

.fab-wrap {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: none;
  justify-items: end;
  gap: 8px;
}
.fab {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #0057f7);
  box-shadow: 0 14px 26px color-mix(in srgb, var(--brand) 30%, transparent);
}
.fab svg {
  width: 24px;
  height: 24px;
  display: block;
}
.fab-menu {
  display: none;
  grid-template-columns: 1fr;
  gap: 7px;
  width: min(84vw, 260px);
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}
.fab-menu::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: inherit;
  transform: rotate(45deg);
}
.fab-menu.open { display: grid; }
.fab-action {
  min-height: 66px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-2);
  text-align: left;
}
.fab-action:hover {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  box-shadow: 0 10px 20px color-mix(in srgb, var(--brand) 10%, transparent);
}
.fab-action-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.fab-action-icon svg {
  width: 23px;
  height: 23px;
}
.fab-action.income .fab-action-icon {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand-2) 18%, var(--surface));
}
.fab-action.expense .fab-action-icon {
  color: var(--expense);
  background: color-mix(in srgb, var(--expense) 14%, var(--surface));
}
.fab-action strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
  line-height: 1.1;
  font-weight: 900;
}
.fab-action small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 650;
}
body[data-theme="dark"] .fab {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: 0 14px 26px rgba(31, 213, 255, .22);
}
body[data-theme="dark"] .fab-menu,
body[data-theme="dark"] .fab-action {
  background: linear-gradient(180deg, rgba(19, 39, 70, .98), rgba(10, 25, 52, .98));
}
body[data-theme="dark"] .fab-action.income .fab-action-icon {
  background: rgba(31, 213, 255, .18);
}
body[data-theme="dark"] .fab-action.expense .fab-action-icon {
  background: rgba(255, 99, 116, .16);
}

.modal {
  width: min(92vw, 520px);
  padding: 0;
  color: var(--ink);
}
.modal::backdrop { background: rgba(11, 17, 31, .45); }
.modal form { padding: 18px; }
.movement-modal {
  width: min(92vw, 492px);
}
.movement-modal::backdrop {
  background: rgba(7, 19, 41, .58);
  backdrop-filter: blur(2px);
}
.movement-modal form {
  display: grid;
  gap: 14px;
  padding: 22px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h2 { margin-bottom: 0; }
.movement-modal .modal-head {
  margin-bottom: 0;
}
.movement-modal .modal-head h2 {
  font-size: 24px;
  line-height: 1.05;
  font-weight: 900;
}
.modal-helper {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.modal-helper::before {
  content: "";
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  background: currentColor;
  clip-path: polygon(72% 0, 100% 28%, 36% 92%, 5% 100%, 12% 68%);
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-2);
  font-size: 22px;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 15px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.segmented button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}
.segmented button.active {
  color: #fff;
  background: var(--brand);
}
.movement-type-toggle {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  margin-bottom: 0;
  background: var(--surface-2);
}
.movement-type-toggle button {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
}
.movement-type-toggle button.active[data-type="income"] {
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: 0 12px 24px color-mix(in srgb, var(--brand) 28%, transparent);
}
.movement-type-toggle button.active[data-type="expense"] {
  background: linear-gradient(135deg, var(--expense), #ff8763);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--expense) 24%, transparent);
}
.type-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
}
.type-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
fieldset {
  margin: 0 0 15px;
  padding: 0;
  border: 0;
}
legend {
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.movement-modal label,
.movement-modal fieldset {
  margin-bottom: 0;
}
.movement-modal legend,
.movement-modal .field-label {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 850;
}
.input-shell {
  min-height: 52px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.input-shell input {
  min-height: 50px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-weight: 650;
}
.input-shell input::placeholder {
  color: var(--muted);
  font-weight: 600;
}
.input-shell input:focus {
  outline: 0;
}
.input-shell:focus-within {
  border-color: color-mix(in srgb, var(--brand) 48%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
.input-prefix {
  display: grid;
  place-items: center;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 18px;
  font-weight: 900;
}
.field-label:has(input[type="date"]) .input-prefix::before,
.note-prefix::before {
  content: "";
  width: 19px;
  height: 19px;
  display: block;
  background: currentColor;
}
.field-label:has(input[type="date"]) .input-prefix::before {
  clip-path: polygon(16% 14%, 26% 14%, 26% 3%, 36% 3%, 36% 14%, 64% 14%, 64% 3%, 74% 3%, 74% 14%, 84% 14%, 84% 92%, 16% 92%);
}
.note-prefix::before {
  clip-path: polygon(18% 9%, 82% 9%, 82% 70%, 61% 70%, 48% 91%, 45% 70%, 18% 70%);
}
.movement-modal .category-grid {
  grid-template-columns: 1fr;
  gap: 9px;
}
.category-option {
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}
.movement-modal .category-option {
  min-height: 52px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line);
  font-size: 13px;
  font-weight: 820;
}
.category-option.active {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 35%, transparent);
  background: var(--brand-soft);
}
.movement-modal .category-option.active {
  color: var(--ink);
  border-color: var(--brand-2);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-2) 16%, var(--surface)), color-mix(in srgb, var(--brand) 8%, var(--surface)));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand-2) 18%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--brand-2) 34%, transparent);
}
.category-option-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: transparent;
}
.category-option-icon.expense {
  color: var(--expense);
  background: transparent;
}
.category-option-icon.income {
  color: var(--brand);
  background: transparent;
}
.category-option-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}
.movement-modal .category-option[data-category="I-02"] .category-option-icon { color: var(--violet); }
.movement-modal .category-option[data-category="I-03"] .category-option-icon { color: var(--income); }
.movement-modal .category-option[data-category="I-04"] .category-option-icon { color: var(--warning); }
.movement-modal .category-option[data-category="I-05"] .category-option-icon { color: var(--violet); }
.movement-modal .category-option[data-category="I-06"] .category-option-icon { color: var(--muted); }
.movement-modal .category-option[data-category="G-01"] .category-option-icon,
.movement-modal .category-option[data-category="G-08"] .category-option-icon,
.movement-modal .category-option[data-category="G-10"] .category-option-icon { color: #ff5b63; }
.movement-modal .category-option[data-category="G-02"] .category-option-icon { color: #21c776; }
.movement-modal .category-option[data-category="G-03"] .category-option-icon { color: #ffc533; }
.movement-modal .category-option[data-category="G-04"] .category-option-icon { color: var(--brand); }
.movement-modal .category-option[data-category="G-09"] .category-option-icon { color: var(--expense); }
.movement-modal .category-option[data-category="G-05"] .category-option-icon { color: var(--income); }
.movement-modal .category-option[data-category="G-06"] .category-option-icon { color: var(--violet); }
.category-option-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: 0 7px 16px color-mix(in srgb, var(--brand) 20%, transparent);
}
.category-option-check:empty {
  background: transparent;
  box-shadow: none;
}
.category-option-check svg {
  width: 14px;
  height: 14px;
}
.custom-category-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand-soft) 46%, var(--surface));
}
.custom-category-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.custom-category-copy strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 850;
}
.custom-category-copy span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 650;
}
.custom-category-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  border-radius: var(--radius);
  color: var(--brand);
  background: color-mix(in srgb, var(--brand-soft) 72%, var(--surface));
  font-size: 12px;
  font-weight: 850;
}
.custom-category-toggle span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  line-height: 1;
}
.custom-category-entry[hidden] {
  display: none;
}
.custom-category-entry {
  grid-column: 1 / -1;
}
.custom-category-input .input-prefix::before {
  content: "";
  width: 18px;
  height: 18px;
  display: block;
  background: currentColor;
  clip-path: polygon(11% 30%, 40% 30%, 50% 8%, 60% 30%, 89% 30%, 66% 50%, 75% 82%, 50% 64%, 25% 82%, 34% 50%);
}
body[data-theme="dark"] .custom-category-toggle {
  background: rgba(31, 213, 255, .08);
  border-color: rgba(31, 213, 255, .36);
}
body[data-theme="dark"] .custom-category-box {
  background: rgba(31, 213, 255, .06);
}
.modal-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
  margin-top: 10px;
}
.movement-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}
.movement-actions .secondary-btn {
  grid-column: 1;
  grid-row: 1;
}
.movement-actions .primary-btn {
  grid-column: 2;
  grid-row: 1;
}
.movement-actions .secondary-btn,
.movement-actions .primary-btn {
  min-height: 58px;
  width: 100%;
}
.movement-actions .danger-btn[hidden] {
  display: none;
}
.movement-actions .danger-btn:not([hidden]) {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: center;
  width: min(100%, 180px);
  min-height: 54px;
  padding-inline: 16px;
  color: var(--expense);
  background: color-mix(in srgb, var(--expense-soft) 70%, var(--surface));
  border-color: color-mix(in srgb, var(--expense) 65%, var(--line));
  box-shadow: none;
  font-weight: 850;
}
body[data-theme="dark"] .movement-modal {
  background: linear-gradient(180deg, rgba(14, 29, 56, .98), rgba(8, 20, 43, .98));
}
body[data-theme="dark"] .movement-type-toggle,
body[data-theme="dark"] .input-shell,
body[data-theme="dark"] .movement-modal .category-option {
  background: rgba(19, 39, 70, .94);
}
body[data-theme="dark"] .movement-modal .category-option.active {
  background: linear-gradient(135deg, rgba(31, 213, 255, .18), rgba(79, 108, 255, .20));
  border-color: var(--brand-2);
  box-shadow: 0 8px 20px rgba(31, 213, 255, .13), inset 0 0 0 1px rgba(31, 213, 255, .28);
}
body[data-theme="dark"] .movement-actions .danger-btn:not([hidden]) {
  color: var(--expense);
  background: rgba(255, 99, 116, .08);
  border-color: rgba(255, 99, 116, .78);
}
.file-label input { padding: 9px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  max-width: min(90vw, 420px);
  padding: 11px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: #161b29;
  box-shadow: var(--shadow);
  transform: translate(-50%, 90px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 820px) {
  .onboarding {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 14px;
    padding: 14px;
  }
  .brand-panel {
    min-height: 300px;
    padding: 24px;
  }
  h1 { font-size: 38px; }
  .lead { font-size: 16px; }

  .layout {
    grid-template-columns: 1fr;
    padding-bottom: 76px;
  }
  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    height: auto;
    z-index: 18;
    display: block;
    padding: 7px 8px 9px;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .topbar, .sidebar-action { display: none; }
  .tabs {
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
  }
  .tab {
    min-height: 54px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 5px 3px;
    font-size: 10px;
  }
  .tab svg { width: 18px; height: 18px; }
  .tab.active {
    box-shadow: inset 0 3px 0 var(--brand);
  }
  .content {
    width: 100%;
    padding: 12px 8px 10px;
  }
  .dashboard-head {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    margin: 2px 0 12px;
  }
  .dashboard-head > div:nth-child(2) { display: none; }
  .mobile-app-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .mobile-logo-mark {
    width: 46px;
    height: 36px;
    display: block;
    flex: 0 0 auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .mobile-logo-mark svg,
  .mobile-logo-mark img {
    width: 46px;
    height: 36px;
    display: block;
    object-fit: contain;
  }
  .mobile-app-head div {
    min-width: 0;
    display: grid;
    gap: 2px;
  }
  .mobile-app-head strong {
    color: var(--ink);
    font-size: 20px;
    font-weight: 900;
  }
  .mobile-app-head span {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .theme-toggle {
    min-height: 40px;
    width: 40px;
    justify-content: center;
    padding: 0;
    box-shadow: none;
  }
  .theme-toggle span { display: none; }
  .inline-fab {
    width: 44px;
    height: 44px;
  }
  .inline-fab svg {
    width: 21px;
    height: 21px;
  }
  .balance-strip {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 12px;
  }
  .balance-wave { display: none; }
  .balance-value {
    font-size: clamp(25px, 7.6vw, 32px);
  }
  .balance-breakdown {
    font-size: 10px;
  }
  .grid.two, .settings-grid { grid-template-columns: 1fr; }
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }
  .recent-panel, .goals-panel { grid-column: 1 / -1; }
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .metric {
    min-height: 58px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 9px 8px;
    column-gap: 0;
    row-gap: 3px;
  }
  .metric-icon { display: none; }
  .metric-label {
    min-height: 22px;
    font-size: 9.5px;
    line-height: 1.15;
  }
  .metric strong {
    font-size: clamp(11px, 3.1vw, 13px);
    line-height: 1.15;
  }
  .metric-note {
    margin-top: 8px;
    font-size: 10px;
  }
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .section-row {
    align-items: start;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 9px;
  }
  .section-row h2 { font-size: 13px; }
  .panel-note {
    margin: -2px 0 8px;
    font-size: 10.5px;
    line-height: 1.32;
  }
  .month-panel .section-row { gap: 10px; }
  .period-tabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }
  .period-tabs button {
    min-width: 0;
    min-height: 31px;
    padding: 6px 4px;
    font-size: 10px;
  }
  .filters select { width: 100%; }
  .history-head {
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 2px 0 12px;
  }
  .history-head h2 {
    font-size: 22px;
  }
  .history-controls {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }
  .history-periods {
    grid-template-columns: repeat(5, 1fr);
  }
  .history-segmented {
    padding: 3px;
  }
  .history-segmented button {
    min-height: 30px;
    font-size: 10px;
  }
  .history-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }
  .history-panel {
    padding: 0;
  }
  .history-table-head {
    display: none;
  }
  .history-date-row {
    padding: 9px 10px 7px;
    font-size: 11px;
  }
  .history-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 10px;
  }
  .history-row time,
  .history-category {
    display: none;
  }
  .history-desc {
    gap: 8px;
  }
  .category-badge {
    width: 31px;
    height: 31px;
  }
  .history-amount {
    align-self: center;
    min-height: auto;
    padding: 0;
    font-size: 12px;
  }
  .recent-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 0;
  }
  .recent-row .category-badge {
    width: 32px;
    height: 32px;
  }
  .recent-row .category-badge svg {
    width: 16px;
    height: 16px;
  }
  .recent-row .row-title {
    font-size: 12.5px;
  }
  .recent-row .row-meta {
    font-size: 10px;
    line-height: 1.25;
  }
  .recent-amount {
    font-size: 12px;
  }
  .analysis-head {
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 2px 0 10px;
  }
  .analysis-head h2 {
    font-size: 22px;
  }
  .analysis-periods {
    margin-bottom: 10px;
  }
  .analysis-filter {
    gap: 7px;
    margin-bottom: 10px;
  }
  .analysis-filter .analysis-periods {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 0;
  }
  .analysis-range-status {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 10.5px;
  }
  .analysis-range-status svg {
    width: 15px;
    height: 15px;
  }
  .analysis-range-panel {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }
  .analysis-range-panel label {
    font-size: 10.5px;
  }
  .date-field {
    min-height: 38px;
    grid-template-columns: 32px minmax(0, 1fr);
    margin-top: 4px;
  }
  .date-field svg {
    width: 15px;
    height: 15px;
  }
  .date-field input {
    min-height: 36px;
    font-size: 11.5px;
  }
  .analysis-range-panel .primary-btn {
    min-height: 38px;
    width: 100%;
    font-size: 12px;
  }
  .analysis-range-panel p {
    padding-left: 0;
    border-left: 0;
    font-size: 10px;
  }
  .analysis-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }
  .analysis-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .analysis-card {
    min-height: auto;
  }
  .analysis-card h3 {
    margin-bottom: 8px;
    font-size: 12px;
  }
  .trend-chart {
    min-height: 112px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
  }
  .trend-axis {
    padding-bottom: 18px;
    font-size: 8px;
  }
  .trend-bars {
    min-height: 104px;
    gap: 6px;
  }
  .trend-day {
    height: 98px;
    gap: 4px;
  }
  .trend-bar {
    width: min(100%, 24px);
  }
  .trend-day small {
    font-size: 8px;
  }
  .insight-card,
  .advice-card,
  .small-expense-card {
    min-height: auto;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }
  .insight-icon,
  .advice-icon,
  .small-expense-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }
  .advice-icon svg,
  .small-expense-icon svg {
    width: 18px;
    height: 18px;
  }
  .small-expense-detail {
    margin-top: 4px;
    font-size: 10px;
  }
  .advice-card ul {
    padding-left: 14px;
    font-size: 10px;
    line-height: 1.45;
  }
  .row {
    align-items: stretch;
    flex-direction: column;
  }
  .amount { width: 100%; }
  .panel {
    padding: 10px;
  }
  .settings-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin: 2px 0 10px;
  }
  .settings-head h2 {
    font-size: 22px;
  }
  .settings-theme-toggle {
    box-shadow: none;
  }
  .settings-theme-toggle button {
    min-height: 30px;
    padding: 6px 8px;
    font-size: 10px;
  }
  .settings-theme-toggle svg {
    width: 14px;
    height: 14px;
  }
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 58px;
  }
  .settings-main {
    gap: 8px;
  }
  .settings-profile-card {
    grid-template-columns: 44px minmax(0, 1fr) 24px;
    gap: 9px;
    padding: 10px;
  }
  .settings-avatar {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .settings-profile-card strong {
    margin-bottom: 5px;
    font-size: 13px;
  }
  .settings-profile-card label,
  .settings-row label {
    font-size: 9.5px;
  }
  .settings-profile-card input,
  .settings-row input,
  .settings-row select {
    min-height: 34px;
    margin-top: 4px;
    padding: 7px 8px;
    font-size: 11px;
  }
  .settings-group {
    padding: 10px;
  }
  .settings-group h3 {
    margin-bottom: 8px;
    font-size: 13px;
  }
  .settings-row {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 0;
  }
  .settings-row-icon {
    width: 26px;
    height: 26px;
  }
  .settings-row-icon svg {
    width: 16px;
    height: 16px;
  }
  .backup-actions {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  .settings-action-btn {
    min-height: 38px;
    padding: 7px;
    font-size: 10.5px;
  }
  .settings-action-btn svg,
  .compact-action svg {
    width: 15px;
    height: 15px;
  }
  .settings-section-head {
    margin-bottom: 7px;
  }
  .compact-action {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 10px;
  }
  .settings-category-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 41px;
    padding: 7px 8px;
  }
  .settings-category-icon svg {
    width: 18px;
    height: 18px;
  }
  .settings-category-row strong {
    font-size: 11px;
  }
  .settings-type-pill,
  .settings-category-action {
    min-height: 24px;
    padding: 4px 7px;
    font-size: 9.5px;
  }
  .settings-save {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 77px;
    z-index: 19;
    min-height: 46px;
    width: auto;
  }
  .goals-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 10px;
  }
  .goals-head h2 {
    font-size: 22px;
  }
  .new-goal-btn {
    min-height: 40px;
    padding: 0 12px;
    font-size: 11px;
  }
  .new-goal-btn svg {
    width: 16px;
    height: 16px;
  }
  .goals-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }
  .goal-summary-card {
    grid-template-columns: 30px minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    gap: 8px;
    min-height: 78px;
    padding: 9px;
  }
  .goal-summary-card .metric-icon {
    display: grid;
    width: 30px;
    height: 30px;
  }
  .goal-summary-card .metric-icon svg {
    width: 16px;
    height: 16px;
  }
  .goal-summary-card p {
    font-size: 8.8px;
    line-height: 1.1;
  }
  .goal-summary-card strong {
    font-size: 12px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }
  .goal-board {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .goal-card {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 9px;
    min-height: 98px;
    padding: 9px;
  }
  .goal-card .row-title {
    font-size: 12px;
  }
  .goal-target {
    font-size: 12px;
  }
  .goal-copy {
    gap: 7px;
  }
  .goal-delete {
    width: 30px;
    height: 30px;
  }
  .goal-delete svg {
    width: 15px;
    height: 15px;
  }
  .goal-progress {
    height: 8px;
  }
  .goal-progress-line {
    gap: 7px;
  }
  .goal-progress-line strong,
  .goal-meta-row {
    font-size: 9.5px;
  }
  .goal-meta-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .goal-art {
    width: 78px;
    height: 64px;
  }
  .goal-note-panel {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
    margin-top: 10px;
    padding: 10px;
  }
  .goal-note-panel p {
    font-size: 10px;
    line-height: 1.4;
  }
  .goal-note-icon {
    width: 30px;
    height: 30px;
  }
  .goal-note-icon svg {
    width: 16px;
    height: 16px;
  }
  .movement-modal {
    width: min(96vw, 460px);
  }
  .movement-modal form {
    gap: 10px;
    padding: 18px;
  }
  .movement-modal .modal-head h2 {
    font-size: 20px;
  }
  .modal-helper {
    margin-top: 6px;
    font-size: 11px;
  }
  .movement-type-toggle button {
    min-height: 50px;
    gap: 8px;
    font-size: 13px;
  }
  .type-icon {
    width: 20px;
    height: 20px;
  }
  .type-icon svg {
    width: 18px;
    height: 18px;
  }
  .movement-modal legend,
  .movement-modal .field-label {
    font-size: 12px;
  }
  .input-shell {
    min-height: 46px;
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .input-shell input {
    min-height: 44px;
    font-size: 13px;
    font-weight: 620;
  }
  .input-prefix {
    font-size: 15px;
  }
  .movement-modal .category-grid {
    gap: 7px;
  }
  .movement-modal .category-option {
    min-height: 46px;
    grid-template-columns: 26px minmax(0, 1fr) 18px;
    gap: 9px;
    font-size: 11.5px;
    font-weight: 820;
  }
  .category-option-icon {
    width: 22px;
    height: 22px;
  }
  .category-option-icon svg {
    width: 19px;
    height: 19px;
  }
  .category-option-check {
    width: 18px;
    height: 18px;
  }
  .category-option-check svg {
    width: 12px;
    height: 12px;
  }
  .custom-category-box {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    padding: 9px;
  }
  .custom-category-copy strong {
    font-size: 10.5px;
  }
  .custom-category-copy span {
    font-size: 9.5px;
    line-height: 1.25;
  }
  .custom-category-toggle {
    min-height: 38px;
    max-width: 150px;
    gap: 6px;
    padding: 7px 8px;
    font-size: 10px;
    line-height: 1.15;
  }
  .custom-category-toggle span {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
  }
  .movement-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .movement-actions .secondary-btn,
  .movement-actions .primary-btn,
  .movement-actions .danger-btn:not([hidden]) {
    min-height: 46px;
    font-size: 12px;
  }
  .movement-actions .danger-btn:not([hidden]) {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: min(100%, 150px);
    min-height: 34px;
    padding: 7px 12px;
    font-size: 10.5px;
  }
  .fab-wrap {
    display: grid;
    right: 14px;
    bottom: 90px;
  }
  .fab {
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }
  .fab svg {
    width: 23px;
    height: 23px;
  }
  .fab-menu {
    width: min(78vw, 248px);
    padding: 10px;
  }
  .fab-action {
    min-height: 58px;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 10px;
  }
  .fab-action-icon {
    width: 36px;
    height: 36px;
  }
  .fab-action-icon svg {
    width: 20px;
    height: 20px;
  }
  .fab-action strong {
    font-size: 12.5px;
  }
  .fab-action small {
    font-size: 10.5px;
  }
  .category-grid { grid-template-columns: 1fr; }
  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 8px;
    min-height: 122px;
  }
  .donut {
    width: 78px;
    height: 78px;
  }
  .legend {
    width: 100%;
    gap: 5px;
  }
  .legend-row {
    gap: 5px;
    font-size: 9px;
  }
  .legend-row strong { font-size: 9px; }
  .legend-dot {
    width: 7px;
    height: 7px;
  }
  .signal-card {
    min-height: 122px;
    gap: 5px;
  }
  .mini-bars {
    height: 46px;
    gap: 4px;
  }
  .mini-bars span { width: 8px; }
  .row-title { font-size: 12px; }
  .row-meta { font-size: 10px; }
  .empty-visual.compact { min-height: 122px; }
  .empty-doc {
    width: 62px;
    height: 54px;
  }
}

@media (min-width: 821px) {
  .content { margin: 0 auto; }
}

.license-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.license-card {
  width: min(100%, 470px);
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.license-logo {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
  margin-bottom: 20px;
}
.license-kicker {
  margin-bottom: 8px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.license-card h1 { font-size: 32px; line-height: 1.15; }
.license-intro, .license-privacy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.license-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 20px 0;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.license-mode button, .license-links button {
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 700;
}
.license-mode button.active { color: #fff; background: var(--brand); }
.license-form label { margin-bottom: 14px; }
.license-form label[hidden] { display: none; }
.license-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}
.license-form input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.license-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 7px;
  font-weight: 800;
}
.license-submit:disabled { opacity: .65; cursor: wait; }
.license-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px;
  margin: 10px 0 16px;
}
.license-links button { min-height: 36px; padding-inline: 4px; color: var(--brand); font-size: 12px; }
.license-message {
  padding: 11px 12px;
  color: var(--danger);
  background: var(--expense-soft);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.license-message[data-type="success"] { color: var(--income); background: var(--success-soft); }
.license-privacy {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}
.account-access-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 13px;
}
.account-access-row strong { overflow-wrap: anywhere; }
.admin-card { width: min(100%, 900px); }
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
}
.admin-toolbar .small-note { margin: 0; overflow-wrap: anywhere; }
.admin-grant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  align-items: end;
  gap: 12px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.admin-grant-form label { margin: 0; }
.admin-grant-form .license-submit { margin: 0; }
.admin-list-title { margin: 24px 0 12px; font-size: 18px; }
.admin-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 12px; }
.admin-table th, .admin-table td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-size: 11px; }
.admin-table td:first-child { overflow-wrap: anywhere; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-refresh { margin-top: 12px; }
@media (max-width: 520px) {
  .license-card { padding: 22px 18px; }
  .license-card h1 { font-size: 28px; }
  .admin-grant-form { grid-template-columns: 1fr; }
  .admin-toolbar { align-items: flex-start; flex-direction: column; }
}
