:root {
  --brand: #0f9d76;
  --brand-soft: #e6f6f0;
  --wechat: #ededed;
  --wechat-head: #f7f7f7;
  --bubble-me: #95ec69;
  --ink: #191919;
  --ink-2: #4a4a4a;
  --muted: #8a8a8a;
  --line: #e4e4e4;
  --ok: #07c160;
  --warn: #e59a1a;
  --bad: #e5484d;
  --panel: #f6f7f8;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: #eef0f1;
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
b, strong { font-weight: 600; }

/* ---------- topbar ---------- */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(145deg, #16b087, #0b7a5c);
  color: #fff; font-weight: 700; font-size: 15px;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(15, 157, 118, .28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 14px; letter-spacing: .3px; }
.brand-text i { font-style: normal; font-size: 11px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.badge {
  font-size: 11px; padding: 4px 9px; border-radius: 99px;
  background: var(--brand-soft); color: #0b7a5c; border: 1px solid #c9eadf;
  white-space: nowrap;
}
.badge-muted { background: #f2f2f2; color: #777; border-color: #e6e6e6; }
.badge-warn { background: #fff6e6; color: #9a6608; border-color: #f4dfb4; }
.badge-bad { background: #fdecec; color: #b3261e; border-color: #f6cccc; }

.btn {
  border: 1px solid transparent; background: #fff; color: var(--ink);
  padding: 7px 12px; border-radius: 8px; font-size: 13px;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: #f6f6f6; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #0c8a68; }
.btn-soft { background: var(--brand-soft); color: #0b7a5c; border-color: #cdebdf; }
.btn-soft:hover:not(:disabled) { background: #d9f0e7; }
.btn-send {
  background: var(--ok); color: #fff; padding: 8px 22px; border-radius: 6px; font-weight: 500;
}
.btn-send:hover:not(:disabled) { background: #06ad56; }
.only-phone { display: none; }

/* ---------- layout ---------- */
.app {
  height: calc(100% - 56px);
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 372px;
  gap: 0;
  min-height: 0;
}

/* ---------- rail ---------- */
.rail {
  background: #fff;
  border-right: 1px solid var(--line);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.rail-scroll { overflow-y: auto; padding: 14px 12px 28px; }
.block { margin-bottom: 20px; }
.block h3 {
  margin: 0 0 10px; font-size: 12px; color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 6px; letter-spacing: .4px;
}
.block h3 span {
  width: 16px; height: 16px; border-radius: 50%; background: #f0f0f0; color: #777;
  font-size: 10px; display: grid; place-items: center;
}
.role-list { display: grid; gap: 6px; }
.role-item {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 9px 10px; font-size: 13px; line-height: 1.35; color: var(--ink-2);
}
.role-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.role-item.on { border-color: #9fd9c6; background: var(--brand-soft); color: #0b6b51; }
.role-item.on small { color: #3f8a74; }
.field { display: block; margin-top: 10px; }
.field span { font-size: 11px; color: var(--muted); display: block; margin-bottom: 5px; }
select, .input {
  width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 13px; color: var(--ink-2);
}
.persona-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.persona-item {
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 8px 7px 7px; display: flex; gap: 6px; align-items: flex-start; min-height: 50px; min-width: 0;
}
.persona-item .dot {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  font-size: 13px; flex: none; background: #f2f2f2;
}
.persona-item .nm { font-size: 11.5px; line-height: 1.3; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.persona-item .nm em { display: block; font-style: normal; font-size: 10px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona-item.on { border-color: #9fd9c6; background: var(--brand-soft); }
.persona-item.on .nm { color: #0b6b51; }

.persona-detail .card { padding: 12px; }
.persona-detail h4 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.persona-detail dl { margin: 0; display: grid; gap: 7px; }
.persona-detail dt { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.persona-detail dd { margin: 0; font-size: 12px; line-height: 1.55; color: var(--ink-2); }
.persona-detail .secret { border-top: 1px dashed var(--line); padding-top: 8px; }
.difficulty { display: inline-flex; gap: 3px; vertical-align: middle; }
.difficulty i { width: 6px; height: 6px; border-radius: 50%; background: #ddd; }
.difficulty i.on { background: var(--warn); }

/* ---------- chat ---------- */
.chatpane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--wechat);
  position: relative;
}
.chat-head {
  height: 58px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: var(--wechat-head); border-bottom: 1px solid #dcdcdc;
  gap: 10px;
}
.chat-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-title { display: flex; flex-direction: column; min-width: 0; }
.chat-title b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing { display: inline-flex; gap: 3px; align-items: center; font-size: 11px; color: var(--muted); }
.typing i {
  width: 5px; height: 5px; border-radius: 50%; background: #b6b6b6; animation: blink 1.1s infinite;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.msgs {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 24px;
  scroll-behavior: smooth;
}
.time-divider {
  text-align: center; font-size: 11px; color: #a3a3a3; margin: 14px 0 10px;
}
.sysline {
  text-align: center; font-size: 11px; color: #9c9c9c; margin: 10px 0;
  background: rgba(0, 0, 0, .04); display: table; padding: 3px 8px; border-radius: 4px; margin-left: auto; margin-right: auto;
}
.row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.row.right { flex-direction: row-reverse; }
.avatar {
  width: 36px; height: 36px; border-radius: 5px; flex: none;
  display: grid; place-items: center; font-size: 17px; color: #fff;
  background: #b7c3c9; user-select: none;
}
.avatar.sm { width: 30px; height: 30px; font-size: 14px; border-radius: 4px; }
.avatar.me { background: linear-gradient(145deg, #16b087, #0b7a5c); font-size: 13px; font-weight: 600; }
.bubble {
  position: relative; max-width: min(520px, 74%);
  padding: 9px 12px; border-radius: 5px; font-size: 15px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}
.row.left .bubble { background: #fff; color: var(--ink); }
.row.right .bubble { background: var(--bubble-me); color: #12300c; }
.row.left .bubble::before {
  content: ''; position: absolute; left: -6px; top: 12px;
  border: 6px solid transparent; border-left: 0; border-right-color: #fff;
}
.row.right .bubble::before {
  content: ''; position: absolute; right: -6px; top: 12px;
  border: 6px solid transparent; border-right: 0; border-left-color: var(--bubble-me);
}
.bubble.ghost { background: #f3f3f3; color: #9a9a9a; font-style: italic; }
.meta-under {
  margin: 4px 0 0; display: flex; gap: 6px; justify-content: flex-end; align-items: center;
  font-size: 11px; color: #8f8f8f;
}
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 99px;
  font-size: 11px; padding: 2px 8px; color: #666;
}
.chip:hover { background: #f4f4f4; }
.chip.ok { color: #067a3c; border-color: #bfe8cf; background: #eefbf2; }
.chip.warn { color: #92600a; border-color: #f2ddb3; background: #fffaf0; }
.chip.bad { color: #ad2118; border-color: #f3c6c3; background: #fdf2f1; }

.empty { display: grid; place-items: center; height: 100%; }
.empty-card {
  max-width: 460px; background: #fff; border: 1px solid #e2e2e2; border-radius: 12px;
  padding: 20px 22px; box-shadow: 0 3px 14px rgba(0, 0, 0, .04);
}
.empty-card h2 { margin: 0 0 10px; font-size: 15px; }
.empty-card ol { margin: 0 0 10px 18px; padding: 0; font-size: 13px; line-height: 1.85; color: #444; }
.empty-note { margin: 0; font-size: 12px; color: var(--muted); }

/* composer */
.composer { flex: none; background: #f7f7f7; border-top: 1px solid #dcdcdc; padding: 8px 14px 12px; }
.composer textarea {
  width: 100%; border: 0; outline: none; resize: none; background: transparent;
  font-size: 15px; line-height: 1.55; min-height: 46px; max-height: 160px; padding: 4px 2px;
  color: var(--ink);
}
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-left { display: flex; align-items: center; gap: 4px; }
.composer-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  border: 0; background: transparent; font-size: 17px; line-height: 1; padding: 4px 5px;
  border-radius: 6px; opacity: .72;
}
.icon-btn:hover { background: #ececec; opacity: 1; }
.icon-btn.on { background: var(--brand-soft); opacity: 1; }
.counter { font-size: 11px; color: #a5a5a5; margin-left: 4px; }

/* ---------- coach ---------- */
.coach {
  background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.tabs { flex: none; display: flex; gap: 2px; padding: 8px 8px 0; background: #fff; border-bottom: 1px solid var(--line); }
.tab {
  border: 0; background: transparent; padding: 8px 8px 10px; font-size: 12.5px; color: #7b7b7b;
  border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; flex: 1;
}
.tab:hover { color: var(--ink); background: #fafafa; }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab-body { display: none; overflow-y: auto; padding: 12px; min-height: 0; flex: 1; }
.tab-body.on { display: block; }
.stack { display: grid; gap: 10px; }
.card {
  background: #fff; border: 1px solid #e8e8e8; border-radius: var(--radius);
  padding: 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, .02);
}
.card h4 { margin: 0 0 8px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.mini-label { display: block; margin: 0 0 6px; font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.card textarea {
  display: block; width: 100%; min-height: 74px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; line-height: 1.65; color: var(--ink); background: #fff; outline: none;
}
.card textarea:focus { border-color: #9fd9c6; box-shadow: 0 0 0 3px rgba(15,157,118,.08); }
.muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.verdict { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 3px 10px; }
.verdict.ok { background: #e9fbf0; color: #067a3c; }
.verdict.warn { background: #fff6e5; color: #92600a; }
.verdict.bad { background: #fdecec; color: #ad2118; }
.score-line { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.score-line strong { font-size: 26px; letter-spacing: -.5px; }
.score-line span { font-size: 12px; color: var(--muted); }
.quote {
  font-size: 14px; line-height: 1.6; background: #f7fbf8; border: 1px dashed #cfe9dd;
  border-radius: 8px; padding: 10px 12px; white-space: pre-wrap;
}
ul.clean { margin: 0; padding-left: 16px; font-size: 12.5px; line-height: 1.7; color: #454545; }
ul.clean li { margin-bottom: 3px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-list { display: grid; gap: 7px; }
.kb-item {
  background: #fff; border: 1px solid #e8e8e8; border-radius: 9px; padding: 9px 10px;
  text-align: left; width: 100%;
}
.kb-item .kb-id { font-size: 10px; color: #9a9a9a; letter-spacing: .4px; }
.kb-item .kb-title { font-size: 12.5px; display: block; margin: 2px 0 0; color: #222; }
.kb-item .kb-text { display: none; font-size: 12px; color: #4c4c4c; line-height: 1.65; margin-top: 7px; }
.kb-item .kb-src { display: none; font-size: 10.5px; color: #a0a0a0; margin-top: 6px; }
.kb-item.open .kb-text, .kb-item.open .kb-src { display: block; }
.kb-empty { font-size: 12px; color: var(--muted); padding: 8px 2px; }

.dim { margin-bottom: 8px; }
.dim-top { display: flex; justify-content: space-between; font-size: 11.5px; color: #666; margin-bottom: 4px; }
.bar { height: 6px; background: #eee; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #35c79b, #0f9d76); border-radius: 99px; }
.bar i.low { background: linear-gradient(90deg, #f0b45c, #e59a1a); }
.bar i.bad { background: linear-gradient(90deg, #f0868a, #e5484d); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(20, 20, 20, .88); color: #fff; font-size: 12.5px;
  padding: 9px 14px; border-radius: 8px; z-index: 80; max-width: 80vw;
}
.scrim {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .32); z-index: 40;
}

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .app { grid-template-columns: 262px minmax(0, 1fr) 336px; }
}
@media (max-width: 980px) {
  .only-phone { display: inline-block; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .brand-text i { display: none; }
  .badge { display: none; }
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; width: 288px; z-index: 50;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 6px 0 24px rgba(0, 0, 0, .12);
  }
  .rail.open { transform: none; }
  .coach {
    position: fixed; left: 0; right: 0; bottom: 0; top: 22vh; z-index: 50;
    transform: translateY(102%); transition: transform .24s ease;
    border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 26px rgba(0, 0, 0, .14);
  }
  .coach.open { transform: none; }
  .bubble { max-width: 78%; }
  .msgs { padding: 12px 12px 18px; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 10px; }
  .brand-text b { font-size: 13px; }
  .btn { padding: 6px 9px; }
}

/* ---------- 使用人 ---------- */
.user-row { display: flex; gap: 6px; }
.user-row select { flex: 1; min-width: 0; }
.user-row .btn { padding: 6px 10px; flex: none; }
.user-note { margin: 6px 0 0; font-size: 10.5px; color: #a0a0a0; line-height: 1.5; }

/* ---------- 素材托盘 ---------- */
.tray {
  flex: none; background: #fff; border-top: 1px solid var(--line);
  max-height: 44vh; overflow-y: auto; padding: 10px 14px 12px;
}
.tray-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.tray-head b { font-size: 13px; }
.tray-note { font-size: 11px; color: #a0a0a0; flex: 1; }
.tray-close { border: 0; background: transparent; font-size: 18px; line-height: 1; color: #9a9a9a; padding: 0 2px; }
.tray-close:hover { color: #333; }
.tray-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 7px; }
#pane-products .tray-grid { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); }
.mat-item {
  position: relative; text-align: left; border: 1px solid var(--line); background: #fcfcfc;
  border-radius: 9px; padding: 8px 9px; display: flex; gap: 8px; align-items: flex-start; min-width: 0;
}
.mat-item:hover { border-color: #9fd9c6; background: #f7fcf9; }
.mat-ico {
  width: 26px; height: 26px; border-radius: 7px; background: #eef7f3; color: #0b7a5c;
  display: grid; place-items: center; font-size: 13px; flex: none;
}
.mat-meta { min-width: 0; }
.mat-name { font-size: 12px; display: block; color: #222; line-height: 1.35; }
#pane-materials .mat-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-desc { font-size: 10.5px; color: #9a9a9a; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mat-del {
  position: absolute; top: 2px; right: 2px; border: 0; background: transparent; color: #c4c4c4;
  font-size: 13px; line-height: 1; padding: 3px 4px; border-radius: 4px; opacity: 0;
}
.mat-item:hover .mat-del { opacity: 1; }
.mat-del:hover { background: #fdecec; color: var(--bad); }
.tray-form { display: grid; gap: 7px; margin-top: 9px; padding: 9px; background: #fafafa; border: 1px dashed var(--line); border-radius: 9px; }
.tray-form-row { display: grid; grid-template-columns: 1fr 132px; gap: 7px; }
.tray-form-actions { display: flex; gap: 7px; }
.tray-foot { display: flex; gap: 8px; margin-top: 9px; }
.tray-foot .btn { font-size: 12px; padding: 6px 10px; }

/* ---------- 素材消息 ---------- */
.bubble.material { background: #fff; border: 1px solid #d9d9d9; padding: 0; overflow: hidden; }
.row.right .bubble.material { background: #f4fff0; border-color: #bfe6b0; }
.row.right .bubble.material::before { border-left-color: #f4fff0; }
.row.left .bubble.material::before { border-right-color: #fff; }
.mat-msg { display: flex; gap: 9px; align-items: center; padding: 9px 11px; min-width: 178px; }
.mat-msg .mat-ico { width: 30px; height: 30px; font-size: 15px; }
.mat-msg b { display: block; font-size: 13px; font-weight: 500; color: #222; }
.mat-msg span { display: block; font-size: 10.5px; color: #9a9a9a; margin-top: 2px; }

/* ---------- 渠道 ---------- */
.channel-info { margin-top: 8px; font-size: 11px; line-height: 1.6; color: #6b6b6b; }
.channel-info .chi-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.channel-info .chi-tag { background: #f2f2f2; border-radius: 4px; padding: 1px 6px; font-size: 10.5px; color: #666; }
.channel-info .chi-goal { color: #0b7a5c; background: #eefaf4; border: 1px solid #d3eee1; border-radius: 6px; padding: 5px 7px; }
.persona-item .chan-dot { font-style: normal; font-size: 9px; color: #0b7a5c; background: #e6f6f0; border-radius: 3px; padding: 0 3px; margin-right: 3px; }

/* ---------- 租户 ---------- */
.gate { position: fixed; inset: 0; z-index: 90; background: #f4f6f7; display: grid; place-items: center; padding: 20px; }
.gate-card { width: min(680px, 94vw); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 26px; box-shadow: 0 18px 60px rgba(0,0,0,.10); }
.gate-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.gate-head .mark { width: 40px; height: 40px; border-radius: 12px; font-size: 18px; }
.gate-head h1 { margin: 0 0 4px; font-size: 19px; }
.gate-head p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.gate-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gate-item { text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; transition: border-color .15s, transform .15s; }
.gate-item:hover { border-color: #9fd9c6; transform: translateY(-1px); }
.gate-item .gi-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.gate-item .gi-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 600; }
.gate-item b { font-size: 15px; display: block; }
.gate-item small { color: var(--muted); font-size: 11.5px; }
.gate-item p { margin: 8px 0 0; font-size: 12px; color: #666; line-height: 1.6; }
.gate-note { margin: 16px 0 0; font-size: 11.5px; color: #9a9a9a; }
.tray-tabs { display: inline-flex; gap: 2px; background: #f1f1f1; border-radius: 7px; padding: 2px; }
.tray-tabs button { border: 0; background: transparent; font-size: 11.5px; padding: 3px 10px; border-radius: 6px; color: #777; }
.tray-tabs button.on { background: #fff; color: #0b7a5c; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tray-pane { display: none; }
.tray-pane.on { display: block; }
.tray-hint { margin: 8px 0 0; font-size: 10.5px; color: #a0a0a0; }
.mat-item.is-product .mat-ico { background: #eef4fb; color: #1f6fb2; }
.mat-price { font-size: 10.5px; color: #0b7a5c; display: block; margin-top: 2px; line-height: 1.35; }
.mat-status { font-size: 9.5px; border-radius: 3px; padding: 0 3px; margin-left: 4px; }
.mat-status.tentative { background: #fff6e6; color: #9a6608; }
.mat-status.confirmed { background: #e9fbf0; color: #067a3c; }
@media (max-width: 560px) { .gate-list { grid-template-columns: 1fr; } }

.exam-toggle { display:flex; align-items:center; gap:6px; margin-top:8px; font-size:11.5px; color:#6b6b6b; }
.exam-toggle input { accent-color: var(--brand); }
.saved-item { background:#fff; border:1px solid var(--line); border-radius:9px; padding:10px; }
.saved-item p { margin:0 0 6px; font-size:12.5px; line-height:1.6; white-space:pre-wrap; }
.saved-item .meta { font-size:10.5px; color:#9a9a9a; }

/* ---------- 「?」提示 ---------- */
.hint-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid #cfd5d9; background: #fff; color: #8a939a;
  font-size: 10px; line-height: 1; font-weight: 600;
  margin-left: 4px; cursor: help; vertical-align: middle; flex: none;
}
.hint-btn:hover, .hint-btn:focus-visible { border-color: var(--brand); color: var(--brand); outline: none; }
.hint-pop {
  position: fixed; z-index: 300; background: #23282d; color: #fff;
  font-size: 12px; line-height: 1.65; padding: 8px 10px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22); pointer-events: none; white-space: pre-wrap;
}

.empty-card .empty-line { margin: 0; font-size: 13px; color: #5a5a5a; }

.persp { display: inline-flex; align-items: center; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.persp button { border: 0; background: transparent; font-size: 11.5px; color: #6f6f6f; padding: 4px 9px; border-radius: 6px; }
.persp button.on { background: var(--brand-soft); color: #0b6b51; font-weight: 600; }
.chat-status { display: flex; align-items: center; gap: 8px; }
.persp + #priceWarn { margin-left: 2px; }
@media (max-width: 560px) { .persp button { padding: 4px 6px; font-size: 11px; } }
.meta-under.left { justify-content: flex-start; padding-left: 44px; }

/* ---------- 场景折叠 ---------- */
.scene { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.scene > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 2px; }
.scene > summary::-webkit-details-marker { display: none; }
.scene > summary::after { content: '▾'; margin-left: auto; color: #9a9a9a; font-size: 10px; transition: transform .15s; }
.scene[open] > summary::after { transform: rotate(180deg); }
.scene-label { font-size: 12px; font-weight: 600; color: #3d3d3d; }
.scene-sum { font-size: 10.5px; color: #9a9a9a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.scene-body { padding-top: 8px; }
.scene-body .block:last-child { margin-bottom: 0; }

/* ---------- 更多 tab ---------- */
.tab-secondary { display: none !important; }
.tab-more { position: relative; flex: 1; }
.tab-more > .tab { width: 100%; }
.tab-menu { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.10); z-index: 40; min-width: 120px; padding: 4px; }
.tab-menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; font-size: 12.5px; border-radius: 6px; color: #444; }
.tab-menu button:hover { background: #f4f4f4; }

/* ---------- 使用引导 ---------- */
.tour-mask { position: fixed; inset: 0; background: rgba(20,24,28,.38); z-index: 200; }
.tour-ring { position: fixed; border: 2px solid #fff; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(20,24,28,.38), 0 0 0 2px rgba(15,157,118,.9); z-index: 202; pointer-events: none; transition: all .2s ease; }
.tour-mask { display: none; }
.tour-card { position: fixed; z-index: 203; background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 16px 48px rgba(0,0,0,.24); }
.tour-card h3 { margin: 0 0 6px; font-size: 14px; }
.tour-card p { margin: 0 0 12px; font-size: 12.5px; line-height: 1.7; color: #4d4d4d; }
.tour-step { font-size: 10.5px; color: var(--brand); letter-spacing: .4px; margin-bottom: 4px; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 980px) { .tour-ring { display: none; } .tour-card { left: 12px !important; right: 12px; width: auto !important; top: auto !important; bottom: 16px; } }

.end-bar { display:flex; align-items:center; gap:8px; padding:8px 14px; background:#fff8e8; border-top:1px solid #f2dfb8; font-size:12px; color:#8a5a00; }
.end-bar span { flex:1; }
.end-bar .btn { padding:5px 10px; font-size:12px; }
.flowbar { display:flex; align-items:center; gap:8px; padding:6px 14px; background:#fff; border-bottom:1px solid var(--line); font-size:12px; }
.flowbar .flow-label { color:#9a9a9a; font-size:11px; }
.flow-current { font-weight:600; color:#2f2f2f; }
.flow-count { color:#9a9a9a; }
.flowbar .btn { margin-left:auto; padding:4px 10px; font-size:11.5px; }
.gate .stack { display:grid; gap:8px; }
.gate .field-mini span { font-size:10.5px; color:#8a8a8a; }
.gate textarea { width:100%; border:1px solid var(--line); border-radius:8px; padding:8px 10px; font-size:13px; }

.block h3 { white-space: nowrap; }
.persona-detail h4 { flex-wrap: wrap; font-size: 12.5px; line-height: 1.5; }
.persona-detail h4 .chip { font-size: 10px; }

.win-menu { position: relative; }
.win-drop { position:absolute; right:0; top:30px; background:#fff; border:1px solid var(--line); border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.12); z-index:60; min-width:120px; padding:4px; }
.win-drop button { display:block; width:100%; text-align:left; border:0; background:transparent; padding:7px 10px; font-size:12.5px; border-radius:6px; color:#444; }
.win-drop button:hover { background:#f4f4f4; }

.win-actions { display:flex; flex-direction:column; gap:2px; padding-left:8px; border-left:1px solid var(--line); }
.win-btn { border:0; background:transparent; padding:1px 0; font-size:10.5px; color:#8a8a8a; text-align:left; line-height:1.3; }
.win-btn:hover { color: var(--brand); }



.mode-select { border:1px solid var(--line); background:#fff; border-radius:7px; font-size:11px; padding:4px 6px; color:#555; }

.flowbar .mode-select { margin-left:8px; }

/* 开局：选身份 + 选人设 */
.start-step { margin-bottom: 16px; }
.start-step > b { display: block; font-size: 12.5px; color: #6b6b6b; margin-bottom: 7px; }
.start-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.start-role, .start-style {
  text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #222;
}
.start-role small { display: block; color: #8a8a8a; font-size: 11px; margin-top: 3px; line-height: 1.5; }
.start-role:hover, .start-style:hover { border-color: #9fd9c6; }
.start-role.on, .start-style.on { border-color: #0b6b51; background: #eef7f3; box-shadow: 0 0 0 1px #0b6b51 inset; }
.start-styles { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) { .start-roles { grid-template-columns: 1fr; } }
