/* ══════════════════════════════════════════════════════════════
   讲师分身平台 — Dub.co 风格
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700&display=swap');

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

:root {
  --sidebar-bg: #f7f8f9;
  --sidebar-width: 220px;
  --sidebar-dark: #384359;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --text: #0d0d0d;
  --text-secondary: #5f6b7a;
  --text-muted: #9aa3af;
  --border: #e8eaed;
  --border-light: #f0f1f3;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-bg: #eef2ff;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 10px;
  --radius-sm: 6px;
}

/* ══════════════════════════════════════════════════════════════
   Grid 四区等比缩放布局
   ══════════════════════════════════════════════════════════════ */
html { font-size: clamp(12px, 0.75vw, 16px); }

.app-container {
  display: grid;
  width: 100vw;
  height: 100vh;
  padding: clamp(2px, 0.2%, 8px);
  gap: clamp(2px, 0.2%, 8px);
  background: var(--sidebar-dark);
  grid-template-columns: clamp(140px, 10%, 220px) 1fr;
  grid-template-rows: 1fr;
  overflow: hidden;
}

/* A1 — 菜单栏 */
.app-a1 {
  background: transparent;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

/* A2 — 工作空间 */
.app-a2 {
  background: transparent;
  border-radius: 0;
  overflow: hidden;
  display: none;
  flex-direction: column;
  gap: 0;
}
.app-a2-inner {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  margin-top: clamp(12px, 2%, 24px);
  margin-bottom: clamp(12px, 2%, 24px);
}
.app-a2-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.app-a2-scroll::-webkit-scrollbar { display: none; }
.workspace-search {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin: 6px 8px 4px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}
.workspace-search svg { color: rgba(255,255,255,0.3); flex-shrink: 0; }
.workspace-search input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 12px; color: rgba(255,255,255,0.7); font-family: inherit;
}
.workspace-search input::placeholder { color: rgba(255,255,255,0.25); }
.workspace-history-list, .workspace-sub-list {
  display: flex; flex-direction: column; gap: 6px;
  padding: 4px 8px;
}
/* 工作空间卡片 — 参照账户卡片风格，适配暗底 */
.ws-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  cursor: pointer; transition: background .15s;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(255,255,255,0.06);
}
.ws-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
}
.ws-card.active {
  background: rgba(34, 197, 94, 0.8);
  backdrop-filter: blur(8px);
  border-color: rgba(34, 197, 94, 0.6);
}
.ws-card.active .ws-card-name { color: rgba(255,255,255,0.95); }
.ws-card.active .ws-card-desc { color: rgba(255,255,255,0.5); }
.ws-card.active .ws-card-watermark { color: #fff; background: rgba(255,255,255,0.15); }
.ws-card-pa .ws-card-avatar { background: linear-gradient(135deg, #2563eb, #6366f1); color: #fff; }
.ws-card-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(37,99,235,0.5), rgba(99,102,241,0.5));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.ws-card-body { flex: 1; min-width: 0; }
.ws-card-name {
  font-size: 13px; color: rgba(255,255,255,0.9); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-card-desc {
  font-size: 11px; color: rgba(255,255,255,0.35);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px;
}
.ws-card-badge { font-size: 10px; opacity: 0.5; margin-left: 4px; }
/* A2 卡片任务计数角标 */
.ws-card-badge-count {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  margin-left: auto;
  flex-shrink: 0;
}
.ws-card-badge-count.hidden { display: none; }
/* 分身卡片水印标签 */
.ws-card-watermark {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 9px;
  line-height: 1.4;
  color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  pointer-events: none;
}
.workspace-empty {
  padding: 24px 12px; text-align: center;
  color: rgba(255,255,255,0.25); font-size: 11px;
}

/* A3 — 主内容区 */
.app-a3 {
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* A4 — 侧边栏 */
.app-a4 {
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  display: none;  /* 默认隐藏 */
}

/* ── 布局变体（通过 .app-container 上的 class 切换）── */
/* A1+A2+A3 */
.app-container.has-a2 { grid-template-columns: clamp(44px, 3.15%, 65px) clamp(140px, 10%, 220px) 1fr; }
.app-container.has-a2 .app-a2 { display: flex; flex-direction: column; }

/* A1+A3+A4 (A3:A4=2:1) */
.app-container.has-a4 { grid-template-columns: clamp(140px, 10%, 220px) 2fr 1fr; }
.app-container.has-a4 .app-a4 { display: flex; flex-direction: column; }

/* A1+A2+A3+A4 */
.app-container.has-a2.has-a4 { grid-template-columns: clamp(44px, 3.15%, 65px) clamp(140px, 10%, 220px) 2fr 1fr; }

/* A1+A3+A4+A4 */
.app-container.has-a4.has-a4-double { grid-template-columns: clamp(140px, 10%, 220px) 1fr 1fr 1fr; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── 底纸（深色） + 浮在上面的圆角矩形 ──────────── */

/* 底纸左侧导航（由 Grid A1 控制尺寸） */
.base-nav {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.base-nav .nav-logo {
  padding: 20px 16px 16px 26px;
}
/* 默认：完整模式（其他 tab 用），显示文字，隐藏图标 */
.base-nav .nav-logo { padding: 20px 16px 16px 26px; }
.base-nav .nav-logo h1 { font-size: 25px; color: #fff; font-weight: 700; letter-spacing: -0.3px; }
.base-nav .nav-logo p { font-size: 11px; color: rgba(255,255,255,0.45); font-weight: 400; margin-top: 1px; }
.base-nav .nav-logo .nav-logo-icon { display: none; }

/* 图标模式：A2 打开时整体下移，隐藏文字，居中显示 SVG Logo */
.app-container.has-a2 .base-nav { padding-top: 8px; }
.app-container.has-a2 .base-nav .nav-logo { padding: 8px; display: flex; justify-content: center; }
.app-container.has-a2 .base-nav .nav-logo h1 { display: none; }
.app-container.has-a2 .base-nav .nav-logo p { display: none; }
.app-container.has-a2 .base-nav .nav-logo .nav-logo-icon { display: block; width: 28px; height: 28px; }
.base-nav .nav-items {
  flex: 1;
  padding: 4px 8px;
}
.base-nav .nav-sep {
  height: 1px;
  margin: 6px 40%;
  background: rgba(255,255,255,0.1);
}
.base-nav .nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  font-size: 14px;
  font-weight: 450;
  transition: all .1s;
  margin-bottom: 1px;
  text-decoration: none;
  user-select: none;
}
/* A2 打开时：图标模式，参照 assistant-icon-item 样式 */
.app-container.has-a2 .base-nav .nav-items { padding: 4px; gap: 4px; display: flex; flex-direction: column; align-items: center; }
.app-container.has-a2 .base-nav .nav-item {
  justify-content: center;
  padding: 0;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: rgba(255,255,255,0.55);
  font-size: 18px;
  transition: color .15s, background .15s;
}
.app-container.has-a2 .base-nav .nav-item:hover,
.app-container.has-a2 .base-nav .nav-item.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.app-container.has-a2 .base-nav .nav-item span:nth-child(2) { display: none; }
.app-container.has-a2 .base-nav .nav-item .nav-icon { font-size: 20px; line-height: 1; }
.app-container.has-a2 .base-nav .nav-item .nav-icon svg { width: 20px; height: 20px; }
/* 提示浮层：参照助理 icon-tip */
.base-nav .nav-item .nav-item-tip {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--card-bg);
  color: var(--text);
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 9999;
}
.app-container.has-a2 .base-nav .nav-item:hover .nav-item-tip { opacity: 1; }
/* A1 导航角标 — 红底白字，两种模式适配 */
.nav-item-badge {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}
.nav-item-badge.hidden { display: none; }
/* A2 打开（图标模式）时角标位置微调，与 assistant-icon-badge 对齐 */
.app-container.has-a2 .nav-item-badge {
  top: -4px;
  right: -4px;
}
.base-nav .nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.base-nav .nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-weight: 500;
}
.base-nav .nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}
.base-nav .nav-item .nav-icon svg {
  flex-shrink: 0;
}
.base-nav .nav-item.active .nav-icon {
  opacity: 1;
}
.base-nav .nav-user {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* A2 图标模式：用户信息隐藏，头像居中 */
.app-container.has-a2 .base-nav .nav-user { justify-content: center; }
.app-container.has-a2 .base-nav .nav-user .u-info { display: none; }

.base-nav .nav-user .u-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.base-nav .nav-user .u-info {
  flex: 1;
  min-width: 0;
}
.base-nav .nav-user .u-name {
  font-size: 13px;
  color: #fff;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.base-nav .nav-user .u-role {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.base-nav .nav-user .logout-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all .1s;
  line-height: 1;
}
.base-nav .nav-user .logout-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ── 订阅抽屉（侧边栏内）──────────── */
.nav-subscription-drawer {
  margin: 0 0 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  overflow: hidden;
  max-height: 240px;
  display: flex;
  flex-direction: column;
}
.nav-subscription-drawer.hidden { display: none; }

.nav-subscription-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: none;
}
.nav-subscription-list::-webkit-scrollbar { display: none; }

.nav-subscription-empty {
  text-align: center;
  padding: 16px 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

.nav-subscription-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  transition: all .12s;
}
.nav-subscription-item:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
}
.nav-subscription-item.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-subscription-item-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
  color: rgba(255,255,255,0.7);
}
.nav-subscription-item.active .nav-subscription-item-icon {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

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

.nav-subscription-item-check {
  color: #93c5fd;
  font-size: 12px;
  flex-shrink: 0;
}

.nav-sub-badge {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #ef4444;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-sub-badge.hidden { display: none; }

/* ── 上面的纸（圆角矩形卡片）──────────── */
.content-card {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-topbar {
  flex-shrink: 0;
  padding: 0 16px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-topbar .page-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tab-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── 表格列等宽 ────────────────────────────────────────── */

.content-card table {
  table-layout: fixed;
}
.content-card table th,
.content-card table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.content-card table .col-hidden { display: none; }

/* ── 卡片 ────────────────────────────────────────────────── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
}
.card-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ── 统计卡片 ──────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 4px;
}

/* ── 标签切换 ──────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 2px;
  padding: 2px 20px 0;
}
.tab-item {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .1s;
  user-select: none;
  border-radius: var(--radius-sm);
}
.tab-item:hover {
  color: var(--text);
  background: var(--border-light);
}
.tab-item.active {
  color: var(--text);
  background: var(--border);
}

/* ── 搜索框 ────────────────────────────────────────────── */

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 25px;
  box-sizing: border-box;
  min-width: 220px;
  transition: all .15s;
  background: var(--card-bg);
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}
.search-box .search-icon {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.6;
  line-height: 1;
}
.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  flex: 1;
  color: var(--text);
  padding: 0;
  line-height: 25px;
  width: 100%;
  font-family: inherit;
}
.search-box input::placeholder {
  color: var(--text-muted);
}

/* ── 表格 ────────────────────────────────────────────────── */

.table-wrapper {
  overflow-x: auto;
  overflow-y: clip;
  scrollbar-width: none;
}
.table-wrapper::-webkit-scrollbar { display: none; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table th {
  text-align: left;
  padding: 8px 20px;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table td {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
  font-size: 13px;
}
table tbody tr:hover td {
  background: var(--bg);
}
table tbody tr:last-child td {
  border-bottom: none;
}
table .cell-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── 标签/Tag ──────────────────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  border-radius: 12px;
  margin: 1px 3px 1px 0;
}
.tag-skill {
  background: transparent;
  color: inherit;
}
.tag-knowledge {
  background: transparent;
  color: inherit;
}
.tag-official {
  background: transparent;
  color: inherit;
}
.tag-private {
  background: transparent;
  color: inherit;
}
.tag-third_party {
  background: transparent;
  color: inherit;
}
.tag-free {
  background: var(--success-bg);
  color: var(--success);
}
.tag-paid {
  background: var(--warning-bg);
  color: var(--warning);
}
.tag-draft {
  background: var(--border-light);
  color: var(--text-muted);
}
.tag-published {
  background: var(--success-bg);
  color: var(--success);
}

/* ── 表单 ────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  font-size: 13px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all .15s;
  background: var(--card-bg);
  color: var(--text);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}
.form-group textarea {
  min-height: 80px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.6;
}

/* ── 添加资源按钮 ──────────────────────────────────────────── */

.btn-resource {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 14px;
  height: 25px;
  box-sizing: border-box;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .1s;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.btn-resource:hover {
  background: var(--primary-hover);
}

/* ── 资源下拉菜单 ──────────────────────────────────────────── */

.resource-dropdown {
  position: relative;
  display: inline-flex;
}
.resource-dropdown::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 8px;
  z-index: 51;
}
.resource-dropdown .resource-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  padding: 4px;
  z-index: 50;
}
.resource-dropdown:hover .resource-dropdown-menu,
.resource-dropdown.open .resource-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.resource-dropdown-menu button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s;
  white-space: nowrap;
  width: 100%;
}
.resource-dropdown-menu button:hover {
  background: var(--border-light);
}

/* ── 按钮 ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all .1s;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #047857;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: var(--bg);
  color: var(--text);
  border-color: #d0d3d8;
}
.btn-gray {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #94a3b8;
  cursor: default;
}
.btn-gray:hover {
  background: #f1f5f9;
  color: #94a3b8;
}
.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px 8px;
}
.btn-ghost:hover {
  background: var(--border-light);
  color: var(--text);
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-xs {
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 4px;
}
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── 分页 ──────────────────────────────────────────────── */

.pagination {
  padding: 8px 20px 14px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── 分身卡片 ──────────────────────────────────────────── */

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px 20px 20px;
  align-content: start;
}
#tab-avatars { position: relative; }
#tab-avatars .empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0;
}
.avatar-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  height: 155px;
}
.avatar-card:hover {
  border-color: #d0d3d8;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.avatar-card.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.avatar-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.avatar-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* 分身卡片 - 顶部图标区 */
.ac-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.ac-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}
.ac-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
}
.ac-card-info {
  flex: 1;
  min-width: 0;
}
.ac-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ac-card-tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 分身卡片 - 中间描述 */
.ac-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* 分身卡片 - 底部：作者/时间 + 标签 */
.ac-card-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ac-card-author-bottom {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: auto;
}
.ac-card-time {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
  white-space: nowrap;
}

/* ── 悬停浮层提示 ─────────────────────────────────── */

.hover-tooltip {
  position: fixed;
  z-index: 3000;
  max-width: 480px;
  padding: 6px 10px;
  background: #1a1a1a;
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 6px;
  pointer-events: none;
  white-space: normal;
  word-break: break-word;
}
.hover-tooltip.hidden { display: none; }
.ac-owner {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.ac-time {
  margin-left: 10px;
  flex-shrink: 0;
}
/* ── 分身卡片响应式 ───────────────────────────────────── */

@media (max-width: 1200px) { .avatar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 960px)  { .avatar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .avatar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── 空状态 ────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 12px;
}
.empty-state .empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.25;
}
.resource-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.resource-empty.hidden { display: none; }
.resource-empty .empty-state {
  padding: 0;
}

/* ── 弹窗 ────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99999;
  justify-content: center;
  align-items: center;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 520px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.modal h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
  letter-spacing: -0.2px;
}
.modal .modal-footer {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.modal .modal-footer-right {
  justify-content: flex-end;
}

/* ── 大型弹窗（技能创建） ───────────────────────────────── */

.modal-lg {
  width: 66.67vw;
  height: 66.67vh;
  max-width: 1200px;
  max-height: 800px;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  gap: 0;
}

/* 顶栏 */
.modal-lg .builder-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.modal-lg .builder-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: text;
  outline: none;
  transition: border-color .15s;
  display: inline-block;
  min-width: 60px;
}
.modal-lg .builder-title:hover {
  border-color: var(--border);
}
.modal-lg .builder-title:focus {
  border-color: var(--primary);
}
.modal-lg .builder-topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.modal-lg .builder-topbar-actions .btn {
  padding: 5px 14px;
  line-height: 1.4;
}
.modal-lg .builder-topbar-actions .btn-primary {
  border: none;
}

/* 双栏主体 */
.modal-lg .builder-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 16px;
}
.modal-lg .builder-panel {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-lg .builder-panel h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 14px 16px 0;
  flex-shrink: 0;
}

/* 右侧空状态 */
.modal-lg .panel-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* 左侧：开始创建按钮 */
.modal-lg .panel-start {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-start-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 36px;
  border: none;
  border-radius: 8px;
  background: #0ea5e9;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  letter-spacing: 0.5px;
}
.btn-start-create:hover {
  background: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

/* 左侧：聊天面板 */
.modal-lg .panel-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.modal-lg .chat-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.modal-lg .chat-input-wrap {
  flex-shrink: 0;
  padding: 0 16px 12px;
}
.modal-lg .chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--card-bg);
  transition: border-color .15s;
}
.modal-lg .chat-input-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}
.modal-lg .chat-input-row textarea {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  resize: none;
  line-height: 1.5;
  max-height: 5lh;
  min-height: 1.5lh;
  padding: 4px 0;
}
.modal-lg .chat-input-row textarea::placeholder {
  color: var(--text-muted);
}
.modal-lg .chat-input-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.modal-lg .chat-input-btns .btn-ghost {
  font-size: 16px;
  padding: 2px 6px;
  line-height: 1;
}
.modal-lg .upload-btn {
  padding: 4px !important;
  color: var(--text-muted);
}
.modal-lg .upload-btn:hover {
  color: var(--text-secondary);
}

/* 聊天消息 */
.modal-lg .chat-msg {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 8px;
  max-width: 85%;
  word-wrap: break-word;
}
.modal-lg .user-msg {
  background: var(--primary-bg);
  color: var(--text);
  margin-left: auto;
  border-bottom-right-radius: 2px;
}
.modal-lg .ai-msg {
  background: var(--bg);
  border: 1px solid var(--border-light);
  color: var(--text);
  margin-right: auto;
  border-bottom-left-radius: 2px;
}
.modal-lg .ai-msg.q-msg {
  background: var(--primary-bg);
  border-color: transparent;
  font-weight: 500;
}
.modal-lg .ai-msg.followup-msg {
  background: #f0f4ff;
  border-color: transparent;
  font-size: 12px;
  margin-top: -4px;
}

/* 系统消息（loading/thinking） */
.modal-lg .sys-msg {
  text-align: center;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-right: auto;
  margin-left: auto;
}
.modal-lg .sys-msg .thinking-dots::after {
  content: '';
  animation: thinkingDots 1.5s steps(4, end) infinite;
  display: inline-block;
  width: 1.2em;
  text-align: left;
}
@keyframes thinkingDots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* 右侧测试面板 */
.modal-lg .test-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.modal-lg .test-idle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}
.modal-lg .test-ready {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
}
.modal-lg .test-ready.show {
  display: flex;
}
.modal-lg .test-ready .chat-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.modal-lg .test-ready .chat-input-wrap {
  padding: 0 16px 12px;
}

/* 完成状态 */
.modal-lg .complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--success-bg);
  color: var(--success);
  margin-bottom: 8px;
}
.modal .url-box {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  word-break: break-all;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  margin: 12px 0;
}

/* ── 登录面板 ──────────────────────────────────────────── */

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}
.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  width: 376px;
}
.login-card h2 {
  font-size: 20px;
  text-align: center;
  margin-bottom: 28px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.3px;
}

/* ── Toast ────────────────────────────────────────────── */

.toast {
  position: fixed;
  top: 14px;
  right: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  transform: translateY(-8px);
  transition: all .2s;
  max-width: 340px;
  pointer-events: none;
  font-family: inherit;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }

/* ── 布局工具 ──────────────────────────────────────────── */

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

/* ── 数据分析 ──────────────────────────────────────────── */

#tab-analytics,
#tab-revenue {
  padding: 20px;
  overflow: hidden;
}
/* KPI 卡片网格 */
.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

/* KPI 单卡 */
.analytics-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow .15s, background .15s;
  user-select: none;
}
.analytics-kpi-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.analytics-kpi-card.selected {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.analytics-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.analytics-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.analytics-kpi-icon.blue  { background: #eef2ff; color: #2563eb; }
.analytics-kpi-icon.green { background: #ecfdf5; color: #059669; }
.analytics-kpi-icon.amber { background: #fffbeb; color: #d97706; }
.analytics-kpi-icon.purple{ background: #f5f3ff; color: #7c3aed; }

.analytics-kpi-trend {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}
.analytics-kpi-trend.up   { color: #059669; background: #ecfdf5; }
.analytics-kpi-trend.down { color: #dc2626; background: #fef2f2; }
.analytics-kpi-trend.flat { color: var(--text-muted); background: #f9fafb; }

.analytics-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.analytics-kpi-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.analytics-kpi-val-main {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.analytics-kpi-val-total {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.analytics-kpi-val-suffix {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}
.analytics-kpi-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 图表区双栏 */
.analytics-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

/* 图表卡片 */
.analytics-chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.analytics-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
}
.analytics-chart-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}
.analytics-chart-body {
  padding: 16px 20px 20px;
  min-height: 200px;
}

/* 趋势图 - CSS 柱状图 */
.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  padding-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.trend-bars::-webkit-scrollbar { display: none; }
.trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.trend-bar {
  width: 50%;
  margin: 0 auto;
  border-radius: 4px 4px 0 0;
  background: #93c5fd;
  transition: height .3s;
}
.trend-bar:hover {
  background: var(--primary);
}
.trend-bar-val {
  font-size: 11px;
  color: var(--text-muted);
}
.trend-bar-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* 排行图 - 水平条 */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 200px;
  overflow-y: auto;
  scrollbar-width: none;
}
.ranking-list::-webkit-scrollbar { display: none; }
.ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ranking-name {
  width: 90px;
  font-size: 13px;
  color: var(--text);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.ranking-bar-wrap {
  flex: 1;
  height: 20px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.ranking-bar {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}
.ranking-pct {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #9aa3af;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1;
}
.ranking-val {
  width: 64px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
  text-align: left;
}
.ranking-bar.c0  { background: #2563eb; }
.ranking-bar.c1  { background: #6366f1; }
.ranking-bar.c2  { background: #8b5cf6; }
.ranking-bar.c3  { background: #a78bfa; }
.ranking-bar.c4  { background: #c4b5fd; }
.ranking-bar.c5  { background: #059669; }
.ranking-bar.c6  { background: #10b981; }
.ranking-bar.c7  { background: #34d399; }
.ranking-bar.c8  { background: #6ee7b7; }
.ranking-bar.c9  { background: #d97706; }
.ranking-bar.c10 { background: #f59e0b; }
.ranking-bar.c11 { background: #fbbf24; }
.ranking-bar.c12 { background: #fcd34d; }
.ranking-bar.c13 { background: #dc2626; }
.ranking-bar.c14 { background: #ef4444; }
.ranking-bar.c15 { background: #f87171; }
.ranking-bar.c16 { background: #fca5a5; }

/* 分区标题 */
.analytics-section {
  margin-bottom: 20px;
}
.analytics-section:last-child {
  margin-bottom: 0;
}
.analytics-section:last-child .card {
  margin-bottom: 0;
}
.analytics-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
}
.analytics-section-desc {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

/* 表格 */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
}
.analytics-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.analytics-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fafbfc;
}

/* 确保 sticky 能穿透到 tab-content 的滚动上下文 */
.analytics-section .table-wrapper {
  overflow: visible;
}
.analytics-table td {
  font-size: 13px;
  color: var(--text);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
}
.analytics-table tbody tr:hover {
  background: #f9fafb;
}
.analytics-table .cell-muted {
  color: var(--text-muted);
  font-size: 12px;
}
.analytics-table .cell-secondary {
  color: var(--text-secondary);
}
.analytics-table .cell-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 我的分身三表联动布局 ────────────────────────────────── */

.analytics-avatar-section {
  display: flex;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.avatar-table-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#analytics-avatar-section > .avatar-table-panel:nth-child(1),
#analytics-avatar-section > .avatar-table-panel:nth-child(2) {
  flex: none;
  width: calc((100% - 36px) / 4);
}

#analytics-avatar-section > .avatar-table-panel:nth-child(3) {
  flex: 1;
}

.avatar-table-header {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.avatar-table-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}

.avatar-table-body::-webkit-scrollbar {
  display: none;
}

.avatar-table-body .analytics-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.avatar-table-body .analytics-table tbody tr {
  cursor: pointer;
}

.avatar-table-body .analytics-table tbody tr.selected,
.avatar-table-body .analytics-table tbody tr.selected:hover {
  background: #e5e7eb;
}

.avatar-table-body .analytics-table tbody tr.selected td,
.avatar-table-body .analytics-table tbody tr.selected:hover td {
  background: transparent;
}

.avatar-table-body .analytics-table tbody tr:not(.selected):hover {
  background: #f9fafb;
}

.avatar-table-body .analytics-table tbody tr:not(.selected):hover td {
  background: transparent;
}

/* ── 收入明细上推滚动容器 ────────────────────────────────── */

#revenue-charts-row {
  transition: max-height .15s ease;
  min-height: 0;
}

/* ── 数据分析使用历史上推滚动 ────────────────────────────── */

#analytics-charts-row {
  transition: max-height .15s ease;
  min-height: 0;
}

#analytics-history-section {
  flex: 1;
  min-height: 120px;
}

.revenue-detail-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}

.revenue-detail-scroll::-webkit-scrollbar {
  display: none;
}

.revenue-detail-scroll .analytics-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* ── 复选框列表 ────────────────────────────────────────── */

.checkbox-list {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
}
.checkbox-item:last-child {
  border-bottom: none;
}
.checkbox-item:hover {
  background: var(--bg);
}
.checkbox-item input {
  accent-color: var(--primary);
}

/* ── 旧版 admin 兼容 ──────────────────────────────────── */

.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header h1 { font-size: 15px; color: var(--text); font-weight: 600; }
.header .nav-links { display: flex; gap: 16px; font-size: 13px; }
.header .nav-links a { color: var(--text-secondary); text-decoration: none; cursor: pointer; }
.header .nav-links a:hover,
.header .nav-links a.active { color: var(--text); }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.info-box {
  background: var(--primary-bg);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--primary);
}

.loading::after {
  content: " ...";
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0%, 20% { content: ""; }
  40% { content: "."; }
  60% { content: ".."; }
  80%, 100% { content: "..."; }
}

/* ── 资源库表格特殊样式 ────────────────────────────────── */

#tab-resources {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.resource-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#tab-resources .table-wrapper {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: none;
}
#tab-resources .table-wrapper::-webkit-scrollbar { display: none; }

/* 10px 横条遮住滚动数据 */
#tab-resources .table-wrapper::before {
  content: '';
  display: block;
  height: 10px;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 3;
}

#tab-resources table {
  margin: 0 10px;
  width: calc(100% - 20px);
}

/* 表头固定 — top:10px 对齐上方遮罩条 */
#tab-resources table thead {
  position: sticky;
  top: 10px;
  z-index: 2;
  background: #fff;
}
/* 表头分隔线 — 距左右 10px（+10px margin = 20px 对齐资源库/搜索框） */
#tab-resources table thead tr {
  background-image: linear-gradient(to right, transparent 10px, var(--border) 10px, var(--border) calc(100% - 10px), transparent calc(100% - 10px));
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 100% 1px;
}
#tab-resources table thead th {
  border-bottom: none;
}

/* 资源库行分隔线 — 同上 */
#tab-resources table tbody tr {
  background-image: linear-gradient(to right, transparent 10px, var(--border-light) 10px, var(--border-light) calc(100% - 10px), transparent calc(100% - 10px));
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: 100% 1px;
}
#tab-resources table tbody td {
  border-bottom: none;
  background: transparent;
}
#tab-resources table tbody tr:hover td {
  background: transparent;
}
#tab-resources table tbody tr:hover {
  background-color: #f1f5f9;
}
#tab-resources table tbody tr.selected {
  background-color: #f1f5f9;
}
#tab-resources table tbody tr.selected:hover {
  background-color: #f1f5f9;
}

/* 资源库列宽：6 列 */
#tab-resources table th:nth-child(1),
#tab-resources table td:nth-child(1) { width: 6%; }
#tab-resources table th:nth-child(2),
#tab-resources table td:nth-child(2) { width: 24%; }
#tab-resources table th:nth-child(3),
#tab-resources table td:nth-child(3) { width: 10%; text-align: center; }
#tab-resources table th:nth-child(4),
#tab-resources table td:nth-child(4) { width: 10%; text-align: center; }
#tab-resources table th:nth-child(5),
#tab-resources table td:nth-child(5) { width: 10%; text-align: center; }
#tab-resources table th:nth-child(6),
#tab-resources table td:nth-child(6) { width: 20%; }
#tab-resources table th:nth-child(7),
#tab-resources table td:nth-child(7) { width: 20%; }
.rename-input {
  width: 100%;
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: inherit;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  outline: none;
}

#tab-resources table td:nth-child(6) .btn-ghost {
  padding: 6px 12px;
}

/* ── 工具类 ────────────────────────────────────────────── */

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

.hidden { display: none !important; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; color: var(--text-secondary); }
.text-xs { font-size: 12px; color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.w-full { width: 100%; }

/* ── 三点操作菜单 ──────────────────────────────────────── */

.action-menu {
  position: relative;
  display: inline-block;
}
.action-dots {
  font-size: 18px;
  padding: 2px 8px;
  line-height: 1;
  letter-spacing: 2px;
}
.action-menu.open .action-dots {
  background: var(--border-light);
  color: var(--text);
}
.action-dropdown {
  display: none;
  position: fixed;
  min-width: 100px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  padding: 4px;
  z-index: 2000;
}
.action-menu.open .action-dropdown {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.action-dropdown::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 5px;
  background: transparent;
}
.action-dropdown button {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 450;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  width: 100%;
  transition: background .1s;
}
.action-dropdown button:hover {
  background: var(--border-light);
}

/* ── 资源抽屉 ──────────────────────────────────────────── */

.resource-drawer td {
  padding: 0 !important;
  background: #fafbfc;
  border-bottom: 1px solid var(--border-light);
}
.resource-drawer .drawer-content {
  padding: 8px 20px 12px 40px;
  font-size: 13px;
}
.drawer-loading, .drawer-empty {
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 0;
}
.file-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}
.file-tree li {
  padding: 1px 0;
  padding-left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: #fff;
}
.file-tree li.selected {
  background: #d9d9d9;
}
.file-tree .file-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.file-tree .file-name {
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  transition: color .1s;
}
.file-tree .file-name:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ── 文件查看器 ────────────────────────────────────────── */

.file-viewer-panel {
  flex: 1;
  margin: 5px;
  border-radius: 10px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 300px;
}
/* 编辑器在 A3-3 中展示（文档模式）：宽度对齐消息区 */
	.file-viewer-panel.in-a33 .side-panel-close { display: none; }
.file-viewer-panel.in-a33 {
  width: 100%;
  max-width: 560px;
  height: 98%;
  flex: none;
  margin: 10px auto;
  background: transparent;
}
.file-viewer-panel.in-a33 .file-viewer-body,
.file-viewer-panel.in-a33 .file-diff-view {
  background: transparent;
}
.file-viewer-panel.in-a33 .file-viewer-body {
  padding: 5px;
}

/* diff 接受/取消按钮覆盖在文本区右下角 */
.file-viewer-panel.in-a33 .file-viewer-body .diff-actions {
  position: absolute;
  bottom: 12px;
  right: 16px;
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  z-index: 10;
}

/* ── 编辑器底部工具栏（doc 模式） ── */
.editor-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  gap: 8px;
}
.editor-toolbar.hidden { display: none; }
.editor-toolbar-left,
.editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.editor-toolbar-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.editor-toolbar-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}
.editor-save-btn { color: var(--text-muted); }
.editor-save-btn.active {
  color: #2563eb;
  background: #eef2ff;
}
.editor-save-btn.active:hover {
  background: #dbeafe;
}
.editor-publish-btn { color: var(--text-muted); }
.editor-publish-btn.active {
  color: #2563eb;
  background: #eef2ff;
}
.editor-publish-btn.active:hover {
  background: #dbeafe;
}

/* 黑底白字 tooltip */
.editor-toolbar-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 6px;
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

.file-viewer-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 55px;
}
.file-viewer-filename {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-viewer-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}
.version-select {
  font-size: 12px;
  font-family: inherit;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  cursor: pointer;
  max-width: 200px;
  height: 28px;
  box-sizing: border-box;
}
.version-select:focus {
  border-color: var(--primary);
}
.version-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(99,102,241,0.1);
  padding: 2px 10px;
  border-radius: 12px;
  user-select: none;
}
.version-badge.published {
  color: #059669;
  background: rgba(5,150,105,0.1);
}
.version-badge:hover {
  background: rgba(99,102,241,0.18);
}
.version-badge.published:hover {
  background: rgba(5,150,105,0.18);
}
.version-badge.active {
  color: #d97706;
  background: rgba(217,119,6,0.12);
}
.version-badge.active:hover {
  background: rgba(217,119,6,0.2);
}
/* 版本管理 — 列表布局 */
.version-mgmt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.version-mgmt-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-mgmt-label {
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  width: 70px;
  padding-left: 10px;
}

.version-mgmt-item .version-select {
  margin: 0 auto;
  min-width: 180px;
  max-width: 220px;
  flex-shrink: 0;
}

.version-mgmt-action {
  flex-shrink: 0;
  width: 56px;
  padding: 3px 0;
  font-size: 12px;
  border-radius: 5px;
  height: 28px;
}

.version-mgmt-action.btn-publish-on {
  background: #10b981 !important; color: #fff !important; border-color: #10b981 !important;
}
.version-mgmt-action.btn-publish-on:hover { background: #059669 !important; }
.version-mgmt-action.btn-publish-off {
  background: #ef4444 !important; color: #fff !important; border-color: #ef4444 !important;
}
.version-mgmt-action.btn-publish-off:hover { background: #dc2626 !important; }

.file-viewer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 8px 16px;
  scrollbar-width: none;
  position: relative;
}
.file-viewer-body::-webkit-scrollbar { display: none; }

.file-viewer-body textarea {
  width: 100%;
  height: 100%;
  min-height: 300px;
  border: none;
  border-radius: 0;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: none;
  outline: none;
  color: var(--text);
  background: transparent;
  scrollbar-width: none;
}
.file-viewer-body textarea::-webkit-scrollbar { display: none; }

/* ── Markdown 预览 ───────────────────────────────────── */
}

/* 失焦后仍然保持蓝色选中底纹 */
#file-viewer-content::selection {
  background: #2563eb;
  color: #fff;
}

/* ── 文件对比视图 ──────────────────────────────────────── */

.file-diff-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 300px;
}
.file-diff-view.hidden { display: none; }
.file-diff-view .diff-label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}
.diff-unified {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  line-height: 1.6;
  padding: 4px 0;
  scrollbar-width: none;
}
.diff-unified::-webkit-scrollbar { display: none; }
.diff-unified .diff-line {
  padding: 1px 12px;
  white-space: pre;
  min-height: 1.6em;
}
.diff-unified .diff-line.removed {
  background: #fee2e2;
  color: #991b1b;
}
.diff-unified .diff-line.added {
  background: #dcfce7;
  color: #166534;
}
.diff-unified .diff-line.same {
  background: transparent;
  color: var(--text);
}

/* ── 资源侧边面板 ──────────────────────────────────────── */

.resource-side-panel {
  flex: 1;
  margin: 5px;
  border-radius: 10px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 300px;
}

.side-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 55px;
}
.side-panel-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
}
.aep-title-wrap {
  position: relative;
  cursor: pointer;
}
.aep-title-hint {
  display: none;
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  margin-left: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}
.aep-title-wrap:hover .aep-title-hint {
  display: block;
}
.aep-title-wrap.editing .aep-title-hint {
  display: none !important;
}
.side-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.side-panel-back {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all .1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.side-panel-back:hover {
  color: var(--text);
  background: var(--border-light);
}
.side-panel-back.hidden { display: none; }

.side-panel-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all .1s;
}
.side-panel-close:hover {
  color: var(--text);
  background: var(--border-light);
}

.side-panel-welcome {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

	/* ── 分身预览欢迎态 ── */
	#chat-side-panel.avp-welcome {
	  position: relative;
	}
	#chat-side-panel.avp-welcome #chat-side-msgs {
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	  justify-content: center;
	}
	#chat-side-panel.avp-welcome .side-panel-welcome {
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	  gap: 16px;
	  padding: 0 16px;
	}
	#chat-side-panel.avp-welcome .side-panel-welcome .avp-welcome-icon {
	  width: 80px;
	  height: 80px;
	  border-radius: 50%;
	  object-fit: cover;
	}
	#chat-side-panel.avp-welcome .side-panel-welcome .avp-welcome-icon-fallback {
	  display: flex;
	  align-items: center;
	  justify-content: center;
	  background: linear-gradient(135deg, #667eea, #764ba2);
	  color: #fff;
	  font-size: 32px;
	  font-weight: 700;
	  object-fit: unset;
	}
	#chat-side-panel.avp-welcome .side-panel-welcome .avp-welcome-name {
	  font-size: 18px;
	  font-weight: 600;
	  color: var(--text);
	}
	#chat-side-panel.avp-welcome .side-panel-input-wrap {
	  position: absolute;
	  left: 50%;
	  transform: translateX(-50%);
	  top: calc(50% + 100px);
	  width: 80%;
	  max-width: 80%;
	  margin-bottom: 0;
	}
/* 时间分割线 */
.time-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  margin: 2px 0;
}
.time-separator::before,
.time-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
.time-separator span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Todo 列表 */
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 2px 0;
}
.todo-checkbox {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.todo-done {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ── A4 输入区外层（对标 A3-3 assistant-chat-bottom） ── */
.side-panel-input-wrap {
  flex-shrink: 0;
  max-width: 80%;
  align-self: center;
  width: 100%;
  margin-bottom: 25px;
}

/* ── A4 输入行（对标 A3-3 assistant-input-row） ── */
.side-panel-input-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: none;
  border-radius: 14px;
  padding: 0;
  background: #f3f4f6;
  overflow: hidden;
}
.side-panel-input-row:focus-within {
  outline: 1px solid #2563eb;
}
.side-panel-input-row textarea {
  display: block;
  width: 100%;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  min-height: 24px;
  padding: 9px 14px 4px;
  box-sizing: border-box;
  scrollbar-width: none;
}
.side-panel-input-row textarea::-webkit-scrollbar { display: none; }
.side-panel-input-row textarea::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}
.side-panel-input-row .assistant-input-toolbar {
  padding: 4px 10px 9px;
}

/* 输入框禁用状态 */
.side-panel-input-row.textarea-disabled {
  opacity: 0.5;
  pointer-events: none;
}
.side-panel-input-row textarea:disabled {
  background: #f5f5f5;
  color: #666;
  cursor: not-allowed;
}

/* ── A4 停止按钮（对标 A3-3 assistant-stop-btn） ── */
.side-panel-stop-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  cursor: pointer;
  transition: background .15s, transform .15s;
  z-index: 2;
  animation: stop-btn-breathe 1.8s ease-in-out infinite;
  pointer-events: auto;
}
.side-panel-stop-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  transform: scale(1.1);
  animation: none;
}
.side-panel-stop-btn.hidden { display: none; }

/* 侧边栏 loading 状态 */
.side-panel-loading {
  padding: 8px 0;
}
.side-panel-loading .loading-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  margin: 0 3px;
  animation: loading-dot-breathe 1.4s ease-in-out infinite;
}
.side-panel-loading .loading-dot:nth-child(2) { animation-delay: 0.2s; }
.side-panel-loading .loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── A4 todo 进度看板（对标 A3-3 todo-sticky-container） ── */
.side-panel-todo-sticky {
  flex-shrink: 0;
  max-width: 80%;
  width: 100%;
  align-self: center;
  padding: 0 0 8px 0;
}
.side-panel-todo-sticky.hidden { display: none; }

/* 手动修改确认按钮 */
#manual-confirm-btn:disabled {
  opacity: 1;
  color: var(--text-muted);
  border-color: var(--border);
}
#manual-confirm-btn.btn-primary:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
#manual-confirm-btn.btn-primary:not(:disabled):hover {
  background: var(--primary-hover);
}

/* ── 分身详情面板 ───────────────────────────────────── */

#avatar-detail-panel {
  position: relative;
}

#avd-soul {
  overflow-y: auto;
  scrollbar-width: none;
  resize: none;
  min-height: 1.6em;
  white-space: pre-wrap;
}
#avd-desc {
  white-space: pre-wrap;
}
#avd-soul::-webkit-scrollbar { display: none; }
#avd-soul:empty::after {
  content: '暂无人设和风格...';
  color: var(--text-muted);
}
#asp-profile, #asp-soul {
  min-height: 40px;
  white-space: pre-wrap;
}

.avd-soul-ai-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.avd-soul-input-wrap {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 6px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.avd-soul-input-wrap.hidden { display: none; }
.avd-soul-input-wrap textarea {
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  resize: none;
  min-width: 280px;
  max-width: 460px;
  line-height: 1.5;
  min-height: 1.5lh;
  max-height: 5lh;
  overflow-y: hidden;
  padding: 2px 0;
}
.avd-soul-input-wrap textarea::placeholder {
  color: var(--text-muted);
}
.avd-soul-input-wrap .btn {
  flex-shrink: 0;
}
.avd-soul-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.avd-soul-actions.hidden { display: none; }
.btn-ai-generate {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}
.btn-ai-generate:hover {
  background: #dcfce7;
}
.btn-ai-edit {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.btn-ai-edit:hover {
  background: #dbeafe;
}

.avd-dropdown-wrap {
  position: relative;
  margin-top: 10px;
}
.avd-dropdown-menu {
  position: absolute;
  right: 0;
  bottom: 100%;
  z-index: 100;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  padding: 8px;
  display: none;
  margin-bottom: 5px;
}
.avd-dropdown-menu.open {
  display: block;
}
.avd-dropdown-menu .checkbox-list {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 0;
  scrollbar-width: none;
  border: none;
  outline: none;
  background: transparent;
}
.avd-dropdown-menu .checkbox-list::-webkit-scrollbar {
  display: none;
}
.avd-dropdown-menu .checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-bottom: none;
  cursor: pointer;
  font-size: 12px;
  color: #1a1a1a;
}
.avd-dropdown-menu .checkbox-item span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.avd-dropdown-menu .tag-official,
.avd-dropdown-menu .tag-private {
  color: var(--text-muted);
}
.avd-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  min-height: 20px;
}
.avd-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 12px;
}
.avd-tag .avd-tag-type {
  font-size: 10px;
  opacity: 0.6;
}
.avd-tag button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
  opacity: 0.5;
}
.avd-tag button:hover { opacity: 1; }
.avd-empty-tags {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── 人设与风格扩大编辑 ──────────────────────────── */
.avd-soul-expanded {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 20;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
}
.avd-soul-expanded.hidden { display: none; }
.avd-soul-exp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  flex-shrink: 0;
}
.avd-soul-exp-header .side-panel-title {
  font-size: 13px;
  color: var(--text-muted);
}
.avd-soul-exp-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.avd-soul-exp-body textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 16px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  color: var(--text);
  background: var(--card-bg);
  scrollbar-width: none;
}
.avd-soul-exp-body textarea::-webkit-scrollbar { display: none; }
.avd-soul-exp-input-wrap {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 6px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.avd-soul-exp-input-wrap.hidden { display: none; }
.avd-soul-exp-input-wrap textarea {
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  resize: none;
  min-width: 280px;
  max-width: 460px;
  line-height: 1.5;
  min-height: 1.5lh;
  max-height: 5lh;
  overflow-y: hidden;
  padding: 2px 0;
  height: auto;
}
.avd-soul-exp-input-wrap textarea::placeholder {
  color: var(--text-muted);
}
.avd-soul-exp-input-wrap .btn {
  flex-shrink: 0;
}
.btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-icon-only:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── 个人助理设置面板 (ASP) ─────────────────────────── */

.aep-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: none;
}
.aep-body::-webkit-scrollbar { display: none; }
.aep-section {
  margin-bottom: 14px;
}
.aep-section label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}
.aep-section textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}
.aep-section textarea:focus {
  border-color: var(--primary);
}
.aep-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.aep-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

/* ASP 用共享的 avd-* AI/下拉/标签样式（见分身详情面板区） */

.aep-selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  min-height: 20px;
}
.btn-publish-inactive {
  background: #e5e7eb;
  color: #9ca3af;
  border: 1px solid #d1d5db;
  cursor: default;
}
.btn-publish-active {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}

/* ── 分身调试面板 ───────────────────────────────────── */

#avatar-debug-panel {
  flex: 0.5;
  position: relative;
}
.adp-avatar-section {
  flex-shrink: 0;
  text-align: center;
  padding-top: 12vh;
}
.adp-avatar-section img {
  width: 80px;
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
}
.adp-msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: none;
}
.adp-msgs::-webkit-scrollbar { display: none; }
.adp-msg-wrap {
  max-width: 450px;
  margin: 0 auto;
  width: 100%;
}
.adp-welcome {
  padding: 16px 16px 0;
}
.adp-welcome p {
  width: fit-content;
  max-width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 auto;
  line-height: 1.5;
  white-space: pre-wrap;
}
.adp-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 8px;
  max-width: 100%;
  word-wrap: break-word;
}
.adp-msg.user-msg {
  background: var(--primary-bg);
  color: var(--text);
  margin-left: auto;
  max-width: 80%;
  border-bottom-right-radius: 2px;
}
.adp-msg.ai-msg {
  background: #f7f8f9;
  border: 1px solid var(--border-light);
  color: var(--text);
  margin-right: auto;
  max-width: 80%;
  border-bottom-left-radius: 2px;
}
.adp-msg.sys-msg {
  text-align: center;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 auto;
  max-width: 100%;
}
.adp-msg.sys-msg .thinking-dots::after {
  content: '';
  animation: thinkingDots 1.5s steps(4, end) infinite;
  display: inline-block;
  width: 1.2em;
  text-align: left;
}
.adp-input-wrap {
  flex-shrink: 0;
  padding: 25px 0 32px;
  max-width: 490px;
  align-self: center;
  width: 100%;
}
.adp-input-row {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: border-color .15s;
}
.adp-input-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}
.adp-input-row textarea {
  display: block;
  width: 100%;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  resize: none;
  line-height: 1.5;
  max-height: 5lh;
  min-height: 2lh;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 4px 10px 0;
  box-sizing: border-box;
}
.adp-input-row textarea::-webkit-scrollbar {
  display: none;
}
.adp-input-row textarea::placeholder {
  color: var(--text-muted);
}
.adp-input-row .assistant-input-toolbar {
  padding: 4px 6px 6px;
}

/* ── 选中文本浮动工具栏 ──────────────────────────── */

.selection-toolbar {
  position: absolute;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  transition: opacity .15s;
}
.selection-toolbar.hidden { display: none; }
.selection-toolbar textarea {
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  resize: none;
  min-width: 280px;
  max-width: 460px;
  line-height: 1.5;
  min-height: 1.5lh;
  max-height: 5lh;
  overflow-y: hidden;
  padding: 2px 0;
}
.selection-toolbar textarea::placeholder {
  color: var(--text-muted);
}
.selection-toolbar .btn {
  flex-shrink: 0;
}

/* 选中文本像素级精确覆盖层 — 模拟原生蓝色选中底纹 */
.selection-highlight {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  background: rgba(37, 99, 235, 0.30);
  border-radius: 2px;
}
.selection-highlight.hidden { display: none; }

/* 选中文本 loading 状态（透明波浪，不遮盖原本蓝色底纹） */
.selection-loading {
  position: absolute;
  z-index: 5;
  border-radius: 2px;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: selectionShimmer 1.6s ease-in-out infinite;
}

/* 全文档 AI 编辑 loading：浅绿色波浪遮罩 */
.selection-loading.full-doc-loading {
  background: linear-gradient(110deg, rgba(16,185,129,0.08) 30%, rgba(16,185,129,0.20) 50%, rgba(16,185,129,0.08) 70%);
  border-radius: 6px;
}
.selection-loading.hidden { display: none; }
@keyframes selectionShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Diff 视图操作按钮栏 */
.diff-actions {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: #fff;
}

/* ── 响应式 ────────────────────────────────────────────── */

@media (max-width: 768px) {
  .base-nav { width: 52px; }
  .base-nav .nav-logo h1, .base-nav .nav-logo p,
  .base-nav .nav-item span, .base-nav .nav-user .u-info { display: none; }
  .base-nav .nav-item { justify-content: center; padding: 10px; }
  .content-card { margin: 0; border-radius: 0; }
  .grid-2, .grid-3, .stats-grid { grid-template-columns: 1fr; }
}

/* ── 个人助理 ──────────────────────────────────────────── */

/* ── 个人助理 Flex 三层：A3-1(图标) A3-2(面板) A3-3(主交互) ── */
.assistant-new-layout {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
/* A3-1: 图标栏 */
.assistant-a31 {
  width: 70px; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 17px 0; overflow: visible; z-index: 10;
}
/* A3-2: 列表面板 */
.assistant-a32 {
  width: 0; overflow: hidden;
  transition: width .2s;
}
.assistant-new-layout.has-panel .assistant-a32 {
  width: clamp(158px, 20%, 246px);
  display: flex; flex-direction: column;
}
.assistant-a32-inner {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  margin-top: 17px;
  margin-bottom: 25px;
  padding: 0;
  overflow: hidden;
  border-radius: 6px;
}
.assistant-a32 .assistant-history-panel:not(.hidden) {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
}
/* A3-3: 主交互区 */
.assistant-a33 {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
}
.assistant-new-layout.has-panel .assistant-a33 {
  margin-left: clamp(2px, 0.2%, 8px);
}
/* 图标栏内部 */
.assistant-icon-bar {
  display: flex; flex-direction: column;
  justify-content: space-between; align-items: center;
  flex: 1;
}
.assistant-icon-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assistant-icon-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.assistant-icon-item svg {
  width: 20px; height: 20px;
}

.assistant-icon-item:hover,
.assistant-icon-item.active {
  color: var(--text);
  background: var(--border-light);
}

.assistant-icon-tip {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 13px;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  z-index: 10000;
}

.assistant-icon-item:hover .assistant-icon-tip {
  opacity: 1;
}

/* ── 图标角标（红底白字，无框线） ──── */
.assistant-icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}
.assistant-icon-badge.hidden { display: none; }

/* 定时任务列表项未读角标，与 .assistant-icon-badge 保持一致的尺寸 */
.cron-unread-badge {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── 会话历史 / 文档面板通用 ──────────── */
.assistant-history-panel {
  background: transparent;
  border: none;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.assistant-history-panel.hidden { display: none; }

/* 定时任务面板：默认透明，未读时浅紫 */
#assistant-cron-panel {
  background: transparent;
  border-radius: 6px;
  padding: 0;
  transition: background 0.3s ease;
}
.assistant-history-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 10px 12px 6px 12px;
}

/* ── 面板搜索框 ─────────────────────── */
.assistant-panel-search {
  flex-shrink: 0;
  padding: 6px 12px 8px 12px;
}
.assistant-panel-search input {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: #f3f4f6;
  outline: none;
  box-sizing: border-box;
}
.assistant-panel-search input::placeholder {
  color: var(--text-muted);
}

/* ── 面板列表 ──────────────────────── */
.assistant-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  scrollbar-width: none;
}
.assistant-history-list::-webkit-scrollbar { display: none; }

.assistant-history-item {
  padding: 8px 4px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
}
.assistant-history-item:hover,
.assistant-history-item.selected {
  background: #e8eaed;
}
.assistant-history-item:last-child { margin-bottom: 0; }

.assistant-history-item-title {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-all;
}
.assistant-history-item-title[contenteditable="true"],
.assistant-suspend-item-title[contenteditable="true"] {
  outline: 1px solid #60a5fa;
  border-radius: 2px;
  padding: 1px 3px;
  margin: -1px -3px;
}

.assistant-history-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── 挂起任务消息卡片标记 ───────────────────── */
.assistant-msg.ai-msg.suspended-output {
  background: rgba(139, 92, 246, 0.04);
  border-left: 3px solid rgba(139, 92, 246, 0.3);
  padding-left: 12px;
  border-radius: 0 6px 6px 0;
}
.suspended-badge {
  display: inline-block;
  color: #8b5cf6;
  font-size: 10px;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 3px;
  background: rgba(139, 92, 246, 0.06);
  vertical-align: middle;
  font-weight: 500;
}
/* 回放区域的挂起标记 */
.stream-wrap.suspended-stream {
  background: rgba(139, 92, 246, 0.03);
  border-left: 3px solid rgba(139, 92, 246, 0.25);
  border-radius: 0 6px 6px 0;
}

/* ── 挂起任务列表项 ───────────────────── */
.assistant-suspend-item {
  padding: 8px 4px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
}
.assistant-suspend-item:hover,
.assistant-suspend-item.selected { background: #e8eaed; }
.assistant-suspend-item.bg-running:hover { background: rgba(139, 92, 246, 0.12); }

.assistant-suspend-item-title {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-all;
}

.assistant-suspend-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 3px;
}

.assistant-suspend-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.assistant-suspend-item.bg-running {
  background: rgba(139, 92, 246, 0.06);
  animation: suspend-breathe 2s ease-in-out infinite;
}
@keyframes suspend-breathe {
  0%, 100% { background: rgba(139, 92, 246, 0.04); }
  50%      { background: rgba(139, 92, 246, 0.10); }
}

/* 已完成未点击：同色底纹，无呼吸动画 */
.assistant-suspend-item.bg-completed {
  background: rgba(139, 92, 246, 0.06);
}

.assistant-suspend-item:hover .list-item-dots {
  opacity: 1;
}

/* ── 文档列表项 ───────────────────────── */
.assistant-doc-item {
  padding: 8px 4px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 2px;
}
.assistant-doc-item:hover,
.assistant-doc-item.selected {
  background: #e8eaed;
}
.assistant-doc-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.assistant-doc-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}
.assistant-doc-name {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-all;
}
.assistant-doc-name[contenteditable="true"] {
  outline: 1px solid #60a5fa;
  border-radius: 2px;
  padding: 1px 3px;
  margin: -1px -3px;
  background: #fff;
}
.assistant-doc-ext {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.assistant-doc-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.assistant-doc-open {
  flex-shrink: 0;
  margin-left: 4px;
  padding: 1px 5px;
  font-size: 12px;
  line-height: 1.4;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  color: var(--primary, #2563eb);
}
.assistant-doc-open:hover {
  background: var(--primary, #2563eb);
  color: #fff;
}

/* ── 列表项三点操作菜单 ─────────────────── */
.assistant-history-item,
.assistant-doc-item {
  position: relative;
}
.list-item-dots {
  position: absolute;
  right: 2px;
  bottom: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.assistant-history-item:hover .list-item-dots,
.assistant-doc-item:hover .list-item-dots {
  opacity: 1;
}
.list-item-dots:hover {
  background: #e5e7eb;
  color: #6b7280;
}
.list-item-dots svg {
  pointer-events: none;
}
/* 共享浮层菜单（fixed 定位，JS 控制） */
#list-item-action-menu {
  position: fixed;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 100px;
  overflow: hidden;
  padding: 4px;
}
#list-item-action-menu.hidden {
  display: none;
}
#list-item-action-menu .list-item-action-btn {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: none;
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}
#list-item-action-menu .list-item-action-btn:hover {
  background: #f3f4f6;
}
#list-item-action-menu .list-item-action-btn.danger {
  color: #dc2626;
}
#list-item-action-menu .list-item-action-btn.danger:hover {
  background: #fef2f2;
}

/* ── Welcome 模式（无聊天） ──────────── */
.assistant-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: clamp(400px, 50%, 640px);
  padding: 0;
  min-height: 0;
}
.assistant-new-layout.chat-active .assistant-welcome {
  display: none;
}

.assistant-welcome .assistant-hero {
  text-align: center;
  margin-bottom: 24px;
}

.assistant-welcome .assistant-input-row {
  width: 100%;
}

/* ── Chat 模式（有消息时） ──────────── */
.assistant-new-layout.chat-active {}

/* ── Chat 模式底部输入区 ──────────── */
.assistant-chat-bottom {
  width: 100%;
  max-width: 560px;
  flex-shrink: 0;
  margin-bottom: 25px;
}

/* ── 会话态输入包装（新会话图标 + 输入行） ──── */
.assistant-chat-input-wrap {
  position: relative;
  width: 100%;
}

.assistant-chat-input-wrap .assistant-input-row {
  width: 100%;
}

/* ── 停止任务按钮（呼吸态，位于输入框内右上角） ──── */
.assistant-stop-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  cursor: pointer;
  transition: background .15s, transform .15s;
  z-index: 2;
  animation: stop-btn-breathe 1.8s ease-in-out infinite;
}
.assistant-stop-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  transform: scale(1.1);
  animation: none;
}
.assistant-stop-btn.hidden { display: none; }
@keyframes stop-btn-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ── 新会话按钮（绝对定位在输入框左侧外部） ──── */
.assistant-new-chat-btn {
  position: absolute;
  left: -52px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #f3f4f6;
  color: #8b8b8b;
  cursor: pointer;
  flex-shrink: 0;
  z-index: 1;
  transition: color .15s, background .15s, box-shadow .15s;
  box-shadow: none;
}
.assistant-new-chat-btn:hover {
  color: #333;
  background: #f0f0f0;
}
.assistant-new-chat-btn:active {
  transform: translateY(-50%) scale(0.95);
}

/* ── 通用 ──────────────────────────── */
.assistant-hero {
  text-align: center;
  flex-shrink: 0;
}

.assistant-avatar-icon {
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}

.assistant-hero-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.assistant-hero-desc {
  display: none;
}

/* ── 分身切换面板 ──────────────────────────────── */

.assistant-avatar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.assistant-avatar-item:hover { background: var(--hover-bg, #f5f5f5); }
.assistant-avatar-item.active { background: #eef2ff; }

.assistant-avatar-item-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #eef2ff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  flex-shrink: 0;
}
.assistant-avatar-item-name {
  font-size: 14px; font-weight: 500;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.assistant-avatar-item-check {
  color: #2563eb; font-size: 14px; flex-shrink: 0;
}
.assistant-avatar-empty {
  text-align: center; padding: 20px; color: var(--text-muted); font-size: 13px;
}

/* ── A4 消息区（对齐A3-3 .assistant-msgs-wrapper 间距） ── */
#chat-side-msgs {
  align-self: center;
  width: 100%;
  flex: 1;
  min-height: 0;
  height: auto;
  margin: 0 0 16px 0;
}
/* todo 出现时：消息区→todo 间距 8px */
.resource-side-panel:has(#chat-side-todo:not(.hidden)) #chat-side-msgs {
  margin: 0 0 8px 0;
}
.resource-side-panel:has(#chat-side-todo:not(.hidden)) #chat-side-todo {
  margin-bottom: 8px;
  padding-bottom: 0;
  align-self: center;
}
/* ── A4 面板 80% 比例宽度覆盖 ── */
.chat-max-80 { max-width: 80% !important; }

/* ── 消息区外层包裹（固定间距，不随滚动消失） ──── */
.assistant-msgs-wrapper {
  width: 100%;
  max-width: 560px;
  flex: 1;
  min-height: 0;
  margin: 25px 0 16px 0;
  overflow: hidden;
}
.assistant-msgs-wrapper.hidden { display: none; }

/* todo 出现时：消息区→todo 收窄为 8px，todo→输入 也为 8px */
.assistant-a33:has(.todo-sticky-container:not(.hidden)) .assistant-msgs-wrapper {
  margin: 25px 0 8px 0;
}
.assistant-a33:has(.todo-sticky-container:not(.hidden)) .todo-sticky-container {
  margin-bottom: 8px;
  padding-bottom: 0;
}

.assistant-new-msgs {
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}
.assistant-new-msgs::-webkit-scrollbar { display: none; }
.assistant-new-msgs > .assistant-msg:last-child { margin-bottom: 0; }
.assistant-new-msgs > .assistant-sys-msg:last-child { margin-bottom: 0; }

/* ── 输入行（白色圆角，无边框，用于欢迎态和会话态） ──── */
.assistant-input-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: none;
  border-radius: 14px;
  padding: 0;
  background: #f3f4f6;
  overflow: hidden;
}

.assistant-input-row:focus-within {
  outline: 1px solid #2563eb;
}

/* ── 文件展示区 ──── */
.upload-file-area {
  background: #f3f4f6;
  padding: 6px 14px;
  font-size: 12px;
  line-height: 1.4;
}
.upload-file-area.hidden {
  display: none;
}

/* ── @ 提及标签区域 ──── */
.at-mention-tags-area {
  background: #f3f4f6;
  padding: 6px 14px;
  font-size: 12px;
  line-height: 1.4;
}
.at-mention-tags-area.hidden {
  display: none;
}
.at-mention-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.at-mention-tag-item {
  display: flex;
  align-items: center;
  gap: 0;
  background: #333;
  color: #fff;
  border-radius: 4px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
}
.at-mention-tag-type {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(255,255,255,0.15);
  font-weight: 600;
  font-size: 11px;
}
.at-mention-tag-name {
  display: inline-block;
  padding: 2px 2px 2px 8px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.at-mention-tag-del {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 22px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  transition: background .15s;
}
.at-mention-tag-del:hover {
  background: rgba(255,255,255,0.2);
}

.upload-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.upload-file-item {
  display: flex;
  align-items: center;
  gap: 0;
  background: #333;
  color: #fff;
  border-radius: 4px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
}
.upload-file-name {
  display: inline-block;
  padding: 2px 2px 2px 8px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-file-del {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 22px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  transition: background .15s;
}
.upload-file-del:hover {
  background: rgba(255,255,255,0.2);
}

/* ── 聊天页面上传文件标签 ──── */
.chat-upload-area {
  padding: 4px 10px;
  background: #f3f4f6;
  border-top: 1px solid #e5e7eb;
}
.chat-upload-area.hidden { display: none; }
.chat-upload-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-upload-tag {
  display: inline-block;
  padding: 2px 10px;
  background: #333;
  color: #fff;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-upload-tag:hover {
  background: #e53e3e;
}

/* ── 输入行内部 textarea ──── */
.assistant-input-row textarea {
  display: block;
  width: 100%;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  min-height: 24px;
  padding: 9px 14px 4px;
  box-sizing: border-box;
  scrollbar-width: none;
  overflow-y: auto;
}
.assistant-input-row textarea::-webkit-scrollbar {
  display: none;
}
.assistant-input-row textarea::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

/* ── 输入行工具栏 ──── */
.assistant-input-toolbar {
  display: flex;
  align-items: center;
  padding: 4px 10px 9px;
  gap: 0;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.toolbar-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color .15s, background .15s;
  line-height: 1;
}
.toolbar-btn:hover {
  color: var(--primary);
  background: rgba(37,99,235,0.06);
}

/* ── 模型选择器 ──────────────────────────── */
.model-select-wrap {
  position: relative;
  flex-shrink: 0;
}
.model-select-trigger {
  display: inline-block;
  height: 26px;
  line-height: 26px;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary, #999);
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}
.model-select-trigger:hover {
  background: #e8e8e8;
  color: var(--text-primary, #333);
}
.model-select-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 3px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  padding: 4px;
  z-index: 1000;
}
.model-select-dropdown.open {
  display: block;
}
.model-select-option {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #333;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
  margin: 0 2px;
}
.model-select-option:hover {
  background: #f0f0f0;
}
.model-select-option.selected {
  color: var(--primary, #2563eb);
  font-weight: 500;
}

/* ── @ 提及选择面板 ──────────────────────── */
.at-mention-popup {
  position: absolute;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}

.at-mention-header {
  padding: 10px 14px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  flex-shrink: 0;
}

.at-mention-tabs {
  display: flex;
  gap: 0;
  padding: 6px 10px;
  background: #f9fafb;
  flex-shrink: 0;
}

.at-mention-tab {
  padding: 5px 14px;
  font-size: 12px;
  color: #6b7280;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.at-mention-tab:hover {
  color: var(--text);
  background: #f3f4f6;
}

.at-mention-tab.active {
  color: var(--primary, #2563eb);
  background: #eef2ff;
  font-weight: 600;
}

.at-mention-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-height: 0;
}
.at-mention-list::-webkit-scrollbar {
  display: none;
}

.at-mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.15s;
}

.at-mention-item:hover {
  background: #f3f4f6;
}

.at-mention-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.at-mention-item-icon.skill {
  background: #fef3c7;
  color: #d97706;
}

.at-mention-item-icon.knowledge {
  background: #dbeafe;
  color: #2563eb;
}

.at-mention-item-icon.doc {
  background: #f3e8ff;
  color: #7c3aed;
}

.at-mention-item-icon.mcp {
  background: #d1fae5;
  color: #059669;
}

.at-mention-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.at-mention-item-desc {
  font-size: 11px;
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
  flex-shrink: 0;
}

.at-mention-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
}

.assistant-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 8px;
  max-width: 100%;
  word-wrap: break-word;
}

.assistant-msg.user-msg {
  background: var(--primary-bg, #e8f0fe);
  color: var(--text);
  margin-left: auto;
  border-bottom-right-radius: 2px;
  white-space: pre-wrap;
}

/* 用户消息外部的文件标签（独立于气泡，右对齐） */
.user-msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  margin-bottom: 4px;
}
.user-msg-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #dbeafe;
  border-radius: 8px;
  font-size: 12px;
  color: #1e40af;
}
.user-msg-file-chip svg {
  flex-shrink: 0;
  color: #3b82f6;
}
.user-msg-file-name {
  font-weight: 500;
}
.user-msg-file-ext {
  color: #6b7280;
  font-size: 11px;
}
.user-msg-mention-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: #ede9fe;
  border-radius: 8px;
  font-size: 12px;
  color: #5b21b6;
  font-weight: 500;
}

.assistant-msg.ai-msg {
  /* 外层=透明 flex 容器：气泡(.ai-bubble/.stream-content) + 文档块 + 操作块
     三个独立兄弟。气泡底纹移到内层，文档/操作块脱出气泡、浮在页面底色上。 */
  background: transparent;
  color: var(--text);
  margin-right: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* 注意：不要设 align-items:flex-start——会把流式里的"执行中"挂起栏/工具卡片
     压成内容宽度、挂起按钮无法靠右。保持默认 stretch 让这些子元素全宽。 */
}
/* 内层气泡：承载文字，保留淡灰底纹 */
.assistant-msg.ai-msg > .stream-content,
.assistant-msg.ai-msg > .ai-bubble {
  order: 0;
  background: rgba(0,0,0,0.03);
  padding: 8px 12px;
  border-radius: 8px;
  border-bottom-left-radius: 2px;
  max-width: 100%;
  word-wrap: break-word;
}
/* 顺序：气泡(0) → 文档块(1) → 操作块(2)，与 DOM 顺序无关 */
.assistant-msg.ai-msg > .msg-doc-bar { order: 1; }
.assistant-msg.ai-msg > .msg-actions { order: 2; }
.assistant-msg.ai-msg ul,
.assistant-msg.ai-msg ol {
  padding-left: 8px;
  margin: 0.5em 0;
  list-style-position: outside;
}

/* ── AI 消息操作按钮栏（浮层覆盖在气泡底部） ──── */
.assistant-msg.ai-msg {
  position: relative;
}
/* ── AI 消息卡片下方：操作 icon 栏 + 文档容器（对齐小程序样式）──
   原为绝对定位+灰底+hover才显，改为在流下方、左对齐、无底纹、常显 */
.assistant-msg.ai-msg .msg-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 2px 2px 12px;  /* 操作icon整体右移10px(左边距 2→12) */
}
.assistant-msg.ai-msg .msg-action-btn {
  background: transparent;
  border: none;
  padding: 0;
  color: #9aa0a6;
  cursor: pointer;
  transition: color .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.assistant-msg.ai-msg .msg-action-btn:hover { color: #4b5563; }
.assistant-msg.ai-msg .msg-action-btn.active { color: #2563eb; }
.assistant-msg.ai-msg .msg-action-btn svg { width: 17px; height: 17px; }

/* 文档容器：单容器、从上到下竖排、卡片样式 */
.assistant-msg.ai-msg .msg-doc-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 2px;  /* 容器 gap 6px + margin-top 2px = 8px = 消息气泡间距 */
  align-items: stretch;
}
.assistant-msg.ai-msg .msg-doc-btn {
  background: #f7f8fa;
  border: none;
  padding: 9px 11px;
  border-radius: 10px;
  color: #2563eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.3;
  text-align: left;
  transition: background .15s, color .15s;
  position: relative;
}
.assistant-msg.ai-msg .msg-doc-btn:hover { background: #eef0f3; color: #1d4ed8; }
.assistant-msg.ai-msg .msg-doc-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

/* A4 消息内 Markdown 样式（复用 A3-3 气泡） */
.assistant-msg.ai-msg p { margin: 0 0 4px; }
.assistant-msg.ai-msg p:last-child { margin-bottom: 0; }
.assistant-msg.ai-msg pre {
  background: #e8eaed;
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0;
}
.assistant-msg.ai-msg code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  background: #e8eaed;
  padding: 1px 4px;
  border-radius: 3px;
}
.assistant-msg.ai-msg pre code {
  background: none;
  padding: 0;
}
.assistant-msg.ai-msg table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
  font-size: 12px;
}
.assistant-msg.ai-msg table th,
.assistant-msg.ai-msg table td {
  padding: 4px 8px;
  border: 1px solid var(--border);
  text-align: left;
}
.assistant-msg.ai-msg table th {
  background: #f7f8f9;
  font-weight: 500;
}

/* ── 引用标签（黑底白字） ──── */
.quote-tag-area {
  background: #f3f4f6;
  padding: 6px 14px;
}
.quote-tag-area.hidden { display: none; }
/* A4 侧边栏引用标签：强制可见，防止被层叠/约束盖住（与 A3-3 行为一致） */
#chat-side-quote-tag:not(.hidden) { display: block; position: relative; z-index: 3; flex-shrink: 0; }
.quote-tag-item {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: #333;
  color: #fff;
  border-radius: 4px;
  overflow: hidden;
  font-size: 12px;
}
.quote-tag-text {
  display: inline-block;
  padding: 2px 2px 2px 8px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quote-tag-del {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 22px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}
.quote-tag-del:hover { background: rgba(255,255,255,0.2); }

.assistant-sys-msg {
  text-align: center;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-right: auto;
  margin-left: auto;
}
/* 呼吸三点 loading：左对齐 + 底纹胶囊 */
.assistant-sys-msg.assistant-loading {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: var(--bg-hover, rgba(0,0,0,0.04));
  border-radius: 16px;
  margin-left: 0;
  margin-right: auto;
}
.assistant-sys-msg.assistant-loading .loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted, #999);
  animation: loading-dot-breathe 1.4s ease-in-out infinite;
}
.assistant-sys-msg.assistant-loading .loading-dot:nth-child(2) { animation-delay: 0.2s; }
.assistant-sys-msg.assistant-loading .loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes loading-dot-breathe {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* ── 挂起按钮 ────────────────────────────── */
.suspend-btn {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  cursor: pointer;
  transition: background .15s, color .15s;
  vertical-align: middle;
}
.suspend-btn:hover {
  background: var(--primary);
  color: #fff;
}
.suspend-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 流式执行中的持久挂起栏 */
/* 它在流式开始就创建、文字/工具卡片随后流入 contentEl(气泡)，用 order 钉在气泡底部 */
.stream-content > .stream-suspend-bar { order: 999; }
.stream-suspend-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  margin-top: 4px;
  margin-bottom: 4px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.08);
  font-size: 12px;
  color: var(--text-muted, #888);
}
.stream-suspend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: stream-suspend-pulse 1.2s ease-in-out infinite;
}
@keyframes stream-suspend-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.stream-suspend-bar .suspend-btn {
  margin-left: auto;
}

/* ── 后台任务通知卡片 ─────────────────────── */
.bg-task-card {
  max-width: 80%;
  margin: 8px auto;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  font-size: 13px;
}
.bg-task-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #166534;
  margin-bottom: 6px;
}
.bg-task-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 12px;
}
.bg-task-card-preview {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bg-task-card-view {
  padding: 4px 12px;
  border: none;
  border-radius: 4px;
  background: #22c55e;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.bg-task-card-view:hover {
  background: #16a34a;
}

/* ── 流式输出 & 工具调用卡片 ──────────────────────────── */

.stream-wrap {
  padding: 10px 14px;
}

#chat-side-msgs .stream-wrap {
  background: transparent;
  margin-bottom: 8px;
}
#chat-side-msgs .stream-wrap:last-child {
  margin-bottom: 0;
}
#chat-side-msgs .stream-text-chunk ul,
#chat-side-msgs .stream-text-chunk ol {
  margin: 4px 0;
  padding-left: 0;
  list-style-position: inside;
}

.stream-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stream-text-chunk {
  font-size: 13px;
  line-height: 1.6;
  color: inherit;
}

.stream-text-chunk p {
  margin: 0 0 2px;
}

.stream-text-chunk p:last-child {
  margin-bottom: 0;
}

/* 标题样式 */
.stream-text-chunk h1 { font-size: 18px; margin: 6px 0 2px; font-weight: 700; }
.stream-text-chunk h2 { font-size: 16px; margin: 4px 0 1px; font-weight: 700; }
.stream-text-chunk h3 { font-size: 14px; margin: 3px 0 1px; font-weight: 600; }
.stream-text-chunk h4 { font-size: 13px; margin: 2px 0 1px; font-weight: 600; }

/* 表格滚动容器 */
.md-table-wrap {
  overflow-x: auto;
  margin: 4px 0;
  padding-bottom: 1px;
  -webkit-overflow-scrolling: touch;
}
.md-table-wrap table {
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.5;
  min-width: 100%;
}
.md-table-wrap th,
.md-table-wrap td {
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  border: none;
  border-bottom: 1px solid var(--border-light, rgba(255,255,255,0.08));
}
.md-table-wrap th {
  background: rgba(0,0,0,0.04);
  font-weight: 600;
  color: inherit;
  border-bottom: 2px solid var(--border-light, rgba(0,0,0,0.12));
}
.md-table-wrap tr:last-child td {
  border-bottom: none;
}

/* Unicode 制表符表格 */
/* Mermaid 图：渲染前是 <pre class="mermaid">(纯文本源码)，渲染后 mermaid 注入 SVG。
   去掉代码块外观，居中显示，SVG 自适应宽度 */
pre.mermaid {
  background: transparent;
  border: none;
  padding: 8px 0;
  margin: 6px 0;
  text-align: center;
  overflow-x: auto;
  white-space: normal;
  font-size: 13px;
  color: #6b7280;
}
pre.mermaid svg { max-width: 100%; height: auto; }
pre.mermaid:not([data-processed]) { font-family: inherit; }

pre.unicode-table {
  background: transparent;
  color: inherit;
  font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre;
  padding: 8px 0;
  margin: 4px 0;
  border: none;
  border-radius: 0;
  -webkit-overflow-scrolling: touch;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg-input, rgba(255,255,255,0.04));
  transition: border-color 0.3s, background 0.3s;
  margin-bottom: 2px;
}

.tool-card.tool-card-running {
  background: rgba(99, 102, 241, 0.08);
}

.tool-card.tool-card-done {
  background: rgba(34, 197, 94, 0.06);
}

.tool-card-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.tool-card-name {
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  flex-shrink: 0;
  font-family: monospace;
  font-size: 11px;
}

.tool-card-args {
  color: var(--text-muted, #888);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.tool-card-result {
  color: #4ade80;
  font-size: 11px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.tool-card-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: toolSpin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes toolSpin {
  to { transform: rotate(360deg); }
}

.stream-cursor {
  display: inline-block;
  width: 6px;
  height: 14px;
  background: var(--text, #0d0d0d);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: cursorBlink 0.8s steps(1) infinite;
}

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

/* ── A2UI 组件 ──────────────────────────────────────────── */

.a2ui-wrapper {
  margin: 8px 0;
}

.a2ui-card {
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--border-color, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 16px;
  max-width: 480px;
}

.a2ui-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  margin-bottom: 6px;
}

.a2ui-hint {
  font-size: 12px;
  color: var(--text-muted, #888);
  margin-bottom: 12px;
}

.a2ui-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.a2ui-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  background: var(--bg-input, rgba(255,255,255,0.04));
}

.a2ui-option:hover {
  background: var(--bg-hover, rgba(255,255,255,0.08));
}

.a2ui-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
  cursor: pointer;
  flex-shrink: 0;
}

.a2ui-option-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary, #e0e0e0);
}

.a2ui-option-type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.type-tag-private {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.type-tag-official {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.type-tag-third_party {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

.a2ui-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.a2ui-count {
  font-size: 12px;
  color: var(--text-muted, #888);
}

.a2ui-confirm-btn {
  padding: 7px 20px;
  border: none;
  border-radius: 8px;
  background: #6366f1;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.a2ui-confirm-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.a2ui-confirm-btn:not(:disabled):hover {
  background: #5558e6;
}

/* ── A2UI Todo Progress 组件（深灰+白色块风格） ──────────── */

.todo-sticky-container {
  width: 100%;
  max-width: 560px;
  flex-shrink: 0;
  padding: 0 0 8px 0;
}

.todo-sticky-container.hidden {
  display: none;
}

.todo-sticky-container .a2ui-wrapper {
  margin: 0;
}

.todo-progress-card {
  max-width: 560px;
  padding: 0;
  background: #fefce8;
  border-radius: 10px;
  overflow: hidden;
  padding-bottom: 6px;
}

.todo-progress-card-header {
  padding: 6px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
}

.todo-progress-items {
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  padding: 0;
}

.todo-progress-items::-webkit-scrollbar {
  display: none;
}

.todo-progress-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 14px;
  font-size: 11px;
  margin: 1px 8px;
  border-radius: 5px;
  background: rgba(180,83,9,0.08);
}

.todo-progress-item.todo-active {
  animation: todo-breathe 2s ease-in-out infinite;
}

@keyframes todo-breathe {
  0%, 100% { background: rgba(180,83,9,0.06); }
  50% { background: rgba(180,83,9,0.15); }
}

.todo-progress-icon {
  font-size: 12px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.todo-progress-icon.todo-status-completed {
  color: #4ade80;
}

.todo-progress-icon.todo-status-in_progress {
  color: #fbbf24;
}

.todo-progress-icon.todo-status-pending {
  color: #78716c;
}

.todo-progress-icon.todo-status-cancelled {
  color: #f87171;
}

.todo-progress-content {
  flex: 1;
  color: #333;
  font-size: 11px;
}

.todo-progress-content.todo-progress-done {
  text-decoration: line-through;
  color: #999;
}

.todo-progress-status-tag {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.04);
  color: #78716c;
}

.todo-progress-status-tag.todo-status-completed {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.todo-progress-status-tag.todo-status-in_progress {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.todo-progress-status-tag.todo-status-pending {
  background: rgba(0,0,0,0.04);
  color: #78716c;
}

.todo-progress-status-tag.todo-status-cancelled {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

/* ── 资源广场 ──────────────────────────────────────────── */

#tab-marketplace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-anchor: none;
  scrollbar-width: none;
}
#tab-marketplace::-webkit-scrollbar { display: none; }

/* Hero 横幅 */
.mkp-hero {
  flex-shrink: 0;
  height: 261px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  background: linear-gradient(180deg, #f8fafd 0%, #fff 100%);
  min-height: 0;
  overflow: hidden;
}

.mkp-hero-title {
  font-size: 52px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  text-align: center;
  margin: 0;
}

.mkp-hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

.mkp-hero-search-wrap {
  position: relative;
  width: 700px;
  max-width: 100%;
  margin-top: 5px;
}

/* 分类条（hero 与卡片之间，粘性固定） */
.mkp-cat-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 5;
  margin-top: -2px;
  background: #fff;
  gap: 12px;
}

.mkp-cat-search {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  height: 30px;
  margin-left: auto;
  flex-shrink: 0;
  min-width: 180px;
  background: var(--card-bg);
  transition: border-color .15s, opacity .15s;
}

.mkp-cat-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-bg);
}

/* 默认隐藏 cat-bar 搜索框（hero 可见时用 hero 里的搜索框） */
#tab-marketplace .mkp-cat-search {
  opacity: 0;
  pointer-events: none;
}

/* 滚动后显示 cat-bar 搜索框 */
#tab-marketplace.mkp-scrolled .mkp-cat-search {
  opacity: 1;
  pointer-events: auto;
}

.mkp-cat-search .search-icon {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.6;
}

.mkp-cat-search input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  flex: 1;
  color: var(--text);
  font-family: inherit;
  line-height: 30px;
}

.mkp-cat-search input::placeholder {
  color: var(--text-muted);
}

.mkp-hero-search {
  width: 100%;
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
  scrollbar-width: none;
}

.mkp-hero-search::-webkit-scrollbar { display: none; }

.mkp-hero-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.mkp-hero-search::placeholder {
  color: var(--text-muted);
}

.mkp-categories {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mkp-cat {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 450;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
  transition: all .12s;
}

.mkp-cat:hover {
  color: var(--text);
  background: var(--border-light);
}

.mkp-cat.active {
  color: #fff;
  background: var(--primary);
  font-weight: 500;
}

.mkp-cat.inactive {
  color: var(--text-secondary);
  background: var(--border-light);
  font-weight: 400;
  border-color: var(--border);
}

.mkp-select.has-value {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 500;
}

.mkp-cat-fixed {
  width: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mkp-select {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--card-bg);
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  min-width: 72px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

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

/* 卡片网格外层容器 */
.mkp-grid-wrap {
  flex: 1;
  min-height: 0;
}

/* 卡片网格区 */
.mkp-grid-scroll {
  padding: 0 20px 12px;
}

/* 卡片网格 */
.mkp-grid-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* 单卡 */
.mkp-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  height: 155px;
}

.mkp-card:hover {
  border-color: #d0d3d8;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.mkp-card.selected {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.mkp-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.mkp-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.mkp-card-icon.c0, .mkp-detail-icon.c0, .ac-card-icon.c0, .res-detail-icon.c0 { background: linear-gradient(135deg, #2563eb, #6366f1); }
.mkp-card-icon.c1, .mkp-detail-icon.c1, .ac-card-icon.c1, .res-detail-icon.c1 { background: linear-gradient(135deg, #059669, #10b981); }
.mkp-card-icon.c2, .mkp-detail-icon.c2, .ac-card-icon.c2, .res-detail-icon.c2 { background: linear-gradient(135deg, #d97706, #f59e0b); }
.mkp-card-icon.c3, .mkp-detail-icon.c3, .ac-card-icon.c3, .res-detail-icon.c3 { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.mkp-card-icon.c4, .mkp-detail-icon.c4, .ac-card-icon.c4, .res-detail-icon.c4 { background: linear-gradient(135deg, #dc2626, #ef4444); }
.mkp-card-icon.c5, .mkp-detail-icon.c5, .ac-card-icon.c5, .res-detail-icon.c5 { background: linear-gradient(135deg, #0891b2, #06b6d4); }
.mkp-card-icon.c6, .mkp-detail-icon.c6, .ac-card-icon.c6, .res-detail-icon.c6 { background: linear-gradient(135deg, #4f46e5, #818cf8); }
.mkp-card-icon.c7, .mkp-detail-icon.c7, .ac-card-icon.c7, .res-detail-icon.c7 { background: linear-gradient(135deg, #db2777, #f472b6); }

.mkp-card-info {
  flex: 1;
  min-width: 0;
}

.mkp-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mkp-card-tagline {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mkp-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.mkp-card-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mkp-card-author-bottom {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: auto;
}

.mkp-card-time {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
  white-space: nowrap;
}

.mkp-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  line-height: 1.4;
}

/* 类型标签 */
.mkp-tag-type--skill { background: #e8f0fe; color: #1a73e8; }
.mkp-tag-type--knowledge { background: #e6f4ea; color: #137333; }
.mkp-tag-type--avatar { background: #fce7f3; color: #be185d; }

/* 来源标签 */
.mkp-tag-source--official { background: var(--primary-bg); color: var(--primary); }
.mkp-tag-source--mine { background: #fef3c7; color: #b45309; }
.mkp-tag-source--third_party { background: #f1f5f9; color: #64748b; }

/* 价格标签 */
.mkp-tag-price--free { background: var(--success-bg); color: var(--success); }
.mkp-tag-price--paid { background: var(--warning-bg); color: var(--warning); }

/* MCP 标签 */
.mkp-tag-type--mcp { background: #f3e8ff; color: #7c3aed; }

/* 详情面板内 badge 兼容 */
.mkp-card-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.mkp-card-badge.free { background: var(--success-bg); color: var(--success); }
.mkp-card-badge.paid { background: var(--warning-bg); color: var(--warning); }
.mkp-card-badge.official { background: var(--primary-bg); color: var(--primary); }

/* 详情面板 */
.mkp-detail-panel {
  flex: 1;
  margin: 5px;
  border-radius: 10px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 300px;
  position: relative;
}

.mkp-detail-header {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 40px 16px;
}

.mkp-detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 8px 16px;
}

.mkp-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.mkp-detail-close:hover {
  background: var(--hover-bg);
  color: var(--text);
}


.mkp-detail-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
}

.mkp-detail-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.mkp-detail-text {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  min-width: 0;
  flex: 1;
}

.mkp-detail-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mkp-detail-tagline {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mkp-detail-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.mkp-detail-section {
  margin-bottom: 20px;
}

.mkp-detail-section h4 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #f0f4ff, #f8fafc);
  border-radius: 6px;
}

.mkp-detail-section p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 10px;
}

.mkp-detail-list {
  list-style: none;
  padding: 0 0 0 10px;
  margin: 0;
}

.mkp-detail-list li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 4px 0;
}

.mkp-detail-footer {
  flex-shrink: 0;
  padding: 8px 12px 10px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--border-color);
}
.btn-mkp-detail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  height: 25px;
  box-sizing: border-box;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .1s;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.btn-mkp-detail:hover {
  background: var(--primary-hover);
}
.btn-mkp-detail.disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-mkp-detail-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  height: 25px;
  box-sizing: border-box;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.btn-mkp-detail-secondary:hover {
  background: var(--hover-bg);
  color: var(--text);
}

/* ── 资源视图切换按钮 ──────────────────────────────────── */

.res-view-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.res-view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  padding: 0;
}

.res-view-btn:hover {
  background: var(--hover-bg);
  color: var(--text);
}

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

.res-view-btn svg {
  width: 16px;
  height: 16px;
}

/* ── 资源卡片网格 ─────────────────────────────────────── */

.res-grid-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.res-grid-wrap::-webkit-scrollbar { display: none; }

.res-grid-wrap .mkp-grid-scroll {
  padding: 0 20px 12px;
}

/* ── 资源详情面板 ─────────────────────────────────────── */

.res-detail-panel {
  flex: 1;
  margin: 5px;
  border-radius: 10px;
  background: var(--card-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 300px;
  position: relative;
}

.res-detail-header {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 40px 16px;
}

.res-detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 8px 16px;
  scrollbar-width: none;
}
.res-detail-scroll::-webkit-scrollbar { display: none; }

.res-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.res-detail-close:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.res-detail-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
}

.res-detail-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.res-detail-text {
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  min-width: 0;
  flex: 1;
}

.res-detail-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-detail-tagline {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.res-detail-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.res-detail-section {
  margin-bottom: 20px;
}

.res-detail-section h4 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #f0f4ff, #f8fafc);
  border-radius: 6px;
}
.res-detail-section-header {
  padding: 6px 10px;
  background: linear-gradient(135deg, #f0f4ff, #f8fafc);
  border-radius: 6px;
  margin-bottom: 8px;
}
.res-detail-section-header h4 {
  margin-bottom: 0;
  padding: 0;
  background: none;
  border-radius: 0;
}

.res-detail-section p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 10px;
}

.res-detail-footer {
  flex-shrink: 0;
  padding: 8px 12px 10px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
}
.res-detail-footer-left {
  display: flex;
  gap: 4px;
}
.res-detail-footer-right {
  display: flex;
  gap: 4px;
}

/* 资源详情 icon 按钮 */
.res-detail-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.res-detail-btn:hover {
  background: var(--hover-bg);
  color: var(--text);
}
.res-detail-btn.disabled {
  color: #cbd5e1;
  cursor: not-allowed;
  pointer-events: none;
}
.res-detail-btn-danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

/* 黑底白字 tooltip */
.res-detail-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: 4px;
  background: #1e293b;
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}

/* 退出工作空间按钮 */
/* 退出工作空间/取消订阅按钮 — 固定底部，无hover浮层 */
.avd-exit-workspace {
  position: sticky; bottom: 0; z-index: 5;
  padding: 8px 16px 12px;
  background: var(--bg);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.avd-exit-workspace.hidden { display: none; }
.avd-exit-workspace-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px 0;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  color: rgba(239, 68, 68, 0.85);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.avd-exit-workspace-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.res-detail-files {
  list-style: none;
  padding: 0 0 0 10px;
  margin: 0;
}

.res-detail-files li {
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* 资源详情 - 可编辑字段 hover 提示 */
[data-editable]:not([data-editable=""]) {
  position: relative;
}
.res-editable-hover {
  outline: 2px dashed var(--primary);
  outline-offset: 4px;
  border-radius: 4px;
}

/* 资源详情 - 编辑浮层提示 */
.res-edit-tooltip {
  position: fixed;
  z-index: 999;
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* 资源详情 - 行内编辑输入框 */
.res-detail-edit-input {
  width: 100%;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  box-sizing: border-box;
}
.res-detail-edit-textarea {
  width: 100%;
  min-height: 60px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.6;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
}

/* 资源详情 - 列表编辑每行 */
.res-detail-edit-list-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 2px 0;
}
.res-detail-edit-list-item input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.res-detail-edit-list-item input:focus {
  border-color: var(--primary);
}

/* 收款码支付弹窗 */
.payment-modal-box {
  text-align: center;
  max-width: 360px;
}
.payment-qr-wrap {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
}

/* 空状态 */
.mkp-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── 账户管理 ──────────────────────────────────────────── */

/* 让左下角用户区域可点击 */
.base-nav .nav-user {
  cursor: pointer;
  transition: background .12s;
  border-radius: 8px;
  margin: 4px 8px 12px;
}
.base-nav .nav-user:hover {
  background: rgba(255, 255, 255, 0.08);
}
.base-nav .nav-user.active {
  background: rgba(255, 255, 255, 0.1);
}

#tab-account {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
#tab-account::-webkit-scrollbar { display: none; }

.account-container {
  width: 640px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

/* 头部卡片 */
.account-header-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 24px;
  background: linear-gradient(135deg, #f0f4ff 0%, #f8fafd 100%);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  margin-bottom: 24px;
}

.account-avatar-lg {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  cursor: pointer;
}

.account-avatar-text {
  position: relative;
  z-index: 1;
}

.account-avatar-lg .account-avatar-overlay {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 400;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}

.account-avatar-lg .account-avatar-overlay::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
}

.account-avatar-lg:hover .account-avatar-overlay {
  opacity: 1;
}

.account-header-info {
  flex: 1;
  min-width: 0;
}

.account-header-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.account-header-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  margin: 0;
}

.account-header-role {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 10px;
  border-radius: 10px;
}

.account-header-bio {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

/* 信息分区 */
.account-section {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}

.account-section-header {
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-section-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

/* 信息网格 */
.account-info-grid {
  padding: 0 20px 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.account-info-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}

/* 可编辑行 */
.account-info-editable {
  cursor: pointer;
  border-radius: 6px;
  padding: 10px 8px;
  margin: 0 -8px;
  transition: background .12s;
}
.account-info-editable:hover {
  background: #f8fafd;
}

/* 浮层提示 */
.account-info-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.account-info-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
}
.account-info-editable:hover .account-info-tooltip {
  opacity: 1;
}

/* 编辑模式 */
.account-info-editable.editing {
  background: #eff6ff;
  cursor: default;
}
.account-info-editable.editing .account-info-tooltip {
  display: none;
}
.account-info-editable.editing .account-info-value {
  display: none;
}

/* 行内编辑输入框 */
.account-info-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--primary);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 2px var(--primary-bg);
}
.account-info-item:last-child {
  border-bottom: none;
}

.account-info-label {
  width: 80px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.account-info-value {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}


/* 链接列表 */
.account-link-list {
  padding: 0 20px 14px;
}

.account-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-muted);
  transition: color .1s;
}
.account-link-item:last-child {
  border-bottom: none;
}
.account-link-item:hover {
  color: var(--primary);
}

.account-link-item-danger {
  color: var(--text-muted);
}
.account-link-item-danger:hover {
  color: #d97706;
}

.account-link-item-delete {
  color: var(--text-muted);
}
.account-link-item-delete:hover {
  color: #dc2626;
}

/* 危险操作分区 */
.account-section-danger {
  border-color: #fee2e2;
  background: #fefaf9;
}

/* ══════════════════════════════════════════════════════════════
   注册/登录页面 (auth.html)
   ══════════════════════════════════════════════════════════════ */

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f4ff 0%, #f8fafd 50%, #f0f4ff 100%);
  padding: 40px 20px;
}

.auth-container {
  width: 440px;
  max-width: 100%;
}

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

.auth-logo {
  font-size: 48px;
  margin-bottom: 12px;
}

.auth-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-muted);
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px 28px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.04);
}

/* Tab 按钮 */
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}

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

.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* 表单 */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.auth-form.active {
  display: flex;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.auth-field .required {
  color: var(--danger);
}

.auth-field input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}

.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.auth-btn {
  height: 42px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
  margin-top: 4px;
  letter-spacing: 2px;
}

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

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

.auth-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin: -4px 0 0;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
}

.auth-footer a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}

.auth-footer a:hover {
  color: var(--primary);
}

/* 验证码 */
.auth-captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-captcha-row input {
  flex: 1;
}

/* 身份选择 */
.auth-role-toggle {
  display: flex;
  gap: 8px;
}

.auth-role-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  background: #fafbfc;
}

.auth-role-option:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.auth-role-option.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 500;
}

.auth-role-option input {
  display: none;
}

/* Toast */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  transform: translateY(-20px);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-ok {
  background: var(--success);
}

.toast-err {
  background: var(--danger);
}

/* ══════════════════════════════════════════════════════════════
   欢迎页面（暗黑模式 + 翻页轮播）
   ══════════════════════════════════════════════════════════════ */

.welcome-body {
  min-height: 100vh;
  background: #08090d;
  color: #e1e1e6;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 背景光晕 */
.welcome-body::before {
  content: '';
  position: fixed;
  top: -40%;
  left: -20%;
  width: 140%;
  height: 140%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(37,99,235,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(99,102,241,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 80%, rgba(5,150,105,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── 顶部导航 ──────────────────────────────── */
.welcome-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
}

.welcome-logo {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

/* ── 轮播舞台 ──────────────────────────────── */
.welcome-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow: hidden;
}

.welcome-track {
  display: flex;
  width: 600%;  /* 6 slides */
  height: 100%;
  transition: transform 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}

.welcome-slide {
  width: calc(100% / 6);  /* exactly 1/6 of track */
  height: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 60px;
  padding-top: 200px;
}

/* ── 第1页 Hero ──────────────────────────────── */
.welcome-hero {
  text-align: center;
  max-width: 800px;
  padding: 0 40px;
}

.welcome-hero-title {
  font-size: clamp(80px, 12vw, 140px);
  font-weight: 800;
  color: #fff;
  letter-spacing: -3px;
  line-height: 1;
  margin-bottom: 28px;
}

.welcome-hero-tagline {
  font-size: 20px;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
  letter-spacing: 0.5px;
  line-height: 1.6;
}

/* ── 第2页 Feature 页（居中） ──────────────────── */
.welcome-feature {
  text-align: center;
  max-width: 620px;
}

.welcome-feature-icon {
  margin-bottom: 28px;
  display: inline-block;
}

.welcome-feature-title {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.welcome-feature-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.5);
  line-height: 1.8;
  margin-bottom: 28px;
}

.welcome-feature-desc strong {
  color: rgba(255,255,255,0.8);
  font-weight: 600;
}

.welcome-feature-tags {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.welcome-feature-tags span {
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
}

/* ── 第3-5页 左文右图 ────────────────────────── */
.welcome-split {
  display: flex;
  align-items: center;
  gap: 64px;
  max-width: 1040px;
  width: 100%;
  padding: 0 40px;
}

.welcome-split-text {
  flex: 0 0 400px;
}

.welcome-split-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 16px;
  background: rgba(37,99,235,0.12);
  border: 1px solid rgba(37,99,235,0.25);
  color: #60a5fa;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}

.welcome-split-title {
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin-bottom: 18px;
}

.welcome-split-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.45);
  line-height: 1.75;
  margin-bottom: 20px;
}

.welcome-split-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.welcome-split-list li {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  padding-left: 20px;
  position: relative;
  line-height: 1.6;
}

.welcome-split-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 6px rgba(59,130,246,0.4);
}

.welcome-split-visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-split-visual svg {
  width: 100%;
  max-width: 520px;
  height: auto;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.4));
}

.welcome-shot {
  width: 100%;
  max-width: 560px;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

/* ── 翻页箭头 ──────────────────────────────── */
.welcome-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  backdrop-filter: blur(10px);
  z-index: 5;
}

.welcome-arrow:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.25);
  color: #fff;
}

.welcome-arrow:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.welcome-arrow-left  { left: 24px; }
.welcome-arrow-right { right: 24px; }

/* ── 圆点指示器 ──────────────────────────────── */
.welcome-dots {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 5;
}

.welcome-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all .3s;
  padding: 0;
}

.welcome-dot.active {
  background: #3b82f6;
  box-shadow: 0 0 8px rgba(59,130,246,0.5);
  width: 24px;
  border-radius: 4px;
}

.welcome-dot:hover:not(.active) {
  background: rgba(255,255,255,0.4);
}

/* ── 底部 CTA ──────────────────────────────── */
.welcome-cta-bar {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 20px 0 36px;
}

.welcome-cta-btn {
  height: 46px;
  padding: 0 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 20px rgba(37,99,235,0.3);
}

.welcome-cta-btn:hover {
  box-shadow: 0 6px 28px rgba(37,99,235,0.45);
  transform: translateY(-1px);
}

.welcome-cta-hint {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

/* 响应式：小屏幕左文右图切换为上下布局 */
@media (max-width: 860px) {
  .welcome-hero-title {
    font-size: 56px;
    letter-spacing: -1px;
  }
  .welcome-hero-tagline {
    font-size: 16px;
  }
  .welcome-split {
    flex-direction: column;
    gap: 32px;
    padding: 20px 24px;
  }
  .welcome-split-text {
    flex: 0 0 auto;
    text-align: center;
    max-width: 100%;
  }
  .welcome-split-title {
    font-size: 26px;
  }
  .welcome-split-list li {
    text-align: left;
  }
  .welcome-shot {
    max-width: 100%;
  }
  .welcome-arrow {
    display: none;
  }
  .welcome-slide {
    padding: 0 20px;
  }
}

/* ══════════════════════════════════════════════════════════════
   暗黑模式 — 登录/注册弹框
   ══════════════════════════════════════════════════════════════ */

.welcome-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.welcome-modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.welcome-modal {
  position: relative;
  width: 420px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  background: #13151a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 32px 28px 28px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.welcome-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.welcome-modal-close:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
}

.welcome-modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-dark {
  font-size: 40px;
  margin-bottom: 8px;
}

.welcome-modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.welcome-modal-header p {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

/* Tab 按钮 — 暗黑 */
.auth-tabs-dark {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 4px;
}

.auth-tab-dark {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}

.auth-tab-dark:hover {
  color: rgba(255,255,255,0.7);
}

.auth-tab-dark.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* 表单 — 暗黑 */
.auth-form-dark {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.auth-form-dark.active {
  display: flex;
}

.auth-field-dark {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field-dark label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
}

.required-dark {
  color: #ef4444;
}

.auth-field-dark input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #e1e1e6;
  background: rgba(255,255,255,0.04);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}

.auth-field-dark input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.auth-field-dark input::placeholder {
  color: rgba(255,255,255,0.25);
}

.auth-captcha-row-dark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-captcha-row-dark input {
  flex: 1;
}

.auth-btn-dark {
  height: 42px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  margin-top: 2px;
  letter-spacing: 2px;
}

.auth-btn-dark:hover {
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}

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

.auth-hint-dark {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  margin: -2px 0 0;
}

/* ══════════════════════════════════════════════════════════════
   PC 端分身聊天界面 (chat.html)
   ══════════════════════════════════════════════════════════════ */

.chat-page-body {
  min-height: 100vh;
  display: flex;
  background: #f5f5f5;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 侧栏 */
.chat-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-header {
  padding: 20px 16px 12px;
  flex-shrink: 0;
}

.chat-sidebar-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.chat-sidebar-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.chat-sidebar-user {
  padding: 0 16px 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-user-info {
  flex: 1;
  min-width: 0;
}

.chat-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-user-id {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sidebar-search {
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.chat-sidebar-search input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #f9fafb;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}

.chat-sidebar-search input:focus {
  border-color: var(--primary);
  background: #fff;
}

.chat-sidebar-search input::placeholder {
  color: var(--text-muted);
}

.chat-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
  scrollbar-width: none;
}

.chat-sidebar-list::-webkit-scrollbar { display: none; }

.chat-sidebar-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background .12s;
}

.chat-sidebar-item:hover {
  background: #f3f4f6;
}

.chat-sidebar-item.active {
  background: #eff6ff;
}

.chat-sidebar-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-sidebar-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 主聊天区 */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #f5f5f5;
}

/* 空状态 */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
}

.chat-empty-icon {
  font-size: 56px;
  opacity: 0.6;
}

.chat-empty h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.chat-empty p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  max-width: 320px;
  text-align: center;
  line-height: 1.6;
}

/* 头部栏 */
.chat-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.chat-topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.chat-topbar-info {
  flex: 1;
  min-width: 0;
}

.chat-topbar-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.chat-topbar-desc {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-topbar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* 消息列表 */
.chat-msgs-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: none;
}

.chat-msgs-wrap::-webkit-scrollbar { display: none; }

.chat-msg-row {
  max-width: 720px;
  margin: 0 auto 16px;
  display: flex;
  flex-direction: column;
}

.chat-msg-row.user-row {
  align-items: flex-end;
}

.chat-msg-row.ai-row {
  align-items: flex-start;
}

.chat-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  word-wrap: break-word;
}

.user-row .chat-msg-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-row .chat-msg-bubble {
  background: #fff;
  border: 1px solid var(--border-light);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  padding: 0 4px;
}

.user-row .chat-msg-label {
  text-align: right;
}

/* 消息内 Markdown */
.chat-msg-bubble p { margin: 0 0 4px; }
.chat-msg-bubble p:last-child { margin-bottom: 0; }
.chat-msg-bubble pre {
  background: rgba(0,0,0,0.06);
  padding: 8px 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0;
}
.chat-msg-bubble code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
}
.chat-msg-bubble ul, .chat-msg-bubble ol {
  margin: 4px 0;
  padding-left: 18px;
}

/* 输入区 */
.chat-input-wrap {
  flex-shrink: 0;
  padding: 14px 20px 20px;
  background: #f5f5f5;
}

.chat-input-row {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 8px 6px 14px;
  transition: border-color .15s;
}

.chat-input-row:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.chat-input-row textarea {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  min-height: 24px;
  padding: 4px 0;
}

.chat-input-row textarea::placeholder {
  color: var(--text-muted);
}

.chat-input-file-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 16px;
  transition: all .15s;
  line-height: 1;
}

.chat-input-file-btn:hover {
  color: var(--primary);
  background: var(--primary-bg);
}

.chat-input-send-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.chat-input-send-btn:hover {
  background: var(--primary-hover);
}

.chat-input-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 文件标签 */
.chat-files-row {
  max-width: 720px;
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-files-row:empty { display: none; }

.chat-file-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: #e8eaed;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text);
  cursor: default;
}

.chat-file-tag .rm-file {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
}

.chat-file-tag .rm-file:hover {
  color: var(--danger);
}

/* 系统消息 */
.chat-sys-msg {
  text-align: center;
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto;
}

/* ══════════════════════════════════════════════════════════════
   分享弹框 (兼容已有 .modal-overlay 体系)
   ══════════════════════════════════════════════════════════════ */

/* 分享弹框 overlay 提升 z-index，靠 .show 控制显隐 */
#modal-share.modal-overlay {
  z-index: 5000;
  background: rgba(0,0,0,0.4);
}

#modal-share .modal {
  position: relative;
  border-radius: 14px;
  padding: 28px 28px 24px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

#modal-share .modal h3 {
  font-size: 18px;
  margin: 0 0 8px;
}

#modal-share .modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

.modal-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-link-input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--text);
  background: #f9fafb;
  outline: none;
  box-sizing: border-box;
  user-select: all;
}

.modal-copy-btn {
  height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
}

.modal-copy-btn:hover {
  background: var(--primary-hover);
}

.modal-copy-btn.copied {
  background: var(--success);
}

.modal-open-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
  transition: color .15s;
}

.modal-open-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* toast 通用样式增强 */
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── 定时任务结果展示区 ─────────────────── */
.cron-result-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  position: relative;
}
.cron-result-area.hidden { display: none; }
/* 顶部任务详情卡片 */
.cron-result-jobcard {
  width: 720px;
  flex-shrink: 0;
  background: transparent;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
}
.cron-result-jobcard .jobcard-name {
  font-size: 14px; font-weight: 600; color: #1f2937;
  margin-bottom: 10px;
  padding-right: 50px;
}
.cron-result-jobcard .jobcard-info {
  margin-bottom: 10px;
  padding-right: 50px;
}
.cron-result-jobcard .jobcard-info-row {
  font-size: 11px; color: #9ca3af;
  line-height: 1.6;
}
.cron-result-jobcard .jobcard-info-label {
  color: #6b7280;
  font-weight: 600;
}
.cron-result-jobcard .jobcard-info-icon {
  display: inline-flex;
  align-items: center;
  color: #9ca3af;
  vertical-align: -2px;
  margin-right: 2px;
}
.cron-result-jobcard .jobcard-detail { transition: max-height .25s ease, opacity .25s ease; }
.cron-result-jobcard .jobcard-detail.collapsed { max-height: 0; opacity: 0; overflow: hidden; }
.cron-result-jobcard .jobcard-collapse-btn { margin-right: 4px; }
.cron-result-jobcard .jobcard-desc {
  font-size: 12px; color: #6b7280;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}
.cron-result-jobcard .jobcard-edit {
  position: absolute;
  right: 12px; top: 12px;
  opacity: 0; transition: opacity .15s;
  display: flex; align-items: center; gap: 10px;
}
.cron-result-jobcard:hover .jobcard-edit { opacity: 1; }
.cron-result-jobcard .jobcard-edit-btn {
  position: relative;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.cron-result-jobcard .jobcard-edit-btn:hover { background: #f3f4f6; }
.cron-result-jobcard .jobcard-edit-tip {
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.cron-result-jobcard .jobcard-edit-btn:hover .jobcard-edit-tip { opacity: 1; }

/* 主体：左侧导航 + 右侧展示 */
.cron-result-body {
  display: flex;
  gap: 10px;
  width: 720px;
  flex: 1;
  min-height: 0;
}

/* 左侧导航列表 */
.cron-result-nav {
  width: 175px;
  flex-shrink: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  border-radius: 10px;
  padding: 8px;
}
.cron-result-nav::-webkit-scrollbar { display: none; }
.cron-result-nav-item {
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cron-result-nav-item:hover,
.cron-result-nav-item.active {
  background: var(--border-light);
  color: var(--text);
}

/* 右侧结果展示区 */
.cron-result-content {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: visible;
}

.cron-result-msg-card {
  background: transparent;
  border-radius: 10px;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}
.cron-result-msg-card .msg-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 2px;
  min-height: 0;
}
.cron-result-msg-card .msg-body::-webkit-scrollbar { display: none; }
.cron-result-msg-card .msg-time {
  font-size: 10px;
  color: #999;
  margin-bottom: 6px;
}
.cron-result-msg-card .msg-body p { margin: 0 0 6px; }
.cron-result-msg-card .msg-body h1 { font-size: 18px; font-weight: 700; margin: 16px 0 8px; color: #111; }
.cron-result-msg-card .msg-body h2 { font-size: 16px; font-weight: 600; margin: 14px 0 6px; color: #1f2937; }
.cron-result-msg-card .msg-body h3 { font-size: 14px; font-weight: 600; margin: 12px 0 4px; color: #374151; }
.cron-result-msg-card .msg-body h4 { font-size: 13px; font-weight: 600; margin: 10px 0 4px; color: #4b5563; }
.cron-result-msg-card .msg-body h5 { font-size: 12px; font-weight: 600; margin: 8px 0 4px; color: #6b7280; }
.cron-result-msg-card .msg-body h6 { font-size: 12px; font-weight: 500; margin: 8px 0 4px; color: #9ca3af; }
.cron-result-msg-card .msg-body blockquote {
  border-left: 3px solid #d1d5db;
  padding: 6px 12px;
  margin: 8px 0;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 0 4px 4px 0;
}
.cron-result-msg-card .msg-body blockquote p { margin: 0; }
.cron-result-msg-card .msg-body pre {
  background: #f9fafb;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  overflow-x: auto;
}
.cron-result-msg-card .msg-actions {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  opacity: 0; transition: opacity .15s;
}
.cron-result-msg-card:hover .msg-actions { opacity: 1; }
.cron-result-msg-card .msg-action-btn {
  position: relative;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.cron-result-msg-card .msg-action-btn:hover { background: #f3f4f6; }
.cron-result-msg-card .msg-action-btn .msg-action-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 9999;
}
.cron-result-msg-card .msg-action-btn:hover .msg-action-tip { opacity: 1; }
.cron-result-msg-card .msg-doc-btn {
  color: #374151;
  margin-right: auto;
  padding: 3px 8px;
  gap: 4px;
}
.cron-result-msg-card .msg-doc-btn:hover { background: #f3f4f6; color: #111827; }
/* 正文顶部文档横幅（generate_doc 任务自动生成的文档） */
.cron-doc-banners {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.cron-doc-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f0f7ff;
  border: 1px solid #d0e3f7;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
  font-size: 13px;
  color: #2563eb;
}
.cron-doc-banner:hover { background: #e0efff; }
.cron-doc-banner .cron-doc-banner-name {
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cron-result-msg-card .msg-action-disabled {
  color: #d1d5db !important;
  cursor: not-allowed;
  pointer-events: none;
}
.cron-result-msg-card .msg-action-disabled:hover { background: transparent; }
.cron-result-msg-card .msg-action-delete:hover { background: #fef2f2; color: #ef4444; }
.cron-result-msg-card .msg-action-delete:hover .msg-action-tip { background: #dc2626; }

/* 暂停水印 — 列表项 */
.list-item-watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  font-size: 28px; font-weight: 900; color: #ef4444;
  opacity: 0.18; pointer-events: none; white-space: nowrap;
  z-index: 0;
}
.assistant-history-item.paused { position: relative; overflow: hidden; }

/* 暂停水印 — 任务详情卡片 */
.jobcard-watermark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  font-size: 42px; font-weight: 900; color: #ef4444;
  opacity: 0.15; pointer-events: none; white-space: nowrap;
  z-index: 2;
}

/* Markdown 链接 */
.md-link {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-all;
}
.md-link:hover { color: #1d4ed8; }

/* 会话历史中的定时任务标记 */
.assistant-history-item.history-suspended {
  background: rgba(99, 102, 241, 0.04);
}

.cron-result-empty {
  text-align: center;
  color: #999;
  font-size: 13px;
  padding: 40px 0;
}

/* Cron 结果中的文档链接 */
