:root {
  /* 颜色系统 - 深色高级感 */
  --bg-primary: #121417;
  /* 主背景 */
  --bg-secondary: #1a1d21;
  /* 侧边栏/卡片背景 */
  --bg-tertiary: #242830;
  /* 悬停/激活态 */
  --accent-color: #6366f1;
  /* 主色调 (Indigo) */
  --accent-hover: #4f46e5;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-color: #2d3748;
  --success-color: #10b981;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* 布局 */
  --sidebar-width: 280px;
  --header-height: 70px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}

/* 布局容器 */
.app-container {
  display: flex;
  height: 100%;
}

/* 侧边栏样式 */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.sidebar-header {
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 1.5rem;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 0%, #a5a6f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.account-list-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-left: 0.5rem;
}

.account-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.account-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2sease;
  background-color: transparent;
  border: 1px solid transparent;
}

.account-item:hover {
  background-color: var(--bg-tertiary);
}

.account-item.active {
  background-color: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.2);
}

.account-item-avatar {
  font-size: 1.25rem;
  margin-right: 0.75rem;
}

.account-item-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.account-item.active .account-item-name {
  color: var(--text-primary);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.version-info {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 主内容区域 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
}

.content-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  background-color: rgba(18, 20, 23, 0.8);
  backdrop-filter: blur(8px);
}

.current-account {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.account-avatar {
  font-size: 1.75rem;
  width: 2.75rem;
  height: 2.75rem;
  background-color: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-info h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.account-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 聊天区域 */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scroll-behavior: smooth;
}

.welcome-message {
  text-align: center;
  margin-top: 10vh;
  color: var(--text-secondary);
}

.welcome-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

.welcome-message h3 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* 消息样式 */
.message {
  max-width: 80%;
  animation: fadeIn 0.3s ease-out;
}

.message.user {
  align-self: flex-end;
  background-color: var(--accent-color);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 1rem 1rem 0 1rem;
  margin-left: auto;
}

.message.ai {
  align-self: flex-start;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 1rem 1rem 1rem 0;
  padding: 1.25rem;
  width: 100%;
  max-width: 800px;
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.topic-button {
  text-align: left;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9375rem;
}

.topic-button:hover {
  background-color: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-color);
  transform: translateX(4px);
}

.generated-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.content-block h4 {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.content-box {
  background-color: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 0.5rem;
  white-space: pre-wrap;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.tags-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
}

/* 底部操作区 */
.action-bar {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.action-btn {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  box-shadow: var(--shadow-md);
}

.action-btn:hover:not(:disabled) {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.action-btn:active:not(:disabled) {
  transform: translateY(0);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--bg-tertiary);
}

.action-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
  margin: 0 2px;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

/* 登录模态框样式 */
.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.login-box {
  background: #1e1e1e;
  padding: 2rem;
  border-radius: 12px;
  width: 350px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border: 1px solid #333;
  text-align: center;
}

.login-box h2 {
  margin-bottom: 1.5rem;
  color: #fff;
  font-size: 1.2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.login-box input {
  width: 100%;
  padding: 10px;
  background: #2d2d2d;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}

.login-box input:focus {
  border-color: #646cff;
}

.login-box button {
  width: 100%;
  padding: 10px;
  background: #646cff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  margin-top: 1rem;
  transition: background 0.3s;
}

.login-box button:hover {
  background: #535bf2;
}

.error-text {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.hidden {
  display: none !important;
}

/* ============ 数据看板样式 ============ */

/* 侧边栏分隔线 */
.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 1rem 0;
}

/* 侧边栏导航 */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  text-align: left;
}

.nav-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-color);
  color: white;
}

.nav-icon {
  font-size: 1.1rem;
}

/* 数据看板容器 */
.dashboard-view {
  overflow-y: auto;
}

.dashboard-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  height: calc(100vh - var(--header-height) - 2rem);
}

/* 左侧数据录入面板 */
.dashboard-input-panel {
  background: var(--bg-secondary);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  height: fit-content;
}

.dashboard-input-panel h3 {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.dashboard-input-panel .form-group {
  margin-bottom: 1rem;
}

.dashboard-input-panel label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.dashboard-input-panel select,
.dashboard-input-panel input[type="date"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.dashboard-input-panel select:focus,
.dashboard-input-panel input:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* 指标输入区 */
.metrics-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.metric-input {
  background: var(--bg-tertiary);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.metric-input label {
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.metric-input input {
  width: 100%;
  padding: 0.5rem;
  border: none;
  border-radius: 0.25rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  text-align: center;
}

.metric-input input:focus {
  outline: 2px solid var(--accent-color);
}

/* 右侧图表面板 */
.dashboard-chart-panel {
  background: var(--bg-secondary);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dashboard-chart-panel h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.chart-container {
  height: 280px;
  margin-bottom: 1.5rem;
}

/* 数据表格 */
.metrics-table-container {
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.metrics-table th {
  text-align: left;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 500;
  position: sticky;
  top: 0;
}

.metrics-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.metrics-table tbody tr:hover {
  background: var(--bg-tertiary);
}

.delete-btn {
  background: transparent;
  border: 1px solid #ef4444;
  color: #ef4444;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.delete-btn:hover {
  background: #ef4444;
  color: white;
}

/* ============ 增强版数据看板样式 ============ */

/* 时间范围选择器 */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.time-range-selector {
  display: flex;
  gap: 0.5rem;
}

.range-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.range-btn:hover {
  border-color: var(--accent-color);
  color: var(--text-primary);
}

.range-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

/* 看板滚动容器 */
.dashboard-scroll-container {
  padding: 1.5rem;
  overflow-y: auto;
  height: calc(100vh - var(--header-height) - 2rem);
}

/* KPI 卡片区 */
.kpi-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kpi-card.kpi-views {
  border-left: 3px solid #6366f1;
}

.kpi-card.kpi-interactions {
  border-left: 3px solid #ef4444;
}

.kpi-card.kpi-consultations {
  border-left: 3px solid #10b981;
}

.kpi-card.kpi-days {
  border-left: 3px solid #f59e0b;
}

.kpi-icon {
  font-size: 2rem;
}

.kpi-content {
  flex: 1;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* 对比分析区 */
.comparison-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.comparison-chart-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
}

.comparison-chart-panel h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* 排行榜 */
.leaderboard-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
}

.leaderboard-panel h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 0.5rem;
}

.leaderboard-rank {
  font-size: 1.25rem;
  width: 2rem;
  text-align: center;
}

.leaderboard-info {
  flex: 1;
}

.leaderboard-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.leaderboard-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.leaderboard-views {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-color);
}

.leaderboard-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

/* 单账号分析区 */
.single-account-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
}

.single-account-section>h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.single-account-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

.single-account-section .dashboard-input-panel,
.single-account-section .dashboard-chart-panel {
  background: var(--bg-tertiary);
  border: none;
  padding: 1rem;
}

.single-account-section h4 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.single-account-section .metrics-table-container {
  max-height: 150px;
}

/* 响应式调整 */
@media (max-width: 1200px) {
  .kpi-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .comparison-section {
    grid-template-columns: 1fr;
  }

  .single-account-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ HTML视频输出样式 ============ */

.html-video-output {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
}

.html-video-output .video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.html-video-output .video-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.html-video-output .video-actions {
  display: flex;
  gap: 0.5rem;
}

.html-video-output .video-actions .action-btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.html-video-output .video-preview-container {
  margin-top: 1rem;
}

.html-video-output .video-code-container {
  margin-top: 1rem;
}

.html-video-output .video-code-container pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}