:root {
  --bg: #f7f7f8;
  --sidebar-bg: #171717;
  --sidebar-text: #ececec;
  --sidebar-muted: #8e8ea0;
  --primary: #10a37f;
  --primary-hover: #0d8c6d;
  --border: #e5e5e5;
  --text: #353740;
  --text-muted: #6e6e80;
  --user-bg: #f0f0f0;
  --assistant-bg: #ffffff;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { font-size: 28px; font-weight: 700; color: var(--text); }
.login-header p { color: var(--text-muted); margin-top: 8px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  transition: border-color .2s;
}
.form-group input:focus { outline: none; border-color: var(--primary); }

.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-img {
  height: 40px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.error-msg {
  background: #fef2f2;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-block { width: 100%; padding: 12px; font-size: 16px; }
.btn-icon { background: none; border: none; padding: 6px; cursor: pointer; color: var(--text-muted); }

/* ── Chat Layout ───────────────────────────────────────── */
.chat-body { height: 100vh; overflow: hidden; }

.app-layout {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform .3s, width .25s ease, min-width .25s ease;
}

@media (min-width: 769px) {
  .app-layout.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    pointer-events: none;
  }
}

.sidebar-header { padding: 16px; }
.btn-new-chat {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
  color: var(--sidebar-text);
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn-new-chat:hover { background: rgba(255,255,255,.08); }

.sidebar-section { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.sidebar-label {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.session-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

/* 侧边栏滚动条：细窄、深色、无箭头 */
.session-list::-webkit-scrollbar,
.sidebar .nav-group-config::-webkit-scrollbar {
  width: 6px;
}
.session-list::-webkit-scrollbar-track,
.sidebar .nav-group-config::-webkit-scrollbar-track {
  background: transparent;
}
.session-list::-webkit-scrollbar-thumb,
.sidebar .nav-group-config::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.session-list::-webkit-scrollbar-thumb:hover,
.sidebar .nav-group-config::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}
.session-list::-webkit-scrollbar-button,
.sidebar .nav-group-config::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
.sidebar .nav-group-config {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.session-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
}
.session-item:hover { background: rgba(255,255,255,.08); }
.session-item.active { background: rgba(255,255,255,.12); }

/* 会话标题区域 */
.session-title-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.session-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 对话删除按钮 */
.session-delete-btn {
  opacity: 0;
  background: none;
  border: none;
  color: var(--sidebar-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
  flex-shrink: 0;
  transition: opacity 0.2s, color 0.2s;
  line-height: 1;
}
.session-item:hover .session-delete-btn { opacity: 1; }
.session-delete-btn:hover { color: var(--danger); }
.session-toggle-item {
  list-style: none;
  padding: 4px 12px 4px 32px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.session-toggle-dots {
  letter-spacing: 2px;
  color: #6e6e80;
  font-size: 16px;
  line-height: 1;
}
.session-toggle-link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}
.session-toggle-link:hover {
  text-decoration: underline;
}

/* 下拉菜单已废弃，保留兼容 */

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  gap: 8px;
}
.btn-settings, .btn-logout {
  flex: 1;
  background: transparent;
  border: 1px solid rgba(255,255,255,.15);
  color: var(--sidebar-text);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn-settings:hover, .btn-logout:hover { background: rgba(255,255,255,.08); }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.chat-header h2 { font-size: 16px; font-weight: 600; }
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background .2s, color .2s;
}
.sidebar-toggle:hover {
  background: var(--bg);
  color: var(--text);
}
.chat-header .sidebar-toggle.btn-icon {
  border: none;
  background: none;
}
.chat-header .sidebar-toggle.btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}
.welcome-icon { font-size: 48px; margin-bottom: 16px; }
.welcome-screen h2 { color: var(--text); margin-bottom: 8px; }
.welcome-examples { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; justify-content: center; }
.example-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: border-color .2s, background .2s;
}
.example-btn:hover { border-color: var(--primary); background: #f0faf7; }

.message {
  max-width: 800px;
  margin: 0 auto 24px;
  display: flex;
  gap: 14px;
}
.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.message.user .message-avatar { background: var(--primary); color: #fff; }
.message.assistant .message-avatar { background: #5436da; color: #fff; }

.message-body { flex: 1; min-width: 0; }
.message-role { font-size: 13px; font-weight: 600; margin-bottom: 4px; }

.message-content {
  font-size: 15px;
  line-height: 1.7;
  word-break: break-word;
}
.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }

.sql-block {
  margin-top: 12px;
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  padding: 12px 16px;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 13px;
  overflow-x: auto;
  white-space: pre-wrap;
}
.sql-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  margin-bottom: 4px;
  font-weight: 500;
}

.reasoning-block {
  margin-top: 12px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.reasoning-block summary { cursor: pointer; font-weight: 500; color: var(--text); }

.stream-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stream-status.hidden { display: none; }
.message.streaming .message-content:empty { display: none; }
.stream-content {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 15px;
}
.stream-content.is-typing::after {
  content: '▍';
  display: inline-block;
  margin-left: 2px;
  color: var(--primary);
  animation: stream-cursor-blink 0.9s step-end infinite;
  vertical-align: baseline;
}
@keyframes stream-cursor-blink {
  50% { opacity: 0; }
}

.stream-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13px;
}
.stream-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-muted);
  line-height: 1.4;
}
.stream-step.active {
  color: var(--text);
}
.stream-step.active .step-text::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}
.stream-step.done {
  color: #6e6e80;
}
.stream-step.done .step-indicator {
  color: #10a37f;
  font-weight: 600;
}
.step-indicator {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
}
.step-text {
  flex: 1;
}
.optimized-question-block {
  margin: 4px 0 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d1e7dd;
  background: #f0faf4;
}
.optimized-question-label {
  font-size: 12px;
  color: #0d6e4f;
  font-weight: 600;
  margin-bottom: 4px;
}
.optimized-question-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.message.streaming .stream-content:not(:empty) {
  display: block;
  margin-top: 4px;
}

.data-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th { background: #f9f9f9; font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }

.query-result-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 8px;
}
.query-result-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  flex: 1;
  min-width: 160px;
}
.query-result-footer .btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.taxonomy-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .taxonomy-layout { grid-template-columns: 1fr; }
}
.taxonomy-dim-list { list-style: none; margin: 0; padding: 0; }
.taxonomy-dim-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}
.taxonomy-dim-item:hover { background: #f5f5f5; }
.taxonomy-dim-item.active { border-color: var(--primary); background: #f0faf7; }
.taxonomy-dim-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.taxonomy-node-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}
.taxonomy-node-actions { display: flex; gap: 8px; }
/* 四知识模块 — 弹窗内架构多选 */
.modal-body .form-group .taxonomy-tags-editor {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.taxonomy-editor-dims {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  overflow: hidden;
}
.taxonomy-editor-dim {
  border-bottom: 1px solid var(--border);
}
.taxonomy-editor-dim:last-child {
  border-bottom: none;
}
.taxonomy-editor-dim-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  margin: 0;
  border: none;
  background: #f3f4f6;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
  transition: background 0.12s;
}
.taxonomy-editor-dim-header:hover {
  background: #e9ecef;
}
.taxonomy-editor-dim-chevron {
  display: inline-flex;
  width: 14px;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.taxonomy-editor-dim-chevron::before {
  content: '▾';
}
.taxonomy-editor-dim.is-collapsed .taxonomy-editor-dim-chevron {
  transform: rotate(-90deg);
}
.taxonomy-editor-dim-name {
  flex: 1;
  min-width: 0;
}
.taxonomy-editor-dim-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
}
.taxonomy-editor-dim-count-muted {
  color: var(--text-muted);
  font-weight: 400;
}
.taxonomy-editor-dim.is-collapsed .taxonomy-editor-dim-body {
  display: none;
}
.taxonomy-editor-dim-body {
  padding: 4px 8px 10px 12px;
  background: #fff;
}
.taxonomy-tag-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(220px, 40vh);
  overflow-y: auto;
  padding-right: 4px;
}
.taxonomy-tag-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 8px;
  margin: 0;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  user-select: none;
}
.taxonomy-tag-option:hover {
  background: #f5f7fa;
}
.taxonomy-tag-option input[type='checkbox'] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  margin: 2px 0 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
  display: inline-block !important;
  vertical-align: top;
  accent-color: var(--primary);
  cursor: pointer;
}
.taxonomy-tag-option-text {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--text);
  word-break: break-word;
}

.chart-container {
  margin-top: 12px;
  width: 100%;
  height: 360px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.input-area {
  padding: 16px 20px 20px;
  background: var(--bg);
  position: relative;
}
.input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-height: 56px;
  box-shadow: var(--shadow);
}
.input-wrapper textarea {
  flex: 1;
  border: none;
  resize: none;
  font-size: 15px;
  line-height: 24px;
  min-height: 44px;
  max-height: 150px;
  padding: 10px 0;
  box-sizing: border-box;
  font-family: inherit;
  background: transparent;
}
.input-wrapper.is-requesting {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12);
  animation: input-request-pulse 2s ease-in-out infinite;
}
@keyframes input-request-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12); }
  50% { box-shadow: 0 0 0 5px rgba(16, 163, 127, 0.18); }
}
.input-wrapper textarea:focus { outline: none; }
.btn-send {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  transition: background 0.2s;
}
.btn-send .send-btn-state {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 0;
}
.btn-send.is-send .send-btn-state--send {
  display: inline-flex;
}
.btn-send.is-send .send-btn-state--send svg {
  display: block;
  flex-shrink: 0;
}
.btn-send.is-loading .send-btn-state--loading {
  display: inline-flex;
  position: relative;
}
.btn-send:hover:not(:disabled) { background: var(--primary-hover); }
.btn-send.is-loading {
  cursor: pointer;
}
.btn-send.is-loading.is-stop {
  background: var(--primary);
}
.btn-send.is-loading.is-stop:hover:not(:disabled) { background: var(--primary-hover); }
.btn-send .send-spinner-ring {
  position: absolute;
  inset: 3px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-right-color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  animation: send-spin 0.75s linear infinite;
  pointer-events: none;
}
.btn-send .send-stop-svg {
  position: relative;
  z-index: 1;
  display: block;
  flex-shrink: 0;
}
@keyframes send-spin {
  to { transform: rotate(360deg); }
}
.btn-send:disabled.is-send {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-send:disabled.is-send .send-btn-state--send svg {
  opacity: 1;
}
.agent-thinking {
  display: none;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background: #f0faf7;
  border: 1px solid #b7e4d8;
  color: #0d8c6d;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.input-wrapper.is-requesting .agent-thinking { display: inline-flex !important; }
.agent-thinking-orb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(16, 163, 127, 0.4);
  animation: agent-thinking-pulse 1.4s ease-out infinite;
}
@keyframes agent-thinking-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 163, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 163, 127, 0); }
}
.stream-stopped-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}
.input-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Voice ──────────────────────────────────────────────── */
/* 输入框内的按住说话、语音通话按钮先不展示 */
.input-wrapper .voice-ptt-wrapper,
.input-wrapper .btn-voice-call-input {
  display: none !important;
}
.btn-voice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s;
}
.btn-voice:hover {
  background: var(--primary-hover);
}

.btn-voice-call-input {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s;
  position: relative;
}
.btn-voice-call-input:hover {
  background: var(--primary-hover);
}

/* ── Call Overlay ──────────────────────────────────────────── */
.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.call-overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.call-overlay-content {
  position: relative;
  width: 340px;
  max-width: 90vw;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 28px;
}
.call-header {
  text-align: center;
  margin-bottom: 24px;
}
.call-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 6px;
}
.call-duration {
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-family: monospace;
}
.call-body {
  text-align: center;
  margin-bottom: 32px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.call-transcript {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  min-height: 28px;
  word-break: break-word;
  background: #f7f7f8;
  border-radius: 12px;
  padding: 12px 16px;
  width: 100%;
}
.call-status {
  font-size: 13px;
  color: var(--primary);
}
.call-footer {
  display: flex;
  justify-content: center;
}
.call-hangup-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: #ef4444;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  padding: 14px 0 10px;
  transition: background 0.2s, transform 0.15s;
}
.call-hangup-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}
.call-hangup-btn:active {
  transform: scale(0.95);
}

/* ── PTT recording indicator ──────────────────────────────── */
.btn-voice.recording {
  background: var(--danger) !important;
  animation: voice-pulse 1s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.15); }
}

/* Active call button state */
.btn-voice-call-input.active {
  background: var(--danger) !important;
  animation: call-active-pulse 2s ease-in-out infinite;
}
@keyframes call-active-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.1); }
}

.voice-ptt-hint {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}
.voice-ptt-hint.show {
  opacity: 1;
}

/* ── Call overlay avatar & wave bars ──────────────────────── */
.call-avatar-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 4px;
}
.call-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.3s;
}
.call-avatar.speaking {
  background: #3b82f6;
}
.call-wave-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  opacity: 0;
  transition: opacity 0.3s;
}
.call-wave-bars.active {
  opacity: 1;
}
.wave-bar {
  display: block;
  width: 4px;
  background: var(--primary);
  border-radius: 2px;
  animation: wave-idle 1.2s ease-in-out infinite;
  height: 8px;
}
.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.15s; }
.wave-bar:nth-child(3) { animation-delay: 0.30s; }
.wave-bar:nth-child(4) { animation-delay: 0.45s; }
.wave-bar:nth-child(5) { animation-delay: 0.60s; }

@keyframes wave-idle {
  0%, 100% { height: 8px; }
  50% { height: 22px; }
}
.call-wave-bars.speaking .wave-bar {
  background: #3b82f6;
  animation: wave-speak 0.6s ease-in-out infinite;
}
.call-wave-bars.speaking .wave-bar:nth-child(1) { animation-delay: 0s; }
.call-wave-bars.speaking .wave-bar:nth-child(2) { animation-delay: 0.1s; }
.call-wave-bars.speaking .wave-bar:nth-child(3) { animation-delay: 0.2s; }
.call-wave-bars.speaking .wave-bar:nth-child(4) { animation-delay: 0.1s; }
.call-wave-bars.speaking .wave-bar:nth-child(5) { animation-delay: 0s; }

@keyframes wave-speak {
  0%, 100% { height: 8px; }
  50% { height: 32px; }
}
.call-wave-bars.processing .wave-bar {
  background: #f59e0b;
  animation: wave-process 1.5s ease-in-out infinite;
}
@keyframes wave-process {
  0%, 100% { height: 8px; opacity: 0.4; }
  50% { height: 14px; opacity: 1; }
}

/* ── Modal ─────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 18px; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; text-align: right; }

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.toggle-item:last-of-type { border-bottom: none; }
.toggle-item input { display: none; }
.toggle-slider {
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 12px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-item input:checked + .toggle-slider { background: var(--primary); }
.toggle-item input:checked + .toggle-slider::after { transform: translateX(20px); }
.settings-hint { font-size: 12px; color: var(--text-muted); margin-top: 12px; }

#spaceSelector {
  min-height: 36px;
}
.space-select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #ececec;
  font-size: 13px;
}
.space-selector-empty {
  padding: 8px;
  font-size: 12px;
  color: #8e8ea0;
}

/* ── Sidebar Nav ───────────────────────────────────────── */
.sidebar-nav {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-group-main {
  padding-bottom: 4px;
}
.nav-config-entry-wrap {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.nav-config-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.nav-config-entry .nav-icon {
  flex-shrink: 0;
  opacity: 0.9;
}
.nav-group-back {
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.nav-group-back .nav-item {
  font-weight: 500;
}
.nav-group-config {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.nav-config-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--sidebar-text) !important;
  padding: 8px 4px 6px !important;
}
.nav-subgroup-title {
  padding-top: 10px;
  font-size: 10px;
}

/* ORA 可折叠分组（Object / Relationship / Action） */
.nav-ora-group {
  margin-top: 6px;
}
.nav-ora-group .nav-ora-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.nav-ora-group .nav-ora-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
}
.nav-ora-chevron {
  display: inline-flex;
  width: 16px;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  opacity: 0.85;
  transition: transform 0.15s ease;
}
.nav-ora-chevron::before {
  content: '▾';
}
.nav-ora-group.is-collapsed .nav-ora-chevron {
  transform: rotate(-90deg);
}
.nav-ora-group .nav-subgroup-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 2px 4px;
}
.nav-ora-group.is-collapsed .nav-subgroup-items {
  display: none;
}
.nav-ora-group .nav-subgroup-items .nav-item {
  padding: 8px 12px 8px 28px;
  font-size: 13px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.08); }
.nav-item.active { background: rgba(255,255,255,.12); }
.btn-block { width: 100%; }

/* ── Page Layout ───────────────────────────────────────── */
.page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.page-header h2 { font-size: 18px; font-weight: 600; }
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 1200px;
}

.settings-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow);
}
.settings-card h3 {
  font-size: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.toggle-label { display: block; font-weight: 500; color: var(--text); }
.toggle-desc { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.settings-card .toggle-item { padding: 16px 0; }
.settings-card .btn-primary { margin-top: 20px; }

.save-msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.save-msg.success { background: #ecfdf5; color: #059669; }
.save-msg.error { background: #fef2f2; color: var(--danger); }

.settings-card .form-group { margin-bottom: 16px; }
.settings-card .form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 14px; }
.provider-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.provider-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; cursor: pointer; background: #fafafa;
}
.provider-tab:has(input:checked) { border-color: var(--primary); background: #f0faf7; color: var(--primary); }
.provider-tab input { margin: 0; }

.prompt-stage {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px 12px;
}
.prompt-stage summary {
  cursor: pointer;
  font-weight: 500;
  padding: 12px 0 8px;
  font-size: 14px;
}
.prompt-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  resize: vertical;
}

.follow-up-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.follow-up-label {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.follow-up-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fafafa;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
}
.follow-up-btn:hover {
  border-color: var(--primary);
  background: #f0faf7;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: #f9f9f9; }

.verify-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  margin-left: 8px;
}
.verify-link:hover { text-decoration: underline; }
.sql-verify-row { margin-top: 6px; }

.checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 18px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1.6;
}
.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ── Verify Page ───────────────────────────────────────── */
.verify-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.verify-history {
  width: 280px;
  border-right: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.verify-history-header {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.verify-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}
.verify-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
}
.verify-item:hover { background: #f9f9f9; }
.verify-item.active { background: #f0faf7; border-left: 3px solid var(--primary); }

.verify-item-content {
  flex: 1;
  min-width: 0;
}

.verify-item-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.verify-item-sql { font-size: 12px; color: var(--text-muted); font-family: Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verify-item-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* 验证页面删除按钮 */
.verify-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  flex-shrink: 0;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}
.verify-delete-btn:hover { color: var(--danger); background: #fef2f2; }
.verify-empty { padding: 20px 16px; color: var(--text-muted); font-size: 13px; }
.verify-load-more { padding: 10px 16px; text-align: center; }
.verify-load-more button { width: 100%; }

.verify-workspace {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.verify-section { margin-bottom: 20px; }
.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.section-label-row .section-label {
  margin-bottom: 0;
}
.section-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.verify-download-btn:hover { color: var(--primary); }
.badge {
  font-size: 12px;
  font-weight: normal;
  color: var(--text-muted);
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
}
.sql-editor {
  width: 100%;
  min-height: 160px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  background: #1e1e1e;
  color: #d4d4d4;
}
.sql-editor:focus { outline: none; border-color: var(--primary); }
.verify-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.analysis-content {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 15px;
  line-height: 1.7;
}
.empty-hint { font-size: 13px; color: var(--text-muted); padding: 12px 0; }

.error-detail {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  font-family: Consolas, Monaco, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  color: #991b1b;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    z-index: 50;
    height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .verify-layout { flex-direction: column; }
  .verify-history { width: 100%; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
}

/* ── Settings radio ─────────────────────────── */
.settings-section-title {
  font-size: 16px;
  margin: 28px 0 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.settings-section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.settings-section-desc a { color: var(--primary); }
.radio-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.radio-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  align-items: flex-start;
}
.radio-item:has(input:checked) { border-color: var(--primary); background: #f0faf7; }
.radio-item input { margin-top: 4px; flex-shrink: 0; }

/* ── Tab buttons (space-management etc.) ───────────── */
.tab-btn {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tab-btn:hover {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
}
.btn-link.danger { color: var(--danger); }
.error-cell { color: var(--danger); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
}
.modal-card {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow);
  z-index: 1;
}
.modal-card h3 { margin-bottom: 16px; }
.modal-card textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ─ Nav Group ─────────────────────────────────────────── */
.nav-group {
  padding: 8px;
}
.nav-group-title {
  font-size: 11px;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 8px 4px 4px;
  font-weight: 600;
}

/* ── Business Logic & Synonyms Pages ───────────────────── */
.page-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.info-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #0369a1;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 280px;
}

.search-box input {
  border: none;
  outline: none;
  font-size: 14px;
  flex: 1;
}

.btn-search {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.table-container {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.table-container .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-container .data-table th,
.table-container .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table-container .data-table th {
  background: #fafafa;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.table-container .data-table td.cell-truncate {
  cursor: default;
}

.cell-truncate-text {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.table-container .data-table th.cell-actions,
.table-container .data-table th.cell-date,
.table-container .data-table td.cell-actions,
.table-container .data-table td.cell-date {
  white-space: nowrap;
}

.table-container .data-table td.cell-actions,
.table-container .data-table th.cell-actions {
  text-align: center;
}

.table-container .data-table td.cell-wrap {
  white-space: normal;
  word-break: break-word;
}

.table-container .data-table tr:last-child td {
  border-bottom: none;
}

.table-container .data-table tr.selected {
  background: #f0faf7;
}

.loading-cell,
.error-cell {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.error-cell {
  color: var(--danger);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
}

.selected-info {
  font-size: 13px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-sm.active {
  background: var(--primary);
  color: #fff;
}

.jump-to {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.jump-to input {
  width: 50px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  font-size: 13px;
}

.modal-lg {
  max-width: 600px;
}

/* ── 数据源管理样式 ──────────────────────────── */

.ds-section-header {
  margin-bottom: 12px;
}

.ds-section-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── 列信息弹窗 ──────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-overlay .modal {
  position: static;
  inset: auto;
  z-index: auto;
  background: #fff;
  border-radius: 12px;
  width: 92%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-overlay .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  width: 100%;
  box-sizing: border-box;
}

.modal-overlay .modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.modal-close:hover {
  background: #f3f4f6;
  color: var(--text);
}

.modal-overlay .modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

/* ── Modal Form Styles ──────────────────────── */
.modal-overlay .form-group {
  margin-bottom: 18px;
  width: 100%;
  box-sizing: border-box;
}
.modal-overlay .form-group > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.modal-overlay .form-group input:not([type='checkbox']):not([type='radio']),
.modal-overlay .form-group textarea,
.modal-overlay .form-group select {
  display: block;
  width: 85% !important;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.modal-overlay .form-group input:focus,
.modal-overlay .form-group textarea:focus,
.modal-overlay .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12);
}
.modal-overlay .form-group textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
.modal-overlay .form-group input::placeholder,
.modal-overlay .form-group textarea::placeholder {
  color: #9ca3af;
}

/* 架构多选：勿套用弹窗 85% 宽 input 规则 */
.modal-overlay .taxonomy-tags-editor .taxonomy-tag-option {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 0;
  cursor: pointer;
}
.modal-overlay .taxonomy-tags-editor .taxonomy-tag-option input[type='checkbox'] {
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  flex: 0 0 16px !important;
  padding: 0 !important;
  margin: 2px 0 0 !important;
  border-radius: 4px;
  box-shadow: none !important;
}
.modal-overlay .taxonomy-tags-editor .taxonomy-tag-option input[type='checkbox']:focus {
  outline: 2px solid rgba(16, 163, 127, 0.35);
  outline-offset: 1px;
  border-color: var(--primary);
}
.modal-overlay .taxonomy-tags-editor .taxonomy-tag-option-text {
  flex: 0 1 auto;
  text-align: left;
}

/* ── 分页样式 ──────────────────────────── */

.modal-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.modal-pagination .page-info {
  flex: 1;
}

.modal-pagination .page-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-pagination .page-btn {
  padding: 4px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-pagination .page-btn:hover:not(:disabled) {
  background: var(--primary-light, #eff6ff);
  border-color: var(--primary);
  color: var(--primary);
}

.modal-pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.modal-pagination .page-size-select {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

/* ── 数据源配置卡片 ──────────────────── */

.ds-config-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.ds-config-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ds-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.ds-status-badge.connected {
  background: #ecfdf5;
  color: #059669;
}

.ds-status-badge.disconnected {
  background: #fef2f2;
  color: #dc2626;
}

.ds-info-row {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.ds-info-row span code {
  color: var(--text);
  font-weight: 500;
}

/* ── 穿梭框 ──────────────────── */

.shuttle-box {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  height: 360px;
}

.shuttle-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shuttle-panel:first-child {
  border-right: none;
}

.shuttle-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  background: #fafafa;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.shuttle-btn {
  width: 36px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.shuttle-btn:hover:not(:disabled) {
  background: #eef2ff;
  border-color: var(--primary);
  color: var(--primary);
}

.shuttle-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.shuttle-panel-header {
  padding: 10px 14px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.shuttle-panel-header .count {
  font-size: 11px;
  font-weight: normal;
  color: var(--text-muted);
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
}

.shuttle-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.shuttle-search input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.shuttle-search input:focus {
  border-color: var(--primary);
}

.shuttle-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.shuttle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.shuttle-item:hover {
  background: #f9f9f9;
}

.shuttle-item.selected {
  background: #f0faf7;
}

.shuttle-item input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: var(--primary);
}

.shuttle-item .table-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Consolas, Monaco, monospace;
}

.shuttle-item .table-type {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.shuttle-item .table-type.view {
  background: #ede9fe;
  color: #6d28d9;
}

.shuttle-item .table-type.table {
  background: #dbeafe;
  color: #1d4ed8;
}

.shuttle-item .table-comment {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shuttle-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── 表列表含描述列 ──────────────────── */

.table-comment-cell {
  min-width: 200px;
  max-width: 480px;
  vertical-align: top;
}

.table-comment-cell .col-comment-text {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.table-desc-cell {
  max-width: 300px;
  white-space: normal;
  word-break: break-word;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.table-desc-cell .desc-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.table-desc-cell .edit-desc-btn {
  display: inline-block;
  margin-top: 4px;
}

/* ── 列信息弹窗增强 ──────────────────── */

.modal-overlay .modal.column-modal {
  width: min(960px, 94vw);
  max-width: 960px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.column-modal-body {
  padding: 0 !important;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.column-modal-table-wrap {
  overflow: auto;
  max-height: min(52vh, 480px);
  padding: 0 20px;
}

.column-modal-table {
  table-layout: fixed;
  width: 100%;
  font-size: 13px;
}

.column-modal-table th,
.column-modal-table td {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  vertical-align: top;
  padding: 10px 12px;
  line-height: 1.5;
}

.column-modal-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
  box-shadow: 0 1px 0 var(--border);
}

.column-modal .col-name-cell { width: 20%; }
.column-modal .col-type-cell { width: 12%; }
.column-modal .col-null-cell { width: 6%; text-align: center; }
.column-modal .col-key-cell { width: 6%; text-align: center; }
.column-modal .col-comment-cell { width: 56%; }

.col-comment-content {
  margin-bottom: 6px;
}

.col-comment-cell .col-edit-btn {
  font-size: 12px;
}

.col-name-code {
  font-weight: 500;
  font-size: 12px;
  word-break: break-all;
}

.col-cell-text,
.col-desc-text {
  display: block;
  font-size: 12px;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.col-comment-text {
  color: var(--text-muted);
}

.col-empty {
  color: #ccc;
  font-size: 12px;
}

.col-desc-textarea {
  width: 100%;
  min-height: 72px;
  max-height: 160px;
  padding: 8px 10px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
  word-break: break-word;
}

.col-desc-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.column-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
}

.column-edit-cell textarea {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}

.column-edit-cell textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.role-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 500;
}

.role-badge.admin {
  background: #ecfdf5;
  color: #059669;
}

.role-badge.user {
  background: #f3f4f6;
  color: #6b7280;
}
