/* MOBIUS KB — 平面风 + 钉钉蓝 */
:root {
  /* 钉钉蓝：主色 #0089FF / hover #39A3FF / active #0065D5 */
  --ink: #171a1d;
  --ink-soft: #3d474f;
  --muted: #7a8690;
  --line: #d6e8fa;
  --panel: #ffffff;
  --panel-soft: #f0f7ff;
  --accent: #0089ff;
  --accent-deep: #0065d5;
  --accent-soft: #e6f4ff;
  --glow: rgba(0, 137, 255, 0.22);
  --danger: #b42318;
  --danger-soft: #fef3f2;

  --bg: #ddebf5;
  --bg-accent: #c9dff2;
  --surface: var(--panel);
  --surface-soft: var(--panel-soft);
  --text: var(--ink);
  --text-secondary: var(--ink-soft);
  --text-tertiary: var(--muted);
  --border: var(--line);
  --border-strong: #a8cdfa;
  --brand: var(--accent);
  --brand-hover: #39a3ff;
  --brand-deep: var(--accent-deep);
  --brand-light: var(--accent-soft);
  --brand-mid: #2a9bff;
  --accent-orange: #0089ff;
  --accent-orange-soft: #e6f4ff;
  --bot-bg: #f2f8ff;
  --user-bg: #0089ff;
  --warn-bg: #eef6ff;
  --radius: 12px;
  --radius-lg: 16px;
  --side-w: 252px;
  --font: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-brand: "Outfit", "Noto Sans SC", sans-serif;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --focus-ring: 0 0 0 3px rgba(0, 137, 255, 0.22);
  --accent-hover: #0078e6;
  --accent-active: #0069cc;
  --page-spot-1: rgba(0, 137, 255, 0.18);
  --page-spot-2: rgba(57, 163, 255, 0.1);
  --page-bg-grad: linear-gradient(180deg, #d6e8f6 0%, #dcecf6 48%, #e1eef7 100%);
  --header-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 247, 255, 0.94) 100%);
  --header-line: rgba(168, 205, 250, 0.55);
  --header-slogan-color: #1c2d46;
  --nav-bg: #ffffff;
  --nav-line: #e6edf5;
  --nav-shell-line: rgba(168, 205, 250, 0.45);
  --panel-grad: linear-gradient(180deg, #ffffff 0%, #f7f9fb 70%, #f3f5f7 100%);
  --panel-edge: rgba(168, 205, 250, 0.5);
  --btn-primary-grad: linear-gradient(180deg, #39a3ff 0%, #0089ff 60%, #0065d5 100%);
  --chat-tab-grad: linear-gradient(180deg, #3dadff 0%, #0089ff 100%);
  --chat-tab-glow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 4px 14px rgba(0, 137, 255, 0.32);
  --user-bubble-grad: linear-gradient(135deg, #39a3ff 0%, #0089ff 55%, #0065d5 100%);
  --nav-text: #64748b;
  --nav-text-hover: #0f172a;
  --nav-hover-bg: #f1f5f9;
  --nav-active-bg: #eaf4ff;
  --nav-active-color: #006fd6;
  --filter-bg: rgba(255, 255, 255, 0.9);
  --bubble-bot-bg: rgba(255, 255, 255, 0.92);
  --bubble-bot-line: rgba(180, 210, 230, 0.55);
  --rail-bg: rgba(255, 255, 255, 0.55);
  --admin-sidebar-bg: #f7f8fa;
  --hover-line: rgba(0, 137, 255, 0.35);
}

/* ── 页面风格（html[data-theme]，选择存在 localStorage） ── */
html[data-theme="ding"] { color-scheme: light; }

html[data-theme="celadon"] {
  color-scheme: light;
  --ink: #14241f;
  --ink-soft: #3d5a52;
  --muted: #6b817a;
  --line: #c5ddd6;
  --panel: #ffffff;
  --panel-soft: #eef7f4;
  --accent: #0d9488;
  --accent-deep: #0f766e;
  --accent-soft: #ccfbf1;
  --glow: rgba(13, 148, 136, 0.22);
  --bg: #dceee8;
  --bg-accent: #c5e4da;
  --border-strong: #9ec9bc;
  --brand-hover: #14b8a6;
  --brand-mid: #2dd4bf;
  --accent-orange: #0d9488;
  --accent-orange-soft: #ccfbf1;
  --user-bg: #0d9488;
  --bot-bg: #f0faf7;
  --warn-bg: #ecfdf5;
  --focus-ring: 0 0 0 3px rgba(13, 148, 136, 0.22);
  --accent-hover: #0f766e;
  --accent-active: #115e59;
  --page-spot-1: rgba(13, 148, 136, 0.2);
  --page-spot-2: rgba(45, 212, 191, 0.12);
  --page-bg-grad: linear-gradient(180deg, #d4ebe4 0%, #dceee8 48%, #e4f3ee 100%);
  --header-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(238, 247, 244, 0.94) 100%);
  --header-line: rgba(158, 201, 188, 0.55);
  --header-slogan-color: #14332c;
  --nav-bg: #ffffff;
  --nav-line: #d5ebe4;
  --nav-shell-line: rgba(158, 201, 188, 0.45);
  --panel-grad: linear-gradient(180deg, #ffffff 0%, #f4faf8 70%, #eef7f4 100%);
  --panel-edge: rgba(158, 201, 188, 0.5);
  --btn-primary-grad: linear-gradient(180deg, #2dd4bf 0%, #0d9488 60%, #0f766e 100%);
  --chat-tab-grad: linear-gradient(180deg, #2dd4bf 0%, #0d9488 100%);
  --chat-tab-glow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 4px 14px rgba(13, 148, 136, 0.28);
  --user-bubble-grad: linear-gradient(135deg, #2dd4bf 0%, #0d9488 55%, #0f766e 100%);
  --nav-text: #5f746e;
  --nav-text-hover: #14241f;
  --nav-hover-bg: #eef7f4;
  --nav-active-bg: #ccfbf1;
  --nav-active-color: #0f766e;
  --filter-bg: rgba(255, 255, 255, 0.92);
  --bubble-bot-bg: rgba(255, 255, 255, 0.94);
  --bubble-bot-line: rgba(158, 201, 188, 0.55);
  --rail-bg: rgba(238, 247, 244, 0.7);
  --admin-sidebar-bg: #eef7f4;
  --hover-line: rgba(13, 148, 136, 0.35);
}

html[data-theme="sand"] {
  color-scheme: light;
  --ink: #2a2118;
  --ink-soft: #5c4a38;
  --muted: #8a7460;
  --line: #ead9c4;
  --panel: #fffdf9;
  --panel-soft: #fbf3e8;
  --accent: #c26a2d;
  --accent-deep: #9a4e1a;
  --accent-soft: #fde8d4;
  --glow: rgba(194, 106, 45, 0.22);
  --bg: #f3e6d4;
  --bg-accent: #ead7bf;
  --border-strong: #d4b896;
  --brand-hover: #d97706;
  --brand-mid: #e09a4a;
  --accent-orange: #c26a2d;
  --accent-orange-soft: #fde8d4;
  --user-bg: #c26a2d;
  --bot-bg: #fff8ef;
  --warn-bg: #fff7ed;
  --focus-ring: 0 0 0 3px rgba(194, 106, 45, 0.22);
  --accent-hover: #9a4e1a;
  --accent-active: #7c3d12;
  --page-spot-1: rgba(194, 106, 45, 0.16);
  --page-spot-2: rgba(217, 119, 6, 0.1);
  --page-bg-grad: linear-gradient(180deg, #f0dfc8 0%, #f3e6d4 48%, #f7eee0 100%);
  --header-bg: linear-gradient(180deg, rgba(255, 253, 249, 0.94) 0%, rgba(251, 243, 232, 0.94) 100%);
  --header-line: rgba(212, 184, 150, 0.55);
  --header-slogan-color: #3b2a1c;
  --nav-bg: #fffdf9;
  --nav-line: #ead9c4;
  --nav-shell-line: rgba(212, 184, 150, 0.45);
  --panel-grad: linear-gradient(180deg, #fffdf9 0%, #fbf6ee 70%, #f6eee2 100%);
  --panel-edge: rgba(212, 184, 150, 0.5);
  --btn-primary-grad: linear-gradient(180deg, #e09a4a 0%, #c26a2d 60%, #9a4e1a 100%);
  --chat-tab-grad: linear-gradient(180deg, #e09a4a 0%, #c26a2d 100%);
  --chat-tab-glow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 4px 14px rgba(194, 106, 45, 0.28);
  --user-bubble-grad: linear-gradient(135deg, #e09a4a 0%, #c26a2d 55%, #9a4e1a 100%);
  --nav-text: #8a7460;
  --nav-text-hover: #2a2118;
  --nav-hover-bg: #fbf3e8;
  --nav-active-bg: #fde8d4;
  --nav-active-color: #9a4e1a;
  --filter-bg: rgba(255, 253, 249, 0.92);
  --bubble-bot-bg: rgba(255, 253, 249, 0.94);
  --bubble-bot-line: rgba(212, 184, 150, 0.55);
  --rail-bg: rgba(251, 243, 232, 0.7);
  --admin-sidebar-bg: #fbf3e8;
  --hover-line: rgba(194, 106, 45, 0.35);
}

html[data-theme="violet"] {
  color-scheme: light;
  --ink: #1e1830;
  --ink-soft: #4a4270;
  --muted: #7a7396;
  --line: #d9d2f0;
  --panel: #ffffff;
  --panel-soft: #f4f1fc;
  --accent: #6d5ce7;
  --accent-deep: #5344c9;
  --accent-soft: #eee9ff;
  --glow: rgba(109, 92, 231, 0.22);
  --bg: #e8e4f4;
  --bg-accent: #d9d3ec;
  --border-strong: #b8aee0;
  --brand-hover: #7c6ef0;
  --brand-mid: #8b7cf5;
  --accent-orange: #6d5ce7;
  --accent-orange-soft: #eee9ff;
  --user-bg: #6d5ce7;
  --bot-bg: #f6f3ff;
  --warn-bg: #f5f3ff;
  --focus-ring: 0 0 0 3px rgba(109, 92, 231, 0.22);
  --accent-hover: #5344c9;
  --accent-active: #4338a8;
  --page-spot-1: rgba(109, 92, 231, 0.18);
  --page-spot-2: rgba(139, 124, 245, 0.12);
  --page-bg-grad: linear-gradient(180deg, #ddd8f0 0%, #e8e4f4 48%, #eeeaf8 100%);
  --header-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(244, 241, 252, 0.94) 100%);
  --header-line: rgba(184, 174, 224, 0.55);
  --header-slogan-color: #2a2150;
  --nav-bg: #ffffff;
  --nav-line: #e4def4;
  --nav-shell-line: rgba(184, 174, 224, 0.45);
  --panel-grad: linear-gradient(180deg, #ffffff 0%, #f7f5fc 70%, #f1eef9 100%);
  --panel-edge: rgba(184, 174, 224, 0.5);
  --btn-primary-grad: linear-gradient(180deg, #8b7cf5 0%, #6d5ce7 60%, #5344c9 100%);
  --chat-tab-grad: linear-gradient(180deg, #8b7cf5 0%, #6d5ce7 100%);
  --chat-tab-glow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 4px 14px rgba(109, 92, 231, 0.28);
  --user-bubble-grad: linear-gradient(135deg, #8b7cf5 0%, #6d5ce7 55%, #5344c9 100%);
  --nav-text: #7a7396;
  --nav-text-hover: #1e1830;
  --nav-hover-bg: #f4f1fc;
  --nav-active-bg: #eee9ff;
  --nav-active-color: #5344c9;
  --filter-bg: rgba(255, 255, 255, 0.92);
  --bubble-bot-bg: rgba(255, 255, 255, 0.94);
  --bubble-bot-line: rgba(184, 174, 224, 0.55);
  --rail-bg: rgba(244, 241, 252, 0.7);
  --admin-sidebar-bg: #f4f1fc;
  --hover-line: rgba(109, 92, 231, 0.35);
}

html[data-theme="night"] {
  color-scheme: dark;
  --ink: #e8eef6;
  --ink-soft: #c5d0de;
  --muted: #8b9bb0;
  --line: #2a3a4f;
  --panel: #1a2433;
  --panel-soft: #151d2a;
  --accent: #4da3ff;
  --accent-deep: #7ec0ff;
  --accent-soft: #1c3350;
  --glow: rgba(77, 163, 255, 0.28);
  --bg: #0f1724;
  --bg-accent: #152033;
  --border-strong: #3d5470;
  --brand-hover: #6bb4ff;
  --brand-mid: #4da3ff;
  --accent-orange: #4da3ff;
  --accent-orange-soft: #1c3350;
  --user-bg: #1d6fd4;
  --bot-bg: #1a2433;
  --warn-bg: #243044;
  --danger: #f87171;
  --danger-soft: #3a1d1d;
  --focus-ring: 0 0 0 3px rgba(77, 163, 255, 0.28);
  --accent-hover: #6bb4ff;
  --accent-active: #3b8ee6;
  --page-spot-1: rgba(77, 163, 255, 0.14);
  --page-spot-2: rgba(126, 192, 255, 0.08);
  --page-bg-grad: linear-gradient(180deg, #0c1320 0%, #0f1724 48%, #121b2a 100%);
  --header-bg: linear-gradient(180deg, rgba(22, 32, 48, 0.94) 0%, rgba(18, 26, 40, 0.96) 100%);
  --header-line: rgba(61, 84, 112, 0.7);
  --header-slogan-color: #e8eef6;
  --nav-bg: #1a2433;
  --nav-line: #2a3a4f;
  --nav-shell-line: rgba(61, 84, 112, 0.55);
  --panel-grad: linear-gradient(180deg, #1a2433 0%, #16202e 70%, #141c29 100%);
  --panel-edge: rgba(61, 84, 112, 0.55);
  --btn-primary-grad: linear-gradient(180deg, #6bb4ff 0%, #4da3ff 60%, #1d6fd4 100%);
  --chat-tab-grad: linear-gradient(180deg, #6bb4ff 0%, #4da3ff 100%);
  --chat-tab-glow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 4px 14px rgba(77, 163, 255, 0.28);
  --user-bubble-grad: linear-gradient(135deg, #6bb4ff 0%, #4da3ff 55%, #1d6fd4 100%);
  --nav-text: #8b9bb0;
  --nav-text-hover: #e8eef6;
  --nav-hover-bg: #243044;
  --nav-active-bg: #1c3350;
  --nav-active-color: #7ec0ff;
  --filter-bg: rgba(26, 36, 51, 0.92);
  --bubble-bot-bg: rgba(26, 36, 51, 0.94);
  --bubble-bot-line: rgba(61, 84, 112, 0.7);
  --rail-bg: rgba(21, 29, 42, 0.85);
  --admin-sidebar-bg: #151d2a;
  --hover-line: rgba(77, 163, 255, 0.4);
}

html[data-theme="night"] input,
html[data-theme="night"] select,
html[data-theme="night"] textarea,
html[data-theme="night"] .toolbar-select,
html[data-theme="night"] .admin-search {
  background: var(--panel-soft);
  color: var(--text);
  border-color: var(--line);
}
html[data-theme="night"] .side-head-more,
html[data-theme="night"] .k-item:hover,
html[data-theme="night"] .script-card:hover,
html[data-theme="night"] .browse-card:hover {
  background: var(--panel-soft);
}
html[data-theme="night"] .chat-composer textarea,
html[data-theme="night"] .chat-input-bar textarea {
  background: transparent;
}
html[data-theme="night"] .auth-gate {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, var(--page-spot-1), transparent 60%),
    var(--page-bg-grad);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  margin: 0;
  padding: 0;
  /* 禁止双击缩放；配合 viewport user-scalable=no */
  touch-action: manipulation;
  -ms-touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 360px at 14% -8%, var(--page-spot-1), transparent 58%),
    radial-gradient(720px 340px at 96% 6%, var(--page-spot-2), transparent 52%),
    var(--page-bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
@media (min-width: 1025px) {
  html, body { height: 100%; overflow: hidden; }
  body { height: 100vh; height: 100dvh; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fade-up 0.35s ease-out both; }

/* ── Header（平面淡蓝顶栏） ── */
.header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-line);
  box-shadow: none;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 16px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
}
.header-brand {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.header-logo {
  position: relative;
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  flex-shrink: 0;
}
.header-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
}
.header-logo:hover { opacity: 0.92; transform: translateY(-0.5px); }
.header-logo .badge-dot {
  position: absolute;
  top: -1px;
  right: -1px;
  margin: 0;
}
.header-brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 1px;
}
.header-slogan {
  margin: 0;
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--header-slogan-color);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-title {
  margin: 0;
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
  padding: 0;
  border: none;
  line-height: 1.4;
}
.header-version {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  opacity: inherit;
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}
.header-updated {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  opacity: 0.85;
  margin-left: 6px;
  white-space: nowrap;
}
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 0;
}
.theme-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  line-height: 0;
  box-shadow: none;
  transition: transform 0.15s var(--ease);
}
.theme-chip:hover {
  background: transparent;
  transform: scale(1.12);
}
.theme-chip.is-active {
  background: transparent;
  box-shadow: none;
}
.theme-chip-label { display: none; }
.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--chip-swatch, var(--accent));
  box-shadow: none;
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.theme-chip.is-active .theme-dot {
  box-shadow: 0 0 0 1.5px var(--chip-swatch, var(--accent));
}
.theme-chip[data-theme="ding"] { --chip-swatch: #0089ff; }
.theme-chip[data-theme="celadon"] { --chip-swatch: #0d9488; }
.theme-chip[data-theme="sand"] { --chip-swatch: #c26a2d; }
.theme-chip[data-theme="violet"] { --chip-swatch: #6d5ce7; }
.theme-chip[data-theme="night"] { --chip-swatch: #1a2433; }
.theme-chip[data-theme="night"] .theme-dot {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.theme-chip[data-theme="night"].is-active .theme-dot {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 0 1.5px #7ec0ff;
}
.btn-contribute {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  background: var(--btn-primary-grad);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: filter 0.15s var(--ease);
}
.btn-contribute:hover { filter: brightness(1.05); transform: none; }
.btn.btn-contribute,
.btn.btn-contribute:hover,
.btn.btn-contribute:active,
.btn.btn-contribute:focus,
.btn.btn-contribute:focus-visible {
  border: none;
  outline: none;
  box-shadow: none;
  background: var(--btn-primary-grad);
  color: #fff;
  -webkit-appearance: none;
  appearance: none;
}
.btn.btn-contribute:hover { filter: brightness(1.05); }
.btn-contribute-sub { font-size: 12px; opacity: 0.9; font-weight: 400; }
.btn-feedback {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent-deep);
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s var(--ease);
}
.btn-feedback:hover { background: var(--accent-soft); }
.btn-member {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-width: 72px;
  max-width: 140px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent-deep);
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s var(--ease);
}
.btn-member:hover { background: var(--accent-soft); }
.btn-member.is-logged-in {
  background: var(--accent-soft);
  border-color: rgba(42, 63, 95, 0.25);
}

/* 全站登录门禁 */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(42, 63, 95, 0.12), transparent 60%),
    linear-gradient(160deg, #f4f6f9 0%, #e8edf4 45%, #f7f8fb 100%);
}
.auth-gate[hidden] { display: none !important; }
.auth-gate-card {
  width: min(400px, 100%);
  padding: 28px 24px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(24, 39, 75, 0.12);
}
.auth-gate-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.auth-gate-logo {
  border-radius: 12px;
  flex-shrink: 0;
}
.auth-gate-title {
  font-family: Outfit, "Noto Sans SC", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.auth-gate-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}
.auth-gate-notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}
.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-gate-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.auth-gate-label input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
}
.auth-gate-label input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-gate-error {
  margin: 0;
  font-size: 13px;
  color: #b42318;
}
.auth-gate-submit {
  width: 100%;
  height: 42px;
  margin-top: 4px;
}
.auth-gate-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
.auth-gate-admin-link {
  margin-top: 8px;
  border: 0;
  background: none;
  color: var(--accent-deep);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
body.auth-locked {
  overflow: hidden;
}
.tag-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #067647;
  background: #ecfdf3;
}
.tag-off {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #b42318;
  background: #fef3f2;
}
.btn-admin { position: relative; }
.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff6b5a;
  box-shadow: 0 0 0 2px #fff;
  vertical-align: top;
  margin-left: 2px;
}
.badge-dot[hidden] { display: none !important; }
.btn-admin .badge-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  margin: 0;
}
.admin-nav-badge {
  margin-left: 6px;
  vertical-align: middle;
}

/* ── 布局：顶栏通栏 + 主区 + 右侧 ── */
.page-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-w);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  min-height: 0;
  align-items: stretch;
  padding: 12px 12px 0;
  overflow: hidden;
}
.page-layout > .nav-tabs {
  grid-column: 1 / -1;
  grid-row: 1;
  border: 1px solid var(--nav-shell-line);
  border-bottom: 1px solid var(--nav-line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.page-layout > .center-panel {
  grid-column: 1;
  grid-row: 2;
  max-width: 100%;
  min-height: 0;
}
.page-layout > .side-right {
  grid-column: 2;
  grid-row: 2;
  width: var(--side-w);
  max-width: var(--side-w);
  min-height: 0;
}

.side-panel {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: none;
  min-height: 0;
  height: 100%;
}
.side-left { display: none; }
.side-right {
  background: var(--panel-grad);
  border-left: 1px solid var(--header-line);
  border-top: none;
  border-radius: 0;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.side-head {
  padding: 14px 16px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-deep);
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  flex-shrink: 0;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.side-head-more {
  border: 1px solid var(--line);
  background: #fff;
  padding: 3px 8px;
  margin: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0;
  white-space: nowrap;
  transition: background 0.15s var(--ease);
}
.side-head-more:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.side-head-meta {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.78;
  flex-shrink: 0;
}
.side-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(0, 137, 255, 0.16);
  line-height: 1.2;
}
.side-subhead-more {
  border: none;
  background: transparent;
  color: var(--brand-hover);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  opacity: 0.9;
}
.side-subhead-more:hover { text-decoration: underline; opacity: 1; }
.side-subhead-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0;
  flex-shrink: 0;
}
.side-body-unified {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.side-right-fixed {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.side-right-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  margin-top: 4px;
}
.side-section {
  padding: 0;
}
.side-section + .side-section {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.side-hot-head {
  margin-top: 0;
}
.side-body-unified .side-subhead {
  margin: 0 0 10px;
  padding: 0 0 8px;
}
.side-right .side-body {
  padding: 12px 14px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.frequent-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
}
.frequent-link-list li + li { margin-top: 0; }
.side-right .home-hot {
  margin-bottom: 0;
}
.side-right .home-hot-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
.home-hot {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 4px;
}
.home-hot-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.home-hot-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin: 0 0 2px;
  letter-spacing: 0.08em;
  text-transform: none;
  line-height: 1.3;
}
.home-hot-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.home-hot-list li + li { margin-top: 0; }
.home-hot-item {
  width: 100%;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 3px 0;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  min-height: 26px;
}
.home-hot-item.has-biz {
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
}
.home-hot-item:hover {
  background: transparent;
  color: var(--accent);
}
.home-hot-item:hover .home-hot-name { color: var(--accent); }
.home-hot-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.home-hot-rank.hot-rank-1 { color: #0089ff; }
.home-hot-rank.hot-rank-2 { color: #39a3ff; }
.home-hot-rank.hot-rank-3 { color: #6baef0; }
.home-hot-name {
  font-size: 12.5px;
  font-weight: 450;
  line-height: 1.35;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.home-hot-biz.k-tag {
  font-size: 10px;
  padding: 1px 5px;
  max-width: 4.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.home-hot-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.link-group-frequent > .cat-title {
  color: var(--brand-deep);
}
.home-hot-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 4px 2px 2px;
}
.side-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px;
  min-height: 0;
}

/* 一级分类 + 二级列表 */
.cat-block { margin-bottom: 10px; }
.cat-block:last-child { margin-bottom: 0; }
.cat-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 8px 10px 4px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: none;
  letter-spacing: 0.04em;
}
.cat-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  border-radius: 6px;
  color: var(--text-tertiary);
}
.cat-toggle:hover { background: var(--bg); color: var(--text-secondary); }
.cat-toggle-icon {
  font-size: 9px;
  width: 10px;
  color: var(--text-tertiary);
  transition: transform .15s;
}
.doc-group.collapsed .cat-toggle-icon,
.link-group.collapsed .cat-toggle-icon,
.browse-group.collapsed .cat-toggle-icon { transform: rotate(-90deg); }
.doc-group.collapsed .cat-list,
.link-group.collapsed .cat-list,
.browse-group.collapsed .browse-group-body { display: none; }
.browse-group {
  margin-bottom: 6px;
}
.browse-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  text-align: left;
}
.browse-group-head:hover { border-color: var(--border-strong); background: var(--brand-light); }
.browse-group-title { font-size: 14px; font-weight: 600; }
.browse-group-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-tertiary);
}
.browse-group-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 4px 0;
}
.cat-count {
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 11px;
  margin-left: auto;
}
.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cat-list li {
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 1px;
}
.cat-list li:hover { background: transparent; }

/* 左右栏统一：轻量列表行，不要卡片边框 */
.side-item,
.side-link,
.doc-link.side-link,
.doc-link-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  transition: background .12s, color .12s;
  cursor: pointer;
  min-width: 0;
  box-shadow: none;
}
.side-item:hover,
.side-link:hover,
.doc-link.side-link:hover,
.doc-link-compact:hover {
  background: rgba(0, 137, 255, 0.06);
  color: var(--text);
  box-shadow: none;
  border: none;
}
.side-link-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.side-link-icon.link-favicon {
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: hidden;
  padding: 0;
}
.side-link-icon.link-favicon img,
.browse-card-icon.link-favicon img,
.resource-card-icon.link-favicon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}
.side-link-icon.link-favicon.is-fallback {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-tertiary);
}
.side-link-icon.link-favicon.is-letter,
.browse-card-icon-link.link-favicon.is-letter,
.resource-card-icon.link-favicon.is-letter {
  padding: 0;
  border: none;
  box-shadow: none;
  font-family: Outfit, "Noto Sans SC", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.browse-card-icon-link.link-favicon.is-letter { font-size: 14px; }
.resource-card-icon.link-favicon.is-letter { font-size: 13px; }
.side-link:hover .side-link-icon { color: var(--brand); }
.side-link:hover .side-link-icon.link-favicon:not(.is-fallback):not(.is-letter) {
  border: none;
  box-shadow: none;
}
.frequent-link-list .side-link {
  padding: 3px 2px;
  gap: 8px;
  border-radius: 0;
  background: transparent;
}
.frequent-link-list .side-link:hover {
  background: transparent;
}
.frequent-link-list .side-link-icon {
  width: 22px;
  height: 22px;
}
.frequent-link-list .side-link-text {
  font-weight: 500;
  font-size: 13px;
}
.side-link-text,
.doc-link .doc-name,
.doc-link-compact .doc-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
  font-size: 13px;
  color: var(--text);
}
.side-view-count {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
  white-space: nowrap;
}
.side-link:hover .side-link-text,
.doc-link:hover .doc-name,
.doc-link-compact:hover .doc-name {
  color: var(--brand);
  text-decoration: none;
}
.cat-list a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.cat-list a:hover { color: inherit; }
.doc-meta { display: none; }
.doc-link-text { min-width: 0; flex: 1; display: contents; }
.doc-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  border: 1px solid transparent;
  box-sizing: border-box;
}
/* 浅底色字：比实心色块更轻，混排也不跳 */
.doc-icon-excel { background: #e8f5ee; color: #1b7a45; border-color: #c5e6d2; }
.doc-icon-word { background: #eaf2fb; color: #2b579a; border-color: #c9dcf3; }
.doc-icon-ppt { background: #fdeee8; color: #c43e1c; border-color: #f5cfc2; }
.doc-icon-pdf { background: #fdebec; color: #d32f2f; border-color: #f5c5c8; }
.doc-icon-html { background: #e8f4ff; color: #1677ff; border-color: #91caff; }
.doc-icon-image { background: #f3eefc; color: #7c3aed; border-color: #ddd0f7; }
.doc-icon-file { background: #f1f5f9; color: #64748b; border-color: #dde3ea; }
.doc-icon-knowledge { background: #eef5fc; color: #3b6ea5; border-color: #d0e4f7; }
.doc-icon-script { background: #eaf8f5; color: #0d8a7a; border-color: #c5ebe3; }
.doc-icon-link { background: #fff7e8; color: #b45309; border-color: #f5e0b8; }
.doc-icon-case { background: #f5f0ff; color: #6d28d9; border-color: #ddd6fe; }
.doc-icon-flow { background: #eef9f3; color: #047857; border-color: #a7f3d0; }
.doc-icon-course { background: #fff4e8; color: #c2410c; border-color: #fed7aa; }
.doc-icon-material { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.doc-icon-collection {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
  font-weight: 600;
}
/* 两字标签：缩小字号以塞进原色块尺寸 */
.doc-icon-knowledge,
.doc-icon-script,
.doc-icon-case,
.doc-icon-flow,
.doc-icon-course,
.doc-icon-material,
.doc-icon-link,
.doc-icon-collection {
  font-size: 7px;
  letter-spacing: -0.06em;
  white-space: nowrap;
}
/* 业务库混排：文档/知识/话术左侧色块统一尺寸 */
.browse-card-row .doc-icon,
.k-item-head .doc-icon,
.script-card-head .doc-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 11px;
}
.browse-card-row .doc-icon-knowledge,
.browse-card-row .doc-icon-script,
.browse-card-row .doc-icon-case,
.browse-card-row .doc-icon-flow,
.browse-card-row .doc-icon-course,
.browse-card-row .doc-icon-material,
.browse-card-row .doc-icon-link,
.browse-card-row .doc-icon-collection,
.k-item-head .doc-icon-knowledge,
.k-item-head .doc-icon-script,
.k-item-head .doc-icon-case,
.k-item-head .doc-icon-flow,
.k-item-head .doc-icon-course,
.k-item-head .doc-icon-material,
.k-item-head .doc-icon-link,
.k-item-head .doc-icon-collection,
.script-card-head .doc-icon-knowledge,
.script-card-head .doc-icon-script,
.script-card-head .doc-icon-case,
.script-card-head .doc-icon-flow,
.script-card-head .doc-icon-course,
.script-card-head .doc-icon-material,
.script-card-head .doc-icon-link,
.script-card-head .doc-icon-collection {
  font-size: 9px;
  letter-spacing: -0.06em;
}
.doc-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.doc-tag {
  display: none; /* 侧栏一行够挤，业务标签放到 title 悬停里 */
}
.side-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ── 主区（向左铺开，平面淡蓝） ── */
.center-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--panel-grad);
  border: 1px solid var(--panel-edge);
  border-right: none;
  border-top: none;
  border-radius: 0;
  box-shadow: none;
}
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-line);
  padding: 10px 14px;
  flex-shrink: 0;
  overflow-x: auto;
  min-width: 0;
}
.nav-biz-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  padding: 0 4px;
}
.nav-biz-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  outline: none;
  padding: 7px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--nav-text);
  cursor: pointer;
  margin: 0;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.2;
  box-shadow: none;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.nav-tab-short { display: none; }
.nav-tab-long { display: inline; }
.nav-tab:hover {
  color: var(--nav-text-hover);
  background: var(--nav-hover-bg);
}
.nav-tab:focus-visible {
  outline: 2px solid var(--glow);
  outline-offset: 2px;
}
.nav-tab.active {
  color: var(--nav-active-color);
  background: var(--nav-active-bg);
  font-weight: 700;
  box-shadow: none;
}
.nav-tab[data-panel="chat"] {
  color: var(--nav-text);
  background: transparent;
}
.nav-tab[data-panel="chat"]:hover {
  background: var(--accent-soft);
  color: var(--nav-text-hover);
}
.nav-tab[data-panel="chat"].active {
  color: #fff;
  background: var(--chat-tab-grad);
  box-shadow: var(--chat-tab-glow);
}
.nav-tab[data-panel="chat"].active:hover {
  filter: brightness(1.05);
  background: var(--chat-tab-grad);
  box-shadow: var(--chat-tab-glow);
}
.nav-tab[data-panel="featured"],
.nav-tab[data-panel="favorites"] {
  color: var(--muted);
  font-weight: 500;
  background: transparent;
  padding: 7px 12px;
}
.nav-tab[data-panel="featured"]:hover,
.nav-tab[data-panel="favorites"]:hover {
  color: var(--nav-text-hover);
  background: var(--nav-hover-bg);
}
.nav-tab[data-panel="featured"].active,
.nav-tab[data-panel="favorites"].active {
  color: var(--nav-active-color);
  background: var(--nav-active-bg);
  font-weight: 700;
}

.admin-order-input {
  width: 64px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-strong, #cbd5e1);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: #fff;
}
.admin-order-input:focus {
  outline: none;
  border-color: #0089ff;
  box-shadow: 0 0 0 3px rgba(0, 137, 255, 0.15);
}
.admin-inline-sort,
.admin-inline-text,
.admin-inline-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong, #cbd5e1);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  box-sizing: border-box;
}
.admin-inline-select {
  max-width: 132px;
  min-width: 88px;
  padding: 0 6px;
  height: 30px;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.admin-inline-select:focus {
  outline: none;
  border-color: #0089ff;
  box-shadow: 0 0 0 3px rgba(0, 137, 255, 0.15);
}
.admin-inline-select:disabled {
  opacity: 0.6;
  cursor: wait;
}
.materials-table-wrap .admin-col-classify {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.materials-table-wrap td.col-actions.admin-actions {
  white-space: nowrap;
}
.materials-table-wrap .admin-act-sum {
  display: inline-flex;
}
.materials-table-wrap .admin-act-menu:not(.is-open) > .admin-act-panel {
  display: none !important;
}
.materials-table-wrap .admin-act-menu.is-open > .admin-act-panel {
  display: flex !important;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 120px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(42, 63, 95, 0.16);
}
.materials-table-wrap .admin-act-panel .btn-sm,
.materials-table-wrap .admin-act-panel a.btn-sm {
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}
.admin-inline-sort {
  width: 72px;
  min-width: 72px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  /* 隐藏 number 步进箭头，避免挤占数字 */
  -moz-appearance: textfield;
  appearance: textfield;
}
.admin-inline-sort::-webkit-outer-spin-button,
.admin-inline-sort::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.admin-inline-text:focus,
.admin-inline-sort:focus {
  outline: none;
  border-color: #0089ff;
  box-shadow: 0 0 0 3px rgba(0, 137, 255, 0.15);
}

/* 资料列表标题：各类型统一黑色、统一字重 */
.lib-title,
.lib-title.is-featured {
  font-weight: 400;
  color: var(--text);
}
.browse-card-title,
.browse-card-row .browse-card-title,
.browse-card-title .lib-title,
.browse-card-title .lib-title.is-featured,
.script-card-title,
.script-card-title .lib-title,
.script-card-title .lib-title.is-featured,
.k-item h4,
.k-item h4 .lib-title,
.k-item h4 .lib-title.is-featured,
.doc-name .lib-title,
.doc-name .lib-title.is-featured,
.biz-library-list .browse-card-title,
.biz-library-list .script-card-title,
.biz-library-list .k-item h4 {
  font-weight: 400;
  color: var(--text);
}
.lib-title.is-premium,
.browse-card-title .lib-title.is-premium,
.script-card-title .lib-title.is-premium,
.k-item h4 .lib-title.is-premium,
.doc-name .lib-title.is-premium,
.admin-row-title .lib-title.is-premium {
  font-weight: 700;
  color: var(--brand-deep);
}
.browse-card:hover .browse-card-title,
.browse-card:hover .browse-card-title .lib-title {
  color: var(--text);
  text-decoration: underline;
}
.browse-card:hover .browse-card-title .lib-title.is-premium {
  color: var(--brand-deep);
  text-decoration: underline;
}
.biz-collection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px 12px;
  flex-wrap: wrap;
  background: var(--brand-light);
  border: 1px solid rgba(0, 137, 255, 0.18);
  border-radius: 12px;
}
.biz-collection-bar .btn {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border-strong);
}
.biz-collection-bar-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.biz-collection-bar-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  line-height: 1.3;
}
.biz-collection-bar-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}
.biz-collection-bar-acts {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.collection-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 16px;
}
button.browse-card-main,
button.browse-card-title-hit {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  width: auto;
  max-width: 100%;
  cursor: pointer;
}
/* 合集行：与其它资料同底，标题旁「合集」芯片区分（方案 D） */
.collection-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 0 6px;
  height: 16px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  text-decoration: none;
  box-sizing: border-box;
}
.browse-card:hover .collection-chip {
  text-decoration: none;
}
.featured-mark {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  height: 18px;
  line-height: 18px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
  color: #fff;
  background: #f59e0b;
}
.new-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 0 4px;
  min-width: 16px;
  height: 16px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  vertical-align: 1px;
  color: #fff;
  background: #ff0000;
  flex-shrink: 0;
}
.new-mark img,
.new-mark svg {
  display: none;
}
.admin-row-title .featured-mark,
.admin-row-title .new-mark,
.k-item-title-row .featured-mark,
.k-item-title-row .new-mark,
.script-card-title .featured-mark,
.script-card-title .new-mark,
.browse-card-title .featured-mark,
.browse-card-title .new-mark,
.doc-name .featured-mark,
.doc-name .new-mark {
  flex-shrink: 0;
}

.view { display: none; flex: 1; flex-direction: column; min-height: 0; }
.view.active { display: flex; animation: viewIn 0.28s var(--ease); }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ── 问小M：历史 + 对话 ── */
.chat-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  min-width: 0;
}
.chat-history-rail {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--rail-bg);
}
.chat-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-history-title-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.chat-history-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.chat-history-clear-btn {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #b42318;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1.2;
}
.chat-history-clear-btn:hover {
  background: rgba(180, 35, 24, 0.08);
}
.chat-history-clear-btn[hidden] {
  display: none !important;
}
.chat-new-btn {
  font-size: 12px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--brand-deep);
  font-weight: 600;
}
.chat-history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-history-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 24px 8px;
  text-align: center;
  line-height: 1.5;
}
.chat-history-item {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 7px 6px;
  cursor: pointer;
  color: var(--text);
}
.chat-history-item:hover,
.chat-history-item.active {
  background: rgba(15, 118, 110, 0.08);
}
.chat-history-item.active {
  font-weight: 600;
}
.chat-history-item-title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-history-del {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
}
.chat-history-item:hover .chat-history-del { opacity: 1; }
.chat-history-del:hover { color: #b91c1c; background: rgba(185, 28, 28, 0.08); }
.modal-desc {
  margin: -4px 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.form-error {
  margin: 0;
  font-size: 12px;
  color: #b91c1c;
}

/* 姓名门禁弹窗 */
.name-gate-box {
  padding: 28px 26px 24px;
}
.name-gate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.name-gate-logo {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.name-gate-eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--brand-deep);
}
.name-gate-slogan {
  margin: 4px 0 0;
  font-family: var(--font-brand), Outfit, "Noto Sans SC", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep, #1f3a5f);
  letter-spacing: 0.02em;
}
.name-gate-title {
  margin: 0 0 6px !important;
  font-size: 18px;
  font-weight: 700;
}
.name-gate-box .modal-desc {
  margin: 0 0 18px;
}
.name-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.name-gate-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.name-gate-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.name-gate-form input[name="user_name"] {
  width: 100%;
  box-sizing: border-box;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-strong, #c5ced9);
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.name-gate-form input[name="user_name"]:focus {
  border-color: rgba(42, 63, 95, 0.45);
  box-shadow: 0 0 0 3px rgba(42, 63, 95, 0.1);
}
.name-gate-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.btn.name-gate-cancel,
.btn.name-gate-submit {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: none;
}
.btn.name-gate-submit {
  letter-spacing: 0.02em;
}

.chat-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.chat-thread {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(520px 280px at 100% 0%, var(--page-spot-1), transparent 60%),
    radial-gradient(460px 260px at 0% 30%, var(--page-spot-2), transparent 55%);
}
.msg {
  display: flex;
  gap: 10px;
  max-width: min(88%, 100%);
  min-width: 0;
  animation: msgIn 0.32s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.msg-user { align-self: flex-end; flex-direction: row-reverse; max-width: min(85%, 100%); }
.msg-bot { align-self: flex-start; }
.msg-loading-row {
  width: min(640px, 100%);
}
.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-family: var(--font-brand);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: none;
  user-select: none;
}
.msg-body { min-width: 0; max-width: min(560px, 100%); overflow: hidden; }
.msg-user .msg-body {
  width: fit-content;
  max-width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.msg-loading-row .msg-body {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}
.msg-bubble {
  padding: 12px 14px 10px;
  border-radius: 12px;
  line-height: 1.55;
  white-space: normal;
  font-size: 13.5px;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-break: anywhere;
  max-width: 100%;
  box-sizing: border-box;
}
.msg-bot .msg-bubble {
  background: var(--bubble-bot-bg);
  border: 1px solid var(--bubble-bot-line);
  border-top-left-radius: 4px;
  box-shadow: none;
}
.msg-bubble-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
}
.msg-user .msg-bubble {
  width: fit-content;
  max-width: 100%;
  background: var(--user-bubble-grad);
  color: #fff;
  border-top-right-radius: 4px;
  box-shadow: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-break: anywhere;
}
.msg-warn { background: var(--warn-bg) !important; border-color: #b7d4eb !important; }
.msg-error { background: #fef2f2 !important; border-color: #fecaca !important; color: var(--danger); }
.msg-loading { color: var(--text-tertiary); font-style: italic; }
.msg-hints { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
.prompt-chip {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2px 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent-deep);
  cursor: pointer;
  max-width: 100%;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(154, 90, 24, 0.35);
  transition: color 0.15s var(--ease), text-decoration-color 0.15s var(--ease);
}
.prompt-chip:hover {
  color: var(--brand);
  text-decoration-color: currentColor;
  background: transparent;
  transform: none;
}

.chat-recent {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 8px 6px 0;
  margin-bottom: 0;
  border-top: 1px solid var(--border);
  background: var(--panel);
  min-width: 0;
  overflow: hidden;
}
.chat-recent-label {
  font-size: 12px;
  color: var(--brand-deep);
  font-weight: 700;
  flex-shrink: 0;
}
.chat-recent-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.chat-recent-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
}
.chat-recent-chip:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: var(--brand-light);
}

.chat-input-bar,
.chat-composer {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 8px 6px 6px;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: none;
  transition: border-color 0.15s var(--ease);
}
.chat-composer:focus-within {
  border-color: var(--border-strong, rgba(42, 63, 95, 0.28));
  box-shadow: none;
}
.chat-composer textarea,
.chat-input-bar textarea {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  min-height: 84px;
  max-height: 240px;
  padding: 10px 12px;
  border: none;
  border-radius: 0;
  font: inherit;
  font-size: 13px;
  outline: none;
  resize: vertical;
  line-height: 1.5;
  background: transparent;
  color: var(--text);
}
.chat-composer textarea::placeholder,
.chat-input-bar textarea::placeholder {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.chat-composer textarea:focus,
.chat-input-bar textarea:focus {
  border: none;
  box-shadow: none;
}
.chat-composer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: var(--panel-soft);
}
.chat-composer-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.chat-composer-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}
.chat-send-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.btn.chat-send,
.chat-send,
.chat-stop {
  height: 36px;
  min-width: 72px;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0;
  box-shadow: none;
  background-image: none;
  -webkit-appearance: none;
  appearance: none;
}
.btn.primary.chat-send,
.btn.chat-send.primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}
.btn.primary.chat-send:hover,
.btn.chat-send.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.chat-stop {
  min-width: 64px;
}
.chat-attach-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
}
.chat-attach-preview[hidden] { display: none !important; }

.chat-wrap > .chat-composer,
.chat-wrap > .chat-input-bar {
  position: relative;
}
.chat-recent {
  margin-bottom: 0;
}

.browse-panel-head {
  padding: 16px 20px 8px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(216, 224, 235, 0.55) 0%, transparent 100%);
}
.browse-panel-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-deep);
}
.browse-panel-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.browse-toolbar {
  flex-shrink: 0;
  padding: 4px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.browse-search-wrap {
  position: relative;
}
.browse-search-wrap::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  border: 2px solid #8a97a8;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}
.browse-search-wrap::after {
  content: "";
  position: absolute;
  left: 26px;
  top: calc(50% + 5px);
  width: 7px;
  height: 2px;
  background: #8a97a8;
  border-radius: 1px;
  transform: rotate(45deg);
  pointer-events: none;
}
.browse-search {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #eef1f5;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.browse-search::placeholder { color: #8a97a8; }
.browse-search:hover { border-color: var(--border-strong); }
.browse-search:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: var(--focus-ring);
}
.browse-filter-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.browse-filter-label {
  flex-shrink: 0;
  width: 56px;
  padding-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.script-pill[data-kind="type"][data-v="教程"].active { background: #2563eb; border-color: #2563eb; }
.script-pill[data-kind="type"][data-v="手册"].active { background: #0f766e; border-color: #0f766e; }
.script-pill[data-kind="type"][data-v="资料"].active { background: #5b6472; border-color: #5b6472; }
.script-pill[data-kind="type"][data-v="流程图"].active { background: #7c3aed; border-color: #7c3aed; }
.script-pill[data-kind="type"][data-v="图片"].active { background: #d97706; border-color: #d97706; }
.script-pill[data-kind="lang"][data-v="中文"].active { background: #2563eb; border-color: #2563eb; }
.script-pill[data-kind="lang"][data-v="日文"].active { background: #dc2626; border-color: #dc2626; }
.script-pill[data-kind="lang"][data-v="英文"].active { background: #0f766e; border-color: #0f766e; }
.browse-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.browse-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.browse-section:last-child { margin-bottom: 0; }
.browse-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-deep);
  letter-spacing: 0.02em;
  padding: 4px 2px 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.biz-section-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  padding: 1px 8px;
}
.biz-library-list {
  overflow: auto;
  padding: 8px 16px 24px;
  flex: 1;
  min-height: 0;
}
.biz-library-list .browse-section-list,
.biz-library-list .list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.browse-section-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.admin-check-label input { width: auto; margin: 0; }
.browse-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.browse-card:hover {
  border-color: var(--hover-line);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.browse-card-main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.browse-card-primary,
.browse-card-secondary {
  display: contents;
}
.browse-card-title-hit {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  order: initial;
  text-decoration: none;
  color: inherit;
  display: block;
}
.browse-card-title-block {
  order: 1;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(46vw, 520px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.browse-card-meta {
  order: 2;
}
.browse-card-secondary > .k-tag {
  order: 3;
  flex-shrink: 0;
}
.browse-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.browse-card > .doc-icon,
.browse-card > .browse-card-icon,
.browse-card > .browse-card-icon-link {
  flex-shrink: 0;
  margin-top: 1px;
}
.browse-card-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.browse-card-icon-link {
  background: var(--brand-light);
  color: var(--brand);
  font-size: 14px;
}
.browse-card-icon-link.link-favicon {
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
  padding: 0;
}
.browse-card-icon-link.link-favicon.is-fallback {
  background: var(--brand-light);
  border-color: transparent;
}
.browse-card-body { flex: 1; min-width: 0; }
.browse-card-title {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.browse-card:hover .browse-card-title { text-decoration: underline; color: var(--text); }
.browse-card-meta {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}
.browse-card-secondary > .k-tag {
  flex-shrink: 0;
}
.browse-card-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.browse-card-action,
.card-acts .browse-card-action {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: none;
  line-height: 1;
  flex-shrink: 0;
}
.browse-card-action:hover,
.card-acts .browse-card-action:hover {
  background: var(--brand-light);
  color: var(--brand-deep);
}
/* 网站/文档/视频库：与知识卡片同构 */
.browse-card-row {
  padding: 8px 12px;
  gap: 8px;
  align-items: center;
}
.browse-card-row:hover { transform: none; }
.browse-card-row .browse-card-icon,
.browse-card-row .browse-card-icon-link,
.browse-card-row > .doc-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 10px;
  margin-top: 0;
}
.browse-card-row .browse-card-title { font-size: 13px; font-weight: 400; color: var(--text); }
.browse-card-row .browse-card-title-hit {
  display: flex;
  align-items: center;
  min-height: 26px;
}
.browse-card-row .browse-card-title .lib-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-width: 0;
}
.browse-card-row .browse-card-title .collection-chip,
.browse-card-row .browse-card-title .featured-mark,
.browse-card-row .browse-card-title .new-mark {
  margin-left: 0;
  vertical-align: unset;
  height: 16px;
  line-height: 16px;
  box-sizing: border-box;
}

.fav-btn {
  border: none;
  background: transparent;
  width: auto;
  height: auto;
  min-width: 0;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 2px;
  color: #9aa8bb;
  box-shadow: none;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
}
.fav-btn:hover {
  border: none;
  color: #e0a800;
  background: transparent;
}
.fav-btn.is-fav {
  color: #f5b301;
  background: transparent;
  border: none;
}
.share-btn {
  border: 1px solid var(--line);
  background: #fff;
  height: 28px;
  min-width: 0;
  padding: 0 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-deep);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}
.share-btn:hover {
  background: var(--accent-soft);
}
.fav-star {
  font-size: 11px;
  line-height: 1;
}
.k-item-tags .fav-btn,
.script-tags .fav-btn,
.script-card-head > .fav-btn,
.k-item-head > .fav-btn,
.browse-card > .fav-btn {
  margin-left: 6px;
  box-shadow: none;
  background: transparent;
}
.script-card-head > .share-btn,
.k-item-head > .share-btn,
.browse-card > .share-btn {
  margin-left: 4px;
}
.fav-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 16px 8px;
}
.fav-filters { margin-top: 0; }
.member-center-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
@media (max-width: 640px) {
  .member-center-grid { grid-template-columns: 1fr; }
}
.member-center-card {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}
.member-center-h {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--brand-deep);
}
.member-center-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
#favorites-list { padding: 0 16px 20px; }
input.name-locked {
  background: var(--surface-soft) !important;
  color: var(--text-secondary);
  cursor: not-allowed;
}

.script-filters {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 16px 8px;
  padding: 10px 12px;
  background: var(--filter-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
#panel-scripts {
  overflow: hidden;
}
#scripts-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
#panel-scripts .pager {
  flex-shrink: 0;
  margin-top: 0;
  padding: 8px 0 12px;
}
.script-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.script-filter-row[hidden] {
  display: none !important;
}
.list-expand-toggle[hidden] {
  display: none !important;
}
.script-filter-row-scene {
  padding-top: 2px;
}
.script-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  width: 56px;
  flex-shrink: 0;
}
.script-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.script-pill {
  appearance: none;
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: 999px;
  height: 28px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  transition: background .12s, border-color .12s, color .12s;
}
.script-pill:hover { border-color: var(--text-tertiary); color: var(--text); }
/* 选中：默认品牌蓝底 + 白字，避免无专属色时白字看不清 */
.script-pill.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}
.script-pill[data-kind="all"].active { background: #374151; border-color: #374151; }
/* 业务 pill 配色 */
.script-pill[data-kind="biz"][data-v="通用"].active { background: #5b6472; border-color: #5b6472; }
.script-pill[data-kind="biz"][data-v="手机卡"].active,
.script-pill[data-kind="biz"][data-v="号卡"].active { background: #2563eb; border-color: #2563eb; }
.script-pill[data-kind="biz"][data-v="宽带"].active { background: #0f766e; border-color: #0f766e; }
.script-pill[data-kind="biz"][data-v="WIFI"].active,
.script-pill[data-kind="biz"][data-v="wifi"].active { background: #d97706; border-color: #d97706; }
.script-pill[data-kind="biz"][data-v="电力"].active { background: #ea580c; border-color: #ea580c; }
.script-pill[data-kind="biz"][data-v="行政书士"].active,
.script-pill[data-kind="biz"][data-v="签证中心"].active { background: #7c3aed; border-color: #7c3aed; }
.script-pill[data-kind="biz"][data-v="保险"].active,
.script-pill[data-kind="biz"][data-v="车保险"].active,
.script-pill[data-kind="biz"][data-v="旅游保险"].active,
.script-pill[data-kind="biz"][data-v="房屋保险"].active { background: #0f766e; border-color: #0f766e; }
.script-pill[data-kind="biz"][data-v="mobius"].active { background: #2563eb; border-color: #2563eb; }
.script-pill[data-kind="stage"][data-v="售前"].active { background: #16a34a; border-color: #16a34a; }
.script-pill[data-kind="stage"][data-v="售中"].active { background: #2563eb; border-color: #2563eb; }
.script-pill[data-kind="stage"][data-v="售后"].active { background: #d97706; border-color: #d97706; }
/* 知识库一级业务类型（沿用上方 biz 色） */
.knowledge-filters .script-filter-label { width: 64px; }
.script-filter-row-search {
  align-items: center;
}
.list-expand-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.list-expand-toggle .switch { flex-shrink: 0; }

#knowledge-list.list-collapsed .k-item:not(.item-expanded) .k-item-body,
#scripts-list.list-collapsed .script-card:not(.item-expanded) .script-card-content,
#biz-library-list.list-collapsed .k-item:not(.item-expanded) .k-item-body,
#biz-library-list.list-collapsed .script-card:not(.item-expanded) .script-card-content {
  display: none;
}
#knowledge-list.list-collapsed .k-item,
#scripts-list.list-collapsed .script-card,
#biz-library-list.list-collapsed .k-item,
#biz-library-list.list-collapsed .script-card {
  padding-top: 5px;
  padding-bottom: 5px;
}
/* 列表折叠时可用「展开」按钮预览；点行进详情 */
.item-expand-btn {
  display: inline-flex !important;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-deep);
  cursor: pointer;
  flex-shrink: 0;
}
.item-expand-btn:hover {
  background: var(--accent-soft);
}
.card-acts .item-expand-btn,
.card-acts .script-copy,
.card-acts .share-btn {
  height: 24px;
  padding: 0 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}
.card-acts .item-expand-btn:hover,
.card-acts .script-copy:hover,
.card-acts .share-btn:hover {
  background: var(--brand-light);
  color: var(--brand-deep);
}
.list-collapsed .k-item-title-row,
.list-collapsed .script-card-title-row {
  cursor: pointer;
}
.list-collapsed .k-item-head,
.list-collapsed .script-card-head {
  cursor: default;
}
.detail-replies {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.reply-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 14px;
}
.reply-empty {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 8px 0;
}
.reply-item {
  background: #f7fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.reply-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.reply-meta strong {
  color: var(--brand-deep);
  font-weight: 600;
}
.reply-time {
  color: var(--text-tertiary);
}
.reply-cite-btn {
  margin-left: auto;
}
.reply-quote {
  font-size: 12px;
  color: var(--text-secondary);
  background: #eef5fc;
  border-left: 3px solid var(--brand);
  padding: 6px 10px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 8px;
}
.reply-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.reply-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reply-cite-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--brand-light);
  border-radius: 8px;
  font-size: 12px;
  color: var(--brand-deep);
}
.reply-cite-bar[hidden] {
  display: none !important;
}
.reply-cite-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reply-compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.reply-author-input {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.script-search-input {
  flex: 1;
  min-width: 160px;
  max-width: 420px;
}
.script-filter-row-scene[hidden] { display: none !important; }
.script-filter-row-scene .script-filter-label { padding-top: 6px; }
.script-scene-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.script-scene-item {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  max-width: 100%;
  transition: background .12s, border-color .12s, color .12s;
}
.script-scene-item:hover {
  border-color: var(--text-tertiary);
  background: var(--surface);
}
.script-scene-item.active {
  border-color: #374151;
  background: #374151;
  color: #fff;
  font-weight: 600;
}
.script-scene-item[data-kind="all"] {
  color: var(--text-secondary);
}
.script-scene-item[data-kind="all"].active {
  color: #fff;
}
.script-scene-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 6px 0;
}
.script-filter-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0;
  padding: 8px 10px;
  line-height: 1.45;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  z-index: 1;
}
.script-filter-hint:empty { display: none; }
.script-flat-list { gap: 6px; }
.script-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.script-card:hover {
  border-color: rgba(0, 137, 255, 0.35);
  box-shadow: var(--shadow-sm);
}
.script-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: nowrap;
  min-width: 0;
}
.script-card-title {
  font-weight: 400;
  font-size: 13px;
  color: var(--text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.script-tags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.script-tag {
  display: inline-flex;
  align-items: center;
  height: auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.25;
  border: 1px solid transparent;
  white-space: nowrap;
  background: var(--bg);
  color: var(--text-secondary);
  box-sizing: border-box;
}
/* 业务类型 */
.script-tag[data-kind="biz"][data-v="通用"] { color: #5b6472; border-color: #9aa3af; background: #f3f4f6; }
.script-tag[data-kind="biz"][data-v="手机卡"] { color: #1d4ed8; border-color: #60a5fa; background: #eff6ff; }
.script-tag[data-kind="biz"][data-v="宽带"] { color: #0f766e; border-color: #2dd4bf; background: #f0fdfa; }
.script-tag[data-kind="biz"][data-v="WIFI"] { color: #b45309; border-color: #fbbf24; background: #fffbeb; }
.script-tag[data-kind="biz"][data-v="电力"] { color: #c2410c; border-color: #fb923c; background: #fff7ed; }
.script-tag[data-kind="biz"]:not([data-v="通用"]):not([data-v="手机卡"]):not([data-v="宽带"]):not([data-v="WIFI"]):not([data-v="电力"]) {
  color: #5b6472; border-color: #9aa3af; background: #f3f4f6;
}
/* 阶段 */
.script-tag[data-kind="stage"][data-v="售前"] { color: #15803d; border-color: #4ade80; background: #f0fdf4; }
.script-tag[data-kind="stage"][data-v="售中"] { color: #1d4ed8; border-color: #93c5fd; background: #eff6ff; }
.script-tag[data-kind="stage"][data-v="售后"] { color: #b45309; border-color: #fdba74; background: #fff7ed; }
.script-tag[data-kind="stage"]:not([data-v="售前"]):not([data-v="售中"]):not([data-v="售后"]) {
  color: #5b6472; border-color: #9aa3af; background: #f3f4f6;
}
.script-card-content {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 8px;
}
.script-card-content.k-rich-content {
  white-space: normal;
}
/* 展开后看清图：完整比例预览，不再裁成小方块 */
.script-card-content.k-rich-content img,
.resource-script-body.k-rich-content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: center;
  margin: 10px 0 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  background: var(--surface-soft, #f3f6fa);
}
.script-card-content.k-rich-content .image-text-tool,
.resource-script-body.k-rich-content .image-text-tool {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin: 10px 0 14px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.script-card-content.k-rich-content .image-text-tool > img,
.resource-script-body.k-rich-content .image-text-tool > img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(70vh, 720px);
  margin: 0;
}
.script-card-content.k-rich-content .image-text-actions,
.resource-script-body.k-rich-content .image-text-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 420px;
}
.script-card-content.k-rich-content .image-text-btn,
.script-card-content.k-rich-content .image-text-redo,
.resource-script-body.k-rich-content .image-text-btn,
.resource-script-body.k-rich-content .image-text-redo,
.k-item-body .k-rich-content .image-text-btn,
.k-item-body .k-rich-content .image-text-redo,
.detail-block-body.k-rich-content .image-text-btn,
.detail-block-body.k-rich-content .image-text-redo {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
}
.script-card-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.script-copy {
  flex-shrink: 0;
}
.script-card-row {
  padding: 5px 10px;
}
.script-card-row .script-card-head { margin-bottom: 0; }

.match-section { margin-top: 10px; }
.match-section-label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 6px; }

.ref-type-tag,
.k-tag[data-kind="ref-type"] {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  border-width: 1px;
  border-style: solid;
}
.k-tag[data-kind="ref-type"][data-v="知识"] { color: #1d4ed8; border-color: #93c5fd; background: #eff6ff; }
.k-tag[data-kind="ref-type"][data-v="话术"] { color: #0f766e; border-color: #5eead4; background: #f0fdfa; }
.k-tag[data-kind="ref-type"][data-v="网站"] { color: #6d28d9; border-color: #c4b5fd; background: #f5f3ff; }
.k-tag[data-kind="ref-type"][data-v="文档"] { color: #b45309; border-color: #fcd34d; background: #fffbeb; }
.k-tag[data-kind="ref-type"][data-v="视频"] { color: #be123c; border-color: #fda4af; background: #fff1f2; }
.match-card-meta .match-card-date {
  color: var(--text-tertiary);
  font-size: 11px;
  white-space: nowrap;
}
.match-card-meta .ref-type-tag,
.match-card-meta .k-tag[data-kind="ref-type"] {
  order: -1;
}
.escalate-box,
.escalate-panel {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e6f4ff 0%, #ffffff 58%, #f2f8ff 100%);
  border: 1px solid #b3d7ff;
  box-shadow: none;
}
.escalate-panel {
  margin: 12px 4px;
  text-align: center;
}
.escalate-lead,
.escalate-msg {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-deep);
  line-height: 1.45;
}
.escalate-msg {
  background: linear-gradient(135deg, #e6f4ff 0%, #fff 100%) !important;
  border-color: #b3d7ff !important;
  text-align: center;
}
.escalate-msg .escalate-lead { margin-bottom: 8px; }
.escalate-art {
  display: block;
  width: min(180px, 56vw);
  height: auto;
  margin: 10px auto 6px;
  border-radius: 12px;
  background: #f2f8ff;
  border: 1px solid rgba(170, 205, 230, 0.35);
  box-shadow: none;
  object-fit: cover;
  aspect-ratio: 1;
}
.escalate-box .escalate-art { margin-left: 0; margin-right: auto; }
.escalate-panel .escalate-art { margin-top: 12px; }
.escalate-desc {
  margin: 8px 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.escalate-cta {
  margin-top: 10px;
  width: 100%;
  max-width: 280px;
}
.escalate-panel .escalate-cta { margin-top: 4px; }
.escalate-box.escalate-chat {
  margin-top: 8px;
  padding: 0;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.escalate-box.escalate-chat .escalate-lead {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.45;
}
.escalate-box.escalate-chat .escalate-cta {
  width: auto;
  max-width: none;
  margin-top: 0;
}
.stale-topic-box {
  margin-top: 10px;
}
.recommend-script {
  margin-top: 10px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(0, 137, 255, 0.22);
  background: linear-gradient(180deg, #f7fbff 0%, #fff 58%);
  border-radius: 10px;
}
.recommend-script-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.recommend-script-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.recommend-script-label {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #0369a1;
  background: rgba(0, 137, 255, 0.1);
  border: 1px solid rgba(0, 137, 255, 0.22);
  border-radius: 999px;
}
.recommend-script-source,
.recommend-script .script-tag {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: #64748b !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 999px;
}
.recommend-script-title {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recommend-script-copy {
  flex-shrink: 0;
  margin-left: 0;
  height: 26px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0369a1;
  background: #fff;
  border: 1px solid rgba(0, 137, 255, 0.32);
  border-radius: 999px;
  box-shadow: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.recommend-script-copy:hover {
  color: #0260a0;
  background: rgba(0, 137, 255, 0.06);
  border-color: #0089ff;
}
.recommend-script-copy:active {
  background: rgba(0, 137, 255, 0.1);
  border-color: #0078e6;
}
.recommend-script-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 137, 255, 0.1);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.msg-html-dl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.msg-html-dl-row .html-download-btn,
.msg-html-dl-row .html-open-link,
.msg-html-dl-row .html-download-link {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  box-sizing: border-box;
}
.msg-html-dl-row .html-download-link {
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(0, 137, 255, 0.35);
  font-size: 12px;
  font-weight: 600;
}
.escalate-cta-quiet {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(0, 137, 255, 0.35);
  border-radius: 8px;
  box-shadow: none;
}
.escalate-cta-quiet:hover {
  background: rgba(0, 137, 255, 0.06);
  border-color: var(--accent);
  color: var(--accent-deep);
}
.match-card {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: linear-gradient(90deg, #eef1f5 0%, #fff 60%);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font: inherit;
  transition: border-color .15s, background .15s, box-shadow .15s;
  min-width: 0;
}
.match-card[data-biz="通用"] { border-left-color: #9aa3af; }
.match-card[data-biz="手机卡"],
.match-card[data-biz="号卡"] { border-left-color: #2563eb; }
.match-card[data-biz="宽带"] { border-left-color: #0f766e; }
.match-card[data-biz="WIFI"],
.match-card[data-biz="wifi"] { border-left-color: #d97706; }
.match-card[data-biz="电力"] { border-left-color: #ea580c; }
.match-card[data-biz="行政书士"],
.match-card[data-biz="签证中心"] { border-left-color: #7c3aed; }
.match-card[data-biz="保险"],
.match-card[data-biz="车保险"],
.match-card[data-biz="旅游保险"],
.match-card[data-biz="房屋保险"] { border-left-color: #0891b2; }
.match-card[data-biz="mobius"] { border-left-color: #2563eb; }
.match-card:hover { border-color: var(--brand); background: var(--brand-light); }
.match-card-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-card-meta {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
  margin-top: 0;
}

.resource-list { display: flex; flex-direction: column; gap: 4px; }
.resource-card {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; text-decoration: none; color: inherit; transition: border-color .15s, background .15s;
  min-width: 0;
}
.resource-card:hover { border-color: var(--brand); background: var(--brand-light); }
.resource-card-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.resource-card-icon.link-favicon {
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
  font-size: 10px;
  color: var(--brand);
}
.resource-card-icon.link-favicon.is-fallback {
  background: var(--brand-light);
  border-color: transparent;
}
.resource-card .doc-icon {
  margin-top: 0;
  width: 16px;
  height: 16px;
  font-size: 7px;
  border-radius: 3px;
}
.resource-card-compact .resource-card-title {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}
.resource-card-compact .resource-card-meta {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 11px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resource-card-compact .k-tag {
  flex-shrink: 0;
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
}
.resource-card-compact .match-score-hint {
  flex-shrink: 0;
  white-space: nowrap;
}
.resource-card-title { font-size: 13px; font-weight: 400; color: var(--text); }
.resource-card-meta { font-size: 11px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.resource-script {
  align-items: flex-start;
  padding: 6px 8px;
}
.resource-script .resource-card-body { width: 100%; }
.resource-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.resource-card-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
  flex: 1;
}
.resource-card-title-row .resource-card-title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(100%, 280px);
}
.resource-card-title-row .resource-card-views {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.match-card-meta .match-score-hint {
  margin-left: 6px;
  white-space: nowrap;
}
.match-score {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: baseline;
}
.match-score.match-score-hi {
  color: #0a7a3e;
  background: #e8f7ee;
}
.match-score.match-score-mid {
  color: #9a6b00;
  background: #fff6d9;
}
.match-score.match-score-lo {
  color: #b42318;
  background: #fdecea;
}
.resource-script .script-tag {
  height: 18px;
  padding: 0 6px;
  font-size: 10px;
  flex-shrink: 0;
}
.resource-script-body {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 10px;
}
.resource-script .script-copy { flex-shrink: 0; white-space: nowrap; }
.msg-source-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #0f766e;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 4px;
  padding: 1px 7px;
  margin: 0;
  line-height: 1.5;
}
.msg-source-tag.web {
  color: #1a7a3c;
  background: #eef7f0;
  border-color: #b7e0c2;
}
.msg-source-tag.cache {
  color: #0a7a3e;
  background: #e8f7ee;
  border-color: #b7e0c2;
}
.msg-dispute-row {
  margin: 8px 0 4px;
}
.msg-dispute-btn {
  font-size: 12px;
  font-weight: 600;
  color: #9a3412;
  border-color: #fdba74;
  background: #fff7ed;
}
.msg-dispute-btn:hover {
  color: #b42318;
  border-color: #f3b4ae;
  background: #fdecea;
}
.msg-source-tag.msg-time-tag {
  color: var(--text-tertiary);
  background: #f4f6f8;
  border-color: var(--border);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.msg-usage-note {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-tertiary);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.msg-bubble .chat-ans {
  display: block;
  line-height: 1.6;
  color: var(--text);
}
.msg-bubble .chat-ans .chat-br {
  display: block;
  content: "";
  margin-top: 0.06em;
}
.msg-bubble .chat-ans .chat-br-gap {
  margin-top: 0.1em;
}
.msg-bubble .chat-ans .chat-explain-gap {
  display: block;
  height: 2px;
}
.msg-bubble .chat-ans .chat-key-gap {
  display: block;
  height: 2px;
}
.msg-bubble .chat-ans .chat-sec-gap {
  display: block;
  height: 2px;
}
/* 核心结论：荧光笔高亮 */
.msg-bubble .chat-ans strong.chat-key {
  font-weight: 700;
  color: #1c2430;
  background: rgba(255, 214, 64, 0.55);
  padding: 0.08em 0.28em;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
/* 小节标题：加粗、无黄底，紧贴下方 (1)(2) */
.msg-bubble .chat-ans strong.chat-sec {
  font-weight: 700;
  color: var(--text);
  background: transparent;
  padding: 0;
}
.msg-user .msg-bubble .chat-ans strong.chat-key {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}
.msg-user .msg-bubble .chat-ans strong.chat-sec {
  color: #fff;
  background: transparent;
}

/* ── 知识库 ── */
.center-panel .view#panel-browse {
  padding: 16px 20px;
  overflow-y: auto;
}
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar-search {
  flex: 1;
  min-width: 180px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
}
.toolbar-select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
  min-width: 110px;
}
.list { display: flex; flex-direction: column; gap: 6px; padding: 0 16px 16px; }
.k-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.k-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(0, 137, 255, 0.3);
}
/* 业务色改由右侧标签表达，左侧不再加色条，与文档行对齐 */
.k-item-head,
.script-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}
.k-item-main,
.script-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.k-item-primary,
.script-card-primary {
  display: contents;
}
.k-item-secondary,
.script-card-secondary {
  display: contents;
}
.k-item-title-row,
.script-card-title-row {
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(46vw, 520px);
  order: 1;
}
.k-item-meta,
.script-card-meta-inline {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 80px;
  order: 2;
}
.k-item-tags,
.script-tags {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
  order: 3;
}
.card-acts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  order: 4;
  margin-left: 4px;
}
.card-act,
.card-acts .share-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  box-shadow: none;
}
.card-act:hover,
.card-acts .share-btn:hover {
  background: var(--brand-light);
  color: var(--brand-deep);
}
.card-acts .fav-btn {
  margin-left: 0;
  width: 24px;
  height: 24px;
}
.k-item h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.k-item-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.k-item-tags {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}
.k-tag {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.25;
  border: 1px solid transparent;
}
.k-tag[data-kind="biz"][data-v="通用"] { color: #5b6472; border-color: #9aa3af; background: #f3f4f6; }
.k-tag[data-kind="biz"][data-v="手机卡"],
.k-tag[data-kind="biz"][data-v="号卡"] { color: #1d4ed8; border-color: #60a5fa; background: #eff6ff; }
.k-tag[data-kind="biz"][data-v="宽带"] { color: #0f766e; border-color: #2dd4bf; background: #f0fdfa; }
.k-tag[data-kind="biz"][data-v="WIFI"],
.k-tag[data-kind="biz"][data-v="wifi"] { color: #b45309; border-color: #fbbf24; background: #fffbeb; }
.k-tag[data-kind="biz"][data-v="电力"] { color: #c2410c; border-color: #fb923c; background: #fff7ed; }
.k-tag[data-kind="biz"][data-v="行政书士"],
.k-tag[data-kind="biz"][data-v="签证中心"] { color: #6d28d9; border-color: #c4b5fd; background: #f5f3ff; }
.k-tag[data-kind="biz"][data-v="保险"],
.k-tag[data-kind="biz"][data-v="车保险"],
.k-tag[data-kind="biz"][data-v="旅游保险"],
.k-tag[data-kind="biz"][data-v="房屋保险"] { color: #0e7490; border-color: #67e8f9; background: #ecfeff; }
.k-tag[data-kind="biz"][data-v="mobius"] { color: #1d4ed8; border-color: #93c5fd; background: #eff6ff; }
.k-tag[data-kind="biz"]:not([data-v="通用"]):not([data-v="手机卡"]):not([data-v="号卡"]):not([data-v="宽带"]):not([data-v="WIFI"]):not([data-v="wifi"]):not([data-v="电力"]):not([data-v="行政书士"]):not([data-v="签证中心"]):not([data-v="保险"]):not([data-v="车保险"]):not([data-v="旅游保险"]):not([data-v="房屋保险"]):not([data-v="mobius"]) {
  color: #475569; border-color: #cbd5e1; background: #eef4f7;
}
.k-item-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.k-item-body + .k-item-body { margin-top: 6px; }
.k-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-right: 2px;
}
.k-item.item-expanded h4,
#knowledge-list:not(.list-collapsed) .k-item h4,
#biz-library-list:not(.list-collapsed) .k-item h4 {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
.list-collapsed .k-item-head { margin-bottom: 0; }
.k-item-row {
  padding: 5px 10px;
}
.k-item-row .k-item-head { margin-bottom: 0; }
.list-collapsed .k-item-row.item-expanded .k-item-head,
#knowledge-list:not(.list-collapsed) .k-item-row .k-item-head,
#biz-library-list:not(.list-collapsed) .k-item-row .k-item-head {
  margin-bottom: 6px;
}
.list-collapsed .script-card-row.item-expanded .script-card-head,
#scripts-list:not(.list-collapsed) .script-card-row .script-card-head,
#biz-library-list:not(.list-collapsed) .script-card-row .script-card-head {
  margin-bottom: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 14px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn:hover { background: var(--surface-soft); border-color: var(--text-tertiary); }
.btn.primary {
  background: var(--accent);
  background-image: none;
  border: 1px solid var(--accent);
  color: #fff;
  box-shadow: none;
  filter: none;
  -webkit-appearance: none;
  appearance: none;
}
.btn.primary:hover {
  filter: none;
  background: var(--accent-hover);
  background-image: none;
  border-color: var(--accent-hover);
}
.btn.primary:active {
  background: var(--accent-active);
  background-image: none;
  border-color: var(--accent-active);
  box-shadow: none;
}
.btn.primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 137, 255, 0.28);
}
.btn-sm {
  height: 28px; padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font: inherit; font-size: 12px; cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}
.btn-sm.primary {
  background: #0089ff;
  border-color: #0089ff;
  color: #fff;
}
.btn-sm.primary:hover {
  background: #0078e6;
  border-color: #0078e6;
}
.btn-text { background: none; border: none; font: inherit; font-size: 14px; color: var(--brand); cursor: pointer; padding: 4px 8px; }
.link-btn { background: none; border: none; font: inherit; font-size: 13px; color: var(--text-secondary); cursor: pointer; padding: 6px 10px; border-radius: var(--radius); }
.link-btn:hover { color: var(--brand); background: var(--brand-light); }
.btn.ghost { background: transparent; }
.btn.danger, .btn-sm.danger { color: var(--danger); border-color: #fecaca; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.pager-info { font-size: 13px; color: var(--text-tertiary); }
.footer {
  text-align: center;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: none;
  background: transparent;
  flex-shrink: 0;
  margin-top: 0;
}
.footer-stats {
  display: inline-block;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}
.empty { color: var(--text-tertiary); font-size: 13px; padding: 12px 6px; text-align: center; }
.materials-search-empty {
  padding: 28px 16px !important;
}
.materials-search-empty-text {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.materials-search-empty .btn {
  margin: 0 auto;
}

/* ── Modal ── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 32, 51, 0.42);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: modalBg 0.2s var(--ease);
}
@keyframes modalBg {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal[hidden] { display: none !important; }
.modal-box {
  background: var(--surface);
  border-radius: 16px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: hidden;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(15, 32, 51, 0.18);
  border: 1px solid rgba(255,255,255,0.6);
  animation: modalIn 0.28s var(--ease);
}
.modal-box-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-lg { width: min(800px, 100%); }
/* 富文本详情弹框：更宽，便于完整看图 */
.modal-detail-rich {
  width: min(920px, 100%);
  max-height: min(92vh, 960px);
}
#modal-detail .detail-block-body.k-rich-content {
  white-space: normal;
}
#modal-detail .detail-block-body.k-rich-content img,
#modal-detail .detail-block-body.k-rich-content .image-text-tool > img {
  display: block !important;
  float: none !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  margin: 14px 0 !important;
}
#modal-detail .detail-block-body.k-rich-content .image-text-tool {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 100% !important;
  clear: both;
}
.modal-contribute-box {
  width: min(920px, 100%);
  max-height: min(92vh, 960px);
  overflow: hidden;
}
.modal-contribute-mount .materials-create-wizard {
  margin-top: 4px;
}
.modal-contribute-mount .mat-create-card {
  box-shadow: none;
}
.modal-sm { width: min(420px, 100%); }
.modal-pick { z-index: 280; }
.modal-over-admin { z-index: 280; }
.modal-admin-wrap {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}
.image-preview-modal {
  position: fixed;
  inset: 0;
  /* 须高于 .modal-over-admin(280)，否则管理后台聊天详情里点图会被挡住 */
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 48px 20px 88px;
  background: rgba(5, 12, 24, 0.82);
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.image-preview-modal[hidden] { display: none !important; }
.image-preview-modal.is-dragging { cursor: grabbing; }
.image-preview-stage {
  width: min(96vw, 1560px);
  height: min(84vh, 1040px);
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: 100%;
  place-items: center;
  overflow: hidden;
  touch-action: none;
}
.image-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,0.34);
  transform-origin: center center;
  transition: transform 0.05s linear;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}
.image-preview-img.is-zoomed {
  cursor: grab;
}
.image-preview-modal.is-dragging .image-preview-img.is-zoomed {
  cursor: grabbing;
}
.image-preview-close {
  position: fixed;
  top: 16px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.26);
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 262;
}
.image-preview-close:hover { background: rgba(255,255,255,0.2); }
.image-preview-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.26);
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 261;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.image-preview-nav:hover { background: rgba(255,255,255,0.22); }
.image-preview-prev { left: 16px; }
.image-preview-next { right: 16px; }
.image-preview-nav[hidden] { display: none !important; }
.image-preview-zoom {
  position: fixed;
  left: 50%;
  bottom: 52px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255,255,255,0.22);
  z-index: 270;
  max-width: calc(100vw - 24px);
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: auto;
}
.image-preview-zoom-btn,
.image-preview-zoom-label,
.image-preview-rotate-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  min-width: 36px;
  height: 32px;
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
  padding: 0 10px;
}
.image-preview-zoom-label {
  min-width: 56px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.92;
}
.image-preview-rotate-btn {
  min-width: 44px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.95;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.08);
}
.image-preview-zoom-btn:hover,
.image-preview-zoom-label:hover,
.image-preview-rotate-btn:hover {
  background: rgba(255,255,255,0.14);
}
.image-preview-toolbar-sep {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: rgba(255,255,255,0.28);
  flex-shrink: 0;
}
.image-preview-toolbar-sep[hidden] { display: none !important; }
.image-preview-text-tool.image-text-tool {
  display: inline-flex;
  width: auto;
  margin: 0;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.image-preview-text-tool[hidden] { display: none !important; }
.image-preview-text-tool .image-text-btn,
.image-preview-text-tool .image-text-redo {
  width: auto;
  min-width: 0;
  min-height: 28px;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1;
}
.image-preview-text-tool .image-text-btn:hover:not(:disabled),
.image-preview-text-tool .image-text-redo:hover:not(:disabled) {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}
.image-preview-text-tool .image-text-btn.is-result {
  background: rgba(255,255,255,0.92);
  border-color: transparent;
  color: #122033;
}
.image-preview-text-tool .image-text-progress {
  width: 48px;
  height: 4px;
  background: rgba(255,255,255,0.22);
  flex-shrink: 0;
}
.image-preview-text-tool .image-text-progress-fill {
  background: #fff;
}
.image-preview-text-tool .image-text-status {
  max-width: 140px;
  color: rgba(255,255,255,0.78);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.image-preview-text-tool[data-status="error"] .image-text-status {
  color: #ffb4a8;
}
.image-preview-meta {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.image-preview-counter {
  color: rgba(255,255,255,0.92);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,0.35);
  border-radius: 999px;
  padding: 2px 10px;
}
.image-preview-title {
  color: rgba(255,255,255,0.86);
  font-size: 13px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90vw;
}
/* 顶部居中提示，避免与底部缩放条挤在一起 */
.image-preview-hint {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80vw;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.78);
  font-size: 12px;
  text-align: center;
}
.image-preview-hint[hidden] { display: none; }
/* 知识列表/详情展开：完整比例预览，可直接辨认内容 */
.k-item-body .k-rich-content,
.detail-block-body.k-rich-content {
  display: block;
}
.k-item-body .k-rich-content img,
.detail-block-body.k-rich-content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: top center;
  margin: 10px 0 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  background: var(--surface-soft, #f3f6fa);
}
.k-rich-area img {
  cursor: zoom-in;
}
.k-rich-content .image-text-tool {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin: 10px 0 14px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.k-item-body .k-rich-content .image-text-tool > img,
.detail-block-body.k-rich-content .image-text-tool > img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0;
}
.k-item-body .k-rich-content .image-text-actions,
.detail-block-body.k-rich-content .image-text-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 420px;
}
.k-item-body .k-rich-content .image-text-actions,
.detail-block-body.k-rich-content .image-text-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: none;
}
.image-text-actions {
  display: flex;
  min-width: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.image-text-btn,
.image-text-redo {
  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  vertical-align: middle;
}
.image-text-btn {
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--accent);
}
.image-text-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
}
.image-text-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}
.image-text-btn.is-result {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.image-text-btn.is-result:hover:not(:disabled) {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}
.image-text-redo {
  border: 1px solid var(--border-strong, var(--border));
  background: #fff;
  color: var(--text-secondary, var(--muted));
}
.image-text-redo:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.image-text-redo:disabled {
  cursor: wait;
  opacity: 0.72;
}
.image-text-redo[hidden] { display: none !important; }
.image-text-progress {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--border);
}
.image-text-progress[hidden] { display: none; }
.image-text-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}
.image-text-status {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.image-text-tool[data-status="error"] .image-text-status {
  color: var(--danger, #b42318);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.modal-admin {
  width: min(1600px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  height: min(94vh, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}
.modal-admin * { min-width: 0; }
.modal-admin .modal-x { z-index: 2; }
.admin-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.admin-header .modal-title { margin: 0 0 4px; }
.admin-header .text-muted { margin: 0; }
.admin-login-wrap {
  padding: 24px;
  max-width: 400px;
  flex: 1;
  min-height: 0;
}
.admin-login-wrap[hidden],
.admin-shell[hidden] {
  display: none !important;
}

/* ── Admin shell: 侧栏 + 内容 ── */
.admin-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.admin-sidebar {
  background: var(--admin-sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  min-height: 0;
}
.admin-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 10px;
}
.admin-nav-group + .admin-nav-group {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.admin-nav-group-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--brand-deep);
  letter-spacing: 0.12em;
  padding: 2px 10px 8px;
  pointer-events: none;
  user-select: none;
}
.admin-nav {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 8px 10px 8px 14px;
  margin: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  position: relative;
}
.admin-nav:hover {
  background: var(--brand-light);
  color: var(--brand-deep);
}
.admin-nav.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand);
}
.admin-sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.admin-mobilebar {
  display: none;
}
.admin-mobile-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.admin-mobile-scroll::-webkit-scrollbar { display: none; }
.admin-mobile-nav-btn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.admin-mobile-nav-btn.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-deep);
}
.admin-mobile-nav-btn.admin-mobile-logout {
  color: var(--danger);
  border-color: #fecaca;
}
.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}
.admin-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 20px;
}
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.admin-editor-page {
  max-width: 720px;
}
/* 批量上传等宽表单：铺满管理主区，四字段可同行 */
.admin-editor-page:has(.doc-batch-form) {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}
.admin-editor-page .doc-batch-form.form-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  width: 100%;
  max-width: none;
}
.admin-editor-page .doc-batch-form.form-grid > .text-muted,
.admin-editor-page .doc-batch-form.form-grid > .doc-batch-toolbar,
.admin-editor-page .doc-batch-form.form-grid > .doc-batch-list,
.admin-editor-page .doc-batch-form.form-grid > .btn,
.admin-editor-page .doc-batch-form.form-grid > .doc-batch-file-label {
  grid-column: 1 / -1;
}
.admin-editor-page .doc-batch-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-form-panel .doc-batch-form.form-grid label:last-of-type {
  grid-column: 1 / -1;
}
.admin-toolbar-title {
  font-size: 15px;
  font-weight: 600;
  margin-right: auto;
}
.admin-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.admin-search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 200px;
}
.admin-search {
  width: 220px;
  max-width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}
.admin-search:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}
.admin-search-wrap .admin-search {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.admin-toolbar-head,
.admin-toolbar-filters {
  display: contents;
}
.admin-toolbar-count {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-right: auto;
}
.mat-media-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  min-width: 0;
}
.mat-media-row-label {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.mat-media-picks {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 0;
  overflow-x: auto;
}
.mat-media-pick {
  display: inline-flex;
  flex: 1 1 0;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 0;
  min-height: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.mat-media-pick:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.mat-media-pick.is-active {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}
.mat-media-pick-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.mat-media-pick-sub {
  display: none;
}
.mat-create-classify-with-vis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mat-create-vis {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.mat-create-vis-caption {
  line-height: 1.2;
}
.mat-create-vis-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
}
.mat-create-vis-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.materials-create-wizard {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 860px;
}
.mat-create-card {
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 14px;
  padding: 16px 18px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.mat-create-card-head {
  margin-bottom: 12px;
}
.mat-create-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #0f172a;
}
.mat-create-card-desc {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-tertiary);
}
.mat-create-classify {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}
.mat-create-classify-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mat-create-classify label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.mat-create-classify select {
  height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.mat-create-body-card .mat-create-body {
  min-height: 120px;
}
.mat-create-hint {
  margin: 0 0 4px !important;
  font-size: 12px !important;
  line-height: 1.5;
}
.mat-create-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  border: 1px dashed #dbe3ee;
  border-radius: 10px;
  background: #f8fafc;
}
.mat-create-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.materials-toolbar {
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  background: linear-gradient(180deg, #fcfdff 0%, #f7f9fc 100%);
  border-bottom: 1px solid #e8eef5;
}
.materials-toolbar .admin-toolbar-title {
  font-size: 16px;
  font-weight: 700;
  margin-right: 0;
}
.materials-toolbar .admin-toolbar-count {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  margin-right: auto;
  border-radius: 999px;
  background: #eef2f7;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}
.materials-new-btn {
  min-width: 88px;
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18);
}
.materials-table-wrap {
  border: 1px solid #e8eef5;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.materials-table-wrap .admin-table {
  margin: 0;
}
.materials-table-wrap .admin-table thead th {
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  border-bottom: 1px solid #e8eef5;
}
.materials-table-wrap .admin-col-check {
  width: 28px;
  padding-left: 10px !important;
  padding-right: 4px !important;
  text-align: center;
  vertical-align: middle;
}
.materials-table-wrap .admin-col-sort {
  width: 80px;
  min-width: 80px;
  padding-left: 6px !important;
  padding-right: 6px !important;
  text-align: center;
  vertical-align: middle;
}
.admin-table th.admin-col-sort,
.admin-table td.admin-col-sort {
  width: 80px;
  min-width: 80px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
.materials-table-wrap .admin-col-check input,
.materials-batch-bar input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: #2563eb;
}
.materials-batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: -6px 0 12px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
}
.materials-batch-bar[hidden] {
  display: none !important;
}
.materials-batch-count {
  font-size: 13px;
  color: #1e3a8a;
}
.materials-batch-count b {
  font-variant-numeric: tabular-nums;
}
.admin-editor-page:has(.materials-create-wizard) {
  max-width: 880px;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}
.admin-editor-page .materials-create-wizard > .mat-create-card .form-grid.mat-create-form {
  display: grid;
  gap: 12px;
}
@media (max-width: 720px) {
  .mat-create-classify,
  .mat-create-classify-with-vis {
    grid-template-columns: 1fr;
  }
  .mat-media-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .mat-media-picks {
    flex-wrap: wrap;
  }
  .mat-media-pick {
    flex: 1 1 calc(33.33% - 6px);
  }
  .materials-new-btn {
    margin-left: 0;
    width: 100%;
  }
}
.admin-toolbar-more {
  position: relative;
}
.admin-toolbar-more-sum {
  list-style: none;
  cursor: pointer;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
}
.admin-toolbar-more-sum::-webkit-details-marker { display: none; }
.admin-toolbar-more-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 160px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(42, 63, 95, 0.14);
  flex-direction: column;
  gap: 6px;
}
.admin-toolbar-more[open] .admin-toolbar-more-panel {
  display: flex;
}
.admin-toolbar-more-panel .btn,
.admin-toolbar-more-panel a.btn,
.admin-toolbar-more-panel label.btn {
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}
.admin-act-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  gap: 6px;
}
.admin-act-sum {
  display: none;
  list-style: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.admin-act-panel {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  vertical-align: middle;
}
.admin-row-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
}
.admin-row-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.admin-row-sub {
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.admin-vis-label { display: none; }
.admin-tags-panel summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
}
.admin-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  background: #f2f6fb;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  vertical-align: middle;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.4;
  background: var(--surface);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td {
  background: #eef4fb;
}
.admin-table .col-question { min-width: 280px; max-width: 480px; }
.admin-table .admin-chat-col-name,
.admin-table .admin-chat-col-time {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-table .col-actions {
  white-space: nowrap;
  width: 1%;
  vertical-align: middle;
  text-align: right;
}
.admin-table th.col-actions {
  text-align: right;
}
.admin-table .admin-col-vis,
.admin-table th.admin-col-vis {
  text-align: center;
  width: 64px;
}
/* 「查看」次数列（紧挨显示开关）居中对齐 */
.admin-table td.admin-col-desk:has(+ td.admin-col-vis) {
  text-align: center;
  font-variant-numeric: tabular-nums;
  width: 56px;
}
.admin-table thead tr:has(th.admin-col-vis) th:nth-last-child(3) {
  text-align: center;
}
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table td,
.admin-table th {
  max-width: 520px;
}
.admin-table td:not(.col-actions),
.admin-table th:not(.col-actions) {
  overflow-wrap: anywhere;
}
.ai-model-table td code { font-size: 12px; }

/* 操作列：td 必须保持 table-cell，否则行 hover 背景断裂、边框错位 */
.admin-table td.col-actions,
.admin-table td.col-actions.admin-actions {
  display: table-cell;
  vertical-align: middle;
  text-align: right;
}
.admin-table td.col-actions.admin-actions > .admin-act-menu,
.admin-table td.col-actions.admin-actions > .admin-feature-btn,
.admin-table td.col-actions.admin-actions > .admin-premium-btn,
.admin-table td.col-actions.admin-actions > .btn-sm,
.admin-table td.col-actions.admin-actions > a.btn-sm {
  vertical-align: middle;
  margin-left: 6px;
}
.admin-table td.col-actions.admin-actions > .admin-act-menu:first-child,
.admin-table td.col-actions.admin-actions > .btn-sm:first-child,
.admin-table td.col-actions.admin-actions > a.btn-sm:first-child,
.admin-table td.col-actions.admin-actions > .admin-feature-btn:first-child,
.admin-table td.col-actions.admin-actions > .admin-premium-btn:first-child {
  margin-left: 0;
}

.admin-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}
.admin-table .col-actions .admin-actions:not(td) {
  display: inline-flex;
}
.admin-actions .admin-act-menu,
.admin-actions .admin-feature-btn,
.admin-actions .admin-premium-btn,
.admin-actions .btn-sm {
  flex-shrink: 0;
}

/* 管理表操作按钮：方圆角实心底，避免细边框胶囊的廉价感 */
.admin-table .btn-sm,
.admin-act-panel .btn-sm,
.admin-act-panel a.btn-sm {
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #eef2f7;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 550;
  line-height: 1;
  box-shadow: none;
  text-decoration: none;
}
.admin-table .btn-sm:hover,
.admin-act-panel .btn-sm:hover,
.admin-act-panel a.btn-sm:hover {
  background: #e2e9f2;
  color: var(--text);
  border-color: transparent;
}
.admin-table .btn-sm.primary,
.admin-act-panel .btn-sm.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.admin-table .btn-sm.primary:hover,
.admin-act-panel .btn-sm.primary:hover {
  background: #0078e6;
  border-color: #0078e6;
  color: #fff;
}
.admin-table .btn-sm.danger,
.admin-act-panel .btn-sm.danger {
  background: #fff1f0;
  border-color: transparent;
  color: var(--danger);
}
.admin-table .btn-sm.danger:hover,
.admin-act-panel .btn-sm.danger:hover {
  background: #ffe4e1;
  color: #912018;
}
.admin-feature-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eef2f7;
}
.admin-feature-btn:hover {
  color: var(--brand);
  border-color: transparent;
  background: #e6f4ff;
}
.admin-feature-btn.is-on {
  color: #fff;
  border-color: transparent;
  background: #f59e0b;
  box-shadow: none;
}
.admin-feature-btn.is-on:hover {
  color: #fff;
  border-color: transparent;
  background: #d97706;
}
.admin-premium-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eef2f7;
}
.admin-premium-btn:hover {
  color: #dc2626;
  border-color: transparent;
  background: #fee2e2;
}
.admin-premium-btn.is-on {
  color: #fff;
  border-color: transparent;
  background: #dc2626;
  box-shadow: none;
}
.admin-premium-btn.is-on:hover {
  color: #fff;
  border-color: transparent;
  background: #b91c1c;
}
.admin-actions-nowrap {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  vertical-align: middle;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 22px;
  transition: background .2s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.switch input:checked + .switch-slider { background: var(--brand); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.switch input:focus-visible + .switch-slider { box-shadow: 0 0 0 3px var(--brand-light); }
.admin-section-title {
  font-size: 14px;
  font-weight: 600;
  margin: 14px 0 8px;
  color: var(--text-secondary);
}
.admin-section-title:first-child { margin-top: 0; }
.admin-form-panel > .admin-section-title:first-child {
  margin-top: 0;
}

/* ── 使用分析 ── */
.analytics-days { font-size: 13px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.analytics-range-filters { align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.analytics-range-hint { font-size: 12px; align-self: center; }
.analytics-days select {
  height: 32px; padding: 0 8px; border: 1px solid var(--border-strong);
  border-radius: 8px; font: inherit; background: #fff;
}
.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.analytics-kpi {
  background: linear-gradient(180deg, #eef1f5 0%, #fff 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}
.analytics-kpi-val { font-size: 22px; font-weight: 700; color: var(--brand-deep); line-height: 1.2; }
.analytics-kpi-label { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.analytics-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  margin-bottom: 14px;
}
.analytics-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 220px;
}
.analytics-panel-head { margin-bottom: 12px; }
.analytics-panel-head h4,
.analytics-top-card h4,
.analytics-drill-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-deep);
}
.analytics-panel-desc {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
}
.analytics-action-list { display: flex; flex-direction: column; gap: 6px; }
.analytics-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px 10px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: border-color .12s, background .12s;
}
.analytics-action-row:hover {
  border-color: var(--border-strong);
  background: #fff;
}
.analytics-action-row.is-active {
  border-color: var(--brand);
  background: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}
.analytics-side-panel { display: flex; flex-direction: column; }
.analytics-side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.analytics-side-rank {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}
.analytics-side-rank-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}
.analytics-side-rank-row.has-action {
  grid-template-columns: 28px 1fr;
  align-items: start;
}
.analytics-side-rank-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.analytics-side-rank-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.analytics-side-rank-action {
  grid-column: 2;
  display: flex;
  justify-content: flex-start;
}
.analytics-side-rank-idx {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--brand-light);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.analytics-side-rank-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.analytics-side-rank-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-deep);
}
.analytics-side-recent {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}
.analytics-side-recent-row {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}
.analytics-side-recent-title {
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analytics-side-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  padding: 4px 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.analytics-side-item:hover .analytics-drill-title { color: var(--brand); }
.analytics-action-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.analytics-action-hint {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-tertiary);
}
.analytics-action-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 64px;
}
.analytics-action-count {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-deep);
  line-height: 1;
}
.analytics-action-bar {
  width: 64px;
  height: 4px;
  border-radius: 999px;
  background: #e4e9f0;
  overflow: hidden;
}
.analytics-action-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4a6a94, var(--brand));
  border-radius: 999px;
  min-width: 2px;
}
.analytics-trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 180px;
  padding: 4px 2px 0;
  overflow-x: auto;
}
.analytics-trend-col {
  flex: 1 0 22px;
  min-width: 22px;
  max-width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 180px;
}
.analytics-trend-val {
  font-size: 10px;
  color: var(--text-tertiary);
  line-height: 1;
  min-height: 12px;
  text-align: center;
}
.analytics-trend-val i {
  display: block;
  font-style: normal;
  font-size: 9px;
  color: var(--brand-mid);
  margin-top: 1px;
}
.analytics-trend-bar {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: #eef1f5;
  border-radius: 6px 6px 2px 2px;
  overflow: hidden;
  min-height: 80px;
}
.analytics-trend-bar > span {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #6a87ad, var(--brand));
  border-radius: 6px 6px 2px 2px;
  min-height: 2px;
}
.analytics-trend-lab {
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
  transform: scale(0.92);
}
.analytics-user-rank-panel {
  margin-bottom: 14px;
}
.analytics-user-rank-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.analytics-user-rank-total {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-tertiary);
  padding-top: 2px;
}
.analytics-user-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  max-height: none;
  overflow: visible;
}
.analytics-user-rank-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}
.analytics-user-rank-toggle {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.analytics-user-rank-toggle.is-static { cursor: default; }
.analytics-user-rank-item.is-open {
  border-color: var(--brand);
  background: #fff;
}
.analytics-user-rank-item.is-open .analytics-user-rank-toggle {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}
.analytics-user-rank-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.analytics-user-rank-caret {
  color: var(--text-tertiary);
  font-size: 12px;
  transition: transform .12s;
}
.analytics-user-rank-item.is-open .analytics-user-rank-caret {
  transform: rotate(180deg);
}
.analytics-user-rank-detail {
  padding: 0 12px 12px;
}
.analytics-user-type-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.analytics-user-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  color: inherit;
  cursor: pointer;
}
.analytics-user-type-chip:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}
.analytics-user-type-chip b {
  color: var(--brand-deep);
  font-weight: 700;
}
.analytics-person-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.analytics-person-row:hover {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}
.analytics-side-item-inline {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.analytics-bars { display: flex; flex-direction: column; gap: 6px; }
.analytics-bar-row {
  display: grid;
  grid-template-columns: 88px 1fr 40px;
  gap: 8px;
  align-items: center;
  border: none;
  background: none;
  padding: 2px 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.analytics-bar-row.static { cursor: default; }
.analytics-bar-row:not(.static):hover .analytics-bar-label { color: var(--brand); }
.analytics-bar-label { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analytics-bar-track {
  height: 8px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
}
.analytics-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4a6a94, var(--brand));
  border-radius: 999px;
  min-width: 2px;
}
.analytics-bar-count { font-size: 12px; font-weight: 600; color: var(--text); text-align: right; }
.analytics-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.analytics-top-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.analytics-top-list { margin: 0; padding-left: 18px; }
.analytics-top-list li { margin: 0 0 4px; }
.analytics-drill {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  padding: 4px 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.analytics-drill:hover .analytics-drill-title { color: var(--brand); }
.analytics-drill-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.analytics-drill-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-deep);
  background: var(--brand-light);
  border-radius: 999px;
  padding: 1px 8px;
}
.analytics-drill-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 12px 14px 16px;
  margin-bottom: 8px;
}
.analytics-drill-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.analytics-sid { font-size: 11px; color: var(--text-tertiary); }
.analytics-rank-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin-bottom: 14px;
}
.analytics-recent-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin-bottom: 14px;
}
.analytics-rank-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.analytics-rank-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-deep);
}
.analytics-drill.linkish {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--brand);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.analytics-drill.linkish:hover { text-decoration: underline; }
.rank-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.rank-status.rank-ok { color: #166534; background: #dcfce7; }
.rank-status.rank-warn { color: #9a5a18; background: #fff1e0; }
.rank-status.rank-miss { color: #6b778c; background: #eef1f5; }
@media (max-width: 1100px) {
  .analytics-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analytics-grid { grid-template-columns: 1fr; }
}

.admin-form-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.admin-form-panel .form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.admin-form-panel .form-grid label:last-of-type,
.admin-form-panel .form-grid button { grid-column: 1 / -1; }
.admin-form-panel .form-grid label.admin-check-label {
  flex-direction: row;
  align-items: center;
  grid-column: auto;
}
.admin-member-create {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-member-create-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.admin-member-create-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.admin-member-create-fields input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit;
  background: var(--surface);
  width: 100%;
  box-sizing: border-box;
}
.admin-member-create-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-member-admin-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.admin-member-admin-switch .switch {
  flex-shrink: 0;
}
.admin-member-create-actions .btn {
  width: fit-content;
  min-width: 96px;
}
.hint { color: var(--text-tertiary); font-size: 12px; margin-top: 2px; }
.modal-x {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 30;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 32, 51, 0.08);
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
  color: var(--text-tertiary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 32, 51, 0.08);
}
.modal-x:hover {
  color: var(--text);
  background: #fff;
}
.modal-title { margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.text-muted { color: var(--text-tertiary); font-size: 13px; margin: -8px 0 16px; }

.seg-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 16px; background: var(--bg);
  border-radius: var(--radius); padding: 4px;
}
.feedback-status-tabs { margin: 0 0 14px; }
.seg-tab, .subtab {
  background: none; border: none; border-radius: 6px;
  padding: 6px 12px; font: inherit; font-size: 13px;
  color: var(--text-secondary); cursor: pointer;
}
.seg-tab.active, .subtab.active {
  background: var(--surface); color: var(--text);
  font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.contrib-panel { display: none; }
.contrib-panel.active { display: block; }

.doc-batch-form .doc-batch-hint { margin: 0 0 8px; font-size: 13px; line-height: 1.45; }
.doc-batch-defaults {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fafc;
}
.doc-batch-defaults-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}
.doc-batch-defaults-wide {
  grid-column: 1 / -1;
}
.doc-batch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(62vh, 720px);
  overflow: auto;
  padding: 2px;
}
.doc-batch-empty {
  padding: 14px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  font-size: 13px;
}
.doc-batch-file-label {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.doc-batch-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100% !important;
  min-height: 100%;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.doc-batch-file-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 108px;
  padding: 18px 16px;
  border: 1px dashed rgba(0, 137, 255, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, #f7fbff 0%, #fff 70%);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.doc-batch-file-label:hover .doc-batch-file-card,
.doc-batch-file-label:focus-within .doc-batch-file-card,
.doc-batch-file-label.is-dragover .doc-batch-file-card {
  border-color: #0089ff;
  background: linear-gradient(180deg, #eef7ff 0%, #fff 72%);
  box-shadow: 0 0 0 3px rgba(0, 137, 255, 0.1);
}
.doc-batch-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: #0089ff;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}
.doc-batch-file-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.doc-batch-file-desc {
  max-width: 420px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.doc-batch-file-count {
  font-size: 12px;
  font-weight: 600;
  color: #0369a1;
  line-height: 1.3;
}
.doc-batch-file-count.is-selected {
  color: #0b6bcb;
}
.admin-file-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.admin-file-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #646a73);
  line-height: 1.3;
}
.admin-file-picker {
  display: block;
}
.admin-file-picker-card {
  min-height: 96px;
  padding: 16px;
}
.admin-editor-page .form-grid .admin-file-field,
.admin-form-panel .form-grid .admin-file-field {
  grid-column: 1 / -1;
}
/* 避免 form-grid 把文件选择区当成普通输入框描边 */
.form-grid label.admin-file-picker,
.form-grid .admin-file-picker {
  gap: 0;
  color: inherit;
}
.doc-batch-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.doc-batch-row-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}
.doc-batch-row-line .doc-batch-name,
input.doc-batch-name {
  flex: 1 1 160px;
  min-width: 120px;
  width: auto;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  box-sizing: border-box;
}
.doc-batch-row-line .doc-batch-name:focus,
input.doc-batch-name:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 137, 255, 0.15);
}
.doc-batch-row-line select {
  flex: 0 1 108px;
  width: 108px;
  min-width: 88px;
  height: 32px;
  font-size: 13px;
  box-sizing: border-box;
}
.doc-batch-row-line .doc-batch-sort {
  flex: 0 0 64px;
  width: 64px;
  min-width: 56px;
  height: 32px;
  padding: 0 6px;
  font-size: 13px;
  box-sizing: border-box;
}
.doc-batch-size {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.doc-batch-row-line .doc-batch-remove {
  flex: 0 0 auto;
}
.doc-batch-desc,
input.doc-batch-desc {
  width: 100%;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft, #f7f9fc);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  box-sizing: border-box;
}
.doc-batch-desc:focus,
input.doc-batch-desc:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0, 137, 255, 0.12);
}
.admin-row-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 400;
}
.browse-card-desc {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.doc-batch-status {
  font-size: 12px;
  line-height: 1.35;
}
.doc-batch-status.is-pending { color: var(--text-secondary); }
.doc-batch-status.is-ok { color: #067647; }
.doc-batch-status.is-err { color: #b42318; }

@media (max-width: 1100px) {
  .admin-editor-page .doc-batch-form.form-grid,
  .doc-batch-defaults-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .doc-batch-row-line {
    flex-wrap: wrap;
  }
  .doc-batch-row-line .doc-batch-name {
    flex: 1 1 100%;
  }
  .doc-batch-row-line select {
    flex: 1 1 30%;
    width: auto;
  }
}
@media (max-width: 560px) {
  .admin-editor-page .doc-batch-form.form-grid,
  .doc-batch-defaults-grid {
    grid-template-columns: 1fr;
  }
}

.form, .form-grid { display: flex; flex-direction: column; gap: 12px; }
.form label, .form-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: var(--text-secondary);
}
.form input, .form select, .form textarea,
.form-grid input, .form-grid select, .form-grid textarea,
.form-row input, .form-inline input {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit; background: var(--surface);
}
.form textarea, .form-grid textarea { height: auto; padding: 10px 12px; resize: vertical; }
.form-row, .form-inline { display: flex; gap: 8px; }
.form-row input, .form-inline input { flex: 1; }

/* 知识录入表单 */
form.knowledge-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.k-form-section {
  background: linear-gradient(180deg, #eef1f5 0%, #f5f7fa 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 16px;
}
.k-form-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-deep);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.k-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.k-form-span-2 { grid-column: 1 / -1; }
.k-form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.k-form-section label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.k-form-section input,
.k-form-section select,
.k-form-section textarea {
  margin-top: 2px;
  background: #fff;
}
.k-form-section textarea {
  min-height: 88px;
  line-height: 1.55;
}
.k-rich-label { display: block; }
.k-rich-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--text-secondary);
}
.k-rich-field-title {
  font-size: 13px;
  color: var(--text-secondary);
}
.k-rich-editor {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  margin-top: 2px;
}
.k-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft, #f5f7fb);
}
.k-rich-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}
.k-rich-btn:hover {
  background: #fff;
  border-color: var(--border);
}
.k-rich-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 2px;
}
.k-rich-area {
  min-height: 110px;
  max-height: 360px;
  overflow: auto;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.55;
  outline: none;
  color: var(--text);
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}
.k-rich-area:focus {
  box-shadow: inset 0 0 0 1px rgba(0, 137, 255, 0.35);
}
.k-rich-area.is-uploading {
  opacity: 0.72;
}
.k-rich-area img,
.k-rich-content img {
  display: block;
  max-width: min(100%, 520px);
  height: auto;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}
/* 列表/详情展开：可读大图（编辑器仍用上方默认） */
.k-item-body .k-rich-content img,
.detail-block-body.k-rich-content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: top center;
  margin: 10px 0 6px;
  border-radius: 10px;
  background: var(--surface-soft, #f3f6fa);
}
.k-rich-area.is-empty:before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
}
.k-rich-area ul,
.k-rich-content ul {
  margin: 0.35em 0 0.35em 1.2em;
  padding: 0;
  list-style: disc;
}
.k-rich-area ol,
.k-rich-content ol {
  margin: 0.35em 0 0.35em 1.2em;
  padding: 0;
  list-style: decimal;
}
.k-rich-area p,
.k-rich-content p {
  margin: 0 0 0.4em;
}
.k-rich-area a,
.k-rich-content a {
  color: var(--brand-deep, #1d4f91);
  text-decoration: underline;
}
.k-rich-content {
  display: block;
  white-space: normal;
  word-break: break-word;
}
.k-item-body .k-rich-content {
  margin-top: 2px;
}
.detail-block-body.k-rich-content {
  white-space: normal;
}
.k-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}
.k-form-actions .btn {
  min-width: 96px;
}
@media (max-width: 640px) {
  .k-form-grid { grid-template-columns: 1fr; }
  .k-form-span-2 { grid-column: auto; }
  .k-form-actions { justify-content: stretch; }
  .k-form-actions .btn { width: 100%; }
  /* 管理端编辑页保持紧凑，不把提交钮撑满屏 */
  .admin-editor-page .k-form-grid { grid-template-columns: 1fr 1fr; }
  .admin-editor-page .k-form-span-2 { grid-column: 1 / -1; }
  .admin-editor-page .k-form-actions { justify-content: flex-end; }
  .admin-editor-page .k-form-actions .btn { width: auto; }
}

.admin-page-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
}
.admin-inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-inline-fields input[type="number"] {
  width: 96px;
}
.ai-provider-form {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 10px;
}
.admin-actions-wrap {
  flex-wrap: wrap;
  white-space: normal;
}
.admin-chat-card-actions {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}
.admin-chat-card-actions .btn-sm {
  white-space: nowrap;
}
.admin-toolbar-status {
  margin-left: auto;
}

.dept-cat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dept-orphan-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dept-orphan-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.dept-orphan-name {
  font-size: 13px;
  font-weight: 600;
  min-width: 160px;
}
.dept-orphan-row select {
  min-width: 180px;
  height: 34px;
}
.dept-cat-card {
  margin: 0;
  padding: 14px 16px;
}
.dept-cat-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.dept-cat-l1 {
  flex: 1;
  margin: 0;
}
.dept-cat-card textarea {
  width: 100%;
  min-height: 88px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.detail-block { margin-top: 16px; }
.detail-block-label { font-size: 12px; font-weight: 500; color: var(--text-tertiary); margin-bottom: 4px; }
.detail-block-body { font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.rate-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.rate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  background: #fff;
}
.rate-icon {
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rate-svg {
  width: 14px;
  height: 14px;
  display: block;
}
.rate-label { font-size: 12px; }
.rate-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-deep);
  min-width: 1ch;
  font-variant-numeric: tabular-nums;
}
.rate-btn.rate-useful .rate-icon { color: #e11d48; }
.rate-btn.rate-useless .rate-icon { color: #94a3b8; }
.rate-btn.rate-wrong .rate-icon { color: #64748b; }
.rate-btn.rate-useful:hover { border-color: #fda4af; background: #fff1f2; }
.rate-btn.rate-useless:hover { border-color: #cbd5e1; background: #f8fafc; }
.rate-btn.rate-wrong:hover { border-color: #cbd5e1; background: #f8fafc; }

@media (max-width: 1024px) {
  .page-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    padding: 0;
    overflow: visible;
  }
  .page-layout > .nav-tabs {
    grid-column: 1;
    grid-row: 1;
    border-radius: 0;
  }
  .page-layout > .center-panel {
    grid-column: 1;
    grid-row: 2;
  }
  .page-layout > .side-right {
    grid-column: 1;
    grid-row: 3;
  }
  .side-left { display: none; }
  .side-right {
    border-radius: 0;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--header-line);
    background: var(--panel-grad);
    max-height: 280px;
  }
  .side-right .side-body,
  .side-right .side-body-unified {
    height: 100%;
    max-height: 280px;
  }
  .center-panel { min-height: 60vh; height: auto; border-radius: 0; overflow: visible; border-right: 1px solid rgba(154, 168, 187, 0.5); }
}

/* 聊天记录：桌面用表，无线用卡片（须写在 ≤900px 规则之前，避免被后面盖掉） */
.admin-chat-cards { display: none; }

@media (max-width: 900px) {
  .modal-admin-wrap {
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
  }
  .modal-admin {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
  }
  .admin-header {
    padding: calc(10px + env(safe-area-inset-top, 0)) 44px 8px 12px;
  }
  .admin-header .modal-title { font-size: 15px; margin-bottom: 0; }
  .admin-header .text-muted { display: none; }
  .admin-shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    min-height: 0;
    overflow: hidden;
  }
  .admin-mobilebar {
    display: block;
    padding: 6px 0 6px 8px;
    border-bottom: 1px solid var(--border);
    background: rgba(247, 248, 250, 0.98);
    flex: 0 0 auto;
  }
  .admin-mobile-scroll { padding: 0 8px 0 0; gap: 4px; }
  .admin-mobile-nav-btn {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 8px;
  }
  .admin-sidebar { display: none; }
  .admin-main { flex: 1 1 auto; min-height: 0; }
  .admin-body {
    padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0));
  }
  .admin-form-panel .form-grid { grid-template-columns: 1fr; }

  /* 新建/编辑资料页：紧凑表单 */
  .admin-editor-toolbar {
    margin-bottom: 6px;
    padding-bottom: 6px;
  }
  .admin-editor-toolbar .admin-toolbar-head {
    gap: 6px;
  }
  .admin-editor-toolbar #admin-editor-back {
    width: auto;
    flex: 0 0 auto;
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }
  .admin-editor-page {
    max-width: 100%;
    padding: 8px 10px !important;
    margin-bottom: 8px;
  }
  .admin-editor-page .text-muted {
    margin: 6px 0 0;
    font-size: 12px;
  }
  form.knowledge-form {
    gap: 8px;
  }
  .admin-editor-page .k-form-section {
    padding: 8px 10px 10px;
    border-radius: 8px;
  }
  .admin-editor-page .k-form-section-title {
    margin-bottom: 6px;
    font-size: 11px;
    letter-spacing: 0.04em;
  }
  .admin-editor-page .k-form-grid,
  .admin-editor-page .k-form-stack {
    gap: 8px;
  }
  .admin-editor-page .k-form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .admin-editor-page .k-form-span-2 {
    grid-column: 1 / -1;
  }
  .admin-editor-page .k-form-section label,
  .admin-editor-page .form-grid label,
  .admin-editor-page form.knowledge-form label {
    font-size: 12px;
    gap: 2px;
  }
  .admin-editor-page .k-form-section input,
  .admin-editor-page .k-form-section select,
  .admin-editor-page .form-grid input,
  .admin-editor-page .form-grid select,
  .admin-editor-page form input,
  .admin-editor-page form select {
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
    margin-top: 0;
  }
  .admin-editor-page .k-form-section textarea,
  .admin-editor-page .form-grid textarea,
  .admin-editor-page form textarea {
    padding: 6px 8px;
    font-size: 13px;
    min-height: 64px;
    line-height: 1.45;
  }
  .admin-editor-page .k-form-actions {
    padding-top: 0;
    justify-content: flex-end;
  }
  .admin-editor-page .k-form-actions .btn,
  .admin-editor-page .form-grid > .btn,
  .admin-editor-page form > .btn {
    width: auto !important;
    min-width: 88px;
    height: 32px;
    padding: 0 14px;
    font-size: 13px;
  }
  .admin-editor-page .admin-check-label {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    line-height: 1.35;
  }
  .admin-editor-page .form-grid {
    gap: 8px !important;
  }

  /* 工具栏：标题+主按钮一行，筛选搜索一行，不把每个按钮撑满屏 */
  .admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }
  .admin-toolbar-head {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .admin-toolbar-title {
    flex: 1;
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
  }
  .admin-toolbar-count { margin-right: 0; }
  .admin-toolbar-head .btn.primary,
  .admin-toolbar-head > .btn.primary {
    width: auto;
    flex: 0 0 auto;
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
  }
  .admin-toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    width: 100%;
  }
  .admin-toolbar-filters > .admin-filter-select,
  .admin-toolbar-filters > .toolbar-select,
  .admin-toolbar-filters > .admin-filter-input,
  .admin-toolbar-filters > .toolbar-input {
    width: auto;
    max-width: none;
    flex: 1 1 96px;
    min-width: 0;
    height: 32px;
    font-size: 12px;
  }
  .admin-search-wrap {
    flex: 1 1 140px;
    min-width: 0;
  }
  .admin-search-wrap .admin-search {
    height: 32px;
    font-size: 12px;
  }
  .admin-search-btn,
  #admin-search-btn,
  #chat-rec-filter {
    width: auto !important;
    flex: 0 0 auto;
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }
  .admin-toolbar-more { margin-left: auto; }
  .admin-toolbar-more-sum { height: 30px; font-size: 12px; padding: 0 10px; }
  .admin-toolbar > .btn:not(.primary),
  .admin-toolbar > a.btn,
  .admin-toolbar > label.btn,
  .admin-toolbar > select,
  .admin-toolbar > input {
    width: auto;
    flex: 0 1 auto;
  }

  /* 列表：卡片行，信息完整，操作收进 ⋯ */
  .admin-table-wrap {
    border: none;
    background: transparent;
    overflow: visible;
    border-radius: 0;
  }
  .admin-table.admin-table-compact,
  .admin-table {
    min-width: 0 !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
  }
  .admin-table thead { display: none; }
  .admin-table tbody { display: block; }
  .admin-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    align-items: start;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    box-shadow: 0 1px 2px rgba(42, 63, 95, 0.04);
  }
  .admin-table tr:hover td { background: transparent; }
  .admin-table td {
    display: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: none !important;
    background: transparent !important;
    vertical-align: top;
  }
  .admin-table td.admin-col-main,
  .admin-table td.col-question.admin-col-main,
  .admin-table td.col-question:not(.admin-col-desk) {
    display: block !important;
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .admin-table td.col-actions {
    display: flex !important;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-items: flex-start;
    justify-content: flex-end;
    width: auto !important;
    white-space: normal;
  }
  .admin-table tr:not(:has(td.col-actions)) {
    grid-template-columns: 1fr;
  }
  .admin-table tr:has(td.empty) {
    display: block;
    padding: 14px 10px;
    text-align: center;
  }
  .admin-table td.empty {
    display: block !important;
  }
  .admin-table td.admin-col-vis {
    display: inline-flex !important;
    grid-column: 1;
    grid-row: 2;
    align-items: center;
    gap: 6px;
    padding-top: 2px !important;
  }
  .admin-vis-label {
    display: inline;
    font-size: 11px;
    color: var(--text-tertiary);
  }
  .admin-act-sum {
    display: inline-flex;
  }
  .admin-act-menu:not(.is-open) > .admin-act-panel {
    display: none !important;
  }
  .admin-act-menu.is-open > .admin-act-panel {
    display: flex !important;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 112px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(42, 63, 95, 0.16);
  }
  .admin-act-panel .btn-sm,
  .admin-act-panel a.btn-sm {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }
  .admin-row-title { font-size: 13px; }
  .admin-row-meta { font-size: 11px; }
  .admin-row-sub { font-size: 11px; -webkit-line-clamp: 2; }

  .admin-chat-table-wrap { display: none !important; }
  .admin-chat-cards {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
  }
  .admin-chat-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 8px 10px;
  }
  .admin-chat-card-main { min-width: 0; }
  .admin-chat-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
  }
  .admin-chat-card .admin-act-menu { grid-column: 2; grid-row: 1; }
  .admin-chat-card-actions {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }
  .chat-record-meta-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .admin-intent-chip { max-width: 120px; font-size: 11px; padding: 1px 6px; }
  .admin-flag-chip { font-size: 10px; }
  .admin-tags-panel { padding: 10px; margin-bottom: 8px; }
  .admin-tags-panel summary { margin-bottom: 8px; font-size: 13px; }

  /* 系统页：KPI / 分析 / 业务类型 / 表单 */
  .token-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }
  .token-kpi { padding: 10px; border-radius: 10px; }
  .token-kpi .v { font-size: 18px; }
  .analytics-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .analytics-kpi { padding: 10px 8px; }
  .analytics-kpi-val { font-size: 18px; }
  .analytics-grid,
  .analytics-top-grid { grid-template-columns: 1fr; }
  .analytics-panel,
  .analytics-rank-panel,
  .analytics-recent-panel,
  .analytics-drill-panel {
    padding: 10px;
    border-radius: 10px;
  }
  .analytics-days {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
  }
  .analytics-days select,
  .analytics-days .toolbar-select {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
  }
  .analytics-trend-chart {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .analytics-action-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .analytics-action-right { min-width: 0; align-items: stretch; }
  .analytics-action-bar { width: 100%; }
  .analytics-side-rank-title,
  .analytics-side-recent-title,
  .analytics-drill-title {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .dept-cat-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .dept-cat-head .btn-sm,
  .dept-cat-head .btn {
    width: fit-content;
    align-self: flex-end;
  }
  .dept-cat-card { padding: 10px 12px; }
  .admin-page-hint { margin-bottom: 10px; }
  .admin-inline-fields input[type="number"] { width: 88px; }
  .ai-provider-form { grid-template-columns: 1fr !important; }
  .admin-toolbar-status {
    margin-left: 0;
    width: 100%;
    font-size: 11px !important;
  }
  .admin-col-actions-stack .admin-actions,
  .admin-actions-wrap {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .header-version { font-size: 10px; }
  .toolbar { flex-direction: column; }
  .toolbar-search, .toolbar-select { width: 100%; }
  .msg { max-width: 95%; }
}

/* ── 管理登录卡片 ── */
.admin-login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 40px;
  max-width: none;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(42, 63, 95, 0.08), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(201, 148, 74, 0.1), transparent 50%),
    #f4f6f9;
}
.admin-login-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 26px 22px;
  box-shadow: 0 18px 48px rgba(42, 63, 95, 0.1);
}
.admin-login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.admin-login-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line, #d8dee8);
  box-shadow: 0 4px 12px rgba(42, 63, 95, 0.12);
}
.admin-login-title {
  font-family: Outfit, "Noto Sans SC", sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--brand-deep, #0065d5);
  letter-spacing: 0.02em;
}
.admin-login-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.admin-login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-login-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.admin-login-label input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  outline: none;
}
.admin-login-label input:focus {
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}
.admin-login-submit {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  font-weight: 600;
  margin-top: 4px;
}
.admin-login-hint {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}
.modal-admin:has(#admin-login:not([hidden])) .admin-header {
  display: none;
}

/* ── 聊天附件 / 加载进度 ── */
.chat-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  padding: 4px 8px 4px 4px;
  background: #f3f5f8;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.chat-attach-chip img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
}
.chat-attach-img-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: zoom-in;
  overflow: hidden;
  flex: 0 0 auto;
}
.chat-attach-img-btn img {
  width: 100%;
  height: 100%;
  display: block;
}
.chat-attach-chip .chat-attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.chat-attach-chip .chat-attach-x {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1;
  padding: 2px;
}
.chat-tool-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.chat-tool-btn:hover {
  border-color: var(--border-strong, #c5ced9);
  color: var(--text);
  background: var(--panel-soft);
}
.msg-user .msg-attach-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.msg-image-thumb {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: zoom-in;
  overflow: hidden;
}
.msg-user .msg-attach-row img,
.msg-image-thumb img {
  max-width: 160px;
  max-height: 120px;
  border-radius: 10px;
  display: block;
}
.msg-image-thumb:focus-visible,
.chat-attach-img-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.9);
  outline-offset: 2px;
}
.msg-user .msg-file-chip {
  font-size: 12px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
}
.msg-loading-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, 100%);
  min-width: 0;
}
.msg-loading-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 220px;
}
.msg-loading-stage-text {
  color: var(--text-tertiary);
  font-style: italic;
}
.msg-loading-detail,
.msg-loading-model {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}
.msg-loading-time {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: var(--brand-deep);
  font-weight: 600;
  white-space: nowrap;
}
.msg-loading-bar {
  height: 4px;
  border-radius: 999px;
  background: #e8ecf2;
  overflow: hidden;
}
.msg-loading-bar > i {
  display: block;
  height: 100%;
  width: var(--progress-pct, 8%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand, #0089ff), #7ec4ff, var(--brand, #0089ff));
  transition: width 0.28s var(--ease);
}
@keyframes msg-load-slide {
  0% { transform: translateX(-40%); }
  100% { transform: translateX(220%); }
}

/* Token 用量面板 */
.token-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.token-kpi {
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.token-kpi.accent {
  background: rgba(42, 63, 95, 0.08);
  border-color: rgba(42, 63, 95, 0.18);
}
.token-kpi .k {
  font-size: 12px;
  color: var(--text-tertiary);
}
.token-kpi .v {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-deep);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.token-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}
.token-table th,
.token-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.token-table th { color: var(--text-tertiary); font-weight: 600; }
.token-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.accuracy-score {
  display: inline-block;
  min-width: 2.2em;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.accuracy-score.score-hi { color: #0a7a3e; background: #e8f7ee; }
.accuracy-score.score-mid { color: #9a6b00; background: #fff6d9; }
.accuracy-score.score-lo { color: #b42318; background: #fdecea; }
.admin-intent-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3fb;
  color: #2a3f5f;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-intent-chip em {
  font-style: normal;
  color: var(--text-tertiary);
  font-weight: 500;
}
.admin-flag-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.admin-flag-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f4f8;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}
.admin-flag-chip.web {
  background: #e8f1ff;
  color: #1d4ed8;
}
.admin-intent-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px 12px;
}
.admin-intent-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.chat-record-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.admin-record-attach { margin-bottom: 8px; }
.chat-record-detail .msg-bubble {
  background: #f4f6f9;
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.55;
}
.chat-record-detail .match-card,
.chat-record-detail .resource-card {
  pointer-events: none;
}
#modal-chat-record .modal-box {
  max-height: min(88vh, 900px);
  overflow: hidden;
}

/* ── 移动端 / 无线端适配 ── */
@media (max-width: 768px) {
  html, body {
    width: 100%;
    overflow-x: hidden;
    touch-action: manipulation;
  }
  body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background-attachment: scroll; /* fixed 在移动端易抖 */
  }
  input,
  select,
  textarea,
  .toolbar-select,
  .admin-search {
    font-size: 16px !important; /* 避免 iOS 聚焦自动放大 */
  }
  button,
  a,
  .nav-tab,
  .btn,
  .admin-nav {
    touch-action: manipulation;
  }

  /* 顶栏更紧凑 */
  .header {
    padding-top: env(safe-area-inset-top, 0);
  }
  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px 7px;
    min-height: 0;
  }
  .header-brand {
    width: 100%;
    align-items: center;
    gap: 8px;
  }
  .header-brand-text {
    width: 100%;
    max-width: 100%;
    padding-top: 0;
  }
  .header-logo-img {
    width: 32px;
    height: 32px;
    border-radius: 7px;
  }
  .header-slogan {
    font-size: 13px;
    letter-spacing: 0.01em;
    max-width: 100%;
  }
  .header-title {
    font-size: 11px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .header-version { font-size: 10px; }
  .theme-switcher {
    width: 100%;
    justify-content: center;
    gap: 10px;
    padding: 2px 0;
  }
  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
    gap: 6px;
  }
  .header-actions .btn {
    width: 100%;
    min-width: 0;
    height: 34px;
    font-size: 12px;
    font-weight: 600;
    padding: 0 8px;
    border-radius: 999px;
    line-height: 1.2;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid #c9ddf8;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
    color: var(--brand-deep);
    box-shadow: none;
  }
  .header-actions .btn.btn-contribute {
    border: none;
    background: var(--btn-primary-grad);
    color: #fff;
  }
  .btn-contribute-sub { display: none; }
  .page-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: auto;
    min-height: calc(100dvh - 86px);
    padding: 0;
    width: 100%;
  }
  .side-left,
  .side-right {
    display: none !important;
  }
  .center-panel {
    min-height: calc(100dvh - 86px);
    height: auto;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
  }

  /* TAB：业务类型可横滑，置顶/收藏仍在同一行末尾 */
  .nav-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 8px 8px;
    scrollbar-width: none;
    border-radius: 0;
    background: #fff;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-biz-tabs {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 2px;
    padding: 0;
  }
  .nav-tab-long { display: none; }
  .nav-tab-short { display: inline; }
  .nav-tab {
    flex: none;
    width: auto;
    min-width: 0;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 999px;
    border: none;
  }
  .nav-tab.active {
    background: #eaf4ff;
    box-shadow: none;
  }
  .nav-tab[data-panel="chat"].active {
    color: #fff;
    background: linear-gradient(180deg, #3dadff 0%, #0089ff 100%);
    border: none;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.35) inset,
      0 4px 12px rgba(0, 137, 255, 0.3);
  }

  .chat-layout {
    flex-direction: column;
    min-height: 0;
  }
  .chat-history-rail {
    width: 100%;
    max-height: 108px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.95);
  }
  .chat-history-head {
    padding: 6px 10px 4px;
  }
  .chat-history-title-label { font-size: 12px; }
  .chat-history-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 6px;
    padding: 2px 8px 8px;
    scrollbar-width: none;
  }
  .chat-history-list::-webkit-scrollbar { display: none; }
  .chat-history-item {
    width: auto;
    max-width: 140px;
    flex-shrink: 0;
    padding: 6px 8px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
    font-size: 12px;
  }
  .chat-history-empty {
    padding: 6px 8px;
    text-align: left;
    font-size: 12px;
  }
  .chat-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  .chat-thread {
    flex: 1;
    max-height: none;
    padding: 10px 10px 6px;
  }
  .msg { gap: 8px; }
  .msg-avatar {
    width: 28px;
    height: 28px;
    font-size: 9px;
  }
  .msg-body { max-width: calc(100% - 36px); }
  .msg-user {
    max-width: min(88%, 100%);
  }
  .msg-user .msg-body {
    max-width: min(100%, 88vw);
    width: fit-content;
  }
  .msg-user .msg-bubble {
    width: fit-content;
    max-width: 100%;
    padding: 8px 12px;
  }
  .msg-bubble {
    font-size: 14px;
    line-height: 1.55;
    padding: 10px 12px;
    border-radius: 12px;
    word-break: break-word;
  }
  .msg-source-tag {
    font-size: 10px;
    padding: 1px 6px;
  }
  .msg-hints {
    gap: 6px;
    margin-top: 8px;
  }
  .msg-hint-chip,
  .chat-recent-chip {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 999px;
  }
  .chat-recent {
    padding: 6px 10px 4px;
    gap: 6px;
  }
  .chat-recent-label {
    font-size: 11px;
    flex-shrink: 0;
  }
  .chat-recent-list {
    gap: 6px;
  }
  .chat-composer,
  .chat-input-bar {
    margin: 4px 8px calc(8px + env(safe-area-inset-bottom, 0));
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(28, 45, 70, 0.06);
    position: sticky;
    bottom: 0;
    overflow: hidden;
    background: var(--panel);
  }
  .chat-composer textarea,
  .chat-input-bar textarea {
    min-height: 64px;
    max-height: 140px;
    padding: 10px 12px 6px;
    font-size: 16px !important; /* 避免 iOS 聚焦缩放 */
    border: none;
    border-radius: 0;
  }
  .chat-composer-bar {
    padding: 6px 8px 8px;
    gap: 8px;
  }
  .chat-composer-hint { display: none; }
  .chat-tool-btn {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
  }
  .btn.chat-send,
  .chat-send {
    height: 34px;
    min-width: 64px;
    border-radius: 999px;
    font-size: 13px;
  }

  /* ── 筛选条：横滑 pill，避免换行参差；搜索行基线对齐 ── */
  .script-filters,
  .knowledge-filters,
  .browse-panel-head {
    margin: 8px 10px 6px;
    padding: 10px 12px;
    border-radius: 14px;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(15, 32, 51, 0.04);
  }
  .browse-panel-title { font-size: 15px; }
  .browse-panel-desc { font-size: 12px; }
  .script-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .script-filter-label {
    width: auto;
    min-width: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    line-height: 1.2;
  }
  .script-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0 2px;
    margin: 0;
  }
  .script-pills::-webkit-scrollbar { display: none; }
  .script-pill {
    flex: 0 0 auto;
    height: 30px;
    min-height: 30px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    border-width: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
  }
  .script-filter-row-search {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .script-filter-row-search .script-filter-label {
    display: none;
  }
  .script-filter-row-search .script-search-input,
  .script-filter-row-search .toolbar-search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: #fff;
    box-sizing: border-box;
  }
  .script-filter-row-search > .btn {
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 12px;
    flex-shrink: 0;
  }
  .list-expand-toggle {
    margin-left: 0;
    height: 34px;
    padding: 0 2px 0 4px;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    align-items: center;
  }
  .list,
  #knowledge-list,
  #scripts-list,
  #sites-browse,
  #files-browse,
  #biz-library-list {
    padding: 0 10px 14px;
    gap: 8px;
  }
  .k-item,
  .script-card,
  .browse-card,
  .resource-card {
    border-radius: 12px;
  }

  /* 资料列表卡片：方案 D 极简信息流（仅无线端两行） */
  .k-item,
  .script-card {
    padding: 10px 12px;
  }
  .k-item-head,
  .script-card-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 0;
  }
  .k-item-head > .doc-icon,
  .script-card-head > .doc-icon {
    margin-top: 1px;
    flex: 0 0 auto;
  }
  .k-item-main,
  .script-card-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .k-item-primary,
  .script-card-primary {
    display: flex;
    align-items: flex-start;
    gap: 4px;
  }
  .k-item-secondary,
  .script-card-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .k-item-title-row,
  .script-card-title-row {
    flex: 1;
    min-width: 0;
    max-width: none;
    order: initial;
    display: block;
  }
  .k-item-meta,
  .script-card-meta-inline {
    order: initial;
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 11px;
    line-height: 1.35;
    opacity: 0.9;
  }
  .k-item-tags,
  .script-tags {
    order: initial;
    flex-shrink: 0;
    max-width: 46%;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: 0;
    width: auto;
  }
  .card-acts {
    order: initial;
    flex-shrink: 0;
    gap: 0;
    margin-top: -1px;
    margin-left: 0;
  }
  .k-item h4,
  .script-card-title,
  .script-card-title .lib-title,
  .k-item h4 .lib-title {
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
  }
  .card-acts .card-act,
  .card-acts .item-expand-btn,
  .card-acts .script-copy,
  .card-acts .share-btn {
    height: 24px;
    padding: 0 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    border: none;
    background: transparent;
    border-radius: 4px;
  }
  .card-acts .fav-btn {
    width: 24px;
    height: 24px;
  }
  .k-tag,
  .script-tag {
    flex-shrink: 0;
    height: auto;
    padding: 0;
    margin: 0;
    font-size: 10px;
    line-height: 1.35;
    border: none !important;
    background: transparent !important;
    border-radius: 0;
    color: #64748b;
  }
  .k-tag::before,
  .script-tag::before {
    content: "#";
    color: #94a3b8;
  }
  .k-tag[data-kind="biz"],
  .script-tag[data-kind="biz"] {
    color: #ea580c;
  }
  .k-tag[data-kind="biz"]::before,
  .script-tag[data-kind="biz"]::before {
    color: #fb923c;
  }
  .script-tag[data-kind="stage"] {
    color: #15803d;
  }
  .script-tag[data-kind="stage"]::before {
    color: #4ade80;
  }

  /* 网站/文档/视频/合集：与知识卡片同构（标题行操作文字链 + meta/#标签） */
  .browse-card.browse-card-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }
  .browse-card-row > .doc-icon,
  .browse-card-row > .browse-card-icon,
  .browse-card-row > .browse-card-icon-link {
    flex: 0 0 auto;
    margin-top: 1px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
  }
  .browse-card-row .browse-card-main-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .browse-card-row .browse-card-primary {
    display: flex;
    align-items: flex-start;
    gap: 4px;
  }
  .browse-card-row .browse-card-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .browse-card-row .browse-card-title-hit {
    flex: 1;
    min-width: 0;
    max-width: none;
    order: initial;
  }
  .browse-card-row .browse-card-title-block {
    flex: 1;
    min-width: 0;
    max-width: none;
    order: initial;
    gap: 3px;
  }
  .browse-card-row .browse-card-meta {
    order: initial;
    flex: 1;
    min-width: 0;
    font-size: 11px;
    line-height: 1.35;
    margin: 0;
  }
  .browse-card-row .browse-card-secondary > .k-tag {
    order: initial;
  }
  .browse-card-row .card-acts {
    order: initial;
    margin-left: 0;
  }
  .browse-card-row .browse-card-title,
  .browse-card-row .browse-card-title .lib-title {
    width: 100%;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
  }
  .browse-card-row .card-acts .browse-card-action,
  .browse-card-row .card-acts .share-btn {
    height: 24px;
    padding: 0 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    border: none;
    background: transparent;
    border-radius: 4px;
  }
  .browse-card-row .card-acts .fav-btn {
    width: 24px;
    height: 24px;
  }
  .browse-card-row .browse-card-secondary {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .browse-card-row .browse-card-meta {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    line-height: 1.35;
    margin: 0;
  }
  .browse-card-row .browse-card-secondary > .k-tag {
    flex-shrink: 0;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .browse-card-row .browse-card-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.35;
  }
  .pager {
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0));
    gap: 10px;
  }

  .modal-box,
  .modal-lg,
  .modal-sm {
    width: calc(100vw - 16px);
    max-width: 100%;
    max-height: min(90dvh, 100%);
    margin: 8px;
    border-radius: 12px;
  }
  .modal-admin {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
  }
  .modal-over-admin {
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
    overflow: hidden;
  }
  .modal-over-admin .modal-box,
  .modal-over-admin .modal-lg,
  .modal-over-admin .modal-sm {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0 !important;
    border-radius: 0 !important;
    overflow: auto;
  }
  .modal-admin-wrap {
    padding: 0 !important;
    align-items: stretch;
    justify-content: stretch;
  }
  .modal-admin .modal-x {
    top: calc(10px + env(safe-area-inset-top, 0));
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: rgba(255,255,255,0.9);
  }
  .admin-header {
    padding: calc(12px + env(safe-area-inset-top, 0)) 48px 10px 12px;
    flex: 0 0 auto;
  }
  .admin-header .modal-title { font-size: 16px; }
  .admin-header .text-muted {
    font-size: 12px;
    line-height: 1.35;
  }
  .admin-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }
  .admin-mobilebar {
    display: block;
    padding: 8px 0 8px 10px;
    border-bottom: 1px solid var(--border);
    background: rgba(247, 248, 250, 0.98);
    flex: 0 0 auto;
  }
  .admin-mobile-scroll {
    padding: 0 10px 0 0;
  }
  .admin-mobile-nav-btn {
    height: 34px;
    font-size: 13px;
  }
  .admin-sidebar {
    display: none;
  }
  .admin-sidebar::-webkit-scrollbar { display: none; }
  .admin-nav-group {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    gap: 6px;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
  }
  .admin-nav-group + .admin-nav-group {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .admin-nav-group-title { display: none; }
  .admin-nav {
    flex: 0 0 auto;
    width: auto;
    min-width: auto;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    line-height: 30px;
    text-align: center;
    white-space: nowrap;
  }
  .admin-nav.active {
    border-color: var(--brand);
    background: var(--brand-light);
    box-shadow: none;
  }
  .admin-sidebar-foot {
    flex: 0 0 auto;
    margin: 0 0 0 2px;
    padding: 0;
    border: 0;
  }
  .admin-sidebar-foot .link-btn {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    white-space: nowrap;
  }
  .admin-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    width: 100%;
  }
  .admin-body {
    flex: 1 1 auto;
    padding: 12px 10px calc(16px + env(safe-area-inset-bottom, 0));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  .admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }
  .admin-toolbar-title {
    margin-right: 0;
    line-height: 1.3;
    font-size: 14px;
  }
  .admin-toolbar > .btn,
  .admin-toolbar > .btn-sm,
  .admin-toolbar > select,
  .admin-toolbar > input,
  .admin-toolbar > a.btn,
  .admin-toolbar > label.btn {
    width: auto;
    min-width: 0;
  }
  .admin-search-wrap { flex: 1 1 140px; }
  .admin-search { height: 32px; width: auto; }
  #admin-search-btn { width: auto; }
  .admin-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: visible;
    border: none;
    background: transparent;
    border-radius: 0;
  }
  .admin-table,
  .ai-model-table {
    min-width: 0 !important;
  }
  .admin-table.admin-table-compact th,
  .admin-table.admin-table-compact td {
    padding: 0;
  }
  .admin-table .col-question {
    min-width: 0;
    max-width: none;
  }
  .admin-actions,
  .admin-actions-nowrap,
  .admin-table .col-actions .admin-actions,
  .admin-table td.col-actions.admin-actions {
    flex-wrap: wrap;
    white-space: normal;
  }
  .admin-pager {
    flex-wrap: wrap;
    justify-content: center;
  }
  .admin-form-panel {
    padding: 10px;
    border-radius: 10px;
    max-width: 100%;
    overflow: hidden;
  }
  .admin-body .form-grid,
  .admin-form-panel .form-grid,
  .admin-editor-page .form-grid {
    grid-template-columns: 1fr !important;
  }
  .admin-body .form-grid label,
  .admin-body .form-grid button,
  .admin-form-panel .form-grid label,
  .admin-form-panel .form-grid button {
    grid-column: 1 / -1 !important;
  }
  .admin-member-create-fields {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .admin-member-create {
    gap: 12px;
  }
  .admin-member-create-actions {
    gap: 12px;
  }
  .admin-editor-page .doc-batch-form.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .admin-editor-page .doc-batch-form.form-grid > label:not(.doc-batch-file-label) {
    grid-column: auto !important;
  }
  .admin-editor-page .doc-batch-form.form-grid > .doc-batch-file-label,
  .admin-editor-page .doc-batch-form.form-grid > .doc-batch-toolbar,
  .admin-editor-page .doc-batch-form.form-grid > .doc-batch-list,
  .admin-editor-page .doc-batch-form.form-grid > .btn,
  .admin-editor-page .doc-batch-form.form-grid > .text-muted {
    grid-column: 1 / -1 !important;
  }
  .admin-editor-page {
    max-width: 100%;
  }
  .admin-header .text-muted { display: none; }
  .admin-mobilebar {
    padding: 6px 0 6px 8px;
  }
  .admin-mobile-nav-btn {
    height: 30px;
    font-size: 12px;
  }
  .admin-body {
    padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0));
  }
  .analytics-days,
  .analytics-days select {
    width: auto;
    max-width: 100%;
  }
  .analytics-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .analytics-kpi {
    padding: 10px 8px;
  }
  .analytics-kpi-val {
    font-size: 18px;
    overflow-wrap: anywhere;
  }
  .analytics-grid,
  .analytics-top-grid {
    grid-template-columns: 1fr;
  }
  .analytics-panel,
  .analytics-rank-panel,
  .analytics-recent-panel,
  .analytics-drill-panel {
    padding: 10px;
    border-radius: 10px;
  }
  .analytics-side-head,
  .analytics-rank-head,
  .analytics-drill-head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .analytics-action-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .analytics-action-right {
    align-items: stretch;
    min-width: 0;
  }
  .analytics-action-bar {
    width: 100%;
  }
  .analytics-side-rank-row,
  .analytics-side-rank-row.has-action {
    grid-template-columns: 24px 1fr;
    align-items: start;
  }
  .analytics-side-rank-action {
    grid-column: 2;
  }
  .analytics-side-rank-title,
  .analytics-side-recent-title,
  .analytics-drill-title {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .token-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .token-kpi {
    padding: 10px;
    border-radius: 10px;
  }
  .token-kpi .v {
    font-size: 18px;
    overflow-wrap: anywhere;
  }
  .token-table {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .token-table th,
  .token-table td {
    padding: 8px;
    white-space: normal;
  }
  .modal-over-admin .modal-lg {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0 !important;
    border-radius: 0 !important;
    overflow-y: auto;
  }
  .chat-record-meta-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .admin-chat-table-wrap { display: none !important; }
  .admin-chat-cards {
    display: flex !important;
    flex-direction: column;
    gap: 6px;
  }
  .admin-chat-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 8px 10px;
    box-shadow: 0 1px 2px rgba(42, 63, 95, 0.04);
  }
  .admin-chat-card-main { min-width: 0; }
  .admin-chat-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
  }
  .admin-chat-card .admin-act-menu,
  .admin-chat-card-actions { align-self: start; }
  .admin-intent-chip { max-width: 140px; }
  .chat-record-detail {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
  }
  .footer {
    font-size: 11px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0));
  }
  .resource-card-compact .resource-card-title { max-width: 42%; }
  .resource-card-title-row .resource-card-title { max-width: min(100%, 200px); }
  .resource-card-meta { max-width: 100%; }
  .browse-toolbar,
  .panel-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .match-section-label { font-size: 12px; }
  .msg-dispute-btn {
    font-size: 11px;
    padding: 4px 8px;
  }
}


/* 超窄屏再收紧 TAB */
@media (max-width: 380px) {
  .nav-tab {
    font-size: 11px;
    padding: 8px 0 9px;
    letter-spacing: -0.02em;
  }
  .header-slogan { font-size: 12px; }
  .header-actions .btn {
    font-size: 10px;
    padding: 5px 7px;
  }
}


.featured-type-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 600;
}
.featured-side-item,
.featured-card-btn {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
}
.featured-card-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
