/* ===== 全局基础 ===== */
:root {
  --bg: #f5f6fa;
  --sidebar-bg: #eaedf4;
  --sidebar-fg: #55637b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --border: #e3e6ee;
  --text: #1f2430;
  --text-soft: #6b7280;
  --danger: #dc2626;
  --radius: 10px;
  font-size: 14px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ===== 布局 ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

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

/* 右列容器（旧版 el-container 垂直结构：内容区 + 底部栏） */
.app-right {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

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

.app-main > * {
  flex: 1;
  min-height: 0;
}

/* ===== 底部栏（旧版 Footer.vue） ===== */
.app-footer {
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 12px;
  font-size: 11px;
  color: #94a3b8;
  border-top: 1px solid var(--border);
  background: var(--bg);
  user-select: none;
}

.app-footer-devtools {
  cursor: pointer;
  opacity: 0;
}

/* ===== 标题栏（跨平台） ===== */
.titlebar {
  display: flex;
  align-items: stretch;
  height: 36px;
  background: var(--sidebar-bg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  user-select: none;
  flex-shrink: 0;
}

.titlebar-drag {
  flex: 1;
  display: flex;
  align-items: center;
  -webkit-app-region: drag;
  padding-left: 48px; /* 与侧边栏菜单文字左边缘对齐（10 菜单 + 10 项 + 18 图标 + 10 gap） */
}

.titlebar-mac-spacer {
  width: 68px; /* 为 macOS 红绿灯按钮留位 */
}

.titlebar-title {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}

.titlebar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.titlebar-app-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
}

.titlebar-app-version {
  font-size: 11px;
  font-weight: 400;
  color: var(--text);
  opacity: 0.55;
}

.socket-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.socket-dot--connected { background: #22c55e; }
.socket-dot--connecting { background: #f59e0b; }
.socket-dot--closed { background: #6b7280; }

.titlebar-controls {
  display: flex;
  -webkit-app-region: no-drag;
}

.titlebar-actions {
  display: flex;
  align-items: center;
  -webkit-app-region: no-drag;
  padding-right: 4px;
}

.titlebar-action-btn {
  width: 32px;
  height: 28px;
  margin: 4px 2px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.titlebar-action-btn:hover {
  background: rgba(15, 23, 42, 0.07);
  color: var(--text);
}

.titlebar-action-btn.is-active {
  background: rgba(15, 23, 42, 0.1);
  color: var(--text);
}

.titlebar-btn {
  width: 44px;
  border: none;
  background: transparent;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
}

.titlebar-btn:hover {
  background: rgba(15, 23, 42, 0.07);
  color: var(--text);
}

.titlebar-btn--close:hover {
  background: #dc2626;
  color: #fff;
}

/* ===== 侧栏 ===== */
.sidebar {
  width: 230px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* 品牌标题（旧版 LeftMenu.vue 顶部：setting.brand + setting.version） */
.sidebar-brand {
  padding: 22px 10px 8px;
  text-align: center;
}

.sidebar-brand h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #334155;
}

.sidebar-brand h3 span {
  font-size: 12px;
  font-weight: 400;
  margin-left: 4px;
  opacity: 0.7;
}

.sidebar-footer {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
}

.sidebar-context {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

/* ===== 侧栏功能菜单（旧版 LeftMenu） ===== */
.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.16);
  border-radius: 4px;
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--sidebar-fg);
  font-size: 16px;
  text-align: left;
  transition: all 0.15s ease;
}

.sidebar-menu-item:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}

.sidebar-menu-item--active {
  background: var(--primary);
  color: #fff;
}

.sidebar-menu-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

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

/* ===== 按钮 ===== */
.btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  transition: all 0.15s;
}

.btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

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

.sidebar .btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #e5e9f0;
}

.sidebar .btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn--stop {
  background: #fff;
  border-color: var(--border);
  color: var(--danger);
}

.btn--active {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== 聊天区 ===== */
.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 24px 8%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-welcome {
  margin: auto;
  text-align: center;
  max-width: 520px;
}

.chat-welcome-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-welcome h2 {
  margin-bottom: 8px;
}

.chat-welcome p {
  color: var(--text-soft);
  margin-bottom: 20px;
}

.chat-welcome-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.suggestion {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
  text-align: left;
  color: var(--text-soft);
  transition: all 0.15s;
}

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

/* ===== 消息 ===== */
.msg {
  display: flex;
  gap: 10px;
  max-width: 100%;
}

.msg--user {
  justify-content: flex-end;
}

.msg-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-bubble {
  border-radius: var(--radius);
  padding: 10px 14px;
  max-width: min(760px, 86%);
  line-height: 1.7;
  word-break: break-word;
  /* 字号由设置页「字体大小」控制（旧版 setting.fontSize，默认 16） */
  font-size: var(--chat-font-size, 16px);
}

.msg-bubble--user {
  background: var(--primary);
  color: #fff;
  white-space: pre-wrap;
}

.msg-bubble--assistant {
  background: #fff;
  border: 1px solid var(--border);
}

.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.08);
}

.msg-bubble--user .attachment-chip {
  background: rgba(255, 255, 255, 0.18);
}

.attachment-remove {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 13px;
  padding: 0 2px;
}

.stream-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--primary);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 0.9s infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.msg-error {
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
}

/* ===== 智能体步骤 ===== */
.agent-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed var(--border);
}

.step summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-soft);
  cursor: pointer;
  list-style: none;
}

.step summary::-webkit-details-marker {
  display: none;
}

.step-name {
  font-weight: 600;
}

.step-status {
  margin-left: auto;
}

.step--running .step-status { color: #f59e0b; }
.step--done .step-status { color: #16a34a; }
.step--waiting .step-status { color: #2563eb; }
.step--denied .step-status { color: #d97706; }
.step--error .step-status { color: var(--danger); }

.step-detail {
  margin-top: 6px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-soft);
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ===== 待办卡片 ===== */
.pending-card {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 8px;
  font-size: 13px;
}

.pending-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.pending-item {
  margin-bottom: 8px;
}

.pending-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pending-actions input {
  flex: 1;
  min-width: 140px;
}

.pending-deny {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.pending-deny input {
  min-width: 100px;
}

/* ===== 输出文件 ===== */
.output-files {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.output-files-title {
  font-size: 12px;
  color: var(--text-soft);
}

.output-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  text-align: left;
}

.output-file:hover:not(:disabled) {
  border-color: var(--primary);
}

.output-file-size {
  color: var(--text-soft);
  font-size: 11px;
}

.output-file-action {
  margin-left: auto;
  color: var(--primary);
  font-size: 12px;
}

/* ===== 输入框 ===== */
.chat-input {
  padding: 12px 8% 16px;
  flex-shrink: 0;
}

.chat-input-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 2px 12px rgba(31, 36, 48, 0.06);
}

.chat-input-row:focus-within {
  border-color: var(--primary);
}

.chat-input-row textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  max-height: 160px;
  background: transparent;
}

.chat-input-attach {
  border: none;
  background: transparent;
  font-size: 16px;
  padding: 4px;
}

.chat-input-attach:disabled {
  opacity: 0.4;
}

/* ===== Markdown ===== */
.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }
.md-body p { margin: 8px 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  margin: 14px 0 8px;
  line-height: 1.4;
}
.md-body h1 { font-size: 1.35em; }
.md-body h2 { font-size: 1.2em; }
.md-body h3 { font-size: 1.08em; }
.md-body ul, .md-body ol { margin: 8px 0; padding-left: 22px; }
.md-body li { margin: 4px 0; }
.md-body a { color: var(--primary); }
.md-body blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--primary);
  background: #f8fafc;
  color: var(--text-soft);
}
.md-body code {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.9em;
  background: rgba(135, 131, 120, 0.15);
  padding: 2px 5px;
  border-radius: 4px;
}
.md-body pre {
  margin: 10px 0;
  padding: 12px;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}
.md-body pre code {
  background: transparent;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}
.md-body table {
  border-collapse: collapse;
  margin: 10px 0;
  width: 100%;
  font-size: 13px;
}
.md-body th, .md-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.md-body th { background: #f6f8fa; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* ===== 设置页 ===== */
.settings {
  flex: 1;
  overflow-y: auto;
  padding: 24px 8%;
}

.settings h2 {
  margin-bottom: 16px;
}

.settings-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.settings-section h3 {
  font-size: 14px;
  margin-bottom: 12px;
}

.settings-empty {
  color: var(--text-soft);
  font-size: 13px;
}

.settings-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

.settings-tip {
  color: var(--text-soft);
  font-size: 12px;
}

.settings code {
  background: rgba(135, 131, 120, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  /* 与 .settings-fields 一致：子项缩进，突出大项/小项层级 */
  margin-left: 3px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
  flex-wrap: wrap;
}

.settings input[type='text'] {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.settings input[type='text']:focus {
  border-color: var(--primary);
}

.kv-grid {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px 14px;
  font-size: 13px;
}

.kv-grid span {
  color: var(--text-soft);
}

.hid-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

.hid-table th, .hid-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.hid-table th {
  background: #f6f8fa;
}

.socket-state {
  font-weight: 600;
}

.socket-state--connected { color: #16a34a; }
.socket-state--connecting { color: #f59e0b; }
.socket-state--closed { color: var(--text-soft); }

.socket-log {
  margin-top: 10px;
  padding: 10px;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-soft);
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
}

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

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.settings-form input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}

.settings-form input:focus {
  border-color: var(--primary);
}

/* ===== 设置页表单行（旧版 el-form label-width 100px） ===== */
.settings-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* 子项相对大项标题缩进，左侧加分组线突出主次 */
  margin-left: 3px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.settings-field {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.settings-field-label {
  color: var(--text-soft);
}

.settings-control {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  outline: none;
  min-width: 180px;
  justify-self: start;
}

.settings-control:focus {
  border-color: var(--primary);
}

.settings-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
}

.settings-slider-wrap input[type='range'] {
  flex: 1;
  accent-color: var(--primary);
}

.settings-slider-value {
  font-size: 12px;
  color: var(--text-soft);
  min-width: 42px;
}

/* 开关（旧版 el-switch） */
.settings-switch {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 22px;
}

.settings-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.settings-switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.15s;
  pointer-events: none;
}

.settings-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s;
}

.settings-switch input:checked + .settings-switch-track {
  background: var(--primary);
}

.settings-switch input:checked + .settings-switch-track::after {
  transform: translateX(18px);
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background: rgba(120, 130, 150, 0.35);
  border-radius: 3px;
}

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

/* ===== 模板中心（TemplatePage） ===== */
.tpl-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tpl-header {
  text-align: center;
  padding: 32px 24px 16px;
  flex-shrink: 0;
}

.tpl-title {
  font-size: 1.5rem;
  color: rgb(39 39 42);
  margin: 0 0 6px;
  font-weight: 600;
}

.tpl-subtitle {
  color: rgb(113 113 122);
  font-size: 0.875rem;
  margin: 0;
}

.tpl-toolbar {
  display: flex;
  justify-content: center;
  padding: 0 32px 12px;
  flex-shrink: 0;
}

.tpl-tabs {
  display: flex;
  gap: 4px;
  background: rgb(244 244 245);
  border-radius: 10px;
  padding: 3px;
  max-width: 100%;
  overflow-x: auto;
}

.tpl-tab {
  padding: 7px 18px;
  border-radius: 8px;
  border: none;
  background: none;
  font-size: 0.875rem;
  color: rgb(82 82 91);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tpl-tab:hover {
  color: rgb(39 39 42);
}

.tpl-tab-icon {
  font-size: 1rem;
}

.tpl-tab--active {
  background: #fff;
  color: rgb(39 39 42);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tpl-sub-pills {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 32px 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.tpl-pill {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid rgb(228 228 231);
  background: #fff;
  font-size: 0.8rem;
  color: rgb(82 82 91);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tpl-pill:hover {
  border-color: rgb(161 161 170);
  color: rgb(39 39 42);
}

.tpl-pill--active {
  background: rgb(99 102 241);
  color: #fff;
  border-color: rgb(99 102 241);
}

.tpl-content {
  flex: 1;
  min-height: 0;
  position: relative;
}

.tpl-loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  z-index: 5;
}

.tpl-loading::after {
  content: '';
  position: absolute;
  top: 40%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid rgb(226 232 240);
  border-top-color: rgb(99 102 241);
  border-radius: 50%;
  animation: tpl-spin 0.8s linear infinite;
}

@keyframes tpl-spin {
  to {
    transform: rotate(360deg);
  }
}

.tpl-scrollbar {
  height: 100%;
  overflow-y: auto;
}

.tpl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: rgb(161 161 170);
}

.tpl-empty-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.tpl-empty p {
  margin-top: 16px;
  color: rgb(161 161 170);
}

.tpl-group {
  padding: 0 32px;
  margin-bottom: 24px;
}

.tpl-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgb(244 244 245);
}

.tpl-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(99 102 241);
  flex-shrink: 0;
}

.tpl-group-title {
  font-size: 1rem;
  font-weight: 600;
  color: rgb(39 39 42);
  margin: 0;
}

.tpl-group-count {
  font-size: 0.75rem;
  color: rgb(161 161 170);
  margin-left: 4px;
}

.tpl-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.tpl-card {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgb(244 244 245);
  cursor: pointer;
  transition: all 0.3s ease;
}

.tpl-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  border-color: rgb(228 228 231);
}

.tpl-card:hover .tpl-card-overlay {
  opacity: 1;
}

.tpl-card:hover .tpl-card-img {
  transform: scale(1.05);
}

.tpl-card-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: rgb(244 244 245);
}

.tpl-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
}

.tpl-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.12) 45%, rgba(0, 0, 0, 0) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tpl-card:hover .tpl-card-overlay,
.tpl-card:focus-within .tpl-card-overlay {
  opacity: 1;
}

.tpl-card-preview-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: rgb(39 39 42);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tpl-card-preview-btn:hover {
  background: #fff;
  transform: scale(1.05);
}

.tpl-card-download-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  background: rgb(99 102 241);
  color: #fff;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.tpl-card-download-btn:hover:not(:disabled) {
  background: rgb(79 70 229);
  transform: scale(1.05);
}

.tpl-card-download-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tpl-card-info {
  padding: 10px 12px;
}

.tpl-card-name {
  font-size: 0.9rem;
  color: rgb(63 63 70);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

/* Quick Nav */
.tpl-quick-nav {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.tpl-quick-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgb(228 228 231);
  background: rgba(255, 255, 255, 0.95);
  color: rgb(82 82 91);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  overflow: hidden;
}

.tpl-quick-nav-btn:hover {
  background: rgb(99 102 241);
  border-color: rgb(99 102 241);
  color: #fff;
}

/* Preview Dialog */
.tpl-dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 6vh 24px 24px;
}

.tpl-dialog {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}

.tpl-dialog-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 20;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(244 244 245, 0.9);
  color: rgb(82 82 91);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tpl-dialog-close:hover {
  background: rgb(228 228 231);
  color: rgb(39 39 42);
}

.tpl-detail {
  display: flex;
  gap: 0;
  max-width: 92vw;
  max-height: 82vh;
}

/* Left preview area */
.tpl-preview-area {
  display: flex;
  flex-direction: column;
  background: rgb(244 244 245);
  border-radius: 16px 0 0 16px;
  overflow: hidden;
}

.tpl-preview-main {
  position: relative;
  width: 560px;
  height: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(250 250 250);
}

.tpl-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tpl-preview-main[role='button'] {
  cursor: zoom-in;
}

.tpl-preview-zoom-hint {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.tpl-preview-main:hover .tpl-preview-zoom-hint {
  opacity: 1;
}

.tpl-preview-placeholder {
  color: rgb(161 161 170);
  font-size: 0.9rem;
}

.tpl-preview-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: rgb(63 63 70);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.tpl-preview-arrow:hover:not(:disabled) {
  background: #fff;
  transform: translateY(-50%) scale(1.08);
}

.tpl-preview-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tpl-preview-arrow--left {
  left: 12px;
}

.tpl-preview-arrow--right {
  right: 12px;
}

.tpl-preview-indicator {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 12px;
  border-radius: 12px;
}

.tpl-thumb-strip {
  border-top: 1px solid rgb(228 228 231);
  background: #fff;
}

.tpl-thumb-scroll {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
}

.tpl-thumb-item {
  position: relative;
  width: 56px;
  height: 42px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.tpl-thumb-item--active {
  border-color: rgb(99 102 241);
}

.tpl-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tpl-thumb-num {
  position: absolute;
  bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.7rem;
  padding: 0 4px;
  border-radius: 6px 0 0 0;
}

/* Right info panel */
.tpl-info-panel {
  width: 280px;
  padding: 20px;
  overflow-y: auto;
  background: #fff;
  border-radius: 0 16px 16px 0;
}

.tpl-info-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgb(39 39 42);
  margin: 0 0 12px;
  line-height: 1.4;
}

.tpl-info-meta {
  border-top: 1px solid rgb(244 244 245);
  padding-top: 12px;
}

.tpl-info-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.tpl-info-meta-label {
  font-size: 0.8rem;
  color: rgb(161 161 170);
}

.tpl-info-meta-value {
  font-size: 0.8rem;
  color: rgb(63 63 70);
}

.tpl-info-download {
  width: 100%;
  margin-top: 14px;
  padding: 10px 0;
  border-radius: 10px;
  border: 1px solid rgb(99 102 241);
  background: rgb(99 102 241);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tpl-info-download:hover:not(:disabled) {
  background: rgb(79 70 229);
  border-color: rgb(79 70 229);
}

.tpl-info-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tpl-info-recommend {
  margin-top: 18px;
  border-top: 1px solid rgb(244 244 245);
  padding-top: 14px;
}

.tpl-info-recommend-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgb(63 63 70);
  margin: 0 0 10px;
}

.tpl-info-recommend-card {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.tpl-info-recommend-card:hover {
  background: rgb(244 244 245);
}

.tpl-info-recommend-img {
  width: 48px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.tpl-info-recommend-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tpl-info-recommend-name {
  font-size: 0.85rem;
  color: rgb(63 63 70);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.tpl-info-recommend-pages {
  font-size: 0.78rem;
  color: rgb(161 161 170);
}

/* Fullscreen image preview */
.tpl-fullscreen-mask {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  animation: tpl-fade-in 0.2s ease;
}

@keyframes tpl-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.tpl-fullscreen-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.tpl-fullscreen-close {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 2010;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.tpl-fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.tpl-fullscreen-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.tpl-fullscreen-arrow:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
}

.tpl-fullscreen-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tpl-fullscreen-arrow--left {
  left: 24px;
}

.tpl-fullscreen-arrow--right {
  right: 24px;
}

.tpl-fullscreen-indicator {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.85rem;
  padding: 5px 16px;
  border-radius: 14px;
}

.tpl-fullscreen-download {
  position: absolute;
  bottom: 22px;
  right: 28px;
  z-index: 2010;
  display: flex;
  align-items: center;
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  background: rgb(99 102 241);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.tpl-fullscreen-download:hover:not(:disabled) {
  background: rgb(79 70 229);
}

.tpl-fullscreen-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .tpl-preview-main {
    width: 420px;
    height: 360px;
  }

  .tpl-info-panel {
    width: 240px;
  }
}

/* ===== AI新教育开通页（EduInitPage） ===== */
.eduinit-page {
  background-color: rgba(255, 255, 255, 0.95);
  width: 95%;
  margin: 30px auto 0;
  border-radius: 10px;
  height: calc(100% - 30px);
  overflow-y: auto;
}

.eduinit-title {
  text-align: center;
  font-size: 36px;
  margin: 0 0 50px;
  padding-top: 20px;
  color: #606266;
  font-weight: 600;
}

.eduinit-imgs {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 25px;
  padding: 0 16px;
}

.eduinit-imgs img {
  border-radius: 10px;
  max-width: 100%;
  height: auto;
}

.eduinit-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0 25px 20px 0;
  color: #606266;
  font-size: 0.9rem;
}

.eduinit-buy {
  color: #e6a23c;
  cursor: pointer;
}

.eduinit-buy:hover {
  text-decoration: underline;
}

/* ===== 智能体中心（AiAppListPage） ===== */
.aap-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #fafbff 0%, #f4f5fa 100%);
}

/* Hero */
.aap-hero {
  position: relative;
  flex-shrink: 0;
  padding: 20px 32px 18px;
  overflow: hidden;
  border-bottom: 1px solid rgba(99, 102, 241, 0.08);
}

.aap-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.12), transparent 50%),
    radial-gradient(circle at 80% 60%, rgba(168, 85, 247, 0.1), transparent 50%),
    radial-gradient(circle at 60% 100%, rgba(59, 130, 246, 0.08), transparent 50%);
  pointer-events: none;
}

.aap-hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(99, 102, 241, 0.08) 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.5;
}

.aap-hero-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  max-width: 1600px;
  margin: 0 auto;
}

.aap-hero-left {
  flex: 1;
  min-width: 0;
}

.aap-hero-title {
  font-size: 1.5rem;
  line-height: 1.875rem;
  color: rgb(24, 24, 27);
  margin: 0 0 6px 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}

.aap-hero-subtitle {
  color: rgb(113 113 122);
  font-size: 0.95rem;
  margin: 0 0 12px 0;
  max-width: 480px;
}

.aap-hero-right {
  flex-shrink: 0;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Tabs */
.aap-tabs {
  display: inline-flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
}

.aap-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: none;
  font-size: 0.95rem;
  color: rgb(82 82 91);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-weight: 500;
}

.aap-tab:hover {
  color: rgb(24, 24, 27);
  background: rgba(99, 102, 241, 0.06);
}

.aap-tab--active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.aap-tab--active:hover {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
}

.aap-tab-icon {
  font-size: 1rem;
  line-height: 1;
}

/* Search & stats */
.aap-search-input {
  width: 100%;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.12);
  background: rgba(255, 255, 255, 0.85);
  padding: 4px 12px;
  font-size: 1rem;
  outline: none;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.aap-search-input:hover,
.aap-search-input:focus {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.aap-hero-stats {
  display: flex;
  gap: 12px;
}

.aap-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 10px;
}

.aap-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: rgb(24, 24, 27);
  line-height: 1;
}

.aap-stat-label {
  font-size: 0.85rem;
  color: rgb(113 113 122);
}

/* Body */
.aap-body {
  flex: 1;
  display: flex;
  gap: 20px;
  padding: 16px 32px 20px;
  overflow: hidden;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Sidebar */
.aap-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(99, 102, 241, 0.08);
  border-radius: 14px;
  padding: 16px 12px;
  overflow-y: auto;
  align-self: flex-start;
  max-height: 100%;
}

.aap-sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgb(113 113 122);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(99, 102, 241, 0.08);
  margin-bottom: 8px;
}

.aap-side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 1rem;
  color: rgb(63 63 70);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-weight: 500;
  margin-bottom: 2px;
}

.aap-side-item:hover {
  background: rgba(99, 102, 241, 0.06);
  color: rgb(24, 24, 27);
}

.aap-side-item--active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08));
  color: rgb(79, 70, 229);
  font-weight: 600;
}

.aap-side-item--active .aap-side-item-dot {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.aap-side-item-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(212, 212, 216);
  transition: background 0.2s ease;
}

.aap-side-item-dot--all {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

/* Main */
.aap-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}

.aap-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.aap-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: rgb(24, 24, 27);
  margin: 0;
}

.aap-section-count {
  font-size: 0.9rem;
  color: rgb(113 113 122);
  padding: 4px 10px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 12px;
  font-weight: 500;
}

.aap-featured-section {
  flex-shrink: 0;
}

.aap-featured-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.aap-all-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.aap-card-area {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  margin: -4px;
}

.aap-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* Card（AppWrap） */
.aap-card {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 18px;
  background: #fff;
  border: 1px solid rgb(228 231 237);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.aap-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, rgba(59, 130, 246, 0.04) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.aap-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12), 0 2px 4px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.aap-card:hover::before {
  opacity: 1;
}

.aap-card--featured {
  flex-direction: row;
  padding: 10px 14px;
  gap: 10px;
  align-items: center;
}

.aap-card--featured .aap-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.aap-card--featured .aap-card-img {
  width: 22px;
  height: 22px;
}

.aap-card--featured .aap-card-fallback {
  font-size: 18px;
}

.aap-card--featured .aap-card-body {
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.aap-card--featured .aap-card-head {
  gap: 4px;
}

.aap-card--featured .aap-card-name {
  font-size: 0.9rem;
}

.aap-card--featured .aap-collect-btn {
  width: 20px;
  height: 20px;
  font-size: 0.85rem;
}

.aap-card--featured .aap-category-tag,
.aap-card--featured .aap-card-desc,
.aap-card--featured .aap-card-foot {
  display: none;
}

.aap-card--hot {
  border-color: rgba(251, 146, 60, 0.3);
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 50%);
}

.aap-card-icon {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.aap-card-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.aap-card-fallback {
  font-size: 28px;
  line-height: 1;
}

.aap-hot-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
  letter-spacing: 0.5px;
}

.aap-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aap-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.aap-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: rgb(24, 24, 27);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.aap-collect-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  font-size: 1rem;
  color: rgb(203 213 225);
}

.aap-collect-btn:hover {
  background: rgb(244 244 245);
  transform: scale(1.1);
}

.aap-category-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.85rem;
  font-weight: 500;
  color: #6366f1;
  background: #eef2ff;
  border-radius: 4px;
  padding: 1px 8px;
  line-height: 1.6;
  max-width: fit-content;
}

.aap-card-desc {
  font-size: 0.9rem;
  color: rgb(113 113 122);
  margin: 0;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.aap-card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 4px;
}

.aap-card-stat {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.85rem;
  color: rgb(113 113 122);
}

.aap-card-stat-text {
  font-weight: 500;
  color: rgb(82, 82, 91);
}

/* Skeleton */
.aap-skeleton-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background: #fff;
  border: 1px solid rgb(228 231 237);
  border-radius: 14px;
  height: 124px;
  box-sizing: border-box;
}

.aap-skeleton-icon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(90deg, #f4f4f5 0%, #e4e4e7 50%, #f4f4f5 100%);
  background-size: 200% 100%;
  animation: aap-shimmer 1.5s ease-in-out infinite;
}

.aap-skeleton-body {
  flex: 1;
  min-width: 0;
}

.aap-skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f4f4f5 0%, #e4e4e7 50%, #f4f4f5 100%);
  background-size: 200% 100%;
  margin-bottom: 8px;
  animation: aap-shimmer 1.5s ease-in-out infinite;
}

.aap-skeleton-line--title {
  width: 60%;
  height: 14px;
}

.aap-skeleton-line--text {
  width: 90%;
}

.aap-skeleton-line--short {
  width: 40%;
  margin-bottom: 0;
}

@keyframes aap-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.aap-empty {
  text-align: center;
  padding: 80px 20px;
}

.aap-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.aap-empty-text {
  color: rgb(113 113 122);
  font-size: 0.95rem;
  margin: 0;
}

.aap-loading-more {
  text-align: center;
  padding: 24px 0;
  color: rgb(113 113 122);
  font-size: 0.85rem;
}

/* 对话视图 */
.aap-chat-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.aap-chat-scroll {
  flex: 1;
  overflow-y: auto;
  width: 75%;
  margin: 0 auto;
  padding: 8px 0;
}

.aap-chat-head {
  margin: 4px 0 16px;
}

.aap-stop-row {
  text-align: center;
  padding: 8px 0;
}

.aap-chat-send {
  flex-shrink: 0;
  width: 75%;
  margin: 0 auto 40px;
}

.aap-send-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgb(228 231 237) inset;
  padding: 8px;
}

.aap-send-textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 0.95rem;
  line-height: 1.5;
  font-family: inherit;
  background: transparent;
  box-sizing: border-box;
  padding: 4px;
}

.aap-send-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* 参数表单 */
.aap-form {
  width: 100%;
  max-width: 640px;
}

.aap-form-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.aap-form-label {
  width: 110px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: rgb(82 82 91);
  padding-top: 6px;
  text-align: right;
}

.aap-form-input,
.aap-form-select,
.aap-form-textarea {
  flex: 1;
  border: 1px solid rgb(228 231 237);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  background: #fff;
  min-width: 0;
}

.aap-form-textarea {
  resize: vertical;
}

.aap-form-input:focus,
.aap-form-select:focus,
.aap-form-textarea:focus {
  border-color: rgb(99 102 241);
}

.aap-form-input:disabled,
.aap-form-select:disabled,
.aap-form-textarea:disabled {
  background: rgb(244 244 245);
  color: rgb(113 113 122);
}

.aap-form-user {
  min-width: 420px;
}

/* 响应式 */
@media (max-width: 960px) {
  .aap-hero {
    padding: 20px 20px 16px;
  }

  .aap-hero-content {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .aap-hero-right {
    width: 100%;
  }

  .aap-body {
    padding: 16px 20px;
    flex-direction: column;
    overflow-y: auto;
  }

  .aap-sidebar {
    width: 100%;
    max-height: none;
  }

  .aap-featured-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .aap-chat-scroll,
  .aap-chat-send {
    width: 100%;
  }
}

/* ==================== 照片智能工坊 AiImgFactory ==================== */
.factory-page {
  display: flex;
  height: 100%;
  gap: 16px;
  padding: 12px;
  box-sizing: border-box;
  background: var(--bg-page, #f5f7fa);
}

/* ---- Sidebar ---- */
.factory-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  padding: 16px 12px;
  overflow-y: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.factory-sidebar::-webkit-scrollbar {
  width: 4px;
}

.factory-sidebar::-webkit-scrollbar-thumb {
  background: #e0e0e0;
  border-radius: 4px;
}

.factory-sidebar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgb(39 39 42);
  padding: 4px 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgb(228 231 237);
  margin-bottom: 12px;
}

.factory-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.factory-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgb(228 231 237);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.factory-card:hover {
  border-color: #409eff;
  box-shadow: 0 2px 10px rgba(64, 158, 255, 0.1);
  transform: translateY(-1px);
}

.factory-card.is-active {
  border-color: #409eff;
  background: rgba(64, 158, 255, 0.06);
  box-shadow: 0 2px 10px rgba(64, 158, 255, 0.12);
}

.factory-card-icon {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.factory-card-body {
  flex: 1;
  min-width: 0;
}

.factory-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgb(39 39 42);
  margin-bottom: 2px;
}

.factory-card-desc {
  font-size: 0.8rem;
  color: rgb(113 113 122);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---- Main area ---- */
.factory-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  min-width: 0;
}

.factory-header {
  text-align: center;
  margin-bottom: 16px;
}

.factory-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: rgb(39 39 42);
  margin: 0 0 6px 0;
}

.factory-desc {
  font-size: 0.875rem;
  color: rgb(113 113 122);
  margin: 0;
  line-height: 1.5;
}

.factory-compare {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.factory-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  color: rgb(82 82 91);
  font-size: 0.95rem;
  z-index: 5;
  border-radius: 8px;
}

/* ---- 对比滑块（替代 image-compare-viewer） ---- */
.factory-compare-box {
  position: relative;
  width: 100%;
  max-width: 560px;
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
}

.factory-compare-img {
  display: block;
  width: 100%;
  background-color: #fff;
}

.factory-compare-before {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
}

.factory-compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
  transform: translateX(-1px);
  pointer-events: none;
  z-index: 2;
}

.factory-compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  color: rgb(39 39 42);
  font-size: 1rem;
  cursor: ew-resize;
}

.factory-label {
  position: absolute;
  top: 10px;
  padding: 2px 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.75rem;
  border-radius: 10px;
  pointer-events: none;
  z-index: 2;
}

.factory-label--before {
  left: 10px;
}

.factory-label--after {
  right: 10px;
}

.factory-compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

/* ---- Bottom actions ---- */
.factory-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid rgb(240 240 240);
  margin-top: 12px;
}

.factory-upload-btn {
  height: 40px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px dashed #409eff;
  background: rgba(64, 158, 255, 0.04);
  color: #409eff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.factory-upload-btn:hover:not(:disabled) {
  background: rgba(64, 158, 255, 0.1);
}

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

/* ==================== 按钮变体补充 ==================== */
a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.06);
}

.btn-success-outline {
  background: transparent;
  border: 1px solid #16a34a;
  color: #16a34a;
}

.btn-success-outline:hover:not(:disabled) {
  background: rgba(22, 163, 74, 0.08);
}

.btn-warning {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

.btn-warning:hover:not(:disabled) {
  background: #d97706;
  border-color: #d97706;
}

.btn-warning-outline {
  background: transparent;
  border: 1px solid #f59e0b;
  color: #d97706;
}

.btn-warning-outline:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.08);
}

/* ==================== AI 会话页共享布局（Ppt/写作/AI生图 等） ==================== */
.page-chat-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 32px 8% 28px;
  gap: 20px;
  background: var(--bg);
}

.page-chat-ing {
  overflow: hidden;
  padding: 0;
  gap: 0;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 8%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 欢迎头 */
.ai-welcome-header {
  text-align: center;
  margin-bottom: 4px;
}

.ai-welcome-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.ai-welcome-subtitle {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin: 0;
}

/* 热门主题 */
.ai-topic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.ai-topic-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-topic-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.ai-topic-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.ai-topic-text {
  font-size: 0.9rem;
  color: var(--text);
}

/* 大纲卡片 */
.ai-outline-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
}

.ai-outline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.ai-outline-icon {
  font-size: 1.1rem;
}

.ai-outline-title {
  font-weight: 600;
}

.ai-outline-body {
  display: flex;
  align-items: stretch;
}

.ai-outline-col {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.ai-outline-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.ai-outline-desc {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.5;
}

.ai-outline-formats {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.ai-outline-divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* 输入区 */
.ai-input-area {
  flex-shrink: 0;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.page-chat-ing .ai-input-area {
  padding: 0 8% 24px;
}

.ai-input-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.ai-input-textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.6;
  padding: 6px 8px;
  background: transparent;
  box-sizing: border-box;
}

.ai-input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 0 4px 2px;
  flex-wrap: wrap;
}

.ai-input-spacer {
  flex: 1;
}

/* 会话底部操作区 */
.ai-session-bottom {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 10px 8%;
}

.ai-session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex-wrap: wrap;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.link-btn:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
}

/* 历史记录弹层 */
.history-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  z-index: 30;
}

.history-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

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

.history-item.active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
}

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

.history-item-del {
  border: none;
  background: none;
  color: var(--text-soft);
  font-size: 12px;
  cursor: pointer;
  visibility: hidden;
  flex-shrink: 0;
}

.history-item:hover .history-item-del {
  visibility: visible;
}

.history-item-del:hover {
  color: var(--danger);
}

/* ==================== 会话消息（msg-row/bubble） ==================== */
.msg-row {
  display: flex;
  width: 100%;
}

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

.msg-row.msg-system {
  justify-content: flex-start;
}

.bubble {
  max-width: 86%;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.65;
}

.bubble-user {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-system {
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  flex: 1;
  max-width: none;
  min-width: 0;
  overflow: hidden;
}

.stream-tips {
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 8px;
}

/* MessageBubble 补充（助手消息对齐） */
.msg--assistant {
  justify-content: flex-start;
}

.msg-text {
  overflow-wrap: break-word;
}

/* AgentSteps 步骤图标 */
.step-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 13px;
}

/* ==================== 生图结果 / 欢迎 demo / 图片预览 ==================== */
.ai-img-tip {
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 8px;
}

.ai-img-result img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 10px;
  display: block;
  cursor: zoom-in;
}

.ai-img-tools {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.welcome-html {
  font-size: 14px;
  line-height: 1.7;
}

.welcome-html p {
  margin: 6px 0;
}

.welcome-demo {
  display: inline-block;
  margin-top: 10px;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.welcome-demo:hover {
  opacity: 0.8;
}

.img-viewer-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  cursor: zoom-out;
}

.img-viewer-body {
  max-width: 92%;
  max-height: 92%;
  border-radius: 8px;
}

/* ==================== 智能 PPT（ppt-*） ==================== */

/* 导入大纲后的在线编辑确认面板 */
.ppt-outline-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fafbfc;
}

.ppt-outline-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ppt-outline-edit-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.ppt-outline-edit-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  border: none;
  background: #fff;
  color: var(--text-soft);
  font-size: 0.8rem;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.seg-btn + .seg-btn {
  border-left: 1px solid var(--border);
}

.seg-btn.active {
  background: var(--primary);
  color: #fff;
}

.ppt-outline-edit-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 260px;
  max-height: 52vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
  resize: vertical;
  outline: none;
}

.ppt-outline-edit-textarea:focus {
  border-color: var(--primary);
}

.ppt-outline-edit-hint {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.ppt-outline-edit-actions {
  display: flex;
  justify-content: flex-end;
}

.ppt-slides-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ppt-slides-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.ppt-slides-count {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-soft);
  background: var(--bg);
  border-radius: 10px;
  padding: 2px 10px;
}

.ppt-slides-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ppt-slide-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.ppt-slide-card input,
.ppt-slide-card textarea {
  font-family: inherit;
}

.ppt-slide-cover {
  align-items: center;
  text-align: center;
  padding: 24px 12px;
}

.ppt-slide-cover-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin: 0 auto 10px;
}

.ppt-slide-cover-input {
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}

.ppt-slide-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ppt-slide-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.ppt-slide-title-wrap {
  flex: 1;
  min-width: 0;
}

.ppt-slide-label {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 2px;
}

.ppt-slide-title-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 2px 0;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  background: transparent;
  box-sizing: border-box;
}

.ppt-slide-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ppt-slide-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.ppt-slide-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ppt-slide-row-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.ppt-slide-row-title-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  min-width: 0;
}

.ppt-slide-row-content {
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.5;
  font-family: inherit;
  background: transparent;
  box-sizing: border-box;
  min-height: 36px;
}

/* 模板选择 */
.ppt-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.ppt-tpl-card {
  position: relative;
}

.ppt-tpl-img-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  background: #fff;
}

.ppt-tpl-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ppt-tpl-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.4));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ppt-tpl-card:hover .ppt-tpl-overlay {
  opacity: 1;
}

.ppt-tpl-overlay-top {
  display: flex;
}

.ppt-tpl-name-badge {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  border-radius: 10px;
  padding: 2px 10px;
}

.ppt-tpl-overlay-bottom {
  display: flex;
  justify-content: center;
}

/* 生成进度 */
.ppt-progress {
  padding: 4px 0;
}

.ppt-progress-bar {
  height: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}

.ppt-progress-inner {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  border-radius: 11px;
  transition: width 0.3s ease;
  min-width: 36px;
  box-sizing: border-box;
}

/* ==================== PPT 生成流程：动画步骤条 ==================== */
.ppt-stepper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 24px 14px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(30, 36, 51, 0.04);
}

.ppt-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  z-index: 1;
  flex: 1;
}

.ppt-step-line {
  position: absolute;
  top: 16px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: -1;
  transition: background 0.45s ease;
}

.ppt-step:first-child .ppt-step-line {
  display: none;
}

.ppt-step-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid var(--border);
  color: var(--text-soft);
  transition: all 0.35s ease;
}

.ppt-step-label {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  transition: color 0.3s ease;
}

.ppt-step--done .ppt-step-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  animation: pptStepPop 0.4s ease;
}

.ppt-step--done .ppt-step-line {
  background: var(--primary);
}

.ppt-step--done .ppt-step-label {
  color: var(--primary);
}

.ppt-step--active .ppt-step-dot {
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.08);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  animation: pptStepPop 0.4s ease;
}

.ppt-step--active .ppt-step-label {
  color: var(--text);
  font-weight: 600;
}

.ppt-step--running .ppt-step-dot {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
  animation: pptPulse 1.4s ease-out infinite;
}

.ppt-step--running .ppt-step-label {
  color: var(--primary);
  font-weight: 600;
}

.ppt-step-spin {
  animation: aiSpin 0.8s linear infinite;
}

@keyframes pptStepPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@keyframes pptPulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); }
  70% { box-shadow: 0 0 0 11px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* ==================== PPT 生成中：炫酷渲染卡片 ==================== */
.ppt-gen-card {
  padding: 18px 20px;
}

.ppt-gen-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ppt-gen-orb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(from 0deg, #6366f1, #ec4899, #f59e0b, #6366f1);
  animation: aiSpin 1.2s linear infinite;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.ppt-gen-title {
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(90deg, #6366f1, #ec4899, #f59e0b, #6366f1);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: pptTextFlow 3s linear infinite;
}

.ppt-gen-pct {
  margin-left: auto;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

@keyframes pptTextFlow {
  0% { background-position: 250% 0; }
  100% { background-position: -250% 0; }
}

.ppt-progress-bar--glow {
  position: relative;
  height: 12px;
  border: none;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.12), rgba(236, 72, 153, 0.12));
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.ppt-progress-inner--shine {
  background: linear-gradient(90deg, #6366f1, #ec4899, #f59e0b);
  background-size: 200% 100%;
  animation: pptBarFlow 1.8s linear infinite;
  justify-content: flex-start;
  padding-right: 0;
  border-radius: 6px;
  min-width: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.55);
}

@keyframes pptBarFlow {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ppt-progress-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: pptShineSweep 1.5s ease-in-out infinite;
}

@keyframes pptShineSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.ppt-gen-slides {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.ppt-gen-skel {
  flex: 1;
  height: 64px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  animation: pptSkelFloat 1.6s ease-in-out infinite;
}

.ppt-gen-skel-bar {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.28), rgba(236, 72, 153, 0.28));
  background-size: 200% 100%;
  animation: aiShimmerSlide 1.6s ease-in-out infinite;
}

.ppt-gen-skel-line {
  height: 6px;
  width: 92%;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.36), rgba(148, 163, 184, 0.16));
  background-size: 200% 100%;
  animation: aiShimmerSlide 1.9s ease-in-out infinite;
}

@keyframes pptSkelFloat {
  0%, 100% { transform: translateY(0); opacity: 0.75; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* 生成完成预览 */
.ppt-preview-wrap {
  display: flex;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  max-height: 68vh;
}

.ppt-preview-thumbs {
  width: 140px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ppt-preview-thumbs-label {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ppt-preview-thumbs-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ppt-preview-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  display: block;
  background: #f2f3f7;
}

.ppt-preview-thumb:hover {
  opacity: 0.85;
}

.ppt-preview-thumb.active {
  border-color: var(--primary);
}

.ppt-preview-main {
  /* 关键：给主区一个非零 flex-basis，避免气泡按内容收缩时大图（max-width:100% 依赖父宽）塔陷为 0 */
  flex: 1 1 420px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: #fff;
}

.ppt-preview-img {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 6px;
  background: #f2f3f7;
}

.ppt-preview-tips {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 8px;
}

.ppt-preview-img--clickable {
  cursor: zoom-in;
}

/* ===== PPT Lightbox 放大预览 ===== */
.ppt-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  cursor: zoom-out;
  animation: fadeIn 0.18s ease;
}

.ppt-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.ppt-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.ppt-lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  cursor: default;
}

.ppt-lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 500;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==================== 灵感写作首页（iw-*） ==================== */
.iw-page {
  flex: 1;
  overflow-y: auto;
  padding: 40px 10% 32px;
  background: var(--bg);
}

.iw-welcome-header {
  text-align: center;
  margin-bottom: 28px;
}

.iw-welcome-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.iw-welcome-subtitle {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin: 0;
}

.iw-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
}

.iw-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.iw-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
  transform: translateY(-2px);
}

.iw-card-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff, #e0f2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.iw-card-body {
  flex: 1;
  min-width: 0;
}

.iw-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.iw-card-desc {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ==================== 写作编辑器（uw-*） ==================== */
.uw-layout {
  flex: 1;
  display: flex;
  gap: 16px;
  min-height: 0;
  padding: 16px;
  background: var(--bg);
  box-sizing: border-box;
}

.uw-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-sizing: border-box;
}

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

.uw-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.uw-editor {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  outline: none;
  font-size: 14px;
  line-height: 1.8;
  padding: 8px 4px;
  word-break: break-word;
}

.uw-editor:empty::before {
  content: attr(data-placeholder);
  color: #9ca3af;
}

.uw-ai-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.uw-ai-edit-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.uw-aside {
  width: 300px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  overflow-y: auto;
  box-sizing: border-box;
}

.uw-aside-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.uw-loading {
  font-size: 13px;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.uw-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.uw-record {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.uw-record-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafbfc;
  cursor: pointer;
  transition: all 0.15s ease;
}

.uw-record-item:hover {
  border-color: var(--primary);
}

.uw-record-q {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uw-record-a {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== 表单（form-*） ==================== */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin: 6px 0 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}

.form-textarea {
  resize: vertical;
}

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

/* ==================== 弹窗（modal-*） ==================== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  width: 480px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* ==================== 思维导图画布（simple-mind-map，移植旧版 Mind.vue） ==================== */
.mind-map-canvas {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
  overflow: hidden;
}

.mind-map-canvas-body {
  position: relative;
  height: 600px;
}

.mind-map-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  cursor: move;
}

.mind-map-loading {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  z-index: 10;
  pointer-events: none;
}

.mind-map-loading-text {
  font-size: 14px;
  color: #6b7280;
}

.mind-map-tools {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.mind-map-hints {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: #8a919f;
  flex-shrink: 0;
}

.mind-map-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.mind-map-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mind-map-label {
  font-size: 12px;
  color: #6b7280;
}

.mind-map-theme {
  width: auto;
  min-width: 120px;
}

/* ==================== AI生图（imgpro-*） ==================== */
.imgpro-page {
  flex: 1;
  display: flex;
  min-height: 0;
  background: var(--bg);
}

.imgpro-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 14px;
  box-sizing: border-box;
}

.imgpro-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 6px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.imgpro-header-icon {
  font-size: 1.2rem;
}

.imgpro-header-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.imgpro-section {
  margin-bottom: 18px;
}

.imgpro-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.imgpro-lens-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.imgpro-lens-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 9px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}

.imgpro-lens-chip:hover {
  border-color: var(--primary);
}

.imgpro-lens-chip.is-active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
  box-shadow: 0 0 0 1px var(--primary) inset;
}

.imgpro-lens-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.imgpro-lens-text {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.imgpro-style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.imgpro-style-thumb {
  position: relative;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}

.imgpro-style-thumb:hover {
  border-color: #bfdbfe;
}

.imgpro-style-thumb.is-active {
  border-color: var(--primary);
}

.imgpro-style-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.imgpro-style-label {
  display: block;
  font-size: 11px;
  color: var(--text);
  text-align: center;
  padding: 4px 2px 5px;
  background: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.imgpro-style-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ==================== AI高精翻译（tra-*） ==================== */
.tra-page {
  flex: 1;
  overflow-y: auto;
  padding: 32px 8% 32px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tra-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.tra-header-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.tra-header-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.tra-header-subtitle {
  font-size: 0.875rem;
  color: var(--text-soft);
  margin: 0;
}

.tra-body {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tra-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.tra-toolbar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}

.tra-swap-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.tra-swap-btn:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.06);
  border-color: var(--primary);
}

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

.tra-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.tra-panel {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 380px;
}

.tra-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tra-panel-count {
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 8px;
}

.tra-loading {
  color: var(--primary);
  font-weight: 500;
}

.tra-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  font-family: inherit;
  background: transparent;
  box-sizing: border-box;
}

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

.tra-panel-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tra-panel-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

/* 语言下拉 */
.tra-lang-select {
  position: relative;
  display: inline-block;
}

.tra-lang-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.tra-lang-input:hover {
  border-color: var(--primary);
}

.tra-lang-input .arrow {
  font-size: 10px;
  color: var(--text-soft);
}

.tra-lang-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 40;
}

.tra-lang-option {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.tra-lang-option:hover {
  background: var(--bg);
}

.tra-lang-option.active {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  font-weight: 600;
}

/* ==================== 格式专家（ft-*） ==================== */
.ft-page {
  flex: 1;
  overflow-y: auto;
  padding: 32px 8% 32px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ft-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.ft-header-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e0f2fe, #dbeafe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.ft-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.ft-subtitle {
  font-size: 0.875rem;
  color: var(--text-soft);
  margin: 0;
}

.ft-main {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.ft-tools {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ft-category {
  display: flex;
  flex-direction: column;
}

.ft-category-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.ft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.ft-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ft-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.ft-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.ft-card-icon-sm {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.ft-card-body {
  flex: 1;
  min-width: 0;
}

.ft-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.ft-card-desc {
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ft-card-arrow {
  flex-shrink: 0;
  color: #cbd5e1;
  font-size: 1.3rem;
  font-weight: 300;
}

.ft-card:hover .ft-card-arrow {
  color: var(--primary);
}

/* 转换面板 */
.ft-convert {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ft-convert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.ft-convert-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ft-convert-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.ft-convert-tag {
  font-size: 0.75rem;
  color: var(--text-soft);
  background: var(--bg);
  border-radius: 10px;
  padding: 2px 10px;
  white-space: nowrap;
}

.ft-convert-body {
  min-height: 260px;
}

.ft-result {
  height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.ft-result-icon {
  font-size: 3rem;
}

.ft-result-text {
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
}

.ft-result-actions {
  display: flex;
  gap: 10px;
}

.ft-upload {
  height: 260px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ft-upload:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.02);
}

.ft-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ft-upload-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.ft-upload-text {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.ft-upload-text em {
  font-style: normal;
  color: var(--primary);
}

.ft-upload-sub {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.ft-upload-error {
  font-size: 0.8rem;
  color: var(--danger);
  background: rgba(220, 38, 38, 0.06);
  border-radius: 8px;
  padding: 6px 12px;
  margin-top: 6px;
}

.ft-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.ft-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ft-spin 0.8s linear infinite;
}

@keyframes ft-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 操作步骤 */
.ft-steps {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.ft-steps-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.ft-steps-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ft-step-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.ft-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.ft-step-text {
  font-size: 0.78rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.ft-step-connector {
  flex-shrink: 0;
  color: #cbd5e1;
  font-size: 1.2rem;
  padding-top: 4px;
}

/* ==================== 文档校对（pr-*） ==================== */
.pr-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.pr-header {
  flex-shrink: 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.pr-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 6%;
}

/* 上传区 */
.pr-upload-zone {
  max-width: 640px;
  margin: 40px auto;
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: #fff;
  transition: all 0.2s ease;
}

.pr-upload-zone:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.02);
}

.pr-upload-icon {
  font-size: 3rem;
}

.pr-upload-text {
  font-size: 1rem;
  color: var(--text);
}

.pr-upload-sub {
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* 编辑器布局 */
.pr-editor-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pr-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.pr-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pr-file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.pr-char-tag {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-soft);
  background: var(--bg);
  border-radius: 10px;
  padding: 2px 10px;
}

.pr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pr-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pr-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

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

.pr-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pr-btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  color: #fff;
}

.pr-btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.pr-btn-danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.06);
  color: var(--danger);
}

.pr-btn-success {
  background: transparent;
  border-color: #16a34a;
  color: #16a34a;
}

.pr-btn-success:hover:not(:disabled) {
  background: rgba(22, 163, 74, 0.06);
  color: #16a34a;
}

/* 双栏 */
.pr-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.pr-col {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  overflow: hidden;
}

.pr-col-title {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.pr-col-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-soft);
}

/* 编辑工具栏 */
.pr-edit-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  flex-wrap: wrap;
}

.pr-tb-btn {
  min-width: 28px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  padding: 0 6px;
}

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

.pr-tb-btn.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.pr-tb-select {
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: var(--text);
  outline: none;
  padding: 0 4px;
}

.pr-tb-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

.pr-editor {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  outline: none;
  padding: 14px;
  font-size: 14px;
  line-height: 1.8;
  word-break: break-word;
}

.pr-editor:empty::before {
  content: '可直接编辑原文...';
  color: #9ca3af;
}

.proofread-error {
  background: rgba(220, 38, 38, 0.08);
  border-bottom: 2px dotted var(--danger);
}

/* 校对结果 */
.pr-result {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  font-size: 14px;
  line-height: 1.8;
}

.pr-result-placeholder {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 14px;
}

/* 右键 AI 菜单 */
.pr-ctx-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
}

.pr-ctx-menu {
  position: fixed;
  z-index: 91;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  padding: 6px;
}

.pr-ctx-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  padding: 6px 10px 4px;
}

.pr-ctx-item {
  font-size: 13px;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.pr-ctx-item:hover {
  background: rgba(37, 99, 235, 0.06);
  color: var(--primary);
}

/* AI 处理面板 */
.pr-ai-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  padding: 16px;
  z-index: 95;
}

.pr-ai-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

.pr-ai-panel-content {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==================== AI 问答页（ChatView 两段式布局，复刻旧版 Ai.vue） ==================== */

/* --- 页面根 --- */
.ai-chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* --- 欢迎态 --- */
.ai-welcome-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 32px 24px 24px;
}

.ai-welcome-wrap .ai-welcome-header {
  margin: 28px 0 24px;
}

.ai-welcome-wrap .ai-welcome-title {
  font-size: 1.875rem;
  font-weight: 600;
  color: rgb(39 39 42);
}

.ai-hot-topics {
  max-width: 900px;
  width: 100%;
  margin: 0 auto 24px;
}

/* 话题卡 3 列（覆盖共享 .ai-topic-grid 的 2 列） */
.ai-welcome-wrap .ai-topic-grid {
  grid-template-columns: repeat(3, 1fr);
  max-width: 900px;
}

.ai-welcome-wrap .ai-topic-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ai-welcome-wrap .ai-input-area {
  max-width: 900px;
}

.ai-welcome-wrap .ai-input-card {
  padding: 14px 18px;
}

.ai-input-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
}

/* --- 输入卡（欢迎态/会话态共用） --- */
.ai-input-card,
.ai-session-input-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ai-session-input-card {
  padding: 12px 16px;
  margin-top: 8px;
}

/* 拖拽文件悬停高亮 */
.ai-card-dragging {
  outline: 2px dashed var(--primary);
  outline-offset: -4px;
  background: #f0f7ff;
}

.ai-chat-textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  padding: 4px 2px;
  min-height: 92px;
  max-height: 228px;
  background: transparent;
  box-sizing: border-box;
}

.ai-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  flex-wrap: wrap;
}

.ai-input-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.ai-input-count {
  font-size: 12px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.ai-model-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 7px 8px;
  min-width: 150px;
  outline: none;
  cursor: pointer;
}

.ai-model-select:focus {
  border-color: var(--primary);
}

/* --- 上传文件 chip --- */
.ai-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-bottom: 10px;
  background: #f0f7ff;
  border: 1px solid #d6e8ff;
  border-radius: 8px;
  font-size: 13px;
  color: #4a5568;
  max-width: 100%;
  align-self: flex-start;
}

.ai-file-chip.is-error {
  background: #fef0f0;
  border-color: #fde2e2;
}

.ai-file-chip-icon {
  flex-shrink: 0;
}

.ai-file-chip-name {
  font-weight: 500;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-file-chip-size {
  color: #909399;
  font-size: 12px;
  flex-shrink: 0;
}

.ai-file-chip-close {
  border: none;
  background: none;
  cursor: pointer;
  color: #909399;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.ai-file-chip-close:hover {
  color: var(--danger);
}

/* --- 图片编辑模式提示条（粘滞编辑态） --- */
.ai-edit-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.1), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  font-size: 13px;
  color: #7c3aed;
}

.ai-edit-banner-exit {
  margin-left: auto;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: #7c3aed;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s;
}

.ai-edit-banner-exit:hover {
  background: rgba(139, 92, 246, 0.12);
}

/* --- 智能体追问确认提示横幅 --- */
.ai-await-banner {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: rgba(230, 162, 60, 0.1);
  border: 1px solid rgba(230, 162, 60, 0.35);
  color: #b8860b;
  font-size: 13px;
}

/* --- 会话底部固定输出文件区 --- */
.ai-session-output-files {
  margin: 2px 0 6px;
}

/* --- 图片编辑结果网格 --- */
.msg-edit-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0;
}

.msg-edit-image-item {
  position: relative;
  width: 180px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.msg-edit-image-item img {
  width: 100%;
  height: auto; /* 保持宽高比，显示图片全貌（不用 cover 裁剪） */
  display: block;
  background: var(--bg-soft, rgba(0, 0, 0, 0.03));
  transition: transform 0.25s ease;
}

.msg-edit-image-item:hover img {
  transform: scale(1.02);
}

.msg-edit-image-dl {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.msg-edit-image-item:hover .msg-edit-image-dl {
  opacity: 1;
}

.msg-edit-image-dl:hover {
  background: rgba(0, 0, 0, 0.65);
}

/* --- 图片放大预览（全屏遮罩 lightbox） --- */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  animation: lightbox-in 0.15s ease;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.img-lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.img-lightbox-actions {
  position: absolute;
  top: 18px;
  right: 22px;
  display: flex;
  gap: 10px;
}

.img-lightbox-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.img-lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* 图片编辑 shimmer 的文字提示 */
.ai-shimmer-text {
  color: var(--text-soft);
  font-size: 13px;
}

/* --- markdown 中的 csv 代码块表格 --- */
.md-body table.csv-table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 13px;
}

.md-body table.csv-table th,
.md-body table.csv-table td {
  border: 1px solid var(--border);
  padding: 5px 10px;
  text-align: left;
  white-space: nowrap;
}

.md-body table.csv-table th {
  background: rgba(64, 158, 255, 0.06);
  font-weight: 600;
}

.md-body table.csv-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.015);
}

/* --- 会话态 --- */
.ai-session-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 84%;
  max-width: 1200px;
  margin: 0 auto;
}

.ai-session-wrap .chat-list {
  padding: 20px 0;
  flex: 1;
}

.ai-chat-view .ai-session-bottom {
  background: transparent;
  padding: 8px 0 12px;
}

.ai-chat-view .ai-session-actions {
  padding: 4px 0 8px;
}

.ai-session-input-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  flex-wrap: wrap;
}

/* 历史记录弹层头部 */
.history-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.history-close {
  border: none;
  background: none;
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

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

.history-item-del--confirm {
  color: var(--danger);
  font-weight: 600;
  visibility: visible;
}

/* 滚动到底部悬浮按钮（紫色渐变胶囊） */
.ai-scroll-to-bottom {
  position: absolute;
  right: 8px;
  bottom: 150px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  z-index: 10;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-scroll-to-bottom:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(102, 126, 234, 0.55);
}

.ai-scroll-loading {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: aiSpin 0.8s linear infinite;
}

@keyframes aiSpin {
  to {
    transform: rotate(360deg);
  }
}

/* --- 生成中：三点跳动 + shimmer 线条 --- */
.ai-thinking-shimmer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

.ai-thinking-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b0b8e8;
  animation: aiDotBounce 1.4s ease-in-out infinite;
}

.ai-dot-1 { animation-delay: 0s; }
.ai-dot-2 { animation-delay: 0.2s; }
.ai-dot-3 { animation-delay: 0.4s; }

@keyframes aiDotBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.ai-shimmer-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-shimmer-line {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    rgba(176, 184, 232, 0.1) 25%,
    rgba(176, 184, 232, 0.2) 50%,
    rgba(176, 184, 232, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: aiShimmerSlide 2s ease-in-out infinite;
}

@keyframes aiShimmerSlide {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- 生成中长时间无新内容的等待提示 --- */
.ai-stall-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(64, 158, 255, 0.07);
  width: fit-content;
  animation: aiStallFadeIn 0.4s ease;
}

.ai-stall-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.ai-stall-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #409eff;
  animation: aiStallBounce 1.2s infinite ease-in-out;
}

.ai-stall-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-stall-dots span:nth-child(3) { animation-delay: 0.3s; }

.ai-stall-text {
  font-size: 13px;
  color: #606266;
}

.ai-stall-time {
  font-size: 12px;
  color: #909399;
  font-variant-numeric: tabular-nums;
}

@keyframes aiStallBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

@keyframes aiStallFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- 助手消息工具栏（复制/保存为Excel/保存为Word） --- */
.msg-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.msg-toolbar-btn {
  border: none;
  background: none;
  color: var(--text-soft);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}

.msg-toolbar-btn:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
}

.msg-toolbar-btn--success:hover {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

/* --- 轻量 toast --- */
.app-toast {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translate(-50%, -8px);
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  z-index: 300;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast--show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-toast--success { color: #16a34a; }
.app-toast--error { color: var(--danger); }
.app-toast--warning { color: #d97706; }

/* lucide 加载图标旋转（文档校对 AI 处理中） */
.pr-ai-spin {
  animation: pr-ai-spin 1s linear infinite;
}
@keyframes pr-ai-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==================== SWOT 分析专用视图 ==================== */
.swot-page .spin {
  animation: swot-spin 1s linear infinite;
}
@keyframes swot-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.swot-time {
  align-self: flex-end;
  font-size: 12px;
  color: var(--text-3, #94a3b8);
  margin-bottom: 2px;
}

.swot-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.swot-head-icon { color: #46a0e3; }
.swot-head-title { font-size: 16px; font-weight: 700; color: #475569; }

.swot-analyzing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 0;
  color: #64748b;
}

.swot-subject {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: rgba(70, 160, 227, 0.08);
  border-left: 3px solid #46a0e3;
  border-radius: 6px;
}
.swot-subject-label { font-size: 12px; color: #64748b; flex-shrink: 0; }
.swot-subject-text { font-size: 14px; font-weight: 600; color: #334155; }

/* SWOT 战略矩阵：首行/首列为坐标轴标签，中心叠加 SWOT 枢纽 */
.swot-matrix {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr 1fr;
  grid-template-rows: 24px auto auto;
  gap: 10px;
  margin-bottom: 16px;
}
.swot-axis-corner { grid-column: 1; grid-row: 1; }
.swot-axis-top {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #94a3b8;
}
.swot-axis-helpful { grid-column: 2; color: #16a34a; }
.swot-axis-harmful { grid-column: 3; color: #dc2626; }
.swot-axis-side {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  writing-mode: vertical-rl;
  letter-spacing: 2px;
  color: #94a3b8;
}
.swot-axis-internal { grid-column: 1; grid-row: 2; }
.swot-axis-external { grid-column: 1; grid-row: 3; }

.swot-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, #46a0e3, #2563eb);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  border: 3px solid #fff;
  z-index: 2;
  pointer-events: none;
}

.swot-quadrant {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.swot-quadrant:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}
.swot-q-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  color: #fff;
}
.swot-q-letter {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
}
.swot-q-icon { flex-shrink: 0; }
.swot-q-name { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.swot-q-count {
  font-size: 12px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.3);
}
.swot-q-body {
  flex: 1;
  background: #fff;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
  min-height: 96px;
  max-height: 240px;
  overflow: auto;
}
.swot-q-body ul { margin: 0; padding-left: 0; list-style: none; }
.swot-q-body li {
  position: relative;
  margin: 0 0 7px;
  padding-left: 14px;
  animation: swotItemIn 0.32s ease both;
}
.swot-q-body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}
@keyframes swotItemIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.swot-q-empty { color: #cbd5e1; text-align: center; padding: 18px 0; }
.swot-q-skeleton { display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }
.swot-q-skeleton span {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 37%, #eef2f7 63%);
  background-size: 400% 100%;
  animation: swotShimmer 1.3s ease infinite;
}
.swot-q-skeleton span:nth-child(2) { width: 85%; }
.swot-q-skeleton span:nth-child(3) { width: 65%; }
@keyframes swotShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.swot-q-strengths .swot-q-title { background: linear-gradient(90deg, #22c55e, #10b981); }
.swot-q-weaknesses .swot-q-title { background: linear-gradient(90deg, #ef4444, #f43f5e); }
.swot-q-opportunities .swot-q-title { background: linear-gradient(90deg, #3b82f6, #0ea5e9); }
.swot-q-threats .swot-q-title { background: linear-gradient(90deg, #f59e0b, #f97316); }

.swot-full { margin-top: 4px; }
.swot-full-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 7px 4px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.swot-full-toggle:hover { color: #2563eb; }
.swot-chevron { transition: transform 0.2s ease; transform: rotate(-90deg); }
.swot-chevron.open { transform: rotate(0deg); }
.swot-full-hint { margin-left: auto; font-size: 12px; font-weight: 400; color: #94a3b8; }
.swot-full-body {
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px 16px;
  max-height: 320px;
  overflow: auto;
  margin-top: 4px;
}
pre code.hljs {
  display: block;
  overflow-x: auto;
  padding: 1em
}
code.hljs {
  padding: 3px 5px
}
/*!
  Theme: GitHub
  Description: Light theme as seen on github.com
  Author: github.com
  Maintainer: @Hirse
  Updated: 2021-05-15

  Outdated base version: https://github.com/primer/github-syntax-light
  Current colors taken from GitHub's CSS
*/
.hljs {
  color: #24292e;
  background: #ffffff
}
.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
  /* prettylights-syntax-keyword */
  color: #d73a49
}
.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
  /* prettylights-syntax-entity */
  color: #6f42c1
}
.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-variable,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id {
  /* prettylights-syntax-constant */
  color: #005cc5
}
.hljs-regexp,
.hljs-string,
.hljs-meta .hljs-string {
  /* prettylights-syntax-string */
  color: #032f62
}
.hljs-built_in,
.hljs-symbol {
  /* prettylights-syntax-variable */
  color: #e36209
}
.hljs-comment,
.hljs-code,
.hljs-formula {
  /* prettylights-syntax-comment */
  color: #6a737d
}
.hljs-name,
.hljs-quote,
.hljs-selector-tag,
.hljs-selector-pseudo {
  /* prettylights-syntax-entity-tag */
  color: #22863a
}
.hljs-subst {
  /* prettylights-syntax-storage-modifier-import */
  color: #24292e
}
.hljs-section {
  /* prettylights-syntax-markup-heading */
  color: #005cc5;
  font-weight: bold
}
.hljs-bullet {
  /* prettylights-syntax-markup-list */
  color: #735c0f
}
.hljs-emphasis {
  /* prettylights-syntax-markup-italic */
  color: #24292e;
  font-style: italic
}
.hljs-strong {
  /* prettylights-syntax-markup-bold */
  color: #24292e;
  font-weight: bold
}
.hljs-addition {
  /* prettylights-syntax-markup-inserted */
  color: #22863a;
  background-color: #f0fff4
}
.hljs-deletion {
  /* prettylights-syntax-markup-deleted */
  color: #b31d28;
  background-color: #ffeef0
}
.hljs-char.escape_,
.hljs-link,
.hljs-params,
.hljs-property,
.hljs-punctuation,
.hljs-tag {
  /* purposely ignored */
  
}