:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --line: #e7e4dd;
  --line-soft: #f0eee8;
  --ink: #1b1a18;
  --ink-2: #45413a;
  --muted: #857f75;
  --accent: #2f6f5e;
  --accent-soft: #e9f1ed;
  --blue: #3a6ea5;
  --blue-soft: #e8eff7;
  --warn: #9a6a17;
  --warn-soft: #fbf2e1;
  --danger: #a8443c;
  --danger-soft: #f8eae8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 26, 22, .04), 0 6px 20px rgba(28, 26, 22, .04);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

/* ---------------- sidebar ---------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 16px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 14px; letter-spacing: .01em; }
.brand-text span { font-size: 11px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: var(--surface-2); color: var(--ink); }

.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.nav-item .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line); flex: none;
}
.nav-item.is-active .dot { background: var(--accent); }

.side-foot {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--surface-2);
}
.side-label { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.path {
  margin: 4px 0 10px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 10.5px;
  color: var(--ink-2);
  word-break: break-all;
  line-height: 1.5;
}
.ghost-btn {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit; font-size: 12.5px;
  cursor: pointer;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }
.side-hint { margin-top: 8px; font-size: 10.5px; color: var(--muted); }

/* ---------------- main ---------------- */

.main { padding: 26px 34px 40px; max-width: 1180px; }

.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }

.eyebrow { font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
h1 { margin: 2px 0 0; font-size: 26px; font-weight: 650; letter-spacing: -.01em; }

.switch-wrap { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch-wrap input { position: absolute; opacity: 0; pointer-events: none; }
.track {
  width: 38px; height: 21px; border-radius: 999px;
  background: #dcd8d0; position: relative; transition: background .18s;
}
.knob {
  position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .18s;
}
.switch-wrap input:checked + .track { background: var(--danger); }
.switch-wrap input:checked + .track .knob { transform: translateX(17px); }
.switch-text { font-size: 12.5px; color: var(--ink-2); }

.banner {
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid #efd3ce;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #8c3b34;
  font-size: 12.5px;
}

/* ---------------- 快速记录 ---------------- */

.capture {
  margin-bottom: 18px;
  padding: 13px 14px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .18s, box-shadow .18s;
}
.capture:focus-within {
  border-color: #c8c1b4;
  box-shadow: 0 0 0 3px rgba(47, 111, 94, .07), var(--shadow);
}

.cap-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.cap-title { font-size: 12.5px; font-weight: 650; letter-spacing: .02em; color: var(--ink-2); }
.cap-hint { font-size: 11.5px; color: var(--muted); }

.cap-row { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }

#capInput {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 180px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  resize: none;
  overflow-y: auto;
  outline: none;
  transition: border-color .16s, background .16s;
}
#capInput::placeholder { color: #b3ada2; }
#capInput:focus { border-color: #bfb8ab; background: var(--surface); }

.cap-mic, .cap-send {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .16s, border-color .16s, color .16s, transform .1s;
}
.cap-mic { width: 40px; display: grid; place-items: center; flex: none; }
.cap-mic svg { width: 18px; height: 18px; }
.cap-mic:hover:not(:disabled) { border-color: #bfb8ab; background: var(--surface); }
.cap-mic:active:not(:disabled) { transform: scale(.96); }
.cap-mic.is-rec {
  background: var(--danger-soft);
  border-color: #e8bdb7;
  color: var(--danger);
  animation: micPulse 1.25s ease-out infinite;
}
@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(168, 68, 60, .28); }
  70% { box-shadow: 0 0 0 9px rgba(168, 68, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 68, 60, 0); }
}
.cap-mic:disabled { opacity: .42; cursor: not-allowed; }
.cap-mic.is-off { opacity: .5; }
.cap-mic.is-off:hover { opacity: .72; border-color: var(--line); background: var(--surface-2); }

.cap-send {
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  flex: none;
}
.cap-send:hover:not(:disabled) { background: #322e29; }
.cap-send:active:not(:disabled) { transform: scale(.98); }
.cap-send:disabled { opacity: .5; cursor: not-allowed; }

.cap-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  min-height: 18px;
}
.cap-chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.cap-chk input { width: 13px; height: 13px; accent-color: var(--danger); cursor: pointer; }
.cap-state { font-size: 11.5px; color: var(--muted); text-align: right; }
.cap-state.warn { color: var(--warn); }
.cap-state.ok { color: var(--accent); }
.cap-model {
  font-size: 11.5px; color: var(--muted); margin-left: auto;
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
  white-space: nowrap; cursor: help;
}
.cap-model.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------------- 整理结果卡片 ---------------- */

.cap-result {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  overflow: hidden;
}

.cr-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-bottom: 1px dashed var(--line);
}
.cr-kind {
  font-size: 11.5px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e9f1ed;
  color: var(--accent);
  border: 1px solid #d5e4dc;
  flex: none;
}
.cr-kcal {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.cr-id {
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-x {
  flex: none;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  color: var(--muted);
  padding: 0 2px;
  margin-left: 2px;
}
.cr-x:hover { color: var(--ink); }

.cr-items { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 11px; }
.cr-item {
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 8px;
  font-variant-numeric: tabular-nums;
}
.cr-item b { font-weight: 650; color: var(--ink); }
.cr-empty { font-size: 11.5px; color: var(--muted); }

.cr-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-top: 1px dashed var(--line);
}
.cr-by { font-size: 11px; color: var(--muted); }

.cr-btn {
  flex: none;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s, border-color .16s;
}
.cr-btn:hover:not(:disabled) { background: #322e29; }
.cr-btn:disabled { cursor: default; opacity: .55; }
.cr-btn.is-done { background: var(--accent); border-color: var(--accent); opacity: 1; }

/* 结果卡可容纳多个按钮（生成待办 + 撤销），by 文本占据剩余空间 */
.cr-foot { flex-wrap: wrap; }
.cr-foot .cr-by { flex: 1 1 auto; min-width: 0; }

/* 提问类：只回答，不落盘 */
.cr-kind-reply { background: var(--accent); color: #fff; border-color: var(--accent); }
.cr-reply {
  padding: 12px 13px;
  font-size: 13px;
  line-height: 1.68;
  color: var(--ink);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}

/* ---------------- 日历 ---------------- */

.cal-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.cal-bar .ghost-btn { flex: 0 0 auto; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-wd { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0 4px; }

.cal-cell {
  min-height: 66px;
  padding: 6px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.cal-cell.is-empty { border: 0; background: transparent; cursor: default; }
.cal-cell.has { border-color: var(--line); }
.cal-cell:hover:not(.is-empty) { border-color: var(--ink-2); }
.cal-cell.is-today { border-color: var(--accent); background: var(--accent-soft); }
.cal-cell.is-sel { box-shadow: inset 0 0 0 2px var(--accent); }

.cal-num { font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.2; }
.cal-cell.is-today .cal-num { color: var(--accent); }

.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.cal-dot.meal { background: #2f6f5e; }
.cal-dot.mind { background: #3a6ea5; }
.cal-dot.note { background: #a09a90; }
.cal-dot.activity { background: #9a6a17; }
.cal-dot.sens { background: #c2803a; box-shadow: 0 0 0 2px rgba(194, 128, 58, .18); }

.cal-cnt { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

.cal-row {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft);
}
.cal-row:last-child { border-bottom: 0; }
.cal-time { flex: 0 0 64px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.cal-time b { display: block; font-size: 10px; font-weight: 500; opacity: .75; }
.cal-tag {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.cal-tag.mind { background: var(--blue-soft); color: var(--blue); }
.cal-tag.meal { background: var(--accent-soft); color: var(--accent); }
.cal-tag.activity { background: var(--warn-soft); color: var(--warn); }
.cal-txt { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--ink-2); }
.cal-id { flex: 0 0 auto; font-size: 11px; color: var(--muted); }

/* ---------------- 趋势 ---------------- */

.tr-sum { display: flex; align-items: baseline; gap: 14px; }
.tr-big { font-size: 30px; font-weight: 650; letter-spacing: -.02em; color: var(--accent); line-height: 1.1; }
.tr-big small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 7px; letter-spacing: 0; }
.tr-sub { font-size: 12.5px; color: var(--muted); }

.tr-chart { margin: 18px 0 4px; }
.tr-plot {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  height: 142px;
  border-bottom: 1px solid var(--line);
}
.tr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}
.tr-num { font-size: 11px; color: var(--muted); height: 15px; line-height: 15px; }
.tr-bar {
  width: 68%;
  max-width: 34px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  opacity: .75;
}
.tr-col.is-now .tr-bar { background: var(--accent); opacity: 1; }
.tr-col.is-now .tr-num { color: var(--accent); font-weight: 650; }

.tr-axis {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 5px;
}
.tr-xl {
  text-align: center;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
  white-space: nowrap;
}
.tr-xl b { display: block; font-size: 10px; font-weight: 500; opacity: .62; }
.tr-xl.is-now { color: var(--accent); font-weight: 600; }
.tr-xl.is-now b { opacity: .8; }

.tr-note { font-size: 12px; color: var(--muted); line-height: 1.75; }

.tr-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft);
}
.tr-row:last-child { border-bottom: 0; }
.tr-time { flex: 0 0 76px; font-size: 12px; color: var(--muted); }
.tr-txt { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--ink-2); }
.tr-id { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.tr-masked { color: var(--muted); font-style: italic; }

/* mind 类回执：一句确认 + 求助入口，附在记录卡底部，不抢记录信息 */
.cr-say {
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--accent);
  background: var(--accent-soft);
  border-top: 1px solid var(--line);
}

/* 一句话拆成多条 */
.cr-multi { border-top: 1px solid var(--line); }
.cr-multi-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.cr-multi-row:last-child { border-bottom: 0; }
.cr-multi-txt {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-multi-id { flex: none; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 撤销：次要动作，弱化处理 */
.cr-undo { background: transparent; color: var(--muted); border-color: var(--line); }
.cr-undo:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); border-color: var(--ink-2); }

.cr-tag {
  flex: none;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------- cards ---------------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }

.stat {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }

.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 14px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h2 { margin: 0; font-size: 13.5px; font-weight: 650; letter-spacing: .01em; }
.card-head .count { font-size: 11.5px; color: var(--muted); }
.card-body { padding: 6px 0; }
.card-body.pad { padding: 14px 16px; }

/* ---------------- list items ---------------- */

.row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 13.5px; color: var(--ink); }
.row-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.row-sub code { font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; }

.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11px; color: var(--muted); }

/* ---------------- pills ---------------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.todo { background: #f1efe9; color: #6b6459; }
.pill.doing { background: var(--blue-soft); color: var(--blue); }
.pill.done { background: var(--accent-soft); color: var(--accent); }
.pill.cancelled { background: var(--danger-soft); color: var(--danger); }
.pill.active { background: var(--accent-soft); color: var(--accent); }
.pill.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.sensitive { background: #efeaf6; color: #6b4f97; }
.pill.p-high { background: var(--danger-soft); color: var(--danger); }
.pill.p-medium { background: var(--warn-soft); color: var(--warn); }
.pill.p-low { background: #f1efe9; color: #6b6459; }

/* ---------------- toolbar ---------------- */

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit; font-size: 12.5px;
  cursor: pointer;
}
.chip:hover { border-color: #cfc9bd; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.search {
  flex: 1; min-width: 190px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font: inherit; font-size: 13px;
  color: var(--ink);
}
.search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ---------------- table ---------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; vertical-align: top; }
th {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--line-soft); }
tbody tr:hover { background: var(--surface-2); }
td.id { white-space: nowrap; }
td.due { white-space: nowrap; font-size: 12.5px; }

.title-cell { display: flex; flex-direction: column; gap: 2px; }
.title-cell .t { font-size: 13.5px; }

select.status-select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font: inherit; font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
select.status-select:hover { border-color: var(--accent); }

.detail-row td { background: var(--surface-2); padding: 0; }
.detail {
  padding: 14px 16px 16px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  border-top: 1px dashed var(--line);
}
.detail h4 { margin: 0 0 6px; font-size: 11.5px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; font-weight: 600; }
.detail ul { margin: 0; padding-left: 16px; }
.detail li { font-size: 12.5px; color: var(--ink-2); margin-bottom: 3px; }
.detail .kv { display: flex; gap: 8px; font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
.detail .kv b { color: var(--muted); font-weight: 500; min-width: 62px; }

/* ---------------- records ---------------- */

.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 9px 14px;
  border: 0; background: transparent;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit; font-size: 13px;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.mem-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.mem {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.mem-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.mem ul { margin: 0 0 8px; padding-left: 16px; }
.mem li { font-size: 13px; color: var(--ink-2); }
.mem .ev { font-size: 11.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.mem .ev div { margin-bottom: 2px; }

.kr { list-style: none; margin: 0 0 10px; padding: 0; }
.kr li { display: flex; gap: 8px; font-size: 12.5px; color: var(--ink-2); padding: 3px 0; }
.kr .box {
  width: 13px; height: 13px; border: 1.5px solid #cfc9bd; border-radius: 3px; flex: none; margin-top: 3px;
}
.kr li.done .box { background: var(--accent); border-color: var(--accent); }
.kr li.done { color: var(--muted); text-decoration: line-through; }

/* ---------------- level ---------------- */

.level-hero {
  display: flex; align-items: center; gap: 22px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.lv-badge {
  width: 76px; height: 76px; flex: none;
  display: grid; place-items: center;
  border-radius: 20px;
  background: linear-gradient(150deg, #2f6f5e, #1f4a3f);
  color: #fff;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
}
.lv-badge b { display: block; font-size: 24px; letter-spacing: -.02em; }
.level-hero .meta { flex: 1; }
.level-hero h3 { margin: 0 0 4px; font-size: 16px; }
.level-hero p { margin: 0; font-size: 12.5px; color: var(--muted); }

.bar { height: 8px; border-radius: 999px; background: #ece9e2; margin-top: 12px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0%; background: repeating-linear-gradient(45deg, #d9d4c9, #d9d4c9 6px, #e4e0d7 6px, #e4e0d7 12px); }

.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.badge {
  padding: 16px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.badge .b-mark {
  width: 40px; height: 40px; margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 11px; color: #b8b2a6;
}
.badge .b-name { font-size: 12.5px; color: var(--ink-2); }
.badge .b-note { font-size: 10.5px; margin-top: 2px; }

/* 待精修提示：这些数字只是估算，且面板自己不会再算准，所以指向唯一的精修入口 */
.polish-tip {
  margin-bottom: 10px;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 7px;
}
.polish-tip b { font-weight: 650; color: var(--warn); }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------------- profile ---------------- */

.prof-grid { display: grid; grid-template-columns: 1.45fr .85fr; gap: 14px; }
.prof-grid > .card + .card { margin-top: 0; }

.radar-wrap { display: flex; justify-content: center; padding: 4px 0 2px; }
.radar { width: 100%; max-width: 520px; height: auto; }

.radar-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; justify-content: center; padding-top: 6px; }
.radar-legend .lg {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--ink-2);
}
.radar-legend .lg b { font-weight: 600; }
.radar-legend .lg em { font-style: normal; color: var(--accent); font-weight: 700; }
.radar-legend .lg i { font-style: normal; font-size: 10px; color: var(--warn); }

.pending-dims {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.pending-dims .pd {
  padding: 2px 8px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-2);
}

.fact-cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 4px 18px;
  align-items: start;
}
.fg-col { min-width: 0; }
.fg-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 0 2px 4px; margin-bottom: 1px;
  border-bottom: 1px solid var(--line);
  font-size: 11px; color: var(--muted); letter-spacing: .02em;
}
.fg-head .fg-all { font-size: 10px; color: #b0aaa0; letter-spacing: 0; }
.fg-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 3px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.fg-row:last-child { border-bottom: 0; }
.fg-k { flex: none; width: 60px; font-size: 12px; color: var(--muted); }
.fg-v {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 650; letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.fg-v small { font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 2px; white-space: nowrap; }
.fg-row .pill { flex: none; font-size: 9.5px; padding: 0 5px; }
.fg-row .dim { color: #c0bbb0; font-weight: 500; }

.score-cell { white-space: nowrap; }
.scorebar {
  display: inline-block; width: 54px; height: 6px;
  border-radius: 999px; background: #ece9e2;
  margin-right: 7px; vertical-align: middle; overflow: hidden;
}
.scorebar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.score-cell b { font-weight: 650; }
.score-cell .dim { font-size: 11px; }
.src-cell { font-size: 11.5px; color: var(--muted); max-width: 340px; }

.pref-group { border-bottom: 1px solid var(--line-soft); }
.pref-group:last-child { border-bottom: 0; }
.pg-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  color: var(--muted); text-transform: uppercase;
}
.pg-head span { font-weight: 500; letter-spacing: 0; text-transform: none; }
.pref-group .row { padding-left: 16px; }

.tend {
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.tend.like { background: var(--accent-soft); color: var(--accent); }
.tend.dis { background: var(--danger-soft); color: var(--danger); }
.tend.mid { background: #f1efe9; color: #6b6459; }

.trait-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px; font-weight: 650;
}
.tc-head span { font-size: 11px; font-weight: 500; color: var(--muted); }
.tc-head.good { color: var(--accent); }
.tc-head.bad { color: var(--warn); }
.trait {
  padding: 9px 11px; margin-bottom: 7px;
  border: 1px solid var(--line-soft); border-radius: 9px;
  background: var(--surface-2);
}
.trait .t-name {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.trait .t-note { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.pill.inferred { background: var(--blue-soft); color: var(--blue); }

.prof-foot {
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.65;
}
.prof-foot code { font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; }

.hint-p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.75; }
.hint-p code { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.foot { margin-top: 26px; font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.foot-dot { opacity: .5; }

.toast {
  position: fixed; right: 22px; bottom: 22px;
  max-width: 380px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 8px 26px rgba(0,0,0,.2);
  z-index: 50;
}
.toast.err { background: var(--danger); }

/* ---------------- 知识库导览 ---------------- */

.kn-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.kn-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.kn-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 13px; font-family: inherit;
  transition: background .15s, border-color .15s, color .15s;
}
.kn-chip:hover { border-color: var(--accent); color: var(--accent); }
.kn-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.kn-chip small { font-size: 11px; opacity: .75; }
.kn-sum-line { font-size: 12px; color: var(--muted); white-space: nowrap; }

.kn-list { display: grid; gap: 10px; }
.kn-topic {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px; cursor: pointer;
  box-shadow: var(--shadow); transition: border-color .15s;
}
.kn-topic:hover { border-color: var(--accent); }
.kn-topic.is-open { border-color: var(--accent); cursor: default; }
.kn-topic-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.kn-topic-top h3 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: .01em; }
.kn-topic-top .count { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.kn-sum { margin: 5px 0 0; font-size: 13px; color: var(--ink-2); }
.kn-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.kn-tags span {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.kn-more { margin-top: 8px; font-size: 12px; color: var(--blue); }
.kn-doc {
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
  cursor: default;
}
.kn-doc h1 { font-size: 16px; margin: 0 0 6px; }
.kn-doc h2 { font-size: 13.5px; margin: 14px 0 6px; color: var(--ink-2); }
.kn-doc h3 { font-size: 13px; margin: 12px 0 5px; color: var(--ink-2); }
.kn-doc blockquote {
  margin: 0 0 8px; padding: 7px 11px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); color: var(--ink-2); border-radius: 0 8px 8px 0;
}
.kn-doc p { margin: 0 0 7px; }
.kn-ol, .kn-ul { margin: 0 0 8px; padding-left: 20px; }
.kn-ol li, .kn-ul li { margin-bottom: 5px; font-size: 13.2px; }
.kn-empty { padding: 26px 22px; }
.kn-empty h2 { margin: 0 0 8px; font-size: 15px; }
.kn-empty p { margin: 0 0 8px; color: var(--ink-2); font-size: 13px; }
.kn-tip { color: var(--muted) !important; font-size: 12.5px !important; }

/* ---------------- 日课 ---------------- */

.pl-head {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
}
.pl-date { font-size: 12.5px; color: var(--muted); letter-spacing: .4px; }
.pl-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin: 10px 0 14px;
}
.pl-stat { display: flex; align-items: baseline; gap: 5px; }
.pl-stat b { font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -.4px; color: var(--ink); }
.pl-stat span { font-size: 11.5px; color: var(--muted); }
.pl-stat.is-fly b { color: var(--warn); }
.pl-bars { display: flex; flex-direction: column; gap: 4px; }
.pl-bar {
  height: 7px; border-radius: 4px; background: var(--line-soft); overflow: hidden;
}
.pl-bar.is-thin { height: 4px; }
.pl-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .18s ease; }
.pl-bar.is-thin i { background: var(--line); }
.pl-caps { margin-top: 10px; font-size: 11.5px; color: var(--muted); }

.pl-group {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pl-ghead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 0;
}
.pl-gname { font-size: 14.5px; font-weight: 650; color: var(--ink); }
.pl-gcnt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-ghint { padding: 2px 18px 10px; font-size: 11.5px; color: var(--muted); }

.pl-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 18px;
  border-top: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .12s ease;
}
.pl-row:hover { background: var(--surface-2); }
.pl-row.is-done { background: var(--accent-soft); }
.pl-row.is-done:hover { background: #e2ece7; }

.pl-box {
  flex: 0 0 auto;
  width: 17px; height: 17px;
  margin-top: 2px;
  border: 1.5px solid #c9c4ba;
  border-radius: 5px;
  background: var(--surface);
  position: relative;
}
.pl-row.is-done .pl-box { background: var(--accent); border-color: var(--accent); }
.pl-row.is-done .pl-box::after {
  content: '';
  position: absolute; left: 4.5px; top: 1px;
  width: 4.5px; height: 8.5px;
  border: solid #fff; border-width: 0 1.6px 1.6px 0;
  transform: rotate(43deg);
}

.pl-main { min-width: 0; flex: 1 1 auto; }
.pl-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pl-row.is-done .pl-name { color: #24564a; }

/* 提醒时间：清空即不提醒，所以样式要像「可编辑的标签」而不是按钮 */
.pl-time {
  flex: 0 0 auto;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line, #e7e4dd);
  border-radius: 6px;
  padding: 1px 4px;
  height: 22px;
  cursor: pointer;
}
.pl-time:focus { outline: none; border-color: var(--muted-2, #b9b2a6); }
.pl-time:not(:placeholder-shown) { color: var(--ink-2); }
.pl-time::-webkit-calendar-picker-indicator { opacity: .45; cursor: pointer; }
.pl-dose { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.pl-note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.pl-row.is-count { cursor: default; background: var(--surface); }
.pl-row.is-count:hover { background: var(--surface-2); }
.pl-step {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 2px;
  margin-top: -2px;
}
.pl-step b {
  min-width: 30px; text-align: center;
  font-size: 18px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pl-row.is-done .pl-step b { color: var(--warn); }
.pl-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 8px;
  font-size: 15px; line-height: 1;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.pl-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.pl-foot {
  margin: 16px 2px 0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.7;
}

/* 日历上的日课打卡标记 */
.cal-check {
  font-size: 10px;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
  margin-top: 1px;
}
.cal-cell.has-plan { background: #f2f7f4; }
.cal-cell.has-plan.is-today { background: var(--accent-soft); }
.cal-plan-line {
  margin: 0 0 12px;
  padding: 9px 13px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  font-size: 12.5px;
  color: var(--ink-2);
}
.cal-plan-line b { color: var(--accent); font-variant-numeric: tabular-nums; }
.cal-plan-line span { color: var(--muted); font-size: 11.5px; }

@media (max-width: 980px) {
  /* minmax(0,1fr) 而不是 1fr：否则内容的最小宽度会撑破视口，手机端出现横向滚动 */
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; overflow-x: auto; }
  .brand-text, .side-foot { display: none; }
  .nav { flex-direction: row; }
  /* 横排时不让导航项被压扁成竖排文字，放不下就整体横向滚动 */
  .nav-item { flex: none; white-space: nowrap; }
  .main { padding: 20px 18px 32px; min-width: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .mem-grid, .badges, .prof-grid, .trait-cols { grid-template-columns: minmax(0, 1fr); }
  .detail { grid-template-columns: 1fr; }
  .prof-grid > .card + .card { margin-top: 14px; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .fact-cols { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .main { padding: 16px 13px 28px; }
  h1 { font-size: 22px; }
  .cap-hint { display: none; }
  .cap-send { padding: 0 13px; }
  .cap-foot { flex-wrap: wrap; }
  /* 窄屏让导航换行成两排，比横向滚动更好点 */
  .sidebar { flex-wrap: wrap; row-gap: 4px; padding: 12px 13px; }
  .nav { flex-wrap: wrap; row-gap: 2px; }
  .nav-item { padding: 7px 9px; font-size: 13px; }
}


/* === 公开展示样式调整 === */
.pill.sensitive, .cap-model, .polish-tip,
.tr-masked, .cal-dot.sens, .kn-tip { display: none !important; }
