/* ===========================================================
   拾光工作台 · 样式
   暖米色 + 奶油黄 + 圆润卡片，星星人主题
   =========================================================== */

:root {
  --bg: #fbf6ea;
  --bg-deep: #f3ebdb;
  --card: #ffffff;
  --card-soft: #fdfaf2;
  --ink: #2e2a22;
  --ink-2: #6e675b;
  --ink-3: #a79f90;
  --line: rgba(176, 152, 104, 0.18);
  --yellow: #f0be5e;
  --yellow-deep: #dfa63b;
  --yellow-soft: #fcefd0;
  --green: #7c9078;
  --green-deep: #5d7461;
  --red: #d9534f;
  --red-deep: #a3231f;
  --orange: #e8933f;
  --blue: #5b84c4;
  --pink: #f3dcdc;
  --shadow: 0 8px 24px rgba(176, 148, 88, 0.1);
  --shadow-sm: 0 2px 10px rgba(176, 148, 88, 0.08);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", "PingFang SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100dvh;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  -webkit-appearance: none;
  appearance: none;
}

/* ---------- 外壳 ---------- */
#app {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  background-image: radial-gradient(120% 60% at 50% 0%, #fffdf6 0%, rgba(255, 253, 246, 0) 60%);
  box-shadow: 0 0 60px rgba(120, 100, 60, 0.08);
  overflow-x: hidden;
}

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 18px 10px;
  background: rgba(251, 246, 234, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #fdf3d8, #f8e3ae);
  box-shadow: var(--shadow-sm);
}

.brand-text .zh {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.brand-text .en {
  display: block;
  font-size: 8px;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  transition: transform 0.15s ease, background 0.15s ease;
}

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

.icon-btn.solid {
  background: var(--yellow);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px rgba(223, 166, 59, 0.35);
}

.main {
  flex: 1;
  padding: 0 16px calc(104px + env(safe-area-inset-bottom));
}

/* ---------- 页头 ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 16px;
}

.page-head .en {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.page-head h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.25;
  margin: 2px 0 2px;
}

.page-head .sub {
  font-size: 12px;
  color: var(--ink-3);
  margin: 0;
}

.round-add {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, #f6ca76, #eeb44c);
  box-shadow: 0 8px 18px rgba(223, 166, 59, 0.32);
  transition: transform 0.15s ease;
}

.round-add:active {
  transform: scale(0.93);
}

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  margin-bottom: 14px;
}

.card.flat {
  background: var(--card-soft);
  box-shadow: none;
  border: 1px solid var(--line);
}

.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 4px 10px;
}

.sec-head h2 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0;
}

.sec-head .en {
  display: block;
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.sec-head .link {
  font-size: 12px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: none;
  padding: 2px;
}

/* 三列统计 */
.stats3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 14px 6px;
  margin-bottom: 14px;
}

.stats3 > div {
  text-align: center;
  position: relative;
}

.stats3 > div + div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background: var(--line);
}

.stats3 .k {
  font-size: 11px;
  color: var(--ink-3);
}

.stats3 .v {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin-top: 2px;
}

.stats3 .v small {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-3);
  margin-left: 2px;
  font-weight: 400;
}

/* ---------- 搜索 / 输入 ---------- */
.search {
  position: relative;
  margin-bottom: 12px;
}

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
}

.search input {
  width: 100%;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 0 14px 0 40px;
  font-size: 16px;
  outline: none;
}

.search input::placeholder {
  font-size: 13px;
  color: var(--ink-3);
}

.search input:focus {
  border-color: var(--yellow);
  background: #fff;
}

/* 筛选 chips */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip.active {
  background: var(--yellow-soft);
  border-color: #eccd86;
  color: #8a6414;
  font-weight: 600;
}

.chip.mini {
  padding: 5px 11px;
  font-size: 11px;
}

/* ---------- 列表条目 ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.todo-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.2s ease;
}

.todo-item .check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1.6px solid #d9cdb4;
  display: grid;
  place-items: center;
  margin-top: 2px;
  color: transparent;
  transition: all 0.15s ease;
}

.todo-item.done .check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

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

.todo-title {
  font-size: 14.5px;
  word-break: break-word;
}

.todo-item.done .todo-title {
  color: var(--ink-3);
  text-decoration: line-through;
  text-decoration-color: rgba(167, 159, 144, 0.7);
}

.todo-note {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}

.todo-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--ink-3);
}

.item-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.mini-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
}

.mini-btn:active {
  background: var(--bg-deep);
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 34px 20px 30px;
  color: var(--ink-3);
}

.empty .art {
  width: 74px;
  height: 74px;
  margin: 0 auto 10px;
  opacity: 0.9;
}

.empty p {
  margin: 0;
  font-size: 13px;
}

.empty .hint {
  font-size: 11.5px;
  margin-top: 4px;
  color: #bcb3a2;
}

/* ---------- DDL ---------- */
.ddl-item {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 14px 13px 16px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--blue);
  overflow: hidden;
}

.ddl-item.lvl-urgent {
  border-left-color: var(--red);
  background: linear-gradient(100deg, #fff6f5, #ffffff 55%);
}

.ddl-item.lvl-soon {
  border-left-color: var(--orange);
  background: linear-gradient(100deg, #fffaf2, #ffffff 55%);
}

.ddl-item.lvl-normal {
  border-left-color: #8fa8d0;
}

.ddl-item.lvl-overdue {
  border-left-color: var(--red-deep);
  background: linear-gradient(100deg, #fdeeee, #ffffff 60%);
}

.ddl-item.done {
  border-left-color: #cfcabc;
  background: #faf8f2;
  opacity: 0.72;
}

.ddl-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ddl-text {
  font-size: 14.5px;
  font-weight: 500;
  word-break: break-word;
}

.ddl-item.done .ddl-text {
  color: var(--ink-3);
  text-decoration: line-through;
}

.ddl-sub {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  background: var(--bg-deep);
  color: var(--ink-2);
  white-space: nowrap;
}

.badge.red {
  background: #fdeaea;
  color: #b8362f;
}

.badge.orange {
  background: #fdf0e0;
  color: #b6762a;
}

.badge.darkred {
  background: var(--red-deep);
  color: #fff;
  font-weight: 600;
}

.badge.blue {
  background: #eaf0fa;
  color: #47699e;
}

.badge.green {
  background: #eaf1e7;
  color: #4e6b52;
}

.badge.grey {
  background: #f0eee6;
  color: #8d8778;
}

.ddl-time {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.ddl-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* 提醒条 */
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 2px;
  padding: 11px 13px;
  border-radius: 15px;
  background: linear-gradient(100deg, #fdeaea, #fff3ea);
  border: 1px solid #f3c9c4;
  color: #9b2f28;
  font-size: 12.5px;
  box-shadow: 0 6px 16px rgba(200, 90, 70, 0.12);
  cursor: pointer;
  animation: bannerIn 0.36s ease;
}

.banner.overdue {
  background: linear-gradient(100deg, #fbe3e2, #fdf1ef);
  border-color: #eab3ae;
  color: #8d1f1a;
}

.banner .b-icon {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #fff;
  color: inherit;
}

.banner .b-text {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.banner .b-text b {
  font-weight: 700;
}

.banner .b-arrow {
  color: inherit;
  opacity: 0.6;
}

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

/* ---------- 按钮 ---------- */
.btn {
  height: 42px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--bg-deep);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

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

.btn.primary {
  background: linear-gradient(160deg, #f6ca76, #edb247);
  color: #fff;
  box-shadow: 0 6px 14px rgba(223, 166, 59, 0.28);
}

.btn.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.btn.danger {
  background: #fdeeee;
  color: #b8362f;
}

.btn.block {
  width: 100%;
}

.btn.sm {
  height: 34px;
  padding: 0 13px;
  font-size: 12.5px;
  border-radius: 11px;
}

.btn:disabled {
  opacity: 0.5;
}

/* ---------- 表单 ---------- */
.field {
  margin-bottom: 14px;
}

.field > .label {
  display: block;
  font-size: 11.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card-soft);
  border-radius: 13px;
  padding: 11px 13px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--yellow);
  background: #fff;
}

.textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.55;
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a79f90' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.row2 > * {
  min-width: 0;
}

.quick-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.hint-line {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 6px;
  line-height: 1.5;
}

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(46, 42, 34, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  animation: sheetUp 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet .grabber {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #e3d9c4;
  margin: 4px auto 8px;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 2px 20px 10px;
  gap: 10px;
}

.sheet-head h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.03em;
}

.sheet-head p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
}

.sheet-body {
  padding: 4px 20px 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-foot {
  display: flex;
  gap: 10px;
  padding: 10px 20px 4px;
}

.sheet-foot .btn {
  flex: 1;
  height: 46px;
  border-radius: 15px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
}

/* ---------- Toast ---------- */
#toast-host {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 18px);
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(46, 42, 34, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  animation: toastIn 0.24s ease;
  max-width: 80vw;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
  background: rgba(253, 250, 242, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(176, 152, 104, 0.14);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0 3px;
  color: #aca392;
  font-size: 9.5px;
  letter-spacing: 0.02em;
  border-radius: 12px;
  position: relative;
}

.tab .tab-ico {
  position: relative;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.tab.active {
  color: #c08a24;
  font-weight: 600;
}

.tab.active .tab-ico::before {
  content: "";
  position: absolute;
  inset: -6px -9px;
  border-radius: 12px;
  background: var(--yellow-soft);
  z-index: -1;
}

.tab .dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  border: 1px solid #fff;
}

/* ---------- 录音 ---------- */
.rec-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 2px;
}

.rec-time {
  font-family: var(--serif);
  font-size: 34px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.rec-status {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  height: 18px;
}

.rec-btn {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 16px 0 6px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, #f6ca76, #e9a93c);
  box-shadow: 0 12px 26px rgba(223, 166, 59, 0.36);
  transition: transform 0.18s ease;
}

.rec-btn:active {
  transform: scale(0.95);
}

.rec-btn.recording {
  background: linear-gradient(160deg, #e2716c, #c8443e);
  box-shadow: 0 12px 26px rgba(200, 68, 62, 0.34);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(217, 83, 79, 0.32), 0 12px 26px rgba(200, 68, 62, 0.3);
  }
  50% {
    box-shadow: 0 0 0 16px rgba(217, 83, 79, 0), 0 12px 26px rgba(200, 68, 62, 0.3);
  }
}

.wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  margin-bottom: 6px;
}

.wave i {
  width: 4px;
  height: 6px;
  border-radius: 2px;
  background: #e8b25a;
  transition: height 0.12s ease;
}

.live-box {
  min-height: 108px;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px dashed #e2d6bb;
  background: var(--card-soft);
  padding: 13px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.live-box .interim {
  color: var(--ink-3);
}

.live-box .placeholder {
  color: #bfb6a4;
  font-size: 13px;
}

.rec-note {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.6;
}

.summary-card {
  border-radius: 16px;
  background: linear-gradient(140deg, #fdf5e2, #fbf0d6);
  border: 1px solid #f0e0bc;
  padding: 13px 14px;
  margin-bottom: 12px;
}

.summary-card .tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #a5822f;
  text-transform: uppercase;
}

.summary-card p {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.65;
}

.rec-item {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.rec-item .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.rec-item .sum {
  font-size: 13.5px;
  margin: 8px 0 0;
  line-height: 1.6;
}

.rec-item .full {
  font-size: 12.5px;
  color: var(--ink-2);
  margin: 8px 0 0;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 4.9em;
  overflow: hidden;
  position: relative;
}

.rec-item .full.open {
  max-height: none;
}

.rec-item .ops {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.text-btn {
  font-size: 11.5px;
  color: #b08a3e;
  padding: 4px 2px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* ---------- 记账 ---------- */
.money-hero {
  position: relative;
  border-radius: 24px;
  padding: 18px 20px 16px;
  color: #fff;
  background: linear-gradient(150deg, #829678 0%, #667d68 55%, #586e5c 100%);
  box-shadow: 0 14px 30px rgba(88, 110, 92, 0.26);
  overflow: hidden;
  margin-bottom: 14px;
}

.money-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}

.money-hero .label {
  font-size: 10px;
  letter-spacing: 0.2em;
  opacity: 0.7;
  text-transform: uppercase;
}

.money-hero .amount {
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1.15;
  margin: 6px 0 1px;
  letter-spacing: 0.01em;
}

.money-hero .quote {
  font-size: 11px;
  opacity: 0.62;
  margin-bottom: 14px;
}

.money-hero .split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.money-hero .split div {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  padding: 9px 12px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(2px);
}

.money-hero .split b {
  font-weight: 600;
  font-size: 13px;
}

.money-hero .period-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.money-hero .period-row .p-label {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 6px;
}

.p-nav {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.seg {
  display: inline-flex;
  background: var(--bg-deep);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}

.seg button {
  padding: 5px 14px;
  border-radius: 9px;
  font-size: 12px;
  color: var(--ink-2);
}

.seg button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(150, 130, 90, 0.12);
}

.seg.dark {
  background: rgba(255, 255, 255, 0.16);
}

.seg.dark button {
  color: rgba(255, 255, 255, 0.72);
}

.seg.dark button.on {
  background: #fff;
  color: #4e6553;
}

.chart-box {
  position: relative;
  width: 100%;
}

.chart-box.pie {
  height: 190px;
}

.chart-box.bar {
  height: 200px;
}

.pie-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pie-wrap .chart-box {
  flex: 0 0 46%;
  min-width: 0;
  max-width: 46%;
}

/* canvas 有固有宽度，必须允许 flex 收缩，否则会把图例挤出屏幕（手机上尤其明显） */
.pie-wrap canvas {
  max-width: 100%;
}

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

.legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.legend-row .sw {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  flex: none;
}

.legend-row .nm {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-row .vl {
  font-variant-numeric: tabular-nums;
}

.tx-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.tx-ico {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: var(--bg-deep);
}

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

.tx-body .t1 {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-body .t2 {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 1px;
}

.tx-amt {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tx-amt.in {
  color: #4f7b58;
}

.tx-amt.out {
  color: #b4544a;
}

.day-group {
  font-size: 11.5px;
  color: var(--ink-3);
  margin: 14px 4px 8px;
  display: flex;
  justify-content: space-between;
}

/* ---------- 经期 ---------- */
.period-hero {
  border-radius: 22px;
  padding: 18px 20px;
  background: linear-gradient(145deg, #fbe9e6, #f7dfe4 60%, #f5e2ea);
  border: 1px solid #f2d3d6;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.period-hero::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.period-hero .en {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: #b57f83;
  text-transform: uppercase;
}

.period-hero h2 {
  font-family: var(--serif);
  font-size: 23px;
  margin: 5px 0 2px;
  color: #8d4a4f;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.period-hero p {
  margin: 0;
  font-size: 12px;
  color: #a3757a;
}

.cal {
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px 12px 10px;
  margin-bottom: 14px;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 10px;
}

.cal-head .m {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-3);
  padding-bottom: 4px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: 11px;
  background: transparent;
}

.cal-cell.blank {
  pointer-events: none;
}

.cal-cell .num {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.cal-cell.period .num {
  background: #f6c9c9;
  color: #a13a3a;
  font-weight: 600;
}

.cal-cell.predicted .num {
  background: #fdf1f1;
  color: #c98b8b;
  box-shadow: inset 0 0 0 1.4px #eec4c4;
}

.cal-cell.fertile .num {
  background: #fce7cf;
  color: #b4712a;
}

.cal-cell.ovulation .num {
  background: #d8e6f8;
  color: #37609e;
  font-weight: 600;
}

.cal-cell.today .num::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.6px solid var(--yellow);
}

.cal-cell.has-log::before {
  content: "";
  position: absolute;
  bottom: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #cdbfa4;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 6px 0;
  font-size: 10.5px;
  color: var(--ink-3);
}

.cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cal-legend i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  display: inline-block;
}

.flow-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.flow-chip {
  padding: 7px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  font-size: 12.5px;
  color: var(--ink-2);
}

.flow-chip.on {
  background: #fbe4e4;
  border-color: #efc4c4;
  color: #a13a3a;
  font-weight: 600;
}

.day-log {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.day-log:last-child {
  border-bottom: none;
}

.day-log .d {
  font-family: var(--serif);
  font-size: 15px;
  width: 52px;
  flex: none;
  color: var(--ink-2);
}

.day-log .c {
  flex: 1;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
}

/* ---------- 饮食 ---------- */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.upload-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-deep);
  display: grid;
  place-items: center;
  color: var(--ink-3);
  border: 1px dashed #ded2b8;
}

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

.upload-slot .rm {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  display: grid;
  place-items: center;
}

.timeline {
  position: relative;
  padding-left: 2px;
}

.time-label {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-2);
  margin: 16px 2px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.food-card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 12px;
  margin-bottom: 10px;
}

.food-imgs {
  display: grid;
  gap: 4px;
  border-radius: 13px;
  overflow: hidden;
  margin-bottom: 9px;
}

.food-imgs.n1 {
  grid-template-columns: 1fr;
}

.food-imgs.n2 {
  grid-template-columns: 1fr 1fr;
}

.food-imgs.n3 {
  grid-template-columns: 1fr 1fr;
}

.food-imgs.n3 .ph:first-child {
  grid-row: span 2;
}

.food-imgs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg-deep);
  max-height: 230px;
}

.food-imgs.n3 img {
  max-height: 116px;
}

.food-imgs.n3 .ph:first-child img {
  max-height: 236px;
}

.food-imgs .ph {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-deep);
}

.food-imgs.n1 .ph {
  aspect-ratio: 4 / 3;
}

.food-text {
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.food-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--ink-3);
}

.mood-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--yellow-soft);
  color: #9a7420;
  font-size: 10.5px;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(20, 18, 14, 0.92);
  display: grid;
  place-items: center;
  padding: 20px;
}

.viewer img {
  max-width: 100%;
  max-height: 82dvh;
  border-radius: 12px;
}

.viewer .close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 16px);
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: grid;
  place-items: center;
}

/* ---------- 引导页 ---------- */
.onboard {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 26px calc(30px + env(safe-area-inset-bottom));
  text-align: center;
}

.onboard .hero {
  width: 132px;
  height: 132px;
  margin-bottom: 6px;
  animation: floaty 3.6s ease-in-out infinite;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0) rotate(-1.5deg);
  }
  50% {
    transform: translateY(-9px) rotate(1.5deg);
  }
}

.onboard h2 {
  font-family: var(--serif);
  font-size: 25px;
  letter-spacing: 0.06em;
  margin: 10px 0 6px;
  font-weight: 600;
}

.onboard .desc {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.75;
  max-width: 300px;
  margin: 0 auto;
}

.onboard .feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 340px;
  margin: 22px 0 6px;
}

.onboard .feature-grid div {
  background: #fff;
  border-radius: 15px;
  padding: 11px 6px;
  font-size: 11px;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.onboard .feature-grid b {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
}

.onboard .foot {
  width: 100%;
  max-width: 340px;
  margin-top: auto;
}

.dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 18px 0;
}

.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e0d5bd;
}

.dots i.on {
  width: 18px;
  border-radius: 3px;
  background: var(--yellow);
}

/* 小工具 */
.mt8 {
  margin-top: 8px;
}

.mt12 {
  margin-top: 12px;
}

.mt16 {
  margin-top: 16px;
}

.center {
  text-align: center;
}

.muted {
  color: var(--ink-3);
}

.small {
  font-size: 11.5px;
}

.hidden {
  display: none !important;
}

.no-scroll {
  overflow: hidden;
}

::selection {
  background: #f7dfa8;
}
