/* ============================================================
   积分智能运营Agent - 炫酷动态样式表
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --color-primary: #6366f1;
  --color-primary-light: #818cf8;
  --color-primary-dark: #4f46e5;
  --color-primary-bg: rgba(99, 102, 241, 0.06);
  --color-primary-border: rgba(99, 102, 241, 0.2);

  --gradient-header: linear-gradient(135deg, #4f46e5 0%, #7c3aed 40%, #2563eb 70%, #06b6d4 100%);
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  --gradient-primary-hover: linear-gradient(135deg, #5558e6 0%, #7c4ddb 100%);
  --gradient-text: linear-gradient(135deg, #ffffff 0%, #c7d2fe 50%, #a5b4fc 100%);
  --gradient-user-msg: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  --gradient-ai-avatar: linear-gradient(135deg, #6366f1 0%, #a78bfa 100%);
  --gradient-user-avatar: linear-gradient(135deg, #10b981 0%, #34d399 100%);

  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.08);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.08);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.08);
  --color-info: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.08);

  --color-bg: #f1f5f9;
  --color-surface: #ffffff;
  --color-surface-alt: #f8fafc;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-text: #0f172a;
  --color-text-secondary: #64748b;
  --color-text-tertiary: #94a3b8;
  --color-text-inverse: #ffffff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.05), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.06), 0 8px 10px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  --shadow-glow-strong: 0 0 30px rgba(99, 102, 241, 0.25);
  --shadow-color-1: 0 8px 24px rgba(99, 102, 241, 0.12);
  --shadow-color-2: 0 8px 24px rgba(16, 185, 129, 0.12);
  --shadow-color-3: 0 8px 24px rgba(245, 158, 11, 0.12);
  --shadow-color-4: 0 8px 24px rgba(236, 72, 153, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;
  --duration-slower: 500ms;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
}

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ============================================================
   动态网格背景
   ============================================================ */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
  animation: gridShift 20s linear infinite;
}

@keyframes gridShift {
  0% { background-position: 0 0; }
  100% { background-position: 32px 32px; }
}

/* ============================================================
   浮动粒子
   ============================================================ */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
  animation: particleFloat linear infinite;
}

.particle-1 { width: 300px; height: 300px; top: 10%; left: 5%; background: radial-gradient(circle, rgba(99,102,241,0.1) 0%, transparent 70%); animation-duration: 25s; }
.particle-2 { width: 200px; height: 200px; top: 60%; right: 10%; background: radial-gradient(circle, rgba(16,185,129,0.08) 0%, transparent 70%); animation-duration: 20s; animation-delay: -5s; }
.particle-3 { width: 250px; height: 250px; bottom: 20%; left: 30%; background: radial-gradient(circle, rgba(139,92,246,0.08) 0%, transparent 70%); animation-duration: 30s; animation-delay: -10s; }
.particle-4 { width: 180px; height: 180px; top: 30%; right: 25%; background: radial-gradient(circle, rgba(236,72,153,0.07) 0%, transparent 70%); animation-duration: 22s; animation-delay: -7s; }
.particle-5 { width: 220px; height: 220px; bottom: 40%; left: 60%; background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%); animation-duration: 28s; animation-delay: -12s; }
.particle-6 { width: 150px; height: 150px; top: 5%; right: 40%; background: radial-gradient(circle, rgba(6,182,212,0.08) 0%, transparent 70%); animation-duration: 18s; animation-delay: -3s; }
.particle-7 { width: 280px; height: 280px; bottom: 5%; right: 5%; background: radial-gradient(circle, rgba(168,85,247,0.06) 0%, transparent 70%); animation-duration: 35s; animation-delay: -15s; }
.particle-8 { width: 160px; height: 160px; top: 45%; left: 10%; background: radial-gradient(circle, rgba(244,114,182,0.07) 0%, transparent 70%); animation-duration: 24s; animation-delay: -8s; }

@keyframes particleFloat {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  25% { transform: translate(40px, -50px) scale(1.15) rotate(90deg); }
  50% { transform: translate(-30px, 30px) scale(0.9) rotate(180deg); }
  75% { transform: translate(50px, 40px) scale(1.1) rotate(270deg); }
  100% { transform: translate(0, 0) scale(1) rotate(360deg); }
}

/* ============================================================
   点击粒子爆发效果
   ============================================================ */
.click-spark {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: sparkFly 0.6s var(--ease-out) forwards;
}

.click-spark::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 6px var(--color-primary);
}

@keyframes sparkFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(calc(cos(var(--angle)) * 40px), calc(sin(var(--angle)) * 40px)) scale(0); opacity: 0; }
}

/* --- 容器 --- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-lg);
  position: relative;
  z-index: 1;
}

/* ============================================================
   Header - 终极动态版
   ============================================================ */
.header {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  background: var(--gradient-header);
  background-size: 300% 300%;
  animation: headerGradientShift 6s ease infinite;
  color: var(--color-text-inverse);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-lg);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg), var(--shadow-glow), inset 0 1px 0 rgba(255,255,255,0.1);
}

@keyframes headerGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 光晕 */
.header-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 70%, rgba(255,255,255,0.1) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(139,92,246,0.1) 0%, transparent 60%);
  animation: glowPulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* 浮动几何图形 */
.header-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.shape {
  position: absolute;
  border: 1px solid rgba(255,255,255,0.15);
  animation: shapeFloat 8s ease-in-out infinite;
}

.shape-1 { width: 80px; height: 80px; top: 15%; left: 8%; border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; animation-duration: 10s; }
.shape-2 { width: 60px; height: 60px; top: 60%; right: 12%; border-radius: 50%; animation-duration: 8s; animation-delay: -2s; }
.shape-3 { width: 40px; height: 40px; bottom: 20%; left: 15%; transform: rotate(45deg); animation-duration: 12s; animation-delay: -4s; }
.shape-4 { width: 50px; height: 50px; top: 20%; right: 25%; border-radius: 50% 20% 50% 20%; animation-duration: 9s; animation-delay: -3s; }
.shape-5 { width: 70px; height: 70px; bottom: 15%; right: 8%; border-radius: 20% 80% 20% 80%; animation-duration: 11s; animation-delay: -6s; }

@keyframes shapeFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); opacity: 0.3; }
  25% { transform: translate(10px, -15px) rotate(90deg); opacity: 0.5; }
  50% { transform: translate(-10px, 10px) rotate(180deg); opacity: 0.3; }
  75% { transform: translate(15px, 5px) rotate(270deg); opacity: 0.5; }
}

/* 顶部状态栏 */
.header-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding: 0 var(--space-md);
  position: relative;
  z-index: 1;
  animation: fadeSlideDown 0.5s var(--ease-out) 0.2s both;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  50% { box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

.header-time-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 14px 6px 6px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  transition: all 0.3s var(--ease-out);
}

.header-user:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.25);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.3);
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
}

.btn-logout {
  padding: 4px 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  color: rgba(255,255,255,0.8);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.2s var(--ease-out);
}

.btn-logout:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.3);
  color: #fff;
}

.header-date {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.7;
  letter-spacing: 0.02em;
}

.header-time {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.header-content {
  position: relative;
  z-index: 1;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.03em;
  animation: titleSlideIn 0.6s var(--ease-bounce) 0.3s both;
}

@keyframes titleSlideIn {
  from { opacity: 0; transform: translateY(-25px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 渐变文字 */
.gradient-text {
  background: var(--gradient-text);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textShimmer 3s linear infinite;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}

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

/* 标题前图标 */
.header h1::before {
  content: '⚡';
  margin-right: 10px;
  font-size: 2rem;
  display: inline-block;
  -webkit-text-fill-color: initial;
  animation: iconBounce 2s ease-in-out infinite;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

@keyframes iconBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-5px) rotate(-5deg); }
  75% { transform: translateY(-3px) rotate(5deg); }
}

.subtitle {
  opacity: 0.85;
  font-size: 0.95rem;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  animation: subtitleFadeIn 0.8s ease 0.5s both;
}

@keyframes subtitleFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 0.85; transform: translateY(0); }
}

.subtitle::before,
.subtitle::after {
  content: '';
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
}

/* Header 标签 */
.header-tags {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
  animation: tagsSlideUp 0.6s var(--ease-out) 0.7s both;
}

@keyframes tagsSlideUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-tag {
  padding: 5px 14px;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  transition: all var(--duration-fast) var(--ease-out);
}

.header-tag:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

/* ============================================================
   波浪分隔
   ============================================================ */
.wave-divider {
  margin-bottom: -2px;
  margin-top: -2px;
  position: relative;
  height: 50px;
  overflow: hidden;
}

.wave-divider svg {
  width: 100%;
  height: 100%;
}

.wave-path {
  animation: waveDrift 4s ease-in-out infinite alternate;
}

.wave-1 { fill: rgba(99, 102, 241, 0.08); animation-duration: 4s; }
.wave-2 { fill: rgba(139, 92, 246, 0.06); animation-duration: 5s; animation-delay: -1s; }
.wave-3 { fill: rgba(168, 85, 247, 0.04); animation-duration: 6s; animation-delay: -2s; }

@keyframes waveDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(-30px); }
}

/* ============================================================
   快捷概览卡片 - 终极版
   ============================================================ */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--color-border-light);
  transition: all var(--duration-normal) var(--ease-out);
  animation: cardSlideUp 0.5s var(--ease-spring) both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 卡片背景装饰 */
.stat-card-bg {
  position: absolute;
  top: -20%;
  right: -20%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: 0.06;
  transition: all var(--duration-slow) var(--ease-out);
}

.stat-card-1 .stat-card-bg { background: var(--color-primary); }
.stat-card-2 .stat-card-bg { background: var(--color-success); }
.stat-card-3 .stat-card-bg { background: var(--color-warning); }
.stat-card-4 .stat-card-bg { background: #ec4899; }

.stat-card:hover .stat-card-bg {
  transform: scale(1.5);
  opacity: 0.1;
}

/* 顶部彩色条 */
.stat-card-1 { border-top: 3px solid #6366f1; box-shadow: var(--shadow-color-1); }
.stat-card-2 { border-top: 3px solid #10b981; box-shadow: var(--shadow-color-2); }
.stat-card-3 { border-top: 3px solid #f59e0b; box-shadow: var(--shadow-color-3); }
.stat-card-4 { border-top: 3px solid #ec4899; box-shadow: var(--shadow-color-4); }

.stat-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-xl);
}

.stat-card-1:hover { box-shadow: var(--shadow-xl), var(--shadow-glow); }
.stat-card-2:hover { box-shadow: var(--shadow-xl), 0 0 24px rgba(16,185,129,0.15); }
.stat-card-3:hover { box-shadow: var(--shadow-xl), 0 0 24px rgba(245,158,11,0.15); }
.stat-card-4:hover { box-shadow: var(--shadow-xl), 0 0 24px rgba(236,72,153,0.15); }

/* 卡片头部 */
.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.stat-icon-wrap {
  position: relative;
  display: inline-block;
}

.stat-icon {
  font-size: 2rem;
  display: block;
  animation: iconFloat 3s ease-in-out infinite;
}

.stat-card:nth-child(2) .stat-icon { animation-delay: -0.7s; }
.stat-card:nth-child(3) .stat-icon { animation-delay: -1.4s; }
.stat-card:nth-child(4) .stat-icon { animation-delay: -2.1s; }

@keyframes iconFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.05); }
}

/* 图标光环 */
.stat-icon-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid transparent;
  animation: ringPulse 3s ease-in-out infinite;
}

.stat-card-1 .stat-icon-ring { border-color: rgba(99,102,241,0.15); }
.stat-card-2 .stat-icon-ring { border-color: rgba(16,185,129,0.15); }
.stat-card-3 .stat-icon-ring { border-color: rgba(245,158,11,0.15); }
.stat-card-4 .stat-icon-ring { border-color: rgba(236,72,153,0.15); }

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0; }
}

.stat-trend {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 3px;
}

.trend-arrow { font-size: 0.9em; }

.stat-trend.up { background: var(--color-success-bg); color: var(--color-success); }
.stat-trend.down { background: var(--color-danger-bg); color: var(--color-danger); }

.stat-body { text-align: left; }

.stat-value {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--color-text);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-value-suffix { font-size: 1.5rem; }

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* 进度条 */
.stat-progress {
  margin-top: var(--space-md);
  height: 4px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.stat-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1.5s var(--ease-out);
  background: var(--gradient-primary);
}

.stat-card-2 .stat-progress-bar { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card-3 .stat-progress-bar { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card-3 .stat-progress-bar.low { background: linear-gradient(90deg, #ef4444, #f87171); width: 15%; }
.stat-card-4 .stat-progress-bar { background: linear-gradient(90deg, #ec4899, #f472b6); }

/* ============================================================
   功能亮点卡片 - 毛玻璃风格
   ============================================================ */
.feature-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.feature-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--color-border-light);
  transition: all var(--duration-normal) var(--ease-out);
  animation: featureFadeIn 0.5s var(--ease-out) both;
}

.feature-card:nth-child(1) { animation-delay: 0.5s; }
.feature-card:nth-child(2) { animation-delay: 0.6s; }
.feature-card:nth-child(3) { animation-delay: 0.7s; }
.feature-card:nth-child(4) { animation-delay: 0.8s; }

@keyframes featureFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.feature-card-inner {
  position: relative;
  z-index: 1;
}

/* 渐变边框动画 */
.feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: var(--radius-lg);
  background: conic-gradient(from var(--angle, 0deg), #6366f1, #8b5cf6, #ec4899, #f59e0b, #10b981, #3b82f6, #6366f1);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  animation: borderRotate 4s linear infinite;
}

@keyframes borderRotate {
  to { --angle: 360deg; }
}

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

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

.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  display: block;
  transition: transform var(--duration-slow) var(--ease-bounce);
}

.feature-card:hover .feature-icon {
  transform: scale(1.15) rotate(-5deg);
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.feature-card p {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-md);
}

.feature-link {
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--duration-fast) var(--ease-out);
}

.feature-card:hover .feature-link {
  gap: 8px;
}

/* ============================================================
   导航Tab
   ============================================================ */
.nav-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  padding: var(--space-sm);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
}

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

.tab-btn:active { transform: scale(0.97); }

.tab-btn.active {
  background: var(--gradient-primary);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm), var(--shadow-glow);
  animation: tabGlow 2s ease-in-out infinite;
}

@keyframes tabGlow {
  0%, 100% { box-shadow: var(--shadow-sm), var(--shadow-glow); }
  50% { box-shadow: var(--shadow-md), var(--shadow-glow-strong); }
}

.tab-btn[data-tab="chat"]::before { content: '💬'; }
.tab-btn[data-tab="effect"]::before { content: '📊'; }
.tab-btn[data-tab="risk"]::before { content: '🛡️'; }
.tab-btn[data-tab="rule"]::before { content: '📋'; }
.tab-btn[data-tab="forecast"]::before { content: '🔮'; }
.tab-btn[data-tab="expiry"]::before { content: '⏰'; }
.tab-btn[data-tab="store"]::before { content: '🏪'; }
.tab-btn[data-tab="cost"]::before { content: '💰'; }
.tab-btn[data-tab="third-order"]::before { content: '🛒'; }
.tab-btn[data-tab="challenge"]::before { content: '🏆'; }

/* ============================================================
   Tab 内容
   ============================================================ */
.tab-content { display: none; }

.tab-content.active {
  display: block;
  animation: tabFadeIn var(--duration-slow) var(--ease-out);
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   面板/卡片
   ============================================================ */
.panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

.panel:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* 光泽扫过 */
.panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  transition: left 0.8s var(--ease-out);
  pointer-events: none;
}

.panel:hover::after { left: 100%; }

.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

#effect-tab .panel::before { background: linear-gradient(90deg, #3b82f6, #6366f1); }
#risk-tab .panel::before { background: linear-gradient(90deg, #ef4444, #f97316); }
#rule-tab .panel::before { background: linear-gradient(90deg, #10b981, #34d399); }
#forecast-tab .panel::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
#expiry-tab .panel::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
#store-tab .panel::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
#cost-tab .panel::before { background: linear-gradient(90deg, #ec4899, #f472b6); }

.panel h2 {
  margin-bottom: var(--space-xs);
  color: var(--color-text);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.panel-icon {
  font-size: 1.2rem;
  display: inline-block;
  animation: iconBounce 3s ease-in-out infinite;
}

.panel-desc {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

/* ============================================================
   筛选栏
   ============================================================ */
.filter-bar {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar select {
  padding: 10px 36px 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  min-width: 150px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all var(--duration-fast) var(--ease-out);
}

.filter-bar select:hover { border-color: var(--color-primary-light); }
.filter-bar select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-bg); }

/* ============================================================
   按钮
   ============================================================ */
.btn-primary {
  padding: 10px 24px;
  background: var(--gradient-primary);
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-primary:hover {
  background: var(--gradient-primary-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-primary:active { transform: translateY(0) scale(0.98); box-shadow: var(--shadow-sm); }
.btn-primary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn-primary:disabled { background: var(--color-text-tertiary); cursor: not-allowed; box-shadow: none; transform: none; opacity: 0.6; }

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s var(--ease-out);
}

.btn-primary:hover::before { left: 100%; }
.btn-icon { font-size: 1.1em; transition: transform var(--duration-normal) var(--ease-out); }
.btn-primary:hover .btn-icon { transform: translateX(3px); }
.btn-text { position: relative; z-index: 1; }

/* 查看明细按钮 */
.btn-view-detail {
  padding: 4px 12px;
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary-border);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--duration-fast) var(--ease-out);
}
.btn-view-detail:hover {
  background: var(--color-primary);
  color: white;
}

/* ============================================================
   结果区域
   ============================================================ */
.result-area {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  min-height: 100px;
  border: 1px dashed var(--color-border);
  transition: border-color var(--duration-normal) var(--ease-out);
}

.result-area:not(:empty) { border-style: solid; border-color: var(--color-border-light); }

.result-area:empty::after {
  content: '🚀 点击上方按钮开始分析，结果将动态展示在这里';
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  color: var(--color-text-tertiary);
  font-size: 0.875rem;
  animation: emptyPulse 2s ease-in-out infinite;
}

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

.result-area h3 { color: var(--color-text); margin-bottom: var(--space-md); font-size: 1.05rem; font-weight: 600; }
.result-area h3:not(:first-child) { margin-top: var(--space-lg); }

/* ============================================================
   指标卡片
   ============================================================ */
.result-area .metric {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin: var(--space-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  min-width: 130px;
  position: relative;
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out);
  animation: metricPopIn 0.4s var(--ease-spring) both;
}

.result-area .metric:nth-child(1) { animation-delay: 0.1s; }
.result-area .metric:nth-child(2) { animation-delay: 0.2s; }
.result-area .metric:nth-child(3) { animation-delay: 0.3s; }
.result-area .metric:nth-child(4) { animation-delay: 0.4s; }

@keyframes metricPopIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

.result-area .metric:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--color-primary-border);
}

.result-area .metric::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(99,102,241,0.03) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease-out);
}

.result-area .metric:hover::after { transform: translateX(100%); }

.result-area .metric-value { font-size: 1.75rem; font-weight: 800; color: var(--color-primary); letter-spacing: -0.02em; line-height: 1.2; }
.result-area .metric-label { font-size: 0.8rem; color: var(--color-text-secondary); margin-top: var(--space-xs); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* ============================================================
   推荐框
   ============================================================ */
.result-area .recommendation {
  background: var(--color-info-bg);
  border-left: 3px solid var(--color-info);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-sm) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  color: var(--color-text);
  line-height: 1.7;
  position: relative;
  animation: recSlideIn 0.3s var(--ease-out) both;
}

@keyframes recSlideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.result-area .recommendation::before { content: '💡'; margin-right: var(--space-sm); }

/* ============================================================
   风险项
   ============================================================ */
.result-area .risk-item {
  background: var(--color-warning-bg);
  border-left: 3px solid var(--color-warning);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-sm) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  transition: all var(--duration-normal) var(--ease-out);
}

.result-area .risk-item.high {
  background: var(--color-danger-bg);
  border-left-color: var(--color-danger);
  animation: riskPulse 2s ease-in-out infinite;
}

@keyframes riskPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0.1); }
}

/* ============================================================
   图表容器
   ============================================================ */
.chart-container {
  height: 400px;
  margin-top: var(--space-lg);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}

/* ============================================================
   加载状态
   ============================================================ */
.loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.loading::before {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-right-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading::after {
  content: '正在加载数据';
  animation: loadingDots 1.5s steps(4, end) infinite;
}

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

@keyframes loadingDots {
  0% { content: '正在加载数据'; }
  25% { content: '正在加载数据.'; }
  50% { content: '正在加载数据..'; }
  75% { content: '正在加载数据...'; }
  100% { content: '正在加载数据'; }
}

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

.skeleton {
  background: linear-gradient(90deg, var(--color-surface-alt) 25%, var(--color-border-light) 50%, var(--color-surface-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ============================================================
   聊天界面
   ============================================================ */
.chat-container {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  height: calc(100vh - 200px);
  min-height: 600px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border-light);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.chat-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
}

.status-dot.online {
  background: var(--color-success);
  animation: statusPulse 2s ease-in-out infinite;
}

.status-pulse {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(16,185,129,0.2);
  margin-left: -12px;
  animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0; }
}

.chat-version {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.chat-container::before {
  content: '';
  height: 3px;
  background: var(--gradient-primary);
  background-size: 200% 200%;
  animation: headerGradientShift 4s ease infinite;
  flex-shrink: 0;
}

/* 模型选择工具栏 */
.chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 10px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-selector label {
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
}

.model-selector select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 200px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.model-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-icon {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: #667eea;
    border-color: #667eea;
}

.model-info {
    font-size: 0.85rem;
    color: #666;
    padding: 4px 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #eee;
}

.model-info.custom {
    color: #e67e22;
    border-color: #e67e22;
    background: #fef9e7;
}

/* 自定义模型弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.form-hint {
    font-size: 0.85rem;
    color: #888;
    margin-top: 8px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #eee;
}

.btn-secondary {
    padding: 8px 20px;
    background: #f1f3f5;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  background: var(--color-surface-alt);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
.chat-messages::-webkit-scrollbar-thumb:hover { background: var(--color-text-tertiary); }

/* 聊天欢迎区 */
.chat-welcome {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--color-text-secondary);
  animation: welcomeFadeIn 0.6s var(--ease-out) 0.3s both;
}

@keyframes welcomeFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.chat-welcome-icon {
  font-size: 3.5rem;
  margin-bottom: var(--space-md);
  display: block;
  animation: welcomeIconBounce 2s ease-in-out infinite;
}

@keyframes welcomeIconBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

.chat-welcome h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.chat-welcome p {
  font-size: 0.9rem;
  max-width: 500px;
  margin: 0 auto;
}

/* 快捷提问 */
.quick-prompts {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
  overflow-x: auto;
  flex-wrap: wrap;
}

.quick-prompt-label { font-size: 0.75rem; color: var(--color-text-tertiary); white-space: nowrap; }

.quick-prompt {
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  font-family: var(--font-sans);
}

.quick-prompt:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  border-color: var(--color-primary-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* 消息行 */
.chat-message {
  margin-bottom: var(--space-lg);
  display: flex;
  gap: 12px;
  animation: msgSlideIn 0.3s var(--ease-out);
}

.chat-message.user { flex-direction: row-reverse; }

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: white;
  position: relative;
}

.chat-message.assistant .chat-avatar { background: var(--gradient-ai-avatar); box-shadow: 0 2px 8px rgba(99,102,241,0.25); }
.chat-message.user .chat-avatar { background: var(--gradient-user-avatar); box-shadow: 0 2px 8px rgba(16,185,129,0.25); }

.chat-avatar::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255,255,255,0.5);
  pointer-events: none;
}

.chat-bubble {
  max-width: 72%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  line-height: 1.7;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
  word-break: break-word;
}

.chat-message.assistant .chat-bubble {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-top-left-radius: var(--radius-sm);
  color: var(--color-text);
}

.chat-message.user .chat-bubble {
  background: var(--gradient-user-msg);
  color: var(--color-text-inverse);
  border-top-right-radius: var(--radius-sm);
  box-shadow: var(--shadow-md), 0 4px 12px rgba(99,102,241,0.2);
}

.chat-bubble h1, .chat-bubble h2, .chat-bubble h3 { margin: var(--space-md) 0 var(--space-sm); font-weight: 700; line-height: 1.3; }
.chat-bubble h1 { font-size: 1.2rem; }
.chat-bubble h2 { font-size: 1.1rem; }
.chat-bubble h3 { font-size: 1rem; }
.chat-bubble ul, .chat-bubble ol { margin: var(--space-sm) 0; padding-left: var(--space-lg); }
.chat-bubble li { margin: var(--space-xs) 0; }
.chat-bubble strong { color: var(--color-primary); font-weight: 600; }
.chat-message.user .chat-bubble strong { color: inherit; }
.chat-bubble em { font-style: italic; opacity: 0.85; }
.chat-bubble table { width: 100%; border-collapse: collapse; margin: var(--space-md) 0; font-size: 0.85rem; }
.chat-bubble table th, .chat-bubble table td { padding: 8px 12px; border: 1px solid var(--color-border); text-align: left; }
.chat-bubble table th { background: var(--color-primary-bg); font-weight: 600; color: var(--color-text); }
.chat-bubble table td { color: var(--color-text); }
.chat-bubble table tbody tr:hover { background: var(--color-primary-bg); }
.chat-bubble pre { background: var(--color-surface-alt); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: var(--space-md); overflow-x: auto; margin: var(--space-md) 0; }
.chat-bubble pre code { font-family: 'Monaco', 'Menlo', 'Consolas', monospace; font-size: 0.8rem; color: var(--color-text); }
.chat-bubble code { background: var(--color-surface-alt); padding: 2px 6px; border-radius: 3px; font-family: 'Monaco', 'Menlo', 'Consolas', monospace; font-size: 0.85em; }
.chat-bubble hr { border: none; border-top: 1px solid var(--color-border); margin: var(--space-md) 0; }
.chat-bubble p { margin: var(--space-sm) 0; line-height: 1.6; }
.chat-bubble a { color: var(--color-primary); text-decoration: none; }
.chat-bubble a:hover { text-decoration: underline; }

/* ============================================================
   积分挑战详情页
   ============================================================ */
.detail-section { margin: var(--space-md) 0; padding: var(--space-md); background: var(--color-surface); border-radius: var(--radius-md); border: 1px solid var(--color-border-light); }
.detail-section h4 { color: var(--color-text); font-size: 0.95rem; font-weight: 600; margin-bottom: var(--space-sm); }
.detail-section p { color: var(--color-text-secondary); font-size: 0.85rem; margin: var(--space-xs) 0; }
.challenge-card { margin: var(--space-sm) 0; padding: var(--space-md); background: var(--color-surface-alt); border-radius: var(--radius-sm); border: 1px solid var(--color-border-light); }
.challenge-card h5 { color: var(--color-primary); font-size: 0.9rem; font-weight: 600; margin-bottom: var(--space-xs); }

/* ============================================================
   聊天输入区
   ============================================================ */
.chat-input-area {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  align-items: flex-end;
}

.input-wrapper { flex: 1; }

.chat-input-area textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  resize: none;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface-alt);
  transition: all var(--duration-fast) var(--ease-out);
}

.chat-input-area textarea::placeholder { color: var(--color-text-tertiary); }

.chat-input-area textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
  background: var(--color-surface);
}

.input-hint {
  font-size: 0.7rem;
  color: var(--color-text-tertiary);
  margin-top: 4px;
  padding-left: 4px;
}

.btn-send { padding: 12px 28px; min-height: 44px; }

/* ============================================================
   流式输出状态区
   ============================================================ */
.status-area { margin-bottom: var(--space-md); padding-bottom: var(--space-md); border-bottom: 1px dashed var(--color-border); }
.status-area:empty { display: none; }

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-xs) 0;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  background: var(--color-surface-alt);
  transition: all var(--duration-normal) var(--ease-out);
  border: 1px solid transparent;
}

.status-item.collapsed { opacity: 0.45; padding: 2px var(--space-md); font-size: 0.7rem; margin: 1px 0; border: none; background: transparent; }
.status-item.thinking { background: var(--color-info-bg); color: var(--color-info); border-color: rgba(59,130,246,0.15); }
.status-item.tool-call { background: var(--color-warning-bg); color: #d97706; border-color: rgba(245,158,11,0.15); }
.status-item.tool-result { background: var(--color-success-bg); color: #059669; border-color: rgba(16,185,129,0.15); }
.status-item.done { background: var(--color-success-bg); color: #059669; font-weight: 600; border-color: rgba(16,185,129,0.2); }
.status-icon { font-size: 1rem; flex-shrink: 0; }
.status-item.thinking .status-icon { animation: iconPulse 1.5s ease-in-out infinite; }

@keyframes iconPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}

.content-area { min-height: 20px; line-height: 1.7; }

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--color-primary);
  margin-left: 2px;
  animation: cursorBlink 0.8s ease-in-out infinite;
  vertical-align: text-bottom;
  border-radius: 1px;
}

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

.chat-message.user .typing-cursor { background: rgba(255,255,255,0.7); }

/* ============================================================
   表格
   ============================================================ */
table, .data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--space-md) 0;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

table th, .data-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
  border-bottom: 2px solid var(--color-border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

table td, .data-table td { padding: 11px 14px; border-bottom: 1px solid var(--color-border-light); color: var(--color-text); vertical-align: middle; }
table tbody tr, .data-table tbody tr { transition: background var(--duration-fast) var(--ease-out); }
table tbody tr:hover, .data-table tbody tr:hover { background: var(--color-primary-bg); }
table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: none; }
table td strong, .data-table td strong { color: var(--color-text); font-weight: 600; }

/* ============================================================
   徽章
   ============================================================ */
.tier-badge, .status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.tier-badge.high_active { background: var(--color-success-bg); color: #059669; border-color: rgba(16,185,129,0.2); }
.tier-badge.medium_active { background: var(--color-info-bg); color: #2563eb; border-color: rgba(59,130,246,0.2); }
.tier-badge.low_active { background: var(--color-warning-bg); color: #d97706; border-color: rgba(245,158,11,0.2); }
.tier-badge.silent { background: #f1f5f9; color: #64748b; border-color: var(--color-border); }

.status-badge.warning { background: var(--color-warning-bg); color: #d97706; border-color: rgba(245,158,11,0.2); }
.status-badge.info { background: var(--color-info-bg); color: #2563eb; border-color: rgba(59,130,246,0.2); }
.status-badge.success { background: var(--color-success-bg); color: #059669; border-color: rgba(16,185,129,0.2); }
.status-badge.danger { background: var(--color-danger-bg); color: #dc2626; border-color: rgba(239,68,68,0.2); }

td .metric { display: inline-flex; padding: 3px 10px; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; min-width: auto; margin: 0; box-shadow: none; border: 1px solid var(--color-border); background: var(--color-surface-alt); color: var(--color-text-secondary); }

/* ============================================================
   涟漪效果
   ============================================================ */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple 0.6s var(--ease-out) forwards;
  pointer-events: none;
}

@keyframes ripple {
  to { transform: translate(-50%, -50%) scale(30); opacity: 0; }
}

/* ============================================================
   最近动态
   ============================================================ */
.activity-feed {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
  position: relative;
  overflow: hidden;
  animation: feedFadeIn 0.5s var(--ease-out) 0.9s both;
}

@keyframes feedFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.activity-feed::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #10b981, #f59e0b, #ec4899);
}

.feed-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  color: var(--color-text);
}

.feed-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  border: 1px solid transparent;
}

.feed-item:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border-light);
}

.feed-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
  position: relative;
}

.feed-dot::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: calc(100% + 14px);
  background: var(--color-border);
}

.feed-item:last-child .feed-dot::after { display: none; }

.feed-dot-green { background: var(--color-success); box-shadow: 0 0 0 3px var(--color-success-bg); }
.feed-dot-yellow { background: var(--color-warning); box-shadow: 0 0 0 3px var(--color-warning-bg); }
.feed-dot-blue { background: var(--color-info); box-shadow: 0 0 0 3px var(--color-info-bg); }

.feed-content {
  flex: 1;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.feed-content strong {
  color: var(--color-text);
  font-weight: 600;
}

.feed-time {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  margin-top: 4px;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  margin-top: var(--space-xl);
  padding: var(--space-lg) 0;
  text-align: center;
  position: relative;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
}

.footer-divider { opacity: 0.5; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
  .container { padding: var(--space-md); }
  .header h1 { font-size: 1.75rem; }
  .chat-container { height: calc(100vh - 280px); }
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
  .feature-cards { grid-template-columns: repeat(2, 1fr); }
  .feed-items { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .container { padding: var(--space-sm); }
  .header { padding: var(--space-lg) var(--space-md); }
  .header h1 { font-size: 1.5rem; }
  .header h1::before { font-size: 1.3rem; }
  .subtitle { font-size: 0.8rem; }
  .subtitle::before, .subtitle::after { width: 16px; }
  .header-tags { gap: var(--space-xs); }
  .header-tag { font-size: 0.7rem; padding: 4px 10px; }

  .nav-tabs { flex-wrap: nowrap; gap: 2px; padding: var(--space-xs); overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-btn { padding: 8px 14px; font-size: 0.8rem; }

  .panel { padding: var(--space-md); }
  .panel h2 { font-size: 1.125rem; }
  .panel-desc { font-size: 0.8rem; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar select, .filter-bar .btn-primary { width: 100%; }

  .chat-container { height: calc(100vh - 260px); min-height: 400px; }
  .chat-messages { padding: var(--space-md); }
  .chat-bubble { max-width: 85%; padding: 12px 14px; font-size: 0.85rem; }
  .chat-avatar { width: 32px; height: 32px; font-size: 0.75rem; }
  .chat-input-area { padding: var(--space-sm) var(--space-md); }
  .quick-prompts { padding: var(--space-sm); }

  .result-area .metric { min-width: 100px; padding: var(--space-sm) var(--space-md); }
  .result-area .metric-value { font-size: 1.375rem; }
  .chart-container { height: 300px; }

  table, .data-table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  .stat-card { padding: var(--space-md) var(--space-lg); }
  .stat-value { font-size: 1.375rem; }

  .feature-card { padding: var(--space-md); }
  .feature-icon { font-size: 2rem; }
}

@media (max-width: 480px) {
  .header h1 { font-size: 1.25rem; }
  .header h1::before { display: none; }
  .header-time { display: none; }
  .tab-btn { padding: 6px 10px; font-size: 0.75rem; }
  .tab-btn::before { font-size: 0.85rem; }
  .btn-primary { padding: 8px 18px; font-size: 0.8rem; }
  .result-area { padding: var(--space-md); }
  .chat-bubble { max-width: 90%; }
  .quick-stats { grid-template-columns: 1fr; }
  .feature-cards { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.5rem; }
}

/* ============================================================
   无障碍 & 焦点
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* 打印样式 */
@media print {
  .header { background: none; color: black; box-shadow: none; }
  .header-glow, .bg-particles, .bg-grid, .wave-divider { display: none; }
  .nav-tabs { display: none; }
  .chat-input-area, .quick-prompts { display: none; }
  .chat-container { height: auto; box-shadow: none; border: none; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
  .footer, .activity-feed { display: none; }
  .stat-card, .feature-card { break-inside: avoid; }
}
