/* ============================================================
   随行档 · 密档设计系统
   ink + bone + amber · hairline · serif 标题 · mono 元数据
   ============================================================ */
:root {
  /* —— 墨色背景层 —— */
  --bg: #0C0E12;            /* 最深 · 画布 */
  --bg-surface: #13161B;    /* 次深 · 侧栏/顶栏/卡片 */
  --bg-surface-hover: #1B1F26; /* 悬停 */
  --bg-elevated: #1B1F26;   /* 浮起 · 图标按钮悬停/toast */
  /* —— 骨色文字层 —— */
  --text: #E9E3D6;          /* 主文字 · 骨白 */
  --text-secondary: #A39C8E;/* 次文字 */
  --text-muted: #6B6557;    /* 弱文字 · 标签/时间戳 */
  /* —— 细线 —— */
  --border: #262B33;        /* 主细线 */
  --border-light: #363B45;  /* 强调细线 */
  /* —— 琥珀主色（金印）—— */
  --primary: #C8964A;
  --primary-hover: #E2B46A;
  --primary-light: rgba(200, 150, 74, 0.12);
  /* —— 语义色（降饱和、土质，与墨色协调）—— */
  --success: #6FAE7E;       /* 静竹绿 */
  --warning: #D9A441;       /* 赭黄 */
  --danger: #C76B5E;        /* 朱泥红 */
  --danger-light: rgba(199, 107, 94, 0.12);
  /* —— 圆角（克制）—— */
  --radius: 4px;
  --radius-sm: 3px;
  --radius-lg: 5px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  /* —— 字体角色 —— */
  --font-sans: 'IBM Plex Sans', 'PingFang SC', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Noto Serif SC', 'Songti SC', 'STSong', 'Source Han Serif SC', serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, 'Consolas', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 56px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0; gap: 4px; flex-shrink: 0;
}

/* 侧栏品牌印 · 金印「档」/ 用户首字 */
.sidebar-logo {
  width: 34px; height: 34px; margin-bottom: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 17px; font-weight: 600;
  color: var(--primary); border: 1px solid var(--primary);
  border-radius: var(--radius-sm); background: var(--primary-light);
  transition: background .15s, border-color .15s;
}
.sidebar-logo:hover { background: rgba(200, 150, 74, 0.2); }

.nav-btn {
  width: 40px; height: 40px; border-radius: var(--radius);
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s; flex-shrink: 0;
}
.nav-btn:hover { background: var(--bg-surface-hover); color: var(--text); }
.nav-btn.active { background: var(--primary-light); color: var(--primary); }
/* 激活态左侧 2px 琥珀条 · 印鉴式标记 */
.nav-btn.active::before {
  content: ""; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 20px; background: var(--primary); border-radius: 1px;
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-spacer { flex: 1; }
.nav-logout:hover { background: var(--danger-light); color: var(--danger); }

.main-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }

/* ---- Topbar ---- */
.topbar {
  height: 52px; padding: 0 22px; gap: 12px; flex-shrink: 0;
  display: flex; align-items: center;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
.topbar-title {
  font-family: var(--font-serif); font-size: 16px; font-weight: 600;
  letter-spacing: 0.01em; white-space: nowrap; flex-shrink: 0;
}
.topbar-spacer { flex: 1; }

/* ---- Login (密档·凭证核验) —— 保留用户认可的设计 ---- */
.login-container {
  --ink: #0C0E12; --ink-2: #13161B; --bone: #E9E3D6; --bone-2: #A39C8E; --bone-3: #6B6557;
  --rule: #262B33; --amber: #C8964A; --amber-2: #E2B46A; --amber-soft: rgba(200,150,74,0.12);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 40px 20px;
  background: var(--ink); color: var(--bone);
  font-family: var(--font-sans);
}
.login-container::before {
  content: ""; position: absolute; top: -220px; left: 50%; transform: translateX(-50%);
  width: 760px; height: 500px;
  background: radial-gradient(ellipse at center, rgba(200,150,74,0.10), transparent 67%);
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  width: 384px; max-width: 100%;
  background: var(--ink-2); border: 1px solid var(--rule); border-radius: 4px;
  padding: 44px 36px 34px; box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.login-card-banner {
  margin: -44px -36px 30px; padding: 13px 22px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--rule); background: rgba(200,150,74,0.04);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bone-3);
}
.login-card-banner .sx-stamp { font-size: 9px; padding: 3px 8px; letter-spacing: 0.2em; }
.login-logo {
  width: 46px; height: 46px; margin: 0 auto 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 23px; font-weight: 600;
  color: var(--amber); border: 1px solid var(--amber); border-radius: 4px;
  background: var(--amber-soft);
}
.login-card h1 {
  text-align: center; font-family: var(--font-serif);
  font-size: 26px; font-weight: 600; letter-spacing: 0.03em;
  margin-bottom: 6px; color: var(--bone);
}
.login-card .subtitle { text-align: center; font-size: 12.5px; color: var(--bone-2); margin-bottom: 30px; }
/* 登录/注册/找回 共用表单元素（下划线式 · 登记单）*/
.login-card .form-group { margin-bottom: 18px; }
.login-card .form-group label {
  display: block; font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bone-3); margin-bottom: 3px; font-weight: 400;
}
.login-card .form-input {
  width: 100%; background: transparent;
  border: none; border-bottom: 1px solid var(--rule); border-radius: 0;
  padding: 9px 0; color: var(--bone); font-size: 14px; font-family: inherit;
  transition: border-color .15s;
}
.login-card .form-input::placeholder { color: var(--bone-3); }
.login-card .form-input:focus { outline: none; border-bottom-color: var(--amber); }
.login-card .form-input.error, .login-card .form-input.error:focus { border-bottom-color: var(--danger); }
.login-card .btn-primary {
  width: 100%; margin-top: 8px; padding: 12px; border: none; border-radius: 3px;
  background: var(--amber); color: #1a1408;
  font-size: 14px; font-weight: 600; letter-spacing: 0.04em;
}
.login-card .btn-primary:hover { background: var(--amber-2); }
.login-card .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.login-links { display: flex; justify-content: space-between; margin-top: 20px; }
.login-links a { font-size: 12.5px; color: var(--bone-2); text-decoration: none; transition: color .15s; }
.login-links a:hover { color: var(--bone); }
.login-back { display: block; text-align: center; margin-top: 18px; font-size: 12px; color: var(--bone-3); text-decoration: none; transition: color .15s; }
.login-back:hover { color: var(--bone-2); }

/* ---- Forms (shared) ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 6px; font-weight: 500;
}
.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--primary); }
.form-input::placeholder { color: var(--text-muted); }
.form-input.error, .form-input.error:focus { border-color: var(--danger); }
.input-error-msg { font-size: 12px; color: var(--danger); margin-top: 6px; min-height: 16px; }

/* ---- Buttons ---- */
.btn {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: #1a1408; font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: transparent; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--border-light); background: var(--bg-surface-hover); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover { background: rgba(199, 107, 94, 0.2); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon-only { padding: 8px; width: 34px; height: 34px; }
/* 停止生成 */
.btn-primary.is-stop { background: var(--bg-elevated); color: var(--text); border-color: var(--border); }
.btn-primary.is-stop:hover { background: var(--bg-surface-hover); border-color: var(--border-light); }
.btn-primary.is-stop svg { width: 14px; height: 14px; }

/* ---- File Browser ---- */
.files-header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; background: var(--bg-surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap;
}
.files-title { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
.files-title h1 { font-family: var(--font-serif); font-size: 17px; font-weight: 600; color: var(--text); margin: 0; }
.files-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-height: 1em; letter-spacing: 0.02em; }
.files-search { flex: 1; min-width: 200px; max-width: 440px; }
.files-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
.files-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex-shrink: 0; }

.files-body { flex: 1; overflow-y: auto; padding: 18px 24px 24px; }

.search-box { flex: 1; position: relative; min-width: 0; }
.search-box input {
  width: 100%; padding: 8px 12px 8px 34px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; font-family: inherit; transition: border-color .15s;
}
.search-box input:focus { outline: none; border-color: var(--primary); }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-muted); }

/* 面包屑 · 登记册路径 */
.breadcrumb { display: flex; align-items: center; gap: 2px; margin-bottom: 16px; font-size: 13px; flex-wrap: wrap; }
.breadcrumb-item {
  color: var(--text-secondary); cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius-sm); transition: background .15s, color .15s; white-space: nowrap;
}
.breadcrumb-item:hover { background: var(--bg-surface-hover); color: var(--text); }
.breadcrumb-item.current { color: var(--text); font-weight: 500; }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-item svg { width: 14px; height: 14px; vertical-align: middle; }

/* 文件表 · 登记册网格（补全此前缺失的列布局） */
.file-list, .file-table {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.file-table-head, .file-row {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: minmax(0, 1fr) 88px 108px auto;
}
.file-table-head {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.file-table-head .file-cell {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted);
}
.file-row {
  padding: 9px 16px; border-bottom: 1px solid var(--border);
  transition: background .12s; cursor: pointer;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--bg-surface-hover); }

.file-cell { min-width: 0; }
.file-cell--name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-cell--size { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.file-cell--date { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.file-cell--actions { display: flex; gap: 2px; justify-content: flex-end; }

/* 文件页控件（排序/视图/选择） */
.file-controls { display: flex; gap: 4px; flex-shrink: 0; }

/* 网格视图 */
.file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; background: transparent; border: none;
}
.file-card {
  position: relative; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s; text-align: center;
}
.file-card:hover { border-color: var(--primary); transform: translateY(-2px); background: var(--bg-surface-hover); }
.file-card .file-icon { width: 48px; height: 48px; margin: 0; }
.file-card .file-icon svg { width: 36px; height: 36px; }
.file-card .file-name {
  font-size: 13px; line-height: 1.4; width: 100%; flex: none;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  white-space: normal; text-overflow: ellipsis;
}
.file-card-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* 选中态 */
.file-row.is-selected, .file-card.is-selected { background: var(--primary-light); border-color: var(--primary); }
.file-row.is-selected:hover { background: var(--primary-light); }

/* 选择 checkbox */
.file-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-light); background: var(--bg);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin-right: 10px; transition: background .15s, border-color .15s;
}
.file-check.is-checked { background: var(--primary); border-color: var(--primary); color: #1a1408; }
.file-check.is-checked svg { width: 13px; height: 13px; }
.file-card .file-check { position: absolute; top: 8px; left: 8px; margin: 0; background: var(--bg-surface); }

/* 批量操作栏 · 印鉴条 */
.batch-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--primary-light); border: 1px solid var(--primary);
  border-radius: var(--radius); font-size: 13px; flex-wrap: wrap;
}
.batch-count { font-weight: 600; color: var(--primary); font-family: var(--font-mono); letter-spacing: 0.02em; }
.batch-spacer { flex: 1; }

/* 旧 .file-row 兼容（无 file-cell 时由 flex 兜底） */
.file-row .file-icon { margin-right: 0; }

.file-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.file-icon svg { width: 20px; height: 20px; }
/* 文件类型色 · 降饱和土质 */
.file-icon.folder { color: var(--primary); }
.file-icon.code { color: #7B8FA8; }
.file-icon.doc { color: var(--text-secondary); }
.file-icon.image { color: var(--success); }
.file-icon.video { color: #9B7AA8; }
.file-icon.audio { color: var(--danger); }
.file-icon.other { color: var(--text-muted); }

.file-name { flex: 1; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.file-actions { opacity: 0; transition: opacity .15s; }
.file-row:hover .file-actions, .file-card:hover .file-actions { opacity: 1; }

.icon-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s; flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-light); }
.icon-btn svg { width: 16px; height: 16px; }

.empty-state {
  padding: 64px 20px; text-align: center; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.empty-state svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: 0.4; }
.error-state { display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* 骨架屏 */
.skeleton-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.skeleton-row:last-child { border-bottom: none; }
.sk-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0; background: var(--bg-elevated); }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.sk-line {
  height: 10px; border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border-light) 37%, var(--bg-elevated) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
.sk-line.w-50 { width: 50%; }
.sk-line.w-25 { width: 25%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---- Upload Zone (drag-drop) ---- */
.upload-overlay {
  position: fixed; inset: 0;
  background: rgba(200, 150, 74, 0.08); backdrop-filter: blur(4px);
  z-index: 998; display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.upload-overlay-box {
  border: 2px dashed var(--primary); border-radius: var(--radius-lg);
  padding: 60px 80px; text-align: center; background: var(--bg-surface);
}
.upload-overlay-box svg { width: 48px; height: 48px; color: var(--primary); margin-bottom: 12px; }
.upload-overlay-box p { font-size: 18px; font-weight: 600; color: var(--text); }

/* ---- Upload Progress ---- */
.upload-list {
  position: fixed; bottom: 20px; right: 20px; width: 320px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); z-index: 1000; overflow: hidden;
}
.upload-list-header {
  padding: 12px 16px; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.upload-item { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.upload-item:last-child { border-bottom: none; }
.upload-item-name { font-size: 13px; margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.upload-item-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.upload-item-status { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.progress-bar { height: 3px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width .2s; }
.progress-fill.success { background: var(--success); }
.progress-fill.error { background: var(--danger); }

/* ---- Chat ---- */
.chat-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.chat-message { max-width: 80%; }
.chat-message.user { align-self: flex-end; }
.chat-message.assistant { align-self: flex-start; }
.chat-bubble {
  padding: 12px 16px; border-radius: var(--radius-lg);
  font-size: 14px; line-height: 1.6; word-break: break-word;
}
.chat-message.user .chat-bubble { background: var(--primary); color: #1a1408; border-bottom-right-radius: 4px; }
.chat-message.assistant .chat-bubble { background: var(--bg-surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chat-tool-badge { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--primary-light); color: var(--primary); }

/* Chat Markdown 内容样式 */
.chat-message.assistant .chat-bubble p { margin: 0 0 8px; }
.chat-message.assistant .chat-bubble p:last-child { margin-bottom: 0; }
.chat-message.assistant .chat-bubble ul,
.chat-message.assistant .chat-bubble ol { margin: 6px 0 8px; padding-left: 22px; }
.chat-message.assistant .chat-bubble li { margin: 2px 0; }
.chat-message.assistant .chat-bubble h1,
.chat-message.assistant .chat-bubble h2,
.chat-message.assistant .chat-bubble h3 { margin: 12px 0 6px; line-height: 1.3; }
.chat-message.assistant .chat-bubble h1 { font-size: 18px; }
.chat-message.assistant .chat-bubble h2 { font-size: 16px; }
.chat-message.assistant .chat-bubble h3 { font-size: 15px; }
.chat-message.assistant .chat-bubble code {
  font-family: var(--font-mono); font-size: 13px; background: var(--bg);
  padding: 1px 5px; border-radius: 3px;
}
.chat-message.assistant .chat-bubble pre {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; overflow-x: auto; margin: 8px 0;
}
.chat-message.assistant .chat-bubble pre code { background: transparent; padding: 0; font-size: 13px; line-height: 1.5; }
.chat-message.assistant .chat-bubble blockquote { border-left: 2px solid var(--border-light); padding-left: 12px; margin: 8px 0; color: var(--text-secondary); }
.chat-message.assistant .chat-bubble table { border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block; overflow-x: auto; }
.chat-message.assistant .chat-bubble th,
.chat-message.assistant .chat-bubble td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.chat-message.assistant .chat-bubble a { color: var(--primary); }
.chat-message.assistant .chat-bubble hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* 复制按钮 */
.chat-msg-actions { display: flex; opacity: 0; transition: opacity .15s; margin-top: 4px; min-height: 22px; }
.chat-message:hover .chat-msg-actions { opacity: 1; }
.chat-msg-copy {
  width: 24px; height: 22px; border: none; background: transparent;
  color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.chat-msg-copy:hover { background: var(--bg-elevated); color: var(--text); }
.chat-msg-copy svg { width: 14px; height: 14px; }

/* 工具调用可折叠卡片 */
.chat-tools-detail {
  margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg); max-width: 100%;
}
.chat-tools-header {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  font-size: 12px; color: var(--text-secondary); cursor: pointer; user-select: none;
}
.chat-tools-header:hover { background: var(--bg-surface-hover); }
.chat-tools-header > svg { width: 14px; height: 14px; flex-shrink: 0; }
.chat-tools-header .chevron { margin-left: auto; transition: transform .15s; width: 12px; height: 12px; }
.chat-tools-detail.expanded .chat-tools-header .chevron { transform: rotate(90deg); }
.chat-tools-body { display: none; padding: 8px; border-top: 1px solid var(--border); flex-direction: column; gap: 8px; }
.chat-tools-detail.expanded .chat-tools-body { display: flex; }
.tool-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; }
.tool-card-head { display: flex; align-items: center; }
.tool-name { font-family: var(--font-mono); color: var(--primary); font-weight: 600; font-size: 12px; }
.tool-args, .tool-result pre {
  margin: 6px 0 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary);
  white-space: pre-wrap; word-break: break-all; background: var(--bg); padding: 6px 8px; border-radius: 3px;
  max-height: 160px; overflow: auto;
}
.tool-result { margin-top: 6px; }
.tool-result-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.tool-result pre { margin: 0; }

.chat-input-area { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg-surface); }
.chat-input-wrapper { display: flex; gap: 8px; align-items: flex-end; }
.chat-input {
  flex: 1; padding: 12px 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px; font-family: inherit;
  resize: none; min-height: 44px; max-height: 120px; transition: border-color .15s;
}
.chat-input:focus { outline: none; border-color: var(--primary); }

.typing-indicator { padding: 8px 16px; color: var(--text-muted); font-size: 13px; align-self: flex-start; }
.typing-indicator .dot { display: inline-block; animation: bounce 1.4s infinite; }
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

/* ---- Settings ---- */
.settings-container { flex: 1; overflow-y: auto; padding: 28px 24px; max-width: 820px; width: 100%; margin: 0 auto; }
.settings-group { margin-bottom: 28px; }
.settings-group-title {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted);
  margin: 0 4px 10px;
}
.settings-section {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 22px; margin-bottom: 14px; transition: border-color .15s;
}
.settings-section:hover { border-color: var(--border-light); }

.setting-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.setting-head-icon {
  width: 38px; height: 38px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.setting-head-icon svg { width: 19px; height: 19px; }
.setting-head-icon.icon-primary { background: var(--primary-light); color: var(--primary); }
.setting-head-icon.icon-success { background: rgba(111, 174, 126, 0.12); color: var(--success); }
.setting-head-icon.icon-warning { background: rgba(217, 164, 65, 0.12); color: var(--warning); }
.setting-head-icon.icon-danger { background: var(--danger-light); color: var(--danger); }
.setting-head-icon.icon-purple { background: rgba(155, 122, 168, 0.12); color: #9B7AA8; }
.setting-head-text { flex: 1; min-width: 0; }
.setting-head-text h3 { font-family: var(--font-serif); font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.setting-head-text .section-desc { color: var(--text-muted); font-size: 12.5px; margin: 0; }
.setting-head-action { flex-shrink: 0; }
.setting-body { margin-top: 4px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }

/* 统计卡 · 登记册数字 */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 2px; height: 100%; background: var(--stat-accent, var(--primary)); opacity: 0.9; }
.stat-card .stat-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.06em; text-transform: uppercase; }
.stat-card .stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-card .stat-unit { font-size: 13px; color: var(--text-muted); font-weight: 400; }

/* 令牌列表 */
.token-list { margin-top: 4px; }
.token-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); margin-top: 10px; transition: border-color .15s;
}
.token-row:hover { border-color: var(--border-light); }
.token-info { min-width: 0; }
.token-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.token-date { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.token-meta-row { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; }
.token-meta-row .dot-sep { margin: 0 6px; opacity: 0.5; }
.token-never { color: var(--text-muted); font-style: italic; }

/* 紧急吊销全部 */
.token-danger-zone {
  margin-top: 14px; padding: 14px 16px;
  border: 1px dashed var(--danger); border-radius: var(--radius);
  background: var(--danger-light);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.token-danger-zone-text { display: flex; flex-direction: column; gap: 2px; }
.token-danger-zone-text strong { color: var(--danger); font-size: 13px; }
.token-danger-zone-text span { color: var(--text-muted); font-size: 12px; }

/* 创建令牌：有效期预设 */
.expiry-options { display: flex; gap: 8px; flex-wrap: wrap; }
.expiry-option {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text-secondary); font-size: 13px; cursor: pointer;
  font-family: inherit; transition: border-color .15s, color .15s, background .15s;
}
.expiry-option:hover { border-color: var(--border-light); color: var(--text); }
.expiry-option.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

/* 令牌结果展示 */
.token-result { display: flex; gap: 8px; align-items: stretch; margin: 12px 0 4px; }
.token-result-value {
  flex: 1; display: block; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-mono); font-size: 13px; line-height: 1.5;
  word-break: break-all; user-select: all; max-height: 120px; overflow: auto;
}

/* Compact stacked form */
.setting-form { display: flex; flex-direction: column; gap: 12px; max-width: 360px; }
.setting-form .form-group { margin-bottom: 0; }
.setting-empty { color: var(--text-muted); font-size: 13px; margin-top: 10px; }

.totp-status { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-success { background: rgba(111, 174, 126, 0.15); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: rgba(217, 164, 65, 0.15); color: var(--warning); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-group { background: var(--primary-light); color: var(--primary); }

/* ---- Toast ---- */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 1001; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px; background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 13px; max-width: 360px;
  animation: slideIn 0.2s;
}
.toast.success { border-left: 2px solid var(--success); }
.toast.error { border-left: 2px solid var(--danger); }
.toast.warning { border-left: 2px solid var(--warning); }
.toast.info { border-left: 2px solid var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.modal {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; width: 420px; max-width: 90vw; box-shadow: var(--shadow);
}
.modal h3 { font-family: var(--font-serif); margin-bottom: 16px; font-size: 17px; font-weight: 600; }
.confirm-message { font-size: 14px; line-height: 1.6; color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ---- Context Menu ---- */
.context-menu {
  position: fixed; background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 1002;
  min-width: 160px; overflow: hidden; padding: 4px;
}
.context-menu-item { padding: 8px 12px; font-size: 13px; cursor: pointer; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 8px; }
.context-menu-item:hover { background: var(--bg-surface-hover); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item svg { width: 15px; height: 15px; }

/* ---- File Preview ---- */
.preview-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.82); z-index: 2000; display: flex; flex-direction: column; }
.preview-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--bg-surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.preview-title { flex: 1; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-actions { display: flex; gap: 4px; flex-shrink: 0; }
.preview-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 24px; }
.preview-loading, .preview-error { color: var(--text-secondary); font-size: 14px; }
.preview-image { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); }
.preview-video { max-width: 100%; max-height: 100%; border-radius: var(--radius); }
.preview-pdf { width: 100%; height: 100%; border: none; border-radius: var(--radius); }
.preview-audio-wrapper { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.preview-audio-wrapper svg { width: 80px; height: 80px; color: var(--primary); }
.preview-audio { width: 320px; max-width: 90vw; }
.preview-text-wrapper { display: flex; width: 100%; max-width: 960px; height: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.preview-line-numbers {
  flex-shrink: 0; padding: 16px 12px; text-align: right; background: var(--bg-surface);
  color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
  white-space: pre; user-select: none; overflow: hidden; border-right: 1px solid var(--border);
}
.preview-text-code { flex: 1; padding: 16px; margin: 0; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; overflow: auto; color: var(--text); }
.preview-truncated { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 8px 16px; background: var(--warning); color: #1a1d27; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }

/* ---- Groups / Data table ---- */
.data-table { width: 100%; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 14px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-surface-hover); }

.group-folder .file-icon { color: var(--primary); }
.group-folder .file-name { font-weight: 600; }

/* ---- Account Info ---- */
.account-info { display: flex; flex-direction: column; gap: 16px; }
.account-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.account-avatar {
  width: 44px; height: 44px; border-radius: var(--radius);
  background: var(--primary-light); color: var(--primary);
  font-family: var(--font-serif); font-size: 20px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px solid var(--primary);
}
.account-name { min-width: 0; }
.account-username { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.3; word-break: break-all; }
.account-sub { margin-top: 4px; font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.account-field { background: var(--bg-surface); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.account-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.account-value { font-size: 14px; color: var(--text); font-weight: 500; word-break: break-all; }

/* ---- Transfer Assistant (文件传输助手) ---- */
.transfer-container { background: var(--bg); }
.transfer-messages { padding: 24px; gap: 14px; }
.transfer-msg { align-self: flex-end; max-width: 80%; display: flex; align-items: flex-start; gap: 8px; position: relative; }
.transfer-msg-body { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.transfer-text-bubble { padding: 10px 14px; border-radius: var(--radius-lg); background: var(--primary); color: #1a1408; font-size: 14px; line-height: 1.6; word-break: break-word; border-bottom-right-radius: 4px; }
.transfer-file-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  border-bottom-right-radius: 4px; cursor: pointer;
  transition: border-color .15s, background .15s; min-width: 240px; max-width: 360px;
}
.transfer-file-card:hover { border-color: var(--primary); background: var(--bg-surface-hover); }
.transfer-file-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: var(--radius-sm); background: var(--bg-elevated); }
.transfer-file-icon svg { width: 20px; height: 20px; }
.transfer-file-icon.folder { color: var(--primary); }
.transfer-file-icon.code { color: #7B8FA8; }
.transfer-file-icon.doc { color: var(--text-secondary); }
.transfer-file-icon.image { color: var(--success); }
.transfer-file-icon.video { color: #9B7AA8; }
.transfer-file-icon.audio { color: var(--danger); }
.transfer-file-icon.other { color: var(--text-muted); }
.transfer-file-info { flex: 1; min-width: 0; }
.transfer-file-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transfer-file-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.transfer-saved { color: var(--success); }
.transfer-file-dl { flex-shrink: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; transition: background .15s, color .15s; }
.transfer-file-dl:hover { background: var(--bg-elevated); color: var(--primary); }
.transfer-file-dl svg { width: 18px; height: 18px; }
.transfer-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.transfer-file-guard { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: var(--radius-sm); }
.transfer-file-guard.warning { background: rgba(217, 164, 65, 0.15); color: var(--warning); }
.transfer-del { opacity: 0; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; transition: opacity .15s, color .15s, background .15s; align-self: center; }
.transfer-msg:hover .transfer-del { opacity: 1; }
.transfer-del:hover { color: var(--danger); background: var(--danger-light); }
.transfer-del svg { width: 16px; height: 16px; }
.transfer-input-area { padding: 12px 24px; }
.transfer-input-wrapper { gap: 8px; }
.transfer-empty { margin: auto; text-align: center; color: var(--text-muted); padding: 40px 20px; }
.transfer-empty-icon { width: 64px; height: 64px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary); border-radius: var(--radius); }
.transfer-empty-icon svg { width: 30px; height: 30px; }
.transfer-empty-title { font-family: var(--font-serif); font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.transfer-empty-desc { font-size: 13px; color: var(--text-muted); max-width: 320px; line-height: 1.6; }
@media (max-width: 768px) {
  .transfer-msg { max-width: 90%; }
  .transfer-file-card { min-width: 0; max-width: 100%; }
}

/* ============ Landing · 随行档 私人密档 —— 保留用户认可的设计 ============ */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.sx-page {
  --ink: #0C0E12; --ink-2: #13161B; --ink-3: #1B1F26;
  --rule: #262B33; --rule-soft: #1E232B;
  --bone: #E9E3D6; --bone-2: #A39C8E; --bone-3: #6B6557;
  --amber: #C8964A; --amber-2: #E2B46A; --amber-soft: rgba(200, 150, 74, 0.12);
  position: relative; min-height: 100vh; background: var(--ink); color: var(--bone);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
/* 字体角色:标题/印章用宋体,元数据用等宽 */
.sx-page h1, .sx-page h2,
.sx-page .sx-mark, .sx-page .sx-seal-mark span, .sx-page .sx-spec-row dt,
.sx-page .sx-node--hub .sx-node-glyph {
  font-family: var(--font-serif); font-weight: 600; letter-spacing: 0.005em;
}
.sx-page .sx-stamp, .sx-page .sx-ref, .sx-page .sx-spec-val,
.sx-page .sx-archive, .sx-page .sx-brand-sub, .sx-page .sx-hero-meta dt,
.sx-page .sx-node-note, .sx-page .sx-edge-label, .sx-page .sx-foot-copy {
  font-family: var(--font-mono);
}

/* ---- 顶栏 ---- */
.sx-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 24px; height: 64px; padding: 0 32px; background: rgba(12, 14, 18, 0.8); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--rule); }
.sx-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; flex-shrink: 0; }
.sx-mark { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--amber); border: 1px solid var(--amber); border-radius: 4px; background: var(--amber-soft); }
.sx-mark--sm { width: 24px; height: 24px; font-size: 13px; border-radius: 3px; }
.sx-brand-meta { display: flex; flex-direction: column; line-height: 1.2; }
.sx-brand-name { font-size: 15px; font-weight: 600; color: var(--bone); }
.sx-brand-sub { font-size: 10px; color: var(--bone-3); letter-spacing: 0.06em; }
.sx-bar-nav { display: flex; gap: 28px; margin-left: 12px; }
.sx-bar-nav a { font-size: 13.5px; color: var(--bone-2); text-decoration: none; transition: color .15s; }
.sx-bar-nav a:hover { color: var(--bone); }
.sx-bar-cta { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.sx-link { font: inherit; font-size: 13.5px; cursor: pointer; padding: 8px 16px; border-radius: 3px; border: 1px solid var(--rule); background: transparent; color: var(--bone); transition: border-color .15s, color .15s; }
.sx-link:hover { border-color: var(--bone-3); }
.sx-link--solid { background: var(--amber); border-color: var(--amber); color: #1a1408; font-weight: 600; }
.sx-link--solid:hover { background: var(--amber-2); border-color: var(--amber-2); }

/* ---- Hero ---- */
.sx-hero { position: relative; overflow: hidden; padding: 80px 32px 88px; border-bottom: 1px solid var(--rule); }
.sx-hero::before { content: ""; position: absolute; top: -220px; left: 50%; transform: translateX(-50%); width: 940px; height: 560px; background: radial-gradient(ellipse at center, rgba(200, 150, 74, 0.07), transparent 68%); pointer-events: none; }
.sx-hero-grid { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 72px; align-items: center; }
.sx-dossier-head { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; flex-wrap: wrap; }
.sx-stamp { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--amber); border: 1px solid var(--amber); padding: 5px 11px; border-radius: 2px; }
.sx-ref { font-size: 11px; color: var(--bone-3); letter-spacing: 0.04em; }
.sx-hero-title { font-size: clamp(40px, 6.2vw, 74px); line-height: 1.06; margin-bottom: 28px; color: var(--bone); }
.sx-fade { color: var(--amber); display: inline-block; animation: sx-fade 5s ease-in-out infinite; }
@keyframes sx-fade { 0%, 100% { opacity: 1; } 50% { opacity: 0.26; } }
@media (prefers-reduced-motion: reduce) { .sx-fade { animation: none; opacity: 0.75; } }
.sx-hero-lead { font-size: 16px; line-height: 1.85; color: var(--bone-2); max-width: 30em; margin-bottom: 36px; }
.sx-hero-cta { display: flex; align-items: center; gap: 26px; margin-bottom: 44px; flex-wrap: wrap; }
.sx-btn { font: inherit; font-size: 14.5px; cursor: pointer; padding: 12px 22px; border-radius: 3px; border: 1px solid var(--amber); background: var(--amber); color: #1a1408; font-weight: 600; transition: background .15s, border-color .15s; }
.sx-btn:hover { background: var(--amber-2); border-color: var(--amber-2); }
.sx-btn--lg { padding: 14px 30px; font-size: 15px; }
.sx-quiet { font-size: 13.5px; color: var(--bone-2); text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 2px; transition: color .15s, border-color .15s; }
.sx-quiet:hover { color: var(--bone); border-color: var(--bone-3); }
.sx-hero-meta { display: flex; gap: 40px; border-top: 1px solid var(--rule-soft); padding-top: 24px; }
.sx-hero-meta > div { display: flex; flex-direction: column; gap: 5px; }
.sx-hero-meta dt { font-size: 10px; color: var(--bone-3); letter-spacing: 0.1em; text-transform: uppercase; }
.sx-hero-meta dd { font-size: 14px; color: var(--bone); }

/* ---- Archive 实证 ---- */
.sx-archive { background: var(--ink-2); border: 1px solid var(--rule); border-radius: 4px; font-size: 12.5px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); overflow: hidden; }
.sx-archive-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--rule); color: var(--bone-2); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.sx-archive-lock { color: var(--amber); }
.sx-archive-list { list-style: none; }
.sx-archive-list li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--rule-soft); color: var(--bone); transition: background .12s; }
.sx-archive-list li:last-child { border-bottom: none; }
.sx-archive-list li:hover { background: var(--ink-3); }
.sx-idx { color: var(--bone-3); font-size: 10.5px; }
.sx-row-name { color: var(--bone); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-row-tag { color: var(--bone-2); font-size: 10px; letter-spacing: 0.04em; }
.sx-warn { color: var(--amber); }
.sx-archive-foot { padding: 12px 16px; border-top: 1px solid var(--rule); background: rgba(200, 150, 74, 0.04); }
.sx-prompt { color: var(--amber); font-size: 11.5px; }

/* ---- 章节头 ---- */
.sx-sec-head { max-width: 1180px; margin: 0 auto; padding: 28px 32px; display: flex; align-items: baseline; gap: 20px; border-bottom: 1px solid var(--rule); }
.sx-sec-num { font-size: 11.5px; color: var(--amber); letter-spacing: 0.1em; }
.sx-sec-head h2 { font-size: clamp(24px, 3.4vw, 32px); color: var(--bone); }
.sx-sec-head p { margin-left: auto; font-size: 13px; color: var(--bone-3); }

/* ---- Spec 规格表 ---- */
.sx-spec { padding-bottom: 32px; }
.sx-spec-table { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.sx-spec-row { display: grid; grid-template-columns: 200px 1fr 150px; gap: 32px; align-items: baseline; max-width: 1116px; margin: 0 auto; padding: 22px 0; border-bottom: 1px solid var(--rule-soft); transition: background .12s; }
.sx-spec-row:last-child { border-bottom: none; }
.sx-spec-row:hover { background: rgba(233, 227, 214, 0.015); }
.sx-spec-row dt { font-size: 17px; color: var(--bone); }
.sx-spec-desc { font-size: 14px; color: var(--bone-2); line-height: 1.75; }
.sx-spec-val { font-size: 11.5px; color: var(--amber); letter-spacing: 0.05em; text-align: right; }

/* ---- Seal 封缄 ---- */
.sx-seal { max-width: 1180px; margin: 0 auto; padding: 92px 32px; display: grid; grid-template-columns: 240px 1fr; gap: 64px; align-items: center; border-bottom: 1px solid var(--rule); }
.sx-seal-mark { width: 168px; height: 168px; margin: 0 auto; position: relative; border: 1px solid var(--amber); border-radius: 50%; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at center, var(--amber-soft), transparent 72%); }
.sx-seal-mark span { font-size: 64px; color: var(--amber); }
.sx-seal-mark::after { content: ""; position: absolute; inset: 9px; border: 1px dashed rgba(200, 150, 74, 0.28); border-radius: 50%; }
.sx-seal-body .sx-stamp { margin-bottom: 20px; }
.sx-seal-body h2 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 18px; color: var(--bone); }
.sx-seal-body p { font-size: 16px; line-height: 1.85; color: var(--bone-2); max-width: 36em; margin-bottom: 26px; }
.sx-seal-points { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; }
.sx-seal-points li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--bone-2); }
.sx-bullet { color: var(--amber); font-size: 9px; }

/* ---- Topo 拓扑 ---- */
.sx-topo { padding-bottom: 88px; border-bottom: 1px solid var(--rule); }
.sx-topo-graph { max-width: 1000px; margin: 60px auto 0; padding: 0 32px; display: flex; align-items: stretch; justify-content: center; }
.sx-node { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 24px; min-width: 168px; border: 1px solid var(--rule); border-radius: 4px; background: var(--ink-2); }
.sx-node-glyph { font-size: 30px; color: var(--bone-2); line-height: 1; }
.sx-node-name { font-size: 16px; color: var(--bone); font-weight: 600; }
.sx-node-note { font-size: 10.5px; color: var(--bone-3); letter-spacing: 0.04em; }
.sx-node--hub { border-color: var(--amber); background: var(--amber-soft); }
.sx-node--hub .sx-node-glyph { color: var(--amber); }
.sx-edge { flex: 1; min-width: 56px; position: relative; display: flex; align-items: center; justify-content: center; }
.sx-edge::before { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, var(--rule) 20%, var(--rule) 80%, transparent); }
.sx-edge-label { position: relative; background: var(--ink); padding: 0 12px; font-size: 10px; color: var(--bone-3); letter-spacing: 0.08em; }

/* ---- CTA ---- */
.sx-cta { text-align: center; padding: 104px 32px; }
.sx-cta .sx-stamp { margin-bottom: 24px; }
.sx-cta h2 { font-size: clamp(28px, 4.2vw, 42px); margin-bottom: 34px; color: var(--bone); }
.sx-cta-note { margin-top: 22px; font-size: 13px; color: var(--bone-3); }

/* ---- Footer ---- */
.sx-foot { max-width: 1180px; margin: 0 auto; padding: 28px 32px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--bone-3); }
.sx-foot-brand { display: flex; align-items: center; gap: 10px; }
.sx-foot-links { display: flex; gap: 22px; margin-left: auto; }
.sx-foot-links a { color: var(--bone-3); text-decoration: none; transition: color .15s; }
.sx-foot-links a:hover { color: var(--bone); }
.sx-foot-copy { letter-spacing: 0.1em; }

/* ---- 响应式 ---- */
@media (max-width: 980px) {
  .sx-hero-grid { grid-template-columns: 1fr; gap: 52px; }
  .sx-seal { grid-template-columns: 1fr; gap: 40px; padding: 64px 32px; text-align: left; }
  .sx-seal-mark { width: 132px; height: 132px; }
  .sx-seal-mark span { font-size: 50px; }
  .sx-spec-row { grid-template-columns: 1fr; gap: 6px; padding: 18px 0; }
  .sx-spec-val { text-align: left; }
  .sx-topo-graph { flex-direction: column; align-items: center; gap: 0; }
  .sx-node { width: 100%; max-width: 360px; flex-direction: row; justify-content: flex-start; gap: 16px; }
  .sx-node-note { text-align: left; }
  .sx-edge { min-height: 44px; width: auto; }
  .sx-edge::before { left: 50%; right: auto; top: 6px; bottom: 6px; width: 1px; height: auto; background: linear-gradient(180deg, transparent, var(--rule) 20%, var(--rule) 80%, transparent); }
}
@media (max-width: 680px) {
  .sx-bar-nav, .sx-brand-meta { display: none; }
  .sx-bar { padding: 0 20px; gap: 12px; }
  .sx-hero { padding: 52px 20px 64px; }
  .sx-hero-meta { flex-wrap: wrap; gap: 18px 28px; }
  .sx-sec-head { padding: 22px 20px; flex-wrap: wrap; }
  .sx-sec-head p { margin-left: 0; width: 100%; }
  .sx-spec-table, .sx-seal, .sx-topo-graph, .sx-cta, .sx-foot { padding-left: 20px; padding-right: 20px; }
  .sx-seal-points { grid-template-columns: 1fr; }
  .sx-cta { padding: 72px 20px; }
}

/* ---- App 响应式 ---- */
@media (max-width: 720px) {
  .file-table-head, .file-row { grid-template-columns: minmax(0, 1fr) auto; }
  .file-cell--date, .file-table-head .file-cell--date { display: none; }
  .file-cell--size { text-align: right; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .btn span { display: none; }
  .files-body { padding: 14px; }
  .files-header { padding: 12px 14px; }
  .file-actions { opacity: 1; }
  .file-controls { gap: 2px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 8px; }
  .batch-bar { gap: 6px; }
  .chat-messages { padding: 12px; }
  .chat-message { max-width: 95%; }
  .upload-list { width: calc(100vw - 24px); right: 12px; bottom: 12px; }
  .preview-body { padding: 12px; }
  .preview-line-numbers { display: none; }
  .preview-text-wrapper { height: auto; max-height: 100%; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- 可访问性：键盘聚焦 ---- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
