/* ══════════════════════════════════════════════════════════
   Hermes Console 样式 · 现代暗色 Modern Dark
   Linear/Vercel 风 · 深蓝黑 · 克制现代
   ══════════════════════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --page-bg: #0f1419;
  --bg: #0f1419;
  --bg2: #1a2029;
  --card: #1e2630;
  --card-hover: #232d3a;
  --border: #2d3744;
  --border-strong: #3b4757;
  --text: #e6edf3;
  --muted: #8b98a5;
  --faint: #5c6b7a;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --on-accent: #ffffff;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.35);
  --card-glow: inset 0 1px 0 rgba(255,255,255,.06);
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", Consolas, monospace;
}

/* 自定义滚动条（全站） */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

::selection { background: rgba(59,130,246,.25); }

body {
  font-family: var(--font);
  background: var(--page-bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

/* ── 登录页 ── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(37,99,235,.18) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 80% 100%, rgba(59,130,246,.14) 0%, transparent 60%),
    var(--page-bg);
}
.login-card {
  width: 360px; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px 34px; text-align: center;
  box-shadow: var(--shadow-lg), var(--card-glow);
  backdrop-filter: blur(12px);
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; font-size: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(37,99,235,.4);
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; letter-spacing: .02em; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-card input {
  width: 100%; padding: 12px 15px; margin-bottom: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 14px; outline: none; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.login-card button {
  width: 100%; padding: 12px; margin-top: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent); border: none; border-radius: 10px;
  font-size: 15px; cursor: pointer; font-weight: 600; font-family: inherit;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  transition: all .18s;
}
.login-card button:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(37,99,235,.45); }
.login-card button:active { transform: translateY(0) scale(.98); }
.login-card button:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.login-error { color: var(--red); margin-top: 12px; font-size: 13px; }

/* ── 顶栏（毛玻璃） ── */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; height: 58px;
  background: rgba(26,32,41,.8);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.brand-badge {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  padding: 8px 16px; background: transparent; border: none; color: var(--muted);
  font-size: 14px; cursor: pointer; border-radius: 8px; font-family: inherit;
  transition: color .15s, background .15s; position: relative;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,.05); }
.tab.active { color: var(--accent); background: rgba(59,130,246,.1); font-weight: 600; }
.tab.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 1px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* 顶栏按钮（ghost 风格） */
.btn-docs, .btn-dashboard, .btn-logout {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  text-decoration: none; cursor: pointer; font-family: inherit;
  transition: all .18s; border: 1px solid var(--border);
  background: transparent; color: var(--muted);
}
.btn-docs:hover { color: var(--accent); border-color: rgba(59,130,246,.4); background: rgba(59,130,246,.08); transform: translateY(-1px); }
.btn-dashboard:hover { color: var(--green); border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); transform: translateY(-1px); }
.btn-logout:hover { color: var(--red); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }

/* ── 内容 ── */
.content { padding: 24px; max-width: 1440px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── 卡片 ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow), var(--card-glow);
  transition: transform .18s, box-shadow .18s, background .18s, border-color .18s;
}
.card:hover {
  background: var(--card-hover); transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--card-glow);
  border-color: var(--border-strong);
}
.card h3 { font-size: 15px; margin-bottom: 14px; color: var(--text); font-weight: 600; }
.card h4 { font-size: 12.5px; margin: 12px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h3 { margin-bottom: 0; }

/* ── 按钮系统：1 基础 + 4 层级 + 3 尺寸 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .18s ease;
  user-select: none; white-space: nowrap; border: none;
  text-decoration: none; font-family: inherit;
}
.btn-md { padding: 9px 16px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent); box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.1); box-shadow: 0 6px 16px rgba(37,99,235,.45); }
.btn-secondary {
  background: rgba(59,130,246,.1); color: var(--accent);
  border: 1px solid rgba(59,130,246,.35);
}
.btn-secondary:hover { background: rgba(59,130,246,.18); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.btn-danger {
  background: rgba(239,68,68,.1); color: var(--red);
  border: 1px solid rgba(239,68,68,.4);
}
.btn-danger:hover { background: rgba(239,68,68,.2); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.3); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }

/* 旧类名映射到新体系（保持 HTML 兼容） */
.btn-add { background: rgba(59,130,246,.1); color: var(--accent); border: 1px solid rgba(59,130,246,.35); border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .18s; font-family: inherit; }
.btn-add:hover { background: rgba(59,130,246,.18); transform: translateY(-1px); }
.btn-danger { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.4); border-radius: var(--radius-sm); padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .18s; font-family: inherit; }
.btn-danger:hover { background: rgba(239,68,68,.2); transform: translateY(-1px); }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }
.btn-mini { background: rgba(59,130,246,.1); color: var(--accent); border: 1px solid rgba(59,130,246,.35); border-radius: var(--radius-sm); padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .18s; font-family: inherit; }
.btn-mini:hover { background: rgba(59,130,246,.18); transform: translateY(-1px); }
.btn-mini-danger { color: var(--red); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.1); }
.btn-mini-danger:hover { background: rgba(239,68,68,.2); }
.btn-mini:disabled { opacity: .5; cursor: not-allowed; }
.btn-del { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.4); color: var(--red); border-radius: var(--radius-sm); padding: 3px 10px; font-size: 12px; cursor: pointer; transition: all .18s; font-family: inherit; }
.btn-del:hover { background: rgba(239,68,68,.2); color: var(--red); transform: translateY(-1px); }

/* 上传/日志区主按钮 */
.upload-row button, .log-controls button {
  padding: 9px 16px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
  box-shadow: 0 2px 8px rgba(37,99,235,.35); transition: all .18s;
}
.upload-row button:hover, .log-controls button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.upload-row button:disabled, .log-controls button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* 状态行 */
.stat-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.stat-row span { color: var(--muted); width: 70px; flex-shrink: 0; }
.stat-row b { flex: 1; text-align: right; }
.stat-row.small { font-size: 12px; color: var(--muted); justify-content: flex-end; padding: 0 0 8px; }
.bar { flex: 2; height: 7px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; transition: width .4s; }
.bar i:nth-child(1) { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.bar i:nth-child(2) { background: linear-gradient(90deg, var(--green), #22c55e); }

/* 服务徽章 */
.svc-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.svc-badge {
  padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px;
  border: 1px solid var(--border); font-family: var(--mono);
  transition: all .15s;
}
.svc-badge:hover { transform: translateY(-1px); }
.svc-badge.ok { color: var(--green); border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); }
.svc-badge.off { color: var(--red); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }
.svc-badge.unk { color: var(--yellow); border-color: rgba(234,179,8,.4); background: rgba(234,179,8,.08); }

/* 服务状态列表 */
.svc-table td { vertical-align: middle; }
.svc-dot-badge {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px;
}
.svc-dot-badge.ok { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.6); }
.svc-dot-badge.off { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,.6); }
.svc-dot-badge.unk { background: var(--yellow); box-shadow: 0 0 6px rgba(234,179,8,.6); }
.svc-table code { color: #93c5fd; font-size: 12.5px; font-family: var(--mono); }
.svc-port { color: var(--muted); font-size: 11px; margin-left: 4px; }
.svc-warn { margin-left: 4px; font-size: 11px; }
.svc-desc { color: var(--muted); font-size: 12.5px; }
.svc-state {
  display: inline-block; padding: 3px 11px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; text-transform: capitalize;
}
.svc-state.ok { color: var(--green); background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); }
.svc-state.off { color: var(--red); background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); }
.svc-state.unk { color: var(--yellow); background: rgba(234,179,8,.12); border: 1px solid rgba(234,179,8,.3); }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--bg2); }
.tbl td.small { font-size: 12px; color: var(--muted); }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(59,130,246,.04); }
.tbl a.dl { color: var(--accent); text-decoration: none; }
.tbl a.dl:hover { text-decoration: underline; }
.status-pending { color: var(--yellow); }
.status-running { color: var(--accent); }
.status-done { color: var(--green); }
.status-failed { color: var(--red); }

/* 上传 */
.upload-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.upload-row input[type=file] { color: var(--muted); font-size: 13px; }
.upload-hint { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
#wiki-upload-status { margin-top: 10px; font-size: 13px; color: var(--green); }

/* API Key 表格操作按钮：左右分开 */
.key-actions { display: flex; align-items: center; gap: 14px; }
.key-actions .btn-mini { margin-right: 0; flex-shrink: 0; }
.wiki-right .file-list { max-height: 200px; overflow-y: auto; }

/* 文件选择列表 */
.file-list {
  margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg);
}
.file-list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg2); font-size: 12px;
  color: var(--muted); border-bottom: 1px solid var(--border);
}
.file-list-head b { color: var(--accent); }
.file-list-clear {
  color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px;
  border-radius: 4px; user-select: none;
}
.file-list-clear:hover { color: var(--red); background: rgba(239,68,68,.1); }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: rgba(255,255,255,.02); }
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.file-size { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.file-remove {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; transition: all .15s;
}
.file-remove:hover { color: var(--red); background: rgba(239,68,68,.12); }

/* 日志 */
.log-controls { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.log-controls select, .log-controls input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 11px; font-size: 13px; outline: none;
  font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.log-controls select:focus, .log-controls input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.log-controls input { width: 90px; }
.log-output {
  background: #0b0e13; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; font-family: var(--mono); font-size: 12px;
  line-height: 1.55; max-height: 480px; overflow: auto; white-space: pre-wrap;
  word-break: break-all; color: #93c5fd;
}

.loading { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-size: 13px; }

/* ── 知识库：左右布局（等高对齐） ── */
.wiki-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 1100px) {
  .wiki-layout { grid-template-columns: 1fr; }
}
.wiki-right {
  display: flex; flex-direction: column; gap: 16px;
  min-height: 0;
  max-height: 800px;
}
.wiki-right .card { margin-bottom: 0; }
.wiki-right .card:last-child {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0;
}
.wiki-right .card:last-child #wiki-jobs {
  flex: 1; min-height: 120px; overflow-y: auto;
  scrollbar-width: thin;
}
.wiki-right .card:last-child #wiki-jobs::-webkit-scrollbar { width: 6px; }
.wiki-right .card:last-child #wiki-jobs::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 3px;
}

/* 导入任务 tab */
.jobs-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.jobs-tab {
  padding: 5px 14px; background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; transition: all .15s; font-family: inherit;
}
.jobs-tab:hover { color: var(--text); border-color: var(--border-strong); }
.jobs-tab.active {
  background: rgba(59,130,246,.12); color: var(--accent);
  border-color: rgba(59,130,246,.4);
}
.jobs-empty { color: var(--muted); font-size: 13px; padding: 12px 0; }
.jobs-list { overflow-y: auto; }
.jobs-list .tbl { min-width: 100%; }

/* ── 知识库浏览器（左文件树 + 右图谱/预览） ── */
.wiki-explorer { padding: 0; overflow: hidden; }
.explorer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.explorer-actions { display: flex; align-items: center; gap: 16px; }
.explorer-views { display: flex; gap: 8px; }

/* MCP 服务开关 */
.mcp-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.mcp-toggle-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mcp-toggle.on .mcp-toggle-label { color: var(--green); }
.switch {
  position: relative; display: inline-block; width: 40px; height: 21px;
  background: var(--border); border-radius: 11px; transition: background .2s;
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  background: #fff; border-radius: 50%; transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.switch.on .knob { left: 21px; }
.switch.loading { opacity: .5; pointer-events: none; }
.view-btn {
  padding: 6px 14px; background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all .15s; font-family: inherit;
}
.view-btn:hover { color: var(--text); border-color: var(--border-strong); }
.view-btn.active {
  background: rgba(59,130,246,.12); color: var(--accent);
  border-color: rgba(59,130,246,.4);
}
.explorer-body { display: flex; height: 720px; min-height: 560px; }
.explorer-side {
  width: 240px; flex-shrink: 0; overflow-y: auto;
  border-right: 1px solid var(--border); background: var(--bg);
  padding: 10px 8px;
}
.explorer-main {
  flex: 1; position: relative; overflow: hidden; background: #0b0e13;
  display: flex; flex-direction: column;
}
.graph-container { width: 100%; flex: 1; min-height: 0; }
.preview-container {
  width: 100%; height: 100%; overflow: auto; padding: 20px;
  background: #0b0e13;
}

/* 文件树 */
.tree-node { font-size: 13px; }
.tree-dir {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px;
  color: var(--text); cursor: pointer; border-radius: var(--radius-sm); font-weight: 600;
  user-select: none;
}
.tree-dir:hover { background: rgba(255,255,255,.05); }
.tree-dir .caret {
  display: inline-block; width: 12px; transition: transform .15s; font-size: 10px;
  color: var(--muted);
}
.tree-dir.open .caret { transform: rotate(90deg); }
.tree-children { padding-left: 18px; display: none; }
.tree-dir.open + .tree-children { display: block; }
.tree-file {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  color: var(--muted); cursor: pointer; border-radius: var(--radius-sm); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-file:hover { background: rgba(255,255,255,.05); color: var(--text); }
.tree-file.active { background: rgba(59,130,246,.14); color: var(--accent); }
.tree-file .f-size { margin-left: auto; font-size: 10px; color: var(--muted); opacity: .7; }
.tree-file:hover .f-size { opacity: 1; }

/* 图谱统计条 */
.graph-stats {
  position: absolute; top: 10px; left: 12px; z-index: 5;
  background: rgba(15,20,25,.85); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12px; color: var(--muted);
  backdrop-filter: blur(4px);
}
.graph-stats b { color: var(--text); }
/* 图例 */
.graph-legend {
  position: absolute; bottom: 12px; right: 12px; z-index: 5;
  background: rgba(15,20,25,.85); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px;
  backdrop-filter: blur(4px); display: flex; flex-direction: column; gap: 4px;
}
.graph-legend .lg-item { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.graph-legend .lg-dot { width: 10px; height: 10px; border-radius: 3px; }

/* 文件预览 */
.preview-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.preview-toolbar .p-path {
  flex: 1; font-family: var(--mono); font-size: 12px; color: var(--muted);
  word-break: break-all;
}
.preview-toolbar .p-size { font-size: 12px; color: var(--muted); }
.preview-content {
  font-family: var(--mono); font-size: 12.5px;
  line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  color: #c8d3dc;
}
.preview-content .wiki-link {
  color: #60a5fa; cursor: pointer; text-decoration: none;
  border-bottom: 1px dashed rgba(96,165,250,.4);
}
.preview-content .wiki-link:hover { color: #93c5fd; }
.preview-binary { padding: 40px; text-align: center; color: var(--muted); font-size: 14px; }
.preview-binary .big-icon { font-size: 48px; margin-bottom: 12px; }

/* ── 文件分享：紧凑统计 + 分页 + 删除 ─────────────── */
.share-stats-compact {
  display: flex; flex-wrap: wrap; gap: 6px 22px;
  font-size: 13px; color: var(--text);
  padding: 6px 0 10px;
}
.share-stats-compact b { color: var(--accent); }
.share-settings {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-top: 4px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
.share-settings-label { color: var(--text); font-weight: 600; white-space: nowrap; }
.share-settings-field {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.share-settings-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.share-settings-icon { font-size: 14px; }
.share-settings-field input {
  width: 60px; padding: 3px 0; background: transparent;
  border: none; color: var(--text); font-size: 14px; outline: none;
  text-align: right; font-family: inherit;
}
.share-settings-unit { color: var(--muted); font-size: 12px; }
.share-settings-hint { font-size: 12px; margin-left: auto; white-space: nowrap; }
.share-count { font-size: 12px; font-weight: 400; }
.share-tbl td { padding: 6px 10px; }
.share-actions { white-space: nowrap; text-align: right; }
.share-actions .dl { margin-right: 10px; }
.pager {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px 0 4px; font-size: 13px; color: var(--muted);
}
.pager button {
  padding: 4px 12px; background: rgba(59,130,246,.1); color: var(--accent);
  border: 1px solid rgba(59,130,246,.35); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; transition: all .15s; font-family: inherit;
}
.pager button:hover:not([disabled]) { background: rgba(59,130,246,.18); transform: translateY(-1px); }
.pager button[disabled] { opacity: 0.4; cursor: not-allowed; }
.card-head .btn-mini-danger { margin-right: 0; }

/* 专属：立刻清理超时文件按钮（卡片右上角，精致红色） */
#share-cleanup-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: 9px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  color: #fca5a5;
  background: linear-gradient(135deg, rgba(239,68,68,.14), rgba(239,68,68,.06));
  border: 1px solid rgba(239,68,68,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 2px 6px rgba(239,68,68,.12);
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
#share-cleanup-btn:hover {
  color: #fecaca;
  background: linear-gradient(135deg, rgba(239,68,68,.26), rgba(239,68,68,.14));
  border-color: rgba(239,68,68,.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 4px 14px rgba(239,68,68,.28);
  transform: translateY(-1px);
}
#share-cleanup-btn:active { transform: translateY(0) scale(.97); }
#share-cleanup-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(239,68,68,.3); }
#share-cleanup-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#share-cleanup-btn .cleanup-ico {
  font-size: 14px; line-height: 1;
  filter: drop-shadow(0 0 4px rgba(239,68,68,.5));
}

/* 加载 spinner */
.spinner {
  display: inline-block; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 模态框 ──────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  animation: modal-fade .15s ease;
}
/* 关键：hidden 属性必须覆盖 display:flex（否则弹窗初始就显示、取消无效） */
.modal-overlay[hidden] { display: none !important; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  width: 440px; max-width: 92vw; max-height: 86vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px 22px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,.03) inset;
  animation: modal-pop .18s ease;
}
@keyframes modal-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-box h3 { margin: 0 0 14px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.modal-box label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.modal-box input, .modal-box select, .modal-box textarea {
  width: 100%; padding: 8px 11px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 13px; outline: none; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.modal-box input:focus, .modal-box select:focus, .modal-box textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.modal-box textarea { min-height: 70px; resize: vertical; }
.modal-box .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.modal-box .form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions button { padding: 8px 18px; border-radius: 8px; font-size: 13px; cursor: pointer; font-family: inherit; transition: all .15s; border: none; }
.modal-actions .btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600;
}
.modal-actions .btn-primary:hover { filter: brightness(1.1); }
.modal-actions .btn-cancel { background: rgba(255,255,255,.06); color: var(--text); border: 1px solid var(--border); }
.modal-actions .btn-cancel:hover { background: rgba(255,255,255,.1); }
.modal-error { color: var(--red); font-size: 12px; margin-top: 8px; min-height: 16px; }

/* 项目多选 */
.proj-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; max-height: 160px; overflow-y: auto; }
.proj-check {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  font-size: 12px; cursor: pointer; transition: all .12s;
}
.proj-check:hover { border-color: var(--border-strong); }
.proj-check.checked { border-color: var(--accent); background: rgba(59,130,246,.1); }
.proj-check input { width: auto; margin: 0; accent-color: var(--accent); }

/* ── 表格修复：操作列不换行、不溢出 ─────────────── */
.tbl th, .tbl td { white-space: nowrap; }
.tbl td:last-child .key-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.tbl .key-actions .btn-mini { white-space: nowrap; flex-shrink: 0; }
.tbl th:nth-child(3) { white-space: nowrap; }
/* 用户表格列宽 */
.tbl .col-role { width: 90px; text-align: center; }
.tbl .col-status { width: 80px; text-align: center; }
.tbl .col-op { width: 260px; }

/* ── 问题详情排版（admin 右侧栏，与 issues.html 一致）── */
.issue-detail { padding: 4px 2px; }
.id-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.id-no { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.id-title { font-size: 16px; font-weight: 700; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  background: rgba(59,130,246,.1); color: var(--accent); border: 1px solid rgba(59,130,246,.3);
  border-radius: 5px; font-size: 11px; cursor: pointer; font-family: inherit;
  transition: all .15s; vertical-align: middle;
}
.copy-btn:hover { background: rgba(59,130,246,.2); }
.id-section { margin-bottom: 14px; }
.id-section h4 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.id-desc {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word; line-height: 1.6;
}
.id-timeline { border-left: 2px solid var(--border); padding-left: 14px; }
.tl-item { position: relative; margin-bottom: 10px; }
.tl-item::before {
  content: ""; position: absolute; left: -19px; top: 5px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
}
.tl-item .tl-time { font-size: 11px; color: var(--muted); }
.tl-item .tl-action { font-size: 12px; font-weight: 600; margin: 2px 0; }
.tl-item .tl-remark { font-size: 12.5px; color: var(--text); background: rgba(255,255,255,.04); border-radius: 6px; padding: 6px 10px; margin-top: 4px; white-space: pre-wrap; }
.tl-item .tl-content { font-size: 12.5px; color: var(--text); white-space: pre-wrap; }
.id-attachments { display: flex; flex-direction: column; gap: 6px; }
.att-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 12px;
}
.att-item a { color: var(--accent); text-decoration: none; }
.att-item a:hover { text-decoration: underline; }

/* ── 问题左右分栏（admin，与 issues.html 一致）── */
.issue-split { display: grid; grid-template-columns: minmax(480px, 46%) minmax(0, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 1100px) { .issue-split { grid-template-columns: 1fr; } }
.issue-left { display: flex; flex-direction: column; min-height: 0; }
.issue-right { min-width: 0; }
.issue-list-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px;
  cursor: pointer; transition: all .15s; background: var(--card);
}
.issue-list-item:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.issue-list-item.active { border-color: var(--accent); background: rgba(59,130,246,.08); }
.issue-list-item .ili-main { flex: 1; min-width: 0; }
.issue-list-item .ili-no { font-size: 12px; color: var(--muted); font-family: var(--mono); flex-shrink: 0; }
.issue-list-item .ili-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-list-item .ili-sev { flex-shrink: 0; }
.issue-list-item .ili-ops { flex-shrink: 0; display: flex; gap: 4px; align-items: center; }
.issue-list-item .ili-edit { flex-shrink: 0; }
/* 横排辅助：编号+标题一行，元信息一行 */
.issue-list-item .ili-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.issue-list-item .ili-head .ili-title { flex: 1; }
.issue-list-item .ili-sub { display: flex; align-items: center; gap: 10px; margin-top: 3px; min-width: 0; white-space: nowrap; overflow: hidden; }
.issue-list-item .ili-sub .ili-time { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.issue-list-item .ili-sub .ili-meta { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 分页省略号 */
.pager-dots { color: var(--muted); padding: 0 4px; font-size: 12px; }

/* 分页信息（第 x/y 页） */
.pager-info { font-size: 12px; color: var(--muted); margin-right: 8px; }

/* ── 网站页脚（备案信息）── */
.site-footer {
  text-align: center;
  padding: 18px 16px 22px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
/* 登录页页脚（无主体撑高时贴底） */
.login-body .site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-top: none;
}
