:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #dce2ea;
  --text: #1f2937;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --warn-bg: #fffbeb;
  --warn-text: #b45309;
  --safe-bg: #ecfdf5;
  --safe-text: #047857;
  --block-bg: #fef2f2;
  --block-text: #b91c1c;
  --info-bg: #eff6ff;
  --info-text: #1d4ed8;
  --run-bg: #eef2ff;
  --run-text: #4338ca;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 99%;
  margin: 0 auto;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #0f172a;
}

.ver-tag {
  font-size: 10.5px;
  font-weight: 600;
  background: var(--safe-bg);
  color: var(--safe-text);
  border: 1px solid #a7f3d0;
  padding: 1px 6px;
  border-radius: 999px;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.quick-status-strip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.status-chip {
  font-size: 11px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 7px;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.status-chip .chip-ok {
  color: #15803d;
  font-size: 10px;
  background: #dcfce7;
  padding: 1px 5px;
  border-radius: 999px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-safe { background: var(--safe-bg); color: var(--safe-text); border: 1px solid #a7f3d0; }

.btn.btn-xs,
.btn-xs {
  padding: 3px 8px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  border-radius: 5px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  min-height: 0 !important;
  height: auto !important;
}

.badge-sm {
  padding: 1px 6px;
  font-size: 11px;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 99%;
  width: 99%;
  margin: 6px auto;
  padding: 0 4px;
  overflow: hidden;
}

.section { margin-bottom: 18px; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.section-header h2 { margin: 0; font-size: 16px; }
.hint { font-size: 12.5px; color: var(--muted); }

.connector-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.connector-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.connector-card.connected {
  border-color: #6ee7b7;
  background: #f8fffc;
}

.connector-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.connector-name { font-weight: 700; font-size: 15px; }
.connector-desc { margin: 4px 0; font-size: 12.5px; color: var(--muted); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.stat-warn .stat-value { color: var(--warn-text); }
.stat-info .stat-value { color: var(--info-text); }
.stat-run .stat-value { color: var(--run-text); }
.stat-ok .stat-value { color: var(--safe-text); }
.stat-block .stat-value { color: var(--block-text); }

.tab {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.tab:hover { border-color: var(--primary); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.tab-panel { display: none; flex: 1; min-height: 0; }
.tab-panel.active { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#panel-single-task.active,
#panel-logs.active,
#panel-security.active {
  display: block;
  overflow-y: auto;
  padding: 16px 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card h3 { margin: 0 0 14px; font-size: 16px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--danger); }

.form-grid-3 {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.7fr;
  gap: 12px;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

textarea { resize: vertical; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-outline { background: #fff; color: var(--text); border: 1px solid #cbd5e1; }
.btn-outline:hover { background: #f8fafc; }
.btn-warn { background: #d97706; color: #fff; }
.btn-warn:hover { background: #b45309; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.preview-box {
  margin-top: 16px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 14px 16px;
}

.preview-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.preview-grid { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.kv-k { color: var(--muted); font-size: 13px; }
.preview-note { margin: 5px 0 0; font-size: 13px; }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}

.badge-unconnected { background: #e2e8f0; color: #475569; }
.badge-quota { background: #ffedd5; color: #9a3412; }
.badge-safe { background: var(--safe-bg); color: var(--safe-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-danger { background: var(--block-bg); color: var(--block-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-run { background: var(--run-bg); color: var(--run-text); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type="text"] { flex: 1; min-width: 200px; }
.toolbar select { width: 220px; }

.task-list { display: flex; flex-direction: column; gap: 14px; }

.task-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px 16px;
  background: #fcfdff;
}

.task-card.is-running {
  border-color: #818cf8;
  background: #f8f9ff;
}

.task-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.task-title { font-weight: 700; font-size: 15px; }

.task-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.task-content {
  margin: 10px 0 8px;
  white-space: pre-wrap;
  background: #f8fafc;
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 13.5px;
  border: 1px solid #e2e8f0;
}

.running-box {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--run-bg);
  border: 1px solid #c7d2fe;
  color: var(--run-text);
  font-size: 13px;
}

.progress-track {
  height: 6px;
  background: #dbeafe;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  height: 100%;
  background: #4f46e5;
  transition: width 0.5s ease;
}

.result-box {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.result-box-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--safe-text);
  margin-bottom: 6px;
}

.result-text {
  white-space: pre-wrap;
  font-size: 14px;
  color: #111827;
  line-height: 1.65;
  max-height: 360px;
  overflow-y: auto;
}

.task-summary { font-size: 13px; color: #334155; margin: 6px 0; }

.task-error {
  font-size: 13px;
  color: var(--block-text);
  background: var(--block-bg);
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 6px;
  white-space: pre-wrap;
}

.task-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th, .log-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.log-table th { background: #f8fafc; color: var(--muted); }

.setting-list { display: flex; flex-direction: column; gap: 12px; }
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.setting-item p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.setting-item input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; }
.setting-item.locked { background: #f8fafc; }
.form-actions { margin-top: 16px; }

.empty { text-align: center; color: var(--muted); padding: 26px 12px; font-size: 14px; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: 460px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}
.toast.ok { background: #0f766e; }
.toast.warn { background: #b45309; }
.toast.err { background: #b91c1c; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: min(85vh, 600px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  box-sizing: border-box;
}
.modal-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  flex-shrink: 0;
}
.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: #0f172a;
}
.btn-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-close:hover {
  background: #fee2e2;
  color: #dc2626;
}
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  font-size: 13.5px;
  color: #334155;
  box-sizing: border-box;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.hidden { display: none !important; }

.result-markdown {
  font-size: 14px;
  line-height: 1.7;
  color: #0f172a;
  max-height: 480px;
  overflow-y: auto;
  padding: 8px 4px;
}
.result-markdown h1, .result-markdown h2, .result-markdown h3, .result-markdown h4 {
  margin: 14px 0 8px;
  color: #0f172a;
}
.result-markdown p { margin: 6px 0; }
.result-markdown ul, .result-markdown ol { margin: 6px 0; padding-left: 22px; }
.result-markdown li { margin: 3px 0; }
.result-markdown blockquote {
  border-left: 3px solid #cbd5e1;
  margin: 8px 0;
  padding: 4px 12px;
  color: #475569;
  background: #f8fafc;
  border-radius: 0 4px 4px 0;
}
.result-markdown pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0;
  position: relative;
}
.result-markdown code {
  background: #f1f5f9;
  color: #0969da;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: Consolas, monospace;
  font-size: 13px;
}
.result-markdown pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}
.result-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-copy {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.btn-copy:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}
.diagnosis-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.6;
}
.diagnosis-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: #b45309;
}
.cost-tag {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-weight: 600;
}

@media (max-width: 960px) {
  .connector-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 小白模版快速选择栏 */
.template-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}
.template-label {
  font-size: 12.5px;
  color: #475569;
  font-weight: 600;
}
.btn-template {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-template:hover {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

/* 产出物文件交付卡片 */
.delivery-box {
  margin-top: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 14px;
}
.delivery-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #166534;
}
.delivery-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.file-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.file-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #86efac;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  color: #15803d;
  font-family: Consolas, monospace;
}
.file-size {
  color: #64748b;
  font-size: 11px;
}

/* 多轮对话与追问框 */
.followup-box {
  margin-top: 14px;
  border-top: 1px dashed #cbd5e1;
  padding-top: 12px;
}
.followup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #334155;
  margin-bottom: 8px;
}
.btn-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover {
  color: #1d4ed8;
}
.thread-messages {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.thread-messages.hidden {
  display: none;
}
.message-turn {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.turn-user {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  color: #1e3a8a;
}
.turn-assistant {
  background: #f1f5f9;
  border-left: 3px solid #10b981;
  color: #0f172a;
}
.turn-meta {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #475569;
}
.followup-input-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.followup-text {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.followup-text:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.followup-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.followup-ai-select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

/* ==========================================================================
   V3.0 多 AI 协同对话工作台样式
   ========================================================================== */

.app-layout {
  display: flex;
  flex: 1;
  height: 100%;
  min-height: 0;
  max-height: none;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.wb-sidebar {
  width: 250px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.sidebar-nav {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  flex-shrink: 0;
}

.sidebar-nav .nav-tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-nav .nav-tab-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.sidebar-nav .nav-tab-item.active {
  background: #eff6ff;
  color: var(--primary);
  border-color: #bfdbfe;
  font-weight: 700;
}

.nav-tab-icon {
  font-size: 14px;
}

.nav-tab-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wb-sidebar-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  flex-shrink: 0;
}

.wb-sidebar-header h3 {
  margin: 0;
  font-size: 13.5px;
  color: #334155;
  font-weight: 700;
}

.wb-search-box {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  flex-shrink: 0;
}

.wb-search-box input {
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  outline: none;
}

.wb-search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.wb-project-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wb-project-item {
  padding: 10px 12px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.wb-project-item:hover {
  border-color: #93c5fd;
  background: #f0f7ff;
}

.wb-project-item.active {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1);
}

.wb-item-title {
  font-weight: 600;
  font-size: 13px;
  color: #1e293b;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wb-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #64748b;
}

.app-main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.wb-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.empty-wb-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
  color: #475569;
  height: 100%;
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 14px;
}

.role-explain-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 36px;
  max-width: 860px;
  text-align: left;
}

.re-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  gap: 12px;
}

.re-avatar {
  font-size: 28px;
}

.re-info strong {
  font-size: 13.5px;
  color: #1e293b;
  display: block;
  margin-bottom: 6px;
}

.re-info p {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.chat-header {
  flex-shrink: 0;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-title-row h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
}

.chat-path-row {
  margin-top: 2px;
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-path-row code {
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10.5px;
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

.chat-bubble {
  display: flex;
  gap: 12px;
  max-width: 96%;
}

.chat-bubble.bubble-user {
  align-self: flex-end;
  flex-direction: row-reverse;
  max-width: 85%;
}

.chat-bubble.bubble-assistant {
  align-self: flex-start;
  max-width: 95%;
}

.bubble-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.bubble-user .bubble-avatar {
  background: #1d4ed8;
  color: #ffffff;
  border: 2px solid #93c5fd;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}

.bubble-assistant .bubble-avatar {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.bubble-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.65;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

.bubble-user .bubble-card {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #ffffff !important;
  border: 1px solid #1e40af;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.bubble-user .bubble-card p,
.bubble-user .bubble-card span,
.bubble-user .bubble-card strong,
.bubble-user .bubble-card div {
  color: #ffffff !important;
}

.bubble-assistant .bubble-card {
  border-bottom-left-radius: 2px;
  color: #1e293b;
}

.bubble-sender {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #475569;
}

.bubble-user .bubble-sender {
  color: #fef08a !important; /* 醒目亮金色，凸显老板发言 */
  text-align: right;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.bubble-time {
  font-size: 11px;
  font-weight: 400;
  color: #94a3b8;
  margin-left: 6px;
}

.bubble-user .bubble-time {
  color: #dbeafe !important;
}

/* 方案就绪卡片 */
.proposal-box {
  margin-top: 14px;
  background: #eff6ff;
  border: 1.5px solid #3b82f6;
  border-radius: 10px;
  padding: 16px 18px;
}

.proposal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14.5px;
  color: #1d4ed8;
  margin-bottom: 8px;
}

.proposal-body {
  font-size: 13px;
  color: #1e3a8a;
  line-height: 1.5;
  margin-bottom: 14px;
}

.proposal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* 交付物验收卡片 */
.deliverable-box {
  margin-top: 14px;
  background: #f0fdf4;
  border: 1.5px solid #22c55e;
  border-radius: 10px;
  padding: 16px 18px;
}

.deliverable-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14.5px;
  color: #15803d;
  margin-bottom: 8px;
}

.deliverable-body {
  font-size: 13px;
  color: #166534;
  line-height: 1.5;
  margin-bottom: 12px;
}

.deliverable-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* 底部聊天输入栏（无论窗口如何缩放，死死吸附在视口最底部，绝不被顶出屏幕） */
.chat-input-bar {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 8px 14px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 10;
}

.input-controls {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.input-controls textarea {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  line-height: 1.5;
}

.input-controls textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
  max-height: 120px;
  line-height: 1.5;
}

.input-controls textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.input-footnote {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: #94a3b8;
}

/* 图片上传预览条 */
.image-preview-bar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #f1f5f9;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  margin-bottom: 6px;
}
.image-preview-bar.hidden {
  display: none !important;
}
.img-preview-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
}
.img-preview-card img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}
.img-preview-card .img-name {
  font-size: 12.5px;
  color: #334155;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-remove-img {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-remove-img:hover {
  background: #fca5a5;
}
.btn-attach-img {
  padding: 8px 14px;
  font-size: 13.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-msg-img {
  max-width: 360px;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  display: block;
  margin-top: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease;
}
.chat-msg-img:hover {
  transform: scale(1.02);
}
.chat-img-wrap {
  margin: 6px 0;
}

/* ==========================================================================
   移动端与小屏幕自适应 (Responsive Adaptation)
   ========================================================================== */

@media (max-width: 900px) {
  .connector-grid {
    grid-template-columns: 1fr;
  }
  .role-explain-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  html, body {
    height: auto;
    overflow: auto;
  }
  body {
    display: block;
  }
  .container {
    height: auto;
    overflow: visible;
    padding: 0 8px;
    margin: 8px auto 24px;
  }
  .tab-panel.active {
    overflow: visible;
    display: block;
  }
  .topbar-inner {
    padding: 10px 12px;
  }
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .app-layout {
    flex-direction: column;
    height: auto;
    max-height: none;
  }
  .wb-sidebar {
    width: 100%;
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .chat-container {
    height: 70vh;
  }
  .chat-bubble {
    max-width: 94%;
  }
  .modal {
    width: 94%;
    max-height: 90vh;
    border-radius: 10px;
  }
  .modal-body {
    padding: 12px 14px;
  }
  .modal-footer {
    padding: 10px 14px;
  }
}
