* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1320; --panel: #171c2e; --panel2: #1f2540;
  --txt: #e8ebf5; --sub: #9aa3c0; --line: #2a3150;
  --fengge: #ff6b4a; --planner: #4ab0ff; --analyst: #46d39a; --kb: #c08bff;
  --accent: #ffb02e;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--txt); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.app { max-width: 860px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.topbar { padding: 18px 16px 10px; text-align: center; position: relative; }
.topbar h1 { font-size: 22px; letter-spacing: .5px; }
.topbar .sub { color: var(--sub); font-size: 12.5px; margin-top: 4px; }
.hist-btn {
  position: absolute; left: 12px; top: 16px;
  background: var(--panel); border: 1px solid var(--line); color: var(--sub);
  border-radius: 18px; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
}
.hist-btn:hover { color: var(--txt); border-color: var(--sub); }
.new-btn {
  position: absolute; right: 12px; top: 16px;
  background: var(--accent); border: none; color: #2a1d00;
  border-radius: 18px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.new-btn:hover { filter: brightness(1.05); }

.sid-btn {
  margin-top: 7px; background: var(--panel); border: 1px solid var(--line);
  color: var(--sub); border-radius: 14px; padding: 3px 11px; font-size: 11.5px;
  cursor: pointer; font-family: ui-monospace, Menlo, monospace; transition: all .15s;
}
.sid-btn:hover { color: var(--txt); border-color: var(--accent); }
.sid-btn.copied { color: var(--analyst); border-color: var(--analyst); }
.sid-btn #sidText { color: var(--accent); }

/* 折叠式进度面板(默认收起) */
.progress {
  margin: 6px 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px 12px; font-size: 12.5px; color: var(--sub);
}
.progress summary {
  cursor: pointer; list-style: none; display: flex; align-items: center;
  gap: 7px; user-select: none;
}
.progress summary::-webkit-details-marker { display: none; }
.progress .pg-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  flex: none; animation: pgpulse 1s infinite;
}
.progress .pg-dot.ok { background: var(--analyst); animation: none; }
@keyframes pgpulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
.progress .pg-last { color: var(--sub); font-size: 11.5px; opacity: .8; }
.progress.pg-done { opacity: .72; }
.progress .pg-steps {
  margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line);
  font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; line-height: 1.8;
}
.progress .pg-line { color: var(--sub); }


/* 历史抽屉 */
.hist-drawer { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 60; display: flex; }
.hist-panel {
  width: 84%; max-width: 360px; height: 100%; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  animation: slideIn .18s ease;
}
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.hist-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.hist-head h3 { font-size: 16px; }
.hist-close { background: none; border: none; color: var(--sub); font-size: 24px; cursor: pointer; line-height: 1; }
.hist-list { flex: 1; overflow-y: auto; padding: 8px; }
.hist-item { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.hist-item:hover { border-color: var(--sub); }
.hist-item.active { border-color: var(--accent); }
.hist-item .hi-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hist-item .hi-name { font-size: 13px; font-weight: 600; }
.hist-item .hi-count { font-size: 11px; color: var(--sub); white-space: nowrap; }
.hist-item .hi-preview { font-size: 12.5px; color: var(--sub); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hist-item .hi-del { font-size: 11px; color: #ff7a7a; background: none; border: none; cursor: pointer; margin-top: 6px; padding: 0; }
.hist-empty { color: var(--sub); text-align: center; padding: 24px; font-size: 13px; }



.tabs { display: flex; gap: 6px; padding: 6px 10px; overflow-x: auto; flex-wrap: wrap; justify-content: center; }
.tab {
  border: 1px solid var(--line); background: var(--panel); color: var(--sub);
  padding: 7px 13px; border-radius: 20px; font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: all .15s;
}
.tab:hover { color: var(--txt); }
.tab.active { color: #fff; border-color: transparent; }
.tab[data-mode="fengge"].active { background: var(--fengge); }
.tab[data-mode="planner"].active { background: var(--planner); }
.tab[data-mode="analyst"].active { background: var(--analyst); color: #06241a; }
.tab[data-mode="group"].active { background: var(--accent); color: #2a1d00; }
.tab[data-mode="knowledge"].active { background: var(--kb); }

.mode-hint { text-align: center; color: var(--sub); font-size: 12px; padding: 4px 16px 0; min-height: 18px; }

.chat { flex: 1; padding: 14px 12px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 11px 14px; border-radius: 14px; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--panel2); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.bot .who { font-size: 12px; font-weight: 600; margin-bottom: 5px; opacity: .9; }
.who.fengge { color: var(--fengge); }
.who.planner { color: var(--planner); }
.who.analyst { color: var(--analyst); }
.msg.sys { align-self: center; background: transparent; color: var(--sub); font-size: 12.5px; text-align: center; max-width: 95%; }
.msg.typing { color: var(--sub); font-style: italic; }

.group-block { align-self: stretch; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }

.fb-bar { display: flex; gap: 8px; margin-top: 8px; }
.fb-bar button {
  background: transparent; border: 1px solid var(--line); color: var(--sub);
  border-radius: 8px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.fb-bar button:hover { color: var(--txt); border-color: var(--sub); }

.composer { display: flex; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg); }
.composer textarea {
  flex: 1; resize: none; background: var(--panel); color: var(--txt);
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px;
  font-size: 14.5px; font-family: inherit;
}
.composer button {
  background: var(--accent); color: #2a1d00; border: none; border-radius: 12px;
  padding: 0 20px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.composer button:disabled { opacity: .5; cursor: default; }
.disclaimer { color: var(--sub); font-size: 11px; text-align: center; padding: 4px 16px 12px; opacity: .8; }

.kbview { flex: 1; padding: 14px 16px; overflow-y: auto; }
.kbview h2 { font-size: 16px; margin-bottom: 10px; }
.kb-fact { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 9px; }
.kb-fact .claim { font-size: 14px; }
.kb-fact .meta { font-size: 11.5px; color: var(--sub); margin-top: 5px; }
.kb-fact .meta a { color: var(--planner); text-decoration: none; }
.kb-empty { color: var(--sub); text-align: center; padding: 30px; font-size: 13px; }

.fb-modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.fb-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; width: 100%; max-width: 440px; }
.fb-card h3 { font-size: 16px; }
.fb-sub { color: var(--sub); font-size: 12px; margin: 4px 0 10px; }
.fb-card textarea { width: 100%; resize: vertical; background: var(--panel2); color: var(--txt); border: 1px solid var(--line); border-radius: 10px; padding: 9px; font-size: 14px; font-family: inherit; }
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.fb-actions button { border-radius: 10px; padding: 7px 16px; font-size: 13.5px; cursor: pointer; border: none; }
.fb-actions .ghost { background: transparent; border: 1px solid var(--line); color: var(--sub); }
.fb-actions .primary { background: var(--accent); color: #2a1d00; font-weight: 600; }

.hidden { display: none !important; }
@media (max-width: 600px) {
  .msg { max-width: 92%; }
  .topbar { padding-top: 16px; }
  .topbar h1 { font-size: 18px; margin-top: 26px; }
  .hist-btn, .new-btn { top: 12px; padding: 5px 10px; font-size: 12px; }
}

