/*
 * 声客 v2 通用组件样式 (shadcn/ui 风格)
 * 依赖: tokens.css
 *
 * 使用约定：
 * - 所有颜色通过 hsl(var(--xxx)) 引用，方便暗色模式自动切换
 * - 圆角、阴影、间距全部走 token，禁止硬编码 px 值
 * - 组件层级：base → layout → components → pages
 * - v5.0.42+ 新增 `.upload-area--compact`：表单内嵌上传区紧凑三段式（图标 + hint/sub + action）
 */

.emotion-section { margin-top: 2px; }
.emotion-strip { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid hsl(var(--border)); border-radius: var(--radius-md); background: hsl(var(--background) / 0.45); }
.emotion-strip-icon { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto; border-radius: var(--radius-md); color: hsl(var(--brand-700)); background: hsl(var(--brand-50)); }
.emotion-main { min-width: 0; flex: 1 1 0; }
.emotion-title { font-size: 0.82rem; font-weight: 600; }
.emotion-detail { margin-top: 2px; overflow: hidden; color: hsl(var(--muted-foreground)); font-size: 0.74rem; text-overflow: ellipsis; white-space: nowrap; }
.emotion-select { width: 220px; height: 34px; padding: 0 9px; border: 1px solid hsl(var(--input)); border-radius: var(--radius-md); color: hsl(var(--foreground)); background: hsl(var(--background)); font-size: 0.78rem; }
.emotion-select:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.advanced-toggle { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; padding: 2px 0; color: hsl(var(--brand-700)); font-size: 0.75rem; font-weight: 600; }
.advanced-toggle svg { transition: transform 120ms ease; }
.advanced-toggle.open svg { transform: rotate(180deg); }
.advanced { margin-top: 9px; padding: 12px; border: 1px solid hsl(var(--brand-100)); border-radius: var(--radius-md); background: hsl(var(--brand-50) / 0.45); }
.advanced[hidden] { display: none; }
.advanced-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; color: hsl(var(--muted-foreground)); font-size: 0.72rem; }
.advanced-title { color: hsl(var(--foreground)); font-weight: 600; }
.advanced-hint { color: hsl(var(--muted-foreground)); }
.slider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 22px; }
.emo-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 46px; align-items: center; gap: 8px; min-width: 0; }
.emo-label { color: hsl(var(--muted-foreground)); font-size: 0.72rem; }
.emo-row input[type="range"] { width: 100%; min-width: 0; height: 16px; margin: 0; accent-color: hsl(var(--brand)); cursor: pointer; appearance: none; background: transparent; }
.emo-row input[type="range"]::-webkit-slider-runnable-track { height: 2px; border-radius: 999px; background: hsl(var(--border)); }
.emo-row input[type="range"]::-webkit-slider-thumb { width: 10px; height: 10px; margin-top: -4px; border: 2px solid hsl(var(--background)); border-radius: 50%; background: hsl(var(--brand)); box-shadow: 0 0 0 1px hsl(var(--brand)); appearance: none; }
.emo-row input[type="range"]::-moz-range-track { height: 2px; border-radius: 999px; background: hsl(var(--border)); }
.emo-row input[type="range"]::-moz-range-progress { height: 2px; border-radius: 999px; background: hsl(var(--brand)); }
.emo-row input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid hsl(var(--background)); border-radius: 50%; background: hsl(var(--brand)); box-shadow: 0 0 0 1px hsl(var(--brand)); }
.emo-row input[type="range"]:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; }
.emo-value { width: 42px; padding: 2px 4px; border-radius: 4px; color: hsl(var(--brand-700)); background: hsl(var(--background)); font-family: var(--font-mono); font-size: 0.75rem; text-align: center; }
.vector-line { display: flex; align-items: center; justify-content: flex-start; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px solid hsl(var(--brand-100)); color: hsl(var(--muted-foreground)); font-family: var(--font-mono); font-size: 0.75rem; }
.emo-summary { min-width: 0; overflow-wrap: anywhere; color: hsl(var(--brand-700)); font-weight: 600; }
.emo-range-hint { margin-left: auto; flex: 0 0 auto; color: hsl(var(--muted-foreground)); }
@media (max-width: 640px) {
  .emotion-strip { align-items: flex-start; flex-wrap: wrap; }
  .emotion-select { width: calc(100% - 40px); margin-left: 40px; }
  .slider-grid { grid-template-columns: 1fr; }
  .vector-line { align-items: flex-start; flex-direction: column; gap: 4px; }
  .emo-range-hint { margin-left: 0; }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font-sans);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 200ms, color 200ms;
}
button { font-family: inherit; cursor: pointer; border: none; background: transparent; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
code, pre { font-family: var(--font-mono); }

/* 焦点环（仅键盘） */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Layout: 侧栏 + 主区
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* —— 侧栏 —— */
.sidebar {
  width: var(--sidebar-width);
  /* 暖底统一：不再叠白色玻璃，与 body 同一片暖底融合（侧栏仅靠 1px 浅边线区分） */
  background: transparent;
  border-right: 1px solid hsl(var(--border) / 0.55);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid hsl(var(--border));
}
.sidebar-logo {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidebar-brand-name { font-size: 1rem; font-weight: 700; }
.sidebar-brand-tag { font-size: 0.7rem; color: hsl(var(--muted-foreground)); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar-nav-section {
  font-size: 0.7rem; font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer;
  width: 100%; text-align: left;
  position: relative;
  transition: background 120ms, color 120ms;
  margin-bottom: 2px;
}
.nav-item:hover { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.nav-item.active {
  background: hsl(var(--brand-50));
  color: hsl(var(--brand-700));
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  background: hsl(var(--brand-500));
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 0 1px hsl(var(--background) / 0.6);
}
.nav-item-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item-badge {
  margin-left: auto;
  font-size: 0.65rem; font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: hsl(var(--brand-100));
  color: hsl(var(--brand-700));
}

.sidebar-footer {
  border-top: 1px solid hsl(var(--border));
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
  border-radius: var(--radius-md);
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--accent-purple)), hsl(var(--accent-blue)));
  color: white;
  display: grid; place-items: center;
  font-weight: 600; font-size: 0.8rem;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; }
.sidebar-user-credit { font-size: 0.7rem; color: hsl(var(--muted-foreground)); }

.sidebar-actions { display: flex; gap: 4px; }
.sidebar-actions .btn-icon { width: 32px; height: 32px; }

/* —— 顶栏 —— */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.main-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
  min-height: var(--header-height);
  width: 100%;
}
.page-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.page-title { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.page-title-icon { width: 18px; height: 18px; color: hsl(var(--muted-foreground)); }
.page-subtitle { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.header-actions { display: flex; gap: 6px; align-items: center; }

.main-content {
  flex: 1; padding: 24px 32px 48px;
  width: 100%;
}

/* ============================================================
   Card
   ============================================================ */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}
.card-body:first-child { border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); }
.card-body:last-child { border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }
.card-title { font-size: 0.95rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title-icon { width: 16px; height: 16px; color: hsl(var(--muted-foreground)); }
.card-body { padding: 18px; }
.card + .card { margin-top: 14px; }

/* ============================================================
   Button
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  border: 1px solid transparent;
  transition: background 120ms, color 120ms, border-color 120ms, transform 60ms, box-shadow 120ms, filter 120ms;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: hsl(var(--brand-500));
  color: hsl(var(--brand-foreground));
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover:not(:disabled) { background: hsl(var(--brand-600)); filter: brightness(1.02); }

.btn-secondary {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
.btn-secondary:hover:not(:disabled) { background: hsl(var(--muted) / 0.8); }

.btn-outline {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
.btn-outline:hover:not(:disabled) { background: hsl(var(--muted)); border-color: hsl(var(--foreground) / 0.2); }

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground));
}
.btn-ghost:hover:not(:disabled) { background: hsl(var(--muted)); }

.btn-destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}
.btn-destructive:hover:not(:disabled) { filter: brightness(0.92); }

.btn-link {
  background: transparent;
  color: hsl(var(--brand-600));
  height: auto; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:hover:not(:disabled) { color: hsl(var(--brand-700)); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 0.8rem; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 0.95rem; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* 按钮组：同一容器内多个 .btn 共享一个边框，shadcn 风格 segmented control */
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 1px hsl(var(--border));
}
.btn-group > .btn {
  border-radius: 0;
  border: 0;
  border-left: 1px solid hsl(var(--border));
  height: 32px;
  padding: 0 10px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}
.btn-group > .btn:first-child { border-left: 0; }
.btn-group > .btn:first-child { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.btn-group > .btn:last-child  { border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.btn-group > .btn:hover:not(:disabled) { background: hsl(var(--muted)); }
.btn-group-sm > .btn { height: 28px; padding: 0 8px; font-size: 0.78rem; }
.btn-group-sm > .btn .icon { width: 14px; height: 14px; }
/* 危险图标按钮：仅图标变红，hover 加浅红背景 */
.btn-destructive-icon { color: hsl(var(--destructive)) !important; }
.btn-destructive-icon:hover:not(:disabled) { background: hsl(var(--destructive) / 0.1) !important; color: hsl(var(--destructive)) !important; }

/* 渐变 CTA（用于"开始合成"主按钮） */
.cta-gradient {
  background: linear-gradient(135deg, hsl(var(--brand-500)) 0%, hsl(var(--brand-600)) 100%);
  color: white;
  height: 48px; padding: 0 32px;
  border-radius: var(--radius-md);
  font-weight: 600; font-size: 0.95rem;
  border: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--shadow-brand);
  transition: transform 80ms, box-shadow 120ms, filter 120ms;
}
.cta-gradient:hover:not(:disabled) { filter: brightness(1.05); box-shadow: 0 12px 28px -4px hsl(24 95% 53% / 0.35); }
.cta-gradient:active:not(:disabled) { transform: translateY(1px); }
.cta-gradient:disabled { opacity: 0.5; cursor: not-allowed; }
.cta-gradient .icon { width: 16px; height: 16px; }

/* ============================================================
   Form
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.label {
  font-size: 0.8rem; font-weight: 500;
  color: hsl(var(--foreground));
}
.help { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }

.input, .textarea, .select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  /* 半透白：透出 body 暖底（v2 再调淡，保留输入框与暖底的层次对比） */
  background: hsl(var(--background) / 0.4);
  backdrop-filter: blur(2px);
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: border-color 120ms, box-shadow 120ms, background 120ms;
}
.input:hover, .textarea:hover, .select:hover { background: hsl(var(--background) / 0.55); }
.input:focus, .textarea:focus, .select:focus {
  background: hsl(var(--background) / 0.7);
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground)); }
.input.has-error, .textarea.has-error, .select.has-error { border-color: hsl(var(--destructive)); }
.input.has-error:focus, .textarea.has-error:focus, .select.has-error:focus {
  box-shadow: 0 0 0 3px hsl(var(--destructive) / 0.15);
}
.error-msg {
  font-size: 0.75rem; color: hsl(var(--destructive));
  display: flex; align-items: center; gap: 4px;
}
.error-msg .icon { width: 12px; height: 12px; flex-shrink: 0; }

.textarea { height: auto; padding: 12px; line-height: 1.6; resize: vertical; min-height: 120px; font-family: inherit; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}
.select.has-value { color: hsl(var(--foreground)); }
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

/* ============================================================
   Chip / Badge
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 500;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip .icon { width: 10px; height: 10px; flex-shrink: 0; }

.chip-brand { background: hsl(var(--brand-50)); color: hsl(var(--brand-700)); }
.chip-blue { background: hsl(var(--accent-blue-50)); color: hsl(var(--accent-blue-700)); }
.chip-purple { background: hsl(var(--accent-purple-50)); color: hsl(var(--accent-purple-700)); }
.chip-teal { background: hsl(var(--accent-teal-50)); color: hsl(var(--accent-teal-700)); }
.chip-amber { background: hsl(var(--accent-amber-50)); color: hsl(var(--accent-amber-700)); }
.chip-success { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); }
.chip-warning { background: hsl(var(--warning) / 0.15); color: hsl(var(--warning)); }
.chip-danger { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }
.chip-info { background: hsl(var(--info) / 0.12); color: hsl(var(--info)); }

/* ============================================================
   Tag button（情绪/语态 选择）
   ============================================================ */
.tag-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid hsl(var(--border));
  border-radius: var(--radius-md);
  background: hsl(var(--background));
  font-size: 0.8rem; font-weight: 500;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: all 120ms;
}
.tag-btn:hover { border-color: hsl(var(--brand-300)); background: hsl(var(--brand-50)); }
.tag-btn.active {
  border-color: hsl(var(--brand-500));
  background: hsl(var(--brand-50));
  color: hsl(var(--brand-700));
  font-weight: 600;
  transform: scale(1.02);
}
.tag-btn .emoji { font-size: 1rem; line-height: 1; }
.tag-btn.active::after {
  content: '✓';
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: hsl(var(--brand-500));
  color: white;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 0 0 2px hsl(var(--card));
}
.tag-btn { position: relative; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: flex; flex-direction: row; gap: 4px;
}
.tab {
  background: transparent; border: none;
  padding: 7px 14px;
  font-size: 0.8125rem; font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  border-left: 3px solid transparent;
  border-radius: var(--radius-md);
  transition: color 120ms, background 120ms, border-color 120ms;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.tab:hover { color: hsl(var(--foreground)); background: hsl(var(--muted)); }
/* 历史记录页 tab 选中态：左侧 3px 橙色竖条 + 浅橙底 + 橙色字（与侧栏 nav-item.active 同语言，首屏有明确指示） */
.tab.active {
  color: hsl(var(--brand-700));
  background: hsl(var(--brand-50));
  border-left-color: hsl(var(--brand-500));
  font-weight: 600;
}
.icon-sm { width: 14px; height: 14px; flex-shrink: 0; }

/* ============================================================
   Table
   ============================================================ */
.table-wrap {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table.t { width: 100%; border-collapse: collapse; }
.t th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem; font-weight: 600;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.5);
  border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap;
}
.t td {
  padding: 12px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
}
.t tr:last-child td { border-bottom: none; }
.t tbody tr { transition: background 80ms; }
.t tbody tr:hover { background: hsl(var(--muted) / 0.4); }
.t .num-cell { color: hsl(var(--muted-foreground)); width: 40px; font-family: var(--font-mono); }
.t .text-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   v5.0.31: 历史记录里 [xxx] 氛围标签 chip
   ============================================================ */
.history-vibe-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 500;
  color: hsl(24 95% 38%);
  background: hsl(24 95% 95%);
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 4px;
  margin-bottom: 2px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: baseline;
  border: 1px solid hsl(24 90% 85%);
}
.history-table td.text-cell {
  white-space: normal;
  line-height: 1.5;
}
.t .time-cell { color: hsl(var(--muted-foreground)); white-space: nowrap; font-size: 0.78rem; }
.t .time-cell small { display: block; font-size: 0.7rem; margin-top: 1px; }
.t .credits-cell { font-weight: 600; white-space: nowrap; }
.t .credits-cell.positive { color: hsl(var(--success)); }
.t .credits-cell.negative { color: hsl(var(--destructive)); }
.t code {
  font-family: var(--font-mono); font-size: 0.72rem;
  padding: 2px 6px; background: hsl(var(--muted));
  border-radius: 4px;
}

/* 分页器 */
.pagination {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.3);
}
.pagination-info { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.pagination-controls { display: flex; gap: 8px; align-items: center; }
.pagination-controls .text-sm { font-size: 0.85rem; color: hsl(var(--muted-foreground)); }

/* ============================================================
   Player
   ============================================================ */
.player {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  background: hsl(var(--muted) / 0.4);
  border-radius: var(--radius-lg);
  border: 1px solid hsl(var(--border));
}
.player-art {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, hsl(var(--brand-400)), hsl(var(--brand-700)));
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.player-art svg { width: 28px; height: 28px; color: white; }
.player-body { flex: 1; min-width: 0; }
.player-meta {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.78rem; color: hsl(var(--muted-foreground));
  margin-bottom: 8px;
}
.player-meta .label { font-weight: 500; color: hsl(var(--foreground)); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-meta .time { font-family: var(--font-mono); white-space: nowrap; }
.player-track { height: 4px; background: hsl(var(--border)); border-radius: 2px; overflow: hidden; }
.player-fill { height: 100%; width: 0; background: hsl(var(--brand-500)); border-radius: 2px; transition: width 0.1s linear; }
.player-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ============================================================
   Voice card grid (v5.0.34: 纯文字卡 — 名字为主，其他为次)
   ============================================================ */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.voice-card {
  padding: 12px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  /* v5.0.35: 静态态加极淡 brand-50 tint（4%）让卡片有"被管理"的资产底色，不抢戏 */
  background: hsl(var(--brand-50) / 0.35);
  display: flex; align-items: center; gap: 10px;
  transition: border-color 120ms, background 120ms;
}
.voice-card:hover {
  border-color: hsl(var(--brand-300));
  background: hsl(var(--brand-50) / 0.6);
}
.voice-card.is-playing {
  border-color: hsl(var(--brand-500));
  background: hsl(var(--brand-100) / 0.5);
}
.voice-card.is-playing .voice-play-btn { background: hsl(var(--brand-500)); color: white; border-color: hsl(var(--brand-500)); }

.voice-info { min-width: 0; flex: 1; }
.voice-name {
  font-size: 0.95rem; font-weight: 600;
  color: hsl(var(--foreground));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: 0.01em;
}
.voice-meta {
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground));
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.voice-play-btn {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.voice-play-btn:hover { color: hsl(var(--brand-500)); border-color: hsl(var(--brand-300)); }

.voice-card-actions {
  flex-shrink: 0;
  display: flex; gap: 2px;
  opacity: 0;
  transition: opacity 120ms;
}
.voice-card:hover .voice-card-actions,
.voice-card.is-playing .voice-card-actions { opacity: 1; }

/* ============================================================
   Digital Human Assets (v5.0.16) — 9:16 大封面竖版卡片
   ============================================================ */
.dha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 10px;
}
.dha-card {
  display: flex;
  flex-direction: column;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--card));
  overflow: hidden;
  transition: border-color 160ms, box-shadow 160ms, transform 160ms;
  cursor: pointer;
}
.dha-card:hover {
  border-color: hsl(var(--brand-300));
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.dha-cover {
  position: relative;
  aspect-ratio: 9 / 16;
  background: linear-gradient(135deg, hsl(271 81% 56%), hsl(217 91% 60%));
  overflow: hidden;
}
.dha-cover-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.dha-cover-fallback {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 2.5rem;
  background: linear-gradient(135deg, hsl(271 81% 56%), hsl(217 91% 60%));
}
.dha-cover-duration {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  font-family: var(--font-mono);
}
/* 底部信息条覆盖在封面上，与时长 pill 风格一致 */
.dha-cover-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 22px 8px 8px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.65));
  color: white;
  display: flex; flex-direction: column; gap: 1px;
  pointer-events: none;
}
.dha-cover-name {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dha-cover-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  opacity: 0.85;
}
.dha-cover-desc {
  font-size: 10px;
  opacity: 0.8;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.dha-cover-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity 160ms;
}
.dha-card:hover .dha-cover-overlay { opacity: 1; }
.dha-actions {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  justify-content: flex-end;
}
.dha-actions > .btn { flex: 1; min-width: 0; padding: 0; height: 28px; justify-content: center; }
.dha-actions > .btn .icon { width: 14px; height: 14px; }
.dha-actions > .btn.btn-destructive-icon { flex: 0 0 28px; padding: 0; }

@media (max-width: 700px) {
  .dha-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 420px) {
  .dha-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Synthesize result card (v5.0.50 单卡)
   ============================================================ */
.card-header .result-header-actions { display: inline-flex; align-items: center; gap: 8px; }
#resultTitle + .chip { margin-left: 6px; }
.chip-error { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }

/* ============================================================
   Alert
   ============================================================ */
.alert {
  display: flex; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 0.85rem;
  align-items: flex-start;
}
.alert-icon { flex-shrink: 0; margin-top: 1px; width: 16px; height: 16px; }
.alert-text { color: hsl(var(--foreground)); }
.alert-info {
  background: hsl(var(--info) / 0.08);
  border-color: hsl(var(--info) / 0.25);
  color: hsl(var(--info));
}
.alert-warning {
  background: hsl(var(--warning) / 0.08);
  border-color: hsl(var(--warning) / 0.3);
  color: hsl(var(--warning-foreground));
}
[data-theme="dark"] .alert-warning { color: hsl(var(--warning)); }
.alert-success {
  background: hsl(var(--success) / 0.08);
  border-color: hsl(var(--success) / 0.25);
  color: hsl(var(--success));
}
.alert-danger {
  background: hsl(var(--destructive) / 0.08);
  border-color: hsl(var(--destructive) / 0.25);
  color: hsl(var(--destructive));
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 200ms ease-out;
}
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.6); }

.modal-card {
  position: relative;
  background: hsl(var(--card));
  border-radius: var(--radius-lg);
  border: 1px solid hsl(var(--border));
  box-shadow: var(--shadow-lg);
  max-width: 480px; width: 100%;
  animation: modal-in 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-card-lg { max-width: 720px; }
.modal-card-xl { max-width: 900px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.modal-title-icon { width: 16px; height: 16px; color: hsl(var(--muted-foreground)); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid hsl(var(--border));
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.modal-footer-left { display: flex; gap: 6px; }

/* ============================================================
   v5.0.41: 录入声纹 modal — 对齐设计系统
   视觉语言：暖橙品牌色 + shadcn 中性灰 + 紧凑间距
   ============================================================ */
.record-steps {
  display: flex; align-items: center; gap: 0;
  font-size: 0.74rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 16px;
}
.record-step {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: hsl(var(--muted-foreground));
  position: relative;
  transition: all 160ms;
}
.record-step.active {
  color: hsl(var(--brand-700));
  font-weight: 600;
}
.record-step.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 2px; height: 14px;
  background: hsl(var(--brand-500));
  border-radius: 0 2px 2px 0;
}
.record-step-num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 0.7rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.record-step.active .record-step-num {
  background: hsl(var(--brand-500));
  color: hsl(var(--brand-foreground));
}
.record-step-sep { flex: 1; height: 1px; background: hsl(var(--border)); margin: 0 4px; }

.record-sample {
  padding: 12px 14px;
  background: hsl(var(--muted));
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.record-sample-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.record-sample-label {
  font-size: 0.72rem; font-weight: 600;
  color: hsl(var(--muted-foreground));
  display: inline-flex; align-items: center; gap: 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.record-sample-label svg { width: 13px; height: 13px; }
.record-sample-text {
  font-size: 0.95rem; line-height: 1.7;
  color: hsl(var(--foreground));
  min-height: 2.4em;
}
.record-sample-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  display: flex; flex-wrap: wrap; gap: 4px 12px;
}
.record-sample-hint .quote {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
}

.record-controls {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 14px 0 12px;
}
.record-timer {
  font-family: var(--font-mono);
  font-size: 1.1rem; font-weight: 600;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
  min-width: 5ch;
  text-align: center;
  letter-spacing: 0.02em;
}
.record-timer.recording { color: hsl(var(--destructive)); }

.record-status {
  text-align: center;
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
  min-height: 1.4em;
  margin-bottom: 12px;
}
.record-status[data-tone="success"] { color: hsl(var(--success)); }
.record-status[data-tone="error"] { color: hsl(var(--destructive)); }

.record-preview-bar {
  display: flex; align-items: center; gap: 8px;
  background: hsl(var(--muted));
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 12px;
  margin-bottom: 12px;
}
.record-preview-player {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
}
.record-preview-icon {
  width: 16px; height: 16px;
  color: hsl(var(--brand-500));
  flex-shrink: 0;
}
.record-preview-player audio { flex: 1; min-width: 0; height: 32px; }

.record-save-btn {
  width: 100%;
  padding: 10px 14px;
  font-weight: 600;
}

.record-name-field { margin-top: 16px; }

/* 录音中：主按钮变 outline + destructive，强调"按一下停" */
#recordBtn.recording {
  background: hsl(var(--background));
  color: hsl(var(--destructive));
  border: 1px solid hsl(var(--destructive));
}
#recordBtn.recording:hover { background: hsl(var(--destructive) / 0.06); }
#recordBtn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   v5.0.27: 声纹选择 picker（简化：单列表 + 行内试听按钮）
   ============================================================ */
.voice-picker-empty {
  padding: 24px 12px;
  text-align: center;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
}
.voice-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 120ms;
}
.voice-picker-item:hover {
  background: hsl(var(--muted) / 0.6);
}
.voice-picker-play {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: hsl(var(--brand-500));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms;
}
.voice-picker-play:hover {
  background: hsl(var(--brand-600));
}
.voice-picker-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.voice-picker-name {
  font-size: 13px;
  font-weight: 500;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice-picker-meta {
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  flex-shrink: 0;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: hsl(var(--muted-foreground));
}
.empty-icon {
  width: 80px; height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: hsl(var(--muted));
  display: grid; place-items: center;
  color: hsl(var(--muted-foreground));
}
.empty-icon .icon { width: 32px; height: 32px; }
.empty-title { font-size: 0.95rem; font-weight: 600; color: hsl(var(--foreground)); margin-bottom: 4px; }
.empty-desc { font-size: 0.85rem; margin-bottom: 16px; }

/* ============================================================
   Skeleton
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, hsl(var(--muted)) 0%, hsl(var(--muted) / 0.4) 50%, hsl(var(--muted)) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 14px;
}
@keyframes skeleton { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================
   Spinner / Loading
   ============================================================ */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ============================================================
   Impersonate banner（代客模式红条）
   ============================================================ */
.impersonate-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: hsl(var(--destructive));
  color: white;
  padding: 8px 16px;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-weight: 500;
  box-shadow: var(--shadow);
}
.impersonate-banner .icon { width: 14px; height: 14px; }
.impersonate-countdown {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px; border-radius: 4px;
}
.impersonate-exit {
  background: white;
  color: hsl(var(--destructive));
  border: none;
  height: 24px; padding: 0 10px;
  border-radius: 4px;
  font-size: 0.75rem; font-weight: 600;
  margin-left: 4px;
  cursor: pointer;
}

/* ============================================================
   顶栏头部元素（v5.0.24: 三个统一为同一风格）
   主题切换 / 积分 chip / 用户 pill — 全部 32px 高，圆角 pill
   ============================================================ */

/* 统一高度 + 圆角 pill 基础样式（被 theme-toggle / user-pill / chip-header 复用） */
.header-pill-base {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: hsl(var(--muted));
  border: 1px solid transparent;
  color: hsl(var(--foreground));
  font-size: 0.8125rem; font-weight: 500;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms;
}

.theme-toggle {
  display: inline-flex;
  background: hsl(var(--muted));
  border-radius: 999px;
  padding: 3px;
  gap: 0;
  height: 32px;
}
.theme-toggle button {
  background: transparent; border: none;
  width: 26px; height: 26px;
  border-radius: 999px;
  display: grid; place-items: center;
  color: hsl(var(--muted-foreground));
  transition: background 120ms, color 120ms;
}
.theme-toggle button .icon { width: 14px; height: 14px; }
.theme-toggle button:hover { color: hsl(var(--foreground)); }
.theme-toggle button.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow-2xs);
}

/* 顶栏积分 chip — 与其他两个统一为 32px pill，bg brand-50 + brand-700 字色 */
.header-credit {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: hsl(var(--brand-50));
  color: hsl(var(--brand-700));
  font-size: 0.8125rem; font-weight: 600;
  white-space: nowrap;
}
.header-credit .icon { width: 14px; height: 14px; flex-shrink: 0; }

/* 顶栏用户 pill — 头像 + 名字 + chevron，32px 高，hover 边框加深 */
.user-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  background: hsl(var(--muted));
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
}
.user-pill:hover { background: hsl(var(--muted) / 0.7); border-color: hsl(var(--border)); }
.user-pill-icon {
  width: 18px; height: 18px;
  color: hsl(var(--brand-500));
  flex-shrink: 0;
}
.user-pill-name {
  font-weight: 500;
  max-width: 100px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-popover {
  position: absolute;
  top: calc(var(--header-height) - 8px);
  right: 16px;
  z-index: 50;
  min-width: 240px;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  animation: modal-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.user-popover-head {
  display: flex; align-items: center; gap: 12px;
  padding: 8px;
}
.user-popover-sep {
  border: none;
  border-top: 1px solid hsl(var(--border));
  margin: 4px 0;
}
.user-popover-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  text-align: left;
  cursor: pointer;
  transition: background 120ms;
}
.user-popover-item:hover { background: hsl(var(--muted)); }
.user-popover-item .icon { width: 14px; height: 14px; color: hsl(var(--muted-foreground)); flex-shrink: 0; }

/* ============================================================
   Personal Center
   ============================================================ */
.me-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 22px; }
.me-header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.me-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: hsl(var(--brand-50));
  color: hsl(var(--brand-600));
  display: grid; place-items: center;
  flex-shrink: 0;
}
.me-avatar svg { width: 26px; height: 26px; }
.me-header-info { display: flex; flex-direction: column; min-width: 0; }
.me-name { font-size: 1.05rem; font-weight: 600; color: hsl(var(--foreground)); }
.me-email { font-size: 0.8rem; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.me-header-right { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.me-header-stat { text-align: right; }
.me-header-stat-label { font-size: 0.72rem; color: hsl(var(--muted-foreground)); }
.me-header-stat-value { font-size: 1.3rem; font-weight: 700; color: hsl(var(--brand-600)); line-height: 1.2; }

.me-info-list { display: flex; flex-direction: column; gap: 0; margin: 0; }
.me-info-row {
  display: flex; align-items: baseline; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid hsl(var(--border));
  min-height: 24px;
}
.me-info-row:last-child { border-bottom: 0; }
.me-info-row dt,
.me-info-row dd { font-size: 0.92rem; line-height: 1; font-weight: 500; margin: 0; padding: 0; vertical-align: baseline; }
.me-info-row dt { width: 80px; flex-shrink: 0; color: hsl(var(--muted-foreground)); }
.me-info-row dd { color: hsl(var(--foreground)); flex: 1; min-width: 0; }

.me-tx-list { list-style: none; padding: 0; margin: 0; }
.me-tx-item {
  padding: 14px 18px; border-bottom: 1px solid hsl(var(--border));
}
.me-tx-item:last-child { border-bottom: 0; }
.me-tx-meta { min-width: 0; }
.me-tx-desc { font-size: 0.9rem; color: hsl(var(--foreground)); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.me-tx-task {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.6);
  padding: 1px 8px;
  border-radius: 999px;
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.02em;
}
.me-tx-time { font-size: 0.74rem; color: hsl(var(--muted-foreground)); margin-top: 4px; }
.me-tx-empty { list-style: none; text-align: center; padding: 28px 16px; color: hsl(var(--muted-foreground)); font-size: 0.85rem; }

@media (max-width: 640px) {
  .me-header { flex-direction: column; align-items: flex-start; gap: 14px; }
  .me-header-right { width: 100%; justify-content: space-between; }
}
.theme-toggle {
  display: inline-flex;
  background: hsl(var(--muted));
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 0;
}
.theme-toggle button {
  background: transparent; border: none;
  width: 28px; height: 28px;
  border-radius: calc(var(--radius-md) - 2px);
  display: grid; place-items: center;
  color: hsl(var(--muted-foreground));
  transition: background 120ms, color 120ms;
}
.theme-toggle button .icon { width: 14px; height: 14px; }
.theme-toggle button:hover { color: hsl(var(--foreground)); }
.theme-toggle button.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: var(--shadow-2xs);
}

/* ============================================================
   工具类（少量辅助）
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-muted { color: hsl(var(--muted-foreground)); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.hidden { display: none !important; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar { width: 64px; }
  .sidebar-brand-text, .sidebar-nav-section, .nav-item-label, .sidebar-user-info { display: none; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item.active::before { display: none; }
  .nav-item-badge { display: none; }
  .sidebar-actions .sidebar-actions-label { display: none; }
  .main-content { padding: 20px; }
}

@media (max-width: 640px) {
  .main-header { padding: 12px 16px; }
  .main-content { padding: 16px; }
  .voice-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   兼容旧类名（业务 JS 仍引用，逐步迁移）
   ============================================================ */
.btn-export {
  padding: 6px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
}
.btn-export:hover {
  border-color: hsl(var(--brand-300));
  background: hsl(var(--brand-50));
  color: hsl(var(--brand-700));
}

/* 旧的 .btn-clear（清空按钮） */
.btn-clear {
  padding: 4px 12px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-sm);
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 120ms;
}
.btn-clear:hover { background: hsl(var(--muted) / 0.6); color: hsl(var(--foreground)); }

/* 旧的 .btn-outline（小尺寸，业务在 history 表用） */
.btn-outline {
  padding: 6px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 120ms;
}
.btn-outline:hover { background: hsl(var(--muted)); }

/* 旧的 .btn-synth（兼容旧 inline 合成按钮，新版用 .cta-gradient 替代） */
.btn-synth {
  display: block;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, hsl(var(--brand-500)), hsl(var(--brand-600)));
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 120ms;
}
.btn-synth:hover { filter: brightness(1.05); }
.btn-synth:disabled { opacity: 0.5; cursor: not-allowed; }

/* 旧的 .btn-primary-lg（录音区开始按钮） */
.btn-primary-lg {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, hsl(var(--brand-500)), hsl(var(--brand-600)));
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-weight: 600; font-size: 0.95rem;
  cursor: pointer;
  justify-content: center;
  transition: filter 120ms;
}
.btn-primary-lg:hover:not(:disabled) { filter: brightness(1.05); }
.btn-primary-lg:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   减少动效偏好
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   未登录态（v3.3.1 兼容保留）
   ============================================================ */
body.logged-out .sidebar,
body.logged-out .main-header { display: none; }
body.logged-out .main-content {
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   上传区 · 紧凑态（v5.0.42: 数字人资产 / 声纹等表单内嵌场景）
   触发：用 `<div class="upload-area upload-area--compact" tabindex="0" role="button">` 包住
       `<svg.upload-area__icon>` + `<div.upload-area__main>(<span.upload-area__hint>
       <span.upload-area__sub>)</div>` + `<span.upload-area__action>` 三段；
       选中文件后给容器加 `.has-file` 切到 brand 强调态并把按钮文案改成「换视频」
   ============================================================ */
.upload-area--compact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius-md);
  background: hsl(var(--muted) / 0.4);
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
  min-width: 0;
}
.upload-area--compact:hover {
  border-color: hsl(var(--brand-500));
  background: hsl(var(--muted) / 0.7);
}
.upload-area--compact:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-color: hsl(var(--brand-500));
}
.upload-area--compact.has-file {
  border-style: solid;
  border-color: hsl(var(--brand-500));
  background: hsl(var(--brand-50, var(--muted) / 0.6));
}
.upload-area__icon {
  flex: 0 0 auto;
  color: hsl(var(--muted-foreground));
}
.upload-area--compact.has-file .upload-area__icon {
  color: hsl(var(--brand-500));
}
.upload-area__main {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.upload-area__hint {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.upload-area--compact.has-file .upload-area__hint {
  color: hsl(var(--foreground));
  font-weight: 500;
}
.upload-area__sub {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.upload-area__action {
  flex: 0 0 auto;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  font-size: 0.75rem;
  color: hsl(var(--foreground));
  white-space: nowrap;
}
.upload-area--compact.has-file .upload-area__action {
  border-color: hsl(var(--brand-500));
  color: hsl(var(--brand-500));
}

/* ===== v5.0.56: 登录页用户协议勾选行 ===== */
.agree-row {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: hsl(var(--background) / 0.4);
  cursor: pointer;
  user-select: none;
  font-size: 0.8rem;
  line-height: 1.5;
  color: hsl(var(--muted-foreground));
}
.agree-row:hover { background: hsl(var(--background) / 0.55); }
.agree-checkbox {
  margin: 2px 0 0 0;
  width: 14px; height: 14px;
  accent-color: hsl(var(--brand-500));
  cursor: pointer;
  flex-shrink: 0;
}
.agree-text { flex: 1; min-width: 0; }
.agree-link {
  color: hsl(var(--brand-700));
  text-decoration: underline;
  text-underline-offset: 2px;
}
.agree-link:hover { color: hsl(var(--brand-600)); }

/* ============ v5.0.161: 媒体加载遮罩 ============
   视频改为直连签名 URL 后由浏览器自行发 Range 请求，加载期没有任何 JS 回调 ——
   用户看到的是纯黑播放器（"卡在那了"观感的直接来源）。这层遮罩由媒体事件驱动补反馈。
   用法见 index.html 的 attachMediaLoading()；外层容器必须是 position:relative。 */
.media-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 12px; line-height: 1.5;
  pointer-events: none;   /* 不遮挡播放器自带控件（暂停 / 全屏 / 进度条） */
}
/* 必须显式写：.media-loading 的 display:flex 会盖掉 [hidden] 默认的 display:none */
.media-loading[hidden] { display: none; }
.media-loading .spinner { width: 20px; height: 20px; border-width: 2px; margin: 0; }
/* 缩略图加载期的骨架：复用 .skeleton 的 shimmer，但不要它那个为文字行准备的 14px 固定高 */
.dha-cover-img.skeleton { height: auto; width: 100%; border-radius: 0; }

/* ===== Toast (瞬时消息) — v5.0.184: 浅色卡片 + 语义图标（与 iframe 子页同源视觉）===== */
:root, [data-theme="light"] { --toast-bg: rgba(255,255,255,.92); --toast-border: rgba(0,0,0,.08); }
[data-theme="dark"]        { --toast-bg: rgba(26,26,30,.92); --toast-border: rgba(255,255,255,.14); }
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 1002; pointer-events: none; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: hsl(var(--foreground));
  background: var(--toast-bg);
  border: 1px solid var(--toast-border);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: toastIn .3s ease;
}
.toast__icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.toast--success .toast__icon { color: #16a34a; }
.toast--warning .toast__icon { color: #d97706; }
.toast--danger  .toast__icon { color: #dc2626; }
.toast--hide { opacity: 0; transform: translate(-50%, -8px); transition: opacity .3s, transform .3s; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }
