:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --text: #17212b;
  --muted: #7a8792;
  --line: #e8edf0;
  --green: #17865d;
  --green-dark: #116e4b;
  --green-soft: #eaf6f0;
  --red: #d65c59;
  --red-soft: #fff0ef;
  --amber: #bd8735;
  --shadow: 0 12px 34px rgba(31, 49, 59, .07);
  --radius: 20px;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(23,134,93,.18); outline-offset: 2px; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; }
.topbar { height: 76px; padding: 0 max(28px, calc((100vw - 1160px)/2)); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 210px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; color: white; background: linear-gradient(145deg, #20996b, #116d4a); border-radius: 15px; font-size: 23px; font-weight: 800; box-shadow: 0 7px 15px rgba(23,134,93,.18); }
.brand-mark.small { width: 39px; height: 39px; border-radius: 12px; font-size: 19px; }
.brand strong { display: block; font-size: 16px; letter-spacing: .3px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.desktop-nav { display: flex; align-items: center; gap: 8px; }
.nav-link { border: 0; background: transparent; color: #687681; padding: 10px 18px; border-radius: 11px; font-weight: 650; }
.nav-link:hover, .nav-link.active { color: var(--green); background: var(--green-soft); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-button { border: 1px solid var(--line); background: white; color: #52616b; padding: 9px 12px; border-radius: 11px; font-weight: 650; display: inline-flex; align-items: center; gap: 7px; }
.icon-button:hover { border-color: #c9ddd3; color: var(--green); }
.icon-button:first-letter { font-size: 17px; }
.avatar-button { border: 0; border-radius: 50%; width: 35px; height: 35px; background: #edf1f2; color: #61707a; font-size: 12px; font-weight: 700; }
.main-content { width: min(1120px, calc(100% - 56px)); margin: 0 auto; padding: 34px 0 70px; }
.month-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { color: #9aa6ae; letter-spacing: 1.5px; font-size: 10px; font-weight: 800; margin: 0 0 8px; }
h1, h2, h3, p { margin-top: 0; }
.month-toolbar h1 { margin: 0; font-size: 27px; letter-spacing: -.6px; }
.month-picker-wrap { display: flex; gap: 7px; align-items: center; padding: 5px; background: white; border: 1px solid var(--line); border-radius: 13px; }
.month-picker-wrap input { border: 0; color: var(--text); background: transparent; padding: 6px 5px; font-weight: 700; min-width: 142px; }
.month-arrow { width: 28px; height: 28px; border: 0; border-radius: 8px; color: #74818a; background: transparent; font-size: 23px; line-height: 1; }
.month-arrow:hover { background: var(--surface-soft); color: var(--green); }
.view-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .9fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 13px rgba(36,54,62,.025); }
.budget-card { padding: 25px 27px 22px; overflow: hidden; position: relative; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-title { margin: 0; font-size: 15px; font-weight: 750; }
.muted { color: var(--muted); }
.small-muted { color: var(--muted); font-size: 12px; }
.text-button { background: transparent; border: 0; color: var(--green); font-weight: 700; padding: 6px; }
.budget-number { margin: 21px 0 23px; font-size: clamp(35px, 5vw, 48px); font-weight: 780; letter-spacing: -1.6px; line-height: 1; }
.money-symbol { font-size: 19px; margin-right: 5px; font-weight: 600; color: #718078; vertical-align: 7px; letter-spacing: 0; }
.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.money-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.money-value { font-size: 23px; font-weight: 750; letter-spacing: -.5px; }
.money-value.spent { color: #4c5962; }
.money-value.remaining { color: var(--green); }
.money-value.negative { color: var(--red); }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; margin: 17px 0 8px; color: var(--muted); font-size: 11px; }
.progress-track { height: 9px; border-radius: 20px; background: #edf1ef; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #25a573, #17865d); border-radius: inherit; transition: width .25s ease; }
.progress-fill.over { background: linear-gradient(90deg, #ed9a78, #d65c59); }
.budget-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 17px; }
.daily-note { color: var(--muted); font-size: 12px; }
.daily-note strong { color: #52636c; font-weight: 750; }
.button { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 750; transition: transform .12s, background .12s; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--green); color: white; box-shadow: 0 6px 13px rgba(23,134,93,.15); }
.button-primary:hover { background: var(--green-dark); }
.button-soft { color: var(--green); background: var(--green-soft); }
.button-soft:hover { background: #dff1e8; }
.button-danger { color: var(--red); background: var(--red-soft); }
.button-full { width: 100%; }
.quick-add { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 21px; }
.quick-add-copy strong { display: block; font-size: 14px; margin-bottom: 4px; }
.quick-add-copy span { color: var(--muted); font-size: 12px; }
.add-circle { display: grid; place-items: center; border: 0; width: 42px; height: 42px; border-radius: 14px; background: var(--green); color: white; font-size: 25px; line-height: 1; box-shadow: 0 6px 12px rgba(23,134,93,.18); }
.card-pad { padding: 21px 22px; }
.recent-list { margin-top: 8px; }
.expense-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #f0f3f4; }
.expense-row:last-child { border-bottom: 0; padding-bottom: 0; }
.category-icon { width: 39px; height: 39px; flex: 0 0 39px; display: grid; place-items: center; border-radius: 13px; color: #4f7666; background: #eff6f2; font-size: 17px; }
.category-icon.tone-1 { color: #a06f46; background: #fbf3ec; }
.category-icon.tone-2 { color: #6a7b9d; background: #eff2f8; }
.category-icon.tone-3 { color: #a16e82; background: #f8eff3; }
.expense-info { min-width: 0; flex: 1; }
.expense-title { font-size: 13px; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expense-subtitle { margin-top: 4px; color: var(--muted); font-size: 11px; }
.expense-amount { font-weight: 750; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty-state { padding: 30px 15px; text-align: center; color: var(--muted); }
.empty-state .empty-symbol { margin: 0 auto 11px; width: 45px; height: 45px; border-radius: 15px; display: grid; place-items: center; background: #f2f6f4; color: #719282; font-size: 22px; }
.empty-state strong { display: block; color: #4b5961; margin-bottom: 5px; }
.category-bars { margin-top: 17px; display: grid; gap: 15px; }
.category-line { display: grid; grid-template-columns: 76px 1fr 78px; align-items: center; gap: 10px; }
.category-line-name { color: #5f6d75; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-line-track { background: #f0f3f3; height: 7px; border-radius: 10px; overflow: hidden; }
.category-line-fill { height: 100%; background: #70ad91; border-radius: inherit; }
.category-line-value { text-align: right; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.page-card { padding: 22px; }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.toolbar-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field-control { border: 1px solid var(--line); background: white; border-radius: 10px; padding: 9px 11px; color: #53616b; min-height: 38px; }
.search-control { min-width: 190px; }
.filter-control { min-width: 110px; }
.bill-date-heading { color: #8b979e; font-size: 11px; font-weight: 750; margin: 20px 0 4px; }
.bill-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid #edf1f2; }
.bill-actions { display: flex; gap: 4px; margin-left: 5px; }
.small-action { border: 0; border-radius: 8px; background: transparent; padding: 6px 8px; color: #85919a; font-size: 12px; }
.small-action:hover { background: #f4f7f7; color: var(--green); }
.small-action.delete:hover { color: var(--red); background: var(--red-soft); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stat-summary { padding: 20px 22px; }
.stat-total { font-size: 29px; font-weight: 780; margin: 11px 0 0; letter-spacing: -.8px; }
.trend-list { display: grid; gap: 15px; margin-top: 20px; }
.trend-row { display: grid; grid-template-columns: 54px 1fr 88px; gap: 12px; align-items: center; }
.trend-month { color: #78858d; font-size: 12px; }
.trend-bars { display: grid; gap: 5px; }
.trend-track { height: 7px; background: #f0f3f2; border-radius: 10px; overflow: hidden; }
.trend-spent { height: 100%; background: #71ae91; border-radius: inherit; }
.trend-budget { height: 4px; background: #d7e6de; border-radius: 10px; margin-top: 3px; }
.trend-value { text-align: right; font-size: 12px; font-weight: 700; }
.tag { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 7px; color: #63756b; background: #eff6f1; font-size: 10px; font-weight: 700; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(20,31,37,.35); display: grid; place-items: center; padding: 18px; backdrop-filter: blur(3px); }
.modal { width: min(100%, 460px); max-height: min(90vh, 760px); overflow-y: auto; background: white; border-radius: 22px; box-shadow: 0 25px 70px rgba(12,29,37,.22); padding: 25px; }
.modal.wide { width: min(100%, 560px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.modal-head h2 { font-size: 19px; margin: 0 0 5px; }
.modal-close { border: 0; background: #f2f5f5; color: #697780; width: 31px; height: 31px; border-radius: 10px; font-size: 20px; line-height: 1; }
.form-stack { display: grid; gap: 15px; }
.form-field { display: grid; gap: 7px; }
.form-field label { color: #5f6c74; font-weight: 700; font-size: 12px; }
.form-field input, .form-field select { width: 100%; border: 1px solid #e2e8ea; border-radius: 11px; background: #fbfcfc; padding: 12px 13px; min-height: 44px; color: var(--text); }
.form-field input:focus, .form-field select:focus { border-color: #7eb69b; outline: 3px solid rgba(23,134,93,.1); }
.form-hint { color: #9aa5ab; font-size: 11px; margin-top: -2px; }
.form-error { color: var(--red); font-size: 12px; min-height: 16px; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 21px; }
.category-manager { display: grid; gap: 10px; margin: 16px 0; }
.manage-category { display: flex; align-items: center; gap: 8px; }
.manage-category input { flex: 1; min-width: 0; border: 1px solid var(--line); padding: 9px 10px; border-radius: 9px; }
.remove-category { border: 0; background: var(--red-soft); color: var(--red); width: 33px; height: 33px; border-radius: 9px; font-size: 17px; }
.add-category-line { display: flex; gap: 8px; }
.add-category-line input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.toast { position: fixed; z-index: 40; bottom: 28px; left: 50%; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; padding: 11px 17px; color: white; background: #263a33; border-radius: 11px; box-shadow: var(--shadow); transition: .2s ease; font-size: 13px; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading-state { text-align: center; color: var(--muted); padding: 80px 15px; }
.mobile-nav { display: none; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 25px; position: relative; background: radial-gradient(circle at 50% 12%, #e4f4eb 0, transparent 42%), var(--bg); }
.login-card { width: min(100%, 390px); background: white; border: 1px solid var(--line); border-radius: 24px; padding: 36px; box-shadow: var(--shadow); text-align: center; }
.login-card .brand-mark { margin: 0 auto 20px; }
.login-card h1 { margin: 0 0 10px; font-size: 27px; }
.login-intro { line-height: 1.7; font-size: 13px; margin-bottom: 27px; }
.login-form { display: grid; gap: 10px; text-align: left; }
.login-form label { color: #5d6b73; font-weight: 700; font-size: 12px; }
.login-form input { width: 100%; border: 1px solid #e2e8ea; background: #fbfcfc; border-radius: 11px; padding: 13px; min-height: 47px; margin-bottom: 5px; }
.login-foot { position: absolute; bottom: 19px; color: #a1abb0; font-size: 11px; margin: 0; }
.setup-warning { margin-top: 16px; border-radius: 12px; background: #fff7e9; color: #82652d; text-align: left; padding: 12px; font-size: 12px; line-height: 1.7; }
@media (max-width: 760px) {
  .topbar { height: 64px; padding: 0 17px; }
  .brand { min-width: auto; }
  .brand-mark.small { width: 35px; height: 35px; }
  .desktop-nav { display: none; }
  .top-actions { gap: 6px; }
  .icon-button { padding: 8px 9px; font-size: 12px; }
  .avatar-button { width: 32px; height: 32px; }
  .main-content { width: calc(100% - 30px); padding: 25px 0 100px; }
  .month-toolbar { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .month-toolbar h1 { font-size: 24px; }
  .month-picker-wrap { align-self: stretch; justify-content: space-between; }
  .month-picker-wrap input { flex: 1; text-align: center; }
  .view-grid { grid-template-columns: 1fr; gap: 14px; }
  .budget-card { padding: 21px 19px 18px; }
  .budget-number { margin: 20px 0; font-size: 39px; }
  .money-grid { gap: 12px; }
  .money-value { font-size: 20px; }
  .card-pad { padding: 18px; }
  .quick-add { padding: 15px 17px; }
  .page-card { padding: 16px; }
  .toolbar-row { align-items: flex-start; flex-direction: column; }
  .toolbar-controls { width: 100%; }
  .search-control { flex: 1; min-width: 0; }
  .filter-control { flex: 1; min-width: 0; }
  .stats-grid { grid-template-columns: 1fr; gap: 14px; }
  .mobile-nav { position: fixed; display: flex; align-items: center; justify-content: space-around; bottom: 0; left: 0; right: 0; z-index: 8; padding: 9px 9px max(9px, env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(14px); }
  .mobile-nav-item { border: 0; background: transparent; color: #8a969d; min-width: 54px; display: grid; gap: 3px; justify-items: center; font-size: 10px; font-weight: 700; }
  .mobile-nav-item span { font-size: 19px; line-height: 20px; }
  .mobile-nav-item.active { color: var(--green); }
  .mobile-add { border: 0; border-radius: 11px; background: var(--green); color: white; padding: 8px 13px; font-weight: 750; display: flex; align-items: center; gap: 5px; }
  .mobile-add span { font-size: 19px; }
  .login-card { padding: 29px 23px; }
  .login-foot { bottom: 11px; }
}
@media (max-width: 390px) {
  .top-actions .icon-button span { display: none; }
  .top-actions .icon-button { width: 35px; height: 35px; justify-content: center; padding: 0; }
  .category-line { grid-template-columns: 62px 1fr 68px; gap: 7px; }
  .money-value { font-size: 18px; }
  .modal { padding: 21px 18px; }
}


/* Category icon images and site footer */
.category-icon { overflow: hidden; }
.category-icon img { width: 25px; height: 25px; object-fit: contain; display: block; }
.category-line-name { display: inline-flex; align-items: center; gap: 8px; }
.category-line-name .category-icon { width: 27px; height: 27px; flex: 0 0 27px; border-radius: 8px; }
.category-line-name .category-icon img { width: 19px; height: 19px; }
.site-footer { padding: 24px 12px 28px; text-align: center; color: #98a3a9; font-size: 12px; border-top: 1px solid var(--line); margin-top: 26px; }
.site-footer a { color: #16845b; text-decoration: none; font-weight: 650; }
@media (max-width: 760px) { .site-footer { padding-bottom: 100px; } }
