/* ============ 个人工作台 —— 浅紫卡片风格 ============ */
:root {
  --bg: #f5f0fa;
  --bg-deep: #ede4f7;
  --card: #ffffff;
  --primary: #7c5cbf;
  --primary-deep: #6747a8;
  --primary-soft: #efe7fa;
  --primary-soft2: #f6f0fd;
  --accent: #e8a0c9;
  --text: #3b3550;
  --text-sub: #8b84a0;
  --text-faint: #b3adc4;
  --danger: #e05d6f;
  --income: #34a853;
  --expense: #e05d6f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 18px rgba(124, 92, 191, 0.10);
  --shadow-lg: 0 10px 32px rgba(124, 92, 191, 0.16);
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: linear-gradient(160deg, #efe9f8 0%, var(--bg) 40%, #f3eef8 100%);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* 手机外壳：桌面居中显示 */
.phone-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 60px rgba(124, 92, 191, 0.12);
}

@media (min-width: 520px) {
  body { padding: 0 16px; }
  .phone-shell { border-radius: 28px; margin: 16px auto; min-height: calc(100vh - 32px); overflow: hidden; }
}

/* ============ 顶部栏 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 253, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(124, 92, 191, 0.08);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
}
.topbar-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.btn-publish {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: linear-gradient(135deg, var(--primary), #9d7fdd);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(124, 92, 191, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-publish:active { transform: scale(0.95); }
.publish-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ffe28a;
  box-shadow: 0 0 0 3px rgba(255, 226, 138, 0.3);
}

/* ============ 页面容器 ============ */
.page {
  flex: 1;
  padding: 16px 16px 96px;
  overflow-y: auto;
}
.section { margin-bottom: 18px; }
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-sub);
  letter-spacing: 1px;
  margin: 2px 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title::before {
  content: "";
  width: 4px; height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.section-title small { font-weight: 500; color: var(--text-faint); margin-left: auto; }

/* ============ 卡片 ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 12px; }

/* ============ 今日概览 ============ */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 5px;
}
.stat-card .stat-value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: 0.3px;
}
.stat-card .stat-value .unit { font-size: 12px; font-weight: 600; color: var(--text-faint); margin-left: 2px; }
.stat-card .stat-extra { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.stat-card.wide { grid-column: span 2; }
.stat-card .stat-icon {
  position: absolute;
  right: -6px;
  bottom: -8px;
  font-size: 46px;
  opacity: 0.14;
  transform: rotate(-12deg);
}
.c-ink { color: var(--primary); }
.c-ink2 { color: var(--expense); }
.c-ink3 { color: var(--income); }

/* 任务进度条 */
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #b393ea);
  transition: width 0.5s ease;
}
.progress-label { font-size: 12px; color: var(--text-sub); margin-top: 6px; display: flex; justify-content: space-between; }

/* ============ 快速入口宫格 ============ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.entry {
  background: var(--card);
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 14px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  font-family: inherit;
}
.entry:active { transform: scale(0.94); }
.entry .entry-icon {
  width: 48px; height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.06);
}
.entry .entry-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.entry .entry-tag { font-size: 10px; color: var(--text-faint); }
.entry.disabled { opacity: 0.72; }
.entry.disabled:active { transform: none; }
/* 图标底色 */
.ic-purple { background: linear-gradient(135deg, #e9dfff, #d9c8f7); }
.ic-pink   { background: linear-gradient(135deg, #ffe3f0, #fbc9e2); }
.ic-blue   { background: linear-gradient(135deg, #e0efff, #c3e0fb); }
.ic-green  { background: linear-gradient(135deg, #e2f7ea, #c8efd8); }
.ic-orange { background: linear-gradient(135deg, #fff0dd, #fdddb4); }
.ic-cyan   { background: linear-gradient(135deg, #dff6f5, #bfecea); }
.ic-gray   { background: linear-gradient(135deg, #f0eef4, #e2dfea); }

/* ============ 通用按钮 / 表单 ============ */
.btn {
  border: none;
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #9d7fdd);
  color: #fff;
  box-shadow: 0 6px 16px rgba(124, 92, 191, 0.35);
  width: 100%;
}
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--expense); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 10px; }

.form-row { margin-bottom: 12px; }
.form-row label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%;
  border: 1.5px solid transparent;
  background: var(--primary-soft2);
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  background: #fff;
}
.textarea { resize: vertical; min-height: 68px; }
.select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b84a0' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }

/* 分段选择器 */
.seg {
  display: flex;
  background: var(--primary-soft);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.seg button.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(124, 92, 191, 0.18); }

/* 日期选择行 */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.date-nav .month-text { font-size: 16px; font-weight: 700; }
.icon-btn {
  width: 34px; height: 34px;
  border: none;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 16px;
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
}

/* ============ 列表 ============ */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid #f3eef9;
}
.list-item:last-child { border-bottom: none; }
.list-item .li-icon {
  width: 40px; height: 40px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 14.5px; }
.list-item .li-sub { font-size: 12px; color: var(--text-faint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-right { text-align: right; flex-shrink: 0; }
.list-item .li-amount { font-weight: 700; font-size: 15px; }
.list-item .li-amount.expense { color: var(--expense); }
.list-item .li-amount.income { color: var(--income); }
.li-del {
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 2px 4px 8px;
}
.li-del:active { color: var(--danger); }

/* 空状态 */
.empty {
  text-align: center;
  padding: 36px 0 28px;
  color: var(--text-faint);
}
.empty .empty-icon { font-size: 40px; margin-bottom: 8px; opacity: 0.7; }
.empty p { font-size: 13px; }

/* 统计卡（分析页） */
.stats-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mini-stat { background: var(--card); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px 8px; text-align: center; }
.mini-stat .ms-label { font-size: 11px; color: var(--text-sub); }
.mini-stat .ms-value { font-size: 17px; font-weight: 800; margin-top: 3px; }
.mini-stat .ms-value.income { color: var(--income); }
.mini-stat .ms-value.expense { color: var(--expense); }

/* 图例 */
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-sub); }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-item b { color: var(--text); font-weight: 600; }

/* ============ 任务 ============ */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid #f3eef9;
}
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid #d8ceea;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 13px;
  transition: all 0.15s ease;
}
.task-check.checked {
  background: linear-gradient(135deg, var(--primary), #9d7fdd);
  border-color: transparent;
  color: #fff;
}
.task-title { flex: 1; font-size: 14.5px; font-weight: 500; }
.task-title.done { text-decoration: line-through; color: var(--text-faint); }
.task-priority {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}
.tp-high { background: #fde8ec; color: var(--expense); }
.tp-mid { background: #fff3dd; color: #d99a2b; }
.tp-low { background: #e6f3ea; color: var(--income); }
.task-add-row { display: flex; gap: 8px; margin-top: 14px; }
.task-add-row .input { flex: 1; }

/* 日期行（任务页） */
.date-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(124, 92, 191, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 60;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--text-faint);
  font-family: inherit;
  transition: color 0.15s ease;
}
.tab .tab-icon { font-size: 21px; filter: grayscale(0.6) opacity(0.65); transition: filter 0.15s ease, transform 0.15s ease; }
.tab .tab-label { font-size: 10.5px; font-weight: 600; }
.tab.active { color: var(--primary); }
.tab.active .tab-icon { filter: none; transform: translateY(-1px); }

/* ============ 快速记账：FAB + 弹出面板 + 语音 ============ */
.fab {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #8a6fd1, #7c5cbf 60%, #9d7fdd);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  z-index: 70;
  box-shadow: 0 8px 22px rgba(124, 92, 191, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.fab:active { transform: scale(0.9); }
.fab-plus { line-height: 1; font-weight: 300; }

.quick-mask {
  position: fixed;
  inset: 0;
  background: rgba(50, 40, 70, 0.45);
  z-index: 95;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.quick-sheet {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slideup 0.22s ease;
  max-height: 86vh;
  overflow-y: auto;
}
.quick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.quick-title { font-size: 16px; font-weight: 700; color: var(--primary); }
.quick-close {
  border: none;
  background: var(--primary-soft);
  color: var(--text-sub);
  width: 30px; height: 30px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.quick-amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 14px;
}
.quick-yuan { font-size: 24px; font-weight: 800; color: var(--primary); }
.quick-amount {
  flex: 1;
  border: none;
  border-bottom: 2px solid var(--primary-soft);
  font-size: 30px;
  font-weight: 800;
  padding: 6px 2px;
  outline: none;
  color: var(--text);
  font-family: inherit;
  min-width: 0;
}
.quick-amount:focus { border-color: var(--primary); }
.quick-voice {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--primary-soft);
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.quick-voice.listening {
  background: var(--expense);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 93, 111, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(224, 93, 111, 0); }
}
.quick-note { margin: 4px 0 14px; }
.quick-actions { display: flex; gap: 10px; }
.quick-actions .btn { flex: 1; padding: 13px 0; }
.quick-tip {
  margin-top: 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ============ 弹窗 / Toast ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(50, 40, 70, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 20px;
  padding: 22px 20px 16px;
  width: min(320px, 86vw);
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-text { font-size: 15px; text-align: center; color: var(--text); padding: 4px 0 18px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(50, 42, 66, 0.9);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 200;
  max-width: 80vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }

/* 发布弹层 */
.publish-mask {
  position: fixed;
  inset: 0;
  background: rgba(50, 40, 70, 0.45);
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.publish-sheet {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideup 0.22s ease;
  max-height: 70vh;
  overflow-y: auto;
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.publish-sheet h3 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.publish-actions { display: flex; gap: 10px; margin-top: 14px; }
.publish-actions .btn { flex: 1; }

/* 分类选择 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid transparent;
  background: var(--primary-soft2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.chip.active { background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(124, 92, 191, 0.35); }

/* 概览大卡（本月） */
.hero-card {
  background: linear-gradient(135deg, #8a6fd1 0%, #7c5cbf 55%, #9d7fdd 100%);
  border-radius: 22px;
  padding: 20px;
  color: #fff;
  box-shadow: 0 12px 30px rgba(124, 92, 191, 0.4);
  position: relative;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  right: -40px; top: -50px;
}
.hero-card::before {
  content: "";
  position: absolute;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  right: 60px; bottom: -36px;
}
.hero-card .hero-label { font-size: 12.5px; opacity: 0.85; }
.hero-card .hero-value { font-size: 30px; font-weight: 800; margin: 4px 0 14px; letter-spacing: 0.5px; }
.hero-card .hero-stats { display: flex; gap: 22px; position: relative; z-index: 1; }
.hero-card .hero-stats b { font-size: 16px; display: block; }
.hero-card .hero-stats span { font-size: 11.5px; opacity: 0.85; }
