/* ===================================================
   PerpPulse 分析工具 - H5 手机优先样式
   =================================================== */

:root {
  --bg-primary: #eff6ff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f9ff;
  --bg-input: #f1f5f9;

  --text-primary: #1e3a8a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: #e2e8f0;
  --border-light: #cbd5e1;

  --accent: #2563eb;
  --accent-hover: #3b82f6;
  --accent-dim: rgba(37, 99, 235, 0.1);
  --brand: #2563eb;
  --brand-bg: rgba(37, 99, 235, 0.1);

  --long: #0891b2;
  --long-dim: rgba(8, 145, 178, 0.1);
  --short: #dc2626;
  --short-dim: rgba(220, 38, 38, 0.1);
  --neutral: #94a3b8;
  --warning: #ea580c;
  --warning-dim: rgba(234, 88, 12, 0.1);
  --warning-border: rgba(234, 88, 12, 0.3);
  --bg-warning: rgba(234, 88, 12, 0.08);
  --danger: #dc2626;

  --chart-bg: #ffffff;
  --chart-grid: #e2e8f0;
  --chart-text: #1e3a8a;
  --chart-long: #0891b2;
  --chart-short: #dc2626;
  --chart-ema7: #0f172a;
  --chart-ema25: #2563eb;
  --chart-ema99: #7c3aed;
  --chart-bb: #94a3b8;
  --chart-entry: #2563eb;
  --chart-vol-neutral: #94a3b8;

  --shadow: 0 4px 20px rgba(37, 99, 235, 0.08);
  --radius: 12px;
  --radius-sm: 8px;

  --nav-height: 56px;
  --topbar-height: 52px;
  --status-height: 32px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ============== 顶部导航 ============== */
.topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.topbar-top {
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--topbar-height);
  gap: 12px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
}
.logo-icon { font-size: 20px; }
.logo-text { color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  max-width: 75%;
  justify-content: flex-end;
}
.member-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-input);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  font-size: 11px;
  max-width: 140px;
  min-width: 0;
  overflow: hidden;
  flex-shrink: 0;
}
.member-name { font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
.member-badge {
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-muted);
  flex-shrink: 0;
}
.member-badge.member {
  background: var(--long-dim);
  color: var(--long);
}
.login-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 36px;
  flex-shrink: 0;
}
.login-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* 用户菜单 */
.user-menu-wrap {
  position: relative;
  flex-shrink: 0;
}
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.user-menu-trigger:hover {
  background: var(--bg-secondary);
  border-color: var(--brand);
}
.user-menu-trigger:active,
.user-menu-trigger.active {
  background: var(--brand-bg);
  border-color: var(--brand);
}
.user-info-right {
  text-align: right;
}
.user-name-top {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.user-badge-top {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}
.user-badge-top.member {
  color: var(--brand);
}
.user-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.2s;
  margin-left: 2px;
}
.user-menu-trigger:hover .user-arrow,
.user-menu-trigger.active .user-arrow {
  color: var(--brand);
  transform: rotate(180deg);
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #ffffff;
  flex-shrink: 0;
  border: 2px solid var(--bg-input);
}
.user-menu-trigger:hover .user-avatar,
.user-menu-trigger.active .user-avatar {
  border-color: var(--brand);
}
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  max-width: 240px;
  width: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 200;
}
.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
}
.user-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #ffffff;
  flex-shrink: 0;
}
.user-dropdown-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.user-dropdown-type {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.user-dropdown-expire {
  font-size: 11px;
  color: var(--brand);
  margin-top: 4px;
}
.user-dropdown-contact {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}
.user-dropdown-contact-edit {
  padding: 12px 16px;
}
.contact-input {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 12px;
}
.edit-contact-btn {
  margin-top: 8px;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  font-size: 11px !important;
  border-top: 1px solid var(--border);
}
.user-dropdown-divider {
  height: 1px;
  background: var(--border);
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.user-dropdown-item:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}
.dropdown-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* ============== 状态栏 ============== */
.status-bar {
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  height: var(--status-height);
  border-top: 1px solid var(--border);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  display: inline-block;
}
.status-dot.ok { background: var(--long); }
.status-dot.err { background: var(--short); }

/* ============== 主内容区 ============== */
.main-content {
  padding-top: 90px;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 20px);
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg-primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============== 底部Tab导航 ============== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  min-height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom, 0);
  padding-top: 6px;
}
.bottom-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 0;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
  min-height: 52px;
}
.bottom-tab-btn .bottom-tab-icon { font-size: 20px; }
.bottom-tab-btn.active {
  color: var(--accent);
}
.bottom-tab-btn.active .bottom-tab-icon {
  filter: drop-shadow(0 0 4px rgba(240, 185, 11, 0.4));
}

/* ============== 卡片基础 ============== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin: 14px 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title {
  font-size: 17px;
  font-weight: 600;
  margin: 20px 16px 10px;
  color: var(--text-primary);
}

/* ============== 表单 ============== */
.form-group {
  margin-bottom: 24px;
}
.form-group label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  padding-left: 2px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
input[type="text"],
input[type="number"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color 0.2s;
  min-height: 48px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
.input-with-btn {
  display: flex;
  gap: 12px;
}
.input-with-btn input { flex: 1; min-width: 0; }
.input-with-btn button {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  min-height: 48px;
  flex-shrink: 0;
}

/* ============== 快速选择 ============== */
.quick-symbols {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.chip {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
}
.chip:hover, .chip:active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* ============== 分析周期芯片 ============== */
.tf-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tf-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  transition: all 0.2s;
  min-height: 42px;
  flex: 1 0 calc(33.333% - 7px);
  justify-content: center;
  max-width: calc(50% - 5px);
}
.tf-chip input { accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.tf-chip:has(input:checked) {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* ============== 按钮 ============== */
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}
.btn-danger {
  width: 100%;
  background: var(--danger);
  color: white;
  border: none;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
}
.btn-secondary {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  min-height: 52px;
}
.btn-text-danger {
  background: transparent;
  border: none;
  color: var(--short);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 12px;
}

/* 首次加载提示（开始分析按钮下方） */
.first-load-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--warning-dim);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-size: 12px;
  line-height: 1.6;
}
.first-load-hint .ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}
.first-load-hint span {
  flex: 1;
  min-width: 0;
}

/* ============== 结果区 ============== */
.results-area { min-width: 0; }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 64px; margin-bottom: 20px; opacity: 0.5; }
.empty-state .hint { font-size: 14px; margin-top: 10px; opacity: 0.7; }

/* 概览卡片 */
.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: nowrap;
  gap: 12px;
  min-width: 0;
}
.overview-header > div:first-child {
  min-width: 0;
  overflow: hidden;
}
.overview-header .symbol {
  font-size: 17px;
  font-weight: 600;
  margin-right: 8px;
  white-space: nowrap;
}
.overview-header .price {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.direction-badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.direction-badge.多头 { background: var(--long-dim); color: var(--long); border: 1px solid var(--long); }
.direction-badge.空头 { background: var(--short-dim); color: var(--short); border: 1px solid var(--short); }
.direction-badge.震荡 { background: rgba(132, 142, 156, 0.15); color: var(--neutral); border: 1px solid var(--neutral); }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.overview-row {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-align: center;
}
.overview-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.overview-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}
.overview-value.long { color: var(--long); }
.overview-value.short { color: var(--short); }
.overview-value.neutral { color: var(--neutral); }

/* 市场形态 */
.regime-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  font-size: 13px;
  align-items: center;
}
.regime-info .regime-label { color: var(--text-muted); }
.regime-info .regime-value { font-weight: 600; color: var(--accent); }
.regime-info .regime-conf { grid-column: 1 / -1; color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* 标记价格 */
.mark-price-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  font-size: 13px;
}
.mark-price-info .mp-label { color: var(--text-muted); }
.mark-price-info .mp-value { font-weight: 600; color: var(--text-primary); }

/* 额外指标 */
.extra-indicators {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.ei-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  flex-wrap: wrap;
}
.ei-label { color: var(--text-muted); min-width: 60px; }
.ei-value { font-weight: 600; color: var(--text-primary); word-break: break-all; }
.ei-tag {
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: var(--bg-input);
  color: var(--text-secondary);
}
.ei-tag.strong { background: var(--long-dim); color: var(--long); }
.ei-tag.weak { background: var(--short-dim); color: var(--short); }
.ei-tag.neutral { background: var(--warning-dim); color: var(--warning); }

/* 推荐方案 */
.recommend-card { border-left: 4px solid var(--accent); }
.recommend-card.no-recommend { border-left-color: var(--neutral); }
#recommendBody {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.recommend-metric {
  background: var(--bg-secondary);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-align: center;
}
.recommend-metric .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.recommend-metric .value { font-size: 18px; font-weight: 600; }
.recommend-metric.long .value { color: var(--long); }
.recommend-metric.short .value { color: var(--short); }
.recommend-metric.entry .value { color: var(--accent); }
.recommend-metric.stop .value { color: var(--short); }
.recommend-metric.tp .value { color: var(--long); }
.recommend-metric.rr .value { color: var(--accent); }

.recommend-tps {
  background: var(--bg-secondary);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 10px;
}
.tp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.tp-row:last-child { border-bottom: none; }
.tp-label { font-size: 13px; color: var(--text-secondary); }
.tp-price { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.tp-pct { font-size: 12px; }
.tp-pct.pos { color: var(--long); }
.tp-pct.neg { color: var(--short); }

.price-gap {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.price-gap.ok { background: var(--long-dim); color: var(--long); border: 1px solid rgba(8, 145, 178, 0.3); }
.price-gap.neutral { background: var(--warning-dim); color: var(--warning); border: 1px solid var(--warning-border); }
.price-gap.warn { background: var(--short-dim); color: var(--short); border: 1px solid rgba(220, 38, 38, 0.3); }

.recommend-warn {
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-size: 13px;
  margin-top: 12px;
}

/* 操作建议 */
.advice-card { border-left: 4px solid var(--long); }
.market-comment {
  padding: 12px 14px;
  background: var(--long-dim);
  border-radius: var(--radius-sm);
  color: var(--long);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 14px;
  border-left: 3px solid var(--long);
}
.advice-section { margin-bottom: 14px; }
.advice-section:last-child { margin-bottom: 0; }
.advice-section.risk .market-comment { background: var(--short-dim); border-color: var(--short); color: var(--short); }
.advice-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.advice-section ul { list-style: none; padding: 0; margin: 0; }
.advice-section li {
  padding: 6px 0 6px 22px;
  position: relative;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
}
.advice-section li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 10px;
  height: 10px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230ecb81' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/contain no-repeat;
}
.advice-section.risk li::before {
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6465d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>") center/contain no-repeat;
}

.advice-section.warning {
  margin-top: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.12), rgba(255, 152, 0, 0.08));
  border-left: 3px solid #ff9800;
  border-radius: 6px;
  border-bottom: 1px solid rgba(255, 152, 0, 0.3);
}
.advice-section.warning .advice-label { color: #ff9800; font-weight: 700; }
.advice-section.warning li { color: #e65100; font-weight: 500; padding: 4px 0 4px 22px; position: relative; }
.advice-section.warning li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff9800' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>") center/contain no-repeat;
}

/* 风险卡片 */
.risk-card { border-left: 4px solid var(--short); }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}
.risk-table, .plan-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 500px;
}
.risk-table th, .risk-table td,
.plan-table th, .plan-table td,
.data-table th, .data-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.risk-table th, .plan-table th, .data-table th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

/* 图表 */
.chart-card { padding: 16px; }
.chart-tf-label {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
  font-weight: normal;
}
.chart-container {
  width: 100%;
  height: 300px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.kline-container { height: 380px; }

/* 交易计划 */
.plan-card.long { border-left: 4px solid var(--long); }
.plan-card.short { border-left: 4px solid var(--short); }
.plan-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.plan-summary-item {
  background: var(--bg-secondary);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.plan-summary-item .label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.plan-summary-item .value { font-size: 14px; font-weight: 600; font-family: "Courier New", monospace; }

/* 详情 */
.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.detail-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}
.detail-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.detail-panel { display: none; }
.detail-panel.active { display: block; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.detail-item {
  background: var(--bg-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
}
.detail-item .label { color: var(--text-muted); font-size: 11px; margin-bottom: 4px; }
.detail-item .value { font-weight: 600; font-family: "Courier New", monospace; }

/* ============== 卡片列表（历史/用户/卡密） ============== */
.card-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.card-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px;
}
.card-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 10px;
}
.card-item-header > div:first-child { min-width: 0; }
.card-item-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.4;
}
.card-item-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.card-item-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.card-item-field {
  font-size: 13px;
  min-width: 0;
}
.card-item-field .label { color: var(--text-muted); margin-bottom: 4px; }
.card-item-field .value { font-weight: 600; color: var(--text-primary); font-size: 14px; word-break: break-all; }
.card-item-actions {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-item-actions button {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-input);
  color: var(--text-secondary);
  min-height: 48px;
  min-width: 70px;
}
.card-item-actions .btn-view { color: var(--accent); border-color: var(--accent); }
.card-item-actions .btn-edit { color: var(--accent); border-color: var(--accent); }
.card-item-actions .btn-delete { color: var(--short); border-color: var(--short); }
.card-item-actions .btn-reset { color: var(--text-secondary); }
.card-item-actions .btn-copy {
  color: var(--accent);
  border-color: var(--accent);
}

/* ============== 统计网格 ============== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-item {
  background: var(--bg-secondary);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-align: center;
}
.stat-item.long { border-color: rgba(8, 145, 178, 0.3); background: var(--long-dim); }
.stat-item.short { border-color: rgba(220, 38, 38, 0.3); background: var(--short-dim); }
.stat-item.warning { border-color: var(--warning-border); background: var(--warning-dim); }
.stat-value {
  font-size: 24px;
  font-weight: 700;
  font-family: "Courier New", monospace;
}
.stat-item.long .stat-value { color: var(--long); }
.stat-item.short .stat-value { color: var(--short); }
.stat-item.warning .stat-value { color: var(--warning); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ============== 分页 ============== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px;
}
.pagination button {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
  min-width: 40px;
}
.pagination button.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============== 加载遮罩 ============== */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(11, 14, 17, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.loading-box {
  text-align: center;
  background: var(--bg-card);
  padding: 30px 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-input);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== Toast 提示 ============== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  max-width: 85%;
  font-size: 14px;
}
.toast.show { opacity: 1; }
.toast.error { border-color: var(--short); color: var(--short); }
.toast.success { border-color: var(--long); color: var(--long); }

/* ============== 弹窗 ============== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(11, 14, 17, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  width: 90%;
  max-width: 480px;
  max-height: 92vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(37, 99, 235, 0.2);
  animation: fadeIn 0.25s ease-out;
  display: flex;
  flex-direction: column;
}
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal-box.modal-sm {
  max-height: 60vh;
  border-radius: var(--radius);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  min-width: 40px;
  min-height: 40px;
}
.modal-body {
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.modal-footer button { flex: 1; }
.modal-danger { border-left: 4px solid var(--short); }
.modal-warning-icon { font-size: 40px; text-align: center; margin-bottom: 12px; color: var(--warning); }

/* 登录弹窗 */
#loginModal .modal-box {
  max-height: 90vh;
}

/* ============== 登录Tab ============== */
.login-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}
.login-tab.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ============== 搜索建议 ============== */
.suggest-list {
  display: none;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  position: absolute;
  left: 12px;
  right: 12px;
  z-index: 50;
  box-shadow: var(--shadow);
}
.suggest-list.show { display: block; }
.suggest-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
}
.suggest-item:hover, .suggest-item:active { background: var(--bg-card-hover); color: var(--accent); }

/* ============== 时效性标签 ============== */
.validity-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--long-dim);
  color: var(--long);
  border: 1px solid var(--long);
}
.validity-badge.warning { background: var(--warning-dim); color: var(--warning); border-color: var(--warning); }
.validity-badge.expired { background: var(--short-dim); color: var(--short); border-color: var(--short); }

/* ============== 页脚 ============== */
.footer {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-bottom: var(--nav-height);
}

/* ============== 超小屏特殊适配 ============== */
@media (max-width: 360px) {
  .topbar { padding: 8px; }
  .logo-text { display: none; }
  .member-status { padding: 4px 6px; }
  .member-name { max-width: 70px; }
  .login-btn { padding: 6px 8px; font-size: 11px; }
  .card { margin: 8px; padding: 12px; }
  .overview-grid { grid-template-columns: 1fr; }
  .card-item-body { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tf-chip { flex: 1 0 calc(50% - 4px); max-width: 100%; }
}

/* ============== 平板/桌面扩展 ============== */
@media (min-width: 768px) {
  .main-content {
    max-width: 768px;
    margin: 0 auto;
  }
  .overview-grid { grid-template-columns: repeat(4, 1fr); }
  #recommendBody { grid-template-columns: repeat(5, 1fr); }
  .detail-grid { grid-template-columns: repeat(3, 1fr); }
  .card-item-body { grid-template-columns: repeat(3, 1fr); }
  .plan-summary { grid-template-columns: repeat(4, 1fr); }
  .modal-box {
    max-width: 600px;
    border-radius: var(--radius);
    animation: fadeIn 0.2s ease-out;
  }
  @keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
}

/* ============== 全局滚动条样式 ============== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-input);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) var(--bg-input);
}

/* ===================================================
   图标系统：统一 SVG 线条图标，单色跟随文字颜色
   用法：<svg class="ico" viewBox="0 0 24 24">...</svg>
   =================================================== */
.ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* 顶部 logo 图标：发光科技感 */
.logo-icon .ico {
  width: 22px;
  height: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px rgba(240, 185, 11, 0.5));
  stroke-width: 2.2;
}

/* 底部 tab 图标 */
.bottom-tab-icon .ico {
  width: 22px;
  height: 22px;
}
.bottom-tab-btn.active .bottom-tab-icon .ico {
  filter: drop-shadow(0 0 4px rgba(240, 185, 11, 0.5));
}

/* 下拉菜单图标 */
.dropdown-icon .ico {
  width: 16px;
  height: 16px;
}

/* 空状态大图标 */
.empty-icon .ico {
  width: 56px;
  height: 56px;
  opacity: 0.35;
  stroke-width: 1.5;
}

/* 卡片标题图标 */
.card-title .ico {
  width: 18px;
  height: 18px;
  margin-right: 2px;
  vertical-align: -0.2em;
}

/* 按钮内图标 */
.btn-text .ico,
.btn-primary .ico,
.btn-secondary .ico {
  width: 15px;
  height: 15px;
  margin-right: 4px;
  vertical-align: -0.15em;
}

/* 搜索按钮图标 */
#searchBtn .ico,
#histSearchBtn .ico,
#codeSearchBtn .ico,
#userSearchBtn .ico {
  width: 16px;
  height: 16px;
}

/* 弹窗关闭按钮 */
.modal-close {
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted);
}

/* 弹窗标题图标 */
.modal-header h3 .ico {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: -0.2em;
}

/* 弹窗警告大图标 */
.modal-warning-icon .ico {
  width: 40px;
  height: 40px;
  color: var(--warning);
}

/* 锁定/禁止大图标（居中提示页） */
.lock-icon-big .ico,
.ban-icon-big .ico {
  width: 48px;
  height: 48px;
  opacity: 0.4;
  stroke-width: 1.5;
}

/* 操作按钮中的小图标 */
.btn-view .ico,
.btn-delete .ico,
.btn-edit .ico,
.btn-reset .ico {
  width: 13px;
  height: 13px;
  margin-right: 3px;
  vertical-align: -0.1em;
}

/* 多空方案圆点图标（保留颜色区分） */
.plan-card.long .card-title .ico { color: var(--long); }
.plan-card.short .card-title .ico { color: var(--short); }

/* 有效性徽章图标 */
.validity-badge .ico {
  width: 13px;
  height: 13px;
}
