/* ===== 我的零花钱管家 · 蓝白海滩配色 ===== */

:root {
  --sea-deep: #0b6fa4;
  --sea: #149ad4;
  --sea-light: #5cc8ee;
  --sky: #e8f6fd;
  --sky-soft: #f4fbff;
  --foam: #ffffff;
  --ink: #12394d;
  --ink-soft: #5b7f92;
  --ink-faint: #93b0c0;
  --income: #0ea88e;
  --income-bg: #e4f8f4;
  --expense: #f4714f;
  --expense-bg: #fdeee9;
  --line: #dceef7;
  --shadow-sm: 0 4px 14px rgba(16, 92, 132, .07);
  --shadow-md: 0 10px 30px rgba(16, 92, 132, .10);
  --radius-lg: 24px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at 12% -8%, #d5f0fd 0%, rgba(213, 240, 253, 0) 62%),
    radial-gradient(900px 480px at 92% 6%, #e6f8ff 0%, rgba(230, 248, 255, 0) 58%),
    linear-gradient(180deg, #f2fbff 0%, #eaf7fe 42%, #e3f3fc 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 16px calc(30px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--sea-deep);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 15px;
  border-radius: 10px;
  background: var(--foam);
  box-shadow: var(--shadow-sm);
}

.today {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

/* ---------- 余额卡 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 22px 22px 38px;
  border-radius: var(--radius-lg);
  color: #fff;
  background: linear-gradient(150deg, #0a6ba1 0%, #1289c4 46%, #2bb4e0 100%);
  box-shadow: 0 16px 34px rgba(15, 118, 170, .28);
  isolation: isolate;
}

.hero-glow {
  position: absolute;
  top: -64px;
  right: -48px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 68%);
  z-index: -1;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .38);
  background: rgba(255, 255, 255, .10);
  z-index: -1;
}

.b1 { width: 58px; height: 58px; top: 26px; right: 30px; }
.b2 { width: 26px; height: 26px; top: 88px; right: 84px; }
.b3 { width: 14px; height: 14px; top: 18px; right: 112px; }

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-label {
  font-size: 13px;
  letter-spacing: .6px;
  color: rgba(255, 255, 255, .88);
}

.hero-tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .26);
}

.hero-amount {
  margin: 8px 0 18px;
  font-size: 42px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 16px rgba(4, 62, 96, .28);
  word-break: break-all;
}

.hero-amount.is-down { color: #ffe0d6; }

.hero-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .20);
  backdrop-filter: blur(4px);
}

.stat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-name {
  font-size: 11px;
  color: rgba(255, 255, 255, .82);
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-divider {
  width: 1px;
  align-self: stretch;
  background: rgba(255, 255, 255, .26);
}

.hero-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  width: 100%;
  height: 46px;
  display: block;
}

/* ---------- 通用卡片 ---------- */
.card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--foam);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(216, 238, 249, .9);
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

/* ---------- 记账区 ---------- */
.field {
  margin-top: 14px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.amount-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.currency {
  position: absolute;
  left: 16px;
  font-size: 20px;
  font-weight: 700;
  color: var(--sea);
  pointer-events: none;
}

.amount-input,
.note-input {
  width: 100%;
  font-family: inherit;
  color: var(--ink);
  background: var(--sky-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color .16s, box-shadow .16s, background .16s;
}

.amount-input {
  padding: 14px 16px 14px 40px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .4px;
  font-variant-numeric: tabular-nums;
}

.note-input {
  padding: 13px 16px;
  font-size: 15px;
}

.amount-input::placeholder,
.note-input::placeholder {
  color: var(--ink-faint);
  font-weight: 400;
}

.amount-input:focus,
.note-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--sea-light);
  box-shadow: 0 0 0 4px rgba(92, 200, 238, .20);
}

.form-error {
  margin: 10px 2px 0;
  font-size: 12.5px;
  color: var(--expense);
  font-weight: 600;
}

.form-error::before {
  content: "· ";
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 14px 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform .12s, box-shadow .16s, filter .16s;
  -webkit-tap-highlight-color: transparent;
}

.btn-sign {
  font-size: 17px;
  line-height: 1;
}

.btn-income {
  background: linear-gradient(140deg, #17c3a2 0%, #0ea88e 100%);
  box-shadow: 0 8px 18px rgba(14, 168, 142, .26);
}

.btn-expense {
  background: linear-gradient(140deg, #ff8a63 0%, #f4714f 100%);
  box-shadow: 0 8px 18px rgba(244, 113, 79, .26);
}

.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible {
  outline: 3px solid rgba(92, 200, 238, .55);
  outline-offset: 2px;
}

/* ---------- 流水区 ---------- */
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.list-count {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sky);
}

.filters {
  display: flex;
  gap: 8px;
  margin: 14px 0 4px;
}

.filter {
  padding: 7px 15px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--sky-soft);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .16s;
}

.filter:hover { border-color: var(--sea-light); color: var(--sea-deep); }

.filter.is-active {
  color: #fff;
  background: linear-gradient(140deg, #1690c9, #0f7cb4);
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(15, 124, 180, .24);
}

.bill-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 2px;
  border-bottom: 1px dashed var(--line);
  animation: slideIn .26s ease both;
}

.bill:last-child { border-bottom: none; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.bill-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 12px;
}

.bill.is-income .bill-icon {
  color: var(--income);
  background: var(--income-bg);
}

.bill.is-expense .bill-icon {
  color: var(--expense);
  background: var(--expense-bg);
}

.bill-body {
  flex: 1;
  min-width: 0;
}

.bill-note {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bill-meta {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.bill-amount {
  flex: none;
  font-size: 16.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bill.is-income .bill-amount { color: var(--income); }
.bill.is-expense .bill-amount { color: var(--expense); }

.bill-del {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  color: var(--ink-faint);
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: all .16s;
  -webkit-tap-highlight-color: transparent;
}

.bill-del:hover {
  color: var(--expense);
  background: var(--expense-bg);
}

/* ---------- 空状态 ---------- */
.empty {
  padding: 26px 10px 16px;
  text-align: center;
}

.empty-icon {
  font-size: 34px;
  opacity: .55;
  margin-bottom: 8px;
}

.empty-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

.empty-sub {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ---------- 页脚提示 ---------- */
.tip {
  margin: 0 6px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-faint);
  text-align: center;
}

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translate(-50%, 18px);
  max-width: min(88vw, 340px);
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(18, 57, 77, .93);
  border-radius: 999px;
  box-shadow: 0 12px 26px rgba(9, 46, 66, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 60;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 手机适配 ---------- */
@media (max-width: 400px) {
  .app { padding: 14px 12px calc(26px + env(safe-area-inset-bottom)); gap: 14px; }
  .hero { padding: 18px 18px 34px; }
  .hero-amount { font-size: 34px; }
  .card { padding: 17px; border-radius: 20px; }
  .btn { font-size: 15px; padding: 13px 10px; }
  .bill-note { font-size: 14px; }
  .hero-tag { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
