/* ============================================
   Sunkoon 涂料 SaaS — 界面规范
   中性暖灰底、实色、10px 圆角。明黄只用于主按钮、导航激活和品牌标识。
   ============================================ */
:root {
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --surface-2: #F1EDE8;
  --surface-3: #E9E7E4;
  --border: #E5E0D8;
  --border-strong: #D5CEC3;
  --text: #2A221C;
  --text-2: #6F6259;
  --text-3: #9C9186;
  --primary: #F5A623;
  --primary-hover: #E09515;
  --primary-active: #E09515;
  --on-primary: #2A221C;
  --secondary: #A0522D;
  --on-secondary: #FFFFFF;
  --ok: #4C8A4F;
  --warn: #C77700;
  --err: #B3402E;
  --info: #4A6FA5;
  --chart1: #F5A623;
  --chart2: #A0522D;
  --chart3: #C46A3A;
  --chart4: #7A4528;
  --shadow: 0 1px 3px rgba(42, 34, 28, .06), 0 4px 16px rgba(42, 34, 28, .05);
  --radius: 10px;
  --sidebar-w: 300px;
  --shell-pad: 32px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --focus: 0 0 0 2px rgba(245, 166, 35, 0.35);

  --card: var(--surface);
  --sidebar: var(--surface);
  --sidebar-text: var(--text-2);
  --sidebar-muted: var(--text-3);
  --muted: var(--text-2);
  --muted-dark: var(--text-2);
  --primary-soft: var(--surface-2);
  --accent: var(--secondary);
  --accent-soft: rgba(160, 82, 45, 0.14);
  --danger: var(--err);
  --danger-soft: var(--err);
  --danger-bg: rgba(179, 64, 46, 0.14);
  --warning: var(--warn);
  --warning-mark: var(--warn);
  --warning-text: var(--warn);
  --warning-bg: rgba(199, 119, 0, 0.14);
  --success: var(--ok);
  --success-soft: var(--ok);
  --success-text: var(--ok);
  --success-bg: rgba(76, 138, 79, 0.14);
  --info-bg: rgba(74, 111, 165, 0.14);
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a, a:hover, a:visited, a:active { text-decoration: none; }
a { color: var(--secondary); }
a:hover { color: var(--primary-hover); }

.app { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.brand {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 12px;
  height: 64px;
  padding: 0 16px 11px;
  border-bottom: 1px solid var(--border);
}
.brand-mark { display: block; line-height: 0; flex-shrink: 0; }
.brand-logo {
  width: 124px;
  height: auto;
  display: block;
  mix-blend-mode: multiply;
}
.brand-text { min-width: 0; padding-bottom: 5px; }
.brand-title { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.25; white-space: nowrap; }
.brand-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-fields { border: 0; margin: 0; padding: 0; min-width: 0; }

.nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.user-menu { position: relative; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.user-chip:hover,
.user-menu.open .user-chip { background: var(--primary-soft); color: var(--text); }
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-avatar.lg { width: 48px; height: 48px; font-size: 20px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { color: var(--text); font-weight: 500; font-size: 13px; }
.user-role { color: var(--muted); font-size: 12px; }
.user-caret { width: 12px; height: 12px; color: var(--muted); flex-shrink: 0; }
.user-menu.open .user-caret { transform: rotate(180deg); }
.user-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(36, 49, 64, 0.08);
  z-index: 100;
}
.user-menu.open .user-menu-panel { display: block; }
.user-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.user-menu-item:hover { background: var(--primary-soft); color: var(--text); }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger:hover { background: var(--danger-bg); color: var(--danger); }
.logout-form { margin: 0; }
.todo-bell { position: relative; }
.todo-bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.todo-bell-btn:hover,
.todo-bell.open .todo-bell-btn { background: var(--primary-soft); color: var(--text); }
.todo-bell-btn svg { width: 18px; height: 18px; display: block; }
.todo-bell-badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--bg);
}
.todo-bell-badge.warn {
  background: var(--warn);
  color: #fff;
}
.todo-bell-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: min(70vh, 420px);
  overflow: auto;
  padding: 4px 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(36, 49, 64, 0.08);
  z-index: 100;
}
.todo-bell.open .todo-bell-panel { display: block; }
.todo-bell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.todo-bell-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.todo-bell-panel .todo-item { padding: 10px 12px; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 12px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px 8px 8px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.nav-ico { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-ico svg { width: 16px; height: 16px; display: block; }

/* ---------- 主区域 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: 64px;
  padding: 0 var(--shell-pad);
  display: flex;
  align-items: center;
  gap: 12px;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.env-badge {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 20px;
  padding: 0 8px;
  border-radius: 99px;
  font-weight: 600;
}
.topbar .menu-toggle { display: none; }
.content {
  padding: 24px var(--shell-pad) 64px;
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
}
.content.content-chat {
  padding: 0;
  max-width: none;
  margin: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.page-chat { height: 100vh; overflow: hidden; }
body.page-chat .app,
body.page-chat .main { height: 100vh; overflow: hidden; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-grid-sm { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.stat-grid-sm .stat-num { font-size: 22px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: inherit;
}
a.stat-card:hover { border-color: var(--border-strong); color: inherit; }
.stat-label { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; color: var(--text-2); order: -1; }
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: -1px; color: var(--text); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-ico { display: none; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head h3 { font-size: 14px; font-weight: 600; }
.panel-body { padding: 16px; overflow-x: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.import-board { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.import-board .panel { margin-bottom: 0; display: flex; flex-direction: column; }
.import-board .panel-body { flex: 1; }
.import-board .table,
.import-board .import-form { width: 100%; }
.import-board .table th:nth-child(1),
.import-board .table td:nth-child(1),
.import-board .table th:nth-child(2),
.import-board .table td:nth-child(2) { white-space: nowrap; }
.import-form { display: flex; flex-direction: column; min-height: 0; }
.import-form .upload-drop { justify-content: center; min-height: 160px; margin: 0; }
.import-drop.is-over { border-color: var(--primary); background: var(--primary-soft); }
.modal.import-progress-modal { width: 480px; }
.progress-track {
  height: 8px;
  margin: 12px 0 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: var(--radius);
  transition: width 0.2s linear;
}
@media (max-width: 1000px) { .grid-2, .import-board, .cfg-pair { grid-template-columns: 1fr; } }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.table th {
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  background: transparent;
  white-space: nowrap;
  padding: 11px 14px;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-2); }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; font-weight: 700; color: var(--secondary); }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.success { color: var(--success-text); }
.danger { color: var(--danger); }
.warn-text { color: var(--warning-text); }

/* ---------- 状态标签 ---------- */
.badge {
  display: inline-block;
  padding: 3px 11px;
  height: auto;
  line-height: 1.5;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(111, 98, 89, 0.14);
  color: var(--text-2);
  white-space: nowrap;
}
.badge-draft, .badge-deleted { background: var(--accent-soft); color: var(--secondary); }
.badge-active, .badge-approved, .badge-verified, .badge-completed, .badge-product,
.badge-finalized, .badge-indexed { background: var(--success-bg); color: var(--ok); }
.badge-pending { background: var(--warning-bg); color: var(--warn); }
.badge-rejected, .badge-failed { background: var(--danger-bg); color: var(--err); }
.badge-experiment, .badge-testing, .badge-in_progress, .badge-indexing,
.badge-1, .badge-2, .badge-3, .badge-ai, .badge-admin {
  background: var(--info-bg);
  color: var(--info);
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.req { color: var(--err); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  transition: border-color .2s ease, background .2s ease;
}
.textarea { height: auto; min-height: 88px; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid .span-2 { grid-column: 1 / -1; }
.panel-head-ops { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.cfg-desc { margin: 0 0 14px; font-size: 13px; }
.cfg-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 4px; }
form > .cfg-foot { margin: 4px 0 16px; }
.cfg-note { margin: 0 0 12px; font-size: 13px; }
.cfg-status { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.cfg-status-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 13px;
}
.cfg-status-tag { color: var(--muted); font-size: 12px; }
.cfg-status-item:hover { border-color: var(--primary); }
.cfg-status-item.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}
.cfg-status-item.on .cfg-status-tag { color: var(--on-primary); font-weight: 400; }
.cfg-status-item.on:hover { background: var(--primary-hover); color: var(--on-primary); }
.cfg-test-msg { margin: 12px 0 0; }
.key-row { display: flex; gap: 8px; align-items: center; }
.key-row .input { flex: 1; min-width: 0; }
.cfg-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.cfg-pair > .panel { margin-bottom: 0; height: 100%; }
.cfg-pair > .panel > form { height: 100%; }
.panel[id^="cfg-"] { scroll-margin-top: 72px; }
@media (max-width: 800px) {
  .form-grid.cols-2 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
.field-full { grid-column: 1 / -1; }
.form-sec { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted-dark); }
.form-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.form-row .input { flex: 1; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.inline-form { display: block; }
.inline-form .form-row input { flex: 1; }
input[type="date"] { min-width: 0; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-dark); white-space: nowrap; }
body:not(.login-body) input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  display: inline-grid;
  place-content: center;
  vertical-align: -2px;
  cursor: pointer;
  flex: none;
}
body:not(.login-body) input[type="checkbox"]::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.5px solid transparent;
  border-bottom: 1.5px solid transparent;
  transform: rotate(-45deg) translateY(-1px);
}
body:not(.login-body) input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary-hover);
}
body:not(.login-body) input[type="checkbox"]:checked::after {
  border-left-color: var(--on-primary);
  border-bottom-color: var(--on-primary);
}
body:not(.login-body) input[type="checkbox"]:indeterminate {
  background: var(--primary);
  border-color: var(--primary-hover);
}
body:not(.login-body) input[type="checkbox"]:indeterminate::after {
  width: 8px;
  height: 0;
  border-left-color: transparent;
  border-bottom-color: var(--on-primary);
  transform: none;
}
body:not(.login-body) input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
body:not(.login-body) input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.input-xs { height: 28px; padding: 2px 8px; font-size: 12px; }

/* ---------- 按钮（全站唯一规范） ----------
   primary  主操作，一处一个
   默认 btn 次操作：返回、取消、筛选、搜索
   danger   删除、驳回、清除
   success  通过、确认完成
   text     表格行内次要操作
   ghost    仅顶栏图标按钮
   ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  background: transparent;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--primary); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: transparent; color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: transparent; color: var(--on-primary); transform: translateY(-1px); }
.btn-danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn-danger:hover { background: var(--err); border-color: var(--err); color: var(--on-secondary); }
.btn-success { background: var(--ok); border-color: var(--ok); color: var(--on-secondary); }
.btn-success:hover { background: #437946; border-color: transparent; color: var(--on-secondary); }
.btn-text {
  background: transparent;
  border-color: transparent;
  color: var(--secondary);
  min-height: 28px;
  height: auto;
  padding: 6px 8px;
  font-size: 12.5px;
}
.btn-text:hover { background: var(--surface-2); color: var(--primary-hover); border-color: transparent; transform: none; }
.btn-text-danger { color: var(--err); }
.btn-text-danger:hover { background: var(--danger-bg); color: var(--err); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: transparent; border-color: var(--primary); color: var(--text); }
.btn-sm { min-height: 0; padding: 6px 13px; font-size: 12.5px; }
.btn-lg { min-height: 40px; padding: 10px 20px; font-size: 13.5px; }
.btn-block { width: 100%; }
.content .btn-ghost,
.page-actions .btn-ghost,
.page-toolbar .btn-ghost,
.form-actions .btn-ghost,
.panel .btn-ghost,
.modal .btn-ghost,
.login-form .btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-2);
}
.content .btn-ghost:hover,
.panel .btn-ghost:hover,
.modal .btn-ghost:hover {
  background: transparent;
  border-color: var(--primary);
  color: var(--text);
}
.modal-head .btn-ghost {
  width: auto;
  min-width: 28px;
  padding: 0 8px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.modal-head .btn-ghost:hover { background: #F4F6F8; color: var(--text); }
.topbar .btn-ghost { background: transparent; border-color: transparent; }
.lang-menu { position: relative; }
.lang-btn { min-width: 44px; }
.topbar .lang-btn,
.login-body .lang-btn {
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-2);
}
.topbar .lang-btn:hover,
.login-body .lang-btn:hover { border-color: var(--primary); color: var(--text); background: transparent; }
.login-body .lang-menu { position: fixed; top: 16px; right: 16px; z-index: 20; }
.lang-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(36, 49, 64, 0.08);
  z-index: 120;
}
.lang-menu.open .lang-menu-panel { display: block; }
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.lang-option:hover { background: var(--primary-soft); }
.lang-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--border);
  flex: none;
}
.lang-option[aria-checked="true"] .lang-dot { background: var(--primary); box-shadow: none; }
html.i18n-pending body { visibility: hidden; }
body[lang="en"] {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0.1px;
}
html[lang="en"] .table th { white-space: normal; line-height: 1.3; }
html[lang="en"] .nav-item { line-height: 1.3; }

/* ---------- 登录（居中、少装饰，接近 Claude 的登录页） ---------- */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 28px;
  background: #faf9f5;
  color: #141413;
}
.login-stage {
  flex: 1;
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.login-logo {
  width: 168px;
  height: auto;
  margin: 0 0 28px;
  mix-blend-mode: multiply;
}
.login-hello {
  margin: 0 0 22px;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti SC", "STSong", serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #141413;
}
.login-form { width: min(360px, 100%); display: flex; flex-direction: column; }
.login-input + .login-input { margin-top: 12px; }
.login-captcha {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.login-captcha-field {
  position: relative;
  flex: 1;
  min-width: 0;
}
.login-captcha-refresh {
  flex: none;
  width: 140px;
  height: 48px;
  padding: 0;
  border: 1px solid #e8e6dc;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
}
.login-captcha-refresh img { display: block; width: 140px; height: 48px; }
.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: #5c5852;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.login-remember input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.login-remember-box {
  width: 16px;
  height: 16px;
  border: 1.5px solid #141413;
  border-radius: 4px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.login-remember input:checked + .login-remember-box {
  background: #141413;
  border-color: #141413;
}
.login-remember input:checked + .login-remember-box::after {
  content: "";
  width: 8px;
  height: 4px;
  margin-top: -2px;
  border-left: 1.5px solid #faf9f5;
  border-bottom: 1.5px solid #faf9f5;
  transform: rotate(-45deg);
}
.login-remember input:focus-visible + .login-remember-box {
  box-shadow: 0 0 0 1px #141413;
}
.login-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #e8e6dc;
  border-radius: 12px;
  background: #fff;
  color: #141413;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-input::placeholder { color: #a8a49b; }
.login-input:focus {
  border-color: #141413;
  box-shadow: 0 0 0 1px #141413;
}
.login-submit {
  margin-top: 18px;
  height: 48px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: #141413;
  color: #faf9f5;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease;
}
.login-submit:hover { background: #2c2b29; }
.login-submit:disabled { opacity: .5; cursor: default; }
.login-error {
  margin: 0 0 4px;
  color: #b3402e;
  font-size: 14px;
  line-height: 1.5;
}
.login-legal {
  margin: 24px 0 0;
  max-width: none;
  text-align: center;
  color: #8d887f;
  font-size: 12px;
  line-height: 1.7;
  white-space: nowrap;
}
.login-body .site-legal-line { display: inline; }
.login-body .site-legal-line + .site-legal-line { margin-left: 16px; }
.sidebar .site-legal-line { display: block; }
.sidebar .site-legal-line + .site-legal-line { margin-left: 0; }
.site-legal a { color: inherit; }
.sidebar .site-legal {
  margin: 0;
  max-width: none;
  padding: 10px 16px 14px;
  text-align: left;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-3);
  border-top: 1px solid var(--border);
}
.error-shell {
  width: 440px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 2px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(36, 49, 64, 0.08);
  padding: 28px 32px 24px;
}
.error-shell.is-deny { border-top-color: var(--warning); }
.error-shell.is-miss { border-top-color: var(--primary); }
.error-shell.is-down { border-top-color: var(--danger); }
.error-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.error-brand-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.error-brand-sub { font-size: 12px; color: var(--muted); line-height: 1.3; }
.error-code {
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--muted-dark);
}
.error-shell.is-deny .error-code { color: var(--warning-text); }
.error-shell.is-miss .error-code { color: var(--primary); }
.error-shell.is-down .error-code { color: var(--danger); }
.error-shell h1 { font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.error-desc { color: var(--muted-dark); font-size: 13px; line-height: 1.7; margin: 0; }
.error-reason {
  margin: 12px 0 0;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}
.error-shell.is-deny .error-reason { background: var(--warning-bg); border-color: #F3E2B0; color: var(--warning-text); }
.error-shell.is-down .error-reason { background: var(--danger-bg); border-color: #F5C2BE; color: var(--danger); }
.error-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
@media (max-width: 860px) {
  .login-shell { max-width: 420px; min-height: 0; }
  .login-brand-panel { display: none; }
  .login-form-panel { padding: 32px 24px; }
  .login-corner-brand { width: 108px; margin-bottom: 20px; }
}

/* ---------- 提示 ---------- */
.alert {
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
}
.alert-error, .alert-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #F5C2BE;
}
.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #C8E6C9;
}
.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-mark);
}
.alert-info {
  background: var(--info-bg);
  color: #1565C0;
  border-color: #BBDEFB;
}
.toast-stack {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  pointer-events: none;
  animation: toast-in 0.22s ease-out;
}
.toast-ico { width: 14px; height: 14px; flex-shrink: 0; display: inline-flex; }
.toast-ico svg { width: 14px; height: 14px; display: block; }
.toast-text { white-space: nowrap; }
.toast-wrap { align-items: flex-start; }
.toast-wrap .toast-ico { margin-top: 2px; }
.toast-wrap .toast-text {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.toast-success { background: var(--success-bg); color: var(--success-text); border-color: #C8E6C9; }
.toast-error { background: var(--danger-bg); color: var(--danger); border-color: #F5C2BE; }
.toast-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-mark); }
.toast-info { background: var(--info-bg); color: #1565C0; border-color: #BBDEFB; }
.toast-out { animation: toast-out 0.2s ease-in forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-24px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-16px); }
}

.empty { color: var(--muted); text-align: center; padding: 28px 10px; }
.center { text-align: center; }
.link { font-size: 12.5px; color: var(--secondary); font-weight: 700; }
.page-toolbar, .page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-toolbar .spacer { flex: 1; }

.tabs, .admin-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab, .admin-tab {
  padding: 8px 16px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: -1px;
}
.tab:hover, .admin-tab:hover { color: var(--text); }
.tab.active, .admin-tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 700; }

.search-bar { display: flex; gap: 8px; flex: 1; align-items: center; flex-wrap: wrap; max-width: none; }
.search-bar .input, .search-bar .select { width: auto; min-width: 140px; flex: 1 1 180px; max-width: 280px; }
.search-bar input.input[type="text"],
.search-bar input.input[type="search"] { flex-basis: 240px; max-width: 360px; }
.table td.mono { white-space: nowrap; }
.table td.cell-oneline {
  max-width: 22em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.table-wrap { overflow-x: auto; }
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.pager-info { color: var(--muted); font-size: 13px; }
.pager-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-num {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.pager-num:hover { background: #F4F6F8; color: var(--text); }
.pager-num.on { background: var(--primary); color: var(--on-primary); font-weight: 700; }
.pager-gap { color: var(--muted); min-width: 16px; text-align: center; }
.pager .is-off { opacity: 0.45; pointer-events: none; }
.pager-size { display: flex; align-items: center; gap: 6px; margin: 0; }
.pager-size .select { width: auto; min-width: 72px; height: 28px; padding: 0 8px; font-size: 13px; }
.table-sm { font-size: 13px; }
.table-sm th, .table-sm td { padding: 6px 8px; }
.kv { width: 100%; border-collapse: collapse; }
.kv th { width: 120px; text-align: left; color: var(--muted); font-weight: 400; padding: 6px 12px 6px 0; vertical-align: top; }
.kv td { padding: 6px 0; }
.ops, .ops-row { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
/* 表格操作列必须保持 table-cell，否则 display:flex 会把末列撑开、和表头/行对不齐 */
.table td.ops,
.table th.col-ops {
  display: table-cell;
  width: 1%;
  white-space: nowrap;
  text-align: left;
  padding-right: 16px;
  vertical-align: middle;
}
.ops-row form.inline, form.inline { display: inline; margin: 0; }
.price-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.price-big { font-size: 22px; font-weight: 600; margin: 4px 0; color: var(--text); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.mt { margin-top: 12px; }
.small { font-size: 12px; }

/* ---------- 问答 ---------- */
.chat-page { display: flex; flex: 1; width: 100%; min-height: 0; height: 100%; gap: 0; overflow: hidden; }
.chat-side {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 10px;
  min-height: 0;
  overflow: hidden;
}
.chat-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-new svg { width: 16px; height: 16px; }
.chat-new:hover { background: var(--primary-soft); color: var(--primary-hover); border-color: var(--primary-hover); }
.chat-side-label {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 8px 2px;
  margin-top: 2px;
  border-top: 1px solid var(--border);
}
.chat-sessions { flex: 1; min-height: 0; overflow-y: auto; }
.chat-session { display: flex; align-items: center; gap: 4px; border-radius: var(--radius); }
.chat-session:hover { background: #F4F6F8; }
.chat-session.active { background: var(--primary-soft); }
.chat-session-main {
  flex: 1;
  min-width: 0;
  padding: 8px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-session-main:hover { color: var(--text); }
.chat-session.active .chat-session-main { color: var(--primary); }
.chat-session-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-gen { flex-shrink: 0; font-size: 11px; line-height: 1.4; color: var(--primary); background: #fff; border-radius: 999px; padding: 1px 6px; }
.chat-session-ops {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0;
  padding-right: 4px;
}
.chat-session:hover .chat-session-ops,
.chat-session.active .chat-session-ops { opacity: 1; }
.chat-session-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0;
}
.chat-session-act svg { width: 14px; height: 14px; }
.chat-session-act:hover { color: var(--primary); background: #fff; }
.chat-session-del:hover { color: var(--danger); background: var(--danger-bg); }
.chat-session-edit { height: 28px; font-size: 13px; padding: 0 6px; }
.chat-mode { font-size: 12px; color: var(--muted); line-height: 1.5; padding: 0 8px 4px; }
.chat-main { flex: 1; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; min-width: 0; min-height: 0; }
.chat-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 40px 36px; display: flex; flex-direction: column; gap: 18px; background: var(--bg); }
.chat-welcome { margin: auto; text-align: center; max-width: 640px; background: transparent; border: 0; padding: 24px 16px; }
.chat-welcome h3 { font-size: 28px; font-weight: 600; margin: 0 0 10px; color: var(--text); letter-spacing: 0.02em; }
.chat-welcome > p { font-size: 14px; color: var(--muted); margin: 0 0 28px; line-height: 1.7; }
.msg { display: flex; flex-direction: column; max-width: min(720px, 86%); }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-atts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 6px;
  max-width: 100%;
}
.msg-file { padding-right: 10px; min-width: 148px; }
.msg-thumb { width: 56px; height: 56px; border-radius: 12px; }
.msg-ai { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; line-height: 1.7; word-break: normal; overflow-wrap: anywhere; }
.msg-user .msg-bubble {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.msg-tool-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.msg-ai .msg-bubble { background: transparent; border: 0; padding: 4px 8px 12px 4px; color: var(--text); box-shadow: none; }
.msg-ai.is-thinking .msg-bubble {
  background: transparent;
  border: 0;
  padding: 8px 2px;
  min-height: 0;
  box-shadow: none;
}
.msg-ai.is-thinking .msg-text { display: none; }
.msg-thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  padding: 2px 0;
}
.msg-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8A919C;
  animation: think-dot 1.05s ease-in-out infinite;
}
.msg-thinking span:nth-child(2) { animation-delay: 0.16s; }
.msg-thinking span:nth-child(3) { animation-delay: 0.32s; }
.msg-ai.has-think .msg-elapsed { display: none; }
.msg-ai:has(.think-panel) .msg-elapsed { display: none; }
.think-panel { display: block; width: 100%; margin: 0 0 10px; }
.think-panel > summary {
  list-style: none;
  cursor: pointer;
  width: -moz-fit-content;
  width: -webkit-fit-content;
  width: fit-content;
}
.think-panel > summary::-webkit-details-marker { display: none; }
.think-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8A919C;
  font-size: 13px;
  line-height: 1.4;
  -webkit-user-select: none;
  user-select: none;
}
.think-ico {
  width: 10px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  opacity: 0.7;
  flex-shrink: 0;
}
.think-chevron {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  margin-left: 2px;
  flex-shrink: 0;
}
.think-panel[open] .think-chevron { transform: rotate(45deg); margin-top: -2px; }
.think-body {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 6px 0 4px 5px;
  padding: 0 8px 8px 12px;
  border-left: 2px solid #E6E8EC;
  color: #8A919C;
  font-size: 13px;
  line-height: 1.7;
}
.think-queries { margin-bottom: 6px; }
.think-query { color: #8A919C; }
.think-search { margin: 6px 0 8px; display: block; width: 100%; }
.think-search-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}
.think-search-ico {
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  opacity: 0.7;
}
.think-search-ico::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 1.5px;
  background: currentColor;
  right: -4px;
  bottom: -1px;
  transform: rotate(45deg);
}
.think-links {
  display: block;
  width: 100%;
  margin: 6px 0 2px;
  padding-bottom: 2px;
}
.think-link {
  display: block;
  color: #3D4F61;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 0;
}
.think-link:hover { color: var(--primary-hover); text-decoration: none; }
.think-tool { margin-top: 4px; color: #8A919C; }
@keyframes think-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.28; }
  40% { transform: translateY(-4px); opacity: 1; }
}
.msg-text { white-space: pre-wrap; }
.msg-ai .msg-text { display: block; }
.msg-ai .msg-text.md { white-space: normal; }
.msg-ai .msg-text.md > :first-child { margin-top: 0; }
.msg-ai .msg-text.md > :last-child { margin-bottom: 0; }
.msg-ai .msg-text.md h1,
.msg-ai .msg-text.md h2,
.msg-ai .msg-text.md h3,
.msg-ai .msg-text.md h4 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  margin: 14px 0 6px;
  color: var(--text);
}
.msg-ai .msg-text.md h1 { font-size: 16px; }
.msg-ai .msg-text.md p { margin: 0 0 8px; }
.msg-ai .msg-text.md ul,
.msg-ai .msg-text.md ol { margin: 0 0 8px; padding-left: 1.25em; }
.msg-ai .msg-text.md li { margin: 2px 0; }
.msg-ai .msg-text.md li > p { margin: 0; }
.msg-ai .msg-text.md strong { font-weight: 600; }
.msg-ai .msg-text.md a { color: var(--primary); }
.msg-ai .msg-text.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 0 4px;
  border-radius: 2px;
}
.msg-ai .msg-text.md pre {
  margin: 0 0 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
.msg-ai .msg-text.md pre code { background: none; padding: 0; }
.msg-ai .msg-text.md blockquote {
  margin: 0 0 8px;
  padding-left: 10px;
  border-left: 2px solid var(--border-strong);
  color: var(--muted-dark);
}
.msg-ai .msg-text.md table { width: 100%; border-collapse: collapse; margin: 0 0 8px; font-size: 13px; }
.msg-ai .msg-text.md th,
.msg-ai .msg-text.md td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.msg-ai .msg-text.md th { background: #F4F6F8; font-weight: 500; color: var(--muted-dark); }
.msg-meta { margin-top: 4px; font-size: 12px; }
.msg-elapsed { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.reply-title { font-weight: 600; margin-bottom: 2px; }
.reply-meta, .reply-line, .reply-note { margin: 6px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted-dark); }
.reply-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.reply-table th, .reply-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.reply-table th { background: #F4F6F8; color: var(--muted-dark); font-weight: 500; }
.reply-table tr:last-child td { border-bottom: 0; }
.typing { color: var(--muted); }
.typing .dots i { animation: blink 1.2s infinite; font-style: normal; }
.typing .dots i:nth-child(2) { animation-delay: 0.2s; }
.typing .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
.chat-input { padding: 8px 40px 20px; background: var(--bg); flex-shrink: 0; display: flex; flex-direction: column; overflow: visible; }
.chat-composer {
  position: relative;
  background: #fff;
  border: 1px solid #E7E9ED;
  border-radius: 20px;
  padding: 8px 12px 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.chat-mention {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 8px);
  background: #fff;
  border: 1px solid #E7E9ED;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 9;
  max-height: 240px;
  overflow-y: auto;
}
.chat-mention[hidden] { display: none; }
.chat-mention-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.chat-mention-item:hover,
.chat-mention-item[aria-selected="true"] { background: var(--primary-soft); }
.chat-mention-title { font-size: 14px; font-weight: 600; color: var(--text); }
.chat-mention-hint { font-size: 12px; color: var(--muted); }
.chat-mention-empty { padding: 8px 10px; font-size: 13px; color: var(--muted); }
.chat-composer:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.chat-composer-row { display: flex; align-items: flex-end; gap: 10px; }
.chat-composer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  margin: 8px 0 0;
  padding: 0 4px 0 10px;
  border-radius: 999px;
  background: #EEF3F8;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}
.chat-tool-chip[hidden] { display: none; }
.chat-tool-chip button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
}
.chat-tool-chip button:hover { background: rgba(74, 111, 165, 0.12); }
.chat-input textarea {
  flex: 1;
  width: auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 10px 0;
  font-size: 14.5px;
  line-height: 1.6;
  resize: none;
  font-family: inherit;
  min-height: 44px;
  max-height: 160px;
  background: transparent;
  box-shadow: none;
  color: var(--text);
}
.chat-input textarea::placeholder { color: #8A919C; }
.chat-input textarea:focus { outline: none; border: 0; box-shadow: none; }
.chat-input-ops { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.chat-input-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.chat-attach {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.chat-attach svg { width: 24px; height: 24px; }
.chat-attach:hover { background: #EEF0F3; }
.chat-attach:disabled,
.chat-attach[aria-busy="true"] { opacity: .45; cursor: not-allowed; }
.chat-attach::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  width: max-content;
  max-width: 280px;
  padding: 8px 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
  z-index: 8;
}
.chat-attach:hover::after,
.chat-attach:focus-visible::after { opacity: 1; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 4px 8px;
}
.chat-kb {
  font-size: 12px;
  color: #5A616B;
  width: fit-content;
  margin: 0;
  padding: 0;
  background: none;
}
.modal.user-modal {
  width: 640px;
  max-height: calc(100vh - 48px);
}
.user-modal .modal-body {
  max-height: none;
  overflow: visible;
  padding: 20px 20px 8px;
}
.user-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.user-form-grid .field { margin-bottom: 0; }
.user-form-grid .span-2 { grid-column: 1 / -1; }
.user-form-grid .muted.small { margin: 8px 0 0; }
.user-perm-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.user-perm-row .checkbox {
  margin: 0;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #F7F9FB;
}
@media (max-width: 720px) {
  .user-form-grid,
  .user-perm-row { grid-template-columns: 1fr; }
}
.chat-send {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin: 0 0 2px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.chat-send[hidden] { display: none; }
.chat-send svg { width: 16px; height: 16px; }
.chat-send:hover { background: var(--primary-hover); }
.chat-stop { background: #fff; color: var(--text); border: 1px solid var(--border-strong); }
.chat-stop:hover { background: var(--primary-soft); }
.chat-atts { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.chat-atts:empty { display: none; }
.glm-files { display: flex; flex-wrap: wrap; gap: 8px; }
.glm-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  max-width: 280px;
  padding: 10px 28px 10px 10px;
  border-radius: 12px;
  background: #F3F4F6;
}
.glm-file-meta { min-width: 0; }
.glm-file-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: #1F2329;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.glm-file-sub { display: block; margin-top: 2px; font-size: 12px; color: #8A919C; }
.glm-badge {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: rgba(255, 255, 255, .55);
}
.glm-badge.pdf { background: #F24822; }
.glm-badge.docx { background: #2B579A; }
.glm-badge.image { background: #3D7EFF; }
.glm-badge.file { background: #6B7280; }
.glm-badge svg { width: 22px; height: 22px; }
.glm-file > img { width: 36px; height: 36px; flex-shrink: 0; border-radius: 8px; object-fit: cover; }
.glm-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  background: #F3F4F6;
  flex-shrink: 0;
}
.glm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.glm-thumb .glm-file-x {
  top: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: #5A616B;
}
.glm-thumb .glm-file-x:hover { background: #fff; color: #1F2329; }
.glm-file-x {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: #9AA1AB;
  cursor: pointer;
}
.glm-file-x svg { width: 12px; height: 12px; }
.glm-file-x:hover { background: #E5E7EB; color: #1F2329; }
.glm-asks { display: flex; flex-wrap: wrap; gap: 8px; }
.glm-asks button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #E6E8EC;
  border-radius: 8px;
  background: #fff;
  color: #1F2329;
  font-size: 13px;
  cursor: pointer;
}
.glm-asks button span { color: #8A919C; }
.glm-asks button:hover { background: #F7F8FA; }
.tool-list, .artifact-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.tool-card, .artifact-card { display: flex; justify-content: space-between; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; font-size: 12px; background: #fff; color: inherit; text-decoration: none; }
.withdraw-btn { margin-top: 4px; }
.msg-user { align-items: flex-end; }
.msg-sources { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; line-height: 1.5; }
.src-title { font-weight: 500; color: var(--muted-dark); margin-bottom: 4px; }
.src-item { padding: 2px 0; color: var(--text); }
.src-idx { display: inline-block; min-width: 22px; color: var(--primary); font-weight: 500; }
.msg-src-note { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--muted); }
@media (max-width: 860px) {
  body.page-chat,
  body.page-chat .app,
  body.page-chat .main { height: auto; overflow: visible; }
  .chat-page { flex-direction: column; height: auto; overflow: visible; }
  .chat-side { width: 100%; max-height: 240px; border-right: 0; border-bottom: 1px solid var(--border); }
  .chat-msgs { padding: 20px 20px 28px; }
  .chat-input { padding: 8px 20px 16px; }
}

.chart-block { margin-bottom: 20px; }
/* 固定高度容器：canvas 靠它撑开，否则 maintainAspectRatio:false 会塌成 0 高 */
.chart-canvas-wrap { position: relative; height: 260px; width: 100%; }
.chart-table-wrap { max-height: 220px; overflow-y: auto; }

/* ---------- 实验对比分析：选择页 ---------- */
.pick-table tbody tr:hover { background: var(--primary-soft); }
.pick-table input[type="checkbox"] { cursor: pointer; }
.pick-action {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px;
  border-top: 1px solid var(--border); background: var(--bg);
}
.pick-hint.warn { color: var(--warning-text); }

/* ---------- 实验对比分析：详情页 ---------- */
.an-exps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.an-exp {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px; min-width: 210px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; color: inherit; text-decoration: none;
}
.an-exp:hover { border-color: var(--primary); background: var(--primary-soft); }
.an-exp-no { font-size: 12px; color: var(--primary); }
.an-exp-title { font-size: 14px; font-weight: 500; }
.an-exp-meta { font-size: 12px; }

.an-warnings { margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; }
.an-warn {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; line-height: 1.6; color: var(--muted-dark);
  padding: 7px 10px; border-radius: var(--radius); background: var(--info-bg);
}
.an-warn.warn { background: var(--warning-bg); color: var(--warning-text); }
.an-warn-dot {
  flex: none; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%;
  background: currentColor; opacity: .6;
}

.an-metrics { margin-top: 14px; }
.an-metrics summary {
  cursor: pointer; font-size: 13px; font-weight: 500;
  padding: 6px 0; color: var(--muted-dark);
}
.an-metric-table td, .an-metric-table th { vertical-align: top; }

.an-chat { margin-top: 16px; }
.an-msgs {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px; max-height: 560px; overflow-y: auto; background: var(--bg);
}
.an-msg { display: flex; flex-direction: column; max-width: min(780px, 92%); }
.an-user { align-self: flex-end; align-items: flex-end; }
.an-ai { align-self: flex-start; align-items: flex-start; }
.an-bubble {
  padding: 10px 12px; border-radius: var(--radius);
  font-size: 14px; line-height: 1.7; overflow-wrap: anywhere;
}
.an-user .an-bubble { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.an-ai .an-bubble { background: #fff; border: 1px solid var(--border); }
.an-mode {
  display: inline-block; margin-bottom: 6px;
  font-size: 11px; padding: 0 6px; height: 18px; line-height: 18px;
  border-radius: 2px; background: var(--primary-soft); color: var(--primary);
}
.an-mode.local, .an-mode.fallback { background: var(--warning-bg); color: var(--warning-text); }
.an-text.md > *:first-child { margin-top: 0; }
.an-text.md > *:last-child { margin-bottom: 0; }
.an-text.md table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.an-text.md th, .an-text.md td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; }
.an-text.md th { background: var(--bg); }
.an-text.md h2 { font-size: 15px; margin: 14px 0 6px; }
.an-text.md h3 { font-size: 14px; margin: 12px 0 6px; }
.an-text.md ul, .an-text.md ol { padding-left: 20px; }
.an-error { color: var(--danger); }

.an-dots { display: inline-flex; gap: 4px; }
.an-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: an-blink 1.1s infinite ease-in-out;
}
.an-dots i:nth-child(2) { animation-delay: .18s; }
.an-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes an-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.an-start {
  padding: 20px 16px; text-align: center;
  border-bottom: 1px solid var(--border); background: #fff;
}
.an-start p { margin: 0 0 12px; font-size: 14px; color: var(--muted-dark); }

.an-composer { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end; }
.an-input { flex: 1; resize: none; min-height: 44px; max-height: 160px; line-height: 1.6; }
.an-hint { padding: 0 16px 12px; }

@media (max-width: 720px) {
  .an-msg { max-width: 100%; }
  .pick-action { flex-direction: column; align-items: stretch; }
}


/* ---------- 角色权限矩阵 ---------- */
.perm-wrap { overflow: visible; }
.perm-matrix th { vertical-align: top; white-space: normal; position: relative; overflow: visible; }
.perm-matrix .perm-cell { text-align: center; white-space: nowrap; }
.perm-label { font-weight: 700; }
.perm-tip {
  display: none;
  position: absolute;
  left: 8px;
  top: calc(100% - 4px);
  z-index: 30;
  width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.perm-matrix th:hover .perm-tip { display: block; }
.perm-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; padding: 2px 6px; border-radius: 2px;
}
.perm-toggle:hover { background: var(--primary-soft); }
.perm-toggle input { cursor: pointer; }
.prewrap { white-space: pre-wrap; word-break: break-word; font-family: inherit; margin: 0; }
.steps-table td { vertical-align: middle; }

/* ---------- 弹窗 ---------- */
.modal-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(36, 49, 64, 0.45); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: #fff; border-radius: var(--radius); width: 440px; max-width: 92vw; box-shadow: 0 8px 24px rgba(36, 49, 64, 0.16); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; flex: 1; min-width: 0; font-size: 15px; font-weight: 600; }
.modal-head .mono:empty { display: none; }
.modal-body { padding: 12px 16px; max-height: 360px; overflow-y: auto; }
.nav-check-list { display: flex; flex-direction: column; gap: 8px; }
.nav-check-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.nav-check-item:hover { background: #F7F9FB; }
.nav-check-name { font-size: 14px; }
.nav-actions { display: flex; gap: 8px; padding: 0 16px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.modal-foot[hidden] { display: none; }
.confirm-modal { width: 420px; }
.confirm-modal .modal-body p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--text); }
.confirm-modal .confirm-input { margin-top: 12px; }
.confirm-modal .btn-danger {
  background: var(--err);
  border-color: var(--err);
  color: var(--on-secondary);
}
.confirm-modal .btn-danger:hover { background: #9E3828; border-color: transparent; color: var(--on-secondary); }
.modal.price-preview-modal { width: 880px; }
.price-preview-modal .modal-body { max-height: 70vh; }
.price-preview-id .name { font-size: 15px; font-weight: 600; }
.price-preview-price { margin-top: 4px; font-variant-numeric: tabular-nums; }
.wb-metrics.price-preview-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 12px 0; }
.price-preview-metrics .wb-metric { cursor: default; }
.price-preview-metrics .wb-metric:hover { border-color: var(--border); }
.price-preview-modal .modal-foot { align-items: center; }
.price-preview-ops { display: flex; gap: 8px; align-items: center; }
.price-preview-modal .table th:nth-child(n+3),
.price-preview-modal .table td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .wb-metrics.price-preview-metrics { grid-template-columns: 1fr; }
}

/* ---------- 问答导入配方 ---------- */
.chat-export-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}
.chat-export-opt:last-of-type { margin-bottom: 0; }
.chat-export-opt:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.chat-export-ico {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.45);
}
.chat-export-ico svg { width: 20px; height: 20px; }
.chat-export-ico.md { background: var(--primary); }
.chat-export-ico.docx { background: #2B579A; }
.chat-export-ico.pdf { background: #F24822; }
.chat-export-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-export-copy strong { font-size: 14px; font-weight: 600; }
.chat-export-copy em { font-style: normal; font-size: 12px; color: var(--muted); }
.formula-import { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font-size: 12px; }
.formula-import-text { flex: 1; min-width: 140px; color: var(--muted-dark); }
.formula-import-done { width: 100%; color: var(--success-text); }
.formula-import-done a { color: inherit; }
.formula-modal { width: 760px; }
.formula-modal .modal-body { max-height: 64vh; }
.fi-cands { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.fi-cands .nav-check-item { font-size: 13px; }
.fi-match { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fi-match .select { width: 200px; height: 28px; font-size: 12px; }
.fi-reason { margin: 8px 0 0; white-space: pre-wrap; }
.fi-success { font-size: 14px; line-height: 1.8; }

/* ---------- 仪表盘 ---------- */
.wb-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.wb-metric {
  display: block;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  color: inherit;
  min-width: 0;
}
.wb-metric:hover { border-color: var(--primary); color: inherit; }
.wb-metric .k { font-size: 13px; color: var(--muted); }
.wb-metric .v { margin-top: 6px; font-size: 26px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.wb-metric .v.is-empty { color: var(--muted); font-weight: 500; }
.wb-metric .sub { margin-top: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workbench .wb-metric .sub { white-space: normal; overflow: visible; text-overflow: unset; }
.wb-metric.warn { box-shadow: inset 0 2px 0 var(--warning); }
.wb-metric.warn .v { color: var(--warning-text); }
.wb-metric.live { box-shadow: inset 0 2px 0 var(--primary); }
.wb-metric.bad { box-shadow: inset 0 2px 0 var(--danger); }
.wb-metric.bad .v { color: var(--danger); }
.wb-metric.on { border-color: var(--primary); background: var(--primary-soft); }
button.wb-metric { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.wb-metrics.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wb-metrics.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dash-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.dash-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-grid.cols-4 .dash-span-3 { grid-column: span 2; }
.dash-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid.cols-3 .dash-span-3 { grid-column: span 2; }
.dash-grid.cols-3 .dash-span-2 { grid-column: span 1; }
.dash-grid .panel {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dash-grid .panel-body { flex: 1; }
.dash-span-3 { grid-column: span 3; }
.dash-span-2 { grid-column: span 2; }
.dash-span-all { grid-column: 1 / -1; }
.dash-chart-wrap { position: relative; height: 220px; width: 100%; }
.dash-donut { max-width: 320px; margin: 0 auto; }
.workbench .dash-chart-wrap { height: 320px; }
.workbench .dash-donut { max-width: 380px; }
.exp-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; width: 100%; min-width: 0; }
.exp-filters .keyword { flex: 1 1 200px; min-width: 180px; width: auto; }
.exp-filters .status { flex: 0 0 120px; width: 120px; }
.exp-filters .input-date { flex: 0 0 148px; width: 148px; }
.exp-filters .date-label { color: var(--muted); font-size: 13px; }
.exp-count { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.filter-bar .keyword { flex: 1 1 180px; min-width: 160px; width: auto; }
.filter-bar .pick { flex: 0 0 140px; width: 140px; }
.audit-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.audit-filter .pick { flex: 0 0 160px; width: 160px; }
.cell-ellipsis { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-cat { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.kb-cat:last-child { border-bottom: none; }
.kb-cat:hover { color: var(--primary); }
.kb-cat.on { color: var(--primary); font-weight: 500; }
.kb-cat .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.wb-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.wb-layout.side-wide { grid-template-columns: minmax(0, 1fr) 340px; }
.wb-layout.wb-layout-single { grid-template-columns: 1fr; }
.admin-board {
  display: grid;
  /* 4 列：指标卡正好铺满一行，管理入口(3)+说明(1) 铺满下一行 */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.admin-board .panel { margin-bottom: 0; }
.admin-main { grid-column: span 3; }
.admin-note { grid-column: span 1; }
.kb-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.kb-board .panel { margin-bottom: 0; }
.kb-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}
.kb-main { min-width: 0; }
.kb-main .table { min-width: 720px; }
.kb-main .table .input-xs { min-width: 120px; }
.kb-inline-alert { margin: 12px 16px 0; }
.modal.kb-search-modal { width: 560px; }
.kb-search-modal .modal-body { max-height: 70vh; }
.kb-search-hint { margin: 0 0 10px; }
.kb-search-modal #searchQ { width: 100%; }
.kb-search-tools { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.kb-search-tools .select { width: 160px; flex: 0 0 160px; }
.kb-search-tools .btn { margin-left: auto; }
.kb-search-result { margin-top: 12px; }
.kb-search-result:empty { display: none; }
.modal.kb-cat-modal { width: 480px; }
.kb-cat-modal .modal-body { max-height: 50vh; padding-top: 8px; padding-bottom: 8px; }
.kb-cat-modal .cat-row:last-child { border-bottom: none; }
.kb-cat-add { justify-content: flex-start; align-items: center; gap: 8px; }
.kb-cat-add .input { flex: 1; min-width: 0; }
.cat-color {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  flex: 0 0 32px;
}
.cat-color::-webkit-color-swatch-wrapper { padding: 0; }
.cat-color::-webkit-color-swatch { border: none; border-radius: 2px; }
.cat-color::-moz-color-swatch { border: none; border-radius: 2px; }
.modal.kb-upload-modal { width: 720px; }
.kb-upload-modal .modal-body { max-height: 70vh; }
.kb-upload-drop { margin-bottom: 0; padding: 28px 16px; }
.kb-upload-drop.is-over { border-color: var(--primary); background: var(--primary-soft); }
.kb-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
  font-size: 13px;
  color: var(--muted);
}
.kb-file-head[hidden] { display: none; }
.kb-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.kb-file-list:empty { display: none; }
.kb-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.kb-file-item:last-child { border-bottom: none; }
.kb-file-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-all;
}
.kb-file-size { flex: 0 0 auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.kb-upload-meta { margin-top: 16px; }
.kb-upload-meta .field { margin-bottom: 12px; }
.kb-cat-hint { margin: 6px 0 0; }
.upload-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 18px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
}
.upload-drop:hover { border-color: var(--primary); background: var(--primary-soft); }
.upload-drop input[type="file"] { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-k { font-size: 14px; color: var(--text); }
.upload-names { font-size: 12px; color: var(--primary); word-break: break-all; }
.wb-side .panel-body { padding-top: 4px; padding-bottom: 4px; }
.wb-item {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
}
.wb-item:last-child { border-bottom: none; }
.wb-item:hover { color: inherit; }
.wb-item-title { font-size: 14px; color: var(--text); }
.wb-item:hover .wb-item-title { color: var(--primary); }
.wb-item-meta { margin-top: 2px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.wb-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
}
.wb-link:last-child { border-bottom: none; }
.wb-link:hover { color: var(--primary); }
.wb-link span { color: var(--muted); font-size: 12px; }
.admin-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
}
.admin-status:last-child { border-bottom: none; }
.admin-status:hover { color: var(--primary); }
/* ---------- 个人信息 ---------- */
.account-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
}
.account-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.account-id-name { font-size: 18px; font-weight: 600; line-height: 1.3; }
.account-id-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.account-hero-stats { display: flex; gap: 28px; margin: 0; flex-shrink: 0; }
.account-hero-stats > div { min-width: 88px; }
.account-hero-stats dt { font-size: 12px; color: var(--muted); font-weight: 400; }
.account-hero-stats dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; }
.account-pane { max-width: 520px; }
.user-detail-hero .account-hero-stats dd { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
body.page-user-detail { height: 100vh; height: 100dvh; overflow: hidden; }
body.page-user-detail .app,
body.page-user-detail .main { height: 100vh; height: 100dvh; overflow: hidden; }
body.page-user-detail .content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.user-detail-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.user-detail-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
.user-detail-split > .panel {
  margin-bottom: 0;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.user-session-scroll,
.user-thread { flex: 1; min-height: 0; overflow: auto; }
.user-session {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.user-session:hover { background: var(--bg); }
.user-session.on { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.user-session-title { display: block; font-weight: 500; line-height: 1.4; }
.user-thread { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 18px; }
.user-turn-meta { margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.user-turn.is-user .user-turn-text {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  line-height: 1.6;
}
.user-turn.is-ai { padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.user-turn.is-ai:last-child { border-bottom: 0; }
@media (max-width: 1000px) {
  body.page-user-detail,
  body.page-user-detail .app,
  body.page-user-detail .main { height: auto; overflow: visible; }
  body.page-user-detail .content { display: block; overflow: visible; }
  .user-detail-split { grid-template-columns: 1fr; }
  .user-detail-split > .panel { height: auto; }
  .user-session-scroll { flex: none; max-height: 280px; }
}
.account-facts {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px 16px;
  margin: 0 0 8px;
}
.account-facts dt { color: var(--muted); font-weight: 400; }
.account-facts dd { margin: 0; word-break: break-word; }
@media (max-width: 760px) {
  .account-hero { flex-direction: column; align-items: flex-start; }
  .account-hero-stats { width: 100%; gap: 16px; flex-wrap: wrap; }
}

@media (max-width: 1100px) {
  .wb-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wb-metrics.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wb-metrics.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .wb-layout, .wb-layout.side-wide { grid-template-columns: 1fr; }
  .admin-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-main, .admin-note { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .wb-metrics.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wb-metrics.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kb-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid,
  .dash-grid.cols-5,
  .dash-grid.cols-4,
  .dash-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-span-3,
  .dash-span-2,
  .dash-grid.cols-4 .dash-span-3,
  .dash-grid.cols-3 .dash-span-3,
  .dash-grid.cols-3 .dash-span-2 { grid-column: 1 / -1; }
}
/* ---------- 新建 / 编辑实验 ---------- */
.exp-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 16px;
}
.exp-form-grid .span-2 { grid-column: span 2; }
.exp-form-grid .field-full { grid-column: 1 / -1; }
.exp-form-split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr);
  gap: 12px;
  align-items: stretch;
}
.exp-form-split .panel { margin-bottom: 0; display: flex; flex-direction: column; min-width: 0; }
.exp-form-split .panel-body,
.exp-form-split .table-wrap { flex: 1; }
.exp-form-hint {
  margin: 0;
  padding: 10px 16px 14px;
  font-size: 13px;
}
.exp-form-hint[hidden] { display: none; }
.exp-conclusion .panel-body { display: flex; flex-direction: column; }
.exp-conclusion .field { margin-bottom: 0; flex: 1; display: flex; }
.exp-conclusion textarea { flex: 1; min-height: 140px; resize: vertical; }
.exp-form-actions { justify-content: flex-end; }
.exp-form .panel .table-wrap { overflow-x: auto; }
@media (max-width: 1100px) {
  .exp-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exp-form-split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .exp-form-grid { grid-template-columns: 1fr; }
  .exp-form-grid .span-2,
  .exp-form-grid .field-full { grid-column: auto; }
}

.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  color: var(--text);
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.cat-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cat-name { flex: 1; }
.search-result-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.search-result-item .src-file { font-weight: 500; color: var(--primary); font-size: 13px; }
.search-result-item .src-text { font-size: 13px; color: var(--text); margin-top: 4px; line-height: 1.6; }

.env-badge.badge-warn { background: var(--warning-bg); color: var(--warning-text); }
.superlogin-banner {
  background: var(--warning-bg);
  border-bottom: 1px solid var(--warning-mark);
  color: var(--warning-text);
  padding: 8px 20px;
  font-size: 13px;
  line-height: 1.6;
}
.superlogin-banner b { color: var(--warning-text); }

@media (min-width: 900px) and (max-width: 1199px) {
  .sidebar { width: 64px; overflow: hidden; z-index: 60; }
  .sidebar:hover,
  .sidebar:focus-within { width: var(--sidebar-w); overflow: visible; box-shadow: var(--shadow); }
  .sidebar:not(:hover):not(:focus-within) .brand {
    align-items: center;
    justify-content: center;
    height: 64px;
    padding: 0;
  }
  .sidebar:not(:hover):not(:focus-within) .brand::before {
    content: "";
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 1.5px rgba(42, 34, 28, 0.45);
  }
  .sidebar:not(:hover):not(:focus-within) .brand-mark,
  .sidebar:not(:hover):not(:focus-within) .brand-text,
  .sidebar:not(:hover):not(:focus-within) .site-legal { display: none; }
  .sidebar:not(:hover):not(:focus-within) .nav-item {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
    color: transparent;
    font-size: 0;
  }
  .sidebar:not(:hover):not(:focus-within) .nav-ico { color: var(--text-2); }
  .sidebar:not(:hover):not(:focus-within) .nav-item.active .nav-ico { color: var(--on-primary); }
}
@media (max-width: 899px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar .menu-toggle { display: inline-flex; }
}
@media (max-width: 599px) {
  .content { padding: 16px 16px 48px; }
  .topbar { padding: 0 16px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-actions,
  .form-actions { flex-direction: column; align-items: stretch; }
  .page-actions .btn,
  .form-actions .btn { width: 100%; }
}

/* ---------- 知识页 / 引用可追溯（第五轮） ---------- */
.kb-points { margin: 0 0 4px; padding-left: 20px; line-height: 1.7; }
.kb-points li { margin-bottom: 2px; }
.kb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-chunk {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
  scroll-margin-top: 72px;
}
.kb-chunk:last-child { margin-bottom: 0; }
.kb-chunk-focus { border-color: var(--primary); background: var(--primary-soft); }
.kb-chunk-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--muted-dark);
  font-size: 12px;
}
.kb-chunk-head .link { margin-left: auto; }
.kb-chunk-body { white-space: pre-wrap; word-break: break-word; line-height: 1.7; font-size: 13px; color: var(--text); }

.src-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--border-strong); }
.src-link:hover { color: var(--primary); border-bottom-color: var(--primary); }
.src-snippet {
  margin: 2px 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.src-meta { color: var(--muted); font-size: 12px; }

/* ---------- AI 用量：按用户占比条 ---------- */
.usage-meter { height: 6px; background: #EEF1F4; border-radius: 3px; overflow: hidden; margin-bottom: 2px; }
.usage-meter-fill { height: 100%; background: var(--primary); }

/* ---------- 今日待办（首页角色化） ---------- */
.todo-list { padding: 0 !important; }
.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.todo-item:last-child { border-bottom: 0; }
.todo-item:hover { background: var(--primary-soft); color: var(--primary); }
.todo-item.warn .todo-count { background: var(--warning-bg); color: var(--warning-text); }
.todo-count {
  min-width: 26px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* ============================================
   无障碍：减少动态效果（prefers-reduced-motion）
   ============================================
   系统开启「减少动态效果」时（前庭敏感、晕动症用户），
   所有动画与过渡压到几乎为零；靠动画表达状态的指示器改为静态可见，
   避免用户以为页面卡住或没在加载。

   这里用 animation-duration 而非 animation: none，
   是为了保留动画结束时的最终状态（例如 toast 淡出后仍能被正确移除），
   只把时长压到一个渲染帧以内。
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }

  /* 循环动画在此场景失去意义：停掉并保持可见 */
  .typing .dots i,
  .think-dot,
  .an-dots i {
    animation: none !important;
    opacity: 0.75;
  }

  /* 提示条与浮层不再滑入/滑出 */
  .toast,
  .toast-out {
    animation: none !important;
  }
}

/* ---------- MCP 工具接入 ---------- */
body.page-mcp { height: 100vh; height: 100dvh; overflow: hidden; }
body.page-mcp .app,
body.page-mcp .main { height: 100vh; height: 100dvh; overflow: hidden; }
body.page-mcp .content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: var(--shell-pad);
}
.mcp-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.mcp-list-panel,
.mcp-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.mcp-list-panel { margin-bottom: 0; }
.mcp-list-panel > .table-wrap { flex: 1; min-height: 0; overflow: auto; }
.mcp-stage > .panel:first-of-type { margin-bottom: 0; }
.mcp-stage > .panel + .panel { margin-top: 16px; margin-bottom: 16px; }
.mcp-head { align-items: flex-end; }
.mcp-title { margin: 0 0 4px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.mcp-lead { margin: 0; font-size: 13px; line-height: 1.5; }
.mcp-back {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-2);
}
.mcp-back::before { content: "←"; margin-right: 6px; }
.mcp-back:hover { color: var(--text); }
.mcp-blank {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 0;
  padding: 32px;
}
.mcp-blank-title { font-size: 16px; font-weight: 650; }
.mcp-blank p { margin: 0 0 8px; max-width: 420px; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.mcp-id { margin-top: 2px; font-size: 12px; font-weight: 600; }
.mcp-endpoint {
  max-width: 360px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mcp-allow { margin-left: 8px; }
.mcp-row-error { margin-top: 4px; color: var(--err); }
.mcp-ops { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; vertical-align: middle; }
.table td.col-ops { white-space: nowrap; vertical-align: middle; text-align: right; }
.mcp-ops form { display: inline-flex; margin: 0; }
.mcp-add { position: relative; display: inline-flex; }
.mcp-add-caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 8px;
  border: 4px solid transparent;
  border-top-color: currentColor;
  border-bottom: 0;
  transform: translateY(1px);
}
.mcp-add-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(36, 49, 64, 0.08);
  z-index: 40;
}
.mcp-add.open .mcp-add-panel { display: block; }
.mcp-add-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.mcp-add-item:hover { background: var(--surface-2); }
#mcpMarket[hidden],
#mcpMarket [hidden] { display: none !important; }
.mcp-market-modal { width: 560px; }
.mcp-market-modal .modal-body { max-height: 70vh; }
.mcp-market-note { margin: 0 0 12px; }
.mcp-market-search { margin-bottom: 4px; }
.mcp-market-list { margin-top: 8px; }
.mcp-market-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.mcp-market-row:last-child { border-bottom: 0; }
.mcp-market-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 14px;
  font-weight: 700;
}
.mcp-market-copy { min-width: 0; flex: 1; }
.mcp-market-name,
.mcp-market-sum { display: block; }
.mcp-market-name { font-size: 14px; font-weight: 650; }
.mcp-market-sum {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
}
.mcp-market-row form { margin: 0; }
.mcp-market-plus {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}
.mcp-market-done { flex-shrink: 0; }
.mcp-market-empty { margin: 16px 0 8px; color: var(--text-2); font-size: 13px; }
.mcp-switch-form { margin: 0; }
.mcp-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #D9D3CC;
  cursor: pointer;
  vertical-align: middle;
}
.mcp-switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(42, 34, 28, .18);
  transition: transform .15s ease;
}
.mcp-switch.is-on { background: var(--primary); }
.mcp-switch.is-on i { transform: translateX(14px); }
.mcp-switch[aria-disabled="true"] { cursor: default; opacity: .7; }
.mcp-form .field {
  display: grid;
  grid-template-columns: 112px minmax(240px, 520px);
  column-gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.mcp-form .field.is-top { align-items: start; }
.mcp-form .field.is-top .field-label { margin-top: 10px; }
.mcp-form .field-label { margin: 0; }
.mcp-field-hint { margin: 6px 0 0; }
.mcp-form textarea.input { height: auto; min-height: 88px; padding: 8px 12px; line-height: 1.6; resize: vertical; }
.mcp-seg {
  display: inline-flex;
  width: -moz-fit-content;
  width: -webkit-fit-content;
  width: fit-content;
  justify-self: start;
  height: 40px;
  padding: 3px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.mcp-seg label {
  position: relative;
  display: flex;
  align-items: stretch;
  padding: 0;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.mcp-seg label span {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 8px;
}
.mcp-seg input { position: absolute; opacity: 0; pointer-events: none; }
.mcp-seg input:checked + span {
  background: #fff;
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(42, 34, 28, .08);
}
.mcp-timeout { display: flex; align-items: center; gap: 8px; }
.mcp-timeout .input { width: 140px; }
.mcp-form-actions { display: flex; gap: 8px; margin: 8px 0 0 128px; }
.mcp-error {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--err);
  font-size: 13px;
}
.mcp-tools-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mcp-tools-title { font-size: 14px; font-weight: 650; }
.mcp-tools-head p { margin: 4px 0 0; }
.mcp-tool-grid {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.mcp-tool {
  display: grid;
  grid-template-columns: 20px minmax(200px, 320px) minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  margin: 0;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  white-space: normal;
  cursor: pointer;
}
.mcp-tool:last-child { border-bottom: 0; }
.mcp-tool:hover { background: var(--surface-2); }
.mcp-tool input { margin-top: 2px; }
.mcp-tool-name {
  min-width: 0;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
}
.mcp-tool-desc {
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
@media (max-width: 720px) {
  .mcp-form .field,
  .mcp-form-actions { grid-template-columns: 1fr; margin-left: 0; }
  .mcp-form-actions { display: flex; }
  .mcp-tool { grid-template-columns: 20px minmax(0, 1fr); row-gap: 2px; }
  .mcp-tool-desc { grid-column: 2; }
}
@media (max-width: 760px) {
  .login-input, .input, .select, .textarea, .chat-input textarea { font-size: 16px; }
}
