/* rag-web · 私有知识库前端 · 对齐 wan-image site 的纸色极简风 */
* { box-sizing: border-box; }
body {
  margin: 0; background: #f6f3ec; color: #2b2620;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
.hidden { display: none !important; }

/* ── 顶栏 ── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: #fffdf8; border-bottom: 1px solid #e5decf;
  position: sticky; top: 0; z-index: 5;
}
.brand { font-size: 18px; font-weight: 700; }
.brand-sub { font-size: 12px; font-weight: 400; color: #8a7f6a; margin-left: 6px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lamp { font-size: 13px; color: #8a7f6a; white-space: nowrap; }
.lamp.on { color: #2e7d32; }
.lamp.off { color: #c62828; }

/* ── 卡片版面 ── */
main { max-width: 860px; margin: 0 auto; padding: 18px 14px 60px; }
.card {
  background: #fffdf8; border: 1px solid #e5decf; border-radius: 12px;
  padding: 16px 18px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(90, 70, 40, .06);
}
.sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.sec-head h3 { margin: 0; font-size: 16px; }
.sec-tip { font-size: 12px; color: #8a7f6a; }

/* ── 按钮 ── */
.btn-primary {
  background: #3b2f1e; color: #fff; border: 0; border-radius: 8px;
  padding: 9px 22px; font-size: 14px; cursor: pointer;
}
.btn-primary:hover { background: #57452c; }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-ghost {
  background: transparent; color: #6b5f4a; border: 1px solid #cfc4ad; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: #f1ebdd; }
.btn-ghost.small { padding: 4px 10px; font-size: 12px; }
.btn-danger { color: #b3423a; border-color: #d9b3ae; }

/* ── 问答区 ── */
.ask-row { display: flex; gap: 10px; align-items: stretch; }
.ask-row textarea {
  flex: 1; border: 1px solid #cfc4ad; border-radius: 8px; padding: 10px;
  font-size: 14px; resize: vertical; background: #fff; font-family: inherit;
}
.ask-side { display: flex; flex-direction: column; gap: 8px; justify-content: flex-start; }
.ask-time { font-size: 12px; color: #8a7f6a; white-space: nowrap; }
.inline-err {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: #fdf0ee; border: 1px solid #e6b8b1; color: #a33; font-size: 13px; white-space: pre-wrap;
}
.answer-box { margin-top: 14px; }
.answer-text {
  background: #f4f0e4; border-radius: 10px; padding: 14px 16px;
  font-size: 14px; line-height: 1.75; white-space: pre-wrap;
}
.answer-text sup a { color: #1a6b4a; text-decoration: none; font-weight: 700; }
.src-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.src-card {
  border: 1px solid #e0d7c2; border-radius: 10px; background: #fff; overflow: hidden;
}
.src-card.hit-flash { border-color: #1a6b4a; }
.src-head {
  display: flex; gap: 10px; align-items: center; padding: 8px 12px;
  cursor: pointer; font-size: 13px;
}
.src-head .no { font-weight: 700; color: #1a6b4a; min-width: 22px; }
.src-head .score { margin-left: auto; color: #8a7f6a; font-size: 12px; }
.src-body {
  display: none; padding: 8px 12px 12px; font-size: 12.5px; color: #55503f;
  white-space: pre-wrap; border-top: 1px dashed #e0d7c2; max-height: 220px; overflow: auto;
}
.src-card.open .src-body { display: block; }

/* ── 上传区 ── */
.drop-zone {
  border: 2px dashed #c9bda3; border-radius: 10px; padding: 22px;
  text-align: center; color: #8a7f6a; font-size: 14px; background: #fbf8f0;
}
.drop-zone.over { border-color: #1a6b4a; background: #eef7f1; color: #1a6b4a; }
.up-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.up-item {
  display: flex; gap: 10px; align-items: center; font-size: 13px;
  padding: 8px 10px; border: 1px solid #e0d7c2; border-radius: 8px; background: #fff;
}
.up-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .st { font-size: 12px; color: #8a7f6a; min-width: 120px; }
.up-item .st.err { color: #b3423a; }
.up-item .st.ok { color: #2e7d32; }

/* ── 文档表 ── */
.doc-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table th, .doc-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #ece4d2; }
.doc-table th { color: #8a7f6a; font-weight: 500; font-size: 12px; }
.doc-empty { color: #8a7f6a; font-size: 13px; padding: 8px 0; }

/* ── 登录屏 ── */
.login-mask {
  position: fixed; inset: 0; background: rgba(43, 38, 32, .55);
  display: flex; align-items: center; justify-content: center; z-index: 20;
}
.login-card {
  background: #fffdf8; border-radius: 14px; padding: 26px 28px; width: 320px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); text-align: center;
}
.login-card h2 { margin: 0 0 6px; font-size: 18px; }
.login-sub { margin: 0 0 16px; font-size: 12px; color: #8a7f6a; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid #cfc4ad; border-radius: 8px;
  font-size: 14px; margin-bottom: 10px;
}
.cap-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.cap-row span svg { display: block; cursor: pointer; }
.cap-row input { flex: 1; margin-bottom: 0; }
.pw-err { color: #b3423a; font-size: 12px; min-height: 16px; margin: 4px 0 0; white-space: pre-wrap; }

/* ── 移动端 ── */
@media (max-width: 640px) {
  .ask-row { flex-direction: column; }
  .ask-side { flex-direction: row; align-items: center; }
  .topbar { flex-wrap: wrap; }
}
