/* Memo — 安静、温暖的视觉 */
:root {
  --bg: #f5f2ec;
  --card: #fffdf9;
  --ink: #33302a;
  --muted: #7d766a;
  --line: #e4ddcf;
  --accent: #4a7c59;
  --accent-soft: #e7efe8;
  --warm: #b96b3d;
  --warm-soft: #f6e8dd;
  --danger: #a4453f;
  --danger-soft: #f5e3e1;
  --shadow: 0 1px 3px rgba(60, 50, 30, .08), 0 8px 24px rgba(60, 50, 30, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a;
    --card: #202226;
    --ink: #e8e4dc;
    --muted: #9a948a;
    --line: #33363b;
    --accent: #82b494;
    --accent-soft: #24312a;
    --warm: #d0915f;
    --warm-soft: #33281f;
    --danger: #d47d76;
    --danger-soft: #362422;
    --shadow: 0 1px 3px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
.hidden { display: none !important; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- 锁屏 ---------- */
.lock {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lock-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.lock-logo { font-size: 40px; }
.lock-card h1 { margin: 6px 0 2px; font-size: 24px; letter-spacing: 1px; }
.lock-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.lock-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.lock-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.lock-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.lock-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  outline: none;
}
.lock-card input:focus { border-color: var(--accent); }
.lock-card button[type="submit"] {
  margin-top: 4px;
  padding: 11px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .lock-card button[type="submit"] { color: #10231a; }
}
.lock-hint { margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.link-btn {
  background: none; border: none; padding: 0; margin-top: 14px;
  color: var(--accent); font-size: 13px; cursor: pointer; text-decoration: underline;
}

/* ---------- 主框架 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.tabs button {
  border: none; background: none; cursor: pointer;
  padding: 7px 13px; border-radius: 999px;
  color: var(--muted); font-size: 14px;
}
.tabs button:hover { background: var(--accent-soft); color: var(--ink); }
.tabs button.active { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) {
  .tabs button.active { color: #10231a; }
}
.ghost-btn {
  border: 1px solid var(--line); background: none; color: var(--ink);
  padding: 6px 12px; border-radius: 10px; cursor: pointer; font-size: 13px;
  white-space: nowrap;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

.main { max-width: 880px; margin: 0 auto; padding: 22px 18px 60px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

/* ---------- 通用组件 ---------- */
.page-title { font-size: 20px; margin: 4px 0 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 10px; font-size: 15px; }
.card .sub { color: var(--muted); font-size: 13px; margin: -6px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px dashed var(--line);
}
.checklist li:last-child { border-bottom: none; }
.checklist input[type="checkbox"] { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); }
.checklist li.done span { color: var(--muted); text-decoration: line-through; }

.checks-bar { margin-top: 10px; font-size: 13px; color: var(--muted); }

.btn {
  display: inline-block;
  background: var(--accent); color: #fff;
  border: none; border-radius: 10px;
  padding: 9px 16px; font-size: 14px; cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .btn { color: #10231a; }
}
.btn.secondary { background: none; color: var(--accent); border: 1px solid var(--accent); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input[type="text"], .field input[type="password"], .field textarea, .field select {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); outline: none; resize: vertical;
}
.field textarea:focus, .field input:focus { border-color: var(--accent); }

/* ---------- 话术卡片 ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filters button {
  border: 1px solid var(--line); background: none; color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer;
}
.filters button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.search-input {
  width: 100%; max-width: 320px; margin-bottom: 12px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); outline: none;
}
.script-card .badge {
  display: inline-block; font-size: 12px; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; margin-bottom: 6px;
}
.script-card .her-line {
  border-left: 3px solid var(--warm);
  background: var(--warm-soft);
  padding: 8px 12px; border-radius: 0 8px 8px 0;
  margin: 8px 0; font-size: 14px;
}
.script-card .bad, .script-card .good { margin: 8px 0; padding-left: 0; list-style: none; font-size: 14px; }
.script-card .bad li::before { content: "✕ "; color: var(--danger); font-weight: 700; }
.script-card .good li::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.script-card .principle { margin-top: 8px; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }

/* ---------- 急救 ---------- */
.sos-card { border: 2px solid var(--danger); }
.sos-card h2 { color: var(--danger); margin: 0 0 10px; font-size: 17px; }
.sos-steps { counter-reset: step; list-style: none; margin: 0; padding: 0; }
.sos-steps li {
  counter-increment: step;
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.sos-steps li:last-child { border-bottom: none; }
.sos-steps li::before {
  content: counter(step);
  flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--danger); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.ask-script {
  background: var(--warm-soft);
  border: 1px solid var(--warm);
  border-radius: 10px; padding: 14px 16px; margin: 12px 0;
  font-size: 15px;
}
.hotline { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.hotline:last-child { border-bottom: none; }
.hotline .num { font-weight: 700; font-size: 16px; color: var(--danger); text-decoration: none; }
.hotline .note { color: var(--muted); font-size: 13px; }

/* ---------- 记录 ---------- */
.journal-item { border-top: 1px dashed var(--line); padding: 12px 0; }
.journal-item:first-child { border-top: none; }
.journal-item .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.journal-item .kv { font-size: 14px; margin: 3px 0; }
.journal-item .kv b { color: var(--muted); font-weight: 600; margin-right: 6px; font-size: 13px; }
.linklike { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; padding: 0; }

/* ---------- 学习/阶段 ---------- */
.lesson-card .num { color: var(--accent); font-weight: 700; margin-right: 6px; }
.phase-card .theme { color: var(--accent); font-size: 13px; margin-bottom: 8px; }
.phase-card ul { margin: 6px 0; padding-left: 20px; font-size: 14px; }
.phase-card h4 { margin: 10px 0 2px; font-size: 13px; color: var(--muted); }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; border: 1px solid var(--line); color: var(--muted); padding: 1px 9px; border-radius: 999px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 9px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 50; max-width: 90vw;
}

/* ---------- 恢复码 ---------- */
.recovery-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  letter-spacing: 1px;
  background: var(--bg);
  border: 1px dashed var(--warm);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  word-break: break-all;
  white-space: pre-wrap;
  text-align: center;
}
.rp-title { margin: 8px 0 4px; font-size: 16px; }
.rp-check {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  margin: 10px 0; font-size: 13px; color: var(--muted);
}
.rp-btn { width: 100%; }

@media (max-width: 640px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .main { padding: 16px 12px 50px; }
  .tabs button { padding: 6px 10px; font-size: 13px; }
}
