/* ============================================
   小奥录音 - 多主题UI系统
   技术栈: Tailwind CSS (布局) + CSS变量 (主题)
   ============================================ */

/* ---------- 基础变量 (modern-light 默认) ---------- */
html {
  --surface-0: #ffffff;
  --surface-1: #f8fafc;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-muted: rgba(14, 165, 233, 0.12);
  --primary-glow: rgba(14, 165, 233, 0.25);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.04);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.08), 0 1px 2px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar-bg: #ffffff;
  --sidebar-text: #0f172a;
  --sidebar-text-muted: #94a3b8;
  --sidebar-border: #e2e8f0;
  --sidebar-hover: #f1f5f9;
  --sidebar-active: rgba(14, 165, 233, 0.1);
  --sidebar-active-border: var(--primary);
  --input-bg: #ffffff;
  --modal-overlay: rgba(15, 23, 42, 0.45);
  --glass-bg: rgba(255,255,255,0.7);
  --glass-border: rgba(255,255,255,0.3);
  --transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

/* ---------- tech-dark 深色科技蓝 ---------- */
[data-theme="tech-dark"] {
  --surface-0: #0b1121;
  --surface-1: #0f172a;
  --surface-2: #1e293b;
  --surface-3: #334155;
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-muted: rgba(56, 189, 248, 0.15);
  --primary-glow: rgba(56, 189, 248, 0.35);
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --success: #4ade80;
  --warning: #fbbf24;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #0f172a;
  --border: #1e293b;
  --border-strong: #334155;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.3);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.4), 0 1px 2px -1px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4);
  --sidebar-bg: #0f172a;
  --sidebar-text: #f1f5f9;
  --sidebar-text-muted: #64748b;
  --sidebar-border: #1e293b;
  --sidebar-hover: #1e293b;
  --sidebar-active: rgba(56, 189, 248, 0.15);
  --sidebar-active-border: var(--primary);
  --input-bg: #1e293b;
  --modal-overlay: rgba(0, 0, 0, 0.65);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(56, 189, 248, 0.1);
}

/* ---------- warm-office 温暖办公 ---------- */
[data-theme="warm-office"] {
  --surface-0: #fafaf9;
  --surface-1: #f5f5f4;
  --surface-2: #e7e5e4;
  --surface-3: #d6d3d1;
  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-muted: rgba(217, 119, 6, 0.12);
  --primary-glow: rgba(217, 119, 6, 0.25);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #ca8a04;
  --text: #292524;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;
  --text-inverse: #ffffff;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.04);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.06), 0 1px 2px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -4px rgba(0,0,0,0.03);
  --sidebar-bg: #f5f5f4;
  --sidebar-text: #292524;
  --sidebar-text-muted: #a8a29e;
  --sidebar-border: #e7e5e4;
  --sidebar-hover: #e7e5e4;
  --sidebar-active: rgba(217, 119, 6, 0.12);
  --sidebar-active-border: var(--primary);
  --input-bg: #ffffff;
  --modal-overlay: rgba(41, 37, 36, 0.45);
  --glass-bg: rgba(250, 250, 249, 0.8);
  --glass-border: rgba(255,255,255,0.4);
}

/* ---------- focus-dark 高对比专注 ---------- */
[data-theme="focus-dark"] {
  --surface-0: #000000;
  --surface-1: #0a0a0a;
  --surface-2: #171717;
  --surface-3: #262626;
  --primary: #22d3ee;
  --primary-hover: #67e8f9;
  --primary-muted: rgba(34, 211, 238, 0.15);
  --primary-glow: rgba(34, 211, 238, 0.4);
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --success: #4ade80;
  --warning: #facc15;
  --text: #fafafa;
  --text-secondary: #d4d4d4;
  --text-muted: #737373;
  --text-inverse: #000000;
  --border: #262626;
  --border-strong: #404040;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.5);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.6);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.6);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.7);
  --sidebar-bg: #0a0a0a;
  --sidebar-text: #fafafa;
  --sidebar-text-muted: #737373;
  --sidebar-border: #171717;
  --sidebar-hover: #171717;
  --sidebar-active: rgba(34, 211, 238, 0.15);
  --sidebar-active-border: var(--primary);
  --input-bg: #171717;
  --modal-overlay: rgba(0, 0, 0, 0.75);
  --glass-bg: rgba(23, 23, 23, 0.8);
  --glass-border: rgba(255,255,255,0.05);
}

/* ---------- 全局过渡 ---------- */
*, *::before, *::after {
  transition: var(--transition);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--surface-1);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* 关闭部分元素的无用过渡 */
audio, video, canvas, svg {
  transition: none;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- 按钮组件 ---------- */
.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- 卡片组件 ---------- */
.card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* ---------- 输入框 ---------- */
.input, select, textarea {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  width: 100%;
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}
.input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

/* ---------- 标签页 (Pill样式) ---------- */
.tabs-pills {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  width: fit-content;
}
.tab-pill {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.tab-pill:hover { color: var(--text); }
.tab-pill.active {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

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

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sidebar-text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -16px 16px;
}

.sidebar-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.meeting-list { flex: 1; overflow-y: auto; padding: 8px; }

.meeting-item {
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}
.meeting-item:hover {
  background: var(--sidebar-hover);
}
.meeting-item.active {
  background: var(--sidebar-active);
  border-left-color: var(--sidebar-active-border);
}
.meeting-item .title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.meeting-item .meta {
  font-size: 0.75rem;
  color: var(--sidebar-text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
}
.status-recording {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.status-paused { background: var(--warning); }
.status-completed { background: var(--success); }
.status-processing {
  background: var(--primary);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-btn {
  background: none;
  border: none;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

/* ---------- 录音面板 ---------- */
.recording-panel {
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
}

.level-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border-radius: 10px;
  overflow: hidden;
}
.level-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
  border-radius: 10px;
  transition: width 0.1s ease;
}
.level-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 50px;
}
.level-label-clickable {
  cursor: pointer;
  border-bottom: 1px dashed var(--text-muted);
  transition: all 0.2s;
}
.level-label-clickable:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.mic-select-dropdown {
  font-size: 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
  min-width: 120px;
  max-width: 160px;
  flex-shrink: 0;
}
.level-value {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 55px;
  text-align: right;
  font-family: monospace;
}

.btn-record {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 100px;
  background: var(--danger);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  transition: all 0.2s;
}
.btn-record:hover {
  background: var(--danger-hover);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45);
  transform: translateY(-1px);
}
.btn-record.recording {
  animation: pulse-record 2s ease-in-out infinite;
}
@keyframes pulse-record {
  0%, 100% { box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 2px 20px rgba(239, 68, 68, 0.6); }
}

.btn-pause {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
}
.btn-pause:hover {
  background: var(--surface-2);
}
.btn-pause:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#recording-timer {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'SF Mono', Monaco, monospace;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

/* ---------- 欢迎页面 ---------- */
.welcome-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.welcome-content {
  text-align: center;
  max-width: 560px;
}
.welcome-content h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.welcome-content p {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 1rem;
}
.feature-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.feature-icon-wrap {
  width: 44px;
  height: 44px;
  background: var(--primary-muted);
  color: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* ---------- 会议详情 ---------- */
.meeting-detail { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.meeting-detail.hidden { display: none; }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.title-input {
  font-size: 1.25rem;
  font-weight: 700;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  flex: 1;
  padding: 4px 0;
}
.title-input:focus {
  border-bottom: 2px solid var(--primary);
}

.detail-actions { display: flex; gap: 8px; }

/* ---------- 标签内容区 ---------- */
.tab-content { flex: 1; overflow: hidden; position: relative; background: var(--surface-1); }
.tab-panel { display: none; height: 100%; overflow-y: auto; padding: 20px 24px; }
.tab-panel.active { display: block; }

/* ---------- 转录内容 ---------- */
.transcript-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-1);
  margin: -20px -24px 16px -24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
}
.audio-player-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.audio-player-section.hidden { display: none; }
.audio-player-section audio { width: 100%; height: 40px; border-radius: var(--radius-sm); }

.transcript-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  gap: 8px;
  flex-wrap: wrap;
}
.transcript-toolbar-left, .transcript-toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.transcript-content { min-height: 300px; }

.transcript-segment {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}
.transcript-segment:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.segment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.speaker-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.segment-speaker {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
}
.segment-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}
.segment-text {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.transcript-word {
  display: inline;
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 2px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.transcript-word:hover {
  background-color: var(--primary-muted);
  color: var(--primary);
}
.transcript-word.active-word {
  background-color: var(--primary-glow);
  color: var(--primary-hover);
  font-weight: 600;
}
.transcript-segment.active-segment {
  border-left: 3px solid var(--primary);
  background: var(--primary-muted);
  padding-left: 14px;
}
.segment-divider { display: none; }

/* ---------- 摘要内容 ---------- */
.summary-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.summary-content { min-height: 300px; }
.summary-section {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border-left: 3px solid var(--primary);
}
.summary-section h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.summary-section ul { padding-left: 20px; }
.summary-section li {
  margin-bottom: 6px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 0.9375rem;
}

/* ---------- 笔记编辑器 ---------- */
.notes-editor {
  width: 100%;
  height: calc(100% - 60px);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.9375rem;
  line-height: 1.7;
  resize: none;
  font-family: inherit;
  color: var(--text);
}
.notes-editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}

/* ---------- 模态框 ---------- */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- 设置模态框左右布局 ---------- */
.settings-modal-content {
  width: 740px;
  height: 78vh;
  max-width: none;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.settings-modal-body {
  display: flex;
  padding: 0;
  overflow: hidden;
  flex: 1;
}
.settings-sidebar {
  width: 170px;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  flex-shrink: 0;
  overflow-y: auto;
}
.settings-menu-item {
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  margin: 2px 8px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.settings-menu-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.settings-menu-item.active {
  background: var(--primary-muted);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.settings-section { margin-bottom: 24px; }
.settings-section h4 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}
.form-group textarea { resize: vertical; line-height: 1.5; min-height: 80px; }
.form-group .checkbox-label {
  display: block;
  margin-bottom: 0;
}
.form-group .checkbox-label input[type="checkbox"] {
  display: inline-block;
  vertical-align: middle;
  margin: 0 0.5rem 0 0;
  width: 16px;
  height: 16px;
}
.form-group .checkbox-label span {
  display: inline-block;
  vertical-align: middle;
}

/* ---------- 模板 ---------- */
.template-list { display: flex; flex-direction: column; gap: 8px; }
.template-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
  transition: all 0.2s;
}
.template-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.template-item.default {
  border-color: var(--primary);
  background: var(--primary-muted);
}
.template-item .template-info {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
}
.template-item .template-icon { font-size: 1.25rem; flex-shrink: 0; }
.template-item .template-name { font-weight: 600; font-size: 0.875rem; color: var(--text); }
.template-item .template-desc {
  font-size: 0.75rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.template-item .template-badge {
  font-size: 0.7rem; color: var(--primary);
  background: var(--primary-muted);
  padding: 2px 8px; border-radius: 4px; white-space: nowrap;
  font-weight: 600;
}
.template-item .template-actions {
  display: flex; gap: 4px; margin-left: 8px; align-items: center;
}
.template-item .template-actions button {
  background: none; border: none; cursor: pointer;
  font-size: 0.875rem; padding: 4px; border-radius: 4px;
  color: var(--text-muted);
}
.template-item .template-actions button:hover {
  background: var(--surface-2); color: var(--text);
}

/* ---------- 文件上传 ---------- */
.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  margin-bottom: 16px;
  cursor: pointer;
  background: var(--surface-1);
  transition: all 0.2s;
}
.file-upload:hover {
  border-color: var(--primary);
  background: var(--primary-muted);
}
.file-upload input[type="file"] { display: none; }

/* ---------- 搜索结果 ---------- */
.search-results {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--surface-1); z-index: 10;
  padding: 20px; overflow-y: auto;
}
.search-result-item {
  background: var(--surface-0);
  padding: 16px; border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.search-result-item .result-title {
  font-weight: 700; margin-bottom: 8px;
  cursor: pointer; color: var(--primary);
}
.search-result-item .result-context {
  font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5;
}

/* ---------- 详情页 ---------- */
.detail-page { height: 100vh; overflow: hidden; background: var(--surface-1); }
.detail-container { display: flex; flex-direction: column; height: 100vh; }
.detail-page-header {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
}
.back-link {
  color: var(--primary); text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}
.back-link:hover { text-decoration: underline; }
.detail-page-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ---------- 转录编辑 ---------- */
.transcript-edit-card {
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.transcript-edit-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.edit-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.edit-time {
  font-size: 0.75rem; color: var(--text-muted);
  font-family: monospace;
  background: var(--surface-2);
  padding: 2px 8px; border-radius: 4px;
  white-space: nowrap;
}
.edit-speaker-input {
  font-size: 0.875rem; font-weight: 600;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  min-width: 80px; max-width: 150px;
  background: var(--input-bg);
  outline: none;
}
.edit-speaker-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-muted); }
.edit-textarea {
  font-size: 0.9375rem; line-height: 1.6;
  min-height: 48px; padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
  color: var(--text);
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
}
.edit-textarea:focus { border-color: var(--primary); background: var(--surface-0); }
.edit-textarea:empty::before {
  content: '在此输入转录文本...';
  color: var(--text-muted); font-style: italic;
}
.btn-save-segment {
  background: var(--surface-2);
  color: var(--text-secondary);
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-left: auto;
  font-weight: 500;
}
.btn-save-segment:hover { background: var(--surface-3); }
.btn-save-segment.has-changes {
  background: var(--primary);
  color: var(--text-inverse);
}
.btn-save-segment.has-changes:hover { background: var(--primary-hover); }
.btn-save-segment:disabled { opacity: 0.5; cursor: not-allowed; }
.edit-warning {
  font-size: 0.85rem;
  color: var(--warning);
  cursor: help;
}

/* ---------- 主题选择卡片 ---------- */
.theme-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.theme-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  background: var(--surface-0);
}
.theme-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.theme-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-muted); }
.theme-card .theme-preview {
  width: 100%; height: 48px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border);
}
.theme-card .theme-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- 转录中状态 ---------- */
.transcribing-indicator {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px 24px; gap: 16px;
  color: var(--text-muted);
}
.transcribing-indicator.hidden { display: none; }
.funnel-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- 加载动画 ---------- */
.loading {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 工具类 ---------- */
.hidden { display: none !important; }

/* ---------- Toast 通知 ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface-0);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.5;
  min-width: 260px;
  max-width: 360px;
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  backdrop-filter: blur(12px);
}

.toast-item.toast-out {
  animation: toast-out 0.3s ease forwards;
}

.toast-item .toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-top: 1px;
}

.toast-item .toast-content {
  flex: 1;
  min-width: 0;
}

.toast-item .toast-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-item .toast-message {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.toast-item .toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.toast-item .toast-close:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Toast 类型 */
.toast-success {
  border-left: 3px solid var(--success);
}
.toast-success .toast-icon {
  color: var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}
.toast-error .toast-icon {
  color: var(--danger);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}
.toast-warning .toast-icon {
  color: var(--warning);
}

.toast-info {
  border-left: 3px solid var(--primary);
}
.toast-info .toast-icon {
  color: var(--primary);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .sidebar { width: 220px; }
  .level-meters { flex-direction: column; }
  .recording-controls { flex-wrap: wrap; }
  .theme-selector { grid-template-columns: 1fr; }
  .settings-modal-content { width: 95vw; height: 85vh; }
  .settings-sidebar { width: 140px; }
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  .toast-item {
    max-width: none;
    min-width: auto;
    width: 100%;
  }
}

/* ---------- 通知历史 ---------- */
.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.notification-modal-content {
  width: 460px;
  max-width: 90vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notification-modal-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  flex: 1;
}

.notification-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notification-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.notification-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
  border-left: 3px solid transparent;
}

.notification-item:hover {
  background: var(--surface-2);
}

.notification-item.unread {
  background: var(--surface-0);
  border-left-color: var(--primary);
}

.notification-item.unread:hover {
  background: var(--surface-2);
}

.notification-item.read {
  opacity: 0.75;
  border-left-color: transparent;
}

.notification-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.notification-item-icon.notification-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.notification-item-icon.notification-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.notification-item-icon.notification-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.notification-item-icon.notification-info {
  background: var(--primary-muted);
  color: var(--primary);
}

.notification-item-content {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.notification-item-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.notification-detail-message {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
}

.notification-detail-time {
  font-size: 0.8125rem;
  color: var(--text-muted);
}