/* ==========================================================
   轻账 · 样式表
   目录：变量 → 基础 → 通用组件 → 登录 → 主框架 → 首页 →
        列表 → 分析 → 我的 → 导航 → 弹层 → 反馈 → 响应式
   ========================================================== */

/* ==========================================================
   1. 变量 / 基础
   ========================================================== */

:root {
  /* 主题色 */
  --c-cream: #FEF3C7;
  --c-mint: #D1FAE5;
  --c-sky: #DBEAFE;
  --c-pink: #FCE7F3;

  --ink: #4B5563;
  --ink-soft: #6B7280;
  --muted: #8A94A3;
  --muted-2: #ADB6C2;
  --line: rgba(75, 85, 99, 0.08);

  --bg: #FBF6EA;
  --bg-2: #F5F0E5;
  --white: #FFFFFF;
  --danger: #E5484D;
  --success: #2BB78C;
  --qq: #12B7F5;

  --grad: linear-gradient(135deg, #4B5563 0%, #6B7280 100%);
  --pastel: linear-gradient(135deg, #FCE7F3 0%, #DBEAFE 55%, #D1FAE5 100%);
  --grad-soft: linear-gradient(135deg, rgba(252, 231, 243, 0.55) 0%, rgba(219, 234, 254, 0.55) 55%, rgba(209, 250, 229, 0.55) 100%);

  --shadow-card: 0 10px 30px -14px rgba(75, 85, 99, 0.18), 0 2px 8px -2px rgba(75, 85, 99, 0.07);
  --shadow-float: 0 14px 28px -10px rgba(75, 85, 99, 0.85);

  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;

  --app-w: 460px;
  --tabbar-h: 68px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.32s;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #F0EBDD;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(55vw 55vw at 10% 6%, rgba(252, 231, 243, 0.55), transparent 60%),
    radial-gradient(50vw 50vw at 90% 8%, rgba(219, 234, 254, 0.6), transparent 60%),
    radial-gradient(55vw 55vw at 92% 92%, rgba(209, 250, 229, 0.55), transparent 60%),
    radial-gradient(50vw 50vw at 8% 94%, rgba(254, 243, 199, 0.6), transparent 60%),
    linear-gradient(160deg, #FBF6EA 0%, #F4EDDF 100%);
  z-index: -2;
}

button {
  font-family: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}

input,
button,
textarea {
  font-family: inherit;
}

input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  min-width: 0;
}

input::placeholder {
  color: var(--muted-2);
}

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

.hidden {
  display: none !important;
}

:focus-visible {
  outline: 2px solid rgba(75, 85, 99, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

/* 数字等宽，避免滚动时抖动 */
.sc-value,
.ai-score b,
.wc-temp,
.tx-amount,
.donut-center b,
.stat-row b,
.sc-balance b,
.day-total b,
.bar-label {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================
   2. 通用组件
   ========================================================== */

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.loading-bar i {
  display: block;
  height: 100%;
  width: 40%;
  background: var(--grad);
  border-radius: 2px;
  transform: translateX(-100%);
  animation: loadingSlide 1.1s ease-in-out infinite;
}

.loading-bar.show {
  opacity: 1;
}

@keyframes loadingSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.btn-primary {
  width: 100%;
  height: 52px;
  border-radius: 16px;
  background: var(--grad);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 3px;
  box-shadow: 0 14px 26px -12px rgba(75, 85, 99, 0.9);
  transition: transform 0.18s var(--ease), box-shadow 0.25s, opacity 0.2s, filter 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.28) 45%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.55s var(--ease);
}

.btn-primary:hover::after {
  transform: translateX(120%);
}

.btn-primary:active {
  transform: scale(0.975);
  box-shadow: 0 6px 16px -8px rgba(75, 85, 99, 0.8);
}

.btn-primary:disabled {
  opacity: 0.62;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  width: 100%;
  height: 48px;
  border-radius: 15px;
  background: rgba(75, 85, 99, 0.08);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid rgba(75, 85, 99, 0.16);
  transition: background 0.2s, transform 0.16s var(--ease);
}

.btn-ghost:active {
  transform: scale(0.98);
  background: rgba(75, 85, 99, 0.13);
}

.btn-outline {
  width: 100%;
  height: 50px;
  margin-top: 16px;
  border-radius: 16px;
  background: var(--white);
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-card);
  transition: background 0.2s, transform 0.16s var(--ease);
}

.btn-outline svg {
  width: 17px;
  height: 17px;
}

.btn-outline:active {
  background: #FFF6F6;
  transform: scale(0.99);
}

.mini-btn {
  font-size: 11.5px;
  color: var(--ink);
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 9px;
  background: rgba(75, 85, 99, 0.08);
  white-space: nowrap;
  transition: background 0.2s, transform 0.14s var(--ease), opacity 0.2s;
  flex-shrink: 0;
}

.mini-btn:active {
  transform: scale(0.94);
  background: rgba(75, 85, 99, 0.15);
}

.mini-btn.danger {
  color: var(--danger);
  background: rgba(229, 72, 77, 0.08);
}

.mini-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.55);
  display: grid;
  place-items: center;
  color: var(--ink);
  z-index: 2;
  flex-shrink: 0;
  transition: transform 0.16s var(--ease), background 0.2s;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:active {
  transform: scale(0.92);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted-2);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.empty {
  text-align: center;
  padding: 34px 20px;
  color: var(--muted-2);
}

.empty svg {
  width: 46px;
  height: 46px;
  opacity: 0.5;
  margin: 0 auto 10px;
}

.empty p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.empty span {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  opacity: 0.85;
  line-height: 1.6;
  word-break: break-word;
}

/* 骨架屏 */
.sk {
  background: linear-gradient(90deg, #F1ECE1 25%, #F8F4EC 37%, #F1ECE1 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.sk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
}

.sk-ico {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  flex-shrink: 0;
}

.sk-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.sk-line {
  height: 10px;
}

.sk-line.w60 { width: 60%; }
.sk-line.w30 { width: 30%; height: 8px; }
.sk-amount { width: 54px; height: 14px; flex-shrink: 0; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + 18px);
  transform: translate(-50%, -16px);
  padding: 11px 18px;
  border-radius: 14px;
  background: rgba(75, 85, 99, 0.93);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.26s, transform 0.26s var(--ease);
  z-index: 400;
  max-width: min(86vw, 420px);
  text-align: center;
  word-break: break-word;
}

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

.toast.error { background: rgba(190, 40, 46, 0.95); }
.toast.success { background: rgba(24, 138, 103, 0.95); }

/* ==========================================================
   3. 登录 / 注册
   ========================================================== */

.auth {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(var(--safe-top) + 28px) 20px calc(var(--safe-bottom) + 24px);
  background: linear-gradient(165deg, #FEF3C7 0%, #FCE7F3 34%, #DBEAFE 68%, #D1FAE5 100%);
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.55;
  pointer-events: none;
}

.orb-a {
  width: 340px;
  height: 340px;
  background: rgba(255, 255, 255, 0.6);
  top: -120px;
  left: -100px;
  animation: floatOrb 16s ease-in-out infinite;
}

.orb-b {
  width: 300px;
  height: 300px;
  background: rgba(252, 231, 243, 0.95);
  bottom: -110px;
  right: -90px;
  animation: floatOrb 20s ease-in-out infinite reverse;
}

@keyframes floatOrb {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(24px, 26px, 0) scale(1.08); }
}

.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 372px;
  padding: 30px 26px 24px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 26px 60px -20px rgba(75, 85, 99, 0.45);
  animation: cardIn 0.62s var(--ease) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
}

.brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: var(--grad);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px -8px rgba(75, 85, 99, 0.7);
  flex-shrink: 0;
}

.brand-logo svg {
  width: 27px;
  height: 27px;
}

.brand-text h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: 2px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px 0 16px;
  border-radius: 15px;
  background: var(--bg);
  margin-bottom: 12px;
  transition: box-shadow 0.25s, background 0.25s, border-color 0.25s;
  border: 1.5px solid transparent;
}

.field:focus-within {
  background: #fff;
  border-color: rgba(75, 85, 99, 0.5);
  box-shadow: 0 0 0 4px rgba(75, 85, 99, 0.09);
}

.field-icon {
  display: inline-flex;
  color: var(--muted-2);
  flex-shrink: 0;
}

.field-icon svg {
  width: 19px;
  height: 19px;
}

.field input {
  flex: 1;
  font-size: 15px;
  width: 100%;
}

.field-action {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.field-action:active {
  color: var(--ink);
}

.form-error {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--danger);
  min-height: 16px;
  padding-left: 4px;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.22s, transform 0.22s var(--ease);
}

.form-error.show {
  opacity: 1;
  transform: none;
}

.btn-qq {
  width: 100%;
  height: 48px;
  border-radius: 15px;
  background: var(--qq);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 12px 24px -14px rgba(18, 183, 245, 0.95);
  transition: transform 0.16s var(--ease), box-shadow 0.25s, filter 0.2s, opacity 0.2s;
}

.btn-qq .qq-ico {
  display: inline-flex;
}

.btn-qq svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.6;
}

.btn-qq:active {
  transform: scale(0.98);
  box-shadow: 0 6px 14px -8px rgba(18, 183, 245, 0.9);
}

.btn-qq.is-disabled {
  opacity: 0.55;
  background: #94A3B8;
  box-shadow: none;
}

.btn-qq:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-switch {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch button {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(75, 85, 99, 0.3);
}

.auth-foot {
  position: relative;
  z-index: 2;
  margin: 20px 0 0;
  font-size: 11.5px;
  color: rgba(75, 85, 99, 0.65);
  letter-spacing: 0.5px;
}

/* ==========================================================
   4. 主框架
   ========================================================== */

.main {
  position: relative;
  width: 100%;
  max-width: var(--app-w);
  height: 100dvh;
  margin: 0 auto;
  background:
    radial-gradient(120% 55% at 0% 0%, rgba(254, 243, 199, 0.65), transparent 55%),
    radial-gradient(120% 60% at 100% 0%, rgba(219, 234, 254, 0.65), transparent 55%),
    radial-gradient(120% 60% at 100% 100%, rgba(209, 250, 229, 0.6), transparent 55%),
    radial-gradient(120% 60% at 0% 100%, rgba(252, 231, 243, 0.6), transparent 55%),
    var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(75, 85, 99, 0.12);
}

.views {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(var(--safe-top) + 0px) 18px calc(var(--tabbar-h) + 104px);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.views::-webkit-scrollbar {
  width: 0;
}

body.sheet-open .views {
  overflow: hidden;
}

.view.anim {
  animation: viewIn 0.34s var(--ease);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 主页头部 ---------- */

.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 26px 2px 16px;
}

.home-head-text {
  min-width: 0;
}

.greet {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: var(--grad);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px -8px rgba(75, 85, 99, 0.9);
  flex-shrink: 0;
  transition: transform 0.18s var(--ease);
  overflow: hidden;
  padding: 0;
}

.avatar:active {
  transform: scale(0.94);
}

.avatar.has-img {
  background: #E7E2D6;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================
   5. 首页 · 天气
   ========================================================== */

.weather-card {
  position: relative;
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  background: var(--pastel);
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 16px 34px -20px rgba(75, 85, 99, 0.5);
  contain: paint;
}

.weather-card::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  top: -80px;
  right: -50px;
  pointer-events: none;
}

.weather-card::after {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  bottom: -70px;
  right: 42px;
  pointer-events: none;
}

.wc-main {
  position: relative;
  z-index: 2;
  min-width: 0;
  padding-right: 78px;
}

.wc-city {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  font-size: 12.5px;
  font-weight: 600;
  color: inherit;
  padding: 5px 9px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, transform 0.16s var(--ease);
}

.wc-city:active {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(0.97);
}

.wc-city #wcCity {
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wc-pin svg {
  width: 13px;
  height: 13px;
  display: block;
}

.wc-caret {
  display: inline-flex;
  transform: rotate(90deg);
  opacity: 0.7;
}

.wc-caret svg {
  width: 12px;
  height: 12px;
}

.wc-temp {
  display: flex;
  align-items: flex-start;
  margin-top: 6px;
  font-size: clamp(34px, 11vw, 46px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -2px;
}

.wc-temp i {
  font-style: normal;
  font-size: 0.48em;
  font-weight: 300;
  margin-top: 0.16em;
  margin-left: 1px;
  opacity: 0.9;
}

.wc-desc {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.4px;
  min-height: 20px;
}

.wc-meta {
  margin-top: 5px;
  font-size: 11.5px;
  opacity: 0.82;
  letter-spacing: 0.2px;
  line-height: 1.5;
}

.wc-art {
  position: absolute;
  right: 12px;
  top: 42px;
  width: 84px;
  height: 84px;
  z-index: 1;
  color: var(--ink);
  animation: floaty 6s ease-in-out infinite;
  pointer-events: none;
}

.wc-art svg {
  width: 100%;
  height: 100%;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.wc-forecast {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(75, 85, 99, 0.14);
}

.wc-forecast:empty {
  display: none;
}

.wc-fd {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11.5px;
  opacity: 0.94;
  white-space: nowrap;
}

.wc-fd-ico {
  width: 17px;
  height: 17px;
  display: inline-flex;
  flex-shrink: 0;
}

.wc-fd-ico svg {
  width: 100%;
  height: 100%;
}

.wc-fd-name {
  color: rgba(75, 85, 99, 0.75);
}

.wc-fd b {
  font-weight: 600;
}

.wc-notice {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  font-size: 11.5px;
  line-height: 1.55;
  color: rgba(75, 85, 99, 0.85);
  animation: aiIn 0.3s var(--ease) both;
}

.wc-notice-ico {
  display: inline-flex;
  flex-shrink: 0;
  margin-top: 1px;
  color: #C2853A;
}

.wc-notice-ico svg {
  width: 13px;
  height: 13px;
}

.wc-notice p {
  flex: 1;
  margin: 0;
  min-width: 0;
}

.wc-notice-btn {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px -3px rgba(75, 85, 99, 0.4);
}

/* ---------- 本月收支 ---------- */

.summary-card {
  position: relative;
  margin-top: -20px;
  margin-left: 12px;
  margin-right: 12px;
  padding: 15px 16px 12px;
  border-radius: 22px;
  background: var(--white);
  box-shadow: var(--shadow-card);
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.sc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
}

.sc-title {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.sc-month {
  font-size: 11.5px;
  color: var(--ink);
  background: rgba(75, 85, 99, 0.08);
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}

.sc-grid {
  display: flex;
  align-items: center;
}

.sc-item {
  flex: 1;
  min-width: 0;
}

.sc-divider {
  width: 1px;
  height: 34px;
  background: var(--line);
  margin: 0 14px;
  flex-shrink: 0;
}

.sc-label {
  margin: 0 0 5px;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-income { background: var(--success); }
.dot-expense { background: var(--ink); }

.sc-value {
  margin: 0;
  font-size: clamp(17px, 5.2vw, 21px);
  font-weight: 700;
  letter-spacing: -0.6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v-income { color: var(--success); }
.v-expense { color: var(--ink); }

.sc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
}

.sc-balance b {
  color: var(--ink);
  font-weight: 600;
}

.sc-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--grad-soft);
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- 区块 / 交易列表 ---------- */

.block {
  margin-top: 20px;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.block-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 4px 0 4px 6px;
  transition: color 0.2s;
}

.link svg {
  width: 15px;
  height: 15px;
}

.link:active {
  color: var(--ink);
}

.tx-list {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 6px 8px;
  box-shadow: var(--shadow-card);
}

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 8px;
  border-radius: 15px;
  transition: background 0.2s;
  animation: itemIn 0.38s var(--ease) both;
}

.tx-item + .tx-item {
  box-shadow: inset 0 1px 0 var(--line);
}

.tx-item:active {
  background: var(--bg-2);
}

@keyframes itemIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.tx-ico {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--bg);
}

.tx-ico svg {
  width: 20px;
  height: 20px;
}

.tx-mid {
  flex: 1;
  min-width: 0;
}

.tx-name {
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 3px;
}

.tx-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-amount {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tx-amount.income { color: var(--success); }
.tx-amount.expense { color: var(--ink); }

.tx-del {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #C3CCD6;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s, transform 0.14s var(--ease);
}

.tx-del svg {
  width: 14px;
  height: 14px;
}

.tx-del:active {
  color: var(--danger);
  background: rgba(229, 72, 77, 0.1);
  transform: scale(0.9);
}

/* ==========================================================
   6. 页面通用头部 / 列表页
   ========================================================== */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 26px 2px 14px;
}

.page-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.month-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--white);
  border-radius: 12px;
  padding: 3px;
  box-shadow: 0 4px 12px -6px rgba(75, 85, 99, 0.2);
  flex-shrink: 0;
}

.ms-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
  transition: background 0.18s, transform 0.14s var(--ease);
}

.ms-btn svg {
  width: 15px;
  height: 15px;
}

.ms-btn:active {
  background: var(--bg);
  transform: scale(0.92);
}

.ms-label {
  font-size: 12.5px;
  font-weight: 600;
  min-width: 72px;
  text-align: center;
  white-space: nowrap;
}

.seg {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 4px 12px -6px rgba(75, 85, 99, 0.2);
  flex-shrink: 0;
}

.seg button {
  position: relative;
  z-index: 2;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 9px;
  transition: color 0.25s;
  white-space: nowrap;
}

.seg button.active {
  color: #fff;
  font-weight: 600;
}

.seg-pill {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  border-radius: 9px;
  background: var(--grad);
  z-index: 1;
  transition: transform 0.34s var(--ease), width 0.34s var(--ease);
  box-shadow: 0 4px 12px -4px rgba(75, 85, 99, 0.8);
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  margin-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  background: var(--white);
  color: var(--muted);
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.22s, color 0.22s, transform 0.16s var(--ease), box-shadow 0.22s;
}

.chip:active {
  transform: scale(0.95);
}

.chip.active {
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px -7px rgba(75, 85, 99, 0.9);
}

.day-groups {
  margin-top: 8px;
}

.day-group {
  margin-bottom: 14px;
  animation: itemIn 0.34s var(--ease) both;
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px;
  margin-bottom: 7px;
}

.day-date {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.day-date em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted-2);
  margin-left: 6px;
  font-weight: 400;
}

.day-total {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.day-total b {
  color: var(--ink);
  font-weight: 600;
}

/* ==========================================================
   7. 分析页
   ========================================================== */

.ai-card {
  position: relative;
  border-radius: var(--r-lg);
  padding: 16px 16px 12px;
  background: var(--white);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  border: 1px solid rgba(75, 85, 99, 0.12);
}

.ai-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 183, 140, 0.2), transparent 68%);
  top: -130px;
  right: -70px;
  pointer-events: none;
}

.ai-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.ai-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

.ai-icon {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--grad);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px -7px rgba(75, 85, 99, 0.9);
  flex-shrink: 0;
}

.ai-icon svg {
  width: 15px;
  height: 15px;
}

.ai-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  flex-shrink: 0;
}

.ai-score b {
  font-size: 22px;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ai-score small {
  font-size: 10px;
  color: var(--muted-2);
  margin-top: 3px;
  letter-spacing: 0.5px;
}

.ai-headline {
  position: relative;
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: -0.1px;
  color: var(--ink);
}

.ai-sections {
  position: relative;
}

.ai-sec {
  padding: 11px 0;
  border-top: 1px solid var(--line);
  animation: aiIn 0.45s var(--ease) both;
}

@keyframes aiIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}

.ai-sec-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.ai-sec-title svg {
  width: 13px;
  height: 13px;
}

.ai-sec-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.78;
  color: var(--ink-soft);
  letter-spacing: 0.1px;
  word-break: break-word;
}

.ai-tips {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 4px;
}

.ai-tip {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 11px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.6;
  background: rgba(75, 85, 99, 0.06);
  color: var(--ink);
  animation: aiIn 0.45s var(--ease) both;
  word-break: break-word;
}

.ai-tip.warn {
  background: rgba(255, 138, 61, 0.1);
  color: #A5541C;
}

.ai-tip.good {
  background: rgba(34, 192, 138, 0.1);
  color: #157353;
}

.ai-tip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-more {
  position: relative;
  width: 100%;
  margin-top: 9px;
  padding: 9px 0;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(75, 85, 99, 0.055);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.2s;
}

.ai-more:active {
  background: rgba(75, 85, 99, 0.11);
}

.ai-more .chev {
  font-size: 10px;
  transition: transform 0.3s var(--ease);
  display: inline-block;
}

.ai-more .chev.up {
  transform: rotate(180deg);
}

.ai-card.compact .ai-sec:nth-of-type(n + 4),
.ai-card.compact .ai-tip:nth-of-type(n + 3) {
  display: none;
}

.ai-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ai-stamp {
  font-size: 10.5px;
  color: var(--muted-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-refresh {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 9px;
  background: rgba(75, 85, 99, 0.08);
  flex-shrink: 0;
  transition: background 0.2s;
}

.ai-refresh svg {
  width: 13px;
  height: 13px;
}

.ai-refresh:active {
  background: rgba(75, 85, 99, 0.16);
}

.ai-refresh.spin svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.thinking {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 16px 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.thinking i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
  animation: blink 1.3s infinite;
}

.thinking i:nth-child(2) { animation-delay: 0.18s; }
.thinking i:nth-child(3) { animation-delay: 0.36s; }

@keyframes blink {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- 图表 ---------- */

.card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-card);
  margin-top: 12px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.card-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  text-align: right;
  min-width: 0;
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.donut {
  position: relative;
  width: 128px;
  height: 128px;
  flex-shrink: 0;
}

.donut svg {
  transform: rotate(-90deg);
  display: block;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 0 22px;
}

.donut-center b {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.4px;
  white-space: nowrap;
}

.donut-center span {
  font-size: 10px;
  color: var(--muted-2);
  margin-top: 2px;
  white-space: nowrap;
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.lg {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  min-width: 0;
}

.lg i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex-shrink: 0;
}

.lg span {
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lg b {
  font-weight: 600;
  flex-shrink: 0;
}

.lg-empty {
  color: var(--muted-2);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: clamp(92px, 24vw, 112px);
  padding-top: 8px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}

.bar-track {
  width: 62%;
  max-width: 30px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  border-radius: 6px;
  background: rgba(75, 85, 99, 0.05);
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(180deg, #2BB78C 0%, #4B5563 100%);
  min-height: 3px;
  transform-origin: bottom;
  animation: barGrow 0.65s var(--ease) both;
}

@keyframes barGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.bar-label {
  font-size: 9.5px;
  color: var(--muted-2);
  white-space: nowrap;
}

/* ==========================================================
   8. 我的
   ========================================================== */

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: var(--r-lg);
  background: var(--pastel);
  color: var(--ink);
  box-shadow: 0 16px 34px -20px rgba(75, 85, 99, 0.5);
  position: relative;
  overflow: hidden;
}

.profile-card::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  right: -60px;
  top: -80px;
  pointer-events: none;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.55);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 2;
}

.profile-info p {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-info span {
  font-size: 11.5px;
  opacity: 0.75;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-row {
  display: flex;
  margin-top: 12px;
  padding: 15px 6px;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.stat-row > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  min-width: 0;
}

.stat-row > div + div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 22px;
  background: var(--line);
}

.stat-row b {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

.stat-row span {
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
}

.streak {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.streak-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.streak-dot {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  background: var(--bg);
  display: grid;
  place-items: center;
  color: var(--muted-2);
  transition: background 0.3s var(--ease), color 0.3s, transform 0.3s var(--ease);
}

.streak-dot.on {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 7px 14px -7px rgba(75, 85, 99, 0.95);
}

.streak-day span {
  font-size: 10px;
  color: var(--muted-2);
  white-space: nowrap;
}

.streak-day.today span {
  color: var(--ink);
  font-weight: 600;
}

.settings {
  padding: 2px 14px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.setting-row:last-child {
  border-bottom: none;
}

.sr-icon {
  display: inline-flex;
  color: var(--ink);
  flex-shrink: 0;
}

.sr-icon svg {
  width: 17px;
  height: 17px;
}

.setting-row label {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setting-row input[type="text"],
.setting-row input:not([type]) {
  width: 92px;
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}

.setting-value {
  font-style: normal;
  font-size: 12px;
  color: var(--muted-2);
  max-width: 40%;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 20px;
  background: #D8DCE2;
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.26s var(--ease);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.switch:checked {
  background: var(--ink);
}

.switch:checked::after {
  transform: translateX(18px);
}

.version-foot {
  text-align: center;
  font-size: 11px;
  color: var(--muted-2);
  margin: 20px 0 0;
  letter-spacing: 0.4px;
}

/* ==========================================================
   9. FAB / 底部导航
   ========================================================== */

.fab {
  position: absolute;
  right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px);
  height: 48px;
  padding: 0 18px 0 15px;
  border-radius: 24px;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-float);
  z-index: 40;
  transition: transform 0.22s var(--ease), box-shadow 0.25s, opacity 0.25s;
}

.fab.fab-hide {
  opacity: 0;
  transform: translateY(16px) scale(0.88);
  pointer-events: none;
}

.fab svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.4;
}

.fab em {
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.fab:active {
  transform: scale(0.94);
  box-shadow: 0 6px 16px -8px rgba(75, 85, 99, 0.9);
}

.fab::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 30px;
  border: 1.5px solid rgba(75, 85, 99, 0.22);
  animation: pulseRing 3s ease-out infinite;
  pointer-events: none;
}

@keyframes pulseRing {
  0% { transform: scale(0.92); opacity: 0.7; }
  70%, 100% { transform: scale(1.12); opacity: 0; }
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid rgba(75, 85, 99, 0.055);
  z-index: 50;
}

.tab {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted-2);
  transition: color 0.22s;
  position: relative;
  min-width: 0;
}

.tab-ico {
  display: flex;
  transition: transform 0.3s var(--ease);
}

.tab-ico svg {
  width: 22px;
  height: 22px;
}

.tab-txt {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.tab.active {
  color: var(--ink);
}

.tab.active .tab-ico {
  transform: translateY(-1px) scale(1.06);
}

.tab.active .tab-ico svg {
  stroke-width: 2.2;
}

.tab.active .tab-txt {
  font-weight: 600;
}

.tab.active::after {
  content: "";
  position: absolute;
  top: 0;
  width: 18px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--grad);
  animation: tabBarIn 0.28s var(--ease) both;
}

@keyframes tabBarIn {
  from { transform: scaleX(0.2); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}

/* ==========================================================
   10. 弹层（记一笔 / 城市）
   ========================================================== */

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(75, 85, 99, 0.38);
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
  z-index: 90;
}

.sheet-mask.show {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  width: 100%;
  max-width: var(--app-w);
  background: var(--white);
  border-radius: 28px 28px 0 0;
  padding: 8px 18px 0;
  transform: translateY(102%);
  transition: transform 0.4s var(--ease);
  box-shadow: 0 -18px 50px -18px rgba(75, 85, 99, 0.28);
  z-index: 100;
  max-height: min(92dvh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sheet.show {
  transform: translateY(0);
}

.sheet::-webkit-scrollbar {
  width: 0;
}

.sheet-handle {
  width: 38px;
  height: 4.5px;
  border-radius: 4px;
  background: #E5E1D8;
  margin: 2px auto 12px;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sheet-title,
.city-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--ink);
  white-space: nowrap;
}

.type-switch {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border-radius: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.type-switch button {
  position: relative;
  z-index: 2;
  padding: 6px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 9px;
  transition: color 0.25s;
}

.type-switch button.active {
  color: #fff;
  font-weight: 600;
}

.ts-pill {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  width: calc(50% - 4px);
  border-radius: 9px;
  background: var(--grad);
  transition: transform 0.32s var(--ease);
  box-shadow: 0 4px 12px -5px rgba(75, 85, 99, 0.85);
}

.ts-pill.income {
  transform: translateX(calc(100% + 2px));
}

.sheet-close {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.14s var(--ease);
}

.sheet-close svg {
  width: 15px;
  height: 15px;
}

.sheet-close:active {
  transform: scale(0.9);
  background: var(--bg-2);
}

.amount-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 0 2px;
}

.amount-box .currency {
  font-size: 22px;
  font-weight: 300;
  color: var(--muted);
  margin-top: 6px;
}

.amount-box input {
  width: min(260px, 62vw);
  min-width: 0;
  text-align: center;
  font-size: clamp(32px, 10vw, 42px);
  font-weight: 700;
  letter-spacing: -1.2px;
  color: var(--ink);
  caret-color: var(--ink);
}

@supports (field-sizing: content) {
  .amount-box input {
    field-sizing: content;
    width: auto;
    min-width: 2ch;
    max-width: min(260px, 70vw);
  }
}

.amount-box input::placeholder {
  color: #C9CFD8;
  font-weight: 600;
}

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

.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 2px 8px;
  border-radius: 15px;
  border: 1.5px solid transparent;
  background: var(--bg-2);
  transition: background 0.22s var(--ease), border-color 0.22s, transform 0.18s var(--ease);
  min-width: 0;
}

.cat:active {
  transform: scale(0.95);
}

.cat-ico {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--white);
  color: var(--muted);
  transition: background 0.22s, color 0.22s, transform 0.22s var(--ease), box-shadow 0.22s;
  box-shadow: 0 2px 6px -3px rgba(75, 85, 99, 0.2);
}

.cat-ico svg {
  width: 18px;
  height: 18px;
}

.cat-name {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat.active {
  background: rgba(75, 85, 99, 0.07);
  border-color: rgba(75, 85, 99, 0.32);
}

.cat.active .cat-ico {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(75, 85, 99, 0.9);
  transform: translateY(-1px);
}

.cat.active .cat-name {
  color: var(--ink);
  font-weight: 600;
}

.sheet-rows {
  background: var(--bg-2);
  border-radius: 16px;
  padding: 2px 14px;
  margin-bottom: 14px;
}

.sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  border-bottom: 1px solid rgba(75, 85, 99, 0.05);
}

.sheet-row:last-child {
  border-bottom: none;
}

.sheet-row .sr-icon {
  color: var(--muted-2);
}

.sheet-row input {
  flex: 1;
  font-size: 13.5px;
  min-width: 0;
  color: var(--ink);
  background: transparent;
}

.sheet-row input[type="date"] {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.sheet .btn-primary {
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.sheet-safe {
  height: calc(16px + var(--safe-bottom));
}

/* 城市选择 */
.sheet-city {
  padding-bottom: 6px;
}

.city-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  border-radius: 14px;
  background: var(--bg);
  margin-bottom: 8px;
}

.city-search-ico {
  color: var(--muted);
  display: inline-flex;
  flex-shrink: 0;
}

.city-search-ico svg {
  width: 17px;
  height: 17px;
}

.city-search input {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}

.city-hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 2px 2px 10px;
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.city-chip {
  padding: 11px 0;
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  transition: background 0.18s, color 0.18s, transform 0.14s var(--ease);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-chip:active {
  transform: scale(0.94);
}

.city-chip.active {
  background: var(--grad);
  color: #fff;
  font-weight: 600;
}

.city-auto {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink);
  border: 1.5px dashed rgba(75, 85, 99, 0.18);
  background: transparent;
}

.city-auto span {
  display: inline-flex;
}

.city-auto svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================
   11. 响应式
   ========================================================== */

/* 窄屏：收紧留白 */
@media (max-width: 400px) {
  .views {
    padding-left: 14px;
    padding-right: 14px;
  }

  .auth-card {
    padding: 26px 20px 20px;
    border-radius: 24px;
  }

  .sheet {
    padding-left: 14px;
    padding-right: 14px;
  }

  .cat-grid,
  .city-grid {
    gap: 6px;
  }

  .cat-name {
    font-size: 10.5px;
  }

  .wc-main {
    padding-right: 64px;
  }

  .wc-art {
    width: 70px;
    height: 70px;
    top: 46px;
  }

  .wc-fd {
    gap: 3px;
    font-size: 11px;
  }

  .wc-fd-name {
    display: none;
  }

  .donut {
    width: 112px;
    height: 112px;
  }

  .donut svg {
    width: 112px;
    height: 112px;
  }

  .fab {
    width: 48px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .fab em {
    display: none;
  }

  .seg button {
    padding: 6px 11px;
  }

  .ms-label {
    min-width: 64px;
  }

  .setting-row {
    font-size: 13px;
  }

  .mini-btn {
    padding: 6px 9px;
  }
}

/* 超窄屏 320px：进一步压缩 */
@media (max-width: 340px) {
  .home-title { font-size: 19px; }
  .page-head h2 { font-size: 19px; }
  .sc-divider { margin: 0 10px; }
  .sc-label { font-size: 11px; }
  .sc-value { font-size: 16px; }
  .wc-city #wcCity { max-width: 38vw; }
  .streak-dot { width: 26px; height: 26px; border-radius: 9px; }
  .city-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .type-switch button { padding: 6px 12px; }
  .sheet-title { font-size: 15px; }
}

/* 矮屏（横屏 / 小窗口）：压缩纵向留白 */
@media (max-height: 620px) {
  .home-head,
  .page-head {
    padding-top: 16px;
    padding-bottom: 10px;
  }

  .weather-card {
    padding: 14px 16px 12px;
  }

  .wc-art {
    top: 30px;
    width: 64px;
    height: 64px;
  }

  .wc-temp {
    font-size: 34px;
    margin-top: 2px;
  }

  .summary-card {
    margin-top: -14px;
  }

  .sheet {
    max-height: 96dvh;
  }

  .amount-box input {
    font-size: 32px;
  }

  .cat {
    padding: 8px 2px 6px;
  }

  .cat-ico {
    width: 30px;
    height: 30px;
  }

  .auth {
    justify-content: flex-start;
    padding-top: calc(var(--safe-top) + 18px);
  }
}

/* 手机横屏：弹层改为居中卡片，避免高度不够 */
@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --tabbar-h: 56px;
  }

  .views {
    padding-bottom: calc(var(--tabbar-h) + 76px);
  }

  .sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(680px, 94vw);
    max-height: 90dvh;
    border-radius: 22px;
    padding: 10px 18px 6px;
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
    transition: transform 0.3s var(--ease), opacity 0.24s;
  }

  .sheet.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  .sheet-handle {
    display: none;
  }

  .sheet-head {
    margin-bottom: 8px;
  }

  .amount-box input {
    font-size: 30px;
  }

  .sheet-hint {
    margin-bottom: 10px;
  }

  .cat-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .city-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .city-chip {
    padding: 8px 0;
    font-size: 12px;
  }

  .tab-txt {
    display: none;
  }

  .tab-ico svg {
    width: 21px;
    height: 21px;
  }

  .fab {
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  }
}

/* 平板 / 桌面：手机卡片居中，带圆角与投影 */
@media (min-width: 640px) {
  body {
    padding: 0;
  }

  .main {
    height: min(calc(100dvh - 36px), 940px);
    margin: max(18px, calc((100dvh - 940px) / 2)) auto;
    border-radius: 30px;
    box-shadow: 0 30px 80px -30px rgba(75, 85, 99, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.5);
  }

  .views {
    padding-left: 22px;
    padding-right: 22px;
  }

  .tabbar {
    border-radius: 0 0 30px 30px;
  }

  .auth {
    padding: 28px;
  }

  .auth-card {
    max-width: 392px;
  }
}

/* 有精确指针的设备：补充 hover 反馈 */
@media (hover: hover) and (pointer: fine) {
  .tx-item:hover {
    background: var(--bg-2);
  }

  .tx-del:hover {
    color: var(--danger);
    background: rgba(229, 72, 77, 0.08);
  }

  .chip:hover:not(.active) {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 4px 12px -8px rgba(75, 85, 99, 0.6);
  }

  .city-chip:hover:not(.active) {
    background: #EFE9DC;
  }

  .cat:hover:not(.active) {
    background: #EFE9DC;
  }

  .mini-btn:hover {
    background: rgba(75, 85, 99, 0.14);
  }

  .link:hover {
    color: var(--ink);
  }

  .tab:hover {
    color: var(--ink-soft);
  }
}

/* 尊重系统的「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .fab::before {
    display: none;
  }
}
