/* 个人金融防御训练营 —— 视觉基调:台账 + 告示牌
 *
 * 三条规则,改样式前先读:
 * 1. 红色只表示"停止"。防骗横幅、危险提示之外任何地方都不许用红色,
 *    否则用户就学不会"看到红色就停手"。
 * 2. 墨青(--seal)是结构色:标签、分隔线、强调。它不表示"好",也不表示"盈利"——
 *    这个应用里没有好消息要庆祝。
 * 3. 数字位(.figure-value)里可以放一句话。数字会误导时,用同样的位置说人话,
 *    而不是显示一个假的 0%。这是整个应用的主张,也是它的视觉签名。
 *
 * 移动端优先,基准 375×667。触控区 ≥44px。不引外部字体、不引图标库。
 */

:root {
  /* 纸与墨 */
  --paper: #e9edf1;          /* 底色:冷灰,像日光灯下的凭证纸 */
  --plate: #ffffff;          /* 卡片 */
  --plate-sunk: #f4f6f8;     /* 输入框、次级面 */
  --rule: #cfd7de;           /* 细线 */
  --rule-soft: #e3e8ed;
  --ink: #16202b;            /* 正文:蓝黑,不是纯黑 */
  --ink-soft: #5c6874;
  --ink-faint: #8794a1;

  --seal: #1f4e4a;           /* 墨青:结构色 */
  --seal-soft: #2f6b65;
  --amber: #8a5a00;          /* 值得注意,但不是危险 */
  --amber-bg: #fbf3e2;
  --stop: #a8231b;           /* 只用于"停止" */
  --stop-bg: #fbe9e7;

  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
               "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --col: 620px;              /* 阅读栏宽,桌面端底栏也用它,不拉满屏 */
  --bar: 60px;
  --pad: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f171c;
    --plate: #17222a;
    --plate-sunk: #1d2a33;
    --rule: #2c3b45;
    --rule-soft: #243139;
    --ink: #e6ecf1;
    --ink-soft: #9fb0bd;
    --ink-faint: #7c8d9a;

    --seal: #6fada4;
    --seal-soft: #8cc4bb;
    --amber: #d7a55a;
    --amber-bg: #2a2114;
    --stop: #ff8f84;
    --stop-bg: #3a1c19;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.7 var(--font-body);
}

#app {
  max-width: var(--col);
  margin: 0 auto;
  padding: 14px var(--pad) calc(var(--bar) + env(safe-area-inset-bottom) + 32px);
}

/* ── 标题:宋体做显示体,黑体做正文 ───────────────── */

h1 {
  font-family: var(--font-display);
  font-size: 25px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: .01em;
  margin: 6px 0 4px;
}

h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  margin: 0 0 12px;
  padding-bottom: 8px;
  position: relative;
}
/* 每个小节标题下一道短墨青线:全站唯一的结构母题 */
h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 26px;
  height: 2px;
  background: var(--seal);
}

h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--seal);
  margin: 22px 0 8px;
}

p { margin: 0 0 10px; }

.sub { color: var(--ink-soft); font-size: 13.5px; line-height: 1.65; }
.mins {
  font-family: var(--font-num);
  font-size: 11.5px;
  font-weight: 400;
  color: var(--ink-faint);
  letter-spacing: 0;
}

/* ── 顶部提示条:整个应用的前提,常驻首屏 ──────────── */

.banner {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
  background: var(--plate);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--seal);
  border-radius: 3px;
  padding: 13px 16px;
  margin: 0 0 18px;
}

/* ── 卡片:台账上的一页 ──────────────────────────── */

.card {
  background: var(--plate);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 16px;
  margin: 12px 0;
}

/* ── 数字位:这个应用的视觉签名 ───────────────────────
 * 一个数 + 一句白话。数字会误导时,同一个位置改放整句话。 */

.figures { display: grid; gap: 10px; }
@media (min-width: 560px) { .figures { grid-template-columns: 1fr 1fr; } }

.figure {
  background: var(--plate);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 14px 16px;
}

.figure-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--seal);
  margin-bottom: 6px;
}

.figure-value {
  font-family: var(--font-num);
  font-size: 29px;
  line-height: 1.2;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  word-break: break-word;
}
.figure-unit { font-family: var(--font-body); font-size: 15px; font-weight: 400; color: var(--ink-soft); }

/* 数字位里放句子:换成显示体,字号降到能读,颜色跟着语义走 */
.figure-value.is-words {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: 0;
}
.figure.tone-stop .figure-value { color: var(--stop); }
.figure.tone-watch .figure-value { color: var(--amber); }

.figure-note {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule-soft);
}

/* 续航刻度尺:唯一的图形元素。它是一把尺,不是图表 */
.ruler { margin-top: 12px; }
.ruler-track {
  position: relative;
  height: 22px;
  border-bottom: 1px solid var(--rule);
}
.ruler-tick { position: absolute; bottom: 0; width: 1px; height: 6px; background: var(--rule); }
.ruler-tick.major { height: 11px; background: var(--ink-faint); }
.ruler-threshold { position: absolute; bottom: 0; width: 1px; height: 22px; background: var(--stop); opacity: .5; }
.ruler-mark {
  position: absolute;
  bottom: 3px;
  width: 3px;
  height: 19px;
  background: var(--seal);
  transform: translateX(-1px);
}
.ruler-mark.past-limit { background: var(--stop); }
.ruler-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* ── 表单 ────────────────────────────────────────── */

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field-hint { display: block; font-size: 12px; line-height: 1.55; color: var(--ink-faint); margin-top: 5px; }

input[type="text"], input[type="date"], input[type="file"], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: 16px/1.5 var(--font-body);
  color: var(--ink);
  background: var(--plate-sunk);
  border: 1px solid var(--rule);
  border-radius: 3px;
  appearance: none;
}
input[inputmode="decimal"] { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
                    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
textarea { min-height: 68px; resize: vertical; line-height: 1.6; }
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 44px;
  padding: 7px 0;
  font-size: 15px;
  line-height: 1.55;
  cursor: pointer;
}
.check input { width: 21px; height: 21px; margin: 9px 0 0; flex: none; accent-color: var(--seal); }
.danger-check input { accent-color: var(--stop); }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.form-hint { display: none; }
.form-hint.show {
  display: block;
  font-size: 13px;
  line-height: 1.6;
  color: var(--amber);
  background: var(--amber-bg);
  border-left: 3px solid var(--amber);
  padding: 9px 12px;
  border-radius: 0 3px 3px 0;
  margin-top: 8px;
}

/* ── 按钮 ────────────────────────────────────────── */

button, .btn {
  min-height: 44px;
  padding: 10px 18px;
  font: 600 15px/1.4 var(--font-body);
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--plate);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .12s, border-color .12s;
}
button:hover, .btn:hover { border-color: var(--seal); }
button.primary, .btn.primary { background: var(--seal); border-color: var(--seal); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--seal-soft); border-color: var(--seal-soft); }
button.danger { color: var(--stop); border-color: var(--stop); }
button.ghost { background: transparent; }

@media (prefers-color-scheme: dark) {
  button.primary, .btn.primary { color: #0f171c; }
}

/* ── 行卡片(三张表)─────────────────────────────── */

.rows { list-style: none; margin: 0; padding: 0; }
.row-card {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.row-card:last-child { border-bottom: 0; }
.row-card.editing {
  background: var(--plate-sunk);
  border-left: 3px solid var(--seal);
  border-radius: 0 3px 3px 0;
  padding-inline: 10px;
}
.row-main { min-width: 0; flex: 1; }
.row-title { font-weight: 700; font-variant-numeric: tabular-nums; }
.row-line { font-size: 13px; line-height: 1.6; color: var(--ink-soft); word-break: break-word; }
.row-ops { display: flex; gap: 8px; flex: none; flex-wrap: wrap; }
.row-ops.top { margin: 12px 0; }
.row-ops button { min-height: 44px; padding: 8px 13px; font-size: 13.5px; font-weight: 500; }

.summary {
  background: var(--plate);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--seal);
  border-radius: 3px;
  padding: 13px 16px;
}
.summary p { margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.summary p:last-child { margin: 0; }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-soft);
}
ul.plain li:last-child { border-bottom: 0; }
.li-label { font-size: 14.5px; color: var(--ink-soft); }
.li-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  margin-left: auto;
  white-space: nowrap;
}
.li-note { flex-basis: 100%; font-size: 12.5px; line-height: 1.6; color: var(--ink-faint); }

.empty { color: var(--ink-faint); font-size: 14px; }
.warn-line { color: var(--amber); font-size: 13.5px; margin: 8px 0 0; }

/* ── 语义色块 ────────────────────────────────────── */

.danger-box {
  background: var(--stop-bg);
  color: var(--stop);
  border: 1px solid var(--stop);
  border-radius: 3px;
  padding: 13px 15px;
  font-weight: 600;
  line-height: 1.6;
}
.danger-box ul { margin: 8px 0 0; padding-left: 20px; font-weight: 400; }
.ok-box {
  background: var(--plate-sunk);
  border-left: 3px solid var(--seal);
  border-radius: 0 3px 3px 0;
  padding: 12px 15px;
}
.ok-box p:last-child { margin: 0; }
.done-sub { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; }
.caveat { font-size: 12.5px; line-height: 1.6; color: var(--amber); }
.footer-note {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-faint);
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

/* ── 停止告示牌:全站唯一的大面积红色 ─────────────── */

.stop-banner {
  background: var(--stop);
  color: #fff;
  border-radius: 4px;
  padding: 16px;
  margin: 14px 0;
}
.stop-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 12px;
}
.stop-sub { font-size: 12.5px; margin: 10px 0 0; opacity: .88; }
.stop-banner .hotlines li { border-color: rgba(255, 255, 255, .28); }
.stop-banner .hotlines span { color: rgba(255, 255, 255, .85); }

.hotlines { list-style: none; margin: 0; padding: 0; }
.hotlines li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.hotlines li:last-child { border-bottom: 0; }
.hotlines span { font-size: 14px; color: var(--ink-soft); }
.hotlines b { font-family: var(--font-num); font-size: 18px; font-variant-numeric: tabular-nums; }

/* ── 今日学习 ────────────────────────────────────── */

.today-meta { font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--seal); }
.today-title {
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1.3;
  font-weight: 700;
  margin: 8px 0 10px;
}
.today-plan {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-family: var(--font-num);
  font-size: 11.5px;
  color: var(--ink-faint);
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--rule-soft);
}
.today-plan span:not(:last-child)::after { content: "·"; margin-left: 10px; color: var(--rule); }

.conclusion { font-family: var(--font-display); font-size: 18px; line-height: 1.6; font-weight: 700; margin: 0; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 9px; line-height: 1.7; }
.answer {
  background: var(--plate-sunk);
  border-left: 3px solid var(--seal);
  border-radius: 0 3px 3px 0;
  padding: 12px 14px;
  margin-top: 14px;
}

.quiz { border-top: 1px solid var(--rule-soft); padding-top: 14px; margin-top: 14px; }
.quiz:first-of-type { border-top: 0; padding-top: 0; }
.quiz-text { font-weight: 600; line-height: 1.65; }
.quiz-ops { display: flex; gap: 10px; }
.quiz-ops button { min-width: 78px; }
.quiz-ops button.chosen { border-color: var(--ink-soft); }
.quiz-ops button.right { background: var(--plate-sunk); color: var(--seal); border-color: var(--seal); }
.quiz-ops button.wrong { background: var(--stop-bg); color: var(--stop); border-color: var(--stop); }
.quiz-why {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--rule);
}

.toc { list-style: none; margin: 12px 0 0; padding: 0; }
.toc button { width: 100%; justify-content: flex-start; text-align: left; margin-bottom: 6px; font-size: 13.5px; font-weight: 500; }
.toc button.done { color: var(--ink-faint); }
summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; font-size: 15px; }

/* ── 拆解器 ──────────────────────────────────────── */

/* 结果区数字用「左标签右数值」的行式排版:三栏在 375px 下会把 10,220.96 折行 */
.figures.compact { display: block; }
.figures.compact .figure {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 15px;
  margin-bottom: 8px;
}
.figures.compact .figure-label { margin: 0; flex: none; letter-spacing: .06em; }
.figures.compact .figure-value { font-size: 20px; text-align: right; }
.figures.compact .figure-value.headline { font-size: 23px; color: var(--seal); }

.sched { list-style: none; margin: 0; padding: 0; font-family: var(--font-num); font-size: 12.5px; }
.sched li {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-variant-numeric: tabular-nums;
}
.sched li:last-child { border-bottom: 0; }
.sched .p { font-weight: 700; min-width: 58px; color: var(--seal); }

.trap {
  border-left: 3px solid var(--amber);
  background: var(--amber-bg);
  border-radius: 0 3px 3px 0;
  padding: 11px 14px;
  margin-bottom: 12px;
}
.trap-label { font-weight: 700; font-size: 14.5px; }
.trap-value { font-family: var(--font-num); font-size: 12.5px; color: var(--ink-soft); margin: 3px 0 7px; }
.trap p { margin: 0; font-size: 13.5px; line-height: 1.7; }

.per-period { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.per-period label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.per-period span { flex: none; color: var(--ink-faint); font-family: var(--font-num); }

.jump { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.jump a {
  color: var(--seal);
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px 0 0;
}

/* ── 底部导航:桌面端跟正文同宽,不拉满屏 ──────────── */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--col);
  display: flex;
  background: var(--plate);
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
/* 纯文字标签:两个汉字比灰掉的 emoji 好认,也省掉一套图标资产 */
.tabbar a {
  flex: 1;
  min-height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .16em;
  text-indent: .16em;
  color: var(--ink-faint);
  text-decoration: none;
  border-top: 2px solid transparent;
  border-radius: 5px 5px 0 0;
}
.tabbar a.active { color: var(--seal); border-top-color: var(--seal); background: var(--plate-sunk); }

/* ── toast ───────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar) + env(safe-area-inset-bottom) + 18px);
  transform: translateX(-50%) translateY(10px);
  max-width: min(90vw, 480px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 17px;
  border-radius: 3px;
  font-size: 14px;
  line-height: 1.55;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--stop); color: #fff; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ── 分段导航:四张表是同一件事的四个视角 ─────────── */

.subnav {
  display: flex;
  gap: 2px;
  background: var(--plate-sunk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 3px;
  margin-bottom: 14px;
  overflow-x: auto;
}
.subnav a {
  flex: 1;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 3px;
}
.subnav a.active { background: var(--plate); color: var(--seal); box-shadow: 0 1px 2px rgba(0, 0, 0, .07); }

/* 按当前取值隐藏没有意义的字段(比如负债的"能立即动用") */
.field-wrap[hidden] { display: none; }

/* ── 判断题反馈:说人话,不靠颜色 ──────────────────── */

.quiz-verdict {
  font-weight: 700;
  font-size: 14.5px;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 3px;
}
.quiz-verdict.ok { background: var(--plate-sunk); color: var(--seal); border-left: 3px solid var(--seal); }
/* 答错用琥珀色而不是红色:红色在这个应用里专门表示"停止操作" */
.quiz-verdict.no { background: var(--amber-bg); color: var(--amber); border-left: 3px solid var(--amber); }
.quiz-ops button.is-answer { border-color: var(--seal); border-width: 2px; }

/* ── 只读模式横幅 ────────────────────────────────── */

.blocked-bar {
  background: var(--amber-bg);
  border: 1px solid var(--amber);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 16px;
  color: var(--ink);
}
.blocked-bar p { font-size: 14px; line-height: 1.65; }
