* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: #f2f4f7; color: #1a1a1a; overflow-x: hidden; }
.hidden { display: none !important; }
.view { max-width: 720px; margin: 0 auto; }
button { cursor: pointer; font-size: 15px; }
header { position: -webkit-sticky; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: #15803d; color: #fff; }
.head-inner { display: flex; flex-direction: column; gap: 6px; }
header h1 { font-size: 19px; margin: 0; font-weight: 700; }
.month-nav { display: flex; align-items: center; gap: 10px; font-size: 14px; }
button.plain { border: none; background: none; color: #fff; padding: 4px 8px; }
button.plain.dark { color: #fff; font-size: 18px; }
button.strong { color: #fff; font-weight: 600; }
.head-ops { display: flex; align-items: center; gap: 4px; }
#refresh-btn { font-size: 18px; }
#login-view { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
#login-view h1 { color: #15803d; margin: 0 0 2px; font-size: 26px; }
#login-view .subtitle { color: #9aa3b2; margin: 0 0 28px; font-size: 14px; letter-spacing: 1px; }
#login-view input { width: 100%; max-width: 320px; padding: 14px; border: 1px solid #d0d6e0; border-radius: 10px; font-size: 16px; outline: none; margin-bottom: 14px; }
button.primary { width: 100%; max-width: 320px; padding: 14px; border: none; border-radius: 10px; background: #15803d; color: #fff; font-size: 16px; font-weight: 600; }
.err { color: #e5484d; margin-top: 12px; font-size: 14px; }
.summary { display: flex; margin: 12px; padding: 16px 20px; background: #fff; border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.sum-total { flex: 1; }
.sum-count { text-align: right; }
.sum-label { font-size: 13px; color: #9aa3b2; margin-bottom: 4px; }
.sum-amount { font-size: 26px; font-weight: 700; color: #e5484d; }
.sum-count-num { font-size: 22px; font-weight: 700; color: #333; }
.panel { background: #fff; border-radius: 14px; margin: 0 12px 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.panel-title { font-size: 14px; font-weight: 600; color: #555; margin-bottom: 10px; }
.panel-title .hint { font-size: 11px; color: #b8bfcc; font-weight: 400; }
.filter-row { display: flex; gap: 8px; margin-bottom: 8px; }
.filter-row select { flex: 1; padding: 8px 10px; border: 1px solid #d5dae2; border-radius: 8px; font-size: 14px; background: #fff; color: #333; outline: none; -webkit-appearance: none; appearance: none; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.cat-name { min-width: 56px; max-width: 38%; font-size: 14px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar { flex: 1; height: 8px; background: #eef0f4; border-radius: 999px; overflow: hidden; min-width: 30px; }
.cat-bar-in { height: 100%; background: #15803d; border-radius: 999px; }
.cat-amt { min-width: 76px; text-align: right; font-size: 14px; color: #555; white-space: nowrap; flex-shrink: 0; }
.trend { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 130px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-bar { width: 70%; background: #15803d; border-radius: 6px 6px 0 0; min-height: 2px; }
.trend-val { font-size: 11px; color: #98a0ad; margin-bottom: 4px; white-space: nowrap; }
.link-btn { background: none; border: 1px solid #cfd8dc; color: #15803d; border-radius: 8px; padding: 7px 12px; font-size: 13px; }
.bill-mini { padding: 12px 16px; cursor: pointer; }
.bill-mini:active { background: #f7f8fa; }
.bill-mini-row { display: flex; align-items: center; gap: 12px; }
.bill-mini-icon { font-size: 22px; flex-shrink: 0; }
.bill-mini-info { flex: 1; min-width: 0; }
.bill-mini-title { font-size: 15px; font-weight: 600; color: #1f2937; }
.bill-mini-amount { text-align: right; flex-shrink: 0; }
.bill-mini-amt { font-size: 16px; font-weight: 700; color: #e5484d; }
.bill-mini-label { font-size: 11px; color: #9aa3b2; margin-top: 2px; }
.bill-mini-arrow { color: #9aa3b2; font-size: 24px; flex-shrink: 0; }
.bill-stats { display: flex; gap: 8px; padding: 12px 16px; background: #fff; border-bottom: 1px solid #f0f2f5; }
.bill-stat { flex: 1; text-align: center; }
.bill-stat-num { font-size: 15px; font-weight: 700; color: #1f2937; margin-top: 2px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin: 0 0 12px; background: #fff; border-top: 1px solid #f0f2f5; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.check-row input[type=checkbox] { width: 20px; height: 20px; flex-shrink: 0; accent-color: #15803d; }
.check-row span { font-size: 14px; color: #1f2937; line-height: 1.4; }
.check-row .hint { display: block; color: #9aa3b2; font-size: 11px; margin-top: 2px; }
.tpl-entry { display: block; width: calc(100% - 32px); margin: 16px; padding: 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; color: #15803d; font-size: 14px; font-weight: 500; text-align: center; cursor: pointer; }
.tpl-entry:active { background: #f7f8fa; }
.bill-actions { display: flex; gap: 8px; padding: 10px 16px; }
.bill-item { display: flex; align-items: center; padding: 12px 16px; border-top: 1px solid #f0f2f5; gap: 12px; }
.bill-item:first-child { border-top: none; }
.bill-check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #cfd8dc; display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff; flex-shrink: 0; cursor: pointer; background: #fff; }
.bill-check.paid { background: #15803d; border-color: #15803d; }
.bill-info { flex: 1; min-width: 0; cursor: pointer; }
.bill-name { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.bill-item.paid .bill-name { color: #9aa3b2; text-decoration: line-through; }
.bill-meta { font-size: 12px; color: #9aa3b2; margin-top: 2px; }
.bill-amount { font-size: 15px; font-weight: 600; color: #e5484d; flex-shrink: 0; }
.bill-item.paid .bill-amount { color: #9aa3b2; }
.bill-tag { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #eef7f0; color: #15803d; margin-left: 4px; vertical-align: middle; font-weight: 500; }
.bill-tag-muted { background: #f3f4f6; color: #9aa3b2; }
.bill-item.paid .bill-tag { opacity: 0.6; }
.tpl-tip { padding: 12px 16px 4px; color: #9aa3b2; font-size: 12px; line-height: 1.6; }
.tpl-item { display: flex; align-items: center; padding: 12px 16px; border-top: 1px solid #f0f2f5; gap: 12px; }
.tpl-item:first-child { border-top: none; }
.tpl-info { flex: 1; min-width: 0; }
.tpl-del { border: none; background: none; color: #e5484d; font-size: 13px; padding: 6px 8px; }
.trend-month { font-size: 11px; color: #98a0ad; margin-top: 6px; }
#feed { padding-bottom: 90px; }
.item { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid #f0f2f5; }
.item:last-child { border-bottom: none; }
.item-ico { width: 36px; height: 36px; border-radius: 10px; background: #e8f5ec; color: #15803d; font-size: 16px; display: flex; align-items: center; justify-content: center; flex: 0 0 36px; }
.item-main { flex: 1; min-width: 0; }
.item-cat { font-size: 15px; color: #1a1a1a; }
.item-note { font-size: 12px; color: #9aa3b2; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-date { font-size: 12px; color: #b8bfcc; }
.item-amt { font-size: 16px; font-weight: 600; color: #e5484d; }
.empty { text-align: center; color: #98a0ad; margin-top: 30px; margin-bottom: 12px; padding: 0 16px; font-size: 14px; }
#fab { position: fixed; right: 22px; bottom: calc(28px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: none; background: #15803d; color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 6px 16px rgba(21,128,61,.45); }
#editor-view { display: flex; flex-direction: column; min-height: 100vh; background: #fff; }
.amount-row { display: flex; align-items: center; padding: 24px 20px 12px; border-bottom: 1px solid #f0f2f5; }
.amount-row .cur { font-size: 30px; font-weight: 700; color: #1a1a1a; margin-right: 6px; }
.type-chips { display: flex; gap: 8px; padding: 10px 20px; }
.item-amt.refund { color: #15803d; }
#editor-amount { flex: 1; min-width: 0; border: none; outline: none; font-size: 34px; font-weight: 700; color: #1a1a1a; }
.calc-toggle { display: block; margin: 10px 20px 0; padding: 9px 14px; border: 1px solid #d5dae2; border-radius: 10px; background: #fff; color: #15803d; font-size: 14px; text-align: left; }
.calc-panel { margin: 10px 20px 0; padding: 12px; background: #f7f8fa; border-radius: 12px; }
.calc-display { background: #fff; border: 1px solid #e3e6eb; border-radius: 8px; padding: 10px 12px; font-size: 22px; font-weight: 600; text-align: right; margin-bottom: 8px; min-height: 44px; overflow: hidden; white-space: nowrap; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-keys button { padding: 12px 0; border: none; border-radius: 8px; background: #fff; font-size: 18px; color: #1a1a1a; }
.calc-keys .calc-op { color: #15803d; background: #e8f5ec; font-weight: 600; }
.calc-keys .calc-eq { background: #15803d; color: #fff; font-weight: 700; }
.calc-tip { font-size: 11px; color: #9aa3b2; margin-top: 8px; }
.cat-title { padding: 16px 20px 6px; font-size: 14px; color: #9aa3b2; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 20px 8px; }
.chip { padding: 8px 14px; border: 1px solid #d5dae2; border-radius: 999px; font-size: 14px; color: #555; background: #fff; }
.chip.active { border-color: #15803d; color: #15803d; background: #e8f5ec; font-weight: 600; }
.cat-new-btn { margin: 4px 20px 6px; padding: 8px 14px; border: 1px dashed #c3c9d4; border-radius: 999px; font-size: 14px; color: #777; background: #fff; }
#cat-add-row { display: flex; gap: 8px; padding: 6px 20px; }
#cat-add-row input { flex: 1; min-width: 0; width: auto; padding: 10px; border: 1px solid #d0d6e0; border-radius: 10px; font-size: 15px; outline: none; }
.field { padding: 14px 20px 0; }
.field label { display: block; font-size: 13px; color: #9aa3b2; margin-bottom: 6px; }
.field input { width: 100%; padding: 12px; border: 1px solid #d0d6e0; border-radius: 10px; font-size: 16px; outline: none; }
#editor-del { margin: 30px 20px calc(30px + env(safe-area-inset-bottom)); color: #e5484d; background: none; border: 1px solid #e5484d; border-radius: 10px; padding: 12px; width: calc(100% - 40px); font-size: 15px; }
@media (max-width: 380px) {
  .amount-row { padding: 20px 16px 10px; }
  #editor-amount { font-size: 30px; }
  .cat-chips { padding: 4px 16px 8px; }
  .cat-new-btn { margin: 4px 16px 6px; }
  #cat-add-row { padding: 6px 16px; }
  .cat-title { padding: 14px 16px 6px; }
  .field { padding: 12px 16px 0; }
  #editor-del { margin-left: 16px; margin-right: 16px; width: calc(100% - 32px); }
}