/* ==========================================================================
   Pyramid Fund Master - Modern Glassmorphism & Progressive Blur Design System
   UI 视觉对齐、渐进模糊、简洁清爽、移动端与电脑端完美自适应
   ========================================================================== */

:root {
  /* 基础色彩 */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  
  /* 深色主题 (默认豪华黑曜石磨砂玻璃) */
  --bg-primary: #0a0e17;
  --bg-secondary: rgba(18, 24, 38, 0.65);
  --bg-card: rgba(22, 30, 49, 0.55);
  --bg-card-hover: rgba(30, 41, 65, 0.7);
  --bg-input: rgba(14, 20, 32, 0.7);
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-bright: rgba(255, 255, 255, 0.16);
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  /* 中国股市颜色惯例 (红涨绿跌) */
  --color-up: #ef4444;
  --color-up-bg: rgba(239, 68, 68, 0.12);
  --color-up-border: rgba(239, 68, 68, 0.28);
  --color-down: #10b981;
  --color-down-bg: rgba(16, 185, 129, 0.12);
  --color-down-border: rgba(16, 185, 129, 0.28);
  
  --color-accent: #3b82f6;
  --color-accent-hover: #2563eb;
  --color-accent-bg: rgba(59, 130, 246, 0.15);

  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);

  /* 渐进模糊与阴影 */
  --blur-sm: 8px;
  --blur-md: 16px;
  --blur-lg: 24px;
  --shadow-glass: 0 12px 36px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 2px 8px 0 rgba(0, 0, 0, 0.2);
  --shadow-popup: 0 20px 48px 0 rgba(0, 0, 0, 0.5);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* 浅色主题支持 */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: rgba(255, 255, 255, 0.78);
  --bg-card: rgba(255, 255, 255, 0.65);
  --bg-card-hover: rgba(255, 255, 255, 0.9);
  --bg-input: rgba(248, 250, 252, 0.9);

  --border-glass: rgba(0, 0, 0, 0.06);
  --border-glass-bright: rgba(0, 0, 0, 0.12);

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

  --shadow-glass: 0 8px 28px 0 rgba(0, 0, 0, 0.06), inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
}

/* 国际配色模式 (绿涨红跌) */
[data-color-mode="intl"] {
  --color-up: #10b981;
  --color-up-bg: rgba(16, 185, 129, 0.12);
  --color-up-border: rgba(16, 185, 129, 0.28);
  --color-down: #ef4444;
  --color-down-bg: rgba(239, 68, 68, 0.12);
  --color-down-border: rgba(239, 68, 68, 0.28);
}

/* ==========================================================================
   全局重置与移动端防误触
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 严格禁用双击放大误触与长按弹出层 */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  overflow-x: hidden;
}

/* 背景环境光晕，营造高阶磨砂渐进质感 */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.glow-orb-1 {
  position: absolute;
  top: -15%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  min-width: 320px;
  min-height: 320px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0) 70%);
  border-radius: 50%;
  filter: blur(60px);
}

.glow-orb-2 {
  position: absolute;
  bottom: 10%;
  left: -15%;
  width: 60vw;
  height: 60vw;
  min-width: 360px;
  min-height: 360px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0) 70%);
  border-radius: 50%;
  filter: blur(80px);
}

/* 数字等宽对齐 */
.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ==========================================================================
   自定义极简半透明磨砂滚动条 (替换系统默认白色粗滚动条)
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.12);
}

/* 策略各档位列表滚动条专门微调 */
#cfgTiersList::-webkit-scrollbar {
  width: 5px;
}

#cfgTiersList::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}

#cfgTiersList::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 3px;
}

#cfgTiersList::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.38);
}

/* 通用容器 */
.app-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 80px) 16px;
}

/* ==========================================================================
   磨砂玻璃卡片通用类 (Progressive Blur)
   ========================================================================== */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-md)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ==========================================================================
   Header 导航栏 (响应式两段式结构，桌面单行，移动端自适应分层)
   ========================================================================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(var(--blur-lg)) saturate(190%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(190%);
  gap: 14px;
}

.nav-main-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-sub-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 按钮通用 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  min-height: 38px;
  white-space: nowrap;
  word-break: keep-all;
  flex-shrink: 0;
}

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

.btn-icon-only {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 32px;
  border-radius: var(--radius-sm);
}

/* 14:00 巡检状态指示小胶囊 */
.snapshot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: var(--color-accent);
  white-space: nowrap;
  word-break: keep-all;
  flex-shrink: 0;
}

.snapshot-pill.done {
  background: var(--color-down-bg);
  border-color: var(--color-down-border);
  color: var(--color-down);
}

/* 买卖信号常驻触发提醒胶囊 */
.btn-signal-pill {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
  color: var(--color-up) !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
  white-space: nowrap;
  word-break: keep-all;
  flex-shrink: 0;
}

.btn-signal-pill:hover {
  background: rgba(239, 68, 68, 0.28) !important;
  transform: translateY(-1px);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulse-dot 2s infinite ease-in-out;
}

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

/* ==========================================================================
   今日买卖提醒告警横幅 (Alert Banner)
   ========================================================================== */
.alert-banner {
  display: none; /* 有信号时触发 */
  padding: 16px 18px;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(245, 158, 11, 0.18));
  border: 1px solid rgba(239, 68, 68, 0.35);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  animation: slide-in-down 0.3s ease-out;
}

.alert-banner.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.alert-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.alert-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.alert-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  word-break: break-word;
}

.alert-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 动态买卖操作卡片列表 */
.signal-alert-items-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.signal-alert-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.25s ease;
}

/* 成功执行加减仓提醒：绿色背景与绿色边框 */
.signal-alert-card.executed {
  background: var(--color-down-bg) !important;
  border-color: var(--color-down-border) !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.15);
}

.signal-alert-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.signal-alert-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.signal-alert-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.signal-alert-badge.badge-buy {
  background: var(--color-down-bg);
  color: var(--color-down);
  border: 1px solid var(--color-down-border);
}

.signal-alert-badge.badge-sell {
  background: var(--color-up-bg);
  color: var(--color-up);
  border: 1px solid var(--color-up-border);
}

.signal-alert-badge.badge-executed {
  background: rgba(16, 185, 129, 0.25);
  color: var(--color-down);
  border: 1px solid var(--color-down-border);
  font-weight: 700;
}

.signal-alert-fund-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal-alert-detail {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.signal-alert-action-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-action-buy {
  background: var(--color-down) !important;
  color: #fff !important;
  font-weight: 700;
  border: none !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.btn-action-buy:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-action-sell {
  background: var(--color-up) !important;
  color: #fff !important;
  font-weight: 700;
  border: none !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.btn-action-sell:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.signal-executed-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-down);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--color-down-border);
}

/* ==========================================================================
   资产总览卡片 (Portfolio Summary)
   ========================================================================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.summary-item {
  display: flex;
  flex-direction: column;
}

.summary-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.summary-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.summary-sub {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

/* 涨跌色彩类 */
.text-up {
  color: var(--color-up) !important;
}

.text-down {
  color: var(--color-down) !important;
}

.badge-up {
  background: var(--color-up-bg);
  color: var(--color-up);
  border: 1px solid var(--color-up-border);
}

.badge-down {
  background: var(--color-down-bg);
  color: var(--color-down);
  border: 1px solid var(--color-down-border);
}

/* ==========================================================================
   持仓基金列表区
   ========================================================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-muted);
}

.fund-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   单只基金卡片 (Fund Card - 视觉对齐与信息分层)
   ========================================================================== */
.fund-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.fund-card:hover {
  border-color: var(--border-glass-bright);
}

/* 卡片顶部：名称、代码、估值涨跌幅 */
.fund-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.fund-info-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.fund-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
  word-break: break-word;
}

.fund-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.fund-code {
  font-weight: 600;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
}

.fund-rate-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.fund-rate-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.fund-rate-badge .rate-label {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.85;
}

.fund-gz-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 卡片指标分层框：分成清晰独立的两行与毛玻璃微卡片 */
.fund-metrics-box {
  display: flex;
  flex-direction: column;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  margin-bottom: 16px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.metric-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  min-height: 58px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.metric-col:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.metric-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-number {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-date {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 3px;
}

.metric-rate-sub {
  font-size: 11.5px;
  font-weight: 600;
  margin-left: 3px;
}

.metrics-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 10px 0;
}

.metrics-divider::before,
.metrics-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.divider-text {
  padding: 0 10px;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ==========================================================================
   金字塔策略阶梯进度指示器 (Pyramid Ladder Visualization)
   ========================================================================== */
.ladder-section {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  margin-bottom: 16px;
}

.ladder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
}

.anchor-tag {
  color: var(--text-muted);
  font-size: 11px;
}

/* 金字塔下一买卖点建议提示条 */
.next-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.action-pill {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  font-size: 12px;
}

.action-pill.buy-alert {
  border-color: var(--color-down-border);
  background: var(--color-down-bg);
}

.action-pill.sell-alert {
  border-color: var(--color-up-border);
  background: var(--color-up-bg);
}

.action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  font-weight: 600;
}

.action-detail {
  font-size: 11px;
  color: var(--text-muted);
}

/* 阶梯可视化刻度条 */
.ladder-track {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.tier-step-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.tier-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.3s ease;
}

.tier-bar.active-buy {
  background: var(--color-down);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.tier-bar.active-sell {
  background: var(--color-up);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.tier-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
}

/* 卡片操作按钮栏 */
.fund-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-glass);
  flex-wrap: wrap;
}

/* ==========================================================================
   弹窗与表单 (Modals & Form Controls)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
  animation: fade-in 0.2s ease-out;
}

.modal-content {
  width: 100%;
  max-width: 520px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popup);
  padding: 24px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-tip {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
}

/* 空状态卡片 */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  font-size: 40px;
  opacity: 0.6;
}

.empty-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-sub {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 300px;
}

/* ==========================================================================
   基金历程时间轴样式 (Timeline Modal & Breathing Light)
   ========================================================================== */
.timeline-modal-content {
  max-width: 560px;
}

.timeline-container {
  position: relative;
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px 14px 16px 6px;
}

/* 时间轴主轨道与贯穿竖线 */
.timeline-track {
  position: relative;
  padding-left: 30px;
}

.timeline-track::before {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 9px;
  width: 2px;
  background: linear-gradient(to bottom, var(--color-accent) 0%, rgba(255, 255, 255, 0.1) 100%);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  margin-bottom: 18px;
  animation: fade-in 0.25s ease-out;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

/* 时间轴圆点节点 */
.timeline-dot {
  position: absolute;
  left: -30px;
  top: 13px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  background: var(--color-accent);
  z-index: 2;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.timeline-dot.dot-init {
  background: #3b82f6;
  --pulse-color: rgba(59, 130, 246, 0.85);
}

.timeline-dot.dot-buy,
.timeline-dot.dot-buy_alert {
  background: var(--color-down);
  --pulse-color: rgba(16, 185, 129, 0.85);
}

.timeline-dot.dot-sell,
.timeline-dot.dot-sell_alert {
  background: var(--color-up);
  --pulse-color: rgba(239, 68, 68, 0.85);
}

.timeline-dot.dot-pending {
  background: #f59e0b;
  --pulse-color: rgba(245, 158, 11, 0.85);
}

/* 最新时间节点呼吸灯动画 (Pulsing Breathing Light) */
.timeline-dot.latest {
  width: 16px;
  height: 16px;
  left: -31px;
  top: 12px;
  border-width: 2.5px;
}

.breathing-glow {
  animation: breathing-pulse-glow 1.8s infinite ease-in-out;
}

@keyframes breathing-pulse-glow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 var(--pulse-color, rgba(59, 130, 246, 0.8));
  }
  50% {
    transform: scale(1.28);
    box-shadow: 0 0 14px 4px var(--pulse-color, rgba(59, 130, 246, 0.95));
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 var(--pulse-color, rgba(59, 130, 246, 0));
  }
}

/* 时间轴事件卡片 */
.timeline-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: all 0.2s ease;
}

.timeline-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-glass-bright);
}

.timeline-card.is-latest-card {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.timeline-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.timeline-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.timeline-tag.tag-init {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.timeline-tag.tag-buy {
  background: var(--color-down-bg);
  color: var(--color-down);
  border: 1px solid var(--color-down-border);
}

.timeline-tag.tag-sell {
  background: var(--color-up-bg);
  color: var(--color-up);
  border: 1px solid var(--color-up-border);
}

.timeline-tag.tag-buy_alert {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-down);
  border: 1px dashed var(--color-down);
}

.timeline-tag.tag-sell_alert {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-up);
  border: 1px dashed var(--color-up);
}

.timeline-tag.tag-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px dashed rgba(245, 158, 11, 0.5);
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline-latest-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.timeline-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-primary);
}

.timeline-sub-detail {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   响应式断点 (Mobile & Desktop 极致排版优化)
   ========================================================================== */
@media (max-width: 768px) {
  .app-container {
    padding-left: 12px;
    padding-right: 12px;
    padding-top: calc(var(--safe-top) + 12px);
    padding-bottom: calc(var(--safe-bottom) + 60px);
  }

  /* 顶部导航栏：双层布局，杜绝单字竖折与挤压 */
  .navbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
  }

  .nav-main-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-sub {
    display: none; /* 移动端隐藏副标题，为操作按钮释放横向空间 */
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .nav-tools {
    gap: 6px;
  }

  .nav-tools .btn {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 32px;
  }

  .nav-sub-bar {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    margin-left: 0;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-sub-bar::-webkit-scrollbar {
    display: none;
  }

  /* 买卖告警横幅移动端优化 */
  .alert-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  .alert-banner.active {
    flex-direction: column;
    align-items: stretch;
  }

  .alert-banner .alert-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
  }

  /* 资产总览统计卡片 */
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 10px;
    padding: 14px 12px;
    margin-bottom: 16px;
  }

  .summary-label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .summary-value {
    font-size: 18px;
  }

  .summary-sub {
    font-size: 11px;
  }

  /* 基金卡片内边距与头部紧凑化 */
  .fund-card {
    padding: 14px 12px;
  }

  .fund-header {
    margin-bottom: 12px;
    gap: 8px;
  }

  .fund-name {
    font-size: 15px;
  }

  .fund-meta {
    font-size: 11px;
    gap: 6px 8px;
  }

  .fund-rate-badge {
    padding: 4px 8px;
    font-size: 13px;
  }

  .fund-gz-time {
    font-size: 10.5px;
  }

  /* 指标分层微卡片：2x2 网格，清晰独立 */
  .fund-metrics-box {
    padding: 10px;
    margin-bottom: 14px;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .metric-col {
    padding: 8px 10px;
    min-height: 52px;
  }

  .metric-title {
    font-size: 10.5px;
    margin-bottom: 2px;
  }

  .metric-number {
    font-size: 13.5px;
  }

  .metric-rate-sub {
    font-size: 11px;
  }

  .metric-date {
    font-size: 10px;
  }

  .divider-text {
    font-size: 9.5px;
    padding: 0 8px;
  }

  /* 阶梯决策指示区 */
  .ladder-section {
    padding: 10px 12px;
    margin-bottom: 12px;
  }

  .ladder-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 12px;
  }

  .anchor-tag {
    font-size: 10.5px;
  }

  .next-action-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .action-pill {
    padding: 8px 10px;
    font-size: 11.5px;
  }

  .action-header {
    font-size: 11.5px;
  }

  .action-detail {
    font-size: 11px;
  }

  /* 卡片操作按钮：人体工学双列自适应排布，方便单手触达 */
  .fund-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 10px;
    margin-top: 12px;
  }

  .fund-card-actions button {
    width: 100%;
    margin: 0;
    padding: 8px 6px;
    font-size: 12px;
    white-space: nowrap;
    justify-content: center;
  }

  .fund-card-actions button[data-action="buy"] {
    grid-column: 1 / 2;
  }

  .fund-card-actions button[data-action="sell"] {
    grid-column: 2 / 3;
  }

  .fund-card-actions button[data-action="timeline"] {
    grid-column: 1 / 2;
  }

  .fund-card-actions button[data-action="strategy"] {
    grid-column: 2 / 3;
  }

  .fund-card-actions button[data-action="edit"] {
    grid-column: 1 / -1;
  }

  .fund-card-actions button[data-action="delete"] {
    grid-column: 1 / -1;
    min-height: 28px;
    padding: 4px;
    font-size: 11px;
    color: var(--text-dim) !important;
    background: transparent;
    border: none;
  }

  /* 移动端告警卡片自适应 */
  .signal-alert-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .signal-alert-action-box {
    width: 100%;
    justify-content: flex-end;
  }

  .signal-alert-action-box button {
    width: 100%;
  }

  /* 移动端时间轴贴合度 */
  .timeline-container {
    max-height: 65vh;
    padding: 6px 4px 14px 2px;
  }

  .timeline-track {
    padding-left: 24px;
  }

  .timeline-dot {
    left: -24px;
  }

  .timeline-dot.latest {
    left: -25px;
  }

  /* 弹窗在手机端贴合度 */
  .modal-content {
    padding: 18px 14px;
    max-height: 94vh;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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