#boot-error{position:fixed;left:0;right:0;top:0;z-index:9999;background:#7d1d16;color:#fff;
  font:14px/1.7 "Microsoft YaHei","PingFang SC",sans-serif;padding:14px 20px;box-shadow:0 4px 18px rgba(0,0,0,.25)}
#boot-error code{background:rgba(255,255,255,.16);padding:1px 6px;border-radius:5px;font-family:Consolas,monospace}
#boot-error .hint{opacity:.75;font-size:12px}
#nojs{background:#7d1d16;color:#fff;font:14px/1.7 "Microsoft YaHei",sans-serif;padding:14px 20px}
:root{
  --bg:#fbf6ef; --ink:#2c241f; --muted:#8d7c6e; --line:#eadfd2;
  --accent:#c0392b; --accent-soft:#fdeceb; --accent-2:#e08a3c; --card:#fffdfa;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{
  background:var(--bg); color:var(--ink);
  font:15px/1.68 "Microsoft YaHei","PingFang SC",system-ui,-apple-system,"Segoe UI",sans-serif;
  -webkit-font-smoothing:antialiased;
}
.app{display:grid;grid-template-columns:330px minmax(0,1fr);height:100vh}

/* ---------- 左侧 ---------- */
.side{border-right:1px solid var(--line);background:linear-gradient(180deg,#fffdfa 0%,#fdf6ee 100%);padding:18px 16px 28px;overflow:auto}
.brand{display:flex;gap:10px;align-items:center;margin-bottom:4px}
.logo{width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,#c0392b,#e08a3c);display:grid;place-items:center;color:#fff;font-size:19px;flex:0 0 auto}
.brand h1{font-size:16px;margin:0;letter-spacing:.3px}
.brand p{margin:0;font-size:11.5px;color:var(--muted)}
.side-note{font-size:12px;color:var(--muted);margin:10px 0 16px;padding:8px 10px;background:#fff;border:1px dashed var(--line);border-radius:9px}
.block{margin-bottom:14px;border:1px solid var(--line);border-radius:12px;background:#fff;overflow:hidden}
.block>summary{cursor:pointer;padding:10px 12px;font-size:13px;font-weight:700;list-style:none;display:flex;justify-content:space-between;align-items:center;user-select:none}
.block>summary::-webkit-details-marker{display:none}
.block>summary::after{content:"+";color:var(--muted);font-weight:400}
.block[open]>summary::after{content:"–"}
.block .body{padding:0 12px 12px}
pre.sp{margin:0;white-space:pre-wrap;word-break:break-word;font:11.5px/1.6 "Consolas",Menlo,monospace;background:#faf6f1;border:1px solid var(--line);border-radius:8px;padding:10px;max-height:260px;overflow:auto;color:#4a3f36}
.btn{border:1px solid var(--line);background:#fff;color:var(--ink);border-radius:8px;padding:5px 10px;font-size:12px;cursor:pointer}
.btn:hover{border-color:var(--accent);color:var(--accent)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}
.btn.primary:hover{opacity:.9;color:#fff}
.kblist{display:flex;flex-wrap:wrap;gap:6px}
.kbtag{font-size:11.5px;border:1px solid var(--line);border-radius:999px;padding:3px 9px;cursor:pointer;background:#fdfaf6}
.kbtag:hover{border-color:var(--accent);color:var(--accent)}
.stat{font-size:12px;color:var(--muted);display:flex;justify-content:space-between;margin-bottom:6px}
.bar{height:7px;border-radius:99px;background:#efe3d6;overflow:hidden}
.bar>i{display:block;height:100%;width:0;background:linear-gradient(90deg,#e08a3c,#c0392b);transition:width .35s}
.row{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);margin-top:10px}
.row input{accent-color:var(--accent)}
.kv{font-size:12px;color:var(--muted);margin:4px 0}
.kv b{color:var(--ink)}
.mini{font-size:11.5px;color:var(--muted);line-height:1.6}
.mini li{margin:2px 0}

/* ---------- 右侧 ---------- */
.chat{display:flex;flex-direction:column;min-width:0;height:100vh}
.chat-head{padding:14px 26px;border-bottom:1px solid var(--line);background:rgba(255,253,250,.9);backdrop-filter:blur(6px)}
.chat-head h2{margin:0;font-size:15px}
.chat-head span{font-size:12px;color:var(--muted)}
.msgs{flex:1;overflow:auto;padding:22px 26px 8px;display:flex;flex-direction:column;gap:14px;scroll-behavior:smooth}
.msg{max-width:800px;font-size:14.5px}
.msg.user{align-self:flex-end;background:var(--accent);color:#fff;padding:9px 14px;border-radius:14px 14px 4px 14px;max-width:70%}
.msg.bot{align-self:flex-start;background:var(--card);border:1px solid var(--line);border-radius:4px 14px 14px 14px;padding:14px 16px;box-shadow:0 1px 3px rgba(80,50,20,.04)}
.msg.err{align-self:flex-start;background:#fff8e6;border:1px solid #f0dca8;border-radius:4px 14px 14px 14px;padding:12px 14px}
.ans-title{font-size:16px;font-weight:800;letter-spacing:.3px;margin-bottom:2px}
.tag{display:inline-block;font-size:11px;font-weight:400;color:var(--accent);background:var(--accent-soft);border-radius:999px;padding:1px 8px;margin-left:6px;vertical-align:2px}
.ans-sub{font-size:12.5px;color:var(--muted);margin-bottom:10px}
.note{font-size:12.5px;color:#8a6b1f;background:#fff8e6;border-left:3px solid #e8c56a;padding:6px 10px;border-radius:0 6px 6px 0;margin:8px 0}
.sec{margin:12px 0 0}
.sec h4{margin:0 0 4px;font-size:13px;color:var(--accent);letter-spacing:.5px}
.sec ul,.sec ol{margin:4px 0;padding-left:20px}
.sec li{margin:3px 0}
.prose{white-space:pre-wrap;font-size:14px}
.src{margin-top:12px;padding-top:9px;border-top:1px dashed var(--line);font-size:11.5px;color:var(--muted)}
.trace{margin-top:10px;font:11.5px/1.65 "Consolas",Menlo,monospace;color:#6b5c50;background:#faf6f1;border:1px solid var(--line);border-radius:8px;padding:9px 11px;white-space:pre-wrap}
.picks{display:flex;flex-wrap:wrap;gap:7px;margin-top:10px}
.chip{border:1px solid var(--line);background:#fdfaf6;border-radius:999px;padding:4px 11px;font-size:12.5px;cursor:pointer}
.chip:hover{border-color:var(--accent);color:var(--accent);background:#fff}
.chips{padding:0 26px 8px;display:flex;flex-wrap:wrap;gap:7px}
.chips .lbl{font-size:11.5px;color:var(--muted);align-self:center;margin-right:2px}
.composer{display:flex;gap:9px;padding:12px 26px 18px;border-top:1px solid var(--line);background:rgba(255,253,250,.95);align-items:center}
.composer input{flex:1 1 0;min-width:0;width:100%;border:1px solid var(--line);background:#fff;border-radius:11px;padding:11px 14px;font-size:14.5px;line-height:1.4;color:var(--ink);outline:none;font-family:inherit;transition:border-color .15s,box-shadow .15s}
.composer input::placeholder{color:#b3a396}
.composer input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(192,57,43,.10)}
.composer button{border:0;background:var(--accent);color:#fff;border-radius:11px;padding:11px 22px;font-size:14px;cursor:pointer;font-family:inherit;flex:0 0 auto;white-space:nowrap;line-height:1.4}
.composer button:hover{opacity:.92}
.composer button:disabled{opacity:.45;cursor:default}
.muted{color:var(--muted);font-size:13px}
@media (max-width:880px){
  .app{grid-template-columns:1fr;height:auto}
  .side{border-right:0;border-bottom:1px solid var(--line);max-height:none}
  .chat{height:auto}
  .msgs{min-height:52vh}
  .composer{position:sticky;bottom:0}
}
