:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #111418;
  --panel-2: #171b20;
  --line: #2a2f37;
  --text: #f3f4f6;
  --muted: #9aa4b2;
  --accent: #66c2ff;
  --accent-2: #72d69f;
  --warn: #e7b454;
  --danger: #ff6b6b;
  --radius: 8px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-width: 320px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  transition: grid-template-columns 0.18s ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  padding: 0;
  border-right: none;
  overflow: hidden;
}

/* 左侧功能区的折叠把手：贴在页面左缘、标题栏下方、固定定位（滚动时始终可见）。
   展开时把手移到侧栏右缘，箭头反转指向左（收起）。 */
.edge-toggle {
  position: fixed;
  left: 330px;
  top: 86px;
  z-index: 80;
  width: 22px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 11px 11px 0;
  background: var(--panel-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 2px 0 10px rgba(10, 20, 40, 0.12);
  transition: left 0.18s ease, color 0.15s ease, background 0.15s ease;
}

.edge-toggle:hover {
  color: var(--text);
  background: rgba(102, 194, 255, 0.14);
}

.edge-toggle svg {
  transition: transform 0.2s ease;
  transform: rotate(180deg);   /* 展开状态：指向左，点击收起 */
}

body.sidebar-collapsed .edge-toggle {
  left: 0;
}

body.sidebar-collapsed .edge-toggle svg {
  transform: rotate(0deg);     /* 收起状态：指向右，点击展开 */
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #0f1216;
  padding: 18px;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.brand-title {
  flex: 1 1 auto;
  min-width: 0;
}

.version-badge {
  margin: 2px 0 0;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.75;
  letter-spacing: 0.3px;
}

.topbar-head {
  min-width: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-head h2,
.topbar-head p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.pill-btn {
  min-height: 32px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill-btn:hover {
  border-color: var(--accent);
}

.pill-btn.icon {
  padding: 5px 10px;
  font-size: 15px;
  line-height: 1;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: #f3f4f6;
  background-size: cover;
  background-position: center;
  color: #0b0d10;
  font-weight: 800;
  overflow: hidden;
  cursor: pointer;
}

.brand-mark:hover {
  box-shadow: 0 0 0 2px var(--accent);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  letter-spacing: 0;
  white-space: nowrap;
}

h2 {
  font-size: 22px;
  letter-spacing: 0;
  white-space: nowrap;
}

h3 {
  font-size: 16px;
  letter-spacing: 0;
}

.brand p,
.topbar p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.brand p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.panel-title {
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.panel-title::after {
  content: "▾";
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.15s ease;
}

.conn-api-switch {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}

.conn-api-switch button {
  min-height: 24px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.conn-api-switch button.active {
  background: var(--accent);
  color: #fff;
}

.panel.collapsed > .panel-title {
  margin-bottom: 0;
}

.panel.collapsed > .panel-title::after {
  transform: rotate(-90deg);
}

.panel.collapsed > :not(.panel-title) {
  display: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #303742;
  background: #0c0f13;
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 11px;
  outline: none;
}

textarea {
  min-height: 74px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(102, 194, 255, 0.16);
}

.field-block {
  margin-bottom: 12px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segmented button {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.segmented button:hover {
  border-color: transparent;
  background: rgba(102, 194, 255, 0.1);
  color: var(--text);
}

.segmented button.active {
  border-color: transparent;
  background: linear-gradient(180deg, #7cccff 0%, #4aa5f0 100%);
  color: #06121f;
  box-shadow: 0 2px 8px rgba(74, 165, 240, 0.35);
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.check-row input {
  width: auto;
}

.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  min-height: 78px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.model-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: #0d1014;
}

.json-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
}

.json-box > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}

.json-box > summary button {
  margin-left: 0;
}

.json-box > summary button:first-of-type {
  margin-left: auto;
}

.json-box > summary::-webkit-details-marker {
  display: none;
}

.json-box > summary::before {
  content: "▸";
  margin-right: 6px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.json-box[open] > summary::before {
  transform: rotate(90deg);
}

.json-box .json-result {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border-top: 1px solid var(--line);
}

.model-strip button {
  display: grid;
  gap: 3px;
  justify-items: start;
  min-height: 52px;
}

.model-strip button strong {
  font-size: 13px;
  letter-spacing: 0;
}

.model-strip button span {
  color: var(--muted);
  font-size: 12px;
}

.model-strip button.active {
  border-color: var(--accent);
  background: #17212b;
}

.status {
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 11px;
  min-width: 74px;
  text-align: center;
  font-size: 13px;
}

.status.ok {
  border-color: rgba(54, 211, 153, 0.45);
  color: var(--accent-2);
}

.status.fail {
  border-color: rgba(255, 107, 107, 0.5);
  color: var(--danger);
}

.status.busy {
  border-color: rgba(245, 165, 36, 0.45);
  color: var(--warn);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

.progress-wrap.done .progress-fill {
  background: var(--accent-2);
}

.progress-wrap.fail .progress-fill {
  background: var(--danger);
}

.progress-label {
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 130px;
  text-align: right;
}

.suggestions {
  padding: 2px 0 6px;
}

.suggestions-title {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 6px;
}

.suggestion-chips {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
}

.suggestion-chip {
  flex: 1 1 240px;
  max-width: 100%;
  text-align: left;
  white-space: normal;
  line-height: 1.4;
  font-size: 12px;
  min-height: 0;
  padding: 6px 10px;
}

.suggestion-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
  padding: 14px 24px 18px;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
}

.chat-column {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-panel {
  flex: 0 0 340px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}

.info-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.info-collapse-btn {
  min-height: 0;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.info-collapse-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.info-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* System/Instructions 面板迁入数据面板后：外距交给 body 的 gap 控制 */
.info-panel-body .panel { margin-bottom: 0; flex-shrink: 0; }

body.info-collapsed .info-panel {
  display: none;
}

.info-conv {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.info-conv .conv-select {
  max-width: none;
  width: 100%;
}

.info-conv-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.info-conv-actions .pill-btn {
  flex: 0 0 auto;
}

.prompt-zone,
.advanced,
.result-card {
  min-width: 0;
}

#instructions {
  min-height: 84px;
}

#prompt {
  min-height: 174px;
  font-size: 16px;
  line-height: 1.6;
}

.toolbar {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.toolbar.compact {
  gap: 8px;
}

button {
  min-height: 36px;
  border: 1px solid #343b46;
  background: #171b20;
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  color: #061018;
  border-color: var(--accent);
  font-weight: 750;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tab {
  flex: 1;
}

.more-panel {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.more-panel > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
  user-select: none;
}

.more-panel > summary::-webkit-details-marker {
  display: none;
}

.more-panel > summary::before {
  content: "▸ ";
}

.more-panel[open] > summary::before {
  content: "▾ ";
}

.more-panel > summary:hover {
  color: var(--accent);
}

.more-panel > * + * {
  margin-top: 10px;
}

.tab.active {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

#toolsJson,
#extraBody,
#rawBody {
  min-height: 150px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
}

.results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px 22px 24px;
  min-height: 0;
}

.wide {
  grid-column: 1 / -1;
}

.result-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.result-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metrics {
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  white-space: nowrap;
}

.text-result {
  padding: 14px;
  white-space: pre-wrap;
  line-height: 1.55;
  min-height: 180px;
}

.reasoning-box {
  margin: 0 14px 4px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.reasoning-box > summary {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.reasoning-text {
  padding: 0 12px 12px;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 13px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.image-grid img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #06101c;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.image-grid a {
  color: var(--accent);
  font-size: 13px;
}

.image-grid video {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #06101c;
}

.conversation-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  max-height: 680px;
  overflow-y: auto;
}

.conversation-history:empty::after {
  content: attr(data-i18n);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
}

.conversation-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  overflow: hidden;
}

.conversation-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.conversation-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.conversation-item-time {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.conversation-item-mode {
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(102, 194, 255, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.conversation-item-prompt {
  padding: 10px 12px;
  font-size: 13px;
  color: #e8f1fb;
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
  background: var(--panel-2);
}

.conversation-item-result {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.conversation-item-text {
  padding: 10px 12px;
  font-size: 13px;
  color: #d7e8fb;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}

.conversation-item-text.error {
  color: #f87171;
}

.conversation-item-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.conversation-item-images img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #06101c;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
}

.conversation-item-images img:hover {
  border-color: var(--accent);
}

.conversation-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  font-size: 12px;
}

.conversation-item-buttons {
  display: flex;
  gap: 6px;
}

.conversation-item-buttons button {
  padding: 4px 8px;
  font-size: 12px;
  min-height: auto;
}


.conversation-item-video {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.conversation-item-video video {
  width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #06101c;
}

.conversation-video-download {
  align-self: flex-start;
  font-size: 12px;
  color: var(--accent);
}

/* ===== Test connection inline status ===== */
.conn-test-row {
  align-items: center;
  flex-wrap: wrap;
}

.conn-test-row .conn-status {
  flex-basis: 100%;
  overflow-wrap: anywhere;
}

.conn-test-row .conn-status:empty {
  display: none;
}

.conn-status {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.conn-status.ok {
  color: var(--accent-2);
}

.conn-status.fail {
  color: var(--danger);
}

.conn-status.testing {
  color: var(--muted);
}

/* ===== Chat thread (ChatGPT / Codex style) ===== */
.chat-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  flex-shrink: 0;
}

.conv-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 60%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.chat-thread {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chat-row {
  display: flex;
  width: 100%;
}

.chat-row.user {
  justify-content: flex-end;
}

.chat-row.assistant {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 86%;
  border-radius: 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  line-height: 1.6;
}

.chat-bubble.user {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  border-bottom-right-radius: 4px;
}

.chat-source-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chat-source-item {
  position: relative;
  width: 112px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.12);
}

.chat-source-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.chat-source-item span {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 10px;
  line-height: 1.5;
}

.chat-source-item.mask img { image-rendering: pixelated; }

.chat-bubble.assistant {
  background: var(--panel-2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-bubble.assistant.pending {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(102, 194, 255, 0.22);
}

.chat-role {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.75;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.chat-role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-role-row.no-role {
  justify-content: flex-end;
  margin-bottom: 2px;
}

.chat-role-row .chat-role {
  margin-bottom: 0;
}

.chat-copy {
  min-height: auto;
  padding: 2px 7px;
  font-size: 12px;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.12s ease, border-color 0.12s ease;
}

.chat-bubble:hover .chat-copy {
  opacity: 0.9;
}

.chat-copy:hover {
  opacity: 1;
  border-color: var(--accent);
}

.chat-copy.copied {
  opacity: 1;
  color: var(--accent-2);
  border-color: var(--accent-2);
}

.chat-bubble.user .chat-copy {
  border-color: rgba(255, 255, 255, 0.4);
}

.chat-copy-outside {
  align-self: flex-end;
  margin: 0 6px 2px 0;
  flex-shrink: 0;
  opacity: 0.35;
}

.chat-row.user:hover .chat-copy-outside {
  opacity: 0.85;
}

.chat-copy-outside:hover {
  opacity: 1;
}

.chat-bubble.user .chat-copy:hover {
  border-color: #ffffff;
}

.chat-bubble.user .chat-role {
  color: rgba(255, 255, 255, 0.85);
}

.chat-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  color: inherit;
}

.chat-text.error {
  color: var(--danger);
}

.chat-bubble.assistant .chat-text.muted {
  color: var(--muted);
}

/* Rendered Markdown in assistant replies */
.chat-text.md-body {
  white-space: normal;
}
.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }
.md-body p {
  margin: 0 0 8px;
  line-height: 1.6;
}
.md-body .md-h {
  font-weight: 700;
  line-height: 1.35;
  margin: 14px 0 6px;
}
.md-body .md-h1 { font-size: 18px; }
.md-body .md-h2 { font-size: 16px; }
.md-body .md-h3 { font-size: 15px; }
.md-body .md-h4,
.md-body .md-h5,
.md-body .md-h6 { font-size: 14px; }
.md-body ul.md-list,
.md-body ol.md-list {
  margin: 4px 0 8px;
  padding-left: 22px;
}
.md-body ul.md-list { list-style: disc; }
.md-body ol.md-list { list-style: decimal; }
.md-body li {
  margin: 2px 0;
  line-height: 1.55;
}
.md-body strong { font-weight: 700; }
.md-body em { font-style: italic; }
.md-body del { opacity: 0.7; }
.md-body a {
  color: var(--accent, #2b8fe6);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.md-body code.md-code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
  background: rgba(120, 140, 170, 0.16);
  border-radius: 4px;
  padding: 1px 5px;
}
.md-body pre.md-pre {
  margin: 8px 0;
  padding: 10px 12px;
  background: rgba(120, 140, 170, 0.12);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}
.md-body pre.md-pre code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  white-space: pre;
  background: none;
  padding: 0;
}
.md-body blockquote.md-quote {
  margin: 8px 0;
  padding: 2px 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.md-body hr.md-hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

.chat-reasoning {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  color: var(--muted);
  background: rgba(102, 194, 255, 0.06);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.chat-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.chat-image-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-image-item img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #06101c;
  object-fit: contain;
  cursor: pointer;
}

.chat-image-item img:hover {
  border-color: var(--accent);
}

.chat-image-dl {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  cursor: pointer;
}

.chat-image-dl:hover {
  border-color: var(--accent);
}

.chat-video {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-video video {
  width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #06101c;
}

.chat-video-download {
  align-self: flex-start;
  font-size: 12px;
  color: var(--accent);
}

.chat-foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
}

.chat-foot-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-bubble.user .chat-foot {
  color: rgba(255, 255, 255, 0.7);
  justify-content: flex-end;
}

.conversation-empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 20px;
  font-size: 13px;
}

/* ===== Composer (Codex-style input) ===== */
.composer {
  flex-shrink: 0;
  margin-top: 0;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.composer-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(102, 194, 255, 0.22);
}

.composer-box #prompt {
  min-height: 52px;
  max-height: 40vh;
  border: none;
  background: transparent;
  padding: 4px 2px;
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  resize: none;
  outline: none;
  color: var(--text);
  box-shadow: none;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.composer-spacer {
  flex: 1;
}

/* "+" upload button (bottom-left of the composer) */
.plus-btn {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}

.plus-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Hidden only in video mode (no upload there). */
body[data-mode="video"] .plus-btn {
  display: none;
}

.composer-mini {
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.composer-mini:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.composer-box.dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(102, 194, 255, 0.28);
}

.composer-send {
  border-radius: 999px;
  min-width: 104px;
  font-weight: 700;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 50%;
  flex: 0 0 auto;
}

.icon-btn svg {
  display: block;
}

.icon-btn.send-btn {
  color: #ffffff;
}

.icon-btn.cancel-btn {
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.composer .upload-zone {
  margin-bottom: 0;
}

.composer .attach-list {
  margin-top: 0;
}

/* ===== Bottom panels (collapsed JSON + prices) ===== */
.bottom-panels {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== Usage strip (single row under progress) ===== */
.usage-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.usage-strip[hidden] {
  display: none;
}

.usage-strip-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.usage-strip .usage-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.usage-strip .usage-cell b {
  font-size: 15px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.usage-strip .usage-cell i {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

.usage-strip .link-btn {
  margin-left: auto;
}

.image-options,
.edit-options,
.video-options {
  display: none;
}

body[data-mode="images"] .image-options,
body[data-mode="image-edit"] .image-options {
  display: grid;
}

body[data-mode="images"] label.check-row.image-options,
body[data-mode="image-edit"] label.check-row.image-options {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
}

body[data-mode="images"] label.check-row.image-options input,
body[data-mode="image-edit"] label.check-row.image-options input {
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
}

label.check-row.image-options span {
  min-width: 0;
  line-height: 1.55;
}

.segmented-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* 生图能力按模型显隐：.image-options 在生图模式是 display:grid，需显式让 [hidden] 生效 */
body[data-mode] .image-options[hidden],
body[data-mode] .image-options label[hidden] {
  display: none;
}

.image-size-custom {
  margin-top: 6px;
}

.image-size-hint {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.image-size-hint.warn {
  color: #e0a43a;
}

.image-size-hint.bad {
  color: #e5534b;
}

.chat-partial-image {
  display: block;
  max-width: min(100%, 420px);
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  opacity: 0.9;
}

body[data-mode="images"] .edit-options,
body[data-mode="image-edit"] .edit-options {
  display: block;
}

body[data-mode="video"] .video-options {
  display: block;
}

.edit-options > label,
.video-options > .two {
  margin-bottom: 10px;
}

.edit-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-preview[hidden] {
  display: none;
}

.edit-preview:not([hidden]) {
  margin-bottom: 4px;
}

.edit-thumb {
  position: relative;
  width: 60px;
  height: 60px;
}

.edit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #06101c;
}

.edit-thumb-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--danger);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-thumb-remove:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.edit-thumb-tag {
  position: absolute;
  left: 3px;
  bottom: 3px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.upload-zone {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

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

.upload-head > span:first-child {
  font-weight: 700;
  color: #e8f1fb;
}

.upload-sub {
  color: var(--muted);
  font-size: 12px;
}

.upload-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 110px;
  padding: 18px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: #06101c;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.upload-drop:hover {
  border-color: var(--accent);
}

.upload-drop.dragover {
  border-color: var(--accent);
  background: rgba(102, 194, 255, 0.08);
}

.upload-cta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-cta strong {
  color: var(--accent);
  font-size: 15px;
}

.upload-cta span {
  color: var(--muted);
  font-size: 12px;
}

.mask-row {
  margin-top: 12px;
}

.metrics-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.metric-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  color: #d7e8fb;
}

.metric-chip b {
  color: var(--muted);
  font-weight: 600;
}

.token-viz {
  flex: 1;
  min-width: 220px;
}

.token-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #06101c;
  border: 1px solid var(--line);
}

.token-seg {
  height: 100%;
}

.token-seg.in {
  background: var(--accent);
}

.token-seg.cache {
  background: #2fae72;
}

.token-seg.out {
  background: var(--accent-2);
}

.token-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.token-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.token-legend .dot.in {
  background: var(--accent);
}

.token-legend .dot.cache {
  background: #2fae72;
}

.token-legend .dot.out {
  background: var(--accent-2);
}

.token-total {
  margin-left: auto;
  color: #d7e8fb;
  font-weight: 600;
}

.json-result {
  margin: 0;
  padding: 14px;
  overflow: auto;
  max-height: 640px;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #d7e8fb;
}

.table-wrap {
  overflow: auto;
}

.table-result {
  padding: 0 14px 14px;
  overflow: auto;
}

.table-result table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-result td {
  font-size: 13px;
  color: #e3eefb;
}

.table-result td,
.table-result th {
  white-space: pre-wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: var(--panel-2);
}

@media (max-width: 1120px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 72vh;
  }

  /* Collapsed on small screens = fully hidden drawer (avoids 0-width overflow). */
  body.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  body.sidebar-collapsed .sidebar {
    display: none;
  }

  /* 小屏幕：侧栏变为顶部堆叠/抽屉，把手始终贴左缘。 */
  .edge-toggle {
    left: 0;
  }

  .workspace {
    flex-direction: column;
    max-width: 100%;
  }

  .info-panel {
    flex: 0 0 auto;
    width: 100%;
  }

  .info-panel-body {
    max-height: 52vh;
  }

  .chat-card {
    flex: none;
  }

  .chat-thread {
    max-height: 62vh;
  }
}

@media (max-width: 640px) {
  .sidebar,
  .topbar,
  .workspace,
  .results {
    padding-left: 14px;
    padding-right: 14px;
  }

  .two {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .view-switch {
    flex: 1 1 auto;
  }

  .chat-head {
    flex-wrap: wrap;
  }

  .conv-select {
    max-width: 100%;
    flex: 1 1 100%;
  }

  .svc-row {
    gap: 8px;
  }

  .svc-run,
  .svc-row .primary {
    margin-left: 0;
    width: 100%;
  }
}

/* Larger screens: let the working area breathe on 1080p / 2K / 4K. */
@media (min-width: 1680px) { .workspace { max-width: 1320px; } }
@media (min-width: 1920px) { .workspace { max-width: 1480px; } }
@media (min-width: 2560px) { .workspace { max-width: 1820px; padding-top: 20px; } }
@media (min-width: 3400px) { .workspace { max-width: 2320px; } }

.attach-zone {
  display: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 12px;
}

body[data-mode="responses"] .attach-zone,
body[data-mode="chat"] .attach-zone,
body[data-mode="deep-research"] .attach-zone {
  display: block;
}

.attach-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.attach-head > span:first-child {
  font-weight: 700;
  font-size: 12px;
  color: #e8f1fb;
}

.attach-sub {
  color: var(--muted);
  font-size: 11px;
}

.attach-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: #06101c;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.attach-drop:hover {
  border-color: var(--accent);
}

.attach-drop.dragover {
  border-color: var(--accent);
  background: rgba(102, 194, 255, 0.08);
}

.attach-cta {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.attach-cta strong {
  color: var(--accent);
  font-size: 13px;
}

.attach-cta span {
  color: var(--muted);
  font-size: 11px;
}

.attach-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.attach-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 12px;
}

.attach-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(102, 194, 255, 0.15);
  color: var(--accent);
}

.attach-tag.image {
  background: rgba(114, 214, 159, 0.18);
  color: var(--accent-2);
}

.attach-tag.file {
  background: rgba(231, 180, 84, 0.18);
  color: var(--warn);
}

.attach-tag.office {
  background: rgba(124, 92, 255, 0.18);
  color: #8b7bff;
}

.attach-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-size {
  flex-shrink: 0;
  color: var(--muted);
}

.attach-remove {
  flex-shrink: 0;
  min-height: 0;
  padding: 0 7px;
  line-height: 1.5;
  border-radius: 6px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
}

.attach-remove:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Cumulative usage totals */
.usage-totals {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.usage-totals-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #e8f1fb;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.usage-totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.usage-totals-grid span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #06101c;
}

.usage-totals-grid b {
  font-size: 18px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.usage-totals-grid i {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

/* Price panel */
.price-panel {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.price-panel > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #e8f1fb;
  user-select: none;
}

.price-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 10px;
}

.price-controls input {
  flex: 1 1 180px;
  min-width: 140px;
}

.price-controls select {
  width: auto;
}

.price-status {
  padding: 0 14px 8px;
  font-size: 12px;
}

.price-table {
  max-height: 360px;
  overflow: auto;
  padding: 0 14px 14px;
}

.price-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.price-table th,
.price-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.price-table th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 600;
}

.price-table .price-num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--accent-2);
}

.price-meter {
  font-size: 12px;
}

.price-prod {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== Light theme ===== */
body.theme-light {
  color-scheme: light;
  --bg: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f4f6fa;
  --line: #d4dae3;
  --text: #1b2330;
  --muted: #5b6675;
  --accent: #1565d8;
  --accent-2: #1f9d57;
  --warn: #b5790f;
  --danger: #d23b34;
}

body.theme-light .sidebar {
  background: #f6f8fb;
}

body.theme-light .brand-mark {
  background: var(--accent);
  color: #ffffff;
}

body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  background: #ffffff;
  border-color: #c9d1dc;
}

body.theme-light button {
  background: #f0f3f8;
  border-color: #cdd5e0;
}

body.theme-light button.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Voice-chat mic keeps its gradient / states in light theme too. */
body.theme-light .voice-mic {
  background: linear-gradient(135deg, #7cccff 0%, #4aa5f0 100%);
  color: #06101c;
}
body.theme-light .voice-mic.listening {
  background: var(--danger);
  color: #fff;
}

body.theme-light .metric-chip,
body.theme-light .token-total,
body.theme-light .json-result,
body.theme-light .table-result td {
  color: var(--text);
}

body.theme-light .model-strip {
  background: #e9eef5;
}

body.theme-light .model-strip button.active {
  background: #dce9fb;
}

body.theme-light .image-grid img,
body.theme-light .image-grid video,
body.theme-light .usage-totals-grid span,
body.theme-light .upload-drop,
body.theme-light .attach-drop {
  background: #f1f4f9;
}

body.theme-light .upload-drop.dragover {
  background: rgba(21, 101, 216, 0.08);
}

body.theme-light .upload-head > span:first-child,
body.theme-light .attach-head > span:first-child,
body.theme-light .usage-totals-head,
body.theme-light .price-panel > summary {
  color: #16314f;
}

body.theme-light .reasoning-box {
  background: rgba(20, 30, 45, 0.03);
}



/* ---- View switch + AI Services panel ---- */
.view-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.view-switch button {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.view-switch button.active {
  background: var(--accent);
  color: #06101c;
}

body.view-services .chat-column,
body.view-services .info-panel,
body.view-voice .chat-column,
body.view-voice .info-panel { display: none; }
body:not(.view-services) .services-card { display: none; }
body:not(.view-voice) .voice-card { display: none; }
body.view-services #infoPanelToggle,
body.view-voice #infoPanelToggle { display: none; }

/* ---- Voice chat view ---- */
.voice-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.voice-head h3 { margin: 0 0 4px; font-size: 16px; }
.voice-head p { margin: 0; font-size: 12px; }

.voice-transcript {
  flex: 1 1 auto;
  min-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px;
}
.voice-empty {
  margin: auto;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.voice-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.voice-msg.user {
  align-self: flex-end;
  background: var(--accent, #4aa5f0);
  color: #06101c;
  border-bottom-right-radius: 5px;
}
.voice-msg.assistant {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.voice-msg.assistant.speaking { border-color: var(--accent, #4aa5f0); }

.voice-stage {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.voice-mic {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #7cccff 0%, #4aa5f0 100%);
  color: #06101c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(74, 165, 240, 0.35);
  transition: transform 0.15s ease;
}
.voice-mic:hover { transform: scale(1.05); }
.voice-mic.listening {
  background: var(--danger);
  color: #fff;
  animation: voicePulse 1.2s ease-in-out infinite;
}
.voice-mic.busy { opacity: 0.6; cursor: default; }
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 74, 74, 0.5); }
  50% { box-shadow: 0 0 0 14px rgba(224, 74, 74, 0); }
}
.voice-side {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.voice-side:hover { background: rgba(120, 140, 170, 0.18); transform: scale(1.05); }
.voice-state { font-size: 13px; color: var(--muted); min-height: 18px; text-align: center; }

.voice-opts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: nowrap;
}
.voice-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.voice-check input { cursor: pointer; }

.voice-config {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.voice-config[hidden] { display: none; }

.voice-mode {
  margin: 0 auto;
  flex: 0 0 auto;
  align-self: center;
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  width: fit-content;
}

/* 实时数字人：左对话 / 右视频 两栏 */
.voice-main {
  flex: 1 1 auto;
  min-height: 220px;
  display: flex;
  gap: 14px;
  min-width: 0;
}
.voice-main .voice-transcript {
  flex: 1 1 auto;
  min-width: 0;
}
.avatar-stage {
  flex: 0 0 min(44%, 460px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-stage[hidden] { display: none; }
.avatar-stage video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;   /* 数字人流是 16:9，盒子锁定同比例就没有黑边 */
  max-height: 420px;
  object-fit: cover;
  object-position: center top;   /* 高度被压缩时裁下沿，保住头部 */
  border-radius: 12px;
  background: #000;
  box-shadow: 0 6px 18px rgba(10, 20, 40, 0.18);
}
.avatar-stage.connecting video {
  background: linear-gradient(135deg, #101722 0%, #1c2634 100%);
  animation: avPulse 1.4s ease-in-out infinite;
}
@keyframes avPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}
@media (max-width: 900px) {
  .voice-main { flex-direction: column; }
  .avatar-stage { flex: 0 0 auto; order: -1; }
  .avatar-stage video { max-height: 320px; }
}

/* 虚拟人画面放大：视频区占大头、字幕区收窄；按钮用 .avatar-stage 前缀抵消 theme-light 全局 button 覆盖 */
.avatar-stage .av-zoom-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  min-height: 0;
  height: 30px;
  padding: 0 14px;
  font-size: 12.5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(12, 18, 28, 0.55);
  color: #fff;
}
.avatar-stage .av-zoom-btn:hover { background: rgba(12, 18, 28, 0.78); border-color: #fff; }
.voice-main.av-big .avatar-stage { flex: 1 1 auto; }
.voice-main.av-big .voice-transcript { flex: 0 0 min(30%, 320px); }
.voice-main.av-big .avatar-stage video { max-height: min(76vh, 920px); }

.rt-input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
  color: var(--text);
  width: 160px;
  box-sizing: border-box;
  font-size: 13px;
}
.voice-sel {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.voice-sel select,
#avVoice {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
  color: var(--text);
  max-width: 250px;
  box-sizing: border-box;
}
.voice-chip {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.15s ease;
}
.voice-chip:hover { background: rgba(120, 140, 170, 0.18); }
.voice-chip:disabled { opacity: 0.5; cursor: default; }

/* 声音引擎徽章：一眼区分 Azure Speech / Azure OpenAI TTS / 浏览器 */
.voice-engine {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.voice-engine::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.voice-engine.azure { color: #1565d8; background: rgba(21, 101, 216, 0.12); }
.voice-engine.openai { color: #0d9373; background: rgba(13, 147, 115, 0.12); }
.voice-engine.browser { color: #8a8f98; background: rgba(138, 143, 152, 0.14); }
.voice-tip {
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  text-align: center;
}

/* Assistant-bubble footer actions: speak / retry */
.chat-speak,
.chat-retry {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0.5;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.chat-foot:hover .chat-speak,
.chat-foot:hover .chat-retry { opacity: 0.85; }
.chat-speak:hover,
.chat-retry:hover { opacity: 1; background: rgba(120, 140, 170, 0.16); }
.chat-speak.speaking { opacity: 1; background: rgba(74, 165, 240, 0.22); }

.services-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.svc-head h3 { margin: 0 0 4px; font-size: 16px; }
.svc-head p { margin: 0; font-size: 12px; }

.svc-conn {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 10px;
}

.svc-conn label.svc-reuse {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.svc-conn label.svc-reuse input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.svc-conn label.svc-locked {
  opacity: 0.55;
}

.svc-conn label.svc-locked input {
  cursor: not-allowed;
}

.svc-conn label,
.svc-panel label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.svc-conn input,
.svc-conn select,
.svc-panel input,
.svc-panel select,
.svc-panel textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
}

.svc-conn select:disabled { opacity: 0.55; cursor: not-allowed; }

/* Copilot 连接区：字段+按钮压成单行（窄屏自动换行），节省纵向空间 */
.svc-conn.cop-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.svc-conn.cop-line label { flex: 0 0 auto; justify-content: flex-end; margin-bottom: 0; }
.svc-conn.cop-line .cop-f-org { flex: 1 1 170px; min-width: 150px; }
.svc-conn.cop-line .cop-f-token { flex: 1.2 1 190px; min-width: 170px; }
.svc-conn.cop-line .cost-f { flex: 1 1 160px; min-width: 140px; }
.svc-conn.cop-line button { flex: 0 0 auto; }
.svc-conn.cop-line .cost-updated { flex: 0 0 auto; padding-bottom: 9px; }

/* 已存连接：档案多时显示搜索框过滤下拉选项 */
.prof-pick { display: flex; gap: 6px; }
.prof-pick input { width: 118px; flex: 0 0 auto; }
.prof-pick input[hidden] { display: none; }

/* 成本一键接入向导：设备码大字展示 + 步骤行（选择框/按钮统一 38px 高度对齐） */
.cost-wizard { display: flex; flex-direction: column; gap: 10px; }
.cost-wizard-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.cost-wizard-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin: 0; }
.cost-wizard-row select { padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); color: var(--text); min-width: 220px; max-width: 340px; }
.cost-wizard-row select,
.cost-wizard-row button { height: 38px; min-height: 38px; padding-top: 0; padding-bottom: 0; box-sizing: border-box; }
.cost-wizard-row .muted { padding-bottom: 9px; }
.cost-wiz-subwrap { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.cost-wiz-subs { display: flex; flex-direction: column; gap: 2px; min-width: 260px; max-width: 420px; max-height: 190px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); padding: 6px 10px; }
.cost-wizard-row label.cost-wiz-subitem { display: flex; flex-direction: row; align-items: center; gap: 7px; margin: 0; font-size: 13px; color: var(--text); white-space: nowrap; }
.cost-wizard-row label.cost-wiz-subitem[hidden] { display: none; }
.cost-wizard-row label.cost-wiz-selall { position: sticky; top: -6px; z-index: 1; background: var(--panel-2); border-bottom: 1px solid var(--line); padding: 2px 0 5px; font-weight: 600; }
.cost-wiz-showdone { flex: none; align-self: flex-start; margin-top: 2px; font-size: 12px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.cost-wiz-subitem input { width: auto; min-height: 0; margin: 0; flex: none; }
.cost-wiz-subitem span { overflow: hidden; text-overflow: ellipsis; }
.cost-wiz-badge { margin-left: 8px; font-style: normal; font-size: 11px; color: var(--muted); flex: none; }
.cost-wiz-badge.ok { color: #2e9e5b; }
.cost-wizard-code {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 24px; font-weight: 800; letter-spacing: 4px;
  padding: 6px 16px; border: 1.5px dashed var(--accent, #2563eb); border-radius: 10px;
  background: var(--panel-2); user-select: all;
}

/* 错误提示分条列表（SAML 排查步骤等） */
.svc-warn .err-list { margin: 8px 0 0 4px; padding-left: 16px; }
.svc-warn .err-list li { margin: 5px 0; line-height: 1.55; }
.svc-warn .err-list a { word-break: break-all; }

/* Copilot 数据归属横幅：标明当前结果属于哪个已存连接 */
.cop-src { margin: 2px 0 10px; padding: 7px 11px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 7%, transparent); font-size: 12.5px; color: var(--text); }

/* gh 折线图即时悬浮框（数据点金额） */
.gh-tip { position: fixed; z-index: 3000; padding: 5px 9px; border-radius: 6px; background: #1c2733; color: #fff; font-size: 12px; line-height: 1.4; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.25); white-space: nowrap; }
.gh-hit { cursor: pointer; }
/* 图表卡标题内的迷你分组下拉（模型/用户切换） */
.gh-mini-sel { margin: 0 6px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); color: var(--text); font-size: 12px; }

/* GitHub AI usage 同款看板 */
.gh-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 8px 0 12px; }
.gh-toolbar input[type="search"] { flex: 1 1 220px; min-width: 180px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); color: var(--text); }
.gh-toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.gh-toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); color: var(--text); }
.gh-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-bottom: 10px; }
.gh-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px 14px; }
.gh-card h5 { margin: 0 0 8px; font-size: 13px; color: var(--text); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.gh-card h5 .ins-sub { font-weight: 400; font-size: 11px; color: var(--muted); }
.gh-card p { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.gh-big { display: flex; align-items: baseline; gap: 8px; }
.gh-big b { font-size: 24px; }
.gh-big span { font-size: 12px; color: var(--muted); }
.gh-progress { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; margin-top: 8px; }
.gh-progress i { display: block; height: 100%; background: linear-gradient(90deg, #9a6700, #bf8700); border-radius: 999px; }
.gh-chart-card { margin-bottom: 10px; }
.gh-chart { width: 100%; height: auto; display: block; }
.gh-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 2px 0 6px; }
.gh-lg { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.gh-lg i { width: 14px; height: 3px; border-radius: 2px; }
.gh-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.gh-table th { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 600; white-space: nowrap; }
.gh-table th:first-child, .gh-table td:first-child { text-align: left; }
.gh-table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.gh-table tr.gh-row { cursor: pointer; }
.gh-table tr.gh-row:hover { background: var(--panel-2); }
.gh-table tr.gh-sub td { color: var(--muted); background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
.gh-table tr.gh-sub td:first-child { padding-left: 34px; }
.gh-exp { display: inline-block; width: 16px; color: var(--muted); }
.gh-bold { font-weight: 700; }
.gh-bd { margin-bottom: 4px; }
/* 可折叠小节（成员与邮箱 / 每日明细）：summary 常显标题+摘要，点开看明细 */
.cop-fold { margin: 2px 0 12px; }
.cop-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 13px; user-select: none; }
.cop-fold > summary::-webkit-details-marker { display: none; }
.cop-fold > summary::before { content: "▸"; color: var(--muted); flex: 0 0 auto; transition: transform 0.15s; }
.cop-fold[open] > summary::before { transform: rotate(90deg); }
.cop-fold > summary b { font-weight: 600; }
.cop-fold > summary span { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }
.cop-fold[open] > summary { margin-bottom: 8px; }
.cop-fold > summary:hover { border-color: var(--accent); }
.cop-fold > summary span.fold-warn { color: #d1242f; font-weight: 600; }
/* 麦克风设置与测试（AI 服务连接区）：默认只占一行链接，展开后是设备选择 + 电平条 */
.svc-head-flex { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mic-icon-btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.kw-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 0 6px; }
.kw-stage[hidden], .audio-input[hidden] { display: none; }
.kw-orb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 70%);
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.kw-orb.listen { border-color: var(--accent); animation: kwPulse 1.6s ease-in-out infinite; }
.kw-orb.wake {
  border-color: #22c55e;
  animation: none;
  box-shadow: 0 0 0 10px color-mix(in srgb, #22c55e 22%, transparent), 0 0 34px rgba(34, 197, 94, 0.5);
  background: radial-gradient(circle at 35% 30%, rgba(34, 197, 94, 0.4), transparent 70%);
}
@keyframes kwPulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 0 0 14px transparent; }
}
.kw-status { font-size: 13px; min-height: 18px; text-align: center; }
.kw-log { font-size: 12px; color: var(--muted); max-height: 150px; overflow: auto; width: 100%; text-align: center; }
.kw-log div { padding: 2px 0; }
.kw-log .hit { color: #22c55e; font-weight: 700; }
#kwToggle.recording { background: #dc2626; border-color: #dc2626; }
#micRow { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
#micRow .mic-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
#micRow .mic-row label { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
#micRow .mic-row select { min-width: 240px; max-width: 440px; }
#micRow .mic-row button { min-height: 32px; }
#micRow .mic-row #micCur { font-size: 12px; }
.mic-meter { flex: 0 0 170px; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.mic-meter i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #2fae72 0%, #e8a13a 70%, #d1242f 100%); transition: width 0.08s linear; }
#micStatus { font-size: 12px; color: var(--muted); }
.gh-grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 10px; }
.gh-grid2 .gh-chart-card, .gh-grid2 .gh-bd { margin-bottom: 0; }
@media (max-width: 820px) { .gh-grid2 { grid-template-columns: 1fr; } }
/* 预算表：内联进度条 + 使用率分级配色（蓝→黄→橙→红） */
.bud-cell { min-width: 170px; white-space: nowrap; }
.bud-p { display: inline-block; width: 110px; vertical-align: middle; margin-right: 8px; }
.gh-progress i.bud-ok { background: linear-gradient(90deg, #1f6feb, #66c2ff); }
.gh-progress i.bud-warn { background: linear-gradient(90deg, #9a6700, #d4a72c); }
.gh-progress i.bud-hot { background: linear-gradient(90deg, #bc4c00, #f0883e); }
.gh-progress i.bud-over { background: linear-gradient(90deg, #a40e26, #f85149); }
.bud-pct-hot { color: #f0883e; font-weight: 700; }
.bud-pill { display: inline-block; padding: 1px 7px; margin-right: 7px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; color: var(--muted); }

.svc-panel textarea { resize: vertical; }

.svc-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 4px; }
.svc-tabs button { white-space: nowrap; line-height: 1.3; padding-left: 6px; padding-right: 6px; }

.svc-panel { display: none; flex-direction: column; gap: 12px; }
.svc-panel.active { display: flex; }

.svc-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* Keep inputs / selects / buttons on a services row the same height so they line up. */
.svc-row input,
.svc-row select,
.svc-row .svc-file-btn,
.svc-row .svc-run,
.svc-row .audio-rec {
  min-height: 38px;
  box-sizing: border-box;
}

.svc-grow { flex: 1 1 240px; }
.svc-inline { flex-direction: column; }

/* Target-language field: editable text (custom) + a quick-add dropdown. */
.lang-field {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.lang-field input {
  flex: 1 1 auto;
  min-width: 0;
}
.lang-add {
  flex: 0 0 auto;
  width: 128px;
  min-height: 38px;
  box-sizing: border-box;
}

/* Inline help / hint lines inside the services panel. */
.svc-tip {
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 2px;
}

.svc-run {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  margin-left: auto;
}

.svc-file-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.svc-file-name { font-size: 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.svc-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 12px 38px 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  position: relative;
}

.svc-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.svc-close:hover { background: rgba(120, 140, 170, 0.18); color: var(--text); }

.svc-copy-corner { right: 34px; font-size: 13px; }
.svc-copy-corner.ok { color: #3fb950; }

.svc-warn {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(240, 180, 60, 0.5);
  background: rgba(240, 180, 60, 0.1);
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.svc-warn.ok { border-color: rgba(63, 185, 80, 0.5); background: rgba(63, 185, 80, 0.1); }

/* 页底功能说明备注（随子标签切换） */
.svc-help {
  margin-top: 18px;
  padding: 13px 16px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.7;
}
.svc-help-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
}
.svc-help-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 14px;
  color: var(--muted);
}
.svc-help-k {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.svc-help-v { min-width: 0; }
.svc-help-kinds {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 4px 22px;
  color: var(--muted);
}
.svc-help-kind b {
  color: var(--text);
  font-weight: 600;
  margin-right: 8px;
}

.dep-filter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pricing-link { color: var(--accent); text-decoration: none; font-size: 11.5px; white-space: nowrap; }
.pricing-link:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .svc-help-grid { grid-template-columns: 1fr; gap: 1px; }
  .svc-help-k { margin-top: 5px; }
}

.avatar-gallery-wrap { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.avatar-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding: 2px;
}
.avatar-card {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: transparent;
  padding: 0 0 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.avatar-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top;
  background: #dfe6ef;
  display: block;
}
.avatar-card span { font-size: 10.5px; color: var(--muted); text-align: center; padding: 0 4px; }
.avatar-card:hover { border-color: #4aa5f0; transform: translateY(-1px); }
.avatar-card.sel { border-color: #4aa5f0; box-shadow: 0 0 0 2px rgba(74, 165, 240, 0.3); }
.avatar-card.sel span { color: #4aa5f0; font-weight: 600; }

/* 数字人合成全局任务卡：右下角悬浮，跨页面常驻 */
.avatar-job {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 12.5px;
}
/* display:flex 会覆盖 hidden 属性的 UA 隐藏规则，必须显式补回 */
.avatar-job[hidden] { display: none; }
.avatar-job .aj-line { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-job .aj-bar {
  flex: 1 1 120px;
  max-width: 320px;
  height: 6px;
  border-radius: 999px;
  background: rgba(120, 140, 170, 0.18);
  overflow: hidden;
}
.avatar-job .aj-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7cccff, #4aa5f0);
  transition: width 0.2s ease;
}
.avatar-job .aj-bar.wave i { width: 34%; animation: ajWave 1.4s ease-in-out infinite; }
@keyframes ajWave {
  0% { margin-left: -34%; }
  100% { margin-left: 100%; }
}
.avatar-job.ok { border-color: rgba(63, 185, 80, 0.5); }
.avatar-job.err { border-color: rgba(248, 81, 73, 0.55); }
.avatar-job .aj-view {
  padding: 0 12px;
  min-height: 0;
  height: 22px;
  line-height: 22px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #7cccff 0%, #4aa5f0 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.avatar-job .aj-close {
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.avatar-job .aj-close:hover { background: rgba(120, 140, 170, 0.18); color: var(--text); }

.svc-result.error { border-color: var(--danger); color: var(--danger); white-space: pre-wrap; }
.svc-result audio { width: 100%; margin-top: 6px; }
.svc-result pre { margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.svc-result .svc-meta { color: var(--muted); font-size: 11px; margin-top: 8px; }
.svc-result table { border-collapse: collapse; width: 100%; margin-top: 6px; }
.svc-result th, .svc-result td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; }
.svc-result mark { background: rgba(231, 180, 84, 0.35); color: inherit; padding: 0 2px; border-radius: 3px; }

body.theme-light .svc-run,
body.theme-light .view-switch button.active { color: #fff; }
body.theme-light .view-switch button.active { background: #1565d8; }

@media (max-width: 720px) {
  .svc-conn { grid-template-columns: 1fr; }
  .view-switch button { padding: 6px 10px; }
}

/* ---- Speech modules: audio input, voice gallery, pronunciation ---- */
.audio-input {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.audio-rec {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--danger);
  font-weight: 600;
  cursor: pointer;
}

.audio-rec.recording {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  animation: recPulse 1.1s ease-in-out infinite;
}

@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(255, 107, 107, 0); }
}

.svc-dl {
  display: inline-block;
  margin-top: 8px;
  margin-left: 10px;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}
.svc-dl:hover { text-decoration: underline; }

.svc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.svc-actions .svc-dl { margin: 0; }
.svc-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.svc-copy::before { content: "⧉"; font-size: 13px; }
.svc-copy:hover { border-color: var(--accent); color: var(--accent); }
.svc-copy.copied { border-color: #3fb950; color: #3fb950; background: rgba(63, 185, 80, 0.1); }
.svc-copy.copied::before { content: "✓"; }
.svc-audio {
  display: block;
  width: 100%;
  max-width: 360px;
  height: 34px;
  margin-top: 10px;
}

.voice-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  margin-top: 4px;
}

.voice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.voice-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.voice-info b { font-size: 13px; }
.voice-info span { font-size: 11px; }
.voice-info code { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.voice-play {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.voice-play:hover { background: var(--accent); color: #06121f; }

.pron-scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 16px;
  margin-bottom: 12px;
}

.pron-score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.pron-score span { flex: 0 0 64px; color: var(--muted); }
.pron-score b { flex: 0 0 28px; text-align: right; }

.pron-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}
.pron-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #72d69f, #4aa5f0);
}

.pron-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.9;
}
.pron-word {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(114, 214, 159, 0.14);
}
.pron-word.bad {
  background: rgba(255, 107, 107, 0.18);
  color: var(--danger);
  text-decoration: underline wavy var(--danger);
}

/* ---- Voice browser (inside TTS) + doc-translate note ---- */
.voice-browser { margin-top: 4px; }

/* 声音浏览：筛选输入与重新加载按钮同行底部对齐，不换行。 */
.voice-browser .svc-row {
  flex-wrap: nowrap;
  align-items: flex-end;
}
.voice-browser .svc-grow { min-width: 0; }
#loadVoicesBtn { white-space: nowrap; flex: 0 0 auto; }

/* 全局 label 自带 margin-bottom:12px，会让 .svc-row 里的按钮与输入框错位 —— 行内清零。 */
.svc-row label { margin-bottom: 0; }

/* 视频翻译：行内复选框（全局 label{display:grid}+input{width:100%} 会把复选框拉成整行，这里收回行内） */
.svc-row label.vt-burn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 38px;
}
.svc-row label.vt-burn input[type="checkbox"] { width: auto; margin: 0; }

/* TTS：筛选器与声音/风格/语速/按钮同处一行（wrapper 用 display:contents 融入父 flex 行）。 */
.tts-filters { display: contents; }
.tts-filters[hidden] { display: none; }
#vfLang { max-width: 190px; }
#vfGender, #vfFeat { max-width: 110px; }
#ttsVoice { min-width: 190px; max-width: 250px; }
#ttsStyle { max-width: 130px; }
.tts-voice-count { font-size: 11px; margin: -6px 0 0; }
.tts-voice-count:empty { display: none; }
.voice-browser > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  padding: 4px 0;
  user-select: none;
}
.voice-browser[open] > summary { margin-bottom: 8px; }

.voice-info { cursor: pointer; }
.voice-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.svc-note {
  font-size: 11px;
  margin: 2px 0 0;
  line-height: 1.5;
}

/* ---- Composer voice-input mic button ---- */
.mic-btn.recording {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  animation: recPulse 1.1s ease-in-out infinite;
}

.websearch-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #7cccff 0%, #4aa5f0 100%);
  border-color: #4aa5f0;
  box-shadow: 0 2px 8px rgba(74, 165, 240, 0.35);
}

/* ===== Model Hub 模型对比 & 场景 Demo ===== */
body.view-compare .chat-column,
body.view-compare .info-panel,
body.view-demo .chat-column,
body.view-demo .info-panel { display: none; }
body:not(.view-compare) .compare-card { display: none; }
body:not(.view-demo) .demo-card { display: none; }
body.view-compare #infoPanelToggle,
body.view-demo #infoPanelToggle { display: none; }

/* ===== Azure 成本 & Copilot 用量 ===== */
body.view-cost .chat-column,
body.view-cost .info-panel,
body.view-copilot .chat-column,
body.view-copilot .info-panel { display: none; }
body:not(.view-cost) .cost-card { display: none; }
body:not(.view-copilot) .copilot-card { display: none; }
body.view-cost #infoPanelToggle,
body.view-copilot #infoPanelToggle { display: none; }

body.view-create .chat-column,
body.view-create .info-panel { display: none; }
body:not(.view-create) .create-card { display: none; }
body.view-create #infoPanelToggle { display: none; }

body.view-studio .chat-column,
body.view-studio .info-panel { display: none; }
body:not(.view-studio) .studio-card { display: none; }
body.view-studio #infoPanelToggle { display: none; }
/* 工坊画布铺满整个窗口宽度（覆盖 .workspace 的 max-width 居中限制及大屏媒体查询档位） */
body.view-studio .workspace { max-width: none; }

body.view-guide .chat-column,
body.view-guide .info-panel { display: none; }
body:not(.view-guide) .guide-card { display: none; }
body.view-guide #infoPanelToggle { display: none; }

body.view-update .chat-column,
body.view-update .info-panel { display: none; }
body:not(.view-update) .update-card { display: none; }
body.view-update #infoPanelToggle { display: none; }

body.view-apidocs .chat-column,
body.view-apidocs .info-panel { display: none; }
body:not(.view-apidocs) .apidocs-card { display: none; }
body.view-apidocs #infoPanelToggle { display: none; }

body.view-oss .chat-column,
body.view-oss .info-panel { display: none; }
body:not(.view-oss) .oss-card { display: none; }
body.view-oss #infoPanelToggle { display: none; }

body.view-help .chat-column,
body.view-help .info-panel { display: none; }
body:not(.view-help) .help-card { display: none; }
body.view-help #infoPanelToggle { display: none; }

.oss-card { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.help-card { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.apidocs-card { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.docs-toolbar { display: flex; flex-direction: column; gap: 8px; }
.docs-toolbar input[type="search"] { max-width: 420px; }
.docs-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(430px, 1fr)); gap: 12px; align-content: start; overflow: auto; }
.docs-host-note {
  grid-column: 1 / -1;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
}
.docs-group-title { grid-column: 1 / -1; font-size: 14px; font-weight: 700; margin: 6px 0 0; color: var(--accent); }
.docs-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--card); min-width: 0; }
.docs-item h4 { margin: 0; font-size: 14px; }
.docs-item .docs-desc { font-size: 12.5px; color: var(--muted); margin: 0; }
.docs-ep { font-family: var(--mono, ui-monospace), monospace; font-size: 11.5px; background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 6px; padding: 6px 8px; word-break: break-all; }
.docs-code { position: relative; }
/* 代码块统一深蓝码窗风（两主题下都用深底，告别灰底）：左缘强调条 + 浅蓝文字 */
.docs-code pre {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  max-height: 300px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(160deg, #101a2b 0%, #0c1524 100%);
  color: #c9d9f2;
  border: 1px solid rgba(110, 150, 220, 0.22);
  border-left: 3px solid var(--accent, #2f6fed);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  white-space: pre;
}
.docs-langs { display: flex; gap: 5px; flex-wrap: wrap; }
.docs-langs button {
  min-height: 24px;
  padding: 2px 11px;
  font-size: 11.5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.docs-langs button:hover { color: var(--accent); border-color: var(--accent); }
.docs-langs button.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.docs-copy { position: absolute; top: 6px; right: 6px; font-size: 11px; min-height: 24px; padding: 2px 8px; background: rgba(20, 32, 52, 0.85); color: #c9d9f2; border-color: rgba(110, 150, 220, 0.35); }
.docs-copy:hover { color: #fff; border-color: var(--accent); }
.docs-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.docs-links a { font-size: 12.5px; }
.docs-try { font-size: 12px; min-height: 28px; padding: 3px 10px; }
.docs-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.docs-badge { font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); }

.vision-canvas-wrap { overflow: auto; }
.vision-canvas-wrap canvas { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.sf-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.sf-bar-row .sf-name { width: 90px; flex: none; }
.sf-bar { flex: 1; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--line) 60%, transparent); overflow: hidden; }
.sf-bar i { display: block; height: 100%; border-radius: 4px; background: #22c55e; }
.sf-bar i.warn { background: #f59e0b; }
.sf-bar i.bad { background: #dc2626; }
.sf-flag { font-weight: 700; }
.sf-flag.ok { color: #22c55e; }
.sf-flag.bad { color: #dc2626; }

.update-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}
.upd-key-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.upd-key-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 0 1 360px; }
.upd-key-row input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 7px 10px;
  font-size: 12.5px;
}
.upd-status { font-size: 12.5px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
.upd-status.error { color: #d13438; border-color: rgba(209, 52, 56, 0.45); }
.upd-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.upd-sec {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  background: var(--panel);
  min-height: 150px;
  min-width: 0;
}
.upd-sec.upd-wide { grid-column: 1 / -1; }
.upd-sec h4 { margin: 0; font-size: 14px; }
.upd-src { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.6; }
.upd-meta { font-size: 12.5px; color: var(--muted); }
.upd-meta b { color: var(--text); }
.upd-err { color: #d13438; font-size: 12px; word-break: break-all; }
.upd-ok { color: #107c10; font-size: 12.5px; font-weight: 600; }
.upd-news { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.8; color: var(--muted); }
.upd-news a { color: var(--text); }
.upd-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-top: auto; }
.upd-controls label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-size: 12.5px; white-space: nowrap; }
.upd-controls input[type="checkbox"] { width: auto; margin: 0; }
.upd-controls select {
  width: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 5px 8px;
  font-size: 12.5px;
}
.upd-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
.upd-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12.5px; }
.upd-table th, .upd-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.upd-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.upd-table input, .upd-table select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 5px 8px;
  font-size: 12.5px;
}
.upd-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .upd-body { grid-template-columns: minmax(0, 1fr); }
}

.guide-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}
.gd-body { display: flex; flex-direction: column; gap: 16px; }
.gd-sec {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gd-sec h4 { margin: 0; font-size: 14.5px; }
.gd-sec .gd-desc { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin: 0; }
.gd-steps { margin: 0; padding-left: 20px; font-size: 12.5px; color: var(--muted); line-height: 1.9; }
.gd-steps b { color: var(--text); }
.gd-code-wrap { position: relative; }
.gd-code {
  margin: 0;
  border: 1px solid rgba(110, 150, 220, 0.22);
  border-left: 3px solid var(--accent, #2f6fed);
  border-radius: 9px;
  background: linear-gradient(160deg, #101a2b 0%, #0c1524 100%);
  color: #c9d9f2;
  padding: 11px 13px;
  padding-right: 60px;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
}
.gd-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 10px;
  min-height: 0;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}
.gd-copy:hover { color: var(--accent); border-color: var(--accent); }
.gd-langs { display: flex; gap: 6px; flex-wrap: wrap; }
.gd-steps[hidden], .gd-code-wrap[hidden] { display: none; }
.gd-mode { margin-bottom: 2px; }
.gd-mode button { font-weight: 600; }
.gd-langs button {
  padding: 3px 12px;
  min-height: 0;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.gd-langs button.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.gd-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.gd-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  color: var(--accent);
  text-decoration: none;
  font-size: 12.5px;
  background: var(--panel-2);
}
.gd-links a:hover { border-color: var(--accent); }
.gd-doclink { font-size: 12px; color: var(--accent); text-decoration: none; white-space: nowrap; }
.gd-doclink:hover { text-decoration: underline; }
.gd-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.studio-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.studio-toolbar { flex-wrap: wrap; }
#stProj { max-width: 170px; }
.mn-out .mn-editarea { width: 100%; box-sizing: border-box; resize: vertical; font-size: 12.5px; line-height: 1.5; }
.mind-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: max(480px, calc(100vh - 330px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(rgba(120, 140, 170, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 140, 170, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
/* 全屏模式：工坊卡铺满整个窗口（Esc 退出） */
body.studio-fs .studio-card {
  position: fixed;
  inset: 0;
  z-index: 80;
  border-radius: 0;
  border: none;
}
body.studio-fs .studio-card .mind-viewport { min-height: 0; }
.mind-viewport.panning { cursor: grabbing; }
.mind-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mind-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.mind-edges path { fill: none; stroke: rgba(120, 150, 190, 0.55); stroke-width: 2; }
.mind-edges .mn-hit { stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.mind-edges .mn-edge:hover .mn-line { stroke: var(--danger, #d24545); stroke-width: 3; }
.mind-viewport.linking, .mind-viewport.linking .mind-node { cursor: crosshair; }
.mind-node.link-src { outline: 2px dashed var(--accent); outline-offset: 3px; }
/* 节点头部永远是彩色底（内联 def.color，不随主题变），所以前景固定白色；
   用 .mn-head 前缀提高特异性，盖过 body.theme-light input/button 的浅底覆盖（否则白字白底看不见）。 */
.mn-head .mn-link, .mn-head .mn-del {
  width: 23px;
  height: 23px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.36);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.mn-head .mn-del { font-size: 17px; font-weight: 700; }
.mn-head .mn-link:hover { background: #fff; color: #1565d8; border-color: #fff; transform: scale(1.14); }
.mn-head .mn-del:hover { background: #e53e3e; color: #fff; border-color: #fff; transform: scale(1.14); }
.st-link-hint {
  font-size: 12px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.st-link-hint[hidden] { display: none; }
.mind-node {
  position: absolute;
  width: 320px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
  font-size: 14px;
  display: flex;
  flex-direction: column;
}
.mn-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px 10px 0 0;
  color: #fff;
  cursor: move;
  user-select: none;
}
.mn-type { font-weight: 700; white-space: nowrap; }
.mn-head .mn-title {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 13.5px;
  padding: 3px 6px;
}
.mn-head .mn-title::placeholder { color: rgba(255, 255, 255, 0.8); }
.mn-body { display: flex; flex-direction: column; gap: 6px; padding: 9px 10px 10px; }
.mn-selrow { display: flex; gap: 6px; }
.mn-selrow select { flex: 1 1 0; min-width: 0; }
.mn-body select, .mn-body textarea, .mn-body input.mn-model {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  padding: 6px 8px;
  width: 100%;
}
.mn-body textarea { resize: vertical; min-height: 58px; }
.mn-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mn-actions .mn-run {
  padding: 3px 16px;
  min-height: 0;
  height: 27px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #7cccff, #4aa5f0);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.mn-actions .mn-dl, .mn-actions .mn-copy, .mn-actions .mn-open, .mn-actions .mn-ai {
  padding: 3px 14px;
  min-height: 0;
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}
.mn-airow { display: flex; align-items: center; gap: 6px; }
.mn-airow[hidden] { display: none; }
.mn-airow .mn-aireq { flex: 1 1 auto; min-width: 0; }
.mn-airow .mn-aigo {
  flex: 0 0 auto;
  padding: 3px 14px;
  min-height: 0;
  height: 27px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #b18cff, #7c5cf0);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.mn-status { font-size: 12.5px; color: var(--muted); }
.mn-status.err { color: var(--danger); }
.mn-status.ok { color: var(--accent-2); }
.mn-out {
  max-height: 190px;
  overflow: auto;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}
.mn-out img, .mn-out video { max-width: 100%; border-radius: 8px; display: block; }
.mn-out audio { width: 100%; }
.mn-frame { width: 100%; height: 180px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.mn-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  opacity: 0.55;
  background:
    linear-gradient(135deg, transparent 0 58%, var(--muted) 58% 64%, transparent 64% 72%, var(--muted) 72% 78%, transparent 78% 86%, var(--muted) 86% 92%, transparent 92%);
  border-bottom-right-radius: 10px;
}
.mn-resize:hover { opacity: 1; }
.sample-note { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pack-filter-row { display: flex; align-items: center; gap: 8px; }
.pack-filter-row + .pack-filter-row { margin-top: 6px; }
.pack-filter-label { flex: 0 0 auto; font-size: 12.5px; color: var(--muted); min-width: 34px; }
.pack-ind.ind-gen { background: rgba(120, 130, 150, 0.22); color: var(--muted); }
.chat-audio { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.chat-audio audio { max-width: 320px; }
.mn-kids { display: flex; flex-wrap: wrap; gap: 4px; border-top: 1px dashed var(--line); padding-top: 7px; }
.mn-kids button {
  padding: 2px 10px;
  min-height: 0;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.mn-kids button:hover { color: var(--accent); border-color: var(--accent); }

.create-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}
.cr-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.cr-cats { display: flex; flex-direction: column; gap: 8px; }
.cr-split {
  display: grid;
  grid-template-columns: minmax(340px, 2fr) minmax(430px, 3fr);
  gap: 18px;
  align-items: start;
}
.cr-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; overflow: hidden; }
.cr-right { display: flex; flex-direction: column; gap: 10px; min-width: 0; align-self: start; }
.cr-sub { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.cr-sub input, .cr-inline-row input, .cr-inline-row select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 9px;
  font-size: 12.5px;
  min-width: 0;
}
.cr-inline-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.4fr;
  gap: 10px;
}
.cr-inline-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.cr-preview {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  padding: 7px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.cr-preview b { color: var(--text); font-weight: 600; }
.cr-preview code {
  background: rgba(102, 194, 255, 0.12);
  color: var(--accent);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11.5px;
}
.cr-cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.cr-cat-name { flex: 0 0 auto; min-width: 76px; white-space: nowrap; }
.cr-cat-model { flex: 1 1 150px; min-width: 0; }
.cr-cat-sku { flex: 0 1 138px; min-width: 0; }
.cr-cat-cap { flex: 0 0 auto; }
.cr-cat-ver { flex: 1 1 130px; min-width: 0; }
@media (max-width: 1100px) {
  .cr-split { grid-template-columns: 1fr; }
  .cr-right { position: static; }
}
.cr-cat-name b { color: var(--text); font-weight: 600; }
.cr-cat-cap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cr-cat-cap input { width: 68px; }
.cr-cat-cap em { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; }
.cr-cat-row select, .cr-cat-row input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 6px 8px;
  font-size: 12.5px;
  min-width: 0;
}
.cr-script {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.7;
  min-height: 160px;
  white-space: pre-wrap;
  word-break: break-all;
  flex: 0 0 auto;
}
.cr-script .cr-cmt { color: var(--accent-2); }
.cr-script .cr-sec-line { color: var(--accent-2); font-weight: 700; }
.cr-script .cr-cmd { color: var(--text); font-weight: 500; }

/* 页内 Azure CLI 终端（Cloud Shell 风格，深色不随主题切换） */
.cr-term {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #0d1117;
}
.cr-term-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 10px;
  background: #161b22;
  border-bottom: 1px solid #21262d;
}
.cr-term-title { display: flex; align-items: center; gap: 7px; color: #c9d1d9; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.cr-term-dot { width: 8px; height: 8px; border-radius: 50%; background: #6e7681; flex: 0 0 auto; }
.cr-term-dot.on { background: #3fb950; box-shadow: 0 0 6px rgba(63, 185, 80, 0.7); }
.cr-term-dot.off { background: #f85149; }
.cr-term-actions { display: flex; gap: 6px; }
.cr-term-actions button {
  min-height: 0;
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  border: 1px solid #30363d;
  border-radius: 7px;
  background: #21262d;
  color: #c9d1d9;
}
.cr-term-actions button:hover:not(:disabled) { background: #30363d; }
.cr-term-actions button:disabled { opacity: 0.45; }
.cr-term-actions button[hidden] { display: none; }
.cr-term-out {
  height: 300px;
  overflow: auto;
  padding: 10px 12px;
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-all;
}
.cr-term-out .tl { min-height: 1em; }
.cr-term-out .tl-cmd { color: #79c0ff; font-weight: 700; margin-top: 4px; }
.cr-term-out .tl-err { color: #ff7b72; }
.cr-term-out .tl-ok { color: #3fb950; }
.cr-term-out .tl-sys { color: #8b949e; font-style: italic; }
.cr-term-out a { color: #58a6ff; }
.cr-term-inrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #161b22;
  border-top: 1px solid #21262d;
}
.cr-term-ps { color: #3fb950; font-family: Consolas, Menlo, monospace; font-size: 12.5px; font-weight: 700; flex: 0 0 auto; }
.cr-term-inrow input {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #e6edf3;
  font-family: "Cascadia Code", Consolas, Menlo, monospace;
  font-size: 12.5px;
  padding: 6px 0;
  outline: none;
  box-shadow: none;
}
.cr-term-inrow input:disabled { opacity: 0.5; }
.cr-term-inrow button {
  min-height: 0;
  height: 28px;
  padding: 0 14px;
  font-size: 12px;
  border: none;
  border-radius: 7px;
  background: linear-gradient(180deg, #4aa5f0, #1565d8);
  color: #fff;
  font-weight: 600;
}
.cr-term-inrow button:disabled { opacity: 0.45; }

/* 使用说明：右侧边缘竖排标签 + 抽屉（默认收起） */
.cr-help-tab {
  position: fixed;
  right: 0;
  top: 45%;
  z-index: 55;
  writing-mode: vertical-rl;
  letter-spacing: 3px;
  padding: 14px 6px;
  min-height: 0;
  border: none;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(180deg, #4aa5f0, #1565d8);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.18);
}
.cr-help-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 56;
  width: min(400px, 92vw);
  background: var(--card, var(--panel));
  border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
  padding: 16px 18px;
  overflow: auto;
  font-size: 12.5px;
}
.cr-help-drawer[hidden] { display: none; }
.cr-help-drawer .svc-help-grid { display: grid; grid-template-columns: max-content 1fr; gap: 10px 12px; color: var(--muted); }
.cr-help-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cr-help-head b { font-size: 14px; }
.cr-help-close {
  width: 26px;
  height: 26px;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.cr-help-close:hover { background: rgba(120, 140, 170, 0.18); color: var(--text); }

.cost-card,
.copilot-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.cost-updated { font-size: 12px; }
.cost-result { display: flex; flex-direction: column; gap: 12px; }
.cost-diag { font: 12px/1.7 Consolas, "Courier New", monospace; white-space: pre-wrap; word-break: break-all; background: var(--panel-2, rgba(0,0,0,.04)); border: 1px solid var(--line, rgba(128,128,128,.25)); border-radius: 10px; padding: 12px 14px; margin: 0; user-select: text; }
.cost-result[hidden] { display: none; }
.cost-summary { display: flex; flex-wrap: wrap; gap: 10px; }
.cost-cell-cur { box-shadow: inset 3px 0 0 #0078d4; }
.svc-inline[hidden] { display: none; }
.cost-dates { display: flex; align-items: center; gap: 6px; }
.cost-dates i { font-style: normal; color: var(--muted); }
.cost-dates input[type="date"] { min-width: 130px; }
.cost-cell {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 130px;
}
.cost-cell b { font-size: 20px; }
.cost-cell span { font-size: 11.5px; color: var(--muted); }
.cost-sec { font-weight: 600; font-size: 13px; margin-top: 2px; }
.cost-cols {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 4px 2px;
  overflow-x: auto;
}
/* 柱子均分铺满容器宽度；天数多时压缩到 18px 后横向滚动 */
.cost-col { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1 1 0; min-width: 18px; max-width: 92px; }
.cost-col i {
  display: block;
  width: min(70%, 30px);
  min-width: 8px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--accent), rgba(102, 194, 255, 0.45));
}
.cost-col em { font-style: normal; font-size: 10px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-bars { display: flex; flex-direction: column; gap: 5px; }
.cost-bar-row { display: grid; grid-template-columns: minmax(120px, 340px) 1fr max-content; gap: 10px; align-items: center; font-size: 12.5px; }
.cost-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-bar-track { background: rgba(120, 140, 170, 0.14); border-radius: 5px; height: 12px; overflow: hidden; }
.cost-bar-track i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.cost-bar-val { color: var(--muted); white-space: nowrap; }
.cost-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.cost-panel { border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); padding: 10px 14px; min-width: 0; }
.cost-panel-t { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; font-size: 13px; margin-bottom: 8px; gap: 8px; }
.cost-panel .cost-bar-row { grid-template-columns: minmax(110px, 230px) 1fr max-content; font-size: 12px; }
.cost-panel .cost-bar-row[hidden] { display: none; }
.cost-panel-trunc { font-size: 12px; }
.cost-more { font-size: 12px; color: var(--muted); text-decoration: underline; margin-top: 4px; display: inline-block; }
.cop-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.cop-table th, .cop-table td { border-bottom: 1px solid var(--line); padding: 5px 10px 5px 0; text-align: right; white-space: nowrap; }
.cop-table th:first-child, .cop-table td:first-child { text-align: left; }
.cop-table th { color: var(--muted); font-weight: 600; }


.compare-card,
.demo-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card, var(--panel));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.compare-card > label,
.demo-panel > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.chip-btn {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip-btn:hover { color: var(--text); border-color: #4aa5f0; }
.chip-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #7cccff 0%, #4aa5f0 100%);
  border-color: #4aa5f0;
}

.cmp-models { flex-wrap: wrap; }
.cmp-models .svc-inline select.cmp-sel { min-width: 165px; }
.cmp-models .cmp-custom { min-width: 165px; margin-top: 4px; }
.cmp-models .cmp-custom[hidden] { display: none; }
.cmp-status.error { color: var(--danger); }

.cmp-grid {
  display: grid;
  grid-template-columns: repeat(var(--cmp-cols, 2), minmax(0, 1fr));
  gap: 12px;
}

.cmp-col {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(120, 140, 170, 0.05);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cmp-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.cmp-col-meta { font-size: 11px; white-space: nowrap; }
.cmp-col-body {
  padding: 10px 12px;
  font-size: 13px;
  overflow: auto;
  max-height: 420px;
  flex: 1 1 auto;
}
.cmp-col-foot { padding: 6px 12px 9px; }
.cmp-spin {
  width: 18px; height: 18px;
  border: 2px solid var(--line);
  border-top-color: #4aa5f0;
  border-radius: 50%;
  animation: cmpSpin 0.8s linear infinite;
}
@keyframes cmpSpin { to { transform: rotate(360deg); } }
.cmp-err { color: var(--danger); font-size: 12px; white-space: pre-wrap; }
.cmp-err-cell { color: var(--danger); font-size: 12px; }

.cmp-stars { display: inline-flex; gap: 2px; }
.cmp-star {
  background: none;
  border: none;
  padding: 0 1px;
  font-size: 18px;
  line-height: 1;
  color: rgba(140, 155, 180, 0.45);
  cursor: pointer;
}
.cmp-star:hover, .cmp-star.on { color: #f5b301; }

.cmp-summary table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cmp-summary th, .cmp-summary td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.cmp-summary th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.cmp-summary-title { font-size: 13px; font-weight: 700; margin: 4px 0 6px; }
.cmp-star-cell { color: #f5b301; letter-spacing: 1px; }
.cmp-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}
.cmp-badge.fast { background: rgba(74, 165, 240, 0.16); color: #4aa5f0; }
.cmp-badge.cheap { background: rgba(63, 185, 80, 0.16); color: #3fb950; }
.cmp-ref {
  display: inline-block;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(240, 180, 60, 0.16);
  color: #d99a1f;
  cursor: help;
}
.cmp-diff {
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  font-size: 12.5px;
}

.demo-panel { display: none; }
.demo-panel.active { display: flex; flex-direction: column; gap: 12px; }
.demo-result {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.demo-result[hidden] { display: none; }

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 12px;
}
.pack-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(120, 140, 170, 0.05);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.pack-card:hover { border-color: #4aa5f0; transform: translateY(-1px); }
.pack-tags { display: flex; gap: 6px; }
.pack-ind, .pack-tag {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}
.pack-ind.ind-retail { background: rgba(240, 136, 62, 0.16); color: #f0883e; }
.pack-ind.ind-mfg { background: rgba(74, 165, 240, 0.16); color: #4aa5f0; }
.pack-ind.ind-fin { background: rgba(63, 185, 80, 0.16); color: #3fb950; }
.pack-ind.ind-gov { background: rgba(188, 140, 255, 0.18); color: #bc8cff; }
.pack-tag { background: rgba(120, 140, 170, 0.14); color: var(--muted); }
.pack-title { font-size: 13.5px; font-weight: 700; }
.pack-desc { font-size: 12px; line-height: 1.5; flex: 1 1 auto; }
.pack-actions { display: flex; gap: 8px; }
.pack-actions button {
  flex: 1 1 auto;
  padding: 6px 0;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}
.pack-actions button.primary { border: none; }

.rag-flow {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(74, 165, 240, 0.08);
  border: 1px dashed rgba(74, 165, 240, 0.4);
  font-size: 12.5px;
  text-align: center;
}
.rag-hit { border-left: 3px solid #4aa5f0; padding: 4px 10px; margin: 2px 0; }
.rag-hit-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.rag-file { color: #4aa5f0; font-size: 11.5px; }
.rag-score {
  flex: 0 0 90px;
  height: 6px;
  border-radius: 999px;
  background: rgba(120, 140, 170, 0.18);
  overflow: hidden;
}
.rag-score i { display: block; height: 100%; background: linear-gradient(90deg, #7cccff, #4aa5f0); border-radius: 999px; }
.rag-chunk { font-size: 12px; margin-top: 3px; line-height: 1.5; }

.agent-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 480px;
  overflow: auto;
}
.agent-step { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.agent-step .ag-icon { font-size: 16px; line-height: 1.4; }
.agent-step .ag-body { min-width: 0; flex: 1 1 auto; }
.agent-step .ag-detail { margin-top: 2px; font-size: 12px; }
.agent-step .ag-detail code {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(120, 140, 170, 0.1);
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-all;
}
.agent-step.final { border-top: 1px dashed var(--line); padding-top: 8px; }
.agent-step.err { color: var(--danger); }

.sel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.sel-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.sel-card.hot { border-color: #4aa5f0; box-shadow: 0 0 0 1px rgba(74, 165, 240, 0.5); }
.sel-tier { font-size: 11.5px; font-weight: 700; color: #4aa5f0; }
.sel-model { font-size: 16px; font-weight: 800; }
.sel-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.5; }
.sel-row b { flex: 0 0 32px; color: var(--muted); font-weight: 600; }

.safe-verdict {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}
.safe-verdict.blocked { background: rgba(248, 81, 73, 0.13); border: 1px solid rgba(248, 81, 73, 0.45); color: #f85149; }
.safe-verdict.passed { background: rgba(63, 185, 80, 0.12); border: 1px solid rgba(63, 185, 80, 0.4); color: #3fb950; }
.safe-reasons { margin: 0; padding-left: 20px; font-size: 12.5px; }
.safe-reasons li { margin: 3px 0; }
.safe-stage {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
}
.safe-stage.hit { border-color: rgba(248, 81, 73, 0.5); background: rgba(248, 81, 73, 0.06); }
.safe-stage .safe-ico { font-size: 15px; }
.safe-cats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.safe-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.sev-bar {
  display: inline-block;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: rgba(120, 140, 170, 0.18);
  overflow: hidden;
}
.sev-bar i { display: block; height: 100%; border-radius: 999px; background: #3fb950; }
.sev-bar.mid i { background: #f0883e; }
.sev-bar.high i { background: #f85149; }
.sev-num { font-size: 11px; }
.safe-note { font-size: 11.5px; }

.voice-scenes { justify-content: center; margin-top: 2px; }
.voice-scene-banner {
  text-align: center;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(74, 165, 240, 0.08);
  border: 1px dashed rgba(74, 165, 240, 0.35);
}
.voice-ticket {
  display: flex;
  gap: 10px;
  align-items: center;
  align-self: center;
  margin: 6px 0;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(63, 185, 80, 0.4);
  background: rgba(63, 185, 80, 0.09);
  font-size: 12.5px;
}
.voice-ticket .vt-icon { font-size: 18px; }

.ocr-raw summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.ocr-raw pre { max-height: 220px; overflow: auto; }

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

/* ---- 导入报表卡片式看板（Copilot 页） ---- */
.ins-note { display: flex; gap: 8px; align-items: flex-start; background: rgba(102, 194, 255, 0.08); border: 1px solid rgba(102, 194, 255, 0.35); border-radius: 10px; padding: 8px 12px; margin: 8px 0 4px; font-size: 12.5px; line-height: 1.55; }
.ins-filter { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 10px 0 12px; }
.ins-filter label { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ins-filter select { min-height: 30px; padding: 2px 8px; font-size: 12.5px; max-width: 190px; }
.ins-filter .ins-reset { min-height: 30px; height: 30px; padding: 2px 12px; font-size: 12.5px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; color: var(--text); cursor: pointer; }
.ins-filter .ins-reset:hover { border-color: var(--accent); }
.ins-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); gap: 10px; margin: 2px 0 12px; }
.ins-kpi { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 9px; background: var(--panel-2); }
.ins-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kc, #66c2ff); }
.ins-kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 76px; height: 76px; border-radius: 50%; background: var(--kc, #66c2ff); opacity: 0.09; }
.ins-kpi i { font-style: normal; font-size: 14px; }
.ins-kpi b { display: block; font-size: 19px; line-height: 1.25; margin: 2px 0 1px; }
.ins-kpi span { font-size: 11.5px; color: var(--muted); display: block; }
.ins-kpi em { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); opacity: 0.85; margin-top: 2px; }
.ins-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.ins-card { grid-column: span 6; min-width: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.ins-card.w4 { grid-column: span 4; }
.ins-card.w12 { grid-column: span 12; }
.ins-card h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ins-card h4 .ins-sub { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: auto; text-align: right; }
.ins-card .cost-bars, .ins-card .cost-cols, .ins-card .cop-table { margin-top: 0; }
.ins-rank { display: flex; flex-direction: column; gap: 8px; }
.ir-row { display: flex; align-items: center; gap: 10px; }
.ir-n { width: 22px; height: 22px; border-radius: 50%; background: var(--panel); border: 1px solid var(--border); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.ir-n.top { background: linear-gradient(135deg, #66c2ff, #3b82f6); color: #fff; border: none; }
.ir-main { flex: 1; min-width: 0; }
.ir-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; margin-bottom: 3px; }
.ir-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ir-head b { font-size: 12px; white-space: nowrap; }
.ir-bar { height: 7px; border-radius: 4px; background: var(--panel); overflow: hidden; }
.ir-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #66c2ff, #3b82f6); }
.ir-row > em { font-style: normal; font-size: 11px; color: var(--muted); width: 44px; text-align: right; flex: none; }
.ins-stack { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 4px; }
.isb-col { flex: 1 1 0; min-width: 12px; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.isb-col .isb { width: 100%; flex: 1; display: flex; flex-direction: column-reverse; }
.isb-col .isb i { width: 100%; display: block; }
.isb-col .isb i:last-child { border-radius: 3px 3px 0 0; }
.isb-col em { font-style: normal; font-size: 10px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1050px) { .ins-card, .ins-card.w4 { grid-column: span 12; } }
.ins-donut-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.ins-donut { position: relative; width: 118px; height: 118px; border-radius: 50%; flex: 0 0 auto; }
.ins-donut::after { content: ""; position: absolute; inset: 26%; border-radius: 50%; background: var(--panel-2); }
.ins-donut b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12.5px; z-index: 1; text-align: center; padding: 0 22px; line-height: 1.3; }
.ins-legend { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.ins-legend .lg-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ins-legend .lg-row i { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 3px; }
.ins-legend .lg-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-legend .lg-row em { margin-left: auto; font-style: normal; color: var(--muted); flex: 0 0 auto; }
.ins-mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.ins-mini .mi { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.ins-mini .mi b { display: block; font-size: 15.5px; }
.ins-mini .mi span { font-size: 11px; color: var(--muted); }
.ins-table-wrap { max-height: 430px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.ins-table-wrap thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
.sample-collapse { display: block; width: 100%; text-align: left; font-size: 12.5px; color: var(--muted); background: var(--panel-2); border: 1px dashed var(--border); border-radius: 10px; padding: 8px 12px; cursor: pointer; min-height: 0; }
.sample-collapse:hover { border-color: var(--accent); color: var(--text); }
.cr-fullset-row { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; }
/* 上手指南：命令/代码默认折叠块 */
.gd-fold { margin-top: 8px; }
.gd-fold summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel-2); border: 1px dashed var(--border); border-radius: 10px; cursor: pointer; font-size: 13px; user-select: none; }
.gd-fold summary::-webkit-details-marker { display: none; }
.gd-fold summary::before { content: "▸"; font-size: 12px; color: var(--muted); transition: transform 0.15s; }
.gd-fold[open] summary::before { transform: rotate(90deg); }
.gd-fold summary:hover { border-color: var(--accent); }
.gd-fold .gd-fold-hint { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.gd-fold[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.gd-fold[open] > .gd-langs { margin: 8px 0 0; }
.gd-fold[open] > .gd-code-wrap { margin-top: 8px; }
/* display:flex/grid 会覆盖 UA 的 [hidden]，带 hidden 属性的容器必须显式补规则（v0643 同类修复） */
.progress-wrap[hidden],
.metrics-panel[hidden],
.attach-list[hidden],
.agent-timeline[hidden] { display: none; }

/* ---------------- 通用表格增强：点击表头排序 + 拖拽列宽 ---------------- */
th.th-sort { cursor: pointer; position: relative; user-select: none; }
/* 既有粘性表头（价格表 / 导入明细）不能被上面的 relative 覆盖，补回 sticky（sticky 本身就是定位元素，手柄照常定位） */
.price-table th.th-sort,
.ins-table-wrap thead th.th-sort { position: sticky; }
th.th-sort:hover { color: var(--text); }
th.th-sort[data-dir]::after {
  content: "▲";
  font-size: 9px;
  margin-left: 4px;
  color: var(--accent, #2f6fed);
}
th.th-sort[data-dir="desc"]::after { content: "▼"; }
.th-rz {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}
.th-rz:hover { background: linear-gradient(to right, transparent 2px, var(--accent, #2f6fed) 2px, var(--accent, #2f6fed) 4px, transparent 4px); opacity: 0.55; }

/* ---------------- 帮助中心 ---------------- */
.hc-item .svc-help-grid { display: grid; grid-template-columns: max-content 1fr; gap: 7px 14px; margin: 10px 0 4px; max-width: 100%; }
.hc-item .svc-help-k { max-width: 220px; white-space: normal; }
.hc-line { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.hc-line b { color: var(--text); font-weight: 600; margin-right: 4px; }
.hc-sub { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.hc-sub h5 { margin: 0 0 6px; font-size: 13.5px; }
.hc-sub .svc-help-grid { margin: 4px 0 0; }
@media (max-width: 760px) {
  .hc-item .svc-help-grid { grid-template-columns: 1fr; gap: 2px; }
  .hc-item .svc-help-k { margin-top: 6px; }
}

/* API 文档说明结构化：编号要点分行突出、导语加粗（docsDescHtml 生成） */
.docs-desc .docs-line, .docs-desc .docs-lead, .docs-desc .docs-pt { display: block; line-height: 1.65; }
.docs-desc .docs-line + .docs-line, .docs-desc .docs-pt + .docs-line { margin-top: 6px; }
.docs-desc .docs-lead { margin-top: 8px; font-weight: 700; color: var(--text); }
.docs-desc .docs-pt { margin-top: 4px; padding-left: 22px; position: relative; }
.docs-desc .docs-pt i {
  position: absolute;
  left: 0;
  top: 1px;
  font-style: normal;
  font-weight: 700;
  color: var(--accent, #2f6fed);
}

/* 更新中心：米表新模型探测提示 */
.upd-newmodels { margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--accent); border-radius: 8px; font-size: 12px; line-height: 1.7; }
.upd-newmodels b { display: block; margin-bottom: 4px; }
.upd-newmodels .upd-nm { display: inline-flex; align-items: center; gap: 4px; margin: 2px 6px 2px 0; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); }
.upd-newmodels .upd-nm i { font-style: normal; font-size: 10.5px; color: var(--accent); }
.upd-newmodels em { display: block; margin-top: 4px; font-style: normal; color: var(--muted); font-size: 11.5px; }

/* 帮助中心两区切换：用户指南 / 开发中心（.docs-toolbar 前缀保证两主题下不被 body.theme-light button 覆盖） */
.docs-toolbar .hc-seg { display: inline-flex; gap: 8px; flex: 0 0 auto; }
.docs-toolbar .hc-seg button { min-height: 34px; padding: 6px 20px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.docs-toolbar .hc-seg button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* 开发中心：说明书式全宽阅读流 + 顶部提示条 + 深色结构图码窗 */
.hc-devtip { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.65; }
/* 帮助中心两区（用户指南 / 开发中心）统一全宽单列排版：内容多时逐节从上到下读，不再挤小卡片 */
#hcBody .hc-item { grid-column: 1 / -1; }
.hc-pre { margin: 2px 0; padding: 12px 14px; font-family: var(--mono, ui-monospace), monospace; font-size: 11.5px; line-height: 1.6; overflow: auto; border-radius: 10px; background: linear-gradient(160deg, #101a2b 0%, #0c1524 100%); color: #c9d9f2; border: 1px solid rgba(110, 150, 220, 0.22); border-left: 3px solid var(--accent, #2f6fed); white-space: pre; }
