/*
 * YOLO v3 visual layer.
 * Loaded after styles.css so the existing application behavior stays intact.
 */

:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --surface-3: #eff2f5;
  --surface-muted: #f5f7f9;
  --surface-tint: #f7f9fb;
  --border: #eceff3;
  --border-strong: #dde3e9;
  --text: #22303e;
  --text-2: #64748b;
  --text-3: #9aa7b4;
  --text-secondary: #64748b;
  --text-muted: #9aa7b4;
  /* 使用引导 / 帮助中心新增的文本安全令牌：--text-3 仅 2.45:1，不能承载文本。 */
  --ink-3: #6b7280;
  --link: #2563eb;
  --field-border: #808e9c;
  --ok-soft: #eff8f5;
  --warn-soft: #fbf7ed;
  --accent: #3b82f6;
  --accent-weak: #eef5ff;
  --primary: #22303e;
  --primary-strong: #182431;
  --primary-soft: #eef2f6;
  --ok: #16a37a;
  --warn: #c2851f;
  --bad: #d26a5c;
  --alert: #d97a2b;
  --teal: #16a37a;
  --teal-soft: #eff8f5;
  --amber: #c2851f;
  --amber-soft: #fbf7ed;
  --red: #d26a5c;
  --red-soft: #fbf2f1;
  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 18px;
  --shadow-s: 0 1px 2px rgba(30, 45, 60, 0.04);
  --shadow-m: 0 6px 24px rgba(30, 45, 60, 0.06);
  --shadow: var(--shadow-m);
  --shadow-soft: var(--shadow-s);
  --font:
    "Segoe UI Variable",
    "PingFang SC",
    "Microsoft YaHei UI",
    system-ui,
    sans-serif;
  --sidebar-w: 224px;
  --chat-surface: #fafbfc;
  --workspace-drawer-width: 360px;
  --text-shadow-soft: none;
  --text-shadow-dark: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* 横向溢出统一交给 body 裁切：html 保持 overflow:visible 时，body 的 overflow
   会「传播到视口」由视口负责裁切，body 自身的 used overflow 变回 visible，
   不会变成独立滚动容器 —— .sidebar 的 position: sticky 才能按视口吸附。
   反例（本文件曾如此）：给 html 也写 overflow-x: hidden，传播链被打断，
   body 变成滚动容器（另一轴被计算成 auto），sticky 相对 body 的内容高度计算、
   永远不会触发，表现为整条侧栏连同底部用户信息随整页滚走。
   改动前请确认所有页面的横向溢出仍被视口裁切。 */
body {
  overflow-x: hidden;
}

body,
button,
input,
select,
textarea,
.btn,
.tag,
.modal,
.toast {
  text-shadow: none;
}

::selection {
  color: #ffffff;
  background: #6d7f90;
}

button,
input,
select,
textarea {
  font-family: var(--font);
}

a {
  color: var(--accent);
}

/* Shell and navigation */
.app-shell {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  padding: 18px 12px 14px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  box-shadow: none;
  backdrop-filter: none;
}

.brand {
  min-height: 48px;
  padding: 2px 8px 16px;
  gap: 10px;
  border-bottom: 0;
}

.brand-mark {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  display: block;
  flex: 0 0 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

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

.brand-copy strong {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: 0.01em;
  text-shadow: none;
}

.main-nav {
  gap: 1px;
  margin-top: 8px;
}

.nav-group-label {
  padding: 8px 10px 4px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.nav-item,
.nav-item.is-active {
  min-height: 30px;
  padding: 5px 10px;
  gap: 9px;
  border: 0;
  border-radius: var(--radius-s);
  color: var(--text-2);
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transform: none;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-3);
  transform: none;
}

.nav-item.is-active {
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  font-weight: 620;
}

.nav-item > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item .nav-count,
.nav-item .nav-badge {
  margin-left: auto;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 500;
}

/* 会话记录占满导航与页脚之间的剩余高度，列表内部滚动，让可视区域尽量大。 */
.sidebar-sessions {
  margin-top: 12px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--border);
}

.sidebar-session-head {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 8px 6px;
}

.sidebar-session-head strong {
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 620;
}

.sidebar-session-head small {
  color: var(--text-3);
  font-size: 10px;
}

.sidebar-sessions .session-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0 8px;
}

.sidebar-sessions .session-item {
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
}

.sidebar-sessions .session-item:hover {
  border: 0;
  background: var(--surface-3);
  transform: none;
}

.sidebar-sessions .session-item.is-active {
  border: 0;
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.sidebar-sessions .session-main {
  gap: 3px;
  padding: 8px 32px 8px 9px;
  color: var(--text-2);
  font-size: 12px;
}

.sidebar-sessions .session-main strong {
  color: inherit;
  font-size: 12px;
  font-weight: 520;
}

.sidebar-sessions .session-item.is-active .session-main,
.sidebar-sessions .session-item.is-active .session-main strong {
  color: var(--text);
  font-weight: 600;
}

.sidebar-sessions .session-main time {
  color: var(--text-3);
  font-size: 10px;
}

.sidebar-sessions .session-delete {
  opacity: 0;
}

.sidebar-sessions .session-item:hover .session-delete,
.sidebar-sessions .session-item:focus-within .session-delete {
  opacity: 1;
}

.sidebar-foot {
  padding-top: 10px;
}

.runtime-box {
  min-height: 32px;
  padding: 5px 9px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  box-shadow: none;
}

.runtime-box:hover {
  background: var(--surface-2);
}

.runtime-dot {
  width: 7px;
  height: 7px;
  background: var(--ok);
  box-shadow: none;
}

.runtime-box strong {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.runtime-box small {
  margin-top: 1px;
  color: var(--text-3);
  font-size: 10px;
  line-height: 1.25;
}

/* Snapshot / unavailable indicator-source warnings must stay visible (SOURCE-002). */
.runtime-box.is-warning small {
  color: var(--warn, #b7791f);
}

.runtime-box.is-warning .runtime-dot {
  background: var(--warn, #b7791f);
  box-shadow: 0 0 0 5px rgba(194, 133, 31, 0.14);
}

.runtime-box.is-error small {
  color: var(--danger, #c53030);
}

.runtime-box.is-alert small {
  color: var(--alert, #d97a2b);
}

.runtime-box.is-alert .runtime-dot {
  background: var(--alert, #d97a2b);
  box-shadow: 0 0 0 5px rgba(217, 122, 43, 0.14);
}

/* Header */
.workspace {
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg);
}

/* 高度与内边距统一由下方「全站统一紧凑顶栏」（body .topbar）控制，这里只保留外观。 */
.topbar {
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: blur(16px);
}

.topbar-heading {
  min-width: 0;
  overflow: hidden;
}

.topbar-title-row > h1 {
  flex: 0 0 auto;
  white-space: nowrap;
}

.topbar-title-row {
  min-width: 0;
  gap: 6px;
}

.topbar h1,
.topbar .topbar-title-row h1 {
  color: var(--text);
  font-size: 17px;
  font-weight: 660;
  letter-spacing: 0;
  text-shadow: none;
}

.topbar p {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11.5px;
}

.theme-breadcrumb {
  min-width: 0;
  gap: 4px;
}

.theme-breadcrumb-separator {
  color: var(--border-strong);
  font-size: 16px;
}

.theme-breadcrumb-select,
.theme-breadcrumb .ui-select-label {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 520;
}

.theme-breadcrumb .ui-select-trigger {
  min-height: 30px;
  padding: 4px 24px 4px 7px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
}

.theme-breadcrumb .ui-select-trigger:hover,
.theme-breadcrumb .ui-select-trigger:focus-visible,
.theme-breadcrumb .ui-select.is-open .ui-select-trigger {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.topbar-actions {
  flex: 0 0 auto;
  gap: 7px;
}

.topbar-icon-btn,
.user-switch {
  flex: 0 0 32px;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--text-2);
  background: transparent;
  box-shadow: none;
}

.topbar-icon-btn:hover,
.topbar-icon-btn:focus-visible,
.topbar-icon-btn:focus-within,
.user-switch:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
  outline: none;
}

.topbar-icon-slot svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.7;
}

.topbar-count {
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  border: 2px solid var(--bg);
  color: #ffffff;
  background: var(--text);
  font-size: 8px;
}

.topbar-icon-btn::after {
  top: calc(100% + 8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  background: var(--surface);
  box-shadow: var(--shadow-m);
  font-size: 11px;
}

.main-content {
  min-width: 0;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 24px 44px;
  background: var(--bg);
}

.main-content.is-chat {
  max-width: none;
  padding: 0;
  background: #ffffff;
}

.page-stack {
  gap: 16px;
}

/* Shared surfaces and typography */
.section-band,
.list-pane,
.chart-panel,
.summary-grid,
.modal,
.query-composer,
.kpi-item,
.parse-drawer-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  backdrop-filter: none;
}

.section-band {
  padding: 18px 20px 20px;
}

.section-head {
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  color: var(--text);
  font-size: 14px;
  font-weight: 660;
  letter-spacing: 0;
  text-shadow: none;
}

.section-head h3 {
  color: var(--text);
  font-size: 13px;
  font-weight: 640;
  text-shadow: none;
}

.section-head p {
  max-width: 760px;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.55;
}

.toolbar {
  gap: 8px;
  margin-top: 14px;
}

.toolbar > .ui-select {
  width: 190px;
  flex: 0 0 190px;
}

.grow {
  min-width: 180px;
  flex: 1;
}

.muted,
.mono {
  color: var(--text-3);
}

.mono {
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
  font-size: 10.5px;
}

.icon {
  display: inline-grid;
  place-items: center;
}

.icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons */
.btn {
  min-height: 34px;
  padding: 6px 12px;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  color: var(--text-2);
  background: var(--surface);
  box-shadow: none;
  font-size: 12.5px;
  font-weight: 520;
  transform: none;
}

.btn:hover {
  border-color: #ccd5dd;
  color: var(--text);
  background: var(--surface-2);
  box-shadow: none;
  transform: none;
}

.btn:focus-visible {
  border-color: #aebdca;
  outline: 2px solid rgba(59, 130, 246, 0.12);
  outline-offset: 1px;
}

.btn-primary,
.btn.dark {
  border-color: var(--text);
  color: #ffffff;
  background: var(--text);
  box-shadow: none;
  font-weight: 600;
}

.btn-primary:hover,
.btn.dark:hover {
  border-color: #33475b;
  color: #ffffff;
  background: #33475b;
}

.btn-quiet,
.btn.ghost {
  border-color: transparent;
  color: var(--text-2);
  background: transparent;
  box-shadow: none;
}

.btn-quiet:hover,
.btn.ghost:hover {
  border-color: transparent;
  color: var(--text);
  background: var(--surface-3);
}

.btn-small,
.btn.sm {
  min-height: 27px;
  padding: 3px 9px;
  border-color: transparent;
  border-radius: 7px;
  color: var(--text-3);
  background: transparent;
  font-size: 11.5px;
}

.btn-small:hover,
.btn.sm:hover {
  color: var(--text);
  background: var(--surface-3);
}

.btn-icon {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
}

.btn[disabled],
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Pills and status */
.tag,
.meta-pill,
.status-chip {
  min-height: 20px;
  padding: 2px 7px;
  border: 0;
  border-radius: 999px;
  color: var(--text-2);
  background: var(--surface-3);
  box-shadow: none;
  font-size: 10.5px;
  font-weight: 520;
  line-height: 1.5;
}

.tag-blue,
.meta-pill {
  color: #55718d;
  background: #eff4f8;
}

.tag-teal {
  color: #267a64;
  background: #eef7f4;
}

.tag-amber {
  color: #98702a;
  background: #faf5e9;
}

.tag-red {
  color: #a65b52;
  background: #faf1ef;
}

.status-chip::before {
  background: var(--ok);
}

/* Form controls */
.field,
.select,
.textarea,
.query-input {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  color: var(--text);
  background: var(--surface);
  box-shadow: none;
  font-size: 12.5px;
}

.textarea {
  min-height: 100px;
  line-height: 1.65;
  resize: vertical;
}

.field:hover,
.select:hover,
.textarea:hover,
.query-input:hover {
  border-color: #ccd5dd;
}

.field:focus,
.select:focus,
.textarea:focus,
.query-input:focus {
  border-color: #9fb3c5;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #a9b4bf;
  text-shadow: none;
}

.form-grid {
  gap: 16px 18px;
}

.form-field {
  gap: 6px;
}

.form-field > label {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 580;
}

.form-field > small,
.field-hint-row small {
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 1.5;
}

/* MCP 令牌页：创建按钮与名称/租户输入框并排（三列，按钮沉到底部与输入框底边齐平）。
   ≤760px 时下方 .form-grid 的 1 列媒体查询特异性相同且在后，自动覆盖为纵向堆叠。 */
.mcp-create-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mcp-create-action {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* 防止 flex 默认 stretch 把按钮横向拉满整列 */
  align-items: flex-start;
}

.datasource-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.datasource-type-tile {
  min-width: 0;
  min-height: 68px;
  padding: 9px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  text-align: center;
}

.datasource-type-tile:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.datasource-type-tile:focus-visible {
  outline: none;
  border-color: #9fb3c5;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.datasource-type-tile.is-active {
  border-color: #cbd8e4;
  color: var(--text);
  background: var(--accent-weak);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.12);
}

.datasource-type-tile > .icon {
  width: 22px;
  height: 22px;
  color: var(--text-2);
}

.datasource-type-tile.is-active > .icon {
  color: var(--text);
}

.datasource-type-tile > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.datasource-type-tile strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.datasource-type-tile small {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-3);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.check-item {
  min-width: 0;
  min-height: 40px;
  padding: 7px 9px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text-2);
  background: var(--surface);
  box-shadow: none;
  font-size: 12px;
}

.check-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  box-shadow: none;
}

.check-item:has(input:checked) {
  border-color: #cbd8e4;
  color: var(--text);
  background: var(--accent-weak);
}

.check-item input {
  width: 15px;
  height: 15px;
  position: relative;
  margin-top: 2px;
  flex: 0 0 auto;
  appearance: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}

.check-item input:checked {
  border-color: var(--text);
  background: var(--text);
}

.check-item input:checked::after {
  content: "";
  width: 7px;
  height: 4px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-left: 1.5px solid #ffffff;
  border-bottom: 1.5px solid #ffffff;
  transform: rotate(-45deg);
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 11.5px;
}

.inline-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  position: relative;
  flex: 0 0 auto;
  appearance: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}

.inline-check input[type="checkbox"]:checked {
  border-color: var(--text);
  background: var(--text);
}

.inline-check input[type="checkbox"]:checked::after {
  content: "";
  width: 7px;
  height: 4px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-left: 1.5px solid #ffffff;
  border-bottom: 1.5px solid #ffffff;
  transform: rotate(-45deg);
}

.check-item > span {
  min-width: 0;
}

.check-item strong {
  display: block;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  font-weight: 580;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-item small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tables */
.data-table-wrap,
.sub-table-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}

.section-band > .data-table-wrap {
  margin-top: 4px;
}

.data-table,
.sub-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
  font-size: 12px;
}

.data-table th,
.sub-table th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
  background: var(--surface-2);
  font-size: 10.5px;
  font-weight: 560;
  letter-spacing: 0;
  white-space: nowrap;
}

.data-table td,
.sub-table td {
  max-width: 360px;
  padding: 10px 12px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  background: transparent;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.data-table td strong,
.sub-table td strong {
  color: var(--text);
  font-weight: 600;
}

.data-table tbody tr:last-child td,
.sub-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover,
.sub-table tbody tr:hover,
.user-item:hover {
  background: var(--surface-2);
}

.data-table tbody tr.is-selected,
.sub-table tbody tr.is-selected {
  background: var(--accent-weak);
}

.data-table td.numeric-cell {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.table-cell-clamp {
  min-width: 0;
  max-width: 100%;
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-3);
  line-height: 1.55;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.data-table td > .table-cell-clamp,
.data-table td > .table-cell-clamp * {
  max-width: 100%;
}

.data-table td .muted {
  margin-top: 2px;
  font-size: 10.5px;
}

/* Navigation lists and secondary panes */
.two-column {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.list-pane {
  overflow: hidden;
}

.list-pane-head {
  min-height: 46px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 620;
}

.user-list {
  padding: 6px;
}

.user-item {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 8px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: var(--radius-s);
  color: var(--text-2);
  background: transparent;
  text-align: left;
  transform: none;
}

.user-item.is-active {
  color: var(--text);
  background: var(--surface-3);
}

.user-avatar,
.chat-message .user-avatar,
.user-item .user-avatar {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 50%;
  color: var(--text-2);
  background: var(--surface-3);
  box-shadow: none;
  font-size: 10.5px;
  font-weight: 650;
}

.user-item.is-active .user-avatar {
  color: #ffffff;
  background: var(--text);
}

.user-copy {
  min-width: 0;
}

.user-copy strong {
  display: block;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  font-weight: 580;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Summary strip */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
}

.summary-cell {
  min-height: 82px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.summary-cell:last-child {
  border-right: 0;
}

.summary-cell span {
  color: var(--text-3);
  font-size: 10.5px;
}

.summary-cell strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 21px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* Native/custom select drawer */
.ui-select {
  min-width: 0;
}

.ui-select-trigger {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  color: var(--text);
  background: var(--surface);
  box-shadow: none;
}

.ui-select-trigger:hover,
.ui-select-trigger:focus-visible,
.ui-select.is-open .ui-select-trigger {
  border-color: #aebdca;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.ui-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-select-menu {
  z-index: 210;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 42px rgba(34, 48, 62, 0.14);
  backdrop-filter: blur(16px);
}

.ui-select-menu.is-open {
  transform-origin: top center;
}

.ui-select-option {
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--text-2);
  background: transparent;
  font-size: 12px;
}

.ui-select-option:hover,
.ui-select-option:focus-visible {
  color: var(--text);
  background: var(--surface-2);
}

.ui-select-option.is-selected {
  color: var(--text);
  background: var(--surface-3);
  font-weight: 600;
}

.ui-select-check {
  color: var(--text);
}

/* Query workspace */
.chat-layout {
  min-width: 0;
  min-height: 0;
  background: #ffffff;
}

.chat-panel {
  min-width: 0;
  min-height: 0;
  background: #ffffff;
}

.chat-timeline {
  min-width: 0;
  padding: 30px 28px 42px;
  overflow-x: hidden;
  scrollbar-gutter: stable both-edges;
  background: #ffffff;
  scroll-behavior: auto;
}

.chat-thread {
  min-width: 0;
  width: min(100%, 924px);
  margin: 0 auto;
}

.chat-message {
  min-width: 0;
  gap: 10px;
  margin-bottom: 24px;
}

.chat-message.is-user {
  justify-content: flex-end;
  padding-left: 0;
}

.chat-message .user-avatar {
  display: none;
}

.chat-message .agent-avatar {
  display: none;
}

.agent-avatar,
.chat-agent-control .agent-avatar,
.chat-welcome .agent-avatar {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--text);
  box-shadow: none;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.agent-avatar::after,
.chat-agent-control .agent-avatar::after {
  display: none;
}

.user-bubble {
  width: fit-content;
  max-width: min(100%, 680px);
  padding: 9px 13px;
  border: 0;
  border-radius: 16px 16px 5px 16px;
  color: var(--text);
  background: var(--surface-3);
  box-shadow: none;
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.assistant-bubble {
  min-width: 0;
  width: 100%;
  max-width: none;
  padding: 2px 0 0;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: #ffffff;
  box-shadow: none;
}

.chat-answer-text {
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.78;
  text-shadow: none;
}

.chat-answer-text h2,
.chat-answer-text h3,
.chat-answer-text h4,
.chat-answer-text h5 {
  margin-top: 1.25em;
  margin-bottom: 0.5em;
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0;
  text-shadow: none;
}

.chat-answer-text h2:first-child,
.chat-answer-text h3:first-child,
.chat-answer-text h4:first-child,
.chat-answer-text p:first-child {
  margin-top: 0;
}

.chat-answer-text p {
  margin: 0 0 0.8em;
}

.chat-answer-text ul,
.chat-answer-text ol {
  margin: 0.35em 0 0.85em;
  padding-left: 1.45em;
}

.chat-answer-text li {
  margin: 0.2em 0;
}

.chat-answer-text blockquote {
  margin: 12px 0;
  padding: 9px 12px;
  border-left: 2px solid #b8c4ce;
  border-radius: 0 8px 8px 0;
  color: var(--text-2);
  background: var(--surface-2);
}

.chat-answer-text code,
.chat-answer-text .markdown-code {
  border: 1px solid var(--border);
  border-radius: 5px;
  color: #3f556a;
  background: var(--surface-2);
  font-size: 11.5px;
}

.chat-answer-text pre,
.markdown-code-block {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-2);
}

.answer-meta {
  gap: 6px;
  margin-top: 10px;
}

.meta-pill,
.answer-meta .tag {
  min-height: 20px;
  color: var(--text-3);
  background: var(--surface-2);
  font-size: 10px;
}

.provenance-pill {
  gap: 4px;
}

.provenance-pill .icon {
  width: 12px;
  height: 12px;
}

.kpi-grid.chat-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.kpi-item {
  min-height: 66px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-color: var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  box-shadow: none;
}

.kpi-item span {
  color: var(--text-3);
  font-size: 10.5px;
}

.kpi-item strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 18px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.chat-chart-panel {
  min-width: 0;
  max-width: 100%;
  margin-top: 14px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  box-shadow: none;
}

.panel-title {
  padding: 0 2px 8px;
  border-bottom: 0;
  background: transparent;
}

.panel-title strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 620;
}

.panel-title small {
  color: var(--text-3);
  font-size: 10px;
}

.chat-data-details {
  margin-top: 12px;
}

.chat-data-details > summary {
  width: fit-content;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 11.5px;
  cursor: pointer;
}

.chat-data-details > summary:hover {
  color: var(--text-2);
  background: var(--surface-2);
}

.chat-data-details .data-table-wrap {
  margin-top: 8px;
  box-shadow: none;
}

.chat-answer-actions {
  margin-top: 12px;
  padding-top: 10px;
  gap: 4px;
  border-top: 0;
}

.chat-action-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-3);
}

.chat-action-icon .icon,
.chat-action-icon svg {
  width: 14px;
  height: 14px;
}

.chat-action-icon:hover {
  color: var(--text);
  background: var(--surface-3);
}

.fingerprint-copy-btn {
  width: auto;
  min-width: 0;
  padding: 0 8px;
  gap: 5px;
  border-radius: 999px;
  font-size: 10px;
}

.chat-artifact-result-link {
  width: fit-content;
  margin-top: 10px;
  padding: 6px 8px;
  gap: 7px;
  border: 0;
  border-radius: 7px;
  color: var(--text-2);
  background: var(--surface-2);
  box-shadow: none;
  font-size: 11.5px;
}

.chat-artifact-result-link:hover {
  color: var(--text);
  background: var(--surface-3);
  transform: none;
}

.chat-artifact-result-link-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.clarification-options {
  gap: 7px;
  margin-top: 12px;
}

.clarification-option {
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid #d9e5ef;
  border-radius: 999px;
  color: #29485f;
  background: #edf5fb;
  box-shadow: 0 1px 2px rgba(29, 64, 96, 0.05);
  font-size: 11.5px;
}

.clarification-option:hover,
.clarification-option:focus-visible {
  border-color: #b9cfe2;
  color: #173d5c;
  background: #e0effb;
  outline: none;
}

.clarification-option.btn-primary {
  border-color: #173042;
  color: #ffffff;
  background: #173042;
}

.clarification-option.btn-primary:hover,
.clarification-option.btn-primary:focus-visible {
  border-color: #33516a;
  color: #ffffff;
  background: #33516a;
}

.clarification-recommended {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}

.chat-welcome {
  min-height: 48vh;
  padding: 0 12px 18vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.chat-welcome .agent-avatar {
  width: 54px;
  min-width: 54px;
  height: 54px;
  min-height: 54px;
  margin-bottom: 14px;
  font-size: 11px;
}

.chat-welcome .agent-logo-avatar {
  display: block;
  overflow: hidden;
  background: transparent;
}

.chat-welcome .agent-logo-avatar img {
  width: 100%;
  height: 100%;
  display: block;
}

.chat-welcome h2 {
  color: var(--text);
  font-size: 20px;
  font-weight: 670;
  letter-spacing: 0;
}

.chat-welcome p {
  max-width: 520px;
  margin-top: 6px;
  color: var(--text-3);
  font-size: 12.5px;
}

.chat-welcome-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-welcome-kicker {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.goal-loop {
  width: min(100%, 820px);
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  position: relative;
}

.goal-loop::before {
  content: "";
  height: 1px;
  position: absolute;
  top: 15px;
  left: 12.5%;
  right: 12.5%;
  background: linear-gradient(
    90deg,
    rgba(59, 130, 246, 0.18),
    rgba(59, 130, 246, 0.55),
    rgba(47, 191, 148, 0.48),
    rgba(47, 191, 148, 0.18)
  );
}

.goal-loop-step {
  min-width: 0;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 14px;
}

.goal-loop-step:not(:last-child)::after {
  content: "›";
  position: absolute;
  top: 5px;
  right: -4px;
  z-index: 2;
  color: #aab7c4;
  background: var(--bg);
  font-size: 17px;
  line-height: 20px;
}

.goal-loop-index {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text-3);
  background: var(--bg);
  font-size: 9px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.goal-loop-step strong {
  margin-top: 11px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.goal-loop-step small {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10.5px;
}

.chat-welcome.welcome-mini {
  width: min(100%, var(--chat-content-width));
  min-height: 100%;
  margin: 0 auto;
  padding: 64px 0 0;
  justify-content: flex-start;
  background: transparent;
}

.welcome-mini-mark {
  position: relative;
  width: 56px;
  height: 56px;
  margin-bottom: 22px;
}

.welcome-mini-mark::after {
  content: "";
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(76, 126, 243, 0.12),
    rgba(76, 126, 243, 0)
  );
  z-index: -1;
}

.welcome-mini-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.welcome-mini-title {
  margin: 0;
  font-size: 26px;
  font-weight: 720;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.welcome-mini-sub {
  max-width: 560px;
  margin: 12px 0 0;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 450;
  line-height: 1.65;
}

/* 开场：继续上次入口 */
.welcome-resume {
  /* 与问数列宽 --chat-content-width（960px）对齐，保持开场白与对话区同一可视宽度 */
  width: min(100%, var(--chat-content-width));
  margin-top: 20px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: left;
}

.welcome-resume-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.welcome-resume-label {
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.04em;
}

.welcome-resume-session {
  min-width: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  font-size: 11.5px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-resume-session:hover {
  color: var(--text);
  text-decoration: underline;
}

.welcome-resume-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.resume-chip {
  max-width: 100%;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  color: var(--text-2);
  background: var(--surface);
  cursor: pointer;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

/* 开场：能力示例卡 */
.welcome-cards {
  /* 与问数列宽 --chat-content-width（960px）对齐，保持开场白与对话区同一可视宽度 */
  width: min(100%, var(--chat-content-width));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.welcome-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  cursor: pointer;
  text-align: left;
}

.welcome-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.welcome-card-tag {
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.welcome-card-text {
  font-size: 12.5px;
  line-height: 1.5;
}

.live-execution {
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: none;
}

.live-execution-head {
  gap: 9px;
}

.live-execution-head strong {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.live-execution-head small {
  color: var(--text-3);
  font-size: 10.5px;
}

.spinner {
  width: 14px;
  height: 14px;
  border-color: var(--border-strong);
  border-top-color: var(--text-2);
}

.live-warning {
  margin-top: 8px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  color: #8b691e;
  background: var(--amber-soft);
  font-size: 10.5px;
}

/* Execution timeline */
.execution-details,
.execution-details * {
  text-shadow: none;
}

.execution-details {
  margin-top: 10px;
  border-top: 0;
  color: var(--text-2);
}

.execution-details > summary {
  min-height: 38px;
  padding: 8px 0 5px;
  gap: 8px;
  color: var(--text-2);
}

.execution-details > summary::before,
.execution-phase > summary::after,
.execution-operation > summary::after {
  color: var(--text-3);
}

.execution-summary-title {
  gap: 5px;
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 620;
}

.execution-summary-title .icon {
  color: var(--text-3);
}

.execution-summary-duration {
  margin-left: 2px;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}

.execution-summary-pill {
  padding: 2px 7px;
  border: 1px solid var(--border);
  color: var(--text-3);
  background: var(--surface-2);
  font-size: 9.5px;
}

.execution-details > summary small {
  color: var(--text-3);
  font-size: 9.5px;
}

.execution-detail-body {
  margin-top: 5px;
  padding: 8px 0 2px;
  gap: 12px;
  border: 0;
  border-top: 0;
  border-radius: 0;
  background: transparent;
}

.execution-phase-list {
  gap: 3px;
  padding-left: 17px;
}

.execution-phase-list::before {
  left: 5px;
  top: 15px;
  bottom: 15px;
  background: var(--border-strong);
}

.execution-phase {
  background: transparent;
}

.execution-phase::before {
  left: -15px;
  top: 17px;
  width: 7px;
  height: 7px;
  background: #cbd4dc;
  box-shadow: 0 0 0 4px var(--surface);
}

.execution-phase.is-success::before {
  background: var(--ok);
}

.execution-phase.is-failed::before {
  background: var(--bad);
}

.execution-phase.is-running::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px rgba(59, 130, 246, 0.1);
}

.execution-phase > summary {
  min-height: 42px;
  padding: 7px 6px 7px 0;
  gap: 8px;
}

.execution-phase-index {
  width: 17px;
  color: #bdc7d1;
  background: transparent;
  font-size: 9px;
}

.execution-phase.is-success .execution-phase-index,
.execution-phase.is-running .execution-phase-index {
  color: #aab6c1;
  background: transparent;
}

.execution-phase.is-failed .execution-phase-index {
  color: var(--bad);
  background: transparent;
}

.execution-phase-copy strong {
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 620;
}

.execution-phase-copy small {
  color: var(--text-3);
  font-size: 9.5px;
}

.execution-phase-meta {
  color: var(--text-3);
  font-size: 8.5px;
}

.execution-phase-meta b {
  color: var(--text-2);
  font-size: 8.5px;
}

.execution-phase-body {
  padding: 2px 0 8px 38px;
  gap: 5px;
  background: transparent;
}

.execution-phase-body > p,
.execution-phase-empty {
  color: var(--text-3);
  font-size: 9.5px;
}

.execution-operation-list {
  gap: 2px;
  padding-left: 10px;
}

.execution-operation-list::before {
  background: var(--border);
}

.execution-operation {
  background: transparent;
}

.execution-operation::before {
  left: -9px;
  top: 15px;
  width: 5px;
  height: 5px;
  background: #ccd5dd;
  box-shadow: 0 0 0 4px var(--surface);
}

.execution-operation > summary {
  min-height: 32px;
  padding: 5px 5px 5px 1px;
  gap: 7px;
}

.execution-operation-type,
.execution-operation > summary > span:last-of-type {
  color: var(--text-3);
  background: transparent;
  font-size: 8.5px;
}

.execution-operation > summary strong {
  color: var(--text-2);
  font-size: 9.5px;
  font-weight: 580;
}

.execution-operation > summary small {
  color: var(--text-3);
  font-size: 8.5px;
}

.execution-operation-body {
  padding: 2px 5px 8px 32px;
  gap: 6px;
}

.execution-review-facts {
  gap: 6px;
}

.execution-review-fact {
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  box-shadow: none;
}

.execution-review-fact span {
  color: var(--text-3);
  font-size: 8.5px;
}

.execution-review-fact strong {
  color: var(--text-2);
  font-size: 9.5px;
}

.execution-review-raw {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  box-shadow: none;
}

.execution-review-raw > summary {
  padding: 6px 8px;
  color: var(--text-3);
  font-size: 9px;
}

.execution-review-raw pre {
  border-top: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface);
  font-size: 9px;
}

.execution-detail-note {
  color: var(--text-3);
  font-size: 9px;
}

/* Composer */
.chat-composer {
  padding: 0;
  border-top: 0;
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
}

.chat-composer-inner {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 12px 28px 18px;
}

.chat-input-shell {
  min-height: 54px;
  padding: 6px 7px 6px 14px;
  /* 左侧上传入口 / 中间输入区 / 右侧模型选择与发送 */
  grid-template-columns: auto minmax(0, 1fr) auto;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 6px 22px rgba(30, 45, 60, 0.06);
}

.chat-input-shell:focus-within {
  border-color: #aebdca;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.07), 0 8px 24px rgba(30, 45, 60, 0.07);
  transform: none;
}

.chat-input {
  min-height: 40px;
  padding: 9px 4px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
}

.chat-send-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--text);
  box-shadow: none;
}

.chat-send-btn[hidden] {
  display: none;
}

.chat-send-btn:hover {
  background: #33475b;
  box-shadow: none;
}

.chat-send-btn .icon,
.chat-send-btn svg {
  width: 15px;
  height: 15px;
}

.chat-stop-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border: 1px solid #c65f53;
  /* 与发送按钮同一个位置互相替换，形状保持一致 */
  border-radius: 50%;
  color: #ffffff;
  background: var(--bad);
  box-shadow: 0 4px 12px rgba(210, 106, 92, 0.24);
}

.chat-stop-btn:hover,
.chat-stop-btn:focus-visible {
  border-color: #b65349;
  color: #ffffff;
  background: #bd594d;
  box-shadow: 0 5px 14px rgba(210, 106, 92, 0.3);
  outline: none;
}

.chat-stop-btn .icon,
.chat-stop-btn svg {
  width: 16px;
  height: 16px;
}

.chat-stop-btn svg {
  stroke: none;
}

.chat-stop-btn svg rect {
  fill: currentColor;
  stroke: none;
}

.chat-stop-btn[hidden] {
  display: none;
}

.composer-hint {
  margin-top: 7px;
  color: var(--text-3);
  font-size: 10px;
  text-align: center;
}

.chat-input-actions {
  align-self: end;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 1px;
}

.chat-model-picker {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--text-2);
  background: transparent;
  box-shadow: none;
}

.chat-model-picker .ui-select,
.chat-model-picker .chat-model-select {
  min-width: 96px;
  max-width: 190px;
}

.chat-model-picker .ui-select-trigger {
  min-height: 28px;
  padding: 0 18px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 10px;
}

.chat-model-picker .ui-select-chevron {
  right: 0;
}

.chat-model-picker .ui-select-trigger:hover,
.chat-model-picker .ui-select-trigger:focus-visible,
.chat-model-picker .ui-select.is-open .ui-select-trigger {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.chat-model-picker.is-locked {
  opacity: 0.72;
  background: transparent;
}

.chat-model-picker.is-locked .ui-select-trigger {
  cursor: not-allowed;
}

.chat-model-static {
  color: var(--text-3);
  font-size: 10px;
  white-space: nowrap;
}

/* Workspace drawer */
.workspace-drawer {
  z-index: 240;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -18px 0 48px rgba(30, 45, 60, 0.08);
}

.workspace-drawer-head {
  min-height: 66px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.workspace-drawer-head strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 640;
}

.workspace-drawer-head small {
  margin-top: 2px;
  color: var(--text-3);
  font-size: 10.5px;
}

.workspace-drawer-body {
  padding: 10px;
  background: var(--surface);
}

.workspace-artifact-card {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  box-shadow: none;
}

.workspace-artifact-group {
  display: grid;
  gap: 8px;
}

.workspace-artifact-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
}

.workspace-artifact-lineage {
  color: var(--text-3);
}

.execution-review-artifact {
  margin-top: 8px;
}

.workspace-artifact-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: none;
}

.workspace-artifact-card.is-located {
  border-color: #b9cde0;
  background: var(--accent-weak);
}

.workspace-artifact-file-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text-2);
  background: var(--surface-3);
}

.workspace-artifact-file-icon .icon,
.workspace-artifact-file-icon svg {
  width: 15px;
  height: 15px;
}

.workspace-artifact-copy strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 580;
}

.workspace-artifact-copy small {
  color: var(--text-3);
  font-size: 10px;
}

.workspace-action-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
}

/* Modal and toast */
.modal-backdrop {
  background: rgba(28, 40, 51, 0.24);
  backdrop-filter: blur(4px);
}

.modal {
  border-color: var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(30, 45, 60, 0.16);
}

.modal-head {
  min-height: 58px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.modal-head strong,
.modal-head h2 {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.modal-body {
  padding: 18px 20px;
}

.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  color: #ffffff;
  background: #253240;
  box-shadow: 0 12px 34px rgba(30, 45, 60, 0.18);
  font-size: 12px;
}

.toast.is-error {
  color: #ffffff;
  background: #8f4c45;
}

/* Details and theme editor */
.detail-grid {
  gap: 10px;
}

.detail-item {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  box-shadow: none;
}

.detail-item > span {
  color: var(--text-3);
  font-size: 10.5px;
}

.detail-item strong,
.detail-item p {
  color: var(--text-2);
  font-size: 12px;
}

.theme-editor-page {
  background: var(--bg);
}

.theme-editor-page-head {
  padding: 4px 0 14px;
  border-bottom: 0;
  background: transparent;
}

.theme-editor-page-body {
  padding: 0 0 90px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.theme-editor-form {
  gap: 14px;
}

.theme-config-section {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.theme-config-section.is-emphasis {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.theme-config-section.is-emphasis .theme-config-index {
  color: var(--text-2);
  background: var(--surface-3);
}

.theme-config-section-head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.theme-config-index {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-2);
  background: var(--surface-3);
  font-size: 10px;
  font-weight: 650;
}

.theme-config-section-head h3 {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 640;
}

.theme-config-section-head p {
  color: var(--text-3);
  font-size: 11px;
}

.theme-editor-page-actions {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: rgba(250, 251, 252, 0.94);
  box-shadow: 0 -10px 30px rgba(30, 45, 60, 0.04);
  backdrop-filter: blur(14px);
}

.semantic-value-toggles {
  gap: 14px;
}

.semantic-value-scope-hint,
.skill-source-badge {
  color: var(--text-3);
}

.skill-source-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 9.5px;
}

/* Charts */
.chart-canvas {
  min-width: 0;
  max-width: 100%;
  min-height: 220px;
}

/* Empty and loading states */
.loading-state,
.empty-state {
  color: var(--text-3);
  font-size: 12px;
}

.empty-state > div {
  padding: 26px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-state .icon {
  color: var(--text-3);
}

/* Responsive layout */
@media (max-width: 1180px) {
  .main-content {
    padding-inline: 20px;
  }

  .chat-timeline {
    padding-inline: 22px;
  }

  .chat-composer-inner {
    padding-inline: 22px;
  }
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 10px;
  }

  .brand {
    justify-content: center;
    padding-inline: 0;
  }

  .brand-copy,
  .nav-group-label,
  .nav-item > span:last-child,
  .sidebar-session-head > div,
  .sidebar-sessions .session-delete,
  .runtime-box > div {
    display: none;
  }

  .sidebar-sessions .session-main strong,
  .sidebar-sessions .session-main time {
    display: none;
  }

  .nav-item,
  .nav-item.is-active {
    width: 44px;
    min-height: 42px;
    margin: 0 auto;
    padding: 0;
    display: grid;
    place-items: center;
  }

  .nav-item [data-icon],
  .nav-item.is-active [data-icon] {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: var(--text-2);
  }

  .nav-item [data-icon] svg,
  .nav-item.is-active [data-icon] svg {
    display: block;
  }

  .sidebar-sessions {
    min-height: 0;
    margin-top: 12px;
  }

  .sidebar-session-head {
    min-height: 40px;
    justify-content: center;
    padding: 8px 0;
  }

  .sidebar-sessions .session-list {
    display: grid;
    gap: 4px;
    padding: 0;
  }

  .sidebar-sessions .session-item {
    width: 44px;
    height: 38px;
    margin: 0 auto;
  }

  .sidebar-sessions .session-main {
    width: 100%;
    height: 100%;
    padding: 0;
  }

  .sidebar-sessions .session-main::before {
    content: "";
    width: 7px;
    height: 7px;
    display: block;
    margin: 0 auto;
    border: 2px solid currentColor;
    border-radius: 50%;
  }

  .runtime-box {
    min-height: 34px;
    justify-content: center;
    padding: 0;
  }
}

@media (max-width: 900px) {
  .check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-cell:nth-child(2) {
    border-right: 0;
  }

  .summary-cell:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    min-height: 58px;
    padding: 7px 8px;
    display: block;
    border-top: 1px solid var(--border);
    border-right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
  }

  .brand,
  .sidebar-sessions,
  .sidebar-foot {
    display: none;
  }

  .main-nav {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
  }

  .nav-item,
  .nav-item.is-active {
    width: 100%;
    min-height: 42px;
  }

  .workspace {
    padding-bottom: 58px;
  }

  .theme-breadcrumb-separator {
    display: none;
  }

  .theme-breadcrumb .ui-select-label {
    font-size: 13px;
  }

  .theme-breadcrumb {
    max-width: 112px;
  }

  .topbar-actions {
    gap: 2px;
  }

  .topbar-icon-btn,
  .user-switch {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
  }

  .user-switch select {
    min-width: 0;
  }

  .main-content {
    padding: 14px 12px 30px;
  }

  .main-content.is-chat {
    padding: 0;
  }

  .section-band {
    padding: 14px 13px 15px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar .grow {
    min-width: 100%;
  }

  .toolbar > .ui-select {
    width: calc(50% - 4px);
    flex: 1 1 calc(50% - 4px);
  }

  .check-grid,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-field,
  .form-field.span-2 {
    grid-column: 1 / -1;
  }

  .two-column {
    display: block;
  }

  .list-pane {
    margin-bottom: 12px;
  }

  .user-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .user-item {
    width: 180px;
    min-width: 180px;
  }

  .data-table-wrap,
  .sub-table-wrap {
    overflow-x: auto;
  }

  .data-table,
  .sub-table {
    min-width: 640px;
  }

  .chat-timeline {
    padding: 20px 12px 30px;
  }

  .chart-canvas,
  .chat-chart-canvas {
    width: 100%;
    overflow: hidden;
  }

  .chart-canvas > div,
  .chart-canvas canvas {
    max-width: 100%;
  }

  .chat-message {
    margin-bottom: 19px;
  }

  .user-bubble {
    max-width: 86%;
  }

  .assistant-bubble {
    width: 100%;
    padding: 2px 0 0;
  }

  .chat-composer-inner {
    padding: 8px 12px 12px;
  }

  .chat-input-shell {
    min-height: 50px;
    border-radius: 14px;
  }

  .chat-welcome {
    min-height: 0;
    padding: 6vh 12px 8vh;
  }

  .chat-welcome h2 {
    font-size: 18px;
  }

  .goal-loop {
    width: min(100%, 360px);
    margin-top: 24px;
    grid-template-columns: 1fr;
  }

  .goal-loop::before {
    width: 1px;
    height: auto;
    top: 15px;
    right: auto;
    bottom: 15px;
    left: 15px;
    background: linear-gradient(
      180deg,
      rgba(59, 130, 246, 0.18),
      rgba(59, 130, 246, 0.5),
      rgba(47, 191, 148, 0.18)
    );
  }

  .goal-loop-step {
    min-height: 54px;
    flex-direction: row;
    gap: 10px;
    padding: 8px 0;
    text-align: left;
  }

  .goal-loop-step:not(:last-child)::after {
    display: none;
  }

  .goal-loop-step strong {
    margin-top: 0;
    font-size: 12.5px;
  }

  .goal-loop-step small {
    margin-top: 0;
    margin-left: auto;
    text-align: right;
  }

  .execution-phase-meta {
    display: none;
  }

  .execution-phase-body {
    padding-left: 26px;
  }

  .execution-operation > summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .execution-operation > summary small {
    grid-column: 2 / 4;
    white-space: normal;
  }

  .execution-operation-body {
    padding-left: 5px;
  }

  .summary-cell {
    min-height: 72px;
    padding: 13px 14px;
  }
}

@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .summary-cell,
  .summary-cell:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .summary-cell:last-child {
    border-bottom: 0;
  }

  .assistant-bubble {
    width: 100%;
  }
}

/* v4 implementation layer */
:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #f1f2f4;
  --surface-3: #e9ebef;
  --surface-muted: #f1f2f4;
  --surface-tint: #f6f7f8;
  --border: #e7e9ec;
  --border-strong: #dfe2e6;
  --text: #171c26;
  --text-2: #4b5563;
  --text-3: #8b93a1;
  --text-secondary: #4b5563;
  --text-muted: #8b93a1;
  --accent: #4c7ef3;
  --accent-weak: #eef3fe;
  --primary: #171c26;
  --primary-strong: #0f131a;
  --primary-soft: #eef3fe;
  --ok: #1ea678;
  --warn: #b97f24;
  --bad: #d26a5c;
  --alert: #e0904a;
  --teal: #1ea678;
  --teal-soft: #ecf8f4;
  --amber: #b97f24;
  --amber-soft: #fbf5e9;
  --red: #d26a5c;
  --red-soft: #fcf1ef;
  --radius-s: 10px;
  --radius: 14px;
  --radius-l: 20px;
  --shadow-s: 0 1px 2px rgba(20, 28, 40, 0.04);
  --shadow-m: 0 2px 6px rgba(20, 28, 40, 0.05), 0 12px 32px rgba(20, 28, 40, 0.06);
  --shadow: 0 2px 6px rgba(20, 28, 40, 0.05), 0 12px 32px rgba(20, 28, 40, 0.06);
  --shadow-soft: 0 1px 2px rgba(20, 28, 40, 0.04);
  --font: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --sidebar-w: 236px;
  --editor-max-width: 1180px;
}

body {
  background: var(--bg);
}

.app-shell,
.workspace,
.main-content,
.chat-layout {
  background: var(--bg);
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg);
}

.brand-mark {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  background: transparent;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 700;
}

.nav-item.is-active {
  color: #333333;
  background: #e8e8e8;
  box-shadow: none;
}

.nav-item.is-active .nav-count,
.nav-item.is-active .nav-badge {
  color: #666666;
}

.runtime-box {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

/* 高度与内边距由下方「全站统一紧凑顶栏」（body .topbar）统一控制，这里只保留外观。 */
.topbar {
  border-bottom-color: var(--border);
  background: var(--bg);
}

.topbar-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-title-row {
  min-width: 0;
  overflow: hidden;
}

.topbar-title-row h1 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-breadcrumb {
  max-width: min(260px, 42vw);
  overflow: hidden;
}

.topbar-actions {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 52%;
  justify-content: flex-end;
}

.topbar h1,
.topbar .topbar-title-row h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.main-content {
  max-width: 1560px;
  padding: 20px 28px 44px;
}

.main-content.is-chat {
  background:
    radial-gradient(1200px 500px at 50% -180px, #eef3fd 0%, rgba(238, 243, 253, 0) 70%),
    var(--bg);
}

.section-band,
.list-pane,
.chart-panel,
.summary-grid,
.modal,
.query-composer,
.parse-drawer-block {
  border-radius: var(--radius);
  box-shadow: var(--shadow-s);
}

.btn,
.btn-primary,
.btn.dark {
  border-radius: 9px;
  font-weight: 520;
}

.btn-primary,
.btn.dark {
  color: #ffffff;
  background: var(--text);
}

.btn-primary:hover,
.btn.dark:hover {
  color: #ffffff;
  background: #2a3038;
}

.tag,
.meta-pill,
.status-chip {
  min-height: 20px;
  border-radius: 999px;
  font-weight: 520;
}

.data-table th,
.sub-table th {
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 11px;
}

.data-table td,
.sub-table td {
  color: var(--text-2);
}

.chat-layout {
  background:
    radial-gradient(1200px 500px at 50% -180px, #eef3fd 0%, rgba(238, 243, 253, 0) 70%),
    var(--bg);
}

.chat-thread {
  width: min(100%, var(--chat-content-width));
}

.chat-question-layout {
  width: min(100%, var(--chat-content-width));
  margin: 0 auto;
  display: block;
  align-items: start;
}

.chat-question-layout .chat-thread {
  width: 100%;
  margin: 0;
}

.chat-question-rail {
  width: 46px;
  height: min(64vh, 620px);
  padding: 8px 0;
  position: fixed;
  left: calc(var(--sidebar-w) + 10px);
  top: 84px;
  z-index: 12;
  overflow: hidden;
  border-radius: 999px;
  transition: width 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.chat-question-rail:hover,
.chat-question-rail:focus-within {
  width: 232px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-m);
  backdrop-filter: blur(16px);
}

.chat-question-rail:hover .question-rail-label,
.chat-question-rail:focus-within .question-rail-label {
  opacity: 1;
  transform: translateX(0);
}

.chat-question-rail:hover .question-rail-item,
.chat-question-rail:focus-within .question-rail-item {
  grid-template-columns: 24px minmax(0, 1fr);
  justify-content: start;
  padding-left: 10px;
  border-radius: 10px;
}

.chat-question-rail:hover .question-rail-copy,
.chat-question-rail:focus-within .question-rail-copy {
  width: auto;
  opacity: 1;
}

.question-rail-label {
  padding: 0 13px 8px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.question-rail-track {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 0 6px 10px;
}

.question-rail-item {
  min-width: 0;
  height: 32px;
  display: grid;
  grid-template-columns: 24px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.question-rail-item:hover,
.question-rail-item.is-hovered {
  color: var(--text);
  background: var(--surface-3);
  transform: translateX(2px);
}

.question-rail-item.is-active {
  color: var(--text);
  background: transparent;
  box-shadow: none;
}

.question-rail-dot {
  width: 3px;
  height: 3px;
  display: block;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.question-rail-item.is-active .question-rail-dot {
  background: var(--text);
  box-shadow: 0 0 0 1.5px var(--accent-weak);
  transform: scale(1.08);
}

.question-rail-copy {
  width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 11.5px;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: width 0.18s ease, opacity 0.16s ease;
}

.chat-message[data-user-question] {
  scroll-margin-top: 96px;
}

.chat-timeline {
  padding-top: 24px;
  background: transparent;
}

.assistant-bubble {
  background: transparent;
}

.chat-composer {
  background: transparent;
}

.chat-composer-inner {
  width: min(100%, 780px);
  padding: 12px 0 18px;
}

.chat-input-shell {
  min-height: 72px;
  border-radius: 16px;
  padding: 8px 8px 8px 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-input {
  min-height: 52px;
}

.chat-send-btn {
  background: var(--text);
}

.kpi-grid.chat-kpis {
  display: flex;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.kpi-grid.chat-kpis .kpi-item {
  flex: 1 1 0;
  min-height: 70px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.kpi-grid.chat-kpis .kpi-item:last-child {
  border-right: 0;
}

.kpi-item strong {
  font-size: 19px;
  font-weight: 720;
}

.theme-config-section {
  box-shadow: var(--shadow-s);
}

.theme-config-index {
  color: #ffffff;
  background: var(--text);
}

.modal {
  box-shadow: 0 4px 10px rgba(20, 28, 40, 0.06), 0 20px 48px rgba(20, 28, 40, 0.1);
}

.user-switch {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.user-switch::after {
  content: attr(data-initial);
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  width: 100%;
  height: 100%;
  max-width: none;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  color: var(--ink, var(--text));
  background: transparent;
  box-shadow: none;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
  white-space: normal;
  opacity: 1;
  pointer-events: none;
  transform: none;
  transition: none;
}

.user-switch:hover::after,
.user-switch:focus-visible::after,
.user-switch:focus-within::after {
  opacity: 1;
  transform: none;
}

.user-switch .topbar-icon-slot {
  display: none;
}

.workspace-toggle {
  flex: 0 0 auto;
  width: auto;
  min-width: 54px;
  max-width: 88px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

.workspace-toggle::before {
  content: "产物";
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 520;
}

.workspace-toggle .topbar-icon-slot {
  display: none;
}

.workspace-toggle .topbar-count {
  position: static;
  display: inline-grid;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border: 0;
  color: #ffffff;
  background: var(--text);
}

.runtime-icon {
  flex: 0 0 12px;
  width: 12px;
  min-width: 12px;
  height: 12px;
  min-height: 12px;
  padding: 0;
  display: inline-block;
  border: 0;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(30, 166, 120, 0.14);
}

.runtime-icon.is-error {
  background: var(--bad);
  box-shadow: 0 0 0 3px rgba(210, 106, 92, 0.14);
}

.runtime-icon .topbar-icon-slot {
  display: none;
}

.density-seg {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-3);
}

.density-seg[hidden] {
  display: none !important;
}

.density-option {
  min-height: 26px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  color: var(--text-2);
  background: transparent;
  font-size: 12px;
  font-weight: 520;
  cursor: pointer;
}

.density-option:hover {
  color: var(--text);
}

.density-option.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-s);
  font-weight: 620;
}

/* 简洁模式只收敛过程信息，图表是回答本体，必须保留原生渲染。 */
.main-content.is-chat.density-compact .execution-details,
.main-content.is-chat.density-compact .chat-data-details,
.main-content.is-chat.density-compact .answer-meta {
  display: none;
}

.main-content.is-chat.density-compact .chat-chart-panel {
  margin-top: 10px;
  padding: 8px;
}

.main-content.is-chat.density-compact .chat-chart-canvas {
  height: 220px;
}

/* v4 page-level components */
.indicator-toolbar {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.page-toolbar {
  padding: 0 2px;
}

.section-band .data-table-wrap,
.section-band .sub-table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.theme-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.theme-card {
  min-width: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-s);
}

/* 卡片右上角的状态标识是真实开关，点击即启用/停用主题。 */
.theme-status-toggle {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: filter 0.16s ease, box-shadow 0.16s ease;
}

.theme-status-toggle:hover {
  filter: brightness(0.96);
  box-shadow: 0 2px 8px rgba(35, 72, 104, 0.12);
}

.theme-card.is-disabled {
  opacity: 0.72;
}

.theme-card-head,
.theme-card-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.theme-card-head strong,
.theme-card-head small {
  display: block;
}

.theme-card-head strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 680;
}

.theme-card-head small {
  max-width: 320px;
  margin-top: 5px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.55;
}

.theme-card-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.theme-card-meta span {
  min-width: 0;
}

.theme-card-meta small,
.theme-card-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-card-meta small {
  color: var(--text-3);
  font-size: 10px;
}

.theme-card-meta strong {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 620;
}

.theme-card-foot {
  align-items: center;
}

.theme-card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 2px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 10px 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  background: transparent;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  border-bottom-color: var(--text);
  color: var(--text);
  font-weight: 650;
}

.tab small {
  margin-left: 5px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
}

.dataset-tab-body {
  padding-top: 16px;
}

.dataset-tab-head {
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dataset-tab-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 660;
}

.dataset-tab-head p {
  margin: 3px 0 0;
  color: var(--text-3);
  font-size: 11.5px;
}

.data-table tbody tr.is-clickable {
  cursor: pointer;
}

.sql-review,
.json-review {
  margin: 14px 0 0;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  color: var(--text-2);
  background: var(--surface-2);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.permission-search {
  max-width: 360px;
  margin: 2px 0 12px;
}

.gap-heat {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface-2);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
}

.bar-name {
  width: 220px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.88;
}

.bar-value {
  width: 30px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 620;
  text-align: right;
}

.audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.audit-detail {
  position: sticky;
  top: 92px;
  min-height: 220px;
}

.detail-list {
  display: grid;
  gap: 1px;
}

.detail-row {
  padding: 9px 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-row span {
  color: var(--text-3);
  font-size: 11px;
}

.detail-row strong {
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 620;
  text-align: right;
}

@media (max-width: 1100px) {
  .audit-grid {
    grid-template-columns: 1fr;
  }

  .audit-detail {
    position: static;
  }

  .theme-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .datasource-type-grid {
    grid-template-columns: 1fr;
  }

  .theme-cards {
    grid-template-columns: 1fr;
  }

  .theme-card-meta {
    grid-template-columns: 1fr;
  }

  .dataset-tab-head {
    flex-direction: column;
    align-items: stretch;
  }

  .bar-name {
    width: 150px;
  }
}

@media (max-width: 1120px) {
  .topbar-actions {
    max-width: none;
  }

  .density-seg {
    display: none;
  }

  body.is-query-page .density-seg:not([hidden]) {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  .workspace-toggle {
    width: 34px;
    min-width: 34px;
    max-width: 34px;
    height: 32px;
    min-height: 32px;
    padding: 0;
  }

  .workspace-toggle::before {
    display: none;
  }

  .workspace-toggle .topbar-icon-slot {
    display: grid;
  }

  .chat-question-layout {
    width: min(100%, var(--chat-content-width));
    display: block;
  }

  .chat-question-rail {
    width: 38px;
    left: 86px;
    top: 72px;
  }

  .chat-question-rail:hover,
  .chat-question-rail:focus-within {
    width: 200px;
  }
}

@media (max-width: 760px) {
  .chat-question-layout {
    width: 100%;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 8px;
  }

  .chat-question-rail {
    position: sticky;
    left: auto;
    top: 72px;
  }
}

@media (max-width: 1180px) {
  .chat-composer-inner {
    padding-inline: 22px;
  }
}

@media (max-width: 1020px) {
  .chat-composer-inner {
    padding-inline: 22px;
  }
}

@media (max-width: 760px) {
  .chat-composer-inner {
    padding-inline: 0;
  }

  .chat-input-shell {
    width: calc(100% - 54px);
    margin-inline: auto;
  }

  .chat-welcome.welcome-mini {
    padding-top: 48px;
  }

  .welcome-mini-title {
    font-size: 22px;
  }

  .welcome-mini-sub {
    font-size: 11.5px;
  }

  .welcome-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 全站统一紧凑顶栏：42px、无副标题、标题 16px/26px 行高。
   原先只有问数页（body.is-query-page）单独做了一套，导致其他页面顶栏是 68px 且带副标题，
   同一套界面高低不一。这里把 topbar 相关规则提升为全局默认，
   页面各自的内容差异交给 .main-content 自己控制，顶栏不再有高低之分。 */
body .topbar {
  min-height: 42px;
  padding: 4px 24px;
}

body .topbar h1,
body .topbar .topbar-title-row h1 {
  font-size: 16px;
  line-height: 26px;
}

/* 副标题全站不再渲染：PAGE_META 里的副标题文案仍保留（runtime.js 的 memory 特例还依赖该结构），
   只是不再展示，避免顶栏被撑高。 */
body .topbar p {
  display: none;
}

body .topbar-title-row {
  min-height: 26px;
}

body .topbar-actions {
  gap: 8px;
}

body.is-query-page .theme-breadcrumb .ui-select-trigger {
  height: 26px;
  min-height: 26px;
}

body.is-query-page .user-switch {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  overflow: hidden;
}

body.is-query-page .user-switch .ui-select-trigger {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
}

body.is-query-page .user-switch::after {
  overflow: hidden;
  font-size: 11px;
  white-space: nowrap;
}

body.is-query-page .workspace-toggle {
  overflow: hidden;
}

@media (min-width: 761px) {
  body.is-query-page .main-content.is-chat {
    height: calc(100vh - 42px);
  }
}

/* 问数输入区：文字输入独占上方一整行，操作按钮放在下方。 */
.chat-composer-inner {
  width: 100%;
  max-width: none;
}

.chat-input-shell {
  /* 与回答内容（.chat-thread）共用同一个宽度变量，左右边界对齐；
     这里是"问答可视区域"的宽度，不是铺满整个页面的全局宽度。 */
  width: min(100%, var(--chat-content-width));
  margin-inline: auto;
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 6px 8px;
  min-height: 0;
  padding: 10px 12px 8px;
}

.chat-input {
  order: 1;
  width: 100%;
  min-height: 44px;
  flex: 1 1 auto;
}

/* 上传入口与发送按钮平铺在同一行：上传靠左，模型选择与发送靠右。 */
.chat-input-shell .attachment-trigger {
  order: 2;
  flex: 0 0 auto;
}

.chat-input-actions {
  order: 3;
  flex: 1 1 auto;
  justify-content: flex-end;
  padding-bottom: 0;
}

.chat-send-btn,
.chat-stop-btn {
  flex: 0 0 38px;
  border-radius: 50%;
}

/* 公共 Skill 文件上传卡片 */
.skill-upload-card {
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2, #f8fafc);
}

.skill-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.skill-upload-dropzone {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 18px 20px;
  border: 1px dashed var(--border-strong, #cbd5e1);
  border-radius: 12px;
  color: var(--text-2);
  background: #fff;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.skill-upload-dropzone:hover,
.skill-upload-dropzone:focus-within,
.skill-upload-dropzone.is-dragging,
.skill-upload-card.is-dragging .skill-upload-dropzone {
  border-color: var(--accent, #3478f6);
  background: #f5f9ff;
  box-shadow: 0 0 0 3px rgba(52, 120, 246, .08);
}

.skill-upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  color: #3478f6;
  background: #eaf2ff;
}

.skill-upload-icon .icon,
.skill-upload-icon svg {
  width: 21px;
  height: 21px;
}

.skill-upload-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.skill-upload-copy strong {
  color: var(--text);
  font-size: 13px;
}

.skill-upload-copy small {
  color: var(--text-3);
  font-size: 11px;
}

.skill-upload-select {
  flex: 0 0 auto;
}

.skill-upload-selected {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 4px 2px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text-2);
  background: #eef5ff;
  font-size: 12px;
}

.skill-upload-selected[hidden] {
  display: none;
}

.skill-upload-selected .icon,
.skill-upload-selected svg {
  width: 15px;
  height: 15px;
  color: var(--accent, #3478f6);
}

.skill-upload-selected small {
  margin-left: auto;
  color: var(--text-3);
}

#skillUploadBtn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  .skill-upload-dropzone {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .skill-upload-copy {
    flex-basis: calc(100% - 56px);
  }

  .skill-upload-select {
    margin-left: 56px;
  }
}

/* 回答内容与问数输入区共用的内容宽度。
   两处用同一个变量，避免各自写死后悄悄错位——改宽度只需改这一处。 */
:root {
  --chat-content-width: 960px;
}
