/* ============================================================
   命书日课 · 视觉样式
   宣纸米色 + 墨色 + 朱砂 + 金
   ============================================================ */

:root {
  --paper: #f5f0e6;
  --paper-deep: #ece3d3;
  --card: #fffdf7;
  --ink: #211b15;
  --ink-2: #4a4033;
  --muted: #7b6f5e;
  --line: #d9cdb8;
  --line-soft: #e7ddcc;
  --cinnabar: #a93b2f;
  --cinnabar-deep: #872b22;
  --gold: #a9853f;
  --jade: #4e6f5b;
  --blue: #45616e;
  --shadow: 0 14px 40px -26px rgba(33, 27, 21, .55);
  --radius: 16px;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  background:
    radial-gradient(1100px 720px at 8% -8%, rgba(169, 59, 47, .055), transparent 62%),
    radial-gradient(900px 640px at 108% 4%, rgba(169, 133, 63, .09), transparent 58%),
    radial-gradient(760px 520px at 50% 110%, rgba(78, 111, 91, .05), transparent 60%),
    repeating-linear-gradient(0deg, rgba(33, 27, 21, .017) 0 1px, transparent 1px 4px),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(169, 59, 47, .18); }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.35; margin: 0; letter-spacing: .015em; }

p { margin: 0; }

a { color: var(--cinnabar-deep); text-decoration: none; border-bottom: 1px solid rgba(169, 59, 47, .3); }
a:hover { border-bottom-color: var(--cinnabar); }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 2px; border-radius: 4px; }

/* ---------- 顶栏 ---------- */

.app-head {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px clamp(16px, 4vw, 44px) 0;
  background: rgba(245, 240, 230, .86);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line-soft);
}

.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1220px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.seal {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  background: var(--cinnabar);
  color: #f8f0df;
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22), 0 5px 14px -6px rgba(135, 43, 34, .7);
  transform: rotate(-2deg);
}

.brand-text h1 { font-size: 25px; letter-spacing: .09em; }
.brand-text p { font-size: 12px; color: var(--muted); letter-spacing: .14em; margin-top: 1px; }

.head-right { display: flex; align-items: center; gap: 12px; }

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.save-status .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 3px rgba(78, 111, 91, .13);
}
.save-status.saving .dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(169, 133, 63, .16); }
.save-status.error .dot { background: var(--cinnabar); box-shadow: 0 0 0 3px rgba(169, 59, 47, .16); }

.tabs {
  display: flex;
  gap: 4px;
  max-width: 1220px;
  margin: 10px auto 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  position: relative;
  border: 0;
  background: transparent;
  padding: 11px 18px 13px;
  color: var(--muted);
  font-size: 14.5px;
  letter-spacing: .16em;
  white-space: nowrap;
  border-radius: 10px 10px 0 0;
  transition: color .16s ease, background .16s ease;
}
.tab:hover { color: var(--ink); background: rgba(255, 253, 247, .6); }
.tab.active { color: var(--cinnabar-deep); font-weight: 600; }
.tab.active::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cinnabar), transparent);
}

/* ---------- 布局 ---------- */

main#app {
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 30px) clamp(16px, 4vw, 44px) 56px;
}

.view { display: none; animation: viewIn .28s ease both; }
.view.active { display: block; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.foot {
  border-top: 1px solid var(--line-soft);
  padding: 20px clamp(16px, 4vw, 44px) 34px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.foot p { max-width: 720px; margin: 0 auto; }

.grid-2 { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; align-content: start; }
.stack-sm { display: grid; gap: 10px; }

/* ---------- 卡片 ---------- */

.card {
  background: linear-gradient(180deg, rgba(255, 253, 247, .94), rgba(255, 253, 247, .82));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 19px 20px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.card-head h2 {
  position: relative;
  padding-left: 12px;
  font-size: 18px;
  letter-spacing: .04em;
}
.card-head h2::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 3px;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--cinnabar), var(--gold));
}
.card-head .hint { font-size: 12px; color: var(--muted); text-align: right; }

.card-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 26px 0 12px;
}
.section-head h2 { font-size: 21px; letter-spacing: .05em; }
.section-head .hint { color: var(--muted); font-size: 12.5px; }

.divider { height: 1px; background: linear-gradient(90deg, var(--line), transparent); margin: 22px 0; border: 0; }

/* ---------- 今日 hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: clamp(20px, 3vw, 28px);
  color: #f3ead9;
  background:
    radial-gradient(700px 360px at 88% -20%, rgba(169, 133, 63, .22), transparent 60%),
    radial-gradient(480px 300px at 4% 120%, rgba(169, 59, 47, .18), transparent 60%),
    linear-gradient(135deg, #2a231b 0%, #1c1712 58%, #241d16 100%);
  border: 1px solid #3a2f24;
  box-shadow: 0 24px 60px -34px rgba(28, 22, 16, .9);
}
.hero::before {
  content: "命";
  position: absolute;
  right: -14px;
  top: -58px;
  font-family: var(--serif);
  font-size: 230px;
  line-height: 1;
  color: rgba(169, 59, 47, .13);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(243, 234, 217, .1);
  border-radius: 13px;
  pointer-events: none;
}

.hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}

.hero-date { display: flex; align-items: center; gap: 14px; }

.day-nav {
  flex: none;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(243, 234, 217, .28);
  background: rgba(255, 255, 255, .04);
  color: #e8dcc7;
  font-size: 20px;
  line-height: 1;
  transition: background .16s ease, border-color .16s ease;
}
.day-nav:hover { background: rgba(255, 255, 255, .1); border-color: rgba(243, 234, 217, .55); }

.date-main { font-family: var(--serif); font-size: clamp(26px, 3.3vw, 36px); letter-spacing: .05em; line-height: 1.2; }
.date-sub { margin-top: 5px; color: #bfae93; font-size: 13px; letter-spacing: .1em; }
.date-sub .now-tag { color: #e6c77e; }

.pillars { display: flex; gap: 9px; flex-wrap: wrap; }

.pillar {
  min-width: 78px;
  padding: 9px 12px 10px;
  border-radius: 11px;
  border: 1px solid rgba(243, 234, 217, .18);
  background: rgba(255, 255, 255, .045);
  text-align: center;
}
.pillar-label { display: block; font-size: 10.5px; letter-spacing: .24em; color: #a89880; margin-bottom: 4px; }
.pillar-chars { display: flex; justify-content: center; gap: 7px; font-family: var(--serif); font-size: 24px; line-height: 1.1; }
.pillar-chars b { font-weight: 600; }
.pillar-chars b:first-child { color: #f0dcb8; }
.pillar-chars b:last-child { color: #e3b7a8; }

.prompt {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(243, 234, 217, .14);
  display: grid;
  gap: 8px;
}
.prompt-label {
  font-size: 11px;
  letter-spacing: .3em;
  color: #b59d78;
}
.prompt-line {
  font-family: var(--serif);
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.75;
  color: #f4ecdd;
  display: flex;
  gap: 10px;
}
.prompt-line::before {
  content: "○";
  flex: none;
  color: var(--gold);
  font-size: 11px;
  line-height: 2.9;
  opacity: .8;
}
.prompt-line em { font-style: normal; color: #e6c77e; }

.hero-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

/* ---------- 标签 / 按钮 ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .75);
  color: var(--ink-2);
  font-size: 12.5px;
  white-space: nowrap;
}
.chip b { font-weight: 600; color: var(--ink); }
.chip.soft { background: rgba(236, 227, 211, .55); }
.chip.gold { border-color: rgba(169, 133, 63, .42); color: #7e6226; background: rgba(169, 133, 63, .09); }
.chip.jade { border-color: rgba(78, 111, 91, .4); color: var(--jade); background: rgba(78, 111, 91, .07); }
.chip.hot { border-color: rgba(169, 59, 47, .4); color: var(--cinnabar-deep); background: rgba(169, 59, 47, .07); }
.chip.on-dark { border-color: rgba(243, 234, 217, .24); background: rgba(255, 255, 255, .05); color: #e5d8c2; }
.chip.on-dark b { color: #f6edd9; }
.chip.warn { border-style: dashed; }
/* 深色 hero 上的死线标签：朱砂要提亮，否则红字压黑底看不清 */
.hero .chip.hot { color: #f0b3a5; border-color: rgba(214, 110, 90, .6); background: rgba(169, 59, 47, .2); }
.hero .chip.hot b { color: #ffe7dd; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--cinnabar);
  background: var(--cinnabar);
  color: #fdf7ea;
  font-size: 13.5px;
  letter-spacing: .04em;
  transition: transform .12s ease, box-shadow .16s ease, background .16s ease;
  box-shadow: 0 6px 16px -10px rgba(135, 43, 34, .8);
}
.btn:hover { background: var(--cinnabar-deep); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(236, 227, 211, .5); border-color: var(--muted); color: var(--ink); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fffaf0; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
}
.icon-btn:hover { background: rgba(236, 227, 211, .6); color: var(--ink); }

.link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--cinnabar-deep);
  font-size: 12.5px;
  border-bottom: 1px dashed rgba(169, 59, 47, .45);
}
.link-btn:hover { border-bottom-style: solid; }

/* ---------- 表单 ---------- */

label.field, .field { display: grid; gap: 5px; min-width: 0; }

.field > label, .field-label {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .06em;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.field-label .unit { font-size: 11px; color: #9b8f7e; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffcf5;
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { resize: vertical; min-height: 74px; }
input:hover, textarea:hover, select:hover { border-color: #c8b99f; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--cinnabar);
  box-shadow: 0 0 0 3px rgba(169, 59, 47, .1);
  background: #fffdf9;
}
input::placeholder, textarea::placeholder { color: #b3a793; }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="file"] { padding: 7px; font-size: 12.5px; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-full { grid-column: 1 / -1; }

.field-help { font-size: 11.5px; color: #93866f; line-height: 1.6; }

/* 身体 1–5 */

.body-scale { display: flex; gap: 6px; }
.body-btn {
  flex: 1;
  padding: 8px 4px 7px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fffcf5;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  display: grid;
  gap: 2px;
  transition: all .14s ease;
}
.body-btn b { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.body-btn:hover { border-color: #c8b99f; background: #fbf5e8; }
.body-btn.active {
  border-color: var(--cinnabar);
  background: rgba(169, 59, 47, .08);
  color: var(--cinnabar-deep);
  box-shadow: inset 0 0 0 1px rgba(169, 59, 47, .28);
}
.body-btn.active b { color: var(--cinnabar-deep); }

/* ---------- 今日：日期条 ---------- */

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-top: 16px;
}
.day-chip {
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 247, .6);
  border-radius: 11px;
  padding: 8px 4px 7px;
  display: grid;
  gap: 2px;
  text-align: center;
  color: var(--muted);
  transition: all .14s ease;
}
.day-chip:hover { border-color: #c8b99f; background: #fffcf5; }
.day-chip .dc-wd { font-size: 11px; letter-spacing: .1em; }
.day-chip .dc-date { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.day-chip .dc-gz { font-family: var(--serif); font-size: 11.5px; color: #9b8f7e; }
.day-chip.has .dc-date::after {
  content: "";
  display: inline-block;
  width: 4px; height: 4px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--jade);
  vertical-align: middle;
}
.day-chip.today { border-color: rgba(169, 133, 63, .5); }
.day-chip.active {
  border-color: var(--cinnabar);
  background: rgba(169, 59, 47, .07);
  box-shadow: inset 0 0 0 1px rgba(169, 59, 47, .2);
}
.day-chip.active .dc-date { color: var(--cinnabar-deep); }

/* ---------- 今日：任务与字段 ---------- */

.today-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; margin-top: 18px; }

.task-helper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(236, 227, 211, .5);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}
.task-helper .th-text { min-width: 0; }
.task-helper b { color: var(--cinnabar-deep); }

.week-focus {
  margin-top: 4px;
  padding: 11px 13px;
  border-left: 2px solid var(--gold);
  background: rgba(169, 133, 63, .06);
  border-radius: 0 9px 9px 0;
  font-size: 13px;
  color: var(--ink-2);
}
.week-focus .wf-k { font-size: 11px; letter-spacing: .16em; color: #8d7340; display: block; margin-bottom: 3px; }

.lines { display: grid; gap: 8px; }
.line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px dashed var(--line);
  background: rgba(255, 253, 247, .5);
  font-size: 12.5px;
  color: var(--muted);
}
.line .mark {
  flex: none;
  width: 19px; height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 11px;
  color: transparent;
}
.line.done { border-style: solid; border-color: rgba(78, 111, 91, .3); background: rgba(78, 111, 91, .06); color: var(--ink-2); }
.line.done .mark { border-color: var(--jade); background: var(--jade); color: #f7f3e8; }
.line .what { flex: 1; }
.line .why { font-size: 11px; color: #9b8f7e; }

/* ---------- 统计 ---------- */

.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.stat {
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 247, .6);
}
.stat .k { font-size: 11px; color: var(--muted); letter-spacing: .08em; white-space: nowrap; }
.stat .v { font-family: var(--serif); font-size: 20px; color: var(--ink); line-height: 1.4; }
.stat .v small { font-family: var(--sans); font-size: 11px; color: var(--muted); margin-left: 2px; }
.stat.wide { grid-column: span 2; }

.bar-chart { display: flex; align-items: flex-end; gap: 5px; height: 94px; margin-top: 6px; }
.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  height: 100%;
  min-width: 0;
}
.bar .b-fill {
  width: 100%;
  max-width: 18px;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, rgba(169, 59, 47, .75), rgba(169, 59, 47, .35));
  transition: height .3s ease;
}
.bar.gold .b-fill { background: linear-gradient(180deg, rgba(169, 133, 63, .8), rgba(169, 133, 63, .35)); }
.bar .b-label { font-size: 9px; color: #9b8f7e; white-space: nowrap; }
.bar .b-val { font-size: 9.5px; color: var(--muted); }

/* ---------- 表格 ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(255, 253, 247, .6); }
table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
th, td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); line-height: 1.55; }
th { background: rgba(236, 227, 211, .68); color: var(--ink-2); font-weight: 600; font-size: 11.8px; letter-spacing: .04em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(236, 227, 211, .28); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.key { color: var(--muted); white-space: nowrap; }
.table-compact { font-size: 12.2px; }
.table-compact th, .table-compact td { padding: 6px 8px; }

/* ---------- 计划 ---------- */

.phase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 11px; }
.phase-card {
  position: relative;
  padding: 13px 14px;
  border-radius: 11px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 247, .55);
}
.phase-card.current {
  border-color: var(--cinnabar);
  background: rgba(169, 59, 47, .055);
  box-shadow: inset 0 0 0 1px rgba(169, 59, 47, .16);
}
.phase-card.past { opacity: .68; }
.phase-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.phase-head h3 { font-size: 15px; }
.phase-range { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.phase-goal { font-size: 12.5px; color: var(--ink-2); margin-top: 7px; line-height: 1.6; }
.phase-node { font-size: 11.5px; color: #8d7340; margin-top: 4px; }
.phase-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.phase-card.current .phase-badge { color: var(--cinnabar-deep); border-color: rgba(169, 59, 47, .4); background: rgba(169, 59, 47, .07); }

.week-list { display: grid; gap: 9px; }
.week-item {
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 253, 247, .58);
  overflow: hidden;
}
.week-item[open] { border-color: var(--line); background: rgba(255, 253, 247, .9); }
.week-item.now { border-color: rgba(169, 59, 47, .5); box-shadow: inset 0 0 0 1px rgba(169, 59, 47, .14); }
.week-item.now > summary { background: rgba(169, 59, 47, .055); }
.week-item > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  cursor: pointer;
  font-size: 13px;
}
.week-item > summary::-webkit-details-marker { display: none; }
.week-item > summary .wg {
  flex: none;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--cinnabar-deep);
  min-width: 34px;
}
.week-item > summary .wm { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.week-item > summary .wt { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-item > summary .wtag { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.week-item > summary::after { content: "▾"; color: var(--muted); font-size: 11px; transition: transform .16s ease; }
.week-item[open] > summary::after { transform: rotate(180deg); }
.week-body { padding: 2px 14px 14px; display: grid; gap: 10px; }
.wb-row { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: start; font-size: 12.8px; }
.wb-row .k { color: var(--muted); font-size: 11.5px; letter-spacing: .05em; padding-top: 2px; }
.wb-row .v { color: var(--ink-2); line-height: 1.65; }
.wb-row .v b { color: var(--ink); }

.progress {
  height: 7px;
  border-radius: 99px;
  background: rgba(217, 205, 184, .5);
  overflow: hidden;
  min-width: 90px;
}
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--cinnabar), #c9734a); }

/* ---------- 里程碑 ---------- */

.milestone-list { display: grid; gap: 8px; }
.milestone {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 253, 247, .55);
  transition: background .15s ease, border-color .15s ease;
}
.milestone:hover { background: rgba(255, 253, 247, .9); border-color: var(--line); }
.milestone.done { background: rgba(78, 111, 91, .055); border-color: rgba(78, 111, 91, .26); }
.milestone .box { position: relative; display: grid; place-items: center; padding-top: 2px; }
.milestone input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 19px; height: 19px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fffcf5;
  cursor: pointer;
  margin: 0;
  transition: all .14s ease;
}
.milestone input[type="checkbox"]:checked { background: var(--jade); border-color: var(--jade); }
.milestone input[type="checkbox"]:checked::after {
  content: "✓";
  color: #f7f3e8;
  font-size: 12px;
  position: absolute;
  left: 4px; top: 0;
  line-height: 21px;
}
.milestone .m-title { font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.milestone.done .m-title { text-decoration: line-through; text-decoration-color: rgba(78, 111, 91, .4); color: var(--muted); }
.milestone .m-criteria { font-size: 11.8px; color: var(--muted); margin-top: 2px; line-height: 1.55; }
.milestone .m-side { text-align: right; display: grid; gap: 4px; justify-items: end; }
.milestone .m-time { font-size: 11.5px; color: var(--cinnabar-deep); white-space: nowrap; }
.milestone .m-date {
  width: 126px;
  padding: 4px 6px;
  font-size: 11.5px;
}
.milestone-legend { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }

/* ---------- 复盘 ---------- */

.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.subtab {
  border: 1px solid transparent;
  background: transparent;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .08em;
  transition: all .14s ease;
}
.subtab:hover { background: rgba(236, 227, 211, .55); color: var(--ink); }
.subtab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 247, .45);
}
.empty b { display: block; color: var(--ink-2); font-family: var(--serif); font-size: 16px; margin-bottom: 5px; }

.day-table-wrap { max-height: 520px; overflow: auto; }
.day-table-wrap table { min-width: 720px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: rgba(169, 59, 47, .05); }

.review-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }

/* ---------- 修身 ---------- */

.hint-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.hint-card {
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 253, 247, .58);
}
.hint-card .hk { font-size: 11px; letter-spacing: .18em; color: #8d7340; }
.hint-card .hv { font-family: var(--serif); font-size: 19px; margin: 3px 0 6px; }
.hint-card .hd { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }

details.ref {
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(255, 253, 247, .55);
  padding: 0;
  overflow: hidden;
}
details.ref + details.ref { margin-top: 9px; }
details.ref > summary {
  list-style: none;
  cursor: pointer;
  padding: 11px 14px;
  font-size: 13.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 9px;
}
details.ref > summary::-webkit-details-marker { display: none; }
details.ref > summary::before { content: "▸"; color: var(--gold); font-size: 11px; transition: transform .15s ease; }
details.ref[open] > summary::before { transform: rotate(90deg); }
details.ref > summary:hover { background: rgba(236, 227, 211, .35); }
details.ref .ref-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.prose-line { font-size: 12.8px; color: var(--ink-2); line-height: 1.75; }
.prose-line b { color: var(--ink); }

/* ---------- 命书 ---------- */

.destiny-hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid #3a2f24;
  background:
    radial-gradient(760px 420px at 90% -10%, rgba(169, 133, 63, .2), transparent 58%),
    linear-gradient(135deg, #2a231b, #1c1712 62%, #251d15);
  color: #f3ead9;
  padding: clamp(22px, 3.4vw, 34px);
  box-shadow: 0 24px 60px -36px rgba(28, 22, 16, .9);
}
.destiny-hero::before {
  content: "辛";
  position: absolute;
  right: 12px;
  top: -70px;
  font-family: var(--serif);
  font-size: 250px;
  line-height: 1;
  color: rgba(169, 133, 63, .1);
}
.destiny-hero h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: .1em; }
.destiny-hero .sub { color: #bfae93; font-size: 12.5px; letter-spacing: .18em; margin-top: 5px; }
.destiny-hero .intro { color: #d9cbb3; font-size: 13.5px; line-height: 1.8; margin-top: 16px; max-width: 760px; position: relative; }

.pillar-board { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 22px; }
.pillar-card {
  border: 1px solid rgba(243, 234, 217, .2);
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
  padding: 12px 10px 13px;
  text-align: center;
}
.pillar-card .pc-label { font-size: 10.5px; letter-spacing: .24em; color: #a89880; }
.pillar-card .pc-chars { display: flex; justify-content: center; gap: 7px; margin-top: 7px; }
.pillar-card .pc-chars span {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  color: #f0dcb8;
  border: 1px solid rgba(243, 234, 217, .18);
  border-radius: 7px;
  width: 42px; height: 46px;
  display: grid;
  place-items: center;
}
.pillar-card .pc-chars span:last-child { color: #e3b7a8; }
.pillar-card .pc-note { font-size: 10.5px; color: #a89880; margin-top: 7px; line-height: 1.45; }

.fate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 11px; }
.fate-card {
  padding: 13px 14px;
  border-radius: 11px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 247, .58);
}
.fate-card h3 { font-size: 15px; color: var(--ink); margin-bottom: 5px; }
.fate-card p { font-size: 12.8px; color: var(--ink-2); line-height: 1.7; }
.fate-card .tagline { font-size: 11px; color: #8d7340; letter-spacing: .14em; margin-bottom: 5px; }

.dayun-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.dayun-card {
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 247, .55);
  text-align: center;
}
.dayun-card.current { border-color: var(--cinnabar); background: rgba(169, 59, 47, .06); }
.dayun-card .dy-gz { font-family: var(--serif); font-size: 21px; letter-spacing: .08em; color: var(--ink); }
.dayun-card .dy-age { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.dayun-card .dy-note { font-size: 11px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }

.quote {
  border-left: 2px solid var(--gold);
  padding: 9px 14px;
  background: rgba(169, 133, 63, .06);
  border-radius: 0 9px 9px 0;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-2);
}

.markdown { font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.markdown h1, .markdown h2 { font-size: 19px; margin: 18px 0 8px; letter-spacing: .04em; color: var(--ink); }
.markdown h1:first-child, .markdown h2:first-child { margin-top: 0; }
.markdown h3 { font-size: 15.5px; margin: 15px 0 6px; color: var(--ink); }
.markdown h4 { font-size: 13.5px; margin: 12px 0 5px; color: var(--ink); }
.markdown p { margin: 6px 0; }
.markdown ul, .markdown ol { margin: 6px 0; padding-left: 20px; }
.markdown li { margin: 2px 0; }
.markdown strong { color: var(--ink); }
.markdown blockquote { margin: 8px 0; padding: 7px 12px; border-left: 2px solid var(--line); background: rgba(236, 227, 211, .4); color: var(--muted); }
.markdown hr { border: 0; border-top: 1px solid var(--line-soft); margin: 14px 0; }
.markdown code { background: rgba(236, 227, 211, .7); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.markdown pre { overflow-x: auto; background: #2a231b; color: #f0e6d4; padding: 11px 13px; border-radius: 9px; font-size: 12px; }
.markdown pre code { background: transparent; padding: 0; color: inherit; }
.markdown .table-wrap { margin: 8px 0; }
.markdown table { font-size: 12px; }

.doc-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-tab {
  border: 1px solid var(--line-soft);
  background: rgba(255, 253, 247, .6);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
}
.doc-tab.active { background: var(--cinnabar); border-color: var(--cinnabar); color: #fdf7ea; }

/* ---------- 数据页 ---------- */

.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.kv-list { display: grid; gap: 7px; }
.kv-list .kv { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 1px dashed var(--line-soft); font-size: 12.8px; }
.kv-list .kv:last-child { border-bottom: 0; }
.kv-list .kv .k { color: var(--muted); }
.kv-list .kv .v { color: var(--ink-2); text-align: right; word-break: break-all; }
.kv-list .kv .v.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11.5px; }

.anchor-list { display: grid; gap: 5px; font-size: 12.3px; color: var(--ink-2); }
.anchor-list .anchor { display: flex; gap: 8px; }
.anchor-list .anchor .a-dot { color: var(--gold); }

/* ---------- 弹窗 / toast ---------- */

dialog.modal {
  width: min(760px, 92vw);
  max-height: 86vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 40px 100px -40px rgba(28, 22, 16, .7);
}
dialog.modal::backdrop { background: rgba(28, 22, 16, .48); backdrop-filter: blur(3px); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(236, 227, 211, .35);
}
.modal-head h3 { font-size: 17px; letter-spacing: .05em; }
.modal-body { padding: 16px 18px 20px; overflow: auto; max-height: calc(86vh - 60px); }
.modal-body textarea { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.2px; line-height: 1.65; min-height: 320px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 14px);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(33, 27, 21, .92);
  color: #f4ecdd;
  font-size: 12.5px;
  letter-spacing: .04em;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .5);
  transition: opacity .2s ease, transform .2s ease;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */

@media (max-width: 1020px) {
  .today-grid { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .today-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .data-grid { grid-template-columns: 1fr; }
  .hero-top { flex-direction: column; }
  .pillars { width: 100%; }
  .pillar { flex: 1; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pillar-board { grid-template-columns: repeat(2, 1fr); }
  .hint-block { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  body { font-size: 14.5px; }
  .brand-text h1 { font-size: 22px; }
  .brand-text p { font-size: 11px; letter-spacing: .08em; }
  .seal { width: 40px; height: 40px; font-size: 23px; }
  .head-right .btn { display: none; }
  .save-status { font-size: 11px; }
  .tabs { gap: 0; }
  .tab { flex: 1 1 0; padding: 9px 2px 11px; font-size: 12.2px; letter-spacing: 0; text-align: center; }
  .card { padding: 15px 15px; border-radius: 14px; }
  .hero { border-radius: 16px; }
  .date-main { font-size: 24px; }
  .hero-date { gap: 8px; }
  .day-nav { width: 34px; height: 34px; }
  .prompt-line { font-size: 15.5px; }
  .prompt-line::before { display: none; }
  .pillar { min-width: 0; padding: 7px 6px 8px; }
  .pillar-chars { font-size: 20px; gap: 4px; }
  .pillar-label { letter-spacing: .12em; }
  .day-strip { gap: 4px; }
  .day-chip { padding: 6px 2px; border-radius: 8px; }
  .day-chip .dc-wd { font-size: 10px; }
  .day-chip .dc-date { font-size: 12px; }
  .day-chip .dc-gz { font-size: 10px; }
  .form-grid, .form-grid.two, .form-grid.four { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: 1 / -1; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wb-row { grid-template-columns: 74px 1fr; gap: 7px; }
  .week-item > summary .wm { display: none; }
  .week-item > summary .wt { font-size: 12px; }
  .milestone { grid-template-columns: 24px 1fr; }
  .milestone .m-side { grid-column: 2; text-align: left; justify-items: start; grid-auto-flow: column; align-items: center; gap: 8px; }
  .milestone .m-date { width: 138px; }
  .day-table-wrap { max-height: 420px; }
  .doc-tab { font-size: 11.5px; padding: 5px 10px; }
  .pillars-display, .pillar-board { gap: 7px; }
  .pillar-card .pc-chars span { width: 36px; height: 40px; font-size: 25px; }
}

@media (max-width: 430px) {
  .app-head { padding-left: 12px; padding-right: 12px; }
  main#app { padding-left: 12px; padding-right: 12px; }
  .head-right { gap: 8px; }
  .date-main { font-size: 21px; }
  .date-sub { font-size: 11.5px; }
  .pillars { gap: 5px; }
  .pillar-chars { font-size: 18px; }
  .day-chip .dc-gz { display: none; }
  .form-grid, .form-grid.two, .form-grid.four { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
  .body-scale { flex-wrap: wrap; }
  .body-btn { flex: 1 1 28%; }
  .review-summary { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
  html { scroll-behavior: auto; }
}

/* ---------- 今日清单 ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: rgba(255, 253, 247, .5);
  transition: background .15s ease, border-color .15s ease;
}
.task-item.done { background: rgba(78, 111, 91, .06); border-color: rgba(78, 111, 91, .22); }
.task-check {
  flex: 0 0 23px; width: 23px; height: 23px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: transparent;
  cursor: pointer; font-size: 13px; line-height: 1;
}
.task-item.done .task-check { background: var(--jade); border-color: var(--jade); color: var(--card); }
.task-text {
  flex: 1; min-width: 0; width: 100%;
  border: 0; background: transparent; padding: 3px 1px;
  font: inherit; color: var(--ink);
}
.task-text:focus { outline: none; border-bottom: 1px dashed rgba(169, 59, 47, .45); }
.task-item.done .task-text { color: var(--muted); text-decoration: line-through; }
.task-del {
  flex: 0 0 auto; border: 0; background: transparent;
  color: #b3a58f; font-size: 19px; line-height: 1; cursor: pointer; padding: 2px 4px;
}
.task-del:hover { color: var(--cinnabar-deep); }
.task-add-row { display: flex; gap: 8px; margin-top: 10px; }
.task-add-row input { flex: 1; }
.task-tools { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 9px; }
.task-empty { margin: 2px 0 4px; color: var(--muted); font-size: 13px; line-height: 1.7; }

/* ---------- 交易 ---------- */
.trade-review-card textarea { min-height: 120px; }
.trade-rule { display: flex; gap: 8px; font-size: 13px; line-height: 1.75; padding: 3px 0; }
.trade-rule .mark { color: var(--cinnabar); }
.trade-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.trade-actions .field-help { margin: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  border: 1px solid var(--line-soft); border-radius: 99px;
  padding: 3px 9px; font-size: 12px; color: var(--ink-2);
  background: rgba(255, 253, 247, .55);
}
.table-wrap td.up { color: var(--cinnabar-deep); font-weight: 600; }
.table-wrap td.down { color: var(--jade); font-weight: 600; }
.empty-cell { text-align: center; color: var(--muted); padding: 18px 10px !important; }

/* ---------- 状态模式 / 健康护栏 / 下一步 ---------- */
.mode-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-btn {
  flex: 1; min-width: 86px; cursor: pointer;
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: rgba(255, 253, 247, .55); padding: 8px 6px;
  color: var(--ink-2); font-family: inherit;
}
.mode-btn b { display: block; font-size: 14px; font-weight: 600; }
.mode-btn span { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.mode-btn.active {
  border-color: rgba(169, 59, 47, .55);
  background: rgba(169, 59, 47, .08);
  color: var(--cinnabar-deep);
}
.mode-btn.active span { color: #9a6a5e; }
.mode-hint { margin-top: 10px; font-size: 13px; line-height: 1.7; color: var(--ink-2); }
.mode-card .btn { margin-top: 10px; }
.next-card .next-text {
  margin: 8px 0 12px; padding-left: 10px;
  border-left: 3px solid var(--cinnabar);
  font-size: 15px; line-height: 1.7; color: var(--ink);
}
.health-banner {
  display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 0; padding: 10px 14px;
  border: 1px solid; border-radius: 10px;
  font-size: 13px; line-height: 1.7;
}
.health-banner b { flex: 0 0 auto; }
.health-banner.yellow { background: #fbf3df; border-color: #dcc58e; color: #6b5325; }
.health-banner.red { background: #fbe9e5; border-color: #d9a396; color: #8a2f24; }

@media (max-width: 620px) {
  .tabs { gap: 0; }
  .tab { flex: 1 1 0; padding: 8px 1px 10px; font-size: 11.8px; letter-spacing: 0; white-space: nowrap; text-align: center; }
  .task-item { gap: 7px; padding: 7px; }
}

/* ---------- 财务 ---------- */
.fin-month-row { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.fin-month-row b { font-family: var(--serif); font-size: 17px; color: var(--ink); letter-spacing: .03em; }
.fin-month-row .day-nav { width: 30px; height: 30px; font-size: 18px; }
.fin-net { font-family: var(--serif); font-size: 20px; padding-top: 4px; }
.fin-net.up { color: var(--cinnabar-deep); }
.fin-net.down { color: var(--jade); }
tr.active-row td { background: rgba(169, 59, 47, .07); }
@media (max-width: 620px) {
  .fin-month-row b { font-size: 15.5px; }
  .fin-month-row .link-btn { font-size: 11.5px; }
  .fin-net { font-size: 18px; }
}

/* iPhone 刘海 / 底部安全区：装到主屏幕后不压状态栏 */
@supports (padding: env(safe-area-inset-top)) {
  .app-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .foot { padding-bottom: calc(34px + env(safe-area-inset-bottom)); }
}

@media print {
  body { background: #fff; }
  .app-head, .foot, .btn, .day-nav, .day-strip, .tabs, .subtabs, .doc-tabs { display: none !important; }
  main#app { max-width: none; padding: 0; }
  .view { display: none !important; }
  .view.active { display: block !important; }
  .card, .hero, .destiny-hero { box-shadow: none; break-inside: avoid; }
  .hero, .destiny-hero { color: var(--ink); background: #fff; border: 1px solid #999; }
  .hero::before, .hero::after, .destiny-hero::before { display: none; }
  .pillar, .pillar-chars b { color: var(--ink) !important; border-color: #bbb; }
  .date-main, .date-sub, .prompt-line { color: var(--ink); }
  .today-grid, .grid-2, .data-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   AI 复盘助手（站内聊天）
   ============================================================ */

.ai-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 42;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px 8px 8px;
  border: 1px solid rgba(169, 59, 47, .45);
  border-radius: 999px;
  background: linear-gradient(160deg, #b34737, #8d2d23);
  color: #fff8ef;
  box-shadow: 0 16px 34px -16px rgba(33, 27, 21, .7);
  transition: transform .16s ease, box-shadow .16s ease;
}
.ai-fab:hover { transform: translateY(-1px); box-shadow: 0 20px 38px -16px rgba(33, 27, 21, .75); }
.ai-fab-seal {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff8ef;
  color: var(--cinnabar-deep);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.ai-fab-text { font-size: 13px; font-weight: 600; letter-spacing: .08em; }

.ai-backdrop {
  position: fixed;
  inset: 0;
  z-index: 43;
  background: rgba(33, 27, 21, .34);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.ai-backdrop[hidden] { display: none; }

.ai-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 44;
  display: flex;
  flex-direction: column;
  width: 430px;
  max-width: calc(100vw - 32px);
  height: min(680px, calc(100vh - 130px));
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px -28px rgba(33, 27, 21, .6);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.985);
  transition: opacity .18s ease, transform .18s ease;
}
.ai-panel.open { opacity: 1; pointer-events: auto; transform: none; }
.ai-panel[hidden] { display: none; }
#ai-setup[hidden], #ai-chat[hidden] { display: none !important; }

.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fbf6ea, #f7f0e2);
}
.ai-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-title b { font-family: var(--serif); font-size: 15px; letter-spacing: .03em; white-space: nowrap; }
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: #b9ab96; flex: 0 0 auto; }
.ai-dot.online { background: #4e8a63; box-shadow: 0 0 0 3px rgba(78, 138, 99, .13); }
.ai-dot.busy { background: #c58a33; animation: aiPulse 1s infinite; }
.ai-dot.error { background: var(--cinnabar); }
.ai-mode-badge {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
  white-space: nowrap;
}
.ai-head-actions { display: flex; gap: 2px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 18px;
  line-height: 1;
}
.icon-btn:hover { background: var(--paper-deep); border-color: var(--line-soft); }

.ai-setup { padding: 16px; overflow: auto; }
.ai-setup-lead { margin-bottom: 14px; color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.ai-field { display: block; margin-bottom: 12px; }
.ai-field span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.ai-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.ai-field input:focus { outline: 2px solid rgba(169, 59, 47, .28); outline-offset: 1px; border-color: var(--cinnabar); }
.ai-setup-actions { display: flex; gap: 8px; margin: 14px 0 10px; }
.ai-setup-actions .btn { flex: 1; }
.ai-setup-note { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 11.5px; line-height: 1.7; }
.ai-setup-note code { padding: 1px 4px; border-radius: 4px; background: var(--paper-deep); font-size: 11px; }
#ai-test-result { margin-top: 2px; }
#ai-test-result.ok { color: #3f6f52; }
#ai-test-result.bad { color: var(--cinnabar-deep); }

.ai-chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ai-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px;
  background:
    radial-gradient(600px 260px at 12% 0%, rgba(169, 133, 63, .055), transparent 65%),
    var(--card);
}
.ai-empty {
  margin: auto;
  padding: 22px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.9;
}
.ai-empty b { display: block; margin-bottom: 5px; color: var(--ink-2); font-family: var(--serif); font-size: 16px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 90%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant, .msg.error { align-self: flex-start; align-items: flex-start; }
.msg-bubble {
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.7;
}
.msg.user .msg-bubble { background: linear-gradient(160deg, #b34737, #943226); color: #fff9f0; border-bottom-right-radius: 4px; }
.msg.assistant .msg-bubble { border: 1px solid var(--line-soft); background: #f8f2e6; border-bottom-left-radius: 4px; }
.msg.error .msg-bubble { border: 1px solid #e4b7ab; background: #fbebe6; color: #78281d; }
.msg-meta { padding: 0 3px; color: var(--muted); font-size: 10.5px; letter-spacing: .02em; }
.msg-typing .msg-bubble { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.typing-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); animation: aiPulse 1.1s infinite; }
.typing-dot:nth-child(2) { animation-delay: .16s; }
.typing-dot:nth-child(3) { animation-delay: .32s; }
@keyframes aiPulse { 0%, 100% { opacity: .28; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-1px); } }

.ai-quick {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 14px 10px;
  scrollbar-width: none;
}
.ai-quick::-webkit-scrollbar { display: none; }
.ai-quick button {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf7;
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
}
.ai-quick button:hover { border-color: var(--cinnabar); color: var(--cinnabar-deep); background: #fbf1ea; }

.ai-compose { padding: 10px 12px 8px; border-top: 1px solid var(--line-soft); background: #fbf7ed; }
.ai-compose textarea {
  width: 100%;
  min-height: 46px;
  max-height: 130px;
  resize: none;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
}
.ai-compose textarea:focus { outline: 2px solid rgba(169, 59, 47, .22); border-color: var(--cinnabar); }
.ai-compose-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ai-compose-row select {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf8;
  color: var(--ink-2);
  font: inherit;
  font-size: 11.5px;
}
.ai-cost-hint { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.ai-compose-row .btn { flex: 0 0 auto; }
.ai-foot { padding: 7px 14px calc(9px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 10.5px; line-height: 1.5; text-align: center; }

body.ai-open { overflow: hidden; }

@media (max-width: 620px) {
  .ai-fab { right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); padding-right: 13px; }
  .ai-fab-text { display: none; }
  .ai-fab-seal { width: 34px; height: 34px; }
  .ai-backdrop { background: rgba(33, 27, 21, .42); }
  .ai-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: min(88vh, 760px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(30px);
  }
  .ai-panel.open { transform: none; }
  .ai-setup { padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
  .msg { max-width: 94%; }
}

@media print {
  .ai-fab, .ai-panel, .ai-backdrop { display: none !important; }
}

/* ---------- 干支筛选 / 运动 ---------- */
.gz-card { margin-bottom: 14px; }
.gz-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.gz-field { margin: 0; }
.gz-field select {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.gz-field select:focus { outline: 2px solid rgba(169, 59, 47, .18); border-color: var(--cinnabar); }
.gz-filter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.gz-filter-foot b { color: var(--cinnabar-deep); font-size: 18px; font-family: var(--serif); }
.gz-filter-foot .btn { flex: 0 0 auto; }
.gz-insight {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  background: #f7f0e2;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.65;
}
.gz-insight.subtle { border-left-color: var(--line); color: var(--muted); background: #faf6ec; }
.gz-table-wrap { max-height: 420px; margin-top: 12px; }
.gz-cell { color: var(--ink-2); font-size: 11.5px; white-space: nowrap; }

@media (max-width: 900px) {
  .gz-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .gz-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gz-filter-foot { align-items: flex-start; }
  .gz-insight { font-size: 12px; }
  .gz-table-wrap { max-height: 360px; }
}

/* ---------- 睡眠分段 / 运动清单 / 身心状态 ---------- */
.dur-row { display: flex; align-items: center; gap: 6px; }
.dur-row input { width: 76px; flex: 0 0 auto; }
.dur-unit { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.scale-field { margin-top: 12px; }
.scale-field .body-scale { margin-top: 6px; }
.ex-list { display: flex; flex-direction: column; gap: 10px; }
.ex-row {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
}
.ex-top { display: flex; align-items: center; gap: 8px; }
.ex-name { flex: 1 1 auto; min-width: 0; }
.ex-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.ex-metric { display: flex; flex-direction: column; gap: 4px; }
.ex-metric span { color: var(--muted); font-size: 11px; }
.ex-metric span i { font-style: normal; opacity: .7; }
.ex-metric input { width: 100%; min-width: 0; }
.ex-del {
  flex: 0 0 28px;
  width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: #fffdf8; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer;
}
.ex-del:hover { color: var(--cinnabar-deep); border-color: rgba(169,59,47,.35); }
.ex-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ex-total { color: var(--muted); font-size: 12px; }
@media (max-width: 620px) {
  .dur-row input { width: 66px; }
}
