:root {
  --bg: #edf3ea;
  --bg-deep: #e4ede0;
  --surface: #f8fbf6;
  --surface-strong: #ffffff;
  --ink: #17251c;
  --muted: #68766c;
  --faint: #8d998f;
  --line: rgba(31, 57, 41, 0.11);
  --green: #285b43;
  --green-2: #3f785b;
  --green-soft: #dce8d7;
  --green-pale: #e8f0e4;
  --sage: #9bae93;
  --income: #2f7653;
  --spend: #956153;
  --spend-soft: #efe0da;
  --danger: #9b473c;
  --shadow: 0 18px 55px rgba(42, 67, 50, 0.08);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 15px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body { margin: 0; min-width: 320px; min-height: 100%; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; touch-action: manipulation; }
button, input, select { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(40, 91, 67, 0.28); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .56; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.haptic-switch, .haptic-label { position: fixed; left: -20px; top: 0; width: 1px; height: 1px; opacity: .01; pointer-events: none; }
.app-shell { width: min(100%, 760px); min-height: 100svh; margin: 0 auto; padding: calc(18px + var(--safe-top)) 22px calc(102px + var(--safe-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 28px; }
.brand { color: var(--ink); font-size: 26px; line-height: 1; font-weight: 750; letter-spacing: -.055em; text-decoration: none; }
.brand span { color: var(--green-2); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .avatar-button { display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.52); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: transform .16s ease, background .16s ease; }
.icon-button:active, .avatar-button:active, .bottom-nav button:active { transform: scale(.94); }
.icon-button.small { width: 38px; height: 38px; }
.avatar-button { background: var(--green); color: #f8fbf6; font-size: 11px; font-weight: 700; letter-spacing: .06em; box-shadow: none; }

.screen { display: none; animation: screen-in .22s ease both; }
.screen.is-active { display: block; }
@keyframes screen-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.eyebrow-row, .balance-row, .section-heading, .page-title-row, .sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.25; font-weight: 650; letter-spacing: .075em; text-transform: uppercase; }
.sync-label, .section-meta { margin: 0; color: var(--faint); font-size: 12px; }
.balance-block { padding: 4px 0 0; }
.balance-row { align-items: flex-end; margin-top: 8px; }
.money-value { margin: 0; font-size: clamp(44px, 12vw, 70px); line-height: .98; font-weight: 690; letter-spacing: -.065em; font-variant-numeric: tabular-nums; }
.sync-button { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border: 0; border-radius: 19px; background: var(--green-soft); color: var(--green); font-size: 13px; font-weight: 650; cursor: pointer; transition: transform .16s ease, background .16s ease; }
.sync-button:active { transform: scale(.96); }
.sync-button.is-loading svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.balance-change { display: inline-flex; align-items: center; margin-top: 13px; min-height: 26px; padding: 5px 10px; border-radius: 13px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 650; }
.balance-change.is-neutral { background: rgba(255,255,255,.45); color: var(--muted); }

.period-control { display: flex; width: max-content; margin: 32px 0 14px auto; padding: 3px; border-radius: 14px; background: rgba(255,255,255,.52); box-shadow: inset 0 0 0 1px var(--line); }
.period-control button { min-width: 46px; height: 32px; padding: 0 12px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
.period-control button[aria-pressed="true"] { background: var(--surface-strong); color: var(--ink); box-shadow: 0 2px 8px rgba(34,60,43,.09); }
.trend-section { min-height: 250px; padding: 22px 20px 14px; border-radius: var(--radius-xl); background: rgba(248,251,246,.72); box-shadow: inset 0 0 0 1px rgba(255,255,255,.56), var(--shadow); }
.section-heading { margin-bottom: 15px; }
.section-heading.compact { align-items: flex-start; margin-bottom: 8px; }
.section-heading h2, .sheet-header h2 { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 680; letter-spacing: -.025em; }
.section-heading .eyebrow + h2 { margin-top: 3px; }
.legend { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; }
.income-dot { background: var(--income); }
.spend-dot { background: var(--spend); }
.chart { width: 100%; height: 178px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .axis-label { fill: var(--faint); stroke: none; font-size: 10px; font-weight: 550; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .income-bar { fill: var(--green-2); stroke: none; }
.chart .spend-bar { fill: var(--sage); stroke: none; }
.chart .empty-label { fill: var(--muted); stroke: none; font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.metric-card { display: flex; align-items: center; gap: 13px; min-width: 0; padding: 17px; border-radius: var(--radius-lg); background: rgba(248,251,246,.76); box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); }
.metric-icon { display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; border-radius: 14px; }
.metric-icon.income { background: var(--green-soft); color: var(--income); }
.metric-icon.spending { background: var(--spend-soft); color: var(--spend); }
.metric-card div:last-child { min-width: 0; }
.metric-card p, .metric-card small { display: block; margin: 0; color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; overflow: hidden; margin: 2px 0; font-size: 18px; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }

.content-section, .provider-section { margin-top: 34px; }
.text-button { padding: 6px 0; border: 0; background: transparent; color: var(--green); font-size: 13px; font-weight: 650; cursor: pointer; }
.asset-list, .transaction-list, .wallet-list, .category-list { display: grid; gap: 8px; }
.asset-row, .transaction-row, .wallet-row, .empty-row { display: flex; align-items: center; min-width: 0; border-radius: var(--radius-md); }
.asset-row, .transaction-row, .wallet-row { padding: 12px; background: rgba(248,251,246,.48); }
.asset-icon, .transaction-icon, .wallet-icon { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; margin-right: 12px; border-radius: 14px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: -.02em; }
.transaction-icon.out { background: var(--spend-soft); color: var(--spend); }
.transaction-icon.other { background: rgba(255,255,255,.58); color: var(--muted); }
.asset-main, .transaction-main, .wallet-main { min-width: 0; flex: 1; }
.asset-main strong, .transaction-main strong, .wallet-main strong { display: block; overflow: hidden; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.asset-main span, .transaction-main span, .wallet-main span { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.asset-value, .transaction-value { flex: 0 0 auto; margin-left: 10px; text-align: right; }
.asset-value strong, .transaction-value strong { display: block; font-size: 14px; font-weight: 680; font-variant-numeric: tabular-nums; }
.asset-value span, .transaction-value span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.transaction-row { width: 100%; border: 0; text-align: left; cursor: pointer; transition: background .16s ease, transform .16s ease; }
.transaction-row:active { transform: scale(.985); background: var(--green-pale); }
.empty-row { justify-content: center; min-height: 86px; padding: 18px; border: 1px dashed rgba(40,91,67,.18); color: var(--muted); text-align: center; font-size: 13px; line-height: 1.45; }

.page-title-row { align-items: flex-end; margin: 8px 0 6px; }
.page-title-row h1 { margin: 3px 0 0; font-size: 36px; line-height: 1; font-weight: 700; letter-spacing: -.05em; }
.month-stepper { display: flex; gap: 8px; }
.month-label { margin: 28px 0 12px; color: var(--muted); font-size: 13px; font-weight: 650; }
.cashflow-summary { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 2px; overflow: hidden; border-radius: var(--radius-lg); background: var(--line); }
.cashflow-summary article { min-width: 0; padding: 17px 14px; background: rgba(248,251,246,.82); }
.cashflow-summary p { margin: 0 0 7px; color: var(--muted); font-size: 11px; }
.cashflow-summary strong { display: block; overflow: hidden; font-size: 17px; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cashflow-summary .net { background: var(--green-soft); }
.category-row { padding: 11px 0; }
.category-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.category-top strong { font-size: 13px; }
.category-top span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.category-track { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(40,91,67,.09); }
.category-track i { display: block; height: 100%; border-radius: inherit; background: var(--green-2); transform-origin: left; animation: bar-in .35s ease both; }
@keyframes bar-in { from { transform: scaleX(0); } }

.activity-controls { margin: 26px 0 20px; }
.search-field { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 15px; border-radius: 16px; background: rgba(248,251,246,.76); box-shadow: inset 0 0 0 1px var(--line); }
.search-field svg { flex: 0 0 auto; color: var(--muted); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; }
.search-field input::placeholder { color: var(--faint); }
.filter-pills { display: flex; gap: 7px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; scrollbar-width: none; }
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pills button { flex: 0 0 auto; min-height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 17px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; cursor: pointer; }
.filter-pills button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: white; }
.date-group { margin: 22px 0 8px; color: var(--muted); font-size: 12px; font-weight: 650; }

.primary-button, .secondary-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border: 0; border-radius: 16px; font-weight: 670; cursor: pointer; transition: transform .16s ease, filter .16s ease; }
.primary-button:active, .secondary-button:active, .danger-button:active { transform: scale(.98); }
.primary-button { background: var(--green); color: #fff; }
.primary-button.compact { min-height: 40px; border-radius: 14px; font-size: 13px; }
.secondary-button { background: var(--green-soft); color: var(--green); }
.danger-button { background: #f0dfdb; color: var(--danger); }
.full { width: 100%; }
.privacy-note { display: flex; gap: 12px; margin: 27px 0 22px; padding: 16px; border-radius: var(--radius-lg); background: var(--green-soft); color: var(--green); }
.privacy-note svg { flex: 0 0 auto; margin-top: 1px; }
.privacy-note p { margin: 0; }
.privacy-note strong, .privacy-note span { display: block; }
.privacy-note strong { font-size: 13px; }
.privacy-note span { margin-top: 4px; color: #567060; font-size: 11px; line-height: 1.4; }
.wallet-row { position: relative; }
.wallet-icon.evm { background: #e3e4ef; color: #555a79; }
.wallet-icon.solana { background: #dceae2; color: #296349; }
.wallet-icon.tron { background: #f1dfdc; color: #9b453d; }
.wallet-icon.bitcoin { background: #f1e8d5; color: #866821; }
.remove-wallet { display: grid; place-items: center; width: 34px; height: 34px; margin-left: 8px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.coverage-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.coverage-item { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 11px; border-radius: 14px; background: rgba(248,251,246,.45); color: var(--muted); font-size: 11px; }
.coverage-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); }
.coverage-item.is-live { color: var(--ink); }
.coverage-item.is-live i { background: var(--income); box-shadow: 0 0 0 4px rgba(47,118,83,.1); }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: calc(12px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); width: min(calc(100% - 24px), 600px); height: 68px; padding: 6px; border: 1px solid rgba(255,255,255,.55); border-radius: 24px; background: rgba(248,251,246,.88); box-shadow: 0 14px 40px rgba(32,56,39,.15); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); transform: translateX(-50%); }
.bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 0; border: 0; border-radius: 18px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 650; cursor: pointer; transition: transform .16s ease, color .16s ease, background .16s ease; }
.bottom-nav button svg { width: 19px; height: 19px; }
.bottom-nav button[aria-current="page"] { background: var(--green-soft); color: var(--green); }

dialog { color: var(--ink); }
.sheet-dialog { width: min(calc(100% - 24px), 560px); max-height: min(88svh, 760px); margin: auto auto 0; padding: 10px 20px calc(24px + var(--safe-bottom)); border: 0; border-radius: 28px 28px 0 0; background: var(--surface); box-shadow: 0 -20px 70px rgba(24,48,31,.18); overflow-y: auto; }
.sheet-dialog::backdrop { background: rgba(22,35,27,.28); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet-dialog[open] { animation: sheet-in .25s cubic-bezier(.2,.8,.2,1) both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
.sheet-grabber { width: 36px; height: 4px; margin: 0 auto 18px; border-radius: 2px; background: rgba(40,61,47,.16); }
.sheet-header { align-items: flex-start; margin-bottom: 13px; }
.sheet-header h2 { margin-top: 4px; font-size: 23px; letter-spacing: -.035em; }
.sheet-copy { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
#connect-all { justify-content: flex-start; gap: 13px; min-height: 62px; padding: 10px 14px; text-align: left; }
.trust-mark { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.14); font-weight: 800; }
#connect-all strong, #connect-all small { display: block; }
#connect-all small { margin-top: 2px; color: rgba(255,255,255,.72); font-size: 10px; font-weight: 500; }
.provider-results { display: grid; gap: 6px; margin-top: 10px; }
.provider-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 12px; background: var(--green-pale); font-size: 11px; }
.provider-result.is-error { background: #f4e6e2; color: var(--danger); }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.manual-form { display: grid; gap: 13px; }
.manual-form > label:not(.switch-row), .settings-field { display: grid; gap: 7px; }
.manual-form label > span, .settings-field > span > strong { color: var(--muted); font-size: 11px; font-weight: 650; }
.manual-form input, .manual-form select, .settings-field input { width: 100%; height: 48px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; outline: 0; background: white; color: var(--ink); }
.trust-link { display: block; margin-top: 18px; color: var(--green); font-size: 12px; font-weight: 650; text-align: center; text-decoration: none; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; }
.switch-row span { flex: 1; }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { color: var(--ink); font-size: 13px; }
.switch-row small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
input[type="checkbox"][switch] { width: 46px; height: 28px; flex: 0 0 auto; }
.settings-list { display: grid; gap: 2px; }
.settings-field { padding: 14px 0; }
.settings-field > span > small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; }
.settings-actions { display: grid; gap: 9px; margin-top: 18px; }
.file-button { position: relative; cursor: pointer; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.settings-footnote { margin: 18px 0 0; color: var(--faint); font-size: 10px; line-height: 1.45; }

.toast-region { position: fixed; z-index: 80; left: 50%; bottom: calc(94px + var(--safe-bottom)); display: grid; width: min(calc(100% - 36px), 460px); gap: 8px; pointer-events: none; transform: translateX(-50%); }
.toast { padding: 13px 16px; border-radius: 15px; background: rgba(24,39,29,.93); color: white; box-shadow: 0 14px 35px rgba(20,34,25,.22); font-size: 12px; line-height: 1.35; animation: toast-in .2s ease both; }
.toast.error { background: rgba(116,48,41,.95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.is-private [data-private] { position: relative; color: transparent !important; text-shadow: none !important; user-select: none; }
.is-private [data-private]::after { content: "****"; position: absolute; inset: 0; display: flex; align-items: inherit; justify-content: inherit; color: var(--ink); font: inherit; letter-spacing: .08em; text-shadow: none; }

@media (min-width: 761px) {
  .app-shell { padding-top: 36px; }
  .sheet-dialog { margin: auto; border-radius: 28px; padding-bottom: 24px; }
}
@media (max-width: 470px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .topbar { margin-bottom: 24px; }
  .money-value { font-size: 46px; }
  .sync-button span { display: none; }
  .sync-button { width: 38px; padding: 0; justify-content: center; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { gap: 9px; padding: 14px 11px; }
  .metric-icon { width: 34px; height: 34px; border-radius: 12px; }
  .metric-card strong { font-size: 15px; }
  .cashflow-summary article { padding: 15px 10px; }
  .cashflow-summary strong { font-size: 14px; }
  .coverage-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
