* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #223044;
  background: #f4f6f8;
}
button {
  border: 0;
  border-radius: 6px;
  background: #2f7ed8;
  color: #fff;
  height: 34px;
  padding: 0 12px;
  cursor: pointer;
}
button:hover { background: #2569b8; }
button.secondary { background: #edf1f5; color: #2c3e50; }
input, select, textarea {
  width: 100%;
  border: 1px solid #d9e1ea;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid #dfe5ec;
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar span { color: #728092; font-size: 13px; }
.shell {
  height: calc(100vh - 54px);
  display: grid;
  grid-template-columns: 280px minmax(360px, 1fr) 370px;
}
.sidebar, .ai-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
}
.sidebar { border-right: 1px solid #dfe5ec; }
.ai-panel { border-left: 1px solid #dfe5ec; }
.side-head {
  height: 58px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8ef;
}
.side-head strong { display: block; }
.side-head span { display: block; margin-top: 3px; color: #728092; font-size: 12px; }
#newFolderBtn { width: 30px; padding: 0; font-size: 20px; }
.side-actions {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8ef;
}
.tree {
  flex: 1;
  overflow: auto;
  padding: 8px 8px 24px;
  font-size: 14px;
}
.node-row {
  height: 31px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 4px;
}
.node-title {
  min-width: 0;
  background: transparent;
  color: #304258;
  text-align: left;
  padding: 5px 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.node-title:hover { background: #e8f1fb; color: #185693; }
.node.active > .node-row .node-title { background: #d9ebff; color: #174f87; }
.children { margin-left: 18px; border-left: 1px solid #e1e7ee; padding-left: 6px; }
.doc-check { width: 15px; height: 15px; margin: 0; }
.folder-mark { text-align: center; color: #8794a3; }
.editor-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.editor-toolbar {
  min-height: 58px;
  padding: 10px 12px;
  border-bottom: 1px solid #dfe5ec;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 150px 70px 70px;
  gap: 8px;
  align-items: center;
}
#docTitle {
  border: 0;
  font-weight: 700;
  font-size: 20px;
}
#docTitle:focus { outline: 2px solid #d9ebff; }
.editor {
  flex: 1;
  overflow: auto;
  padding: 32px clamp(22px, 5vw, 72px);
  line-height: 1.85;
  font-size: 18px;
  color: #111827;
}
.editor:empty::before { content: "在这里编辑、复制、粘贴内容。"; color: #9aa6b2; }
.editor h1 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.35;
  font-weight: 800;
  color: #05080f;
}
.editor h2 {
  margin: 28px 0 12px;
  font-size: 24px;
  line-height: 1.35;
}
.editor h3 {
  margin: 24px 0 10px;
  font-size: 21px;
  line-height: 1.35;
}
.editor p {
  margin: 0 0 18px;
  max-width: 880px;
}
.editor .article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 26px;
  color: #8a94a6;
  font-size: 15px;
  line-height: 1.5;
}
.editor .article-meta span:first-child {
  background: #f0f2f5;
  border-radius: 4px;
  padding: 1px 5px;
  color: #8a94a6;
}
.editor .article-point {
  position: relative;
  color: #405f9a;
  padding-left: 26px;
  margin-bottom: 22px;
}
.editor .article-point::before {
  content: "▣";
  position: absolute;
  left: 0;
  top: 1px;
  color: #5577b0;
  font-size: 15px;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid #e2e8ef;
}
.tabs button { background: #edf1f5; color: #304258; }
.tabs button.active { background: #2f7ed8; color: #fff; }
.tab-panel {
  min-height: 0;
  flex: 1;
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}
.tab-panel.active { display: flex; }
.chat-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.history, .selected-docs, .input-card {
  background: #fff;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  padding: 10px;
}
.history strong, .selected-docs strong, .input-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}
.history-list {
  max-height: 150px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-item {
  height: auto;
  background: #f7f9fb;
  color: #304258;
  border: 1px solid transparent;
  text-align: left;
  padding: 7px 8px;
}
.history-item.active { border-color: #2f7ed8; background: #e8f2ff; }
.history-item span, .history-item small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.history-item small { margin-top: 3px; color: #728092; font-size: 11px; }
.selected-docs div { color: #667487; font-size: 13px; line-height: 1.45; }
.chat-log {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.message {
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  font-size: 14px;
}
.message.assistant { background: #fff; border: 1px solid #e0e7ef; }
.message.user {
  align-self: flex-end;
  max-width: 92%;
  background: #e8f2ff;
  color: #174f87;
}
.chat-box {
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 8px;
}
.chat-box textarea { min-height: 72px; resize: vertical; }
.input-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.record-row {
  display: grid;
  grid-template-columns: 1fr 60px;
  gap: 8px;
  align-items: center;
}
#recordTime { text-align: center; color: #667487; font-variant-numeric: tabular-nums; }
#transcript { min-height: 130px; resize: vertical; }
@media (max-width: 1080px) {
  .shell { height: auto; min-height: calc(100vh - 54px); grid-template-columns: 240px 1fr; }
  .ai-panel { grid-column: 1 / -1; min-height: 460px; border-left: 0; border-top: 1px solid #dfe5ec; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .editor-toolbar { grid-template-columns: 1fr 1fr; }
  #docTitle { grid-column: 1 / -1; }
}
