:root {
  --ink: #12251d;
  --muted: #718078;
  --paper: #f4f7f1;
  --card: #ffffff;
  --line: #dfe8df;
  --mint: #c9f2d6;
  --mint-strong: #79cf99;
  --orange: #ff9362;
  --orange-soft: #fff0e9;
  --shadow: 0 16px 40px rgba(27, 59, 42, 0.08);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Manrope, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 560px); min-height: 100vh; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 20px calc(104px + env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.eyebrow, .section-kicker { margin: 0 0 5px; color: var(--muted); font-family: "DM Mono", monospace; font-size: 10px; letter-spacing: .13em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 23px; letter-spacing: -.05em; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: -.04em; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.import-button { padding: 9px 10px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 11px; font-size: 12px; font-weight: 700; }
.import-button:focus-visible, .icon-button:focus-visible, .close-button:focus-visible, .save-button:focus-visible, .delete-button:focus-visible { outline: 3px solid rgba(121,207,153,.45); outline-offset: 2px; }
.icon-button, .close-button { display: grid; place-items: center; border: 1px solid var(--line); color: var(--ink); background: var(--card); border-radius: 50%; }
.icon-button { width: 40px; height: 40px; font-weight: 800; }
.hero-card { padding: 23px 22px 19px; color: #f7fff8; background: var(--ink); border-radius: 26px; box-shadow: var(--shadow); }
.hero-topline, .hero-footline { display: flex; justify-content: space-between; align-items: center; color: #9ab4a3; font-size: 12px; }
.status-dot { display: flex; align-items: center; gap: 6px; }
.status-dot i { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--mint-strong); }
.hero-label { margin: 35px 0 4px; color: #b2c8ba; font-size: 13px; }
.hero-amount { margin: 0 0 25px; font-size: clamp(39px, 12vw, 58px); font-weight: 800; line-height: 1; letter-spacing: -.08em; }
.budget-track { height: 8px; overflow: hidden; background: #294638; border-radius: 99px; }
.budget-track span { display: block; width: 0; height: 100%; background: var(--mint); border-radius: inherit; transition: width .35s ease; }
.hero-footline { margin-top: 11px; }
.hero-footline strong { color: #effff2; }
.alert-card { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding: 14px; color: #6a341f; background: var(--orange-soft); border: 1px solid #ffd5c1; border-radius: 18px; }
.alert-card.is-hidden { display: none; }
.alert-mark { display: grid; flex: 0 0 22px; place-items: center; width: 22px; height: 22px; color: white; background: var(--orange); border-radius: 50%; font-weight: 800; }
.alert-card strong { font-size: 13px; }
.alert-card p { margin: 3px 0 0; font-size: 12px; line-height: 1.5; }
.alert-card button { margin-left: auto; border: 0; color: #9c624b; background: transparent; font-size: 22px; line-height: 1; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 32px; }
.stat-card { display: flex; gap: 11px; align-items: center; padding: 15px 13px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.stat-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; font-weight: 800; font-size: 20px; }
.stat-icon.income { color: #25844d; background: var(--mint); }
.stat-icon.expense { color: #b4552f; background: var(--orange-soft); }
.stat-card p { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.stat-card strong { font-size: 16px; letter-spacing: -.04em; }
.section-block { margin-bottom: 30px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.section-count, .text-button { color: var(--muted); font-size: 12px; }
.text-button { padding: 0; border: 0; background: transparent; }
.category-list, .ledger-list { display: grid; gap: 10px; }
.category-row { padding: 13px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 15px; }
.category-meta, .category-values { display: flex; justify-content: space-between; align-items: center; }
.category-meta { margin-bottom: 9px; font-size: 12px; }
.category-values { color: var(--muted); font-family: "DM Mono", monospace; font-size: 11px; }
.category-bar { height: 5px; overflow: hidden; background: #edf2eb; border-radius: 8px; }
.category-bar span { display: block; width: 0; height: 100%; background: var(--mint-strong); border-radius: inherit; transition: width .4s ease; }
.empty-state { padding: 24px 15px; color: var(--muted); background: rgba(255,255,255,.55); border: 1px dashed #cbd8cc; border-radius: 16px; text-align: center; font-size: 13px; }
.ledger-item { display: flex; gap: 12px; align-items: center; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.ledger-symbol { display: grid; flex: 0 0 38px; place-items: center; width: 38px; height: 38px; border-radius: 13px; font-weight: 800; }
.ledger-symbol.expense { color: #b4552f; background: var(--orange-soft); }
.ledger-symbol.income { color: #25844d; background: var(--mint); }
.ledger-copy { min-width: 0; flex: 1; }
.ledger-copy strong, .ledger-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-copy strong { font-size: 13px; }
.ledger-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.ledger-amount { font-family: "DM Mono", monospace; font-size: 13px; }
.ledger-amount.expense { color: #b4552f; }
.ledger-amount.income { color: #25844d; }
.delete-button { padding: 5px 0 5px 8px; border: 0; color: #a2aea5; background: transparent; font-size: 11px; }
.delete-button:hover, .delete-button:focus-visible { color: #b4552f; }
.add-button { position: fixed; z-index: 2; right: max(20px, calc((100vw - 520px) / 2)); bottom: max(22px, env(safe-area-inset-bottom)); display: flex; gap: 7px; align-items: center; padding: 14px 19px; color: white; background: var(--ink); border: 0; border-radius: 99px; box-shadow: 0 12px 25px rgba(18, 37, 29, .22); font-size: 14px; font-weight: 700; }
.add-button span { font-size: 20px; line-height: 14px; }
dialog { width: min(calc(100% - 30px), 500px); padding: 0; color: var(--ink); background: var(--paper); border: 0; border-radius: 24px; box-shadow: 0 24px 80px rgba(18, 37, 29, .25); }
dialog::backdrop { background: rgba(18, 37, 29, .45); backdrop-filter: blur(4px); }
dialog form { padding: 22px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.close-button { width: 32px; height: 32px; font-size: 22px; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px; background: #e7eee6; border-radius: 13px; }
.type-option { padding: 10px; border: 0; color: var(--muted); background: transparent; border-radius: 10px; font-size: 13px; font-weight: 700; }
.type-option.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(18,37,29,.08); }
label { display: block; margin: 14px 0; color: var(--muted); font-size: 12px; }
label input, label select { display: block; width: 100%; padding: 12px 13px; margin-top: 7px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 12px; outline: 0; }
label input:focus, label select:focus { border-color: var(--mint-strong); box-shadow: 0 0 0 3px rgba(121,207,153,.2); }
.optional { float: right; color: #9ca9a0; }
.save-button { width: 100%; padding: 14px; margin-top: 9px; color: var(--ink); background: var(--mint); border: 0; border-radius: 13px; font-weight: 800; }
.import-note, .import-status { color: var(--muted); font-size: 12px; line-height: 1.6; }
.import-note { margin: -3px 0 17px; }
.import-status { min-height: 20px; margin: 10px 0 0; }
.import-preview { padding: 12px; margin-top: 12px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.import-preview.is-hidden { display: none; }
.import-summary, .import-list div { display: flex; justify-content: space-between; align-items: center; }
.import-summary { padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: 12px; }
.import-summary span { color: #b4552f; font-family: "DM Mono", monospace; }
.import-list { display: grid; gap: 8px; padding: 10px 0 3px; }
.import-list div { color: var(--muted); font-size: 11px; }
.import-list strong { color: #b4552f; font-family: "DM Mono", monospace; font-size: 11px; }
.import-preview p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.import-dialog .save-button:disabled { color: #a2aea5; background: #e7eee6; cursor: not-allowed; }
.toast { position: fixed; z-index: 4; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); padding: 11px 15px; color: white; background: var(--ink); border-radius: 99px; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.setting-line { display: flex; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.settings-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
@media (min-width: 600px) { body { padding: 20px 0; } .app-shell { min-height: calc(100vh - 40px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
