:root {
  --paper: #F7F5F0;
  --header: #FFFcf8;
  --card: #FFFcf8;
  --line: #E6E2DA;
  --ink: #2A2A26;
  --ink2: #5A5852;
  --ink3: #8A8780;
  --pine: #2F7A48;
  --pine-deep: #246138;
  --leaf: #3D8F55;
  --seal: #C05C4E;
  --seal-deep: #A34D41;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  background-color: var(--paper);
}
.ripple-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--paper) url("../img/antique-ripple.jpg") center / cover no-repeat;
}
.banner, header, main, .clinic-bar, .work, .shelf, footer {
  position: relative;
  z-index: 1;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 3px;
}
.banner {
  margin: 0;
  padding: 8px 40px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--ink3);
  background: #EEEBE6;
}
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header);
  box-shadow: 0 1px 0 var(--line);
}
header::after {
  content: "";
  display: block;
  height: 3px;
  background:
    linear-gradient(var(--pine), var(--pine)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 1px no-repeat;
}
.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 92px;
  width: 100%;
  padding: 12px 40px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}
.logo {
  height: 62px;
  width: auto;
  max-width: 128px;
  display: block;
  object-fit: contain;
}
.wordmark {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-family: var(--serif);
  color: var(--ink);
  white-space: nowrap;
}
.wordmark::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 0 11px 8px;
  background: var(--seal);
}
nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
nav a {
  padding: 8px 14px;
  color: var(--ink2);
  font-size: 16px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
nav a:hover { color: var(--seal); border-bottom-color: var(--seal); }
nav a.current { color: var(--pine); border-bottom-color: var(--pine); }
.search {
  display: flex;
  flex: 1 1 240px;
  min-width: 180px;
  height: 44px;
  border: 1px solid var(--pine);
  border-radius: 4px;
  background: var(--card);
  overflow: hidden;
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.search input::placeholder { color: var(--ink3); }
.search button {
  height: 100%;
  padding: 0 20px;
  border: 0;
  background: var(--pine);
  color: #FFFDF8;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.search button:hover { background: var(--seal); }
.account { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.btn-login, .btn-register {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  height: 40px;
  padding: 0 18px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
}
.btn-login { border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.btn-register { background: var(--pine); color: #FFFDF8; border: 0; }
.btn-login:hover { background: rgba(192, 92, 78, 0.08); border-color: var(--seal); color: var(--seal); }
.btn-register:hover { background: var(--seal); }

/* 整页只留会话区一个竖向滚动容器：window/document 一律不外溢（滚动条只在栏内） */
html:has(body.clinic-page) {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.clinic-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.clinic-page .work {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.chart-toggle,
.side-tab {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.clinic-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 14px;
  min-height: 52px;
  padding: 8px 20px;
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.clinic-bar::after {
  content: none;
}
.clinic-home {
  flex: 0 0 auto;
  color: var(--ink2);
  font-size: 14px;
}
.clinic-home:hover { color: var(--seal); }
.clinic-bar h1 {
  margin: 0;
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--pine);
  border-radius: 4px;
  color: var(--pine);
  font-size: 14px;
  cursor: pointer;
}
.chart-switch {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--pine);
  border-radius: 4px;
  background: transparent;
  color: var(--pine);
  font-size: 14px;
  cursor: pointer;
}
.now-badge {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-size: 14px;
  background: var(--card);
}
.now-badge b { font-weight: 600; color: var(--pine); }
/* 诊籍侧栏三档：≥1200 并排 · 900–1199 并排略窄 · <900 右侧抽屉。
   档位只由宽度决定——旧规则把 max-height:760px 混进布局开关，宽屏矮窗
   就会切成无遮罩浮层，正好压在对话区右侧（本次修的病根）。 */
.clinic-page { --chart-w: clamp(300px, 26%, 380px); }
.clinic-page .chart-switch { display: inline-flex; }
.clinic-page:has(#open-chart:checked) .chart-switch {
  background: var(--pine);
  border-color: var(--pine);
  color: #FFFDF8;
}
.clinic-page .stage-pane {
  display: none;                 /* 收起即不占位：对话区独占整行 */
  width: var(--chart-w);
  flex: 0 0 var(--chart-w);
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--card);
  overflow: hidden;
}
.clinic-page:has(#open-chart:checked) .stage-pane { display: flex; }
.clinic-page .stage-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(42, 42, 38, 0.2) transparent;
  scrollbar-gutter: stable;
}
.clinic-page .chart-head,
.clinic-page .chart-close,
.clinic-page .chart-mask { display: none; }
.clinic-page #panel-chart { display: block; }
.who-now .wn { display: none; }
.clinic-page:has(#who-healer:checked) .wn-healer,
.clinic-page:has(#who-patient:checked) .wn-patient,
.clinic-page:has(#who-pharm:checked) .wn-pharm,
.clinic-page:has(#who-device:checked) .wn-device,
.clinic-page:has(#who-reg:checked) .wn-reg,
.clinic-page:has(#who-legal:checked) .wn-legal,
.clinic-page:has(#who-zhang:checked) .wn-zhang,
.clinic-page:has(#who-sun:checked) .wn-sun,
.clinic-page:has(#who-dongyuan:checked) .wn-dongyuan,
.clinic-page:has(#who-wansu:checked) .wn-wansu,
.clinic-page:has(#who-conzheng:checked) .wn-conzheng,
.clinic-page:has(#who-danxi:checked) .wn-danxi,
.clinic-page:has(#who-tianshi:checked) .wn-tianshi,
.clinic-page:has(#who-jutong:checked) .wn-jutong,
.clinic-page:has(#who-shengbai:checked) .wn-shengbai,
.clinic-page:has(#who-mengying:checked) .wn-mengying,
.clinic-page:has(#who-yuansu:checked) .wn-yuansu,
.clinic-page:has(#who-jingyue:checked) .wn-jingyue,
.clinic-page:has(#who-shizhen:checked) .wn-shizhen,
.clinic-page:has(#who-qianyi:checked) .wn-qianyi,
.clinic-page:has(#who-bianque:checked) .wn-bianque,
.clinic-page:has(#who-huatuo:checked) .wn-huatuo,
.clinic-page:has(#who-huangfu:checked) .wn-huangfu,
.clinic-page:has(#who-qinan:checked) .wn-qinan { display: inline; }
.seat-bar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.92);
}
.seat-chip {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.seat-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seat-chip:hover { border-color: var(--pine); color: var(--pine); }
.seat-chip:has(input:checked) {
  background: var(--pine);
  border-color: var(--pine);
  color: #FFFDF8;
}
.jia-gate { margin-left: 8px; border-color: var(--pine); color: var(--pine); }
.jia-picked { display: none; }
.clinic-page:has(.jia-who:checked) .jia-idle { display: none; }
.clinic-page:has(.jia-who:checked) .jia-picked { display: inline; }
.clinic-page:has(.jia-who:checked) .jia-gate {
  background: var(--pine);
  border-color: var(--pine);
  color: #FFFDF8;
}
.jia-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(42, 42, 38, 0.28);
  cursor: pointer;
}
.jia-sheet {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 19;
  width: min(100%, 360px);
  height: 100vh;
  flex-direction: column;
  padding: 16px 16px 20px;
  border-left: 1px solid var(--line);
  background: var(--card);
}
.clinic-page:has(#open-jia:checked) .jia-mask { display: block; }
.clinic-page:has(#open-jia:checked) .jia-sheet { display: flex; }
.jia-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.jia-sheet-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
}
.jia-close {
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--pine);
  border-radius: 4px;
  color: var(--pine);
  font-size: 14px;
  cursor: pointer;
}
.jia-sheet .jia-list {
  flex: 1 1 auto;
  min-height: 0;
}
.clinic-page .rail {
  width: 228px;
  flex: 0 0 228px;
  display: block;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(42, 42, 38, 0.2) transparent;
  scrollbar-gutter: stable;
}
.clinic-page .desk,
.clinic-page .desk-body {
  min-height: 0;
  overflow: hidden;
}
.teach-page {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.teach-page .work {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.teach-page .rail {
  display: block;
  min-height: 0;
  overflow: auto;
}
.teach-page header { flex: 0 0 auto; }
.teach-page .desk,
.teach-page .desk-body {
  min-height: 0;
  overflow: hidden;
}
.teach-page .casebar .case-name {
  margin-left: auto;
  color: var(--ink2);
}
.clinic-page .lbl { margin: 12px 0 6px; }
.roster-pane { padding: 12px 16px 16px; }
.roster-pane .sub { margin-bottom: 8px; }
.sess-list {
  flex: 0 0 auto;
  overflow: auto;
}
.six-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
  flex: 0 0 auto;
}
.jia-hint {
  margin: 0 0 8px;
  color: var(--ink3);
  font-size: 12px;
  line-height: 1.5;
}
.jia-search {
  width: 100%;
  height: 32px;
  margin-bottom: 8px;
  padding: 0 10px;
  border: 1px solid var(--pine);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
.schools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.schools span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink2);
  font-size: 12px;
}
.schools span.on {
  border-color: var(--pine);
  color: var(--pine);
}
.six-grid .roster {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 6px 8px;
}
.jia-list {
  flex: 1 1 auto;
  min-height: 140px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}
/* 医家名单：席位头像在左，姓名/学派成栏（与在席名册同一套头像，缺图退字符） */
.jia-list .roster { flex-direction: row; align-items: center; gap: 10px; }
.jia-list .roster .jia-meta { display: flex; flex: 1 1 auto; min-width: 0; flex-direction: column; gap: 2px; }
.jia-list .roster .jia-av { flex: 0 0 30px; width: 30px; height: 30px; font-size: 13px; }
.jia-list .roster:has(input:checked) .jia-av { background: var(--pine); color: #FFFDF8; }
.roster {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 4px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.roster b { font-weight: 600; }
.roster small { color: var(--ink3); font-size: 12px; }
.roster input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.roster:hover { background: rgba(47, 122, 72, 0.06); }
.roster:has(input:checked) {
  background: rgba(47, 122, 72, 0.1);
  color: var(--ink);
}
.roster:has(input:checked) small { color: var(--pine); }
.who-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.who-k {
  flex: 1 0 100%;
  margin: 6px 0 0;
  color: var(--ink3);
  font-size: 12px;
  letter-spacing: 0.16em;
}
.who-k:first-child { margin-top: 0; }
.who-chip {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 72px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink2);
  font-size: 15px;
  cursor: pointer;
}
.who-chip small {
  color: var(--ink3);
  font-size: 11px;
}
.who-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.who-chip:has(input:checked) {
  border-color: var(--pine);
  background: rgba(47, 122, 72, 0.08);
  color: var(--ink);
}
.who-chip:has(input:checked) small { color: var(--pine); }

.work {
  display: flex;
  min-height: calc(100vh - 140px);
}
.rail {
  width: 228px;
  flex: 0 0 228px;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.78);
  overflow: auto;
}
.rail-home {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--ink2);
  font-size: 14px;
}
.rail-home:hover { color: var(--seal); }
.new-session {
  display: block;
  width: 100%;
  height: 40px;
  border: 1px solid var(--pine);
  background: transparent;
  color: var(--pine);
  font: inherit;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
}
.new-session:hover { background: var(--pine); color: #FFFDF8; }
a.new-session {
  box-sizing: border-box;
  text-align: center;
  line-height: 38px;
  text-decoration: none;
}
.lbl {
  margin: 22px 0 8px;
  color: var(--ink3);
  font-size: 12px;
  letter-spacing: 0.16em;
}
.sess {
  display: block;
  padding: 10px 10px;
  border-left: 2px solid transparent;
  color: var(--ink2);
  border-radius: 0 4px 4px 0;
  text-decoration: none;
}
.sess small { display: block; color: var(--ink3); font-size: 12px; }
.sess:hover { background: rgba(47, 122, 72, 0.06); }
.rail label.sess { cursor: pointer; }
.sess.on { border-left-color: var(--pine); background: rgba(47, 122, 72, 0.08); color: var(--ink); font-weight: 600; }

/* ── 左栏智能体名册（会诊在席）── */
.roster { display: flex; flex-direction: column; gap: 2px; }
.roster.thin::after {
  content: "会诊至少勾选两位";
  padding: 4px 10px 0;
  color: var(--seal);
  font-size: 11px;
}
.roster-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--pine);
  color: #FFFDF8;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  letter-spacing: 0;
}
.agent-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  color: var(--ink2);
  cursor: pointer;
}
.agent-row input { position: absolute; width: 0; height: 0; margin: 0; opacity: 0; }
.agent-av {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--line);
  color: var(--ink3);
  font-size: 12px;
  font-weight: 600;
}
.agent-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.agent-meta b { color: var(--ink2); font-size: 14px; font-weight: 500; }
.agent-meta small { color: var(--ink3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line); background: transparent; }
.agent-row:hover { background: rgba(47, 122, 72, 0.06); }
.agent-row.on { border-left-color: var(--pine); background: rgba(47, 122, 72, 0.08); }
.agent-row.on .agent-av { background: var(--pine); color: #FFFDF8; }
.agent-row.on .agent-meta b { color: var(--ink); font-weight: 600; }
.agent-row.on .agent-dot { background: var(--pine); border-color: var(--pine); }
.agent-row.speaking { border-left-color: var(--seal); background: rgba(192, 92, 78, 0.1); }
.agent-row.speaking .agent-av { background: var(--seal); color: #FFFDF8; }
.agent-row.speaking .agent-dot { background: var(--seal); border-color: var(--seal); }
.agent-row.speaking .agent-meta small::after { content: " · 正在发言"; color: var(--seal); }
.agent-row.spoke .agent-av { box-shadow: inset 0 0 0 1px var(--pine); }
.agent-row.off { cursor: default; opacity: 0.55; }
.agent-row.off:hover { background: transparent; }
.seat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  color: var(--ink2);
  font-size: 14px;
}
.seat input { accent-color: var(--pine); }
.seat .tag {
  margin-left: auto;
  font-size: 11px;
  color: var(--pine);
  border: 1px solid var(--line);
  padding: 0 5px;
  border-radius: 2px;
}
.desk { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.9);
  flex-wrap: wrap;
}
.seg { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--card); }
.seg a, .seg button {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 7px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--ink2);
  cursor: pointer;
}
.seg a:last-child, .seg button:last-child { border-right: 0; }
.seg a.on, .seg button.on {
  background: var(--pine);
  color: #FFFDF8;
  font-weight: 600;
}
.seg button:disabled { color: #B4AFA6; cursor: not-allowed; }
.case-name { color: var(--ink2); font-size: 14px; }
.case-name b { font-family: var(--serif); color: var(--ink); font-size: 16px; }
.grow { flex: 1; }
.ai-flag { flex: 0 0 auto; color: var(--ink3); font-size: 12px; }
.desk-body { display: flex; flex: 1; min-height: 0; }
.chat {
  flex: 1;
  min-width: 0;
  min-height: 0;              /* flex 子项必须能收缩，否则外层被内容撑高、滚动外溢 */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.casebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink2);
  font-size: 14px;
}
.casebar b { font-family: var(--serif); color: var(--ink); }
/* 会话区＝唯一竖向滚动容器：气泡/思考块/表格都不得自建竖向滚动 */
.thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 24px;
  scroll-padding-top: var(--chat-sticky-h, 12px);   /* 吸顶条实测高度 + 12px，由 workspace.js 写入 */
  scrollbar-gutter: stable;                          /* 滚动条出现/消失不导致横向跳动 */
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(42, 42, 38, 0.2) transparent;
}
.thread::-webkit-scrollbar { width: 8px; height: 8px; }
.thread::-webkit-scrollbar-track { background: transparent; }
.thread::-webkit-scrollbar-thumb {
  background: rgba(42, 42, 38, 0.18);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.thread::-webkit-scrollbar-thumb:hover { background: rgba(42, 42, 38, 0.32); background-clip: padding-box; }
/* 首条消息留出呼吸位，滚到顶时不被上沿任何吸顶条裁掉 */
.thread > .chips:first-child,
.thread > .round-seg:first-child,
.thread > article.msg:first-child { margin-top: 6px; scroll-margin-top: var(--chat-sticky-h, 12px); }
.msg { display: flex; gap: 12px; margin-bottom: 18px; min-width: 0; }
/* 气泡外层：吃满剩余宽度（不再按内容收缩），百分比 max-width 才有正确的参照 */
.msg > div { flex: 1 1 auto; min-width: 0; max-width: calc(100% - 44px); }
.msg.self { flex-direction: row-reverse; }
.av {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-family: var(--serif);
  font-size: 15px;
  color: #FFFDF8;
  background: var(--pine);
}
.av.sage { background: var(--seal); }
.bub {
  /* 宽度按内容自适应：常见主诉单行；长文到最大宽度才折行；不留窄条 */
  width: -moz-fit-content;
  width: fit-content;
  min-width: 0;
  max-width: 90%;                      /* 对话区 78%–86% 区间（整块实测 83%） */
  flex: 0 0 auto;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  overflow-wrap: break-word;           /* 只在单词过长时断，中文按标点/字正常折 */
  word-break: normal;
  line-break: normal;
}
.msg.self .bub { background: #F3F6F1; border-color: #D7E4D6; }
@media (max-width: 480px) { .bub { max-width: 100%; } }   /* 窄屏：占满可用宽度（约对话区 88%），允许折行但不留窄条 */
/* 回复分条：一条一段（模型按行/分点写的正文不再挤成一整段） */
.bub-seg { margin: 0; }
.bub-seg + .bub-seg { margin-top: 8px; }
.who { font-size: 12px; color: var(--ink3); margin-bottom: 4px; }
.think { margin: 2px 0 8px; padding: 4px 10px; border-left: 2px solid var(--line);
  background: rgba(47, 122, 72, 0.04); border-radius: 0 4px 4px 0; color: var(--ink3); font-size: 12.5px; }
.think > summary { cursor: pointer; color: var(--ink3); font-size: 12px; list-style: none; }
.think > summary::-webkit-details-marker { display: none; }
.think > summary::before { content: "▸ "; color: var(--ink3); }
.think[open] > summary::before { content: "▾ "; }
/* 思考过程：整段随会话区一起滚，气泡内不再自建竖向滚动（长推理也能一眼看全） */
.think-body { margin-top: 4px; max-height: none; overflow: visible; white-space: pre-wrap;
  line-height: 1.65; color: var(--ink3); }
/* 表格：只在横向自建滚动，竖向一律交给会话区 */
.bub-table-wrap { max-width: 100%; overflow-x: auto; overflow-y: hidden; margin: 6px 0 8px;
  scrollbar-width: thin; }
.bub-table-wrap::-webkit-scrollbar { height: 6px; }
.bub-table-wrap::-webkit-scrollbar-thumb { background: rgba(42, 42, 38, 0.16); border-radius: 6px; }
.bub-table { border-collapse: collapse; margin: 0; font-size: 12.5px; max-width: 100%; }
.bub-table th, .bub-table td { border: 1px solid var(--line); padding: 3px 8px; text-align: left; vertical-align: top; }
.bub-table th { background: rgba(47, 122, 72, 0.06); color: var(--ink); font-weight: 600; white-space: nowrap; }
.bub-line { margin: 0 0 4px; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.pick { border: 1px solid var(--pine); border-radius: 999px; background: transparent; color: var(--pine);
  font: inherit; font-size: 12.5px; padding: 4px 12px; cursor: pointer; }
.pick:hover { background: rgba(47, 122, 72, 0.1); }
.pick:disabled { opacity: .5; cursor: default; }
.bub-seg strong { font-weight: 600; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 18px; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink2);
  font-size: 14px;
}
.chip.off { color: var(--ink3); }
.compose { border-top: 1px solid var(--line); padding: 12px 20px 16px; background: rgba(255, 252, 248, 0.92); }
.input-row { display: flex; gap: 10px; align-items: center; }
.input-row input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
.send {
  height: 44px;
  padding: 0 22px;
  flex: 0 0 auto;
  white-space: nowrap;
  border: 0;
  border-radius: 4px;
  background: var(--pine);
  color: #FFFDF8;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.send:hover { background: var(--seal); }
.consult-toggle {
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--pine);
  border-radius: 4px;
  background: transparent;
  color: var(--pine);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.consult-toggle:hover { background: rgba(47, 122, 72, 0.08); }
.consult-toggle.on { background: var(--seal); border-color: var(--seal); color: #FFFDF8; }
.consult-toggle.on:hover { background: var(--seal-deep); }
.pending { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.pending-head { color: var(--ink3); font-size: 12px; }
.pending-chip {
  padding: 2px 10px;
  border: 1px dashed var(--seal);
  border-radius: 10px;
  background: rgba(192, 92, 78, 0.08);
  color: var(--seal-deep);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.pending-chip:hover { background: rgba(192, 92, 78, 0.16); }

/* [hidden] 兜底：作者样式的 display 会压过 UA 的 hidden，必须显式声明 */
[hidden] { display: none !important; }

/* ── 刀二：逐字上屏 / 邀请过程 / 升级给人 ── */
.escalation {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 16px 0; padding: 8px 12px;
  border: 1px solid var(--seal); border-left-width: 4px; border-radius: 4px;
  background: rgba(192, 92, 78, 0.07);
}
.escalation-tag { color: var(--seal-deep); font-size: 12px; letter-spacing: 0.08em; white-space: nowrap; }
.escalation-text { flex: 1; color: var(--ink2); font-size: 13px; line-height: 1.6; }
.escalation-ack {
  padding: 3px 10px; border: 1px solid var(--seal); border-radius: 3px;
  background: transparent; color: var(--seal-deep); font: inherit; font-size: 12px; cursor: pointer;
}
.escalation-ack:hover { background: rgba(192, 92, 78, 0.12); }
.bub.live::after {
  content: "▍"; margin-left: 2px; color: var(--pine); opacity: 0.7;
  animation: tcm-blink 1s steps(1) infinite;
}
@keyframes tcm-blink { 50% { opacity: 0; } }
.agent-row.thinking .agent-dot { background: var(--pine); animation: tcm-pulse 1.1s ease-in-out infinite; }
.agent-row.speaking .agent-dot { background: var(--seal); box-shadow: 0 0 0 3px rgba(192, 92, 78, 0.18); }
.agent-row.speaking .agent-meta small::after { content: " · 发言中"; color: var(--seal); }
.agent-row.thinking .agent-meta small::after { content: " · 思考中"; color: var(--pine); }
.agent-row.failed .agent-dot { background: var(--ink3); }
.agent-row.failed .agent-meta small::after { content: " · 未发言"; color: var(--ink3); }
@keyframes tcm-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.pending-fill {
  padding: 3px 9px; border: 1px dashed var(--line); border-radius: 3px;
  background: transparent; color: var(--ink3); font: inherit; font-size: 12px; cursor: pointer;
}
.pending-fill:hover { border-color: var(--pine); color: var(--pine-deep); }

/* ── UI v2：模式徽标 / 状态条 / 双菜单栏 / 阶段分段 ── */
.mode-badge {
  padding: 3px 10px;
  border-radius: 10px;
  background: var(--line);
  color: var(--ink2);
  font-size: 13px;
  font-weight: 600;
}
.mode-badge.is-consult { background: rgba(47,122,72,0.14); color: var(--pine-deep); }
.mode-badge.is-live { background: rgba(47,122,72,0.9); color: #FFFDF8; }
.mode-badge.is-await { background: rgba(192,92,78,0.95); color: #FFFDF8; }
.seat-summary { color: var(--ink3); font-size: 13px; }
.rail-sec { margin-bottom: 14px; }
.rail-sec-head {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 4px 0; border: 0; background: transparent;
  color: var(--ink3); font: inherit; font-size: 12px; letter-spacing: 0.12em;
  cursor: pointer; text-align: left;
}
.rail-sec-head::before { content: "▾"; font-size: 10px; transition: transform 0.15s; }
.rail-sec.collapsed .rail-sec-head::before { transform: rotate(-90deg); }
.rail-sec.collapsed .rail-sec-body { display: none; }
.rail-sec-title { flex: 1; }
.rail-count {
  min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--line); color: var(--ink2);
  font-size: 11px; line-height: 16px; text-align: center; letter-spacing: 0;
}
.rail-empty { padding: 6px 10px; color: var(--ink3); font-size: 12px; }
.rail-sec[data-sec="consult"]:not(.roster-open) .roster-wrap { display: none; }
.rail-sec[data-sec="consult"] .roster-wrap { margin-bottom: 8px; }
.sess { position: relative; }
.sess.expired { opacity: 0.5; }
.sess-badge {
  display: inline-block; margin-top: 4px; padding: 0 6px;
  border-radius: 9px; font-size: 11px; line-height: 16px;
  background: var(--line); color: var(--ink3);
}
.sess-badge.is-consult { background: rgba(47,122,72,0.12); color: var(--pine-deep); }
.sess-badge.is-await { background: rgba(192,92,78,0.14); color: var(--seal-deep); }
.sess-badge.is-expired { background: var(--line); color: var(--ink3); }
.round-seg { display: block; margin: 14px 0 6px; }
.round-seg-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px; color: var(--ink3); font-size: 12px; letter-spacing: 0.14em;
}
.round-seg-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.seg-self .round-seg-head { color: var(--seal-deep); }
.status-bar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.status-msg { padding: 6px 10px; border-radius: 4px; font-size: 12px; line-height: 1.6; }
.status-msg.is-info { background: rgba(47,122,72,0.08); color: var(--pine-deep); }
.status-msg.is-warn { background: rgba(192,92,78,0.1); color: var(--seal-deep); }
.status-msg.is-error { background: rgba(192,92,78,0.18); color: var(--seal-deep); }
.pane-head { cursor: pointer; }
.pane-head::after { content: " ⌃"; color: var(--ink3); font-size: 12px; }
.pane.collapsed .pane-head::after { content: " ⌄"; }
.pane.collapsed dl, .pane.collapsed .rec-ops, .pane.collapsed .sub, .pane.collapsed p { display: none; }
.agent-row.pending .agent-dot { background: var(--seal); border-color: var(--seal); }
.agent-row.pending .agent-meta small::after { content: " · 待补"; color: var(--seal); }
.agent-row.unasked { opacity: 0.75; }
.agent-row.unasked .agent-meta small::after { content: " · 未点名"; color: var(--ink3); }

.agent-row.host { cursor: default; border-left-color: var(--pine-deep); }
.agent-row.host .agent-av { background: var(--pine-deep); color: #FFFDF8; }
.agent-row.host .agent-meta b { color: var(--ink); font-weight: 600; }
.agent-row.passed { opacity: 0.6; }
.agent-row.passed .agent-meta small::after { content: " · 无新增意见"; color: var(--ink3); }
.agent-at {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink3);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.agent-at:hover { border-color: var(--pine); color: var(--pine); }
.rec-ops { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.rec-op { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; background: rgba(255,255,255,0.5); }
.rec-op.silent { opacity: 0.7; }
.rec-op-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rec-op-head b { font-size: 14px; color: var(--ink2); }
.rec-op p { margin: 0; color: var(--ink2); font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.verdict { margin-left: auto; padding: 0 6px; border-radius: 9px; font-size: 11px; line-height: 16px; }
.verdict.adopted { background: rgba(47,122,72,0.12); color: var(--pine-deep); }
.verdict.rejected { background: rgba(192,92,78,0.14); color: var(--seal-deep); }
.verdict.open { background: var(--line); color: var(--ink3); }
.verdict.none { background: var(--line); color: var(--ink3); }
body.turn-busy .consult-toggle { opacity: 0.55; cursor: default; }
body.turn-busy .roster { pointer-events: none; opacity: 0.75; }
.voice {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink2);
  font: inherit;
  cursor: pointer;
}
.legal { margin-top: 10px; font-size: 12px; color: var(--ink3); }
.stage-pane {
  width: 380px;
  flex: 0 0 380px;
  border-left: 1px solid var(--line);
  background: var(--card);
  overflow: auto;
}
.pane { padding: 20px; }
.pane h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
}
.pane .sub { margin: 0 0 16px; color: var(--ink3); font-size: 13px; }
.field { border-top: 1px solid var(--line); padding: 12px 0; }
.field dt { font-size: 12px; color: var(--ink3); letter-spacing: 0.12em; margin-bottom: 4px; }
.field dd { margin: 0; color: var(--ink); }
.sage-view {
  margin: 0 20px 12px;
  background: #1A1F1C;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  max-height: 340px;
}
.sage-view img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.sage-cap { margin: 0 20px 12px; color: var(--ink3); font-size: 13px; }
.tabs { display: flex; gap: 0; margin: 0 20px; border-bottom: 1px solid var(--line); }
.tabs a {
  padding: 8px 14px;
  color: var(--ink2);
  border-bottom: 2px solid transparent;
}
.tabs a.on { color: var(--pine); border-bottom-color: var(--pine); }
.board {
  margin: 12px 20px 20px;
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #F6F4EF;
  font-family: var(--serif);
  line-height: 1.85;
}

.shelf { padding: 28px 40px 64px; }
.shelf-head { max-width: 1280px; margin: 0 auto 24px; }
.shelf-head h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 36px;
  letter-spacing: 0.08em;
}
.shelf-head p { margin: 0; color: var(--ink2); }
.shelf-tabs { display: flex; gap: 8px; margin-top: 18px; }
.shelf-tabs label {
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink2);
  cursor: pointer;
}
#tab-lib:checked ~ .shelf-head .shelf-tabs label[for="tab-lib"],
#tab-graph:checked ~ .shelf-head .shelf-tabs label[for="tab-graph"] {
  background: var(--pine);
  color: #FFFDF8;
  border-color: var(--pine);
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; max-width: 1280px; margin: 0 auto 22px; }
.filters span {
  padding: 6px 12px;
  border-radius: 4px;
  color: var(--ink2);
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
}
.filters span.on { border-color: var(--pine); color: var(--pine); }
.course-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  max-width: 1280px;
  margin: 0 auto;
}
.course {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.course:hover { border-color: var(--seal); }
.code { color: var(--seal); font-family: var(--serif); font-size: 14px; letter-spacing: 0.08em; }
.course h2 { margin: 8px 0 8px; font-family: var(--serif); font-size: 22px; }
.course p { margin: 0 0 auto; color: var(--ink2); font-size: 15px; }
.go {
  display: inline-flex;
  align-items: center;
  margin-top: 18px;
  padding: 8px 16px;
  background: var(--pine);
  color: #FFFDF8;
  border-radius: 4px;
  font-size: 15px;
}
.go:hover { background: var(--seal); }
.course-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.course-actions .go { margin-top: 0; }
.go-ghost {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--pine);
  border-radius: 4px;
  color: var(--pine);
  font-size: 15px;
}
.go-ghost:hover { background: rgba(47, 122, 72, 0.08); }
.course-meta { margin: 0 0 8px; color: var(--ink3); font-size: 13px; }
.resume-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  max-width: 1280px;
  margin: 0 auto 22px;
  padding: 14px 18px;
  border: 1px solid var(--pine);
  border-radius: 4px;
  background: rgba(47, 122, 72, 0.06);
}
.resume-k {
  color: var(--pine);
  font-size: 12px;
  letter-spacing: 0.16em;
}
.resume-strip b {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
}
.resume-strip span { color: var(--ink2); font-size: 14px; }
.resume-strip .go { margin-left: auto; margin-top: 0; }
.catalog-desk {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  max-width: 1280px;
  margin: 0 auto;
}
.cat-rail .lbl { margin: 18px 0 8px; }
.cat-rail .lbl:first-child { margin-top: 0; }
.cat-rail label {
  display: block;
  padding: 6px 10px;
  border-left: 2px solid transparent;
  color: var(--ink2);
  font-size: 14px;
  cursor: pointer;
  border-radius: 0 4px 4px 0;
}
.cat-rail label:hover { background: rgba(47, 122, 72, 0.06); }
.catalog-page:has(#dept-all:checked) .cat-rail label[for="dept-all"],
.catalog-page:has(#dept-tcm:checked) .cat-rail label[for="dept-tcm"],
.catalog-page:has(#dept-herb:checked) .cat-rail label[for="dept-herb"],
.catalog-page:has(#dept-needle:checked) .cat-rail label[for="dept-needle"],
.catalog-page:has(#dept-tuina:checked) .cat-rail label[for="dept-tuina"],
.catalog-page:has(#dept-bone:checked) .cat-rail label[for="dept-bone"],
.catalog-page:has(#dept-orofacial:checked) .cat-rail label[for="dept-orofacial"],
.catalog-page:has(#dept-intel:checked) .cat-rail label[for="dept-intel"],
.catalog-page:has(#dept-admin:checked) .cat-rail label[for="dept-admin"],
.catalog-page:has(#dept-nursing:checked) .cat-rail label[for="dept-nursing"] {
  border-left-color: var(--pine);
  background: rgba(47, 122, 72, 0.08);
  color: var(--ink);
  font-weight: 600;
}
.catalog-page:has(#dept-tcm:checked) .course:not([data-dept="tcm"]),
.catalog-page:has(#dept-herb:checked) .course:not([data-dept="herb"]),
.catalog-page:has(#dept-needle:checked) .course:not([data-dept="needle"]),
.catalog-page:has(#dept-tuina:checked) .course:not([data-dept="tuina"]),
.catalog-page:has(#dept-bone:checked) .course:not([data-dept="bone"]),
.catalog-page:has(#dept-orofacial:checked) .course:not([data-dept="orofacial"]),
.catalog-page:has(#dept-intel:checked) .course:not([data-dept="intel"]),
.catalog-page:has(#dept-admin:checked) .course:not([data-dept="admin"]),
.catalog-page:has(#dept-nursing:checked) .course:not([data-dept="nursing"]) { display: none; }
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-content: start;
}
.catalog-grid .course { min-height: 0; }
.crumb {
  max-width: 1280px;
  margin: 0 auto 16px;
  color: var(--ink3);
  font-size: 14px;
}
.crumb a { color: var(--pine); }
.course-home { max-width: 1280px; margin: 0 auto; }
.course-lead {
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--line);
}
.course-lead h1 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: 36px;
  letter-spacing: 0.08em;
}
.course-lead p { margin: 0 0 10px; color: var(--ink2); max-width: 46em; }
.chap-title {
  margin: 28px 0 12px;
  font-family: var(--serif);
  font-size: 22px;
}
.chap-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.chap-list a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.chap-list a:hover { color: var(--pine); }
.chap-list small { color: var(--ink3); font-size: 13px; }
.chap-list .on a {
  background: rgba(47, 122, 72, 0.08);
  font-weight: 600;
}
.chap-list .on small { color: var(--pine); }
.learn-nav {
  display: flex;
  flex-wrap: wrap;
  padding: 0 40px;
  background: var(--header);
}
.learn-nav a {
  padding: 10px 20px 12px;
  color: var(--ink2);
  font-size: 16px;
  border-bottom: 2px solid transparent;
}
.learn-nav a:hover { color: var(--pine); }
.learn-nav a.on {
  color: var(--pine);
  font-weight: 600;
  border-bottom-color: var(--pine);
}
.module-nav {
  display: flex;
  flex-wrap: wrap;
  padding: 0 40px 2px;
  background: var(--header);
  border-top: 1px solid var(--line);
}
.module-nav a {
  padding: 8px 18px 10px;
  color: var(--ink2);
  font-size: 15px;
  border-bottom: 2px solid transparent;
}
.module-nav a:hover { color: var(--pine); }
.module-nav a.on {
  color: var(--pine);
  font-weight: 600;
  border-bottom-color: var(--pine);
}
.group-head {
  max-width: 1280px;
  margin: 0 auto 16px;
}
.group-head h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 22px;
}
.group-head p { margin: 0; color: var(--ink2); font-size: 15px; }
.mod-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto 40px;
}
.mod-card {
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.mod-card:hover { border-color: var(--seal); }
.mod-card .code { display: inline-flex; align-items: center; gap: 8px; }
.mod-star {
  color: var(--seal);
  font-size: 13px;
}
.mod-card h2 {
  margin: 10px 0 10px;
  font-family: var(--serif);
  font-size: 20px;
}
.mod-card p { margin: 0 0 auto; color: var(--ink2); font-size: 15px; }
.kg-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 1280px;
  margin: 0 auto 20px;
}
.kg-node {
  padding: 8px 14px;
  border: 1px solid var(--pine);
  border-radius: 4px;
  background: var(--card);
  color: var(--pine-deep);
  font-size: 15px;
}
.kg-node.on {
  background: var(--pine);
  color: #FFFDF8;
}
.kg-arrow { color: var(--ink3); }
.pipe {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 1280px;
  margin: 0 auto 24px;
}
.pipe-step {
  flex: 1 1 140px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.pipe-step b { display: block; color: var(--seal); font-family: var(--serif); font-size: 13px; }
.pipe-step span { display: block; margin-top: 6px; font-size: 14px; color: var(--ink2); }
.pipe-step.on { border-color: var(--pine); }
.research-desk {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 260px;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  align-items: start;
}
.task-rail,
.trace-pane {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.task-rail .lbl,
.trace-pane .lbl { margin-top: 0; }
.task-item {
  display: block;
  padding: 8px 10px;
  margin: 0 -6px 4px;
  border-left: 2px solid transparent;
  color: var(--ink2);
  font-size: 14px;
}
.task-item small { display: block; color: var(--ink3); font-size: 12px; }
.task-item.on {
  border-left-color: var(--pine);
  background: rgba(47, 122, 72, 0.08);
  color: var(--ink);
}
.canvas-col .ask { margin-bottom: 16px; }
.trace-hit {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink2);
}
.trace-hit:last-child { border-bottom: 0; margin-bottom: 0; }
.trust-ok,
.trust-wait {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 2px;
  font-size: 12px;
}
.trust-ok {
  background: rgba(47, 122, 72, 0.12);
  color: var(--pine-deep);
}
.trust-wait {
  background: rgba(192, 92, 78, 0.12);
  color: var(--seal-deep);
}
.async-bar {
  margin: 0 0 16px;
  color: var(--ink3);
  font-size: 13px;
}
.teach-page .pane-mahuang { display: none; }
.teach-page:has(#sess-guizhi:checked) .rail label[for="sess-guizhi"],
.teach-page:has(#sess-mahuang:checked) .rail label[for="sess-mahuang"] {
  border-left-color: var(--pine);
  background: rgba(47, 122, 72, 0.08);
  color: var(--ink);
  font-weight: 600;
}
.teach-page:has(#sess-mahuang:checked) .pane-guizhi { display: none; }
.teach-page:has(#sess-mahuang:checked) span.case-name.pane-mahuang { display: inline; }
.teach-page:has(#sess-mahuang:checked) .casebar.pane-mahuang { display: flex; }
.teach-page:has(#sess-mahuang:checked) .thread.pane-mahuang { display: block; }
.teach-page:has(#sess-mahuang:checked) .board.pane-mahuang { display: block; }
.rail-empty {
  margin: 0;
  color: var(--ink3);
  font-size: 13px;
  line-height: 1.65;
}
.teach-blank {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.teach-blank h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
  letter-spacing: 0.06em;
}
.teach-blank p {
  margin: 0;
  max-width: 28em;
  color: var(--ink2);
}
.teach-blank .go { margin-top: 8px; }
.sess-board {
  max-width: 1280px;
  margin: 0 auto;
}
.sess-board .sess { padding: 12px 10px; }
.reader {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 260px;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  align-items: start;
}
.reader-main { min-width: 0; }
.reader-toc .lbl { margin-top: 0; }
.reader-toc label {
  display: block;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  color: var(--ink2);
  font-size: 14px;
  cursor: pointer;
}
.reader-toc small { display: block; color: var(--ink3); font-size: 12px; }
.catalog-page:has(#chap-guizhi:checked) .reader-toc label[for="chap-guizhi"],
.catalog-page:has(#chap-mahuang:checked) .reader-toc label[for="chap-mahuang"] {
  border-left-color: var(--pine);
  background: rgba(47, 122, 72, 0.08);
  color: var(--ink);
  font-weight: 600;
}
.reader-body {
  padding: 28px 32px 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.reader-body h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 24px;
}
.reader-body .verse {
  margin: 16px 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 2;
}
.reader-body .note { color: var(--ink2); font-size: 15px; }
#text-mahuang { display: none; }
.catalog-page:has(#chap-mahuang:checked) #text-guizhi { display: none; }
.catalog-page:has(#chap-mahuang:checked) #text-mahuang { display: block; }
.plain-only { display: none; }
.catalog-page:has(#mode-plain:checked) .lecture-only { display: none; }
.catalog-page:has(#mode-plain:checked) #text-guizhi,
.catalog-page:has(#mode-plain:checked) #text-mahuang { display: none; }
.catalog-page:has(#mode-plain:checked):has(#chap-guizhi:checked) #text-plain-guizhi { display: block; }
.catalog-page:has(#mode-plain:checked):has(#chap-mahuang:checked) #text-plain-mahuang { display: block; }
.mode-tabs {
  display: flex;
  gap: 8px;
  max-width: 1280px;
  margin: 0 auto 18px;
}
.mode-tabs label {
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink2);
  cursor: pointer;
}
.catalog-page:has(#mode-lecture:checked) .mode-tabs label[for="mode-lecture"],
.catalog-page:has(#mode-plain:checked) .mode-tabs label[for="mode-plain"] {
  background: var(--pine);
  color: #FFFDF8;
  border-color: var(--pine);
}
.case-attach {
  margin-top: 20px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.case-attach h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 20px;
}
.case-attach p { margin: 0 0 12px; color: var(--ink2); }
.case-mahuang { display: none; }
.catalog-page:has(#chap-mahuang:checked) .case-guizhi { display: none; }
.catalog-page:has(#chap-mahuang:checked) .case-mahuang { display: block; }
.reader-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.video-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  border-radius: 4px;
  background: #1A1F1C;
  color: #F7F5F0;
  font-size: 14px;
  text-align: center;
  line-height: 1.6;
}
.reader-side .go,
.reader-side .go-ghost { margin-top: 0; justify-content: center; }
.case-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
}
.case-card, .book-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.case-card h2, .book-card h2 {
  margin: 8px 0 8px;
  font-family: var(--serif);
  font-size: 22px;
}
.book-read {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 32px 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.book-read h1 {
  margin: 8px 0 16px;
  font-family: var(--serif);
  font-size: 32px;
}
.book-read .verse {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 2.1;
}
#tab-lib, #tab-graph { position: absolute; opacity: 0; pointer-events: none; }
#panel-lib, #panel-graph { display: none; }
#tab-lib:checked ~ #panel-lib { display: block; }
#tab-graph:checked ~ #panel-graph { display: block; }
.ask {
  max-width: 1280px;
  margin: 0 auto 28px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.ask label { display: block; margin-bottom: 10px; color: var(--ink2); }
.ask-row { display: flex; gap: 10px; }
.ask-row input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--pine);
  border-radius: 4px;
  font: inherit;
  background: #FFFcf8;
}
.hits { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.hit {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.hit p { margin: 0 0 12px; color: var(--ink); }
.cite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--ink3);
  font-size: 14px;
}
.cite b { color: var(--seal); font-family: var(--serif); font-weight: 600; }
.cite a {
  padding: 6px 12px;
  background: var(--pine);
  color: #FFFDF8;
  border-radius: 4px;
  font-size: 14px;
}
.cite a:hover { background: var(--seal); }
.cite label {
  padding: 6px 12px;
  background: var(--pine);
  color: #FFFDF8;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}
.graph-box {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.graph-box h2 { margin: 0 0 8px; font-family: var(--serif); }
.dsu { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 15px; }
.dsu th, .dsu td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.dsu th { color: var(--ink3); font-weight: 500; font-size: 13px; }
.research-strip {
  max-width: 1280px;
  margin: 0 auto 18px;
  color: var(--ink3);
  font-size: 14px;
}
.protocol-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto 28px;
}
.protocol {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.protocol h2 {
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: 20px;
}
.protocol p { margin: 0; color: var(--ink2); font-size: 15px; }
.flag-src,
.flag-infer {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.flag-src {
  background: rgba(47, 122, 72, 0.12);
  color: var(--pine-deep);
}
.flag-infer {
  background: rgba(192, 92, 78, 0.12);
  color: var(--seal-deep);
}
.lit-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
}
.lit {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.lit h2 {
  margin: 8px 0 8px;
  font-family: var(--serif);
  font-size: 22px;
}
.lit p { margin: 0; color: var(--ink2); font-size: 15px; }
.lit-out { opacity: 0.78; }
.extract-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  overflow-x: auto;
}
.extract {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.extract th,
.extract td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.extract th {
  color: var(--ink3);
  font-weight: 500;
  font-size: 13px;
}
.extract td a { color: var(--pine); }
.extract td a:hover { color: var(--seal); }
.compare-note {
  margin: 16px 0 0;
  color: var(--ink2);
  font-size: 15px;
}
.shelf .course-actions { max-width: 1280px; margin: 0 auto; }

footer.site-foot {
  padding: 20px 40px 40px;
  color: var(--ink3);
  font-size: 14px;
  border-top: 1px solid var(--line);
}
.foot-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sponsor { margin-top: 12px; }

.formula-hit {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.formula-hit.pass { border-color: var(--pine); }
.formula-hit.block { border-color: var(--seal); }
.formula-hit h2 {
  margin: 0 0 8px;
  font-size: 18px;
}
.formula-hit p { margin: 0; color: var(--ink2); font-size: 15px; }

@media (max-width: 1100px) {
  nav { display: none; }
  .learn-nav,
  .module-nav { display: flex; }
  .wordmark { font-size: 26px; }
  .stage-pane { width: 300px; flex-basis: 300px; }
  .course-grid { grid-template-columns: 1fr; }
  .catalog-grid { grid-template-columns: 1fr; }
  .case-grid { grid-template-columns: 1fr; }
  .mod-grid { grid-template-columns: 1fr; }
  .protocol-grid { grid-template-columns: 1fr; }
  .reader { grid-template-columns: 1fr; }
  .research-desk { grid-template-columns: 1fr; }
}
/* 诊籍侧栏：并排两档按宽度选宽窄；窄屏（<900）才收成右侧抽屉。
   抽屉自带遮罩与关闭按钮，对话区宽度不变、可继续滚。 */
@media (min-width: 900px) and (max-width: 1199px) {
  .clinic-page { --chart-w: clamp(240px, 26%, 290px); }
}
@media (max-width: 899px) {
  .clinic-page .stage-pane {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 26;
    width: min(320px, 78vw);
    height: 100vh;
    height: 100dvh;
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 32px rgba(42, 42, 38, 0.18);
  }
  .clinic-page .chart-mask {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 24;
    background: rgba(42, 42, 38, 0.34);
  }
  /* .work 自己是 z-index:1 的层叠上下文，抽屉要压过顶栏（10）就得整层抬起来；
     抬到 12 仍低于医家抽屉（18/19），两个抽屉不会互相打架。 */
  .clinic-page:has(#open-chart:checked) .work { z-index: 12; }
  .clinic-page:has(#open-chart:checked) .chart-mask { display: block; }
  .clinic-page .chart-head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--ink3);
    font-size: 12px;
    letter-spacing: 0.08em;
  }
  .clinic-page .chart-head b { font-family: var(--serif); font-size: 16px; color: var(--ink); letter-spacing: 0.02em; }
  .clinic-page .stage-body .pane-head { display: none; }   /* 抽屉头已写“诊籍”，不重复 */
  .clinic-page .chart-close {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--pine);
    border-radius: 4px;
    color: var(--pine);
    font-size: 14px;
    cursor: pointer;
  }
}
@media (max-width: 720px) {
  .protocol-grid { grid-template-columns: 1fr; }
  .bar { padding: 10px 16px; flex-wrap: wrap; }
  .search { order: 3; flex: 1 1 100%; }
  .rail { display: none; }
  .clinic-page .rail { display: none; }     /* 压过 .clinic-page .rail{display:block}：窄屏单列 */
  .clinic-page .seat-bar { flex-wrap: wrap; row-gap: 4px; }  /* 窄屏席位条换行，医家入口不被裁掉 */
  .stage-pane { display: none; }
  .clinic-bar { padding-left: 16px; padding-right: 16px; }
  .clinic-bar h1 { font-size: 17px; }
  .shelf, footer.site-foot, .banner { padding-left: 16px; padding-right: 16px; }
  .catalog-desk { grid-template-columns: 1fr; }
  .mod-grid { grid-template-columns: 1fr; }
  .learn-nav,
  .module-nav { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.banner { display: none; }
.site-foot a:hover { color: var(--pine); }
.hero {
  text-align: center;
  margin-bottom: 40px;
}
.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.35;
  color: var(--ink);
}
.roles {
  margin: 16px 0 10px;
  color: var(--ink2);
  font-size: 18px;
  letter-spacing: 0.28em;
}
.note {
  margin: 0;
  color: var(--ink2);
}
.stage-wrap {
  max-width: 1280px;
  margin: 0 auto;
}
.stage {
  padding: 36px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(42, 36, 28, 0.06);
  outline: 1px solid rgba(47, 122, 72, 0.22);
  outline-offset: -8px;
}
.gates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
}
.gate {
  display: flex;
  flex-direction: column;
  min-height: 248px;
  padding: 28px 24px 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #F6F4EF;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.gate:hover {
  border-color: var(--seal);
  box-shadow: 0 8px 24px rgba(192, 92, 78, 0.10);
}
.gate:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 2px;
}
.mark {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--seal);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2em;
}
.gate h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.gate p {
  margin: 0 0 auto;
  color: var(--ink2);
  font-size: 16px;
  line-height: 1.75;
}
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin-top: 24px;
  padding: 10px 20px;
  border-radius: 4px;
  background: var(--pine);
  color: #FFFDF8;
  font-size: 16px;
  font-weight: 500;
}
.gate:hover .cta { background: var(--seal); }
.home-page main {
  width: 100%;
  padding: 48px 40px 72px;
}
/* 门户检索结果（首页 / 关于页共用；后端 /semantic-search 病证单元）。样式复用既有 .hits/.hit/.cite */
.hits[hidden] { display: none; }
.hits-head { margin: 0 0 2px; color: var(--ink2); font-size: 14px; letter-spacing: 0.04em; }
.hit .hit-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}
.hit .hit-title b { margin-right: 8px; color: var(--seal); }
.search-note { margin: 0; color: var(--ink3); font-size: 13px; }
.search-note a { color: var(--pine); }
.search-note a:hover { color: var(--seal); }
.home-page .site-foot {
  padding: 20px 40px 48px;
}
.about-body h2 {
  margin: 32px 0 12px;
  font-family: var(--serif);
  font-size: 22px;
}
.about-body p { color: var(--ink2); }
@media (max-width: 720px) {
  .hero h1 { font-size: 36px; letter-spacing: 0.06em; }
  .roles { letter-spacing: 0.14em; }
  .stage { padding: 20px; }
  .gates { grid-template-columns: 1fr; }
}

/* 安全条（平台硬关卡：红旗征命中时确定性出现，与升级条同布局、异配色） */
.escalation.safety { background: rgba(192, 57, 43, 0.10); border-color: rgba(192, 57, 43, 0.45); }
.escalation.safety .escalation-tag { color: #a4291c; }
.escalation.safety .escalation-text { color: var(--ink2); font-weight: 500; }

/* ── 对话输入能力：语音 / 上传 / 朗读（与 workspace 两份同源）── */
.input-row .icon-btn {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line, rgba(0,0,0,.14));
  border-radius: 8px; background: transparent; cursor: pointer;
  font-size: 15px; line-height: 1; color: inherit; opacity: .82;
}
.input-row .icon-btn:hover { opacity: 1; }
.input-row .icon-btn.rec {
  color: #fff; background: #c0392b; border-color: #c0392b;
  width: auto; padding: 0 9px; font-size: 12px; opacity: 1;
}
.input-row .icon-btn.on { opacity: 1; border-color: currentColor; }
/* ── 附件芯片：对齐 Hermes 桌面端 composer 的 pill（图标＋文件名＋✕，零说明文字）── */
.attach-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 0 6px; max-width: 100%; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 224px; min-width: 0; padding: 3px 4px 3px 3px;
  border: 1px solid var(--line, rgba(0,0,0,.14)); border-radius: 10px;
  background: var(--card, #fff); font-size: 12px; line-height: 1.2; color: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
  transition: border-color .12s, background .12s, opacity .12s;
}
.attach-chip .attach-ico {
  flex: 0 0 auto; width: 22px; height: 22px; display: inline-flex;
  align-items: center; justify-content: center;
  border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: 6px;
  background: rgba(0,0,0,.03); font-size: 11px; line-height: 1;
}
.attach-name { display: block; min-width: 0; flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attach-chip.openable { cursor: pointer; }
.attach-chip.openable:hover, .attach-chip.openable:focus-visible { border-color: var(--pine, #2f7a48); outline: none; }
/* 待发 vs 已收好：只改观感，不加字 —— 待发虚线半透明，已收好实线 */
.attach-chip.pending { border-style: dashed; opacity: .62; background: transparent; box-shadow: none; }
.attach-chip.pending .attach-ico { background: transparent; }
.attach-chip.done { opacity: 1; }
.attach-chip.err { border-color: rgba(192,57,43,.55); opacity: .9; }
.attach-chip.err .attach-ico { color: transparent; border-color: rgba(192,57,43,.5); background: rgba(192,57,43,.08); font-size: 0; position: relative; }
.attach-chip.err .attach-ico::before { content: "!"; font-size: 12px; font-weight: 700; color: #c0392b; }
/* 辨识进行中：图标位转圈，不写「正在辨识」 */
.attach-chip.busy .attach-ico { position: relative; color: transparent; font-size: 0; }
.attach-chip.busy .attach-ico::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.14); border-top-color: rgba(0,0,0,.5);
  animation: attach-spin .8s linear infinite;
}
@keyframes attach-spin { to { transform: rotate(360deg); } }
/* 芯片上的「✕」：悬停/聚焦才显形，触摸设备常显；点击区 20×20，不与展开、发送抢手 */
.attach-x {
  flex: 0 0 auto; width: 20px; height: 20px; min-width: 20px; padding: 0; margin: 0 -1px 0 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: inherit;
  font-size: 10px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s, background .12s;
}
.attach-chip:hover .attach-x, .attach-chip:focus-within .attach-x { opacity: .6; }
.attach-x:hover, .attach-x:focus-visible { opacity: 1; color: #c0392b; background: rgba(192, 57, 43, .12); outline: none; }
@media (hover: none) { .attach-x { opacity: .55; } }
/* 拖拽入区：只靠边框与底色说话 */
.compose.dropping { outline: 2px dashed var(--pine, #2f7a48); outline-offset: -2px; background: rgba(47,122,72,.05); }
/* 点芯片看全文的弹层 */
.attach-sheet {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(0,0,0,.26);
}
.attach-sheet-card {
  display: flex; flex-direction: column; width: min(560px, 100%); max-height: min(72vh, 640px);
  border: 1px solid var(--line, rgba(0,0,0,.14)); border-radius: 12px;
  background: var(--card, #fff); box-shadow: 0 24px 60px rgba(0,0,0,.22);
}
.attach-sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line, rgba(0,0,0,.1)); }
.attach-sheet-head b { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.attach-sheet-x { flex: 0 0 auto; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; opacity: .55; }
.attach-sheet-x:hover { opacity: 1; background: rgba(0,0,0,.06); }
.attach-sheet-body { margin: 0; padding: 14px; overflow: auto; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.speak-btn {
  align-self: flex-start; margin-top: 4px;
  border: 1px solid var(--line, rgba(0,0,0,.14)); border-radius: 6px;
  background: transparent; cursor: pointer; font-size: 12px;
  padding: 1px 7px; opacity: .7; color: inherit;
}
.speak-btn:hover { opacity: 1; }
.speak-btn.playing { opacity: 1; border-color: currentColor; }
.speak-btn.busy { opacity: .5; }

/* ── 「＋」附加菜单（对齐 Hermes 桌面端 composer 的 + 菜单）── */
.attach-menu-wrap { position: relative; flex: 0 0 auto; }
.attach-menu {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 40;
  min-width: 15rem; padding: 4px;
  border: 1px solid var(--line, rgba(0,0,0,.14)); border-radius: 10px;
  background: var(--card, #fff); box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.attach-menu[hidden] { display: none !important; }
.attach-menu-label {
  padding: 4px 8px 2px; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; opacity: .55;
}
.attach-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 7px; background: transparent;
  font: inherit; font-size: 13px; text-align: left; cursor: pointer; color: inherit;
}
.attach-menu-item:hover, .attach-menu-item:focus-visible { background: var(--accent, rgba(0,0,0,.06)); outline: none; }
.attach-menu-url { display: flex; gap: 6px; padding: 4px 6px 2px; }
.attach-menu-url[hidden] { display: none !important; }
.attach-url-input {
  flex: 1 1 auto; min-width: 0; padding: 6px 8px; font: inherit; font-size: 13px;
  border: 1px solid var(--line, rgba(0,0,0,.14)); border-radius: 7px; background: transparent; color: inherit;
}
.attach-url-go {
  flex: 0 0 auto; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line, rgba(0,0,0,.14)); border-radius: 7px; background: transparent; color: inherit;
}
.input-row .icon-btn.add { font-size: 17px; line-height: 1; }

/* ── 输入框内「@」点名列表（对齐 Hermes bots 的 @ 提及）── */
/* ── 对话框本体：＋ 在框内左侧、语音/朗读在框内右侧（框宽＝原输入框宽度）── */
.input-row .compose-box {
  position: relative; flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 2px;
  height: 44px; padding: 0 4px 0 2px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--card);
}
.input-row .compose-box > #compose-input {
  flex: 1 1 auto; min-width: 0; height: 40px; padding: 0 6px;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
.input-row .compose-box .icon-btn { flex: 0 0 auto; width: 30px; height: 30px; border: 0; opacity: .62; font-size: 15px; }
.input-row .compose-box .icon-btn:hover, .input-row .compose-box .icon-btn.on { opacity: 1; }
.input-row .compose-box .attach-menu-wrap { position: relative; flex: 0 0 auto; }
.input-row .compose-box .icon-btn.add { font-size: 17px; }
.mention-menu {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 41;
  min-width: 15rem; max-height: 15rem; overflow-y: auto; padding: 4px;
  border: 1px solid var(--line, rgba(0,0,0,.14)); border-radius: 10px;
  background: var(--card, #fff); box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.mention-menu[hidden] { display: none !important; }
.mention-menu-label {
  padding: 4px 8px 2px; font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; opacity: .55;
}
.mention-item {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  padding: 6px 8px; border: 0; border-radius: 7px; background: transparent;
  font: inherit; font-size: 13px; text-align: left; cursor: pointer; color: inherit;
}
.mention-item:hover, .mention-item[aria-selected="true"] { background: var(--accent, rgba(0,0,0,.06)); outline: none; }
.mention-item .mention-note { font-size: 11px; opacity: .6; }
.mention-item .mention-at { opacity: .5; }
.mention-strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 6px; }
.mention-strip[hidden] { display: none !important; }
.mention-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 999px; font-size: 12px; border: 1px solid currentColor; opacity: .9;
}
.mention-chip .mention-note { opacity: .6; }

/* ── 席位头像（图片优先，缺图/断网自动退回字符）── */
.av, .agent-av { position: relative; overflow: hidden; }
.av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.av.has-img, .agent-av.has-img { color: transparent; }
.mention-item .mention-av {
  position: relative; overflow: hidden; flex: 0 0 18px; width: 18px; height: 18px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--line); color: var(--ink3); font-size: 10px; font-weight: 600;
}
.mention-item { align-items: center; }

/* ── 会话历史管理（ui2-15）：过滤条、置顶组、行内动作菜单、回收站 ── */
.rail-filter { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 0 10px; }
.rail-chip {
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 10px;
  background: transparent; color: var(--ink3); font: inherit; font-size: 12px;
  line-height: 18px; cursor: pointer;
}
.rail-chip:hover { border-color: var(--pine); color: var(--pine-deep); }
.rail-chip.on {
  border-color: var(--pine); background: rgba(47, 122, 72, 0.1);
  color: var(--pine-deep); font-weight: 600;
}
.sess { padding-right: 26px; }
.sess-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-more {
  position: absolute; right: 4px; top: 6px; width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 5px; background: transparent; color: var(--ink3);
  font: inherit; line-height: 18px; cursor: pointer; opacity: 0; transition: opacity 0.12s;
}
.sess:hover .sess-more, .sess.on .sess-more { opacity: 1; }
.sess-more:hover { background: var(--line); color: var(--ink); }
.sess-pin {
  display: inline-block; margin-top: 4px; margin-left: 4px; padding: 0 6px;
  border-radius: 9px; font-size: 11px; line-height: 16px;
  background: rgba(47, 122, 72, 0.12); color: var(--pine-deep);
}
.sess.is-archived { opacity: 0.72; }
.sess.is-trash { opacity: 0.68; font-style: italic; }
.sess-rename {
  width: 100%; padding: 1px 4px; border: 1px solid var(--pine); border-radius: 4px;
  background: #fff; color: var(--ink); font: inherit; font-weight: 600;
}
.sess-menu {
  position: fixed; z-index: 90; min-width: 148px; padding: 4px;
  display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #FFFDFA; box-shadow: 0 8px 24px rgba(42, 42, 38, 0.14);
}
.sess-menu button {
  padding: 6px 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--ink2); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.sess-menu button:hover { background: rgba(47, 122, 72, 0.08); color: var(--ink); }
.sess-menu button.danger { color: var(--seal-deep); }
.sess-menu button.danger:hover { background: rgba(192, 92, 78, 0.1); }

/* ── P1：搜索 / 多选 / 分页 / 未读 / 分享到微信（ui2-16）── */
.rail-tools { display: flex; gap: 6px; padding: 0 0 8px; }
#rail-search {
  flex: 1; min-width: 0; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #FFFDFA; color: var(--ink); font: inherit; font-size: 12px;
}
#rail-search::placeholder { color: var(--ink3); }
.rail-multi {
  flex: 0 0 auto; padding: 4px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink2); font: inherit; font-size: 12px; cursor: pointer;
}
.rail-multi.on { border-color: var(--pine); background: rgba(47,122,72,0.1); color: var(--pine-deep); font-weight: 600; }
.rail-more {
  width: 100%; margin-top: 6px; padding: 6px; border: 1px dashed var(--line); border-radius: 8px;
  background: transparent; color: var(--ink3); font: inherit; font-size: 12px; cursor: pointer;
}
.rail-more:hover { border-color: var(--pine); color: var(--pine-deep); }
.rail-selbar {
  position: sticky; bottom: 0; margin-top: 8px; padding: 8px; border: 1px solid var(--line);
  border-radius: 10px; background: rgba(255,253,250,0.96); box-shadow: 0 -4px 14px rgba(42,42,38,0.06);
}
.sel-count { display: block; margin-bottom: 6px; color: var(--ink2); font-size: 12px; }
.sel-acts { display: flex; flex-wrap: wrap; gap: 4px; }
.sel-acts button {
  padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: transparent;
  color: var(--ink2); font: inherit; font-size: 12px; cursor: pointer;
}
.sel-acts button:hover { border-color: var(--pine); color: var(--pine-deep); }
.sel-acts button.danger { color: var(--seal-deep); border-color: rgba(192,92,78,0.4); }
.sess-check { position: absolute; left: -2px; top: 10px; }
.sess.is-sel { background: rgba(47,122,72,0.1); }
.sess-dot {
  display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%;
  background: var(--seal-deep); vertical-align: 2px;
}
body.sel-mode .sess-title { pointer-events: none; }
.share-modal {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  background: rgba(42,42,38,0.34);
}
.share-card {
  width: min(720px, 92vw); max-height: 88vh; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 14px; background: #FFFDFA;
  box-shadow: 0 18px 48px rgba(42,42,38,0.24);
}
.share-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.share-head b { flex: 1; color: var(--ink); font-size: 15px; }
.share-mask { color: var(--ink2); font-size: 12px; }
.share-x { border: 0; background: transparent; color: var(--ink3); font-size: 20px; line-height: 1; cursor: pointer; }
.share-preview { overflow: auto; padding: 14px 16px; text-align: center; }
.share-preview canvas { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; }
.share-acts { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.share-acts button {
  padding: 6px 14px; border: 1px solid var(--pine); border-radius: 9px; background: rgba(47,122,72,0.08);
  color: var(--pine-deep); font: inherit; font-size: 13px; cursor: pointer;
}
.share-acts button:hover { background: rgba(47,122,72,0.16); }
.share-note { color: var(--ink3); font-size: 12px; }

/* ── 资料识读：诊籍「资料」行逐件列出字数与全文（输入区只留芯片）── */
.chart-attach { margin: 2px 0 6px; }
.chart-attach-name { font-size: 13px; line-height: 1.5; word-break: break-all; }
.chart-attach-tip { color: var(--ink3, #777); font-size: 12px; }
.chart-attach-more { margin-top: 2px; }
.chart-attach-more summary { cursor: pointer; color: var(--pine, #2f7a48); font-size: 12px; }
.chart-attach-more pre {
  max-height: 200px; overflow: auto; margin: 4px 0 0; padding: 8px;
  border: 1px solid var(--line, rgba(0,0,0,.12)); border-radius: 8px;
  font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  color: var(--ink2, #444); background: rgba(0,0,0,0.02);
}
