/* 朴素桌面工具风格：中性灰 + 克制的钢蓝强调色，紧凑密度，小圆角 */

:root {
  --font-ui: 'Segoe UI', 'Microsoft YaHei UI', system-ui, sans-serif;
  --font-mono: Consolas, 'Cascadia Mono', 'Courier New', monospace;
  --radius: 4px;
}

html[data-theme='light'] {
  --bg: #f2f2f1;
  --bg-panel: #fafaf9;
  --bg-inset: #ebebea;
  --bg-hover: #e4e4e2;
  --bg-active: #dcdcda;
  --border: #d2d2cf;
  --border-strong: #b8b8b4;
  --text: #1f2328;
  --text-dim: #6b7178;
  --text-faint: #9aa0a6;
  --accent: #3d6f94;
  --accent-text: #ffffff;
  --accent-dim: #d9e4ec;
  --danger: #a4453c;
  --ok: #4a7d4f;
  --warn: #a8762f;
  --term-bg: #fafaf9;
}

html[data-theme='dark'] {
  --bg: #1d1f21;
  --bg-panel: #25282b;
  --bg-inset: #17191b;
  --bg-hover: #2e3236;
  --bg-active: #383d42;
  --border: #36393d;
  --border-strong: #4a4e53;
  --text: #d6d9dc;
  --text-dim: #8f959b;
  --text-faint: #62686e;
  --accent: #6fa3c8;
  --accent-text: #14222d;
  --accent-dim: #2c3b46;
  --danger: #c4756d;
  --ok: #84ad88;
  --warn: #c9a05e;
  --term-bg: #1d1f21;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  user-select: none;
}

input,
textarea,
select,
button {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text);
}

textarea {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ---------- 基础控件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-panel);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.5;
}

.btn:hover {
  background: var(--bg-hover);
}

.btn:active {
  background: var(--bg-active);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.danger {
  color: var(--danger);
}

.btn.small {
  padding: 2px 8px;
  font-size: 12px;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover {
  background: var(--bg-hover);
}

/* ghost 按钮的选中态（如工作区页码）：ghost 的透明背景定义在 primary 之后，需在此恢复实底强调色 */
.btn.ghost.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.input,
.select {
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-panel);
  outline: none;
}

.input:focus,
.select:focus,
textarea.input:focus {
  border-color: var(--accent);
}

textarea.input {
  resize: vertical;
  user-select: text;
}

.label {
  display: block;
  margin: 10px 0 4px;
  color: var(--text-dim);
  font-size: 12px;
}

/* ---------- 布局 ---------- */

.app {
  display: flex;
  height: 100%;
}

.sidebar {
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-inset);
  border-right: 1px solid var(--border);
  position: relative;
}

.sidebar.collapsed {
  width: 40px;
  align-items: center;
  padding: 6px 0;
  gap: 4px;
}

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

.sidebar-tab {
  border: none;
  background: none;
  padding: 3px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
}

.sidebar-tab:hover {
  background: var(--bg-hover);
}

.sidebar-tab.active {
  background: var(--bg-active);
  color: var(--text);
}

/* ---------- 文件树 ---------- */

.file-tree {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.tree-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px 3px;
}

.tree-root {
  flex: 1;
  font-size: 11px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-body {
  flex: 1;
  overflow: auto;
  padding: 0 4px 6px;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12.5px;
}

.tree-item:hover {
  background: var(--bg-hover);
}

.tree-item.selected {
  background: var(--accent-dim);
}

.tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-loading {
  color: var(--text-faint);
  font-size: 11px;
  padding: 2px 0;
}

.tree-copied {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-text);
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
}

/* ---------- 右键菜单 ---------- */

.ctx-backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
}

.ctx-menu {
  position: fixed;
  z-index: 200;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: 3px;
  min-width: 140px;
  max-height: 70vh;
  overflow-y: auto;
}

.ctx-item {
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}

.ctx-item:hover {
  background: var(--bg-hover);
}

.ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 3px 6px;
}

.ctx-title {
  padding: 4px 12px 2px;
  font-size: 11px;
  color: var(--text-faint);
}

.ctx-item.disabled {
  color: var(--text-faint);
  cursor: default;
}

.ctx-item.disabled:hover {
  background: none;
}

.ctx-current {
  color: var(--accent);
  font-size: 11px;
}

/* 浮层菜单中的危险项与次级提示文字 */
.ctx-item.danger {
  color: var(--danger);
}

.ctx-hint {
  color: var(--text-faint);
  font-size: 11px;
}

/* 栏头思考徽标 */
.pane-think {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 7px;
  line-height: 15px;
  background: var(--bg-panel);
}

/* 栏头模型徽标 */
.pane-model {
  flex-shrink: 0;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 8px;
  padding: 0 7px;
  line-height: 15px;
  background: var(--accent-dim);
}

/* ---------- 分栏分隔条 ---------- */

.split-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 20;
}

.split-divider.horizontal {
  left: 0;
  right: 0;
  bottom: auto;
  width: auto;
  height: 6px;
  cursor: row-resize;
}

.split-divider:hover,
.split-divider:active {
  background: var(--accent);
  opacity: 0.4;
}

/* ---------- 侧栏宽度拖拽手柄 ---------- */

.side-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 30;
}

/* 左侧栏：手柄在右缘；右侧指令栏：手柄在左缘。骑在边框上便于抓取 */
.side-resizer.right {
  right: -3px;
}

.side-resizer.left {
  left: -3px;
}

.side-resizer:hover,
.side-resizer:active {
  background: var(--accent);
  opacity: 0.4;
}

/* ---------- 文件预览 ---------- */

.file-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-inset);
  flex-shrink: 0;
}

.preview-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40%;
}

.preview-mode {
  display: flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1px;
}

.preview-warn {
  padding: 5px 12px;
  background: var(--accent-dim);
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}

.preview-warn.danger {
  color: var(--danger);
}

.preview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-editor {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.code-editor .cm-editor {
  height: 100%;
}

.preview-image {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-inset);
}

.preview-image img {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* Markdown 渲染 */
.md-render {
  flex: 1;
  overflow-y: auto;
  padding: 18px 28px;
  user-select: text;
  line-height: 1.65;
  font-size: 13.5px;
}

.md-render h1,
.md-render h2,
.md-render h3,
.md-render h4 {
  margin: 18px 0 8px;
  font-weight: 600;
  line-height: 1.3;
}

.md-render h1 {
  font-size: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.md-render h2 {
  font-size: 17px;
}

.md-render h3 {
  font-size: 15px;
}

.md-render p {
  margin: 8px 0;
}

.md-render code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.md-render pre {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  overflow-x: auto;
}

.md-render pre code {
  border: none;
  background: none;
  padding: 0;
}

.md-render ul,
.md-render ol {
  padding-left: 24px;
  margin: 8px 0;
}

.md-render blockquote {
  margin: 8px 0;
  padding: 2px 14px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-dim);
}

.md-render table {
  border-collapse: collapse;
  margin: 10px 0;
}

.md-render th,
.md-render td {
  border: 1px solid var(--border);
  padding: 5px 12px;
}

.md-render th {
  background: var(--bg-inset);
}

.md-render img {
  max-width: 100%;
}

.md-render a {
  color: var(--accent);
}

.md-render hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

/* ---------- 多栏工作区 ---------- */

/* 多栏时聚焦栏位的内侧描边 */
.terminal-area.multi .terminal-host.focused {
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* 栏头：状态点 + 项目名 + 会话标题 + 会话选择器 */
.pane-header {
  position: absolute;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  cursor: default;
}

.pane-header.focused {
  background: var(--accent-dim);
}

.pane-proj {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 7px;
  line-height: 15px;
  background: var(--bg-panel);
}

.pane-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane-title.empty {
  color: var(--text-faint);
}

.pane-select {
  flex-shrink: 0;
  max-width: 150px;
  font-size: 11px;
  padding: 1px 4px;
  opacity: 0.75;
}

.pane-select:hover,
.pane-select:focus {
  opacity: 1;
}

.pane-empty {
  position: absolute;
  z-index: 14;
  background: var(--term-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pane-empty-hint {
  color: var(--text-faint);
  font-size: 12px;
  max-width: 240px;
  text-align: center;
  line-height: 1.6;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 4px;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.5px;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
}

.sidebar-item:hover {
  background: var(--bg-hover);
}

.sidebar-item.active {
  background: var(--accent-dim);
}

.sidebar-item .item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item .item-x {
  visibility: hidden;
  color: var(--text-faint);
  border: none;
  background: none;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 2px;
}

.sidebar-item:hover .item-x {
  visibility: visible;
}

.sidebar-item .item-x:hover {
  color: var(--danger);
}

/* ---------- 用量统计 ---------- */

.usage-panel {
  border-top: 1px solid var(--border);
  padding: 4px 10px 6px;
}

.usage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.3px;
  margin-bottom: 1px;
}

.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1px 0;
  font-size: 12px;
}

.usage-label {
  color: var(--text-dim);
}

.usage-value {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
}

.usage-hint {
  font-size: 11.5px;
  color: var(--text-faint);
  padding: 1px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quota-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 1px 0;
  font-size: 12px;
}

.quota-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
}

/* 额度窗口下方的「下次刷新」小字 */
.quota-reset {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  padding-left: 8px;
  margin-top: -2px;
  margin-bottom: 1px;
}

/* 订阅信息：套餐 + 状态 + 开始日（官方无活跃订阅到期日） */
.usage-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  padding: 1px 0 3px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.usage-sub-plan {
  color: var(--text);
  font-weight: 600;
}

.usage-sub-status {
  color: var(--accent);
}

.usage-sub-date {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

/* 跨两栏的整行项 */
.sidebar-footer .span-2 {
  grid-column: 1 / -1;
}

/* 纯展示项：无悬停态、不可点击 */
.sidebar-item.static {
  cursor: default;
}

.sidebar-item.static:hover {
  background: none;
}

.sidebar-footer .sidebar-item {
  color: var(--text-dim);
  /* 网格单元里允许文本收缩省略，避免撑破栏宽 */
  min-width: 0;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- 标签栏 ---------- */

.tabbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px 0;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  color: var(--text-dim);
  max-width: 220px;
  white-space: nowrap;
}

.tab:hover {
  background: var(--bg-hover);
}

.tab.active {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
  position: relative;
  top: 1px;
}

.tab .tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab .tab-x {
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0 2px;
  border-radius: 2px;
}

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

/* 状态点 */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.working {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.dot.attention {
  background: var(--warn);
}

.dot.idle {
  background: var(--ok);
}

.dot.exited {
  background: var(--text-faint);
}

.dot.unread {
  background: var(--warn);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ---------- 内容区 ---------- */

.content {
  flex: 1;
  min-height: 0;
  display: flex;
}

.page {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px;
  user-select: text;
}

.page h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}

.page .page-desc {
  color: var(--text-dim);
  margin: 0 0 16px;
  font-size: 12.5px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar .spacer {
  flex: 1;
}

/* ---------- 列表/表格 ---------- */

.row-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.row:last-child {
  border-bottom: none;
}

.row:hover {
  background: var(--bg-hover);
}

.row .row-main {
  flex: 1;
  min-width: 0;
}

.row .row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row .row-sub {
  color: var(--text-dim);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.row .row-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.empty-hint {
  padding: 28px;
  text-align: center;
  color: var(--text-faint);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--bg-inset);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.badge.accent {
  background: var(--accent-dim);
  color: var(--text);
}

/* ---------- 终端 ---------- */

.terminal-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
}

.terminal-pane {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--term-bg);
}

.terminal-pane + .terminal-pane {
  border-left: 1px solid var(--border);
}

.terminal-host {
  position: absolute;
  inset: 0;
  padding: 4px 0 4px 8px;
}

.terminal-host.hidden {
  visibility: hidden;
  z-index: -1;
}

/* ---------- 指令侧栏 ---------- */

.cmd-drawer {
  width: 270px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-inset);
  display: flex;
  flex-direction: column;
  position: relative;
}

.cmd-drawer-header {
  padding: 8px 10px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}

.cmd-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.cmd-group-title {
  font-size: 11px;
  color: var(--text-faint);
  padding: 8px 6px 3px;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.cmd-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

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

.btn.icon-only {
  padding: 2px 5px;
}

/* ---------- 提示队列 ---------- */

.queue-section {
  border-top: 1px solid var(--border);
  padding: 2px 8px 8px;
  flex-shrink: 0;
  max-height: 45%;
  overflow-y: auto;
}

.queue-title {
  cursor: pointer;
  user-select: none;
}

.queue-title:hover {
  color: var(--text-dim);
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 5px;
  border-radius: 3px;
  font-size: 12px;
}

.queue-item:hover {
  background: var(--bg-hover);
}

.queue-index {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-active);
  color: var(--text-dim);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ---------- 收件箱徽标 ---------- */

.inbox-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  background: var(--warn);
  color: var(--bg-panel);
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  padding: 0 3px;
}

/* ---------- 用量趋势图 ---------- */

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 180px;
  padding: 8px 4px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-inset);
}

.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.trend-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.trend-seg {
  width: 100%;
  border-radius: 2px 2px 0 0;
}

.trend-seg.input {
  background: var(--accent);
  opacity: 0.55;
}

.trend-seg.output {
  background: var(--accent);
}

.trend-label {
  height: 16px;
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  white-space: nowrap;
}

.trend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: -1px;
  margin-right: 4px;
}

.trend-swatch.input {
  opacity: 0.55;
}

/* 加星按钮：未加星时仅悬停可见 */
.star-btn {
  color: var(--text-faint);
}

.star-btn.on {
  color: var(--warn);
}

.star-btn.ghost {
  border: none;
  background: none;
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 3px;
  visibility: hidden;
}

.star-btn.ghost.on,
.cmd-item:hover .star-btn.ghost {
  visibility: visible;
}

.star-btn.ghost:hover {
  color: var(--warn);
}

/* ---------- 对话框 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  min-width: 420px;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.dialog-title {
  padding: 12px 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.dialog-body {
  padding: 12px 16px;
  overflow-y: auto;
  user-select: text;
}

.dialog-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- 预览 ---------- */

.preview-msg {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  line-height: 1.55;
}

.preview-msg.user {
  background: var(--accent-dim);
  border-color: transparent;
}

.preview-msg.assistant {
  background: var(--bg-panel);
}

.preview-msg.tool {
  background: var(--bg-inset);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 10px;
}

.preview-role {
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 3px;
}

/* ---------- 设置 ---------- */

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

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row .settings-label {
  flex: 1;
}

.settings-row .settings-label .sub {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 2px;
}

/* 开关 */
.switch {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: var(--border-strong);
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-panel);
  transition: left 0.12s;
}

.switch.on {
  background: var(--accent);
}

.switch.on::after {
  left: 18px;
}

/* 多选项目列表 */
.check-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 160px;
  overflow-y: auto;
  padding: 4px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: pointer;
}

.check-item:hover {
  background: var(--bg-hover);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}
