/* ═══════════ Sword Astra Design System ═══════════ */
:root {
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-muted: rgba(99,102,241,0.15);
  --astra: #38bdf8;
  --blade: #f5c451;
  --blade-muted: rgba(245,196,81,0.12);
  --bg: #0f0f1a;
  --bg-surface: #1a1a2e;
  --bg-elevated: #232340;
  --bg-input: #1e1e32;
  --border: #2a2a40;
  --border-light: #32324a;
  --text: #e4e4f0;
  --text-secondary: #9494b8;
  --text-muted: #606080;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --info: #60a5fa;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.4);
  --font: "Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  --font-mono: "Cascadia Code","JetBrains Mono","Fira Code","Consolas",monospace;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-muted: rgba(79,70,229,0.08);
  --astra: #0284c7;
  --blade: #b7791f;
  --blade-muted: rgba(183,121,31,0.08);
  --bg: #f3f4f6;
  --bg-surface: #ffffff;
  --bg-elevated: #f9fafb;
  --bg-input: #f3f4f6;
  --border: #e5e7eb;
  --border-light: #d1d5db;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --info: #2563eb;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
}

/* theme toggle button */
.theme-toggle {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-secondary); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0; line-height: 1;
}
.theme-toggle:hover { border-color: var(--border-light); color: var(--text); background: var(--bg-input); }

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── 登录/注册页 ── */
.auth-wrapper {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(99,102,241,.12) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(99,102,241,.08) 0%, transparent 60%),
              var(--bg);
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.auth-card .logo {
  text-align: center; margin-bottom: 6px;
  width: 52px; height: 52px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--astra)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; margin: 0 auto 16px; letter-spacing: 0;
}
.auth-card h1 { text-align: center; font-size: 22px; color: var(--text); margin-bottom: 4px; }
.auth-card .sub { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-group input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input); color: var(--text);
  font-size: 14px; outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-muted); }
.form-group input::placeholder { color: var(--text-muted); }
.auth-error { color: var(--error); font-size: 13px; margin-bottom: 14px; min-height: 20px; }
.btn-primary {
  width: 100%; height: 44px; border: none; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.auth-link { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.auth-link a { color: var(--primary); font-weight: 500; }

/* ── 顶部导航栏 ── */
.navbar {
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 20px; flex-shrink: 0;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
.navbar .brand { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; color: var(--text); }
.navbar .brand span { color: var(--primary); }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--astra));
  color: #fff !important; font-size: 11px; letter-spacing: 0; font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08) inset;
}
.navbar .nav-links { display: flex; gap: 4px; margin-left: 8px; }
.navbar .nav-links a {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-secondary); transition: all var(--transition);
}
.navbar .nav-links a:hover, .navbar .nav-links a.active { background: var(--bg-elevated); color: var(--text); }
.navbar .nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.navbar .nav-right .user { font-size: 13px; color: var(--text-secondary); }
.navbar .btn-logout {
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border); padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; transition: all var(--transition);
}
.navbar .btn-logout:hover { color: var(--text); border-color: var(--border-light); }

/* ── 仪表盘 / 入口页 ── */
.dashboard {
  flex: 1; overflow-y: auto; padding: 34px 24px;
  max-width: 1180px; margin: 0 auto; width: 100%;
}
.dashboard .hero {
  position: relative;
  text-align: left;
  margin-bottom: 30px;
  padding: 34px 34px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(99,102,241,.16), rgba(56,189,248,.08) 45%, rgba(245,196,81,.06)),
    var(--bg-surface);
  overflow: hidden;
}
.dashboard .hero::after {
  content: "SA";
  position: absolute; right: 32px; top: 22px;
  color: rgba(228,228,240,.04);
  font-size: 116px; font-weight: 800; letter-spacing: 0;
  pointer-events: none;
}
.dashboard .hero h1 { position: relative; font-size: 42px; color: var(--text); margin-bottom: 10px; letter-spacing: 0; }
.dashboard .hero h1 span { color: var(--blade); }
.dashboard .hero p { position: relative; color: var(--text-secondary); font-size: 15px; max-width: 650px; line-height: 1.7; }
.hero-kicker {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 12px; color: var(--astra);
  font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
}
.hero-kicker::before {
  content: ""; width: 34px; height: 1px; background: var(--astra);
}
.hero-meta {
  position: relative;
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 22px;
}
.hero-meta span {
  padding: 7px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: rgba(15,15,26,.28);
  color: var(--text-secondary);
  font-size: 12px;
}
.section-title {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px; margin-bottom: 32px;
}
.card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; color: inherit;
}
.card:hover { border-color: var(--astra); transform: translateY(-2px); box-shadow: var(--shadow); }
.card .card-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-muted); color: var(--primary);
}
.card h3 { font-size: 15px; color: var(--text); letter-spacing: 0; }
.card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.card.admin-only { display: none; }

.info-box {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px;
}
.info-box h4 { font-size: 13px; color: var(--warning); margin-bottom: 12px; }
.info-box ul { padding-left: 18px; }
.info-box li { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 3px; }
.info-box li strong { color: var(--text); }

/* ── AI 对话页 ── */
.chat-layout { display: flex; flex: 1; min-height: 0; }
.chat-sidebar {
  width: 270px; min-width: 270px; background: var(--bg-surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.chat-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.chat-sidebar-header h2 { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.chat-sidebar-header .model-badge { font-size: 11px; color: var(--primary); background: var(--primary-muted); padding: 2px 8px; border-radius: 4px; }
.chat-conv-list { flex: 1; overflow-y: auto; }
.chat-conv-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--transition);
}
.chat-conv-item:hover { background: var(--bg-elevated); }
.chat-conv-item.active { background: var(--bg-elevated); border-left: 2px solid var(--primary); }
.chat-conv-item .conv-title {
  flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-conv-item .del-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 4px; opacity: 0; transition: opacity var(--transition);
}
.chat-conv-item:hover .del-btn { opacity: 1; }
.chat-conv-item .del-btn:hover { color: var(--error); }
.chat-sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--border); }
.btn-new {
  width: 100%; padding: 8px; border: 1px dashed var(--border); border-radius: var(--radius);
  background: transparent; color: var(--text-secondary); font-size: 13px; cursor: pointer;
  transition: all var(--transition);
}
.btn-new:hover { border-color: var(--primary); color: var(--primary); }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.chat-main-header {
  display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 50px;
  border-bottom: 1px solid var(--border); background: var(--bg-surface); flex-shrink: 0;
}
.chat-main-header .model-select {
  padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-input); color: var(--text); font-size: 12px; outline: none;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; }
.msg { margin-bottom: 16px; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.msg.user .content { background: var(--bg-elevated); color: var(--text); padding: 12px 16px; border-radius: var(--radius); max-width: 80%; margin-left: auto; font-size: 14px; line-height: 1.6; }
.msg.assistant .content { color: var(--text); font-size: 14px; line-height: 1.7; max-width: 85%; }
.msg.assistant .content p { margin-bottom: 8px; }
.msg.assistant .content pre {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px;
  margin: 8px 0;
}
.msg.assistant .content code { font-family: var(--font-mono); font-size: .9em; background: var(--bg-elevated); padding: 2px 6px; border-radius: 3px; }
.msg.assistant .content pre code { background: none; padding: 0; }
.msg.tool, .msg.tool-result {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 8px; font-size: 12px;
}
.msg.tool .tool-header { color: var(--info); font-weight: 600; margin-bottom: 4px; }
.msg.tool-result.success .tool-result-header { color: var(--success); font-weight: 600; }
.msg.tool-result.fail .tool-result-header { color: var(--error); font-weight: 600; }
.msg.tool-result .tool-result-body pre {
  background: var(--bg); padding: 10px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 12px; overflow-x: auto; max-height: 300px;
  margin-top: 6px; color: var(--text-secondary);
}
.msg.reasoning { margin-bottom: 8px; }
.msg.reasoning summary { color: var(--text-muted); font-size: 12px; cursor: pointer; }
.msg.reasoning .reasoning-content { color: var(--text-muted); font-size: 12px; padding: 8px 12px; white-space: pre-wrap; border-left: 2px solid var(--border); margin-top: 4px; }
.msg.system { text-align: center; color: var(--text-muted); font-size: 12px; padding: 8px; }
.msg.error .content { color: var(--error); }

.chat-input-area {
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: var(--bg-surface); flex-shrink: 0;
}
.chat-input-row { display: flex; gap: 10px; }
.chat-input-row textarea {
  flex: 1; min-height: 44px; max-height: 120px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input); color: var(--text); font-size: 14px;
  outline: none; resize: none; line-height: 1.5;
  transition: border-color var(--transition);
}
.chat-input-row textarea:focus { border-color: var(--primary); }
.chat-input-row button {
  padding: 0 22px; border: none; border-radius: var(--radius);
  background: var(--primary); color: #fff; font-weight: 600;
  cursor: pointer; transition: all var(--transition); align-self: flex-end; height: 44px;
}
.chat-input-row button:hover { background: var(--primary-hover); }
.chat-input-row button:disabled { opacity: .4; cursor: not-allowed; }
.config-badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.config-badge.connected { background: rgba(52,211,153,.15); color: var(--success); }
.config-badge.error { background: rgba(248,113,113,.15); color: var(--error); }

/* ── 消息页（聊天风格） ── */
.msg-layout { display: flex; flex: 1; min-height: 0; }
.msg-sidebar {
  width: 300px; min-width: 300px; background: var(--bg-surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.msg-search-box { padding: 12px; position: relative; }
.msg-search-box input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  border: none; border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text);
  font-size: 13px; outline: none;
}
.msg-search-box input:focus { background: var(--bg-input); }
.msg-search-box::before { content: "⌕"; position: absolute; left: 22px; top: 19px; color: var(--text-muted); font-size: 14px; pointer-events: none; }
.msg-search-results {
  position: absolute; top: 50px; left: 12px; right: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); z-index: 10; max-height: 240px; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.msg-contact-list { flex: 1; overflow-y: auto; }
.msg-section-header { padding: 10px 16px 6px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.msg-contact {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  cursor: pointer; transition: background .12s;
}
.msg-contact:hover { background: var(--bg-elevated); }
.msg-contact.active { background: var(--primary-muted); }
.msg-avatar {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff; flex-shrink: 0; position: relative;
}
.msg-contact-info { flex: 1; min-width: 0; }
.msg-contact-name { font-size: 14px; color: var(--text); }
.msg-contact-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-contact-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-contact-time { font-size: 11px; color: var(--text-muted); }
.msg-badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--error); color: #fff; font-size: 11px; font-weight: 600; text-align: center; line-height: 20px; padding: 0 6px; }
.msg-online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); position: absolute; bottom: -1px; right: -1px; border: 2px solid var(--bg-surface); }

.msg-chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.msg-chat-header {
  display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 56px;
  border-bottom: 1px solid var(--border); background: var(--bg-surface); flex-shrink: 0;
}
.msg-chat-header .name { font-size: 15px; color: var(--text); font-weight: 600; }
.msg-chat-header .status { font-size: 11px; margin-top: 1px; }
.msg-chat-header .status.online { color: var(--success); }
.msg-chat-header .status.offline { color: var(--text-muted); }
.msg-chat-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.msg-row { display: flex; gap: 10px; max-width: 70%; margin: 4px 0; align-items: flex-start; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-row .bubble-avatar {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.msg-bubble { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; line-height: 1.6; word-break: break-word; }
.msg-row.mine .msg-bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.msg-row.other .msg-bubble { background: var(--bg-elevated); color: var(--text); border-top-left-radius: 4px; }
.msg-bubble .bubble-time { font-size: 10px; margin-top: 4px; opacity: .6; text-align: right; }
.msg-time-divider { text-align: center; padding: 12px 0; }
.msg-time-divider span { display: inline-block; padding: 3px 10px; background: var(--bg-surface); border-radius: 4px; font-size: 11px; color: var(--text-muted); }
.msg-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.msg-empty .icon { width: 64px; height: 64px; border-radius: 50%; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.msg-empty p { color: var(--text-muted); font-size: 13px; }
.msg-input-bar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-surface); flex-shrink: 0; }
.msg-input-bar input {
  flex: 1; height: 40px; padding: 0 16px; border-radius: 20px; border: none;
  background: var(--bg-elevated); color: var(--text); font-size: 14px; outline: none;
}
.msg-input-bar input:focus { background: var(--bg-input); }
.msg-send-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--primary); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition); flex-shrink: 0;
}
.msg-send-btn:hover { background: var(--primary-hover); }

/* ── 文件管理 ── */
.files-page { flex: 1; overflow-y: auto; padding: 28px 24px; max-width: 1000px; margin: 0 auto; width: 100%; }
.files-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.files-header h1 { font-size: 20px; color: var(--text); }
.breadcrumb { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; font-size: 13px; flex-wrap: wrap; }
.breadcrumb a { color: var(--primary); cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-muted); }
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 32px;
  text-align: center; margin-bottom: 20px; cursor: pointer;
  transition: all var(--transition);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-muted); }
.upload-zone p { color: var(--text-secondary); font-size: 14px; }
.upload-zone .hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.upload-zone input { display: none; }
.upload-status { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; min-height: 20px; }
.upload-status.error { color: var(--error); }
.upload-status.success { color: var(--success); }
.file-table { width: 100%; border-collapse: collapse; }
.file-table th { text-align: left; padding: 8px 14px; font-size: 12px; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); }
.file-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.file-table tr:hover td { background: var(--bg-surface); }
.file-name { display: flex; align-items: center; gap: 10px; }
.file-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.file-icon.dir { background: var(--primary-muted); color: var(--primary); }
.file-icon.file { background: var(--bg-elevated); color: var(--text-muted); }
.file-link { color: var(--text); cursor: pointer; }
.file-link:hover { color: var(--primary); }
.file-size { color: var(--text-muted); white-space: nowrap; }
.file-time { color: var(--text-muted); white-space: nowrap; font-size: 12px; }
.btn-sm {
  display: inline-block; padding: 5px 12px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text-secondary);
  font-size: 12px; text-decoration: none; border: none; cursor: pointer;
  transition: all var(--transition);
}
.btn-sm:hover { background: var(--border-light); color: var(--text); }

/* ── 终端页 ── */
.term-toolbar {
  display: flex; align-items: center; gap: 14px; padding: 0 16px; height: 44px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.term-toolbar .title { color: var(--text-secondary); font-size: 13px; flex: 1; }
.term-container { flex: 1; min-height: 0; padding: 2px; background: #0c0c0d; }
.term-container .xterm { height: 100%; padding: 4px; }
.term-status { color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; padding: 12px 16px; }
.term-status.error { color: var(--error); background: rgba(248,113,113,.08); margin: 12px; border-radius: var(--radius-sm); border: 1px solid rgba(248,113,113,.2); }

/* ── 通用 ── */
.back-link { color: var(--text-muted); font-size: 18px; line-height: 1; text-decoration: none; }
.back-link:hover { color: var(--text); }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px; font-size: 13px; }
.no-results { padding: 16px; color: var(--text-muted); font-size: 12px; text-align: center; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--text-muted); }

/* ═══════════ Job Radar ═══════════ */

/* ── Hub Page ── */
.radar-hub { max-width: 1000px; margin: 0 auto; padding: 40px 20px; }

.radar-hero { text-align: center; margin-bottom: 48px; }
.radar-hero-icon { display: inline-flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: var(--radius-xl); background: var(--primary-muted); color: var(--primary); margin-bottom: 20px; }
.radar-hero h1 { font-size: 32px; font-weight: 700; margin: 0 0 12px; color: var(--text); }
.radar-hero p { color: var(--text-secondary); font-size: 15px; max-width: 500px; margin: 0 auto; }

.radar-stats { display: flex; justify-content: center; gap: 40px; margin-top: 28px; }
.radar-stat { text-align: center; }
.radar-stat-num { display: block; font-size: 28px; font-weight: 700; color: var(--primary); }
.radar-stat-label { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.radar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 48px; }
.radar-card { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); cursor: pointer; transition: all .2s ease; text-decoration: none; }
.radar-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 24px rgba(99,102,241,.12); }
.radar-card-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--bg-elevated); color: var(--card-color, var(--primary)); flex-shrink: 0; }
.radar-card-body { flex: 1; min-width: 0; }
.radar-card-body h3 { margin: 0 0 4px; font-size: 16px; color: var(--text); }
.radar-card-body p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.radar-card-arrow { color: var(--text-muted); flex-shrink: 0; transition: transform .2s; }
.radar-card:hover .radar-card-arrow { transform: translateX(3px); color: var(--primary); }

.radar-footer { padding: 24px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.radar-footer h3 { margin: 0 0 12px; font-size: 14px; color: var(--text-secondary); }
.radar-sources { display: flex; gap: 8px; flex-wrap: wrap; }
.radar-source-placeholder { color: var(--text-muted); font-size: 13px; }

/* ── Page Layout ── */
.radar-page { max-width: 1000px; margin: 0 auto; padding: 24px 20px 60px; min-height: 100vh; overflow-y: auto; }
.radar-page-header { margin-bottom: 24px; }
.radar-page-header h2 { font-size: 22px; font-weight: 700; margin: 0 0 4px; color: var(--text); }
.radar-page-header p { color: var(--text-secondary); font-size: 14px; margin: 0; }

/* ── Search bar ── */
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.search-bar input, .search-bar select { padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; }
.search-bar .search-input-lg { flex: 1; min-width: 240px; }
.radar-sources-bar { margin-bottom: 16px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }

/* ── Job Cards ── */
.job-list { display: flex; flex-direction: column; gap: 12px; }
.job-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: all .2s; }
.job-card:hover { border-color: var(--border-light); box-shadow: 0 2px 12px rgba(0,0,0,.15); }
.job-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 10px; }
.job-card-main h3 { margin: 0 0 4px; font-size: 16px; color: var(--text); }
.job-card-salary { font-size: 15px; font-weight: 600; color: var(--warning); white-space: nowrap; }
.company { color: var(--text-secondary); font-size: 13px; }
.job-meta { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.tag { padding: 3px 10px; background: var(--bg-elevated); border-radius: 20px; font-size: 12px; color: var(--text-secondary); }
.tag-source { color: var(--text-muted); font-style: italic; }
.tag-selected { background: var(--primary-muted); color: var(--primary); }
.job-desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 10px; line-height: 1.6; }
.job-skills { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.skill-tag { padding: 3px 10px; background: var(--primary-muted); color: var(--primary); border-radius: 20px; font-size: 12px; font-weight: 500; }
.skill-tag.matched { background: rgba(52,211,153,.12); color: var(--success); }
.skill-tag.missing { background: rgba(248,113,113,.12); color: var(--error); }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-sm { padding: 5px 14px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all .15s; text-decoration: none; display: inline-block; }
.btn-sm:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-muted); }
.btn-accent { border-color: var(--success); color: var(--success); background: rgba(52,211,153,.08); }
.btn-accent:hover { background: rgba(52,211,153,.15); color: var(--success); border-color: var(--success); }
.btn-primary { padding: 10px 24px; background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 500; transition: all .15s; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { padding: 12px 32px; font-size: 15px; }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; gap: 12px; align-items: center; margin-top: 24px; }
.pagination button { padding: 6px 18px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; font-size: 13px; }
.pagination button:disabled { opacity: .35; cursor: not-allowed; }

/* ── Related panel ── */
.related-panel { margin-top: 28px; padding: 20px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); }
.related-panel h4 { margin: 0 0 14px; color: var(--primary); font-size: 15px; }
.related-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.related-grid .job-card h4 { margin: 0 0 4px; font-size: 14px; color: var(--text); }

/* ── Resume Page ── */
.resume-layout { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.resume-sidebar { display: flex; flex-direction: column; gap: 16px; }
.resume-upload-area { padding: 24px; background: var(--bg-surface); border: 2px dashed var(--border); border-radius: var(--radius-lg); text-align: center; transition: border-color .2s; }
.resume-upload-area:hover { border-color: var(--primary); }
.resume-upload-icon { color: var(--text-muted); margin-bottom: 12px; }
.resume-upload-area h4 { margin: 0 0 4px; font-size: 15px; color: var(--text); }
.resume-upload-area p { margin: 0 0 16px; font-size: 13px; color: var(--text-muted); }
.resume-upload-area form { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.resume-upload-area .field { padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; width: 100%; box-sizing: border-box; }
.resume-upload-area .field-file { display: none; }
.file-label { display: inline-block; padding: 8px 16px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text-secondary); text-align: center; width: 100%; box-sizing: border-box; }
.file-label:hover { border-color: var(--primary); color: var(--primary); }
.status-msg { margin-top: 8px; font-size: 13px; color: var(--info); }

.resume-list { display: flex; flex-direction: column; gap: 8px; }
.resume-list h4 { margin: 0 0 8px; font-size: 14px; color: var(--text-secondary); }
.resume-card { padding: 14px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all .15s; }
.resume-card:hover, .resume-card.selected { border-color: var(--primary); background: var(--bg-elevated); }
.resume-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.resume-card strong { font-size: 14px; color: var(--text); }

.resume-detail { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; }
.resume-detail-empty { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.resume-detail-section { margin-bottom: 24px; }
.resume-detail-section h4 { margin: 0 0 12px; font-size: 15px; color: var(--primary); padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.resume-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.resume-detail-item { }
.resume-detail-item label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.resume-detail-item span { font-size: 14px; color: var(--text); }

.resume-timeline { position: relative; padding-left: 24px; }
.resume-timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.resume-timeline-item { position: relative; margin-bottom: 16px; }
.resume-timeline-dot { position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-surface); }
.resume-timeline-content strong { display: block; font-size: 14px; color: var(--text); margin-bottom: 2px; }
.resume-timeline-content .text-secondary { font-size: 12px; }
.resume-detail-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary); }
.resume-detail-list li { margin-bottom: 3px; }

.resume-skill-grid { display: grid; gap: 12px; }
.resume-skill-item { display: flex; flex-direction: column; gap: 4px; }
.resume-skill-header { display: flex; justify-content: space-between; align-items: center; }
.resume-skill-bar { height: 6px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.resume-skill-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s ease; }

/* ── Match Page ── */
.match-setup { display: flex; justify-content: center; padding-top: 40px; }
.match-setup-card { max-width: 560px; width: 100%; padding: 36px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); text-align: center; }
.match-setup-icon { color: var(--primary); margin-bottom: 16px; }
.match-setup-card h3 { margin: 0 0 20px; font-size: 18px; color: var(--text); }
.match-resume-select { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; text-align: left; }
.match-resume-select .resume-card { padding: 12px 16px; }
.match-filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }
.match-filters select, .match-filters input { padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; }
.match-filters input { width: 120px; }

.match-results { }
.match-summary { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding: 12px 16px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text); }

.match-score { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: var(--radius); border: 2px solid var(--border); flex-shrink: 0; }
.match-score.score-high { border-color: var(--success); background: rgba(52,211,153,.08); }
.match-score.score-mid { border-color: var(--warning); background: rgba(251,191,36,.08); }
.match-score.score-low { border-color: var(--error); background: rgba(248,113,113,.08); }
.match-score-num { font-size: 22px; font-weight: 700; }
.match-score.score-high .match-score-num { color: var(--success); }
.match-score.score-mid .match-score-num { color: var(--warning); }
.match-score.score-low .match-score-num { color: var(--error); }
.match-score-label { font-size: 10px; color: var(--text-muted); }

.match-detail { margin: 10px 0; }
.match-detail-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.match-label { font-size: 12px; color: var(--text-muted); width: 56px; flex-shrink: 0; padding-top: 3px; }
.analysis-text { color: var(--text-secondary); font-size: 13px; font-style: italic; margin: 8px 0; line-height: 1.5; }

/* ── Gap Analysis Page ── */
.gap-layout { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.gap-input-card { padding: 24px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.gap-input-card h4 { margin: 0 0 12px; font-size: 15px; color: var(--text); }
.field-group { margin-bottom: 16px; }
.field-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.field-group select, .field-group textarea { width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; box-sizing: border-box; }
.field-group textarea { resize: vertical; font-family: inherit; }

.gap-results { }
.gap-header-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.gap-header-bar h3 { margin: 0; font-size: 18px; color: var(--text); }

.gap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.gap-card { padding: 20px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); }
.gap-card-title { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.gap-card-title.success { color: var(--success); }
.gap-card-title.danger { color: var(--error); }
.gap-skill-list { display: flex; flex-direction: column; gap: 8px; }
.gap-skill-item { display: flex; justify-content: space-between; align-items: center; }

.gap-learning-plan { padding: 28px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); line-height: 1.8; }
.gap-learning-plan h1, .gap-learning-plan h2, .gap-learning-plan h3 { color: var(--primary); margin-top: 20px; }
.gap-learning-plan table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.gap-learning-plan th, .gap-learning-plan td { padding: 8px 14px; border: 1px solid var(--border); text-align: left; font-size: 13px; }
.gap-learning-plan th { background: var(--bg-elevated); }
.gap-learning-plan code { background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); font-size: 13px; }
.gap-learning-plan ul, .gap-learning-plan ol { padding-left: 22px; }
.gap-learning-plan li { margin-bottom: 4px; }

/* ── Job Radar Hub ── */
.top-nav {
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 20px; flex-shrink: 0;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
}
.top-nav .nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.top-nav .nav-brand span { color: var(--primary); }
.top-nav .nav-links { display: flex; gap: 4px; }
.top-nav .nav-links a {
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-secondary); text-decoration: none;
  transition: all var(--transition);
}
.top-nav .nav-links a:hover, .top-nav .nav-links a.active { background: var(--bg-elevated); color: var(--text); }

.radar-hub { flex: 1; overflow-y: auto; max-width: 900px; margin: 0 auto; width: 100%; padding: 32px 24px; }
.radar-hero { text-align: center; margin-bottom: 32px; }
.radar-hero-icon { color: var(--primary); margin-bottom: 12px; }
.radar-hero h1 { font-size: 26px; color: var(--text); margin-bottom: 6px; }
.radar-hero > p { color: var(--text-muted); font-size: 14px; max-width: 500px; margin: 0 auto; line-height: 1.6; }
.radar-stats { display: flex; justify-content: center; gap: 48px; margin-top: 24px; }
.radar-stat { text-align: center; }
.radar-stat-num { display: block; font-size: 28px; font-weight: 700; color: var(--text); }
.radar-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.radar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.radar-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  text-decoration: none; color: inherit; cursor: pointer;
  transition: all var(--transition);
}
.radar-card:hover { border-color: var(--primary); background: var(--bg-elevated); }
.radar-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-muted); color: var(--card-color, var(--primary));
}
.radar-card-body { flex: 1; min-width: 0; }
.radar-card-body h3 { font-size: 14px; color: var(--text); margin-bottom: 2px; }
.radar-card-body p { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.radar-card-arrow { color: var(--text-muted); flex-shrink: 0; opacity: 0; transition: opacity var(--transition); }
.radar-card:hover .radar-card-arrow { opacity: 1; }
.radar-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.radar-footer h3 { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.radar-sources { display: flex; flex-wrap: wrap; gap: 8px; }
.radar-source-tag {
  display: inline-block; padding: 4px 12px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text-secondary); font-size: 12px;
  border: 1px solid var(--border);
}
.radar-source-placeholder { color: var(--text-muted); font-size: 13px; }

/* ── Utility ── */
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.loading, .empty { text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 14px; }

@media (max-width: 768px) {
  .resume-layout { grid-template-columns: 1fr; }
  .gap-grid { grid-template-columns: 1fr; }
  .radar-stats { gap: 24px; }
}
