/* ============================================
   AI 投資量化策略儀表板 — 樣式系統
   ============================================ */

/* --- Google Fonts 已在 HTML 中引入 --- */

/* ==========================================
   1. Design Tokens (CSS Custom Properties)
   ========================================== */
:root {
  /* 色彩系統 */
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1629;
  --bg-card: rgba(15, 22, 41, 0.75);
  --bg-card-hover: rgba(20, 30, 55, 0.85);
  --bg-sidebar: rgba(10, 14, 30, 0.95);
  --bg-input: rgba(20, 30, 55, 0.6);

  --accent-blue: #00d4ff;
  --accent-green: #00ff88;
  --accent-red: #ff4466;
  --accent-orange: #ffaa00;
  --accent-purple: #a855f7;

  --text-primary: #e8ecf4;
  --text-secondary: #8892a8;
  --text-muted: #4a5568;

  --border-subtle: rgba(0, 212, 255, 0.12);
  --border-glow: rgba(0, 212, 255, 0.3);

  --gradient-blue: linear-gradient(135deg, #00d4ff, #0088cc);
  --gradient-green: linear-gradient(135deg, #00ff88, #00cc6a);
  --gradient-red: linear-gradient(135deg, #ff4466, #cc2244);
  --gradient-card: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(0, 255, 136, 0.03));

  /* 間距系統 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* 圓角 */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* 字體 */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* 陰影 */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 212, 255, 0.1);
  --shadow-glow-blue: 0 0 20px rgba(0, 212, 255, 0.15), 0 0 40px rgba(0, 212, 255, 0.05);
  --shadow-glow-green: 0 0 20px rgba(0, 255, 136, 0.15), 0 0 40px rgba(0, 255, 136, 0.05);

  /* 過渡 */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* 側邊欄寬度 */
  --sidebar-width: 220px;
  --header-height: 60px;
}

/* ==========================================
   1.5 Theme Switcher Styles & Light Theme
   ========================================== */
.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-base);
  user-select: none;
}

.theme-toggle-btn:hover {
  background: rgba(0, 212, 255, 0.12);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow-blue);
  transform: scale(1.05);
}

body.light-theme {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-sidebar: rgba(248, 250, 252, 0.95);
  --bg-input: rgba(226, 232, 240, 0.8);

  --accent-blue: #0284c7;
  --accent-green: #16a34a;
  --accent-red: #dc2626;
  --accent-orange: #ea580c;
  --accent-purple: #7c3aed;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-subtle: rgba(2, 132, 199, 0.15);
  --border-glow: rgba(2, 132, 199, 0.3);

  --gradient-blue: linear-gradient(135deg, #0284c7, #0369a1);
  --gradient-green: linear-gradient(135deg, #16a34a, #15803d);
  --gradient-red: linear-gradient(135deg, #dc2626, #b91c1c);
  --gradient-card: linear-gradient(135deg, rgba(2, 132, 199, 0.03), rgba(22, 163, 74, 0.02));

  --shadow-card: 0 4px 20px rgba(15, 23, 42, 0.06), 0 0 1px rgba(2, 132, 199, 0.08);
  --shadow-glow-blue: 0 0 20px rgba(2, 132, 199, 0.08), 0 0 40px rgba(2, 132, 199, 0.02);
  --shadow-glow-green: 0 0 20px rgba(22, 163, 74, 0.08), 0 0 40px rgba(22, 163, 74, 0.02);
}

body.light-theme::before {
  background:
    radial-gradient(ellipse 600px 400px at 20% 10%, rgba(2, 132, 199, 0.04), transparent),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(22, 163, 74, 0.03), transparent),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(124, 58, 237, 0.02), transparent);
}

body.light-theme .theme-toggle-btn {
  background: rgba(15, 23, 42, 0.05);
}

body.light-theme .theme-toggle-btn:hover {
  background: rgba(2, 132, 199, 0.08);
}


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

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* 背景網格 + 光暈 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 600px 400px at 20% 10%, rgba(0, 212, 255, 0.06), transparent),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(0, 255, 136, 0.04), transparent),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(168, 85, 247, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

/* 自訂捲軸 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ==========================================
   3. Layout
   ========================================== */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr auto;
  grid-template-areas:
    "sidebar header"
    "sidebar main"
    "sidebar footer";
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ==========================================
   4. Header
   ========================================== */
.header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  z-index: 10;
}

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

.header__logo {
  width: 32px;
  height: 32px;
  background: var(--gradient-blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--bg-primary);
}

.header__title {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

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

.header__clock {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.header__status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--accent-green); }
  50% { opacity: 0.5; box-shadow: 0 0 12px var(--accent-green); }
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-xs);
  line-height: 1;
}

/* ==========================================
   5. Sidebar
   ========================================== */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-lg) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  backdrop-filter: blur(20px);
  overflow-y: auto;
  z-index: 20;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar__logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar__logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.sidebar__nav-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  padding-left: var(--space-sm);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-base);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(0, 212, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.nav-item--active {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-blue);
  border-color: rgba(0, 212, 255, 0.2);
}

.nav-item__icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

.sidebar__version {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================
   6. Main Content
   ========================================== */
.main {
  grid-area: main;
  padding: var(--space-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ==========================================
   7. 數據卡片
   ========================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  animation: fadeSlideUp 0.5s ease backwards;
}

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

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-card--blue::before { background: var(--gradient-blue); }
.stat-card--green::before { background: var(--gradient-green); }
.stat-card--orange::before { background: linear-gradient(90deg, var(--accent-orange), #ff8800); }
.stat-card--purple::before { background: linear-gradient(90deg, var(--accent-purple), #7c3aed); }

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow-blue);
  transform: translateY(-2px);
}

.stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

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

.stat-card__icon {
  font-size: 1.2rem;
  opacity: 0.6;
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-xs);
}

.stat-card__value--blue { color: var(--accent-blue); }
.stat-card__value--green { color: var(--accent-green); }
.stat-card__value--orange { color: var(--accent-orange); }
.stat-card__value--purple { color: var(--accent-purple); }

.stat-card__change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.stat-card__change--up {
  color: var(--accent-green);
  background: rgba(0, 255, 136, 0.1);
}

.stat-card__change--down {
  color: var(--accent-red);
  background: rgba(255, 68, 102, 0.1);
}

/* ==========================================
   8. 圖表區域
   ========================================== */
.chart-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  animation: fadeSlideUp 0.5s ease 0.25s backwards;
  min-width: 0;
  overflow: hidden;
}

.chart-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.chart-panel__title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.chart-panel__title-icon {
  color: var(--accent-blue);
}

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

.chart-period-btn {
  padding: 4px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chart-period-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.chart-period-btn--active {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.chart-container {
  width: 100%;
  height: 420px;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.chart-container--sub {
  height: 200px;
}

/* ==========================================
   9. AI 策略面板 + 輔助圖表
   ========================================== */
.strategy-section {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: var(--space-md);
  animation: fadeSlideUp 0.5s ease 0.35s backwards;
}

.ai-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.ai-panel__title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--accent-purple);
}

/* AI 策略選擇器 */
.strategy-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

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

.strategy-select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.strategy-select:focus {
  outline: none;
  border-color: var(--accent-blue);
}

/* AI 執行按鈕 */
.ai-run-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.ai-run-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.3), 0 0 48px rgba(168, 85, 247, 0.15);
}

.ai-run-btn:active {
  transform: translateY(0);
}

.ai-run-btn--scanning {
  pointer-events: none;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
}

/* 掃描動畫 */
.ai-run-btn--scanning::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: scanLine 1.5s ease-in-out infinite;
}

@keyframes scanLine {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* 按鈕光暈脈動 */
.ai-run-btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-base);
  filter: blur(8px);
}

.ai-run-btn:hover::before {
  opacity: 0.5;
}

/* 信心度儀表 */
.confidence-gauge {
  text-align: center;
}

.confidence-gauge__label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.gauge-container {
  width: 100%;
  height: 160px;
}

/* 信號歷史 */
.signal-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-height: 0;
}

.signal-history__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.signal-history__list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-height: 220px;
}

.signal-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  border-left: 3px solid transparent;
  animation: fadeSlideIn 0.3s ease backwards;
}

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

.signal-item--buy {
  border-left-color: var(--accent-green);
}

.signal-item--sell {
  border-left-color: var(--accent-red);
}

.signal-item--hold {
  border-left-color: var(--accent-orange);
}

.signal-item__badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  flex-shrink: 0;
}

.signal-item__badge--buy {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent-green);
}

.signal-item__badge--sell {
  background: rgba(255, 68, 102, 0.15);
  color: var(--accent-red);
}

.signal-item__badge--hold {
  background: rgba(255, 170, 0, 0.15);
  color: var(--accent-orange);
}

.signal-item__text {
  flex: 1;
  color: var(--text-secondary);
}

.signal-item__time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* 輔助圖表 */
.sub-charts {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.sub-chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  min-width: 0;
  overflow: hidden;
}

.sub-chart-panel__title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-primary);
}

/* ==========================================
   10. Toast 通知
   ========================================== */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  right: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  min-width: 320px;
  max-width: 420px;
  animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.toast--removing {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
}

.toast--buy::before { background: var(--accent-green); }
.toast--sell::before { background: var(--accent-red); }
.toast--hold::before { background: var(--accent-orange); }
.toast--info::before { background: var(--accent-blue); }

.toast__icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast__content {
  flex: 1;
}

.toast__title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.toast--buy .toast__title { color: var(--accent-green); }
.toast--sell .toast__title { color: var(--accent-red); }
.toast--hold .toast__title { color: var(--accent-orange); }
.toast--info .toast__title { color: var(--accent-blue); }

.toast__message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
  transition: color var(--transition-fast);
}

.toast__close:hover {
  color: var(--text-primary);
}

/* 進度條 */
.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent-blue);
  animation: progressShrink 4s linear forwards;
}

@keyframes progressShrink {
  from { width: 100%; }
  to { width: 0%; }
}

/* ==========================================
   11. Footer
   ========================================== */
.footer {
  grid-area: footer;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer__disclaimer {
  max-width: 600px;
}

.footer__copyright {
  font-family: var(--font-mono);
}

/* ==========================================
   12. Sidebar Overlay (Mobile)
   ========================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 15;
  backdrop-filter: blur(4px);
}

.sidebar-overlay--active {
  display: block;
}

/* ==========================================
   13. 載入掃描效果
   ========================================== */
.scan-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.7);
  border-radius: var(--radius-md);
  z-index: 5;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-md);
  backdrop-filter: blur(4px);
}

.scan-overlay--active {
  display: flex;
}

.scan-overlay__text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-blue);
  letter-spacing: 1px;
  animation: scanPulse 1.5s ease-in-out infinite;
}

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

.scan-progress {
  width: 200px;
  height: 3px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
}

.scan-progress__bar {
  height: 100%;
  background: var(--gradient-blue);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

/* ==========================================
   14. 響應式設計 (RWD)
   ========================================== */

/* 平板 (<= 1024px) */
@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "footer";
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    transition: left var(--transition-slow);
    z-index: 20;
  }

  .sidebar--open {
    left: 0;
  }

  .hamburger-btn {
    display: block;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .strategy-section {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 350px;
  }
}

/* 手機 (<= 640px) */
@media (max-width: 640px) {
  html {
    font-size: 13px;
  }

  .main {
    padding: var(--space-md);
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-card__value {
    font-size: 1.35rem;
  }

  .chart-container {
    height: 280px;
  }

  .chart-container--sub {
    height: 160px;
  }

  .header__title {
    font-size: 0.95rem;
  }

  .header__clock {
    display: none;
  }

  .toast {
    min-width: 280px;
    max-width: calc(100vw - 32px);
  }

  .footer {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}

/* 超小螢幕 (<= 400px) */
@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
