:root {
  --paper: #f7f2e7;
  --paper-deep: #efe8d8;
  --card: #fffdf8;
  --ink: #1c1b18;
  --ink-soft: #4a463c;
  --lead: #6b6257;
  --faint: #98907f;
  --cinnabar: #b23a2e;   /* 朱批红，涨/待办强调 */
  --indigo: #2e4a66;     /* 线装书封皮青，次强调 */
  --green: #2f7d4f;      /* 跌 - 绿 */
  --rule: #e4dccb;       /* 账页分隔线 */
  --shadow: 0 1px 2px rgba(28, 27, 24, .04), 0 4px 16px rgba(28, 27, 24, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶栏 ===== */
.ledger-head {
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  padding: 18px 20px 16px;
  position: sticky; top: 0; z-index: 20;
}
.ledger-head-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.book-title {
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 22px; font-weight: 700; margin: 0; letter-spacing: 1px;
}
.book-sub { margin: 4px 0 0; color: var(--faint); font-size: 13px; }
.today {
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 20px; color: var(--cinnabar); font-weight: 700;
  text-align: right; line-height: 1.3;
}
.today small {
  display: block; font-family: inherit; font-size: 12px;
  color: var(--faint); font-weight: 400;
}

/* ===== 页面 ===== */
.page { max-width: 720px; margin: 0 auto; padding: 20px 16px 32px; }

/* ===== 卡片通用 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 0;
}
.card-title {
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 15px; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: ""; width: 14px; height: 3px; background: var(--cinnabar);
  border-radius: 1px; flex: none;
}
.card-count { font-size: 12px; color: var(--faint); }

/* ===== 今日账：三张摘要卡 ===== */
.summary-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.summary-card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 12px; padding: 14px 12px;
  box-shadow: var(--shadow);
}
.summary-card.hot { border-color: var(--cinnabar); }
.summary-label {
  font-size: 12px; color: var(--faint);
  margin-bottom: 6px; letter-spacing: 1px;
}
.summary-value {
  font-size: 17px; font-weight: 700; color: var(--ink);
  line-height: 1.3;
}
.summary-value.accent { color: var(--cinnabar); }
.summary-sub { font-size: 11px; color: var(--faint); margin-top: 4px; }

/* ===== 列表 ===== */
.ledger-list { display: flex; flex-direction: column; }
.ledger-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--rule);
}
.ledger-row:last-child { border-bottom: none; }
.row-left { min-width: 0; flex: 1; }
.row-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.row-meta { font-size: 12px; color: var(--faint); margin-top: 2px; }
.row-right { text-align: right; flex: none; }
.row-val { font-size: 15px; font-weight: 700; white-space: nowrap; }
.row-val.up { color: var(--cinnabar); }
.row-val.down { color: var(--green); }
.row-val.flat { color: var(--lead); font-weight: 600; }
.row-val small { font-size: 11px; font-weight: 500; }

/* 状态徽章 */
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 999px; white-space: nowrap; font-weight: 500;
}
.badge.idle { background: #efe9db; color: #8a8170; }
.badge.running { background: #e7f0f6; color: var(--indigo); }
.badge.success { background: #e9f4ec; color: var(--green); }
.badge.failed { background: #fbe9e6; color: var(--cinnabar); }

/* ===== 入口 ===== */
.entry-cta {
  margin-top: 24px; padding: 22px 16px;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 14px; text-align: center; box-shadow: var(--shadow);
}
.btn {
  display: inline-block; background: var(--ink); color: var(--paper);
  padding: 12px 30px; font-size: 15px; font-weight: 600; text-decoration: none;
  border-radius: 8px; transition: background .15s, transform .1s;
}
.btn:active { background: var(--indigo); transform: scale(.98); }
.btn-note { margin-top: 10px; color: var(--faint); font-size: 12px; }

/* ===== 页脚 ===== */
.foot { text-align: center; padding: 8px 20px 36px; color: var(--faint); font-size: 12px; }

@media (max-width: 520px) {
  .book-title { font-size: 20px; }
  .today { font-size: 18px; }
  .summary-value { font-size: 15px; }
  .summary-grid { gap: 8px; }
}
