/* ============================================================
   日用笺 · 设计语言层
   叠在 style.css 之上，只改"长相"不动结构。
   色板 / 字号 / 间距 / 圆角 全部来自《日用笺-设计语言规范 v1.0》
   ============================================================ */

:root {
  --paper: #f6f3eb;
  --paper-raised: #fffcf6;
  --paper-inset: #ece7dc;
  --ink: #302e29;
  --ink-2: #6b675f;
  --line: #ddd6c9;
  --control: #898276;
  --brand: #a64b3c;
  --brand-hover: #8f3f32;
  --brand-tint: #f0e2db;
  --income: #526c5a;
  --warning: #876331;
  --danger: #a13630;
  --mask: rgba(48, 46, 41, 0.32);

  /* 兼容旧变量 */
  --bg: var(--paper);
  --card: var(--paper);
  --muted: var(--ink-2);
  --accent: var(--brand);
  --accent-dark: var(--brand-hover);
  --soft: var(--brand-tint);
  --radius: 12px;
  --shadow: none;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-sheet: 20px;

  --f-title: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --f-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", system-ui, sans-serif;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg.ico {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
svg.ico.sm {
  width: 18px;
  height: 18px;
  stroke-width: 1.7;
}
svg.ico.xs {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

/* ---------- 底色与纸纹 ---------- */

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

#app,
#sheet-root,
#voice-root {
  position: relative;
  z-index: 1;
}

#app {
  max-width: 520px;
  padding: 0 20px 120px;
}

/* ---------- 标题与数字 ---------- */

h1,
h2,
.brand,
.section-title,
.hero-label,
.page-title {
  font-family: var(--f-title);
}

.page-head {
  padding: 18px 0 12px;
  min-height: 56px;
}

.page-head .brand {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* 任何金额都用等宽数字 */
.hero-amount,
.amount-line,
.tx-amt,
.donut-num,
.tri b,
.kpi b,
.spark-amt {
  font-variant-numeric: tabular-nums lining-nums;
}

/* ---------- 卡片：从"厚卡片"变成"细线分节" ---------- */

.card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 28px;
}

.card-head {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.card-head span:first-child {
  font-family: var(--f-title);
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.section-title {
  font-size: 15px;
  color: var(--ink);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

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

.small {
  font-size: 13px;
  line-height: 20px;
}

.link {
  color: var(--brand);
  text-decoration: none;
}

.link.danger,
.danger {
  color: var(--danger);
}

/* ---------- 顶部控件 ---------- */

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 18px;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.book-pill,
.meta-chip,
.now-btn {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: none;
  color: var(--ink);
  font-size: 15px;
}

.topbar .monthbar {
  gap: 2px;
}

.topbar .monthbar > span {
  font-family: var(--f-title);
  font-size: 17px;
  letter-spacing: 0.02em;
}

/* 分段控件：文字 + 朱砂底线 */
.seg {
  background: transparent;
  border-radius: 0;
  padding: 0;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  width: 100%;
}

.seg button {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 10px 0 9px;
  font-size: 15px;
  color: var(--ink-2);
  position: relative;
  flex: 0 0 auto;
}

.seg button.on {
  color: var(--ink);
  font-weight: 600;
  background: transparent;
  box-shadow: none;
}

.seg button.on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}

.seg.wide {
  gap: 0;
}

.seg.wide button {
  flex: 1;
}

/* 需要"胶囊"观感的地方（月/年）保留小块 */
.seg.pill {
  background: var(--paper-inset);
  border: 0;
  border-radius: var(--r-md);
  padding: 3px;
  gap: 3px;
}

.seg.pill button {
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 14px;
}

.seg.pill button.on {
  background: var(--paper-raised);
  box-shadow: none;
}

.seg.pill button.on::after {
  display: none;
}

/* ---------- 账本页 ---------- */

.hero {
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  box-shadow: none;
  padding: 6px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.hero-label {
  color: var(--ink-2);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.hero-amount {
  color: var(--ink);
  font-size: 40px;
  line-height: 48px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 4px 0 6px;
}

.hero-amount .cny {
  font-size: 22px;
  color: var(--ink-2);
  margin-right: 2px;
}

.hero-sub {
  color: var(--ink-2);
  font-size: 14px;
}

.hero-delta {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--paper-inset);
  color: var(--ink-2);
  font-size: 12.5px;
}

.spark {
  margin-top: 14px;
}

.spark-bar {
  background: var(--paper-inset);
}

.spark-bar.on {
  background: var(--ink);
}

/* 今天这一行 */
.today-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.today-row .lbl {
  font-family: var(--f-title);
  font-size: 15px;
  color: var(--ink-2);
}

.today-row .val {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.today-row .cnt {
  font-size: 13px;
  color: var(--ink-2);
  margin-left: auto;
}

/* 预算条 */
.budget-line {
  padding: 14px 0 0;
}

.budget-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 7px;
}

.budget-top b {
  color: var(--ink);
  font-weight: 600;
}

.budget-track {
  height: 4px;
  border-radius: 2px;
  background: var(--paper-inset);
  overflow: hidden;
}

.budget-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 2px;
}

.budget-fill.warn {
  background: var(--warning);
}

.budget-fill.over {
  background: var(--danger);
}

/* 账单行 */
.day-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 6px;
}

.day-head {
  padding: 14px 0 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
}

.day-head b {
  font-family: var(--f-title);
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  margin-right: 8px;
}

.tx-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  min-height: 68px;
}

.tx-ico {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper-inset);
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tx-main {
  font-size: 16px;
  line-height: 24px;
  color: var(--ink);
}

.tx-sub {
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-2);
}

.tx-amt {
  font-size: 18px;
  line-height: 26px;
  font-weight: 500;
  color: var(--ink);
}

.tx-amt.in {
  color: var(--income);
}

/* 分类排行行 */
.cat-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cat-bar {
  background: var(--paper-inset);
}

.cat-bar > i {
  background: var(--ink);
}

.empty {
  color: var(--ink-2);
  font-size: 14px;
  padding: 28px 0;
}

/* ---------- 底部导航 ---------- */

.tabbar {
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: none;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}

.tabbar > button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 16px;
  background: transparent;
}

.tabbar > button svg.ico {
  width: 24px;
  height: 24px;
  stroke-width: 1.6;
}

.tabbar > button.on {
  color: var(--ink);
  font-weight: 600;
}

.tabbar > button.on::before {
  content: "";
  position: absolute;
  top: 0;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.tabbar > button {
  position: relative;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--paper-raised);
  border: 0;
  box-shadow: none;
  right: 20px;
  bottom: calc(84px + env(safe-area-inset-bottom));
}

.fab svg.ico {
  width: 26px;
  height: 26px;
  stroke-width: 2;
}

.fab:active {
  background: var(--brand-hover);
}

/* ---------- 记账面板 ---------- */

.sheet {
  background: var(--paper);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: 0 8px 32px rgba(48, 46, 41, 0.1);
}

.sheet-head {
  padding: 14px 20px 6px;
}

.sheet-head .link {
  font-size: 15px;
}

.sheet-head .seg.pill {
  background: var(--paper-inset);
}

.amount-box {
  padding: 6px 0 4px;
}

.amount-line {
  font-size: 48px;
  line-height: 56px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.amount-line .cny {
  font-size: 22px;
  color: var(--ink-2);
}

.amount-expr {
  font-size: 14px;
  color: var(--ink-2);
  min-height: 20px;
}

.cat-strip {
  padding: 8px 0 4px;
}

.cat-chip {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: none;
  width: 62px;
  padding: 8px 0 6px;
}

.cat-chip .ico,
.cat-chip .em {
  font-size: 20px;
  line-height: 24px;
}

.cat-chip .nm {
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-2);
  margin-top: 3px;
}

.cat-chip.on {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.cat-chip.on .nm {
  color: var(--brand-hover);
  font-weight: 600;
}

.cat-strip.sub .cat-chip {
  width: auto;
  min-width: 64px;
  padding: 7px 14px;
  border-radius: 999px;
  background: transparent;
  border-color: var(--line);
}

.cat-strip.sub .cat-chip.on {
  background: var(--brand-tint);
  border-color: var(--brand);
}

.sheet-meta {
  padding: 8px 0 4px;
}

.meta-chip,
.date-chip {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: none;
  font-size: 14px;
  padding: 8px 12px;
}

input.note-row {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 2px;
  font-size: 16px;
}

input.note-row:focus {
  border-bottom-color: var(--brand);
  outline: none;
}

.keyops {
  gap: 8px;
}

.key,
.keyops .op,
.keyops .eq {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: none;
  font-size: 22px;
  color: var(--ink);
}

.keyops .op {
  background: var(--paper-inset);
  border-color: transparent;
  color: var(--ink-2);
}

.keyops .eq {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.key:active,
.keyops .op:active {
  background: var(--paper-inset);
}

/* 语音确认卡 */
.vr-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(48, 46, 41, 0.1);
}

/* ---------- 分析页 ---------- */

.tri {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.tri b {
  font-family: var(--f-title);
  font-size: 26px;
  line-height: 34px;
}

.rate-line {
  color: var(--ink-2);
  font-size: 13px;
}

.rate-bar {
  background: var(--paper-inset);
}

.rate-bar > i {
  background: var(--ink);
}

.chart-card,
.ai-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.donut-num {
  font-family: var(--f-title);
  font-size: 22px;
}

.insight-card {
  background: var(--paper-inset);
  border-radius: var(--r-lg);
  padding: 16px;
}

/* ---------- 弹层 / 列表 / 表单 ---------- */

.books-sheet {
  background: var(--paper);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
}

.book-row,
.row-link,
.sub-group,
.cat-manage li,
.tag-manage li {
  border-bottom: 1px solid var(--line);
}

.row-link {
  padding: 16px 0;
  font-size: 16px;
}

.quick-btn {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: none;
  color: var(--ink);
  font-size: 15px;
  min-height: 44px;
}

.quick-btn.primary,
.quick-btn.danger.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.quick-btn.danger {
  color: var(--danger);
}

.field input,
.field select,
.field textarea,
input[type="search"],
input[type="text"],
input[type="number"],
input[type="date"] {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 16px;
  color: var(--ink);
}

.badge {
  background: var(--paper-inset);
  color: var(--ink-2);
  border-radius: var(--r-sm);
  font-size: 12px;
}

.badge.on {
  background: var(--brand-tint);
  color: var(--brand-hover);
}

/* 浮动提示 */
#toast {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(48, 46, 41, 0.18);
  font-size: 14px;
}

/* 日历 */
.cal-cell {
  border-radius: var(--r-sm);
  font-size: 14px;
}

.cal-cell.has {
  background: var(--paper-inset);
}

.cal-cell.sel {
  background: var(--ink);
  color: var(--paper);
}

.cal-cell.today {
  box-shadow: inset 0 0 0 1.5px var(--brand);
}

.cdot {
  background: var(--brand);
}

/* 未完成的小细节 */
.spacer {
  height: 12px;
}

.now-btn {
  font-size: 13px;
  padding: 6px 10px;
}

/* ---------- 布局修正 ---------- */

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 10px 0 4px;
}

.topbar .monthbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
}

.topbar .monthbar > span {
  font-size: 16px;
  white-space: nowrap;
  padding: 0 4px;
}

.topbar .icon-btn {
  width: 34px;
  height: 34px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}

.topbar .book-pill {
  padding: 6px 10px;
  font-size: 14px;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-head .brand {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-head .seg.pill {
  flex: none;
  border: 0;
  width: auto;
}

.sheet-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.sheet-head .seg {
  width: auto;
  border: 0;
  justify-self: center;
}

.sheet-head .link {
  white-space: nowrap;
  font-size: 15px;
  padding: 8px 0;
}

/* 迷你趋势 */
.mini-bars .mb-col i {
  background: var(--line);
  border-radius: 3px 3px 0 0;
}

.mini-bars .mb-col:last-child i {
  background: var(--ink);
}

.mini-bars .mb-col span {
  color: var(--ink-2);
  font-size: 11px;
}

/* 图表配色：支出浓墨、收入松绿 */
.dual-bars .db-e {
  background: var(--ink);
}

.dual-bars .db-i {
  background: var(--income);
  opacity: 0.55;
}

.bars .bar {
  background: var(--ink);
}

.tri b.in {
  color: var(--income);
}

.tri b.out {
  color: var(--ink);
}

.rate-bar > i {
  background: var(--ink);
}

.cat-rows .cat-bar > i,
.cat-row .cat-bar > i {
  background: var(--ink);
}

/* 次要按钮 / 分类添加 */
.quick-btn.ghost,
.cat-add .quick-btn {
  background: transparent;
  border-color: var(--control);
}

.cat-manage .quick-btn,
.sub-manage .quick-btn {
  min-height: 40px;
  padding: 0 14px;
}

/* 分类选择器 */
.cat-picker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 74%;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: 0 -8px 32px rgba(48, 46, 41, 0.12);
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
  overflow: auto;
  z-index: 5;
}

.cp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.cp-head b {
  font-family: var(--f-title);
  font-size: 16px;
}

.cp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.cp-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--ink);
}

.cp-cell .ico {
  font-size: 22px;
  line-height: 24px;
}

.cp-cell.on {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-hover);
  font-weight: 600;
}

.cat-chip.more .ico {
  color: var(--ink-2);
}

/* 金额 / 结余的负值：不染红 */
.hero-sub .neg,
.tri b.out {
  color: var(--ink);
}

/* 我的页入口 */
.rows {
  border-top: 1px solid var(--line);
  margin-bottom: 24px;
}

.row-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 0;
  min-height: 56px;
  font-size: 16px;
  color: var(--ink);
}

.rl-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rl-left svg.ico {
  color: var(--ink-2);
}

.rl-right {
  color: var(--ink-2);
  font-size: 14px;
}

.footer-note {
  text-align: center;
  padding: 20px 0 0;
}

/* 预算页 */
.budget-set {
  display: flex;
  align-items: baseline;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0 10px;
}

.budget-set .cny {
  font-size: 20px;
  color: var(--ink-2);
}

.budget-set input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 32px;
  font-family: var(--f-title);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 0;
  min-width: 0;
}

.budget-set input:focus {
  outline: none;
}

.budget-track.big {
  height: 8px;
  border-radius: 4px;
  margin: 6px 0 16px;
}

.budget-facts {
  display: flex;
  gap: 8px;
}

.budget-facts > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.budget-facts b {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* FAB 定位兜底 */
.fab {
  left: auto;
  position: fixed;
  z-index: 25;
}

/* 面板内边距收紧 */
.sheet .amount-box {
  margin-top: 0;
  padding-top: 2px;
}

.sheet .sheet-head {
  padding-bottom: 0;
}

.sheet .pad {
  margin-top: auto;
}

/* 欢迎页品牌 */
.welcome .brand,
.welcome h1 {
  font-family: var(--f-title);
}

.budget-track > i,
.rate-bar > i,
.cat-bar > i {
  display: block;
}

body.locked .fab {
  display: none;
}

.rate-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
}

.rate-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.rate-bar > i {
  height: 100%;
  border-radius: 2px;
}

/* 页头标题不要被细分段挤没 */
.page-head .brand {
  flex: 0 1 auto;
  min-width: 3.6em;
}

.page-head .seg.pill {
  margin-left: auto;
}

/* 图表统一用墨色 */
.bar,
.bars .bar,
.chart .bar {
  background: var(--ink);
  opacity: 1;
  border-radius: 3px 3px 0 0;
}

.new-cat .quick-btn {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* 搜索 */
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0 12px;
  height: 44px;
  min-width: 0;
}

.search-box svg.ico {
  color: var(--ink-2);
}

.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--ink);
  padding: 0;
  min-width: 0;
}

.search-box input:focus {
  outline: none;
}

.daybars i {
  background: var(--ink);
  opacity: 0.78;
  border-radius: 2px 2px 0 0;
}

.daybars i.zero {
  background: var(--paper-inset);
  opacity: 1;
}

body.no-fab .fab {
  display: none;
}

.tx-list.flat .tx {
  border-bottom: 1px solid var(--line);
}

/* 欢迎页 */
.welcome {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 8px;
  background: transparent;
}

.welcome-mark {
  margin-bottom: 18px;
}

.welcome-mark .mark {
  width: 56px;
  height: 56px;
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.welcome h1 {
  font-family: var(--f-title);
  font-size: 30px;
  line-height: 40px;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  color: var(--ink);
}

.welcome-sub {
  color: var(--ink-2);
  font-size: 15px;
  margin: 0 0 32px;
}

.welcome-actions {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.welcome-actions .quick-btn {
  height: 48px;
  font-size: 16px;
}

.welcome-hint {
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 22px;
  max-width: 300px;
}


/* 底部导航必须固定在视口底部（上面的 z-index 分组不能改它的 position） */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
}

.fab {
  position: fixed;
  z-index: 31;
}

/* 修掉旧的居中技巧与新定位冲突 */
.tabbar {
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  height: calc(62px + env(safe-area-inset-bottom));
  padding: 6px 0 calc(8px + env(safe-area-inset-bottom));
  align-items: start;
}

.tabbar > button {
  min-height: 48px;
  justify-content: flex-start;
  padding-top: 2px;
}

/* 分类预算 */
.budget-cats li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.bc-ico {
  width: 28px;
  text-align: center;
  font-size: 17px;
}

.bc-name {
  flex: 1;
  font-size: 15px;
}

.bc-input {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}

.bc-input .cny {
  color: var(--ink-2);
  font-size: 13px;
}

.bc-input input {
  width: 78px;
  border: 0;
  background: transparent;
  text-align: right;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: 0;
}

.bc-input input:focus {
  outline: none;
}

/* 分类详情里的预算行 */
.cat-budget {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
}

.cat-budget .budget-track {
  flex: 1;
  background: rgba(255, 255, 255, 0.25);
}

.cat-budget .budget-fill {
  background: #fff;
}

.cat-budget.over {
  color: #ffd9d0;
}

.cat-budget.over .budget-fill {
  background: #ffb4a3;
}

/* 可撤销的 toast */
#toast.action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 8px;
}

#toast .toast-act {
  background: transparent;
  border: 0;
  color: #f0c9b8;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 8px;
  white-space: nowrap;
}

/* 分类详情：预算行改用墨色（hero 不再是色块） */
.cat-budget {
  color: var(--ink-2);
  padding-top: 8px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.cat-budget .budget-track {
  background: var(--paper-inset);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.cat-budget .budget-fill {
  background: var(--ink);
}

.cat-budget.over {
  color: var(--danger);
}

.cat-budget.over .budget-fill {
  background: var(--danger);
}

/* 分类详情工具行 */
.cat-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 16px;
}

.cat-tools input.cat-search {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--paper-raised);
  font-size: 15px;
}

.cat-tools .seg {
  flex: none;
  width: auto;
  border-bottom: 0;
  gap: 14px;
}

.cat-tools .seg button {
  padding: 8px 0;
}

/* 所有分类条形统一墨色 */
.note-bar,
.cat-bar {
  background: var(--paper-inset);
}

.note-bar > i,
.cat-bar > i,
.note-list .note-bar i {
  background: var(--ink);
}

/* 合并后的分类详情：两段之间用细线分隔 */
.card > .note-list + .card-head {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* 收紧分析页图表上下留白 */
.chart-donut,
.donut-wrap {
  margin: 4px auto 12px;
}

.card-head + .chart-donut,
.card-head + .donut-wrap {
  margin-top: 0;
}

/* 图表容器留白（按实际类名） */
.chart-row.center {
  justify-content: center;
  margin: 6px 0 14px;
}

.chart-row.center + .chart-legend.full {
  margin-top: 0;
}

/* 收紧页头与分段之间的空档 */
.ledger .seg,
#app .seg.wide {
  margin: 10px 0 18px;
}

.hero + .seg.wide {
  margin-top: 16px;
}

.ai-card .row-link {
  border-bottom: 0;
  padding: 12px 0;
}

.ai-card {
  margin-bottom: 18px;
}

/* 页面底部留出悬浮按钮的位置 */
#app {
  padding-bottom: 104px;
}

.chat-entry {
  display: none;
}

/* 最后一行的右侧文字让开悬浮按钮 */
#app > .card:last-of-type .row-link,
#app > section:last-of-type .row-link {
  padding-right: 68px;
}
