/* ===== Mo 记账 · OKX 官方设计系统 (OKD) 亮色主题 =====
   tokens 来源: okx.com 线上 CSS 变量 (theme-light)
   bg #fff / surface #f6f6f6 / content #000..#b3b3b3 / brand #bcff2f
   positive #31bd65 / negative #eb4b6d / link #0569ff */
:root {
  --bg: #ffffff;
  --bg2: #f7f7f7;
  --surface: #f6f6f6;
  --surface-pressed: #d9d9d9;
  --line: #e6e6e6;
  --line-strong: #dbdbdb;
  --txt: #000000;
  --txt2: #383838;
  --txt3: #5b5b5b;
  --muted: #909090;
  --disabled: #b3b3b3;
  --inverse: #0e0e0e;
  --brand: #bcff2f;
  --pos: #31bd65;
  --neg: #eb4b6d;
  --link: #0569ff;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--txt);
  /* 与 okx.com 完全一致的字体栈: HarmonyOS Sans, SF Pro Text, Arial, Helvetica Neue, Helvetica */
  font-family: "HarmonyOS Sans SC", "HarmonyOS Sans", "SF Pro Text", "SF Pro Icons", Arial, "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font-family: inherit; }

/* 页面 */
.page { display: none; padding: 0 16px; max-width: 520px; margin: 0 auto; }
.page.active { display: block; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 2px 16px;
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: -.2px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); display: inline-block; }
.brand span { font-weight: 400; color: var(--muted); font-size: 15px; margin-left: -2px; }
.page-title { font-size: 22px; font-weight: 800; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.icon-btn:active { background: var(--surface-pressed); }
.link-btn { color: var(--muted); font-size: 13px; }
.section-title-row { display: flex; justify-content: space-between; align-items: center; margin: 20px 2px 10px; }
.section-title { font-size: 16px; font-weight: 700; }

.card { background: var(--surface); border-radius: 12px; overflow: hidden; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* 首页 hero（黑卡 · OKX container-inverse 风格） */
.hero-card {
  background: var(--inverse); border-radius: 16px;
  padding: 24px 20px 20px; position: relative; overflow: hidden;
}
.hero-card::after {
  content: ""; position: absolute; right: -50px; top: -50px;
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, rgba(188,255,47,.16), transparent 68%);
}
.hero-label { color: rgba(255,255,255,.55); font-size: 13px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-eye {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
}
.hero-eye:active { background: rgba(255,255,255,.2); }
.hero-amount {
  color: #fff; font-size: 42px; font-weight: 800; letter-spacing: -.5px;
  margin: 10px 0 4px; font-variant-numeric: tabular-nums;
}
.hero-meta { color: rgba(255,255,255,.4); font-size: 12px; margin-bottom: 16px; }
.hero-stats {
  display: flex; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px;
}
.hero-stats > div { flex: 1; text-align: center; position: relative; }
.hero-stats > div + div::before {
  content: ""; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 1px; background: rgba(255,255,255,.08);
}
.hero-stats i { display: block; font-style: normal; color: rgba(255,255,255,.5); font-size: 12px; margin-bottom: 5px; }
.hero-stats b { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.hero-stats .pos { color: #19cc5b; }
.hero-stats .neg { color: #f1507b; }

/* 账户网格 */
.account-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.acct {
  background: var(--surface); border-radius: 12px; border: 1px solid transparent;
  padding: 14px; text-align: left;
}
.acct:active { background: #ededed; }
.acct-top { display: flex; align-items: center; gap: 8px; color: var(--txt3); font-size: 13px; }
.acct-top .ico { display: flex; align-items: center; }
.acct-amt { font-size: 19px; font-weight: 700; margin-top: 8px; font-variant-numeric: tabular-nums; }
.acct-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); border: 1.5px dashed var(--line-strong); background: transparent; }
.acct-add .plus { font-size: 24px; color: var(--txt); line-height: 1; }

/* 列表 */
.list { overflow: hidden; }
.list .cell, .cell-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 15px;
}
.list .cell:last-child, .list .cell-btn:last-child { border-bottom: none; }
.cell .ico {
  width: 38px; height: 38px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0;
}
.cell-mid { flex: 1; min-width: 0; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.cell-btn:active { background: #ededed; }
.cell-btn.danger { color: var(--neg); justify-content: center; font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 13px; }

/* 汇总行 */
.summary-row { display: flex; padding: 15px 0; margin-bottom: 12px; }
.summary-row > div { flex: 1; text-align: center; }
.summary-row i { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.summary-row b { font-variant-numeric: tabular-nums; font-size: 15px; }

/* 筛选 chips（OKX segmented：灰轨道 + 白色激活块） */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.chip {
  padding: 7px 15px; border-radius: 999px; font-size: 13px;
  background: var(--surface); color: var(--txt3); font-weight: 500;
}
.chip.active { background: var(--txt); color: #fff; font-weight: 600; }

/* 日分组 */
.day-head { color: var(--muted); font-size: 12px; margin: 16px 4px 8px; display: flex; justify-content: space-between; }

/* 图表 */
.chart-card { padding: 16px; margin-bottom: 14px; }
.chart-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.chart { width: 100%; height: 240px; }
.pie-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; font-size: 12px; color: var(--txt3); }
.pie-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* 底部导航（白底 + 细分割线，黑 FAB） */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(255,255,255,.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; align-items: stretch; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  max-width: 520px; margin: 0 auto;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 9px 0 8px; color: var(--disabled);
}
.tab span { display: flex; align-items: center; line-height: 1; }
.tab i { font-style: normal; font-size: 11px; }
.tab.active { color: var(--txt); font-weight: 600; }
.fab {
  width: 52px; height: 52px; border-radius: 50%; margin-top: -22px;
  background: var(--txt); color: #fff; font-size: 28px; font-weight: 500;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  align-self: center;
}
.fab:active { transform: scale(.94); }

/* 弹层 */
.sheet-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.43);
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-mask.show { display: flex; }
.sheet {
  width: 100%; max-width: 520px;
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
  animation: slideup .22s ease; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,.08);
}
@keyframes slideup { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-title { font-size: 17px; font-weight: 700; }

.seg { display: flex; background: var(--surface); border-radius: 10px; padding: 3px; gap: 3px; }
.seg-btn { flex: 1; padding: 8px 18px; border-radius: 8px; font-size: 14px; color: var(--txt3); }
.seg-btn.active { background: var(--txt); color: #fff; font-weight: 700; }

.rec-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.rec-row.two { grid-template-columns: 1fr 1fr; }
.cat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 2px; border-radius: 12px; border: 1.5px solid transparent;
  color: var(--txt3); font-size: 12px; background: var(--bg2);
}
.cat .ico { font-size: 22px; }
.cat.active { border-color: var(--txt); background: #fff; color: var(--txt); font-weight: 600; }

.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; color: var(--txt); font-size: 15px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--txt); background: #fff; }
.field input[type="date"] { color-scheme: light; }

.rec-amount-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 14px;
}
.rec-amount-row:focus-within { border-color: var(--txt); background: #fff; }
.cny { font-size: 24px; font-weight: 700; color: var(--muted); }
.rec-amount-row input {
  flex: 1; background: none; border: none; outline: none; color: var(--txt);
  font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 0;
}
.rec-amount-row input::placeholder { color: var(--disabled); font-weight: 400; }

.primary-btn {
  width: 100%; padding: 14px; border-radius: 999px;
  background: var(--txt); color: #fff; font-size: 16px; font-weight: 700;
}
.primary-btn:active { opacity: .8; }
.danger-btn {
  width: 100%; padding: 13px; border-radius: 999px; margin-top: 10px;
  background: #fff8f9; color: var(--neg); font-size: 15px; font-weight: 600;
}
.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-picker button {
  width: 44px; height: 44px; border-radius: 50%; background: var(--bg2);
  border: 1.5px solid transparent; display: flex; align-items: center; justify-content: center;
}
.icon-picker button.active { border-color: var(--txt); background: #fff; }
.brand-badge { display: flex; align-items: center; flex-shrink: 0; }

/* 月份选择 */
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.month-grid button {
  padding: 12px; border-radius: 10px; background: var(--bg2);
  border: 1.5px solid transparent; font-size: 14px;
}
.month-grid button.active { border-color: var(--txt); font-weight: 700; background: #fff; }

.hint { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 14px 4px; }

/* 设置页 */
.hidden-amount .hero-amount, .hidden-amount .cell-amt, .hidden-amount .acct-amt, .hidden-amount .summary-row b, .hidden-amount .hero-stats b { filter: blur(7px); }
.stat-strip { display: flex; padding: 16px 0; margin-bottom: 18px; }
.stat-strip > div { flex: 1; text-align: center; position: relative; }
.stat-strip > div + div::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px; background: var(--line);
}
.stat-strip b { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-strip i { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 4px; }
.group-title { color: var(--muted); font-size: 13px; margin: 18px 6px 8px; font-weight: 600; }
.cell-btn.nav { justify-content: flex-start; }
.nav-ico {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-ico.blue { color: #0569ff; background: #f5f9ff; }
.nav-ico.green { color: #31bd65; background: #f2fff7; }
.nav-ico.orange { color: #f5820d; background: #fef9f6; }
.nav-ico.red { color: #eb4b6d; background: #fff8f9; }
.nav-mid { flex: 1; }
.nav-mid b { display: block; font-size: 15px; font-weight: 600; }
.nav-mid i { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 3px; }
.cell-btn.nav::after {
  content: "›"; color: var(--disabled); font-size: 20px; margin-left: 4px; line-height: 1;
}
.version { text-align: center; color: var(--disabled); font-size: 12px; margin-top: 24px; }

/* 记录可点击 */
.list .cell { cursor: pointer; }
.list .cell:active { background: #ededed; }

/* 模板 chips */
.tpl-row { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.tpl-row::-webkit-scrollbar { display: none; }
.tpl-label { color: var(--muted); font-size: 12px; align-self: center; flex-shrink: 0; }
.tpl-chip {
  flex-shrink: 0; padding: 6px 12px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--line); font-size: 13px; white-space: nowrap;
}
.tpl-chip:active { background: var(--surface-pressed); }
.rec-secondary { display: flex; gap: 10px; margin-top: 10px; }
.ghost-btn {
  flex: 1; padding: 12px; border-radius: 999px;
  background: var(--bg2); color: var(--txt2); font-size: 14px; font-weight: 600;
}
.ghost-btn.danger { color: var(--neg); }

/* 首页预算卡 */
.budget-card { padding: 14px 16px; margin-top: 12px; }
.budget-empty { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--txt3); }
.budget-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.budget-top b { font-weight: 700; }
.budget-bar { height: 6px; border-radius: 3px; background: var(--bg2); overflow: hidden; margin-bottom: 8px; }
.budget-bar i { display: block; height: 100%; border-radius: 3px; transition: width .3s; }
.budget-sub { font-size: 12px; color: var(--txt3); line-height: 1.6; }

/* 月度结论 */
.concl-line { font-size: 13px; color: var(--txt2); padding: 5px 0; line-height: 1.7; }
.concl-line b { font-weight: 700; }

/* 预算弹层分类网格 */
.budget-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 14px; }
.budget-grid .bcat {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.budget-grid .bcat span { font-size: 12px; color: var(--txt3); flex: 1; white-space: nowrap; overflow: hidden; }
.budget-grid .bcat input {
  width: 66px; border: none; background: none; outline: none;
  font-size: 13px; text-align: right; color: var(--txt); font-weight: 600;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(20px);
  background: var(--inverse); color: #fff; padding: 10px 22px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
