/* 云智论坛 · 深色主题 */
:root {
  --bg: #0b0e14;
  --bg2: #10141d;
  --panel: #151a25;
  --panel2: #1a2030;
  --border: #242c3e;
  --text: #e7eaf2;
  --muted: #8b93a7;
  --accent: #5b7cfa;
  --accent2: #7c5bfa;
  --up: #ff6b35;
  --down: #5b7cfa;
  --danger: #f0524f;
  --ok: #3fb27f;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; outline: none; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
::selection { background: rgba(91,124,250,.35); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--panel2); color: var(--text);
  border-radius: 999px; padding: 7px 16px; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; color: #fff; font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; border-radius: 999px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.badge {
  background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 11px; font-style: normal; padding: 0 6px; min-width: 17px;
  height: 17px; display: inline-flex; align-items: center; justify-content: center;
}

/* ============ 布局 ============ */
#app { display: grid; grid-template-columns: 240px minmax(0,1fr); min-height: 100vh; }
#rightbar { display: none; }
@media (min-width: 1200px) {
  #app { grid-template-columns: 240px minmax(0,1fr) 300px; }
  #rightbar { display: block; padding: 20px 20px 20px 0; }
}

/* ============ 侧栏 ============ */
#sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg2); border-right: 1px solid var(--border);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: thin;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-size: 19px; font-weight: 800; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo img { width: 34px; height: 34px; }
#btn-new-post { margin: 0 4px 14px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); padding: 8px 10px; border-radius: 8px; font-size: 14.5px;
  border: none; background: none; width: 100%; text-align: left;
}
.side-nav a:hover { background: var(--panel2); text-decoration: none; }
.side-nav a.active { background: var(--panel2); color: var(--accent); font-weight: 600; }
.side-nav a span { flex: 1; }
.side-section { color: var(--muted); font-size: 12px; padding: 14px 10px 6px; letter-spacing: .1em; }
.side-section-row { display: flex; align-items: center; justify-content: space-between; }
#btn-new-cat {
  background: none; border: none; color: var(--accent);
  font-size: 16px; line-height: 1; padding: 0 4px; cursor: pointer;
}
#btn-new-cat:hover { color: #fff; }
.side-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 8px; color: var(--text); }
.user-chip:hover { background: var(--panel2); text-decoration: none; }
.user-chip .u-name { font-weight: 600; font-size: 14px; }
.user-chip .u-sub { font-size: 12px; color: var(--muted); }
.side-actions { display: flex; gap: 6px; padding: 4px 8px 8px; }
.side-actions a { font-size: 13px; color: var(--muted); }
#sb-toggle { display: none; }

.avatar {
  border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; user-select: none;
}

/* ============ 主区 ============ */
#main { padding: 18px 20px 60px; max-width: 780px; width: 100%; margin: 0 auto; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-desc { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.sort-tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.sort-tabs button { border: none; background: none; color: var(--muted); padding: 5px 14px; border-radius: 999px; font-size: 13.5px; }
.sort-tabs button.active { background: var(--panel2); color: var(--text); font-weight: 600; }

.post-card {
  display: flex; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
  transition: border-color .15s;
}
.post-card:hover { border-color: #34405c; }
.vote-col { display: flex; flex-direction: column; align-items: center; background: var(--bg2); padding: 10px 8px; min-width: 46px; gap: 2px; }
.vote-btn { background: none; border: none; color: var(--muted); font-size: 15px; padding: 2px 6px; border-radius: 6px; line-height: 1; }
.vote-btn:hover { background: var(--panel2); color: var(--text); }
.vote-btn.up.active { color: var(--up); }
.vote-btn.down.active { color: var(--down); }
.score { font-weight: 700; font-size: 13px; }
.post-body { padding: 10px 14px; flex: 1; min-width: 0; }
.post-meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cat-tag {
  background: var(--panel2); color: var(--accent); font-size: 12px; font-weight: 600;
  border-radius: 4px; padding: 1px 7px;
}
.cat-tag:hover { text-decoration: none; filter: brightness(1.2); }
.post-title { display: block; color: var(--text); font-size: 17px; font-weight: 600; margin: 3px 0 2px; }
.post-title:hover { color: var(--accent); text-decoration: none; }
.post-snippet { color: var(--muted); font-size: 13.5px; margin: 2px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-foot { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); align-items: center; }
.post-foot a { color: var(--muted); }
.load-more { display: block; margin: 14px auto; }
.empty { text-align: center; color: var(--muted); padding: 70px 20px; }
.empty .big { font-size: 42px; margin-bottom: 8px; }

/* ============ 帖子详情 ============ */
.post-detail { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.post-detail h1 { font-size: 23px; margin: 4px 0 10px; line-height: 1.35; }
.post-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.md-body { font-size: 15px; overflow-wrap: break-word; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 16px 0 8px; line-height: 1.4; }
.md-body h1 { font-size: 21px; } .md-body h2 { font-size: 19px; } .md-body h3 { font-size: 17px; }
.md-body p { margin: 8px 0; }
.md-body code { background: var(--bg2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 13px; font-family: Consolas, Monaco, monospace; }
.md-body pre { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.md-body pre code { background: none; border: none; padding: 0; }
.md-body blockquote { border-left: 3px solid var(--accent); margin: 8px 0; padding: 4px 14px; color: var(--muted); background: rgba(91,124,250,.06); border-radius: 0 8px 8px 0; }
.md-body img { max-width: 100%; border-radius: 8px; }
.md-body ul, .md-body ol { padding-left: 24px; margin: 8px 0; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ============ 富文本正文 ============ */
.rich-body { font-size: 15px; overflow-wrap: break-word; }
.rich-body img { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.rich-body iframe { width: 100%; max-width: 720px; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; display: block; margin: 8px 0; }
.rich-body video { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.rich-body audio { width: 100%; margin: 6px 0; }
.rich-body blockquote { border-left: 3px solid var(--accent); margin: 8px 0; padding: 4px 14px; color: var(--muted); background: rgba(91,124,250,.06); border-radius: 0 8px 8px 0; }
.rich-body hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.rich-body pre { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.rich-body code { background: var(--bg2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 13px; font-family: Consolas, Monaco, monospace; }
.rich-body pre code { background: none; border: none; }
.rich-body a { word-break: break-all; }
.rich-body ul, .rich-body ol { padding-left: 24px; margin: 8px 0; }
.rich-body h1, .rich-body h2, .rich-body h3, .rich-body h4 { margin: 16px 0 8px; line-height: 1.4; }
.rich-body h1 { font-size: 21px; } .rich-body h2 { font-size: 19px; } .rich-body h3 { font-size: 17px; }

/* ============ 富文本编辑器 ============ */
.rt-editor { border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); overflow: hidden; }
.rt-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px; border-bottom: 1px solid var(--border); background: var(--panel);
  transition: opacity .15s;
}
.rt-bar.rt-uploading { opacity: .55; pointer-events: none; }
.rt-btn {
  min-width: 30px; height: 28px; border: none; background: none; color: var(--muted);
  border-radius: 6px; cursor: pointer; font-size: 13px; padding: 0 6px;
  font-family: Georgia, serif;
}
.rt-btn:hover { background: var(--panel2); color: var(--text); }
.rt-btn.on { background: rgba(91,124,250,.22); color: var(--accent); }
.rt-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 5px; }
.rt-area {
  min-height: 200px; padding: 12px 14px; outline: none;
  font-size: 15px; line-height: 1.7; overflow-wrap: break-word;
}
.rt-compact .rt-area { min-height: 90px; font-size: 14px; }
.rt-area.rt-empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.rt-area img { max-width: 100%; border-radius: 8px; }
.rt-area iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; }
.rt-area blockquote { border-left: 3px solid var(--accent); margin: 8px 0; padding: 2px 12px; color: var(--muted); }
.rt-area.audio, .rt-area video { max-width: 100%; }

.comment-editor { margin: 14px 0 18px; }
.comment-editor textarea { min-height: 90px; }
.comment-editor .row { display: flex; justify-content: space-between; margin-top: 8px; align-items: center; }
.hint { color: var(--muted); font-size: 12px; }

.comment-item { display: flex; gap: 10px; padding: 8px 0 8px 2px; }
.comment-children { margin-left: 30px; border-left: 2px solid var(--border); padding-left: 12px; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.comment-head .author { color: var(--text); font-weight: 600; }
.comment-body { font-size: 14px; }
.comment-foot { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.comment-foot button { background: none; border: none; color: var(--muted); font-size: 12.5px; padding: 0; }
.comment-foot button:hover { color: var(--accent); }
.comment-deleted { color: var(--muted); font-style: italic; }
.collapsed-note { color: var(--muted); font-size: 12.5px; cursor: pointer; }

/* ============ 右栏 ============ */
.side-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.side-card h3 { font-size: 14px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.stat-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; }
.stat-row b { font-size: 14px; }
.hot-item { display: block; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text); }
.hot-item:last-child { border: none; }
.hot-item small { color: var(--muted); display: block; }

/* ============ AI 悬浮球 ============ */
#ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 65;
  width: 58px; height: 58px; border-radius: 50%;
  border: none; cursor: pointer; padding: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 26px rgba(91, 124, 250, .45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
#ai-fab:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 12px 34px rgba(91, 124, 250, .6); }
#ai-fab img { width: 38px; height: 38px; border-radius: 50%; pointer-events: none; }
#ai-fab.open { transform: rotate(90deg); }
#ai-fab::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(91, 124, 250, .5);
  animation: fabPulse 2.4s ease-out infinite;
}
@keyframes fabPulse {
  0% { transform: scale(.9); opacity: .9; }
  70%, 100% { transform: scale(1.35); opacity: 0; }
}

/* ============ AI 弹窗 ============ */
#ai-panel {
  position: fixed; right: 22px; bottom: 94px; z-index: 60;
  width: 430px; height: min(660px, calc(100vh - 130px));
  max-width: calc(100vw - 24px);
  background: var(--bg2); border: 1px solid var(--border); border-radius: 18px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  transform-origin: bottom right;
  animation: popUp .2s ease;
}
@keyframes popUp {
  from { transform: scale(.92) translateY(14px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
#ai-panel.hidden { display: none; }
.ai-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--panel); }
.ai-header img { width: 32px; height: 32px; }
.ai-title { flex: 1; line-height: 1.25; }
.ai-title b { font-size: 15px; }
.ai-title small { display: block; color: var(--muted); font-size: 11.5px; }
.ai-icon-btn { background: var(--panel2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; width: 30px; height: 30px; font-size: 14px; }
.ai-icon-btn:hover { border-color: var(--accent); }
.ai-messages { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 14px; }
.ai-msg { display: flex; gap: 9px; max-width: 100%; }
.ai-msg .avatar { margin-top: 2px; }
.ai-bubble { min-width: 0; overflow-wrap: break-word; font-size: 14px; }
.ai-msg.user { flex-direction: row-reverse; }
.ai-msg.user .ai-bubble { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-radius: 14px 4px 14px 14px; padding: 9px 13px; white-space: pre-wrap; }
.ai-msg.assistant .ai-bubble { background: var(--panel); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 10px 13px; width: 100%; }
.ai-msg.assistant .ai-bubble .md-body { font-size: 13.5px; }
.ai-bubble p { margin: 6px 0; }
.ai-bubble pre { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 12.5px; }
.ai-bubble code { font-family: Consolas, Monaco, monospace; font-size: 12.5px; background: var(--bg2); border-radius: 4px; padding: 1px 5px; }
.ai-bubble pre code { background: none; padding: 0; }
.ai-bubble a { word-break: break-all; }
.ai-tool-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px; margin: 2px 4px 2px 0;
}
.ai-tool-chip.done { color: var(--ok); border-color: rgba(63,178,127,.4); }
.ai-tool-chip.fail { color: var(--danger); border-color: rgba(240,82,79,.4); }
.ai-cursor::after { content: '▍'; animation: blink 1s infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.ai-suggest { display: flex; gap: 7px; flex-wrap: wrap; padding: 8px 14px 4px; }
.ai-suggest button {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  font-size: 12px; border-radius: 999px; padding: 5px 12px;
}
.ai-suggest button:hover { color: var(--accent); border-color: var(--accent); }
#ai-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--panel); align-items: flex-end; }
#ai-input { min-height: 44px; max-height: 140px; }
#ai-send { padding: 10px 18px; }
.ai-chats { border-bottom: 1px solid var(--border); background: var(--panel); max-height: 220px; overflow-y: auto; padding: 6px; }
.ai-chats.hidden { display: none; }
.ai-chat-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.ai-chat-item:hover { background: var(--panel2); }
.ai-chat-item.active { background: var(--panel2); color: var(--accent); }
.ai-chat-item .del { margin-left: auto; background: none; border: none; color: var(--muted); visibility: hidden; }
.ai-chat-item:hover .del { visibility: visible; }
.ai-chat-item .del:hover { color: var(--danger); }
.ai-cta { text-align: center; padding: 12px; }
.ai-config-tip { background: var(--panel); border: 1px dashed var(--accent); border-radius: 10px; padding: 12px 14px; font-size: 13px; margin: 4px 0; }

/* ============ 弹窗 / Toast ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(4,6,12,.7); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  width: 460px; max-width: 100%; max-height: 88vh; overflow-y: auto; padding: 22px 24px;
  animation: pop .18s ease;
}
.modal.wide { width: 640px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { margin: 0 0 16px; font-size: 19px; }
.modal .field { margin-bottom: 13px; }
.modal .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }
.tab-row { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-row button { background: none; border: none; color: var(--muted); padding: 9px 14px; font-size: 14px; border-bottom: 2px solid transparent; }
.tab-row button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 18px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  animation: pop .18s ease; max-width: 90vw;
}
.toast.err { border-color: var(--danger); }
.toast.ok { border-color: var(--ok); }

/* ============ 设置页 ============ */
.settings-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px; }
.settings-card h3 { margin: 0 0 6px; font-size: 16px; }
.settings-card .desc { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.key-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; flex-wrap: wrap; }
.key-item:last-child { border: none; }
.key-item .k-name { font-weight: 600; }
.perm-tag { font-size: 11px; border-radius: 4px; padding: 1px 6px; font-weight: 600; }
.perm-read { background: rgba(91,124,250,.15); color: var(--accent); }
.perm-write { background: rgba(63,178,127,.15); color: var(--ok); }
.perm-banned { background: rgba(240,82,79,.15); color: var(--danger); }
.fb-open { background: rgba(255,178,53,.15); color: #e6a23c; }

/* ============ 广告卡片 ============ */
.ad-card {
  position: relative; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin: 10px 0 10px 42px; overflow: hidden;
  transition: border-color .15s;
}
.ad-card:hover { border-color: var(--accent); }
.ad-tag {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font-size: 11px; color: #ffd479; background: rgba(0,0,0,.55);
  border-radius: 4px; padding: 1px 7px; pointer-events: none;
}
.ad-card > a { display: flex; align-items: stretch; gap: 12px; color: var(--text); }
.ad-card > a:hover { text-decoration: none; }
.ad-card img { width: 200px; height: 120px; object-fit: cover; flex-shrink: 0; }
.ad-body { padding: 12px 14px 12px 0; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.ad-body b { font-size: 16px; }
.ad-body p { color: var(--muted); font-size: 13px; margin: 4px 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ad-link-hint { color: var(--accent); font-size: 12.5px; }

/* ============ 管理后台 ============ */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat-card b { font-size: 24px; display: block; line-height: 1.3; }
.stat-card span { color: var(--muted); font-size: 12.5px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table th { color: var(--muted); font-weight: 600; background: var(--bg2); white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.admin-toolbar input { flex: 1; min-width: 140px; width: auto; }
.k-meta { color: var(--muted); font-size: 12px; width: 100%; }
.radio-row { display: flex; gap: 18px; margin: 6px 0 2px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); cursor: pointer; }
.radio-row input { width: auto; }
.new-key-box { background: var(--bg2); border: 1px dashed var(--ok); border-radius: 10px; padding: 12px 14px; margin-top: 10px; word-break: break-all; font-family: Consolas, monospace; font-size: 13px; }
.doc-block { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-family: Consolas, Monaco, monospace; font-size: 12.5px; white-space: pre; margin: 10px 0; }
.doc-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.doc-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.doc-table code { color: var(--accent); }
.test-result { margin-top: 10px; font-size: 13.5px; }
.test-result.ok { color: var(--ok); }
.test-result.err { color: var(--danger); }

/* ============ 私信 / 通知 ============ */
.two-col { display: grid; grid-template-columns: 280px 1fr; gap: 12px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.conv-item { display: flex; gap: 10px; padding: 11px 12px; border-radius: 10px; cursor: pointer; align-items: center; }
.conv-item:hover, .conv-item.active { background: var(--panel2); }
.conv-item .c-info { flex: 1; min-width: 0; }
.conv-item .c-name { font-weight: 600; font-size: 14px; }
.conv-item .c-last { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 420px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 75%; padding: 8px 13px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; overflow-wrap: break-word; }
.chat-msg.mine { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-radius: 14px 4px 14px 14px; }
.chat-msg.theirs { align-self: flex-start; background: var(--panel2); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.notif-item { display: flex; gap: 12px; padding: 13px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.notif-item:hover { border-color: var(--accent); }
.notif-item.unread { border-left: 3px solid var(--accent); }
.notif-item .n-text { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 用户主页 ============ */
.profile-head { display: flex; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.profile-head .p-info h2 { margin: 0; font-size: 20px; }
.profile-head .p-info .bio { color: var(--muted); font-size: 13.5px; margin: 4px 0; }
.profile-stats { display: flex; gap: 18px; font-size: 13px; color: var(--muted); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 80;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  #sidebar.open { transform: none; }
  #sb-toggle {
    display: block; position: fixed; top: 12px; left: 12px; z-index: 90;
    background: var(--panel2); border: 1px solid var(--border); color: var(--text);
    border-radius: 10px; width: 38px; height: 38px; font-size: 17px;
  }
  #sb-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 70; }
  #main { padding-top: 64px; }
  #ai-panel {
    right: 10px; left: 10px; bottom: 88px; width: auto;
    height: calc(100vh - 110px);
  }
  #ai-fab { right: 16px; bottom: 16px; }
}
