﻿:root {
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #14211f;
  --muted: #6b7b78;
  --accent: #0f766e;
  --accent-strong: #0b5c55;
  --accent-soft: #e3f2ef;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
  --line: #e4e9e7;
  --shadow: 0 10px 30px rgba(20, 33, 31, 0.08);
  --radius: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1514;
    --card: #18211f;
    --text: #e8efed;
    --muted: #93a4a0;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #133330;
    --danger: #f87171;
    --danger-soft: #3a1d1d;
    --line: #263230;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
}

@media (min-width: 700px) {
  body { padding: 24px 0 48px; }
  #app {
    min-height: calc(100dvh - 72px);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
}

.screen { padding: 0 18px calc(110px + env(safe-area-inset-bottom)); }
.screen-center {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 22px calc(32px + env(safe-area-inset-bottom));
}

.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.hidden, [hidden] { display: none !important; }

/* ---------- 登录 / 设置 ---------- */

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}

.logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto 14px;
}

.logo-sm {
  width: 38px;
  height: 38px;
  font-size: 20px;
  border-radius: 12px;
  margin: 0;
}

.auth-title {
  margin: 0 0 8px;
  font-size: 20px;
  text-align: center;
}

.auth-hint {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.form { display: flex; flex-direction: column; gap: 14px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  appearance: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.err {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  white-space: pre-wrap;
}

.btn {
  height: 50px;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.btn:active { transform: scale(0.985); }

.btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}

.btn-primary:disabled { opacity: 0.6; }

.btn-danger {
  color: #fff;
  background: var(--danger);
  border-color: transparent;
}

.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }

/* ---------- 主界面 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 2px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand-mini { display: flex; align-items: center; gap: 10px; }
.brand-mini h1 { margin: 0; font-size: 18px; line-height: 1.2; }

.month-total {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.topbar-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.icon-btn:active { background: var(--line); }

.banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 12px;
}

.list { display: flex; flex-direction: column; gap: 16px; }

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 6px;
  font-size: 13px;
  color: var(--muted);
}

.day-title { font-weight: 600; color: var(--text); }

.day-list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  min-height: 62px;
  cursor: pointer;
}

.row:active { background: var(--hover, rgba(15, 118, 110, 0.06)); }

.row + .row { border-top: 1px solid var(--line); }

.row-main { flex: 1; min-width: 0; }

.purpose {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta { margin-top: 2px; font-size: 12px; color: var(--muted); }

.row-right { display: flex; align-items: center; gap: 2px; }

.amount {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-del {
  width: 40px;
  height: 40px;
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.row-del:active { background: var(--danger-soft); color: var(--danger); }

.empty { padding: 56px 20px; text-align: center; }
.empty-title { margin: 0 0 6px; font-size: 17px; font-weight: 600; }

.fab {
  position: fixed;
  right: 20px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 20;
  height: 54px;
  padding: 0 22px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 27px;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.35);
  cursor: pointer;
}

.fab:active { transform: scale(0.97); }

@media (min-width: 700px) {
  .fab {
    right: calc(50vw - 300px + 24px);
    bottom: calc(40px + env(safe-area-inset-bottom));
  }
}

.fab[disabled] { opacity: 0.5; box-shadow: none; }

/* ---------- 底部弹层 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(8, 16, 14, 0.4);
  animation: fade-in 0.18s ease-out;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 31;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  transform: translateX(-50%);
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--card);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
  animation: slide-up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.sheet-narrow { max-width: 440px; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sheet-head h2 { margin: 0; font-size: 18px; }

.amount-field .amount-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.amount-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.amount-box .yuan { font-size: 22px; color: var(--muted); }

.amount-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
  appearance: none;
}

.confirm-text { margin: 0 0 18px; color: var(--muted); }

.menu-item {
  display: block;
  width: 100%;
  height: 52px;
  margin-bottom: 8px;
  padding: 0 16px;
  font-size: 16px;
  text-align: left;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.menu-danger { color: var(--danger); }
.menu-tip { margin: 10px 2px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 40;
  transform: translateX(-50%);
  max-width: 80vw;
  padding: 10px 18px;
  font-size: 14px;
  color: #fff;
  background: rgba(17, 24, 22, 0.9);
  border-radius: 999px;
  animation: fade-in 0.18s ease-out;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up {
  from { transform: translateX(-50%) translateY(24px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .overlay, .sheet, .toast { animation: none; }
}

