:root {
  --green: #4CAF50;
  --green-d: #388E3C;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --text: #1f2329;
  --muted: #8a8f99;
  --line: #eceef1;
  --pos: #2E9E5B;
  --neg: #E54848;
  --tr: #2F6FED;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  max-width: 560px; margin: 0 auto;
  padding-bottom: 64px; min-height: 100vh;
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; }
.sync-box { display: flex; align-items: center; gap: 8px; }
.sync-status { font-size: 12px; color: var(--muted); }
.sync-status.ok { color: var(--green-d); }
.sync-btn {
  border: none; background: var(--bg); color: var(--green-d);
  width: 30px; height: 30px; border-radius: 50%; font-size: 16px; cursor: pointer;
}
.sync-btn:active { background: #e3e6ea; }

.main { padding: 12px; }

.card {
  background: var(--card); border-radius: 14px; padding: 16px;
  margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 15px; }

.hero { text-align: center; background: linear-gradient(135deg, var(--green), #66BB6A); color: #fff; }
.hero-label { font-size: 13px; opacity: .9; }
.hero-amount { font-size: 32px; font-weight: 700; margin: 6px 0 12px; }
.add-btn { width: 100%; }

.acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acc-item { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.acc-name { font-size: 13px; color: var(--muted); }
.acc-bal { font-size: 17px; font-weight: 600; margin-top: 2px; }

.tx-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tx-row:last-child { border-bottom: none; }
.tx-title { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tx-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tx-right { display: flex; align-items: center; gap: 10px; }
.tx-amt { font-weight: 600; font-size: 15px; }
.tx-amt.pos { color: var(--pos); }
.tx-amt.neg { color: var(--neg); }
.tx-amt.tr { color: var(--tr); }
.tx-del { border: none; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--green); border-color: transparent; }

.btn {
  border: none; border-radius: 10px; padding: 11px 16px;
  font-size: 15px; background: var(--bg); color: var(--text); cursor: pointer; font-weight: 500;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-d); }

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
}
.nav-btn {
  flex: 1; border: none; background: none; padding: 12px 0;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.nav-btn.active { color: var(--green-d); font-weight: 600; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-mask[hidden] { display: none; }
.modal { width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; margin: 0; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px);
  background: #323232; color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--neg); }
