/* 勾勾条 · 水墨风格：宣纸底、墨色字、朱砂印章、宋体标题 */
:root {
  --bg: #f3efe6;
  --card: #fbf9f4;
  --ink: #1f1d1a;
  --ink-2: #3a3631;
  --sub: #6f6a61;
  --faint: #a39c8f;
  --line: #ddd5c6;
  --line-2: #e9e3d6;
  --cinnabar: #b5362a;
  --cinnabar-d: #93281e;
  --cinnabar-l: #f6e6e0;
  --jade: #3d6b4f;
  --serif: 'TB Serif', 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
  --sans: 'TB Sans', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --r: 6px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(rgba(60, 45, 20, 0.035) 1px, transparent 1.2px);
  background-size: 5px 5px;
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cinnabar); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 表单 ---------- */
button { white-space: nowrap; flex-shrink: 0; font: 600 14px/1 var(--sans); cursor: pointer; border: 1px solid var(--ink); border-radius: var(--r); padding: 10px 16px; background: var(--ink); color: var(--card); letter-spacing: 0.5px; transition: background 0.15s, color 0.15s; }
button:hover { background: var(--ink-2); }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; color: var(--ink); }
button.ghost:hover { background: rgba(31, 29, 26, 0.05); }
button.danger { background: transparent; color: var(--cinnabar); border-color: var(--cinnabar); }
button.danger:hover { background: var(--cinnabar-l); }
button.small { padding: 7px 11px; font-size: 13px; }
button:disabled { opacity: 0.45; cursor: default; }
input, textarea, select { font: 15px/1.5 var(--sans); width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fffdf8; color: var(--ink); }
textarea { resize: vertical; min-height: 66px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31, 29, 26, 0.07); }
label { display: block; font-size: 13px; color: var(--sub); margin: 12px 0 5px; }

/* ---------- 框架 ---------- */
.app { max-width: 760px; margin: 0 auto; padding: 0 16px 104px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 14px 0 12px; background: rgba(243, 239, 230, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo i { width: 32px; height: 32px; border-radius: 5px; background: var(--cinnabar); color: #fff6ee; display: grid; place-items: center; font: 700 19px/1 var(--serif); font-style: normal; box-shadow: inset 0 0 0 2px var(--cinnabar), inset 0 0 0 3px rgba(255, 246, 238, 0.55); transform: rotate(-4deg); }
.logo span { font: 700 21px/1.1 var(--serif); letter-spacing: 2px; }
.logo small { display: block; font: 500 11px/1.4 var(--sans); letter-spacing: 1px; color: var(--sub); margin-top: 2px; }
.spacer { flex: 1; }
.toplink { font-size: 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; background: var(--card); }
.toplink:hover { border-color: var(--ink); text-decoration: none; }

.chip { display: inline-flex; align-items: center; gap: 4px; font: 600 11.5px/1 var(--sans); padding: 4px 8px; border-radius: 3px; border: 1px solid var(--line); color: var(--sub); background: transparent; white-space: nowrap; }
.chip.on { color: var(--cinnabar); border-color: var(--cinnabar); }
.chip.off { color: var(--sub); }
.chip.key { color: var(--cinnabar); border-color: rgba(181, 54, 42, 0.5); background: var(--cinnabar-l); }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: center; background: rgba(251, 249, 244, 0.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 0 1 180px; text-align: center; padding: 10px 0 12px; color: var(--sub); font-size: 12.5px; letter-spacing: 1px; text-decoration: none; position: relative; }
.tabs a b { display: block; font: 700 18px/1.3 var(--serif); }
.tabs a.on { color: var(--ink); }
.tabs a.on::before { content: ''; position: absolute; top: -1px; left: 50%; width: 28px; height: 3px; margin-left: -14px; background: var(--cinnabar); }

/* ---------- 标题与卡片 ---------- */
h2 { font: 700 19px/1.3 var(--serif); letter-spacing: 1px; margin: 26px 0 12px; display: flex; align-items: center; gap: 10px; }
h2::before { content: ''; width: 9px; height: 9px; background: var(--cinnabar); transform: rotate(45deg); flex: none; }
h2 small { font: 500 12.5px/1 var(--sans); color: var(--sub); letter-spacing: 0; }
h3 { font: 700 16px/1.3 var(--serif); margin: 18px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.card.tap { cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.card.tap:hover { border-color: var(--ink); }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--sub); font-size: 13px; }
.title { font: 700 17px/1.4 var(--serif); letter-spacing: 0.5px; }

/* 模板库：像一排线装书 */
.tpls { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x mandatory; }
.tpl { position: relative; flex: 0 0 236px; scroll-snap-align: start; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--ink); border-radius: 3px var(--r) var(--r) 3px; padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 7px; }
.tpl.hot { border-left-color: var(--cinnabar); }
.tpl .desc { font-size: 13px; color: var(--sub); flex: 1; line-height: 1.65; }
.seal { position: absolute; top: 12px; right: 12px; font: 700 12px/1 var(--serif); color: var(--cinnabar); border: 1.5px solid var(--cinnabar); border-radius: 3px; padding: 4px 5px; transform: rotate(8deg); letter-spacing: 1px; }

/* 进度 */
.bar { height: 4px; background: var(--line-2); border-radius: 0; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); transition: width 0.3s; }
.meter { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 10px; }
.meter-num { font: 700 34px/1 var(--serif); }
.meter-of { color: var(--sub); font-size: 14px; }
.meter .bar { flex: 1; align-self: center; margin-left: 12px; height: 6px; }
.plan-head { padding: 6px 0 4px; }
.plan-head .name { font: 700 26px/1.3 var(--serif); letter-spacing: 1px; margin: 10px 0 4px; }

/* 阶段与事项 */
.stage { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 4px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); }
.stage:first-child { margin-top: 2px; }
.stage-no { font: 600 12px/1 var(--sans); color: var(--cinnabar); letter-spacing: 2px; flex: none; }
.stage-title { font: 700 16px/1.4 var(--serif); }
.item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.item:last-child { border-bottom: 0; }
.chk { flex: 0 0 30px; height: 30px; border-radius: 4px; border: 1.5px solid #b9b0a0; background: transparent; display: grid; place-items: center; font: 700 15px/1 var(--serif); color: transparent; cursor: pointer; padding: 0; transition: background 0.15s, transform 0.15s; }
.chk:hover { border-color: var(--ink); background: transparent; }
.chk.done { background: var(--cinnabar); border-color: var(--cinnabar); color: #fff6ee; transform: rotate(-6deg); box-shadow: inset 0 0 0 2px var(--cinnabar), inset 0 0 0 3px rgba(255, 246, 238, 0.5); }
.chk.skipped { border-style: dashed; border-color: var(--faint); color: var(--faint); font-size: 13px; }
.item .t { font-weight: 600; line-height: 1.5; }
.item.done .t { color: var(--sub); text-decoration: line-through; text-decoration-color: rgba(181, 54, 42, 0.55); text-decoration-thickness: 1.5px; }
.item .d { font-size: 13.5px; color: var(--sub); margin-top: 2px; line-height: 1.7; }
.time { font: 700 14px/1 var(--serif); color: var(--ink); margin-right: 8px; letter-spacing: 0.5px; }

/* 编辑器 */
.ed-stage { border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: 0 0 var(--r) var(--r); padding: 12px; margin: 14px 0; background: var(--card); }
.ed-item { background: #fffdf8; border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px; margin: 10px 0; }
.ed-item .grid { display: grid; grid-template-columns: 84px 1fr; gap: 8px; }
.ed-item .ops { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.warn { background: #fbf2de; border: 1px solid #ecd9a9; color: #7a5a14; border-radius: var(--r); padding: 9px 12px; font-size: 13px; margin: 10px 0; }

/* AI */
.sugg { border-left: 3px solid var(--cinnabar); padding: 9px 12px; margin: 8px 0; background: #fbf3ef; border-radius: 0 var(--r) var(--r) 0; font-size: 14px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.quick button { background: transparent; color: var(--ink-2); border: 1px solid var(--line); font: 500 13px/1 var(--sans); padding: 7px 11px; border-radius: 99px; }
.quick button:hover { border-color: var(--ink); background: transparent; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: #cfc7b8; display: inline-block; }
.dot.on { background: var(--jade); box-shadow: 0 0 0 3px rgba(61, 107, 79, 0.15); }

#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 10px 18px; border-radius: var(--r); font-size: 14px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 20; max-width: 86vw; }
#toast.show { opacity: 1; }
.empty { text-align: center; color: var(--sub); padding: 34px 0; font-size: 14px; }
.loading { text-align: center; color: var(--sub); padding: 24px 0; letter-spacing: 2px; }
.foot { margin: 26px 2px; font-size: 12.5px; color: var(--sub); line-height: 1.8; }
