* { box-sizing: border-box; }
:root {
  --bg-app: #f4f6fa;
  --bg-card: #ffffff;
  --bg-soft: #f7f9fc;
  --line: #e8ebf0;
  --line-strong: #d9dee7;
  --text-main: #1f2329;
  --text-sub: #667085;
  --text-soft: #98a2b3;
  --primary: #3370ff;
  --primary-soft: #edf3ff;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --ui-font-mini: 12px;
  --ui-font-sm: 13px;
  --ui-font-xs: 11px;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --lexical-indent-base-value: 24px;
}
html, body {
  width: 100%;
  min-height: 100%;
}
body {
  margin: 0;
  font-family: Inter, "PingFang SC", "PingFang TC", "Noto Sans TC", "Microsoft YaHei", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 12px;
  line-height: 1.55;
  font-weight: var(--font-weight-regular);
}
blockquote,button,dd,dl,dt,fieldset,form,h1,h2,h3,h4,hr,input,legend,li,ol,p,pre,svg,td,textarea,th,ul {
  margin: 0;
}
.textEllipsis { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.textEllipsis2, .textEllipsis3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.textEllipsis2 { -webkit-line-clamp: 2; line-clamp: 2; }
.textEllipsis3 { -webkit-line-clamp: 3; line-clamp: 3; }
.textlg {
  background: linear-gradient(to bottom right, #1237b3, #3370ff 40%, #4e83fd 80%, #85b1ff);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* FastGPT-like global utility */
body input,
body select {
  --input-font-size: var(--ui-font-sm) !important;
}
input::placeholder,
textarea::placeholder {
  font-size: var(--ui-font-mini);
}
span[tabindex="0"] {
  line-height: 1;
}
.grecaptcha-badge {
  display: none !important;
}
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-focus-ring-color: rgba(0, 0, 0, 0);
}
.container { max-width: 1400px; margin: 0 auto; padding: 0 18px; }
.site-header {
  background: var(--bg-card);
  color: var(--text-main);
  border-bottom: 1px solid #eceff4;
  position: sticky;
  top: 0;
  z-index: 30;
}
.nav { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo-dot {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #4f8dff, var(--primary));
  color: #fff; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(37,99,235,.3);
}
.brand h1 { margin: 0; font-size: 18px; color: var(--text-main); }
.brand p { margin: 2px 0 0; color: var(--text-sub); font-size: 12px; }
.nav-actions { display: flex; gap: 8px; align-items: center; }
.top-user-display {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.2;
  text-align: right;
  min-width: 120px;
}
#lang-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: 38px;
  min-width: 108px;
  padding: 0 34px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(180deg, #ffffff, #f9fafb),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23e2e8f0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
      no-repeat right 10px center / 14px 14px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
#lang-select:hover {
  border-color: #93c5fd;
  background-color: #ffffff;
}
#lang-select:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147,197,253,.2);
}
#lang-select option {
  color: #0f172a;
  background: #ffffff;
}
.hero {
  margin: 14px 0 10px; border-radius: 14px; padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.top-nav-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.brand p { display: none; }
.hero h2 { margin: 0; font-size: 22px; }
.hero p { margin: 6px 0 0; color: var(--text-sub); }
.status-badge {
  padding: 9px 14px; border-radius: 999px; font-weight: 600; white-space: nowrap;
  background: var(--primary-soft); color: #245bdb; border: 1px solid #d6e4ff;
}
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin: 10px 0 14px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.stat-card .k { font-size: 12px; color: var(--text-sub); }
.stat-card .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.process-flow .steps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.process-flow .step {
  border: 1px solid #dbeafe; background: #eff6ff; color: #1e40af;
  border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 600;
}
.tabs {
  position: sticky; top: 0; z-index: 20; padding: 10px 0;
  display: flex; gap: 8px; flex-wrap: wrap; background: var(--bg-app);
}
.tab-btn {
  background: var(--bg-card); color: var(--text-sub); border: 1px solid transparent;
  border-radius: 10px; padding: 8px 12px;
}
.tab-btn.active {
  background: var(--primary);
  color: #fff; border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(51,112,255,.24);
}
h1,h2,h3 { margin: 0; }
.card {
  background: #fbfbfc; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin: 6px 0; box-shadow: 0 1px 2px rgba(19,51,107,.06);
}
.card h3 {
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  color: #1f2937;
}
.card h4 {
  font-weight: var(--font-weight-medium);
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.row { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg-card); }
.sensitive-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: #fee2e2; color: #b91c1c; }
.muted { color: var(--text-sub); }
input, textarea, button, select {
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 10px; font-size: 12px;
  font-family: inherit;
}
input, textarea { min-width: 180px; }
textarea { width: 100%; background: var(--bg-soft); }
input, select { background: #fff; color: var(--text-main); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}
button {
  cursor: pointer; color: #fff; border-color: var(--primary);
  background: var(--primary);
  font-weight: var(--font-weight-medium);
  line-height: 1.25;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
button:hover { filter: brightness(.97); }
.btn-secondary { background: #fff; color: var(--text-sub); border-color: var(--line-strong); }
.btn-secondary:hover { background: #f7f9fc; color: #344054; }
.result-panel {
  margin-top: 10px;
  white-space: pre-wrap;
  background: #fafbfc;
  color: #1f2937;
  border: 1px solid #e8edf3;
  border-left: 2px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 24px;
  max-height: 280px;
  overflow: auto;
  line-height: 1.5;
  font-size: 13px;
}
.dropzone {
  margin-top: 8px; border: 1px dashed #93c5fd; background: #f8fbff; color: #1e3a8a;
  border-radius: 12px; padding: 16px; text-align: center; font-size: 13px;
}
.dropzone.dragover { border-color: #2563eb; background: #dbeafe; }
.upload-progress-wrap { margin-top: 10px; }
.upload-progress-label { font-size: 12px; color: #475569; margin-bottom: 6px; }
.upload-progress-bar { width: 100%; height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.upload-progress-inner { width: 0%; height: 100%; background: linear-gradient(90deg, #3b82f6, #6366f1); transition: width .12s linear; }
.upload-wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
.upload-step {
  border: 1px solid var(--line);
  background: #f7f9fc;
  color: var(--text-sub);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  text-align: center;
}
.upload-step.active {
  border-color: #d6e4ff;
  background: var(--primary-soft);
  color: #245bdb;
  font-weight: 600;
}
.upload-wizard-panel {
  margin-top: 10px;
}
.upload-wizard-nav {
  justify-content: space-between;
  margin-top: 10px;
}
.table-wrap { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: auto; background: #fff; }
#dashboard-contract-alerts-wrap {
  max-height: 320px;
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 9px; border-bottom: 1px solid #f1f5f9; text-align: left; vertical-align: top; }
th { background: #f9fafb; position: sticky; top: 0; z-index: 1; color: #64748b; font-weight: var(--font-weight-medium); }
.mini-btn { font-size: 12px; padding: 6px 9px; background: #fff; color: var(--text-sub); border-color: var(--line-strong); }
.mini-btn:hover { background: #f7f9fc; }
.citation-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 10px; margin-top: 8px; }
.citation-item { border: 1px solid #dbeafe; background: #f8fbff; border-radius: 10px; padding: 9px; }
.chat-thread {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 12px;
  min-height: 90px;
  padding: 12px;
  margin-bottom: 8px;
}
.rag-fastgpt-thread {
  max-height: 440px;
  overflow-y: auto;
  padding: 16px 14px;
}
.chat-bubble {
  max-width: 92%;
  padding: 9px 12px;
  border-radius: 14px;
  margin: 6px 0;
  white-space: pre-wrap;
  line-height: 1.52;
  font-size: 13px;
  font-weight: var(--font-weight-regular);
}
.chat-bubble.user {
  margin-left: auto;
  background: #e8f1ff;
  border: 1px solid #c7dcff;
}
.chat-bubble.assistant {
  margin-right: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.chat-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #dbe5f2;
}
.rag-input-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.rag-input-wrap textarea {
  margin: 0;
  border: 0;
  box-shadow: none;
  background: #fff;
  min-height: 66px;
}
.rag-input-wrap textarea:focus {
  box-shadow: none;
}
.rag-source-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rag-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  text-decoration: none;
}
.rag-source-chip:hover {
  background: #eff6ff;
}
.dataset-search-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 12px;
}
.dataset-test-box,
.dataset-history-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  margin-bottom: 10px;
}
.dataset-history-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  padding: 7px 9px;
  font-size: 12px;
  color: #374151;
  font-weight: var(--font-weight-regular);
  margin-bottom: 6px;
  cursor: pointer;
}
.dataset-history-item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.fgpt-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.fgpt-head-actions {
  margin: 0;
  justify-content: flex-end;
}
.dashboard-fastgpt-stats {
  margin-top: 0;
}
.dashboard-fastgpt-stats .stat-card {
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  min-height: 82px;
  border-color: #e8ebf0;
}
.dashboard-fastgpt-stats .stat-card .v {
  color: #0f172a;
}
.dashboard-server-block {
  margin-top: 8px;
  padding: 8px 10px;
}
.dashboard-server-chart {
  width: 100%;
  height: 190px;
}
.dashboard-server-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.dashboard-server-item {
  border: 1px solid #e8ebf0;
  border-radius: 8px;
  background: #fff;
  padding: 6px 7px;
}
.dashboard-server-item .k {
  font-size: 10px;
  color: var(--text-sub);
}
.dashboard-server-item .v {
  font-size: 12px;
  color: var(--text-main);
  font-weight: var(--font-weight-semibold);
  margin-top: 2px;
}
.dashboard-flow-output {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}
.dashboard-flow-line {
  border: 1px solid #e8ebf0;
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  font-size: 11px;
  color: var(--text-sub);
}
.process-flow {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  margin-top: 6px;
}
.dataset-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dataset-toolbar .btn-secondary.active {
  background: var(--primary-soft);
  color: #245bdb;
  border-color: #d6e4ff;
}
.fgpt-block {
  border: 1px solid #e8ebf0;
  border-radius: 12px;
  background: #fff;
  padding: 9px;
  margin-top: 7px;
}
.fgpt-block h3 {
  margin-bottom: 8px;
}
.dataset-fastgpt-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 12px;
}
.dataset-fastgpt-sidebar {
  display: grid;
  gap: 10px;
}
.dataset-fastgpt-sidebar textarea {
  margin-top: 8px;
}
.dataset-fastgpt-main {
  border: 1px solid #e8ebf0;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  min-height: 560px;
}
.dataset-fastgpt-main .rag-fastgpt-thread {
  min-height: 390px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 12px;
}
.dataset-fastgpt-main .citation-list {
  margin-top: 12px;
}

.chat-agent-fastgpt {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  min-height: calc(100vh - 140px);
}
.chat-agent-left {
  display: grid;
  gap: 10px;
  align-content: start;
}
.chat-agent-left .assistant-quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}
.chat-agent-main {
  border: 1px solid #e8ebf0;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
}
.chat-agent-thread {
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  margin-bottom: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}
.chat-agent-main #chat-agent-starter .assistant-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.chat-agent-input-row {
  margin-top: auto;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}
.chat-agent-followups {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}
.chat-agent-followups:empty {
  display: none;
}
.chat-followup-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chat-followup-label {
  font-size: 11px;
  color: #64748b;
  margin-right: 4px;
}
.chat-followup-btn {
  border: 1px solid #d7deea;
  background: #f7faff;
  color: #334155;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}
.chat-followup-btn:hover {
  background: #edf3ff;
}
.chat-agent-input-row input {
  flex: 1;
  border: 0;
  box-shadow: none;
}
.chat-agent-input-row button {
  border-radius: 0;
}
.fgpt-subtabs {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: #ffffff;
}
.contract-subtabs .btn-secondary {
  border-radius: 9px;
}
.customer-subtabs {
  margin: 8px 0 10px;
  border: 1px solid #e8edf5;
  border-radius: 12px;
  padding: 6px;
  background: #f8fafd;
}
.customer-subtabs .btn-secondary {
  border-radius: 8px;
  border-color: transparent;
  background: transparent;
  color: #475467;
  font-weight: 500;
}
.customer-subtabs .btn-secondary.active {
  background: #ffffff;
  border-color: #d6e4ff;
  color: #175cd3;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
}
.customer-sub-panel.fgpt-block {
  margin-top: 8px;
  border: 1px solid #eaecf0;
  border-radius: 14px;
}
#tab-customer .customer-panel-tip {
  margin: 0 0 8px;
  font-size: 12px;
}
#tab-customer .customer-sub-panel .row {
  margin: 8px 0;
}
#tab-customer .customer-sub-panel input,
#tab-customer .customer-sub-panel select,
#tab-customer .customer-sub-panel textarea {
  min-height: 36px;
}
#tab-customer .customer-sub-panel textarea {
  line-height: 1.45;
}
.contract-sub-panel.fgpt-block {
  margin-top: 10px;
}
.contract-sub-panel .row {
  margin: 10px 0;
}
.upload-wizard-panel {
  margin-top: 12px;
}
#tab-netdisk .netdisk-sub-panel > .fgpt-block,
#tab-netdisk #netdisk-panel-upload {
  background: #fff;
}
#tab-netdisk .upload-wizard-steps {
  margin-top: 0;
}
#tab-netdisk .upload-step {
  background: #ffffff;
  border-color: #e2e8f0;
}
#tab-netdisk .upload-step.active {
  background: #eaf2ff;
  border-color: #bfdbfe;
}
#tab-netdisk .upload-wizard-nav {
  margin-bottom: 0;
}
#tab-netdisk #netdisk-panel-upload .table-wrap,
#tab-contract .table-wrap {
  border-radius: 12px;
}
#tab-netdisk .netdisk-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}
#tab-netdisk .netdisk-toolbar input {
  min-width: 260px;
}
#tab-netdisk .netdisk-toolbar select {
  min-width: 110px;
}
#tab-netdisk .table-wrap {
  border-radius: 12px;
}
#tab-netdisk .netdisk-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 10px;
}
#tab-netdisk .netdisk-sub-panel {
  margin-top: 8px;
  border: 1px solid #eaecf0;
  border-radius: 14px;
}
#tab-training .training-knowledge-list {
  line-height: 1.8;
}
#tab-training .training-knowledge-list .training-knowledge-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-card);
}
#tab-training .training-knowledge-list .training-knowledge-title {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
}
#tab-training .training-knowledge-list .mini-btn {
  margin-left: auto;
  white-space: nowrap;
}
#tab-training .assistant-quick-actions {
  grid-template-columns: 1fr;
}
#tab-training .training-sidebar {
  height: calc(100vh - 210px);
}
#tab-training .training-kmap-block {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#tab-training .training-peer-block {
  flex: 0 0 auto;
}
#tab-training .training-checklist-block,
#tab-training .training-quiz-block {
  flex: 0 0 auto;
}
#tab-training .training-material-shortcut-block {
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
}
#tab-training .training-sidebar-body {
  min-height: 0;
  overflow-y: visible;
}
#tab-training #training-chat-thread {
  max-height: 360px;
  min-height: 180px;
}
#tab-training .training-quick-inline {
  margin-bottom: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
#tab-training .training-chat-actions {
  justify-content: flex-end;
}
#tab-training .training-checklist-list,
#tab-training .training-quiz-list {
  margin-top: 6px;
  display: grid;
  gap: 6px;
}
#tab-training .training-check-item,
#tab-training .training-quiz-item {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
#tab-training .training-quiz-item {
  justify-content: space-between;
}
#tab-training .training-quiz-text {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
}
#tab-training .fgpt-block {
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
#tab-customer .fgpt-block,
#tab-advice .fgpt-block,
#tab-ops .fgpt-block,
#tab-admin .fgpt-block {
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
#tab-customer .customer-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
#tab-customer .customer-profile-card {
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#tab-customer .customer-profile-card h4 {
  margin: 2px 0 4px;
  font-size: 13px;
  color: #1d2939;
  font-weight: 600;
}
#tab-customer .customer-profile-card textarea,
#tab-customer .customer-profile-card input,
#tab-customer .customer-profile-card select {
  width: 100%;
}
#tab-customer .customer-profile-card .row {
  margin: 0;
}
#tab-ops > .row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 8px;
}
#tab-ops .ops-panel h3,
#tab-ops .ops-panel h4 {
  margin-top: 4px;
}
@media (max-width: 1100px) {
  .dataset-search-layout {
    grid-template-columns: 1fr;
  }
  .dataset-fastgpt-layout,
  .chat-agent-fastgpt {
    grid-template-columns: 1fr;
  }
  .dataset-fastgpt-main,
  .chat-agent-main {
    min-height: calc(100vh - 190px);
  }
  .fgpt-page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .fgpt-head-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .dashboard-server-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #tab-customer .customer-profile-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .chat-agent-left .fgpt-block:first-child {
    display: none;
  }
  .chat-agent-main #chat-agent-starter .assistant-quick-actions {
    grid-template-columns: 1fr;
  }
  .chat-agent-thread {
    max-height: calc(100vh - 320px);
  }
}
.ops-panel.hidden { display: none; }
.ops-panel h4 {
  margin-top: 12px;
  color: #1f2937;
}
#ops-my-panel .row textarea {
  min-height: 74px;
}
#table-workflow-list-wrap,
#table-workflow-steps-wrap,
#agent-table-wrap {
  background: #ffffff;
}
h4 {
  margin: 14px 0 8px;
  font-size: 15px;
}
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  background: #111827; color: #fff; border-radius: 8px; padding: 10px 12px;
  opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.loading-mask {
  position: fixed; inset: 0; z-index: 180; color: #fff;
  background: rgba(2,6,23,.35); display: flex; align-items: center; justify-content: center; gap: 10px;
}
.hidden { display: none; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 980px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { flex-direction: column; align-items: flex-start; }
}

/* View mode states */
body.logged-out .tabs,
body.logged-out .hero,
body.logged-out .stats-grid,
body.logged-out .process-flow,
body.logged-out #btn-logout {
  display: none !important;
}
body.logged-out {
  background:
    radial-gradient(circle at 18% 16%, rgba(255,255,255,.45), rgba(255,255,255,0) 35%),
    url("/bg.svg") center/cover no-repeat fixed;
}
body.logged-out .tab-content { display: none !important; }
body.logged-out #tab-auth {
  display: block !important;
  max-width: 430px;
  margin: 96px auto;
  border-radius: 18px;
  border: 1px solid #e6ecf5;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  padding: 24px;
  background: #ffffff;
}
body.logged-out .site-header {
  position: sticky;
  top: 0;
  z-index: 10;
}
body.logged-out .brand p {
  display: none;
}
body.logged-out #tab-auth h3 {
  font-size: 24px;
  margin-bottom: 2px;
  letter-spacing: .01em;
}
body.logged-out #tab-auth .row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0 8px;
}
body.logged-out #tab-auth input {
  width: 100%;
  min-width: 0;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #dbe4f0;
  background: #f8fbff;
}
body.logged-out #tab-auth #btn-login {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  border-color: var(--primary);
}
body.logged-out #auth-info-detail {
  margin-top: 8px;
  min-height: 18px;
  font-size: 12px;
  color: #6b7280;
}
body.logged-out .auth-branding {
  display: flex;
  align-items: center;
  gap: 10px;
}
body.logged-out .auth-links {
  margin-top: 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
body.logged-out .nav-actions {
  gap: 6px;
}
body.logged-out .top-user-display {
  display: none;
}
body.logged-out .site-header {
  background: transparent;
  border-bottom: 0;
}
body.logged-out .brand {
  opacity: 0;
}

/* FastGPT-like left panel */
body.logged-in .tabs {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  float: none;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #f4f6fa;
  border: 0;
  border-radius: 0;
  padding: 8px 6px;
  margin: 0;
  box-shadow: none;
  z-index: 35;
}
body.logged-in .tabs .sidebar-top {
  padding: 4px 0 10px;
  display: flex;
  justify-content: center;
}
body.logged-in .tabs .sidebar-brand {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(180deg, #5d8fff, #2f6fff);
  color: transparent;
  position: relative;
}
body.logged-in .tabs .sidebar-brand::after {
  content: "W";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}
body.logged-in .tabs .sidebar-menu {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 4px;
  align-items: center;
}
body.logged-in .tabs .tab-btn {
  width: 60px;
  justify-content: center;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 4px;
  min-height: 68px;
  margin-bottom: 0;
  padding: 6px 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #475467;
  font-size: 10px;
  font-weight: var(--font-weight-medium);
  line-height: 1.2;
  text-align: center;
}
body.logged-in .tabs .tab-btn:hover {
  background: #eef2f7;
}
body.logged-in .tabs .tab-btn.active {
  background: #ffffff;
  color: #2f6fff;
  border-color: #eef2f7;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
  position: relative;
}
body.logged-in .tabs .tab-btn::before {
  content: attr(data-icon);
  font-size: 22px;
  line-height: 1;
  opacity: .7;
}
body.logged-in .tabs .side-action-btn {
  width: 60px;
  margin: 0;
  border-style: solid;
  background: transparent;
  border-color: transparent;
  color: #475467;
}
body.logged-in .tabs .side-user-footer {
  margin-top: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 4px 0;
}
body.logged-in .tabs .side-user-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #667085;
  font-size: 10px;
  margin-bottom: 4px;
}
body.logged-in .tabs .side-user-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  font-size: 22px;
  color: #98a2b3;
}
body.logged-in .tabs #side-user-display {
  display: block;
  max-width: 60px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #667085;
  font-size: 10px;
  font-weight: var(--font-weight-medium);
}
body.logged-in .tabs #btn-logout-side {
  width: 60px;
  min-height: 24px;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 10px;
}
body.logged-in .tab-btn[data-tab="tab-auth"] {
  display: none !important;
}
body.logged-in .tab-content {
  margin-left: 84px;
  background: transparent;
}
body.logged-in .site-header {
  display: none !important;
}
body.logged-in main.container {
  max-width: none;
  margin: 0;
  padding: 0 12px 0 0;
  background: var(--bg-app);
}
.steps .step.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* top nav buttons align with left menu style */
#top-nav-bar .btn-secondary {
  border-radius: 9px;
  border-color: var(--line);
  color: var(--text-sub);
  padding: 7px 10px;
  font-size: 13px;
}
#top-nav-bar .btn-secondary:hover {
  background: #f7f9fc;
}

/* popup assistant */
.assistant-fab {
  position: fixed;
  right: 20px;
  bottom: 22px;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1e3a8a;
  font-weight: 700;
  z-index: 150;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .25);
}
.assistant-popup {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 340px;
  max-width: calc(100vw - 20px);
  max-height: 66vh;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
  display: flex;
  flex-direction: column;
  z-index: 160;
}
.assistant-popup.fullscreen {
  left: 220px;
  right: 14px;
  top: 74px;
  bottom: 14px;
  width: auto;
  max-width: none;
  max-height: none;
}
.assistant-popup.fullscreen .assistant-popup-thread {
  max-height: none;
  height: 100%;
}
.assistant-popup.hidden {
  display: none !important;
}
.assistant-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.assistant-popup-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text-sub);
  padding: 0;
  line-height: 1;
}
.assistant-popup-close-btn:hover {
  background: #f7f9fc;
}
.assistant-popup-thread {
  padding: 10px 12px;
  overflow: auto;
  min-height: 120px;
  max-height: 100%;
  background: #ffffff;
}
.assistant-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.assistant-quick-actions .btn-secondary {
  padding: 7px 8px;
  font-size: 12px;
}
.assistant-popup-msg {
  margin: 6px 0;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: var(--font-weight-regular);
  white-space: pre-wrap;
  line-height: 1.5;
}
.assistant-popup-msg.user {
  margin-left: 30px;
  background: #edf3ff;
  border: 1px solid #d6e4ff;
}
.assistant-popup-msg.assistant {
  margin-right: 30px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.assistant-popup-input-row {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.assistant-popup-input-row input {
  flex: 1;
  min-width: 0;
}

.source-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
}
.source-preview-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(1px);
}
.source-preview-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(980px, 58vw);
  min-width: 520px;
  height: 100vh;
  border-radius: 0;
  border-left: 1px solid #dbe5f2;
  border-right: 0;
  border-top: 0;
  border-bottom: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -12px 0 28px rgba(15, 23, 42, 0.1);
  animation: source-preview-in .18s ease-out;
}
.source-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}
.source-preview-body {
  flex: 1;
  min-height: 0;
  background: #fff;
}
.source-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.source-preview-image {
  max-width: 100%;
  max-height: 100%;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}
.source-preview-text {
  margin: 0;
  height: 100%;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.5;
}
@keyframes source-preview-in {
  from {
    transform: translateX(18px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
body.preview-open {
  overflow: hidden;
}
.contract-subtabs .btn-secondary.active {
  background: var(--primary-soft);
  color: #245bdb;
  border-color: #d6e4ff;
}
.contract-sub-panel {
  margin-top: 8px;
}

/* fastgpt-like global scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; border-radius: 2px; }
::-webkit-scrollbar-thumb { background: rgba(189,193,197,.7); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #bdc1c5; }
div::-webkit-scrollbar-thumb { background: rgba(189,193,197,.7) !important; transition: background 1s; }
div::-webkit-scrollbar-thumb:hover { background: #bdc1c5 !important; }

/* nprogress */
#nprogress {
  pointer-events: none;
}
#nprogress .bar {
  background: #1237b3 !important;
  position: fixed;
  z-index: 1031;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
}
#nprogress .peg {
  display: block;
  position: absolute;
  right: 0;
  width: 100px;
  height: 100%;
  box-shadow: 0 0 10px #1237b3, 0 0 5px #1237b3;
  opacity: 1;
  transform: rotate(3deg) translateY(-4px);
}
#nprogress .spinner {
  display: block;
  position: fixed;
  z-index: 1031;
  top: 15px;
  right: 15px;
}
#nprogress .spinner-icon {
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border-color: #1237b3 transparent transparent #1237b3;
  border-style: solid;
  border-width: 2px;
  border-radius: 50%;
  animation: nprogress-spinner .4s linear infinite;
}
.nprogress-custom-parent {
  overflow: hidden;
  position: relative;
}
.nprogress-custom-parent #nprogress .bar,
.nprogress-custom-parent #nprogress .spinner {
  position: absolute;
}
@keyframes nprogress-spinner {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* desktop */
@media (min-width: 1281px) {
  body.logged-in .tabs { width: 74px; }
  body.logged-in .tab-content { margin-left: 84px; }
}

/* tablet */
@media (min-width: 901px) and (max-width: 1280px) {
  .container { padding: 0 14px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .nav { min-height: 58px; }
  .brand h1 { font-size: 16px; }
  body.logged-in .tabs {
    width: 70px;
    padding: 8px 5px;
  }
  body.logged-in .tab-content {
    margin-left: 80px;
  }
  .assistant-popup.fullscreen {
    left: 192px;
    right: 12px;
    top: 68px;
    bottom: 12px;
  }
}

/* mobile */
@media (max-width: 900px) {
  html { font-size: 14px; }
  ::-webkit-scrollbar { width: 2px; height: 2px; }
  .container { padding: 0 10px; }
  .nav {
    min-height: 54px;
    gap: 8px;
  }
  .brand h1 { font-size: 15px; }
  .nav-actions {
    gap: 6px;
  }
  .top-user-display { display: none; }
  #lang-select { min-width: 84px; height: 34px; font-size: 12px; }
  #btn-logout { height: 34px; padding: 0 10px; font-size: 12px; }

  body.logged-in .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 60;
    width: 100%;
    float: none;
    margin: 0;
    border-radius: 14px 14px 0 0;
    border-left: 0;
    border-right: 0;
    display: block;
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
    background: #f7f8fa;
  }
  body.logged-in .tabs .sidebar-top {
    display: none;
  }
  body.logged-in .tabs .side-user-footer {
    display: none;
  }
  body.logged-in .tabs .sidebar-menu {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
  }
  body.logged-in .tabs .tab-btn {
    width: 100%;
    min-height: 44px;
    padding: 6px 4px;
    font-size: 11px;
    justify-content: center;
    text-align: center;
    margin: 0;
    border-radius: 10px;
    flex-direction: column;
    gap: 4px;
  }
  body.logged-in .tabs .tab-btn::before {
    font-size: 13px;
  }
  body.logged-in .tabs .side-action-btn {
    grid-column: 1 / -1;
    border-style: solid;
    min-height: 40px;
    flex-direction: row;
  }
  body.logged-in .tab-content {
    margin-left: 0;
    margin-bottom: calc(96px + env(safe-area-inset-bottom));
  }
  .stats-grid { grid-template-columns: 1fr; }
  .row { gap: 6px; }
  input, textarea, select, button { font-size: 13px; }
  .dataset-search-layout { grid-template-columns: 1fr; }
  .assistant-popup.fullscreen {
    left: 8px;
    right: 8px;
    top: 62px;
    bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .source-preview-panel {
    width: 100vw;
    min-width: 0;
  }
}

@supports (bottom: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}
