/* ═══════════════════════════════════════════════════════════════
   Quant Dashboard V9 — Pure White Professional
   Frosted glass, dark gradient, depth layers.
   Inspired by: iOS 26 Design Language
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ────────────────────── */
:root {
  /* Backgrounds */
  --bg-page: #FFFFFF;
  --bg-card: #F8F9FA;
  --bg-card-hover: #F1F3F5;
  --bg-surface: #F1F3F5;
  --bg-input: #FFFFFF;

  /* Borders */
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --border-strong: #D1D5DB;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6B7280;

  /* Accent */
  --accent: #818cf8;
  --accent-light: rgba(129, 140, 248, 0.10);
  --accent-border: rgba(129, 140, 248, 0.30);

  /* Semantic — bright for dark bg */
  --green: #059669;
  --green-light: rgba(5, 150, 105, 0.08);
  --green-border: rgba(5, 150, 105, 0.20);
  --red: #DC2626;
  --red-light: rgba(220, 38, 38, 0.08);
  --red-border: rgba(220, 38, 38, 0.20);
  --amber: #D97706;
  --amber-light: rgba(217, 119, 6, 0.08);
  --amber-border: rgba(217, 119, 6, 0.20);
  --purple: #7C3AED;
  --purple-light: rgba(124, 58, 237, 0.08);
  --orange: #EA580C;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
          'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code',
              'Consolas', monospace;
  --fs-base: 15px;
  --fs-sm: 13px;
  --fs-xs: 11px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --fs-stat: 32px;

  /* Spacing */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 12px;
  --radius-xl: 12px;
  --card-pad: 24px;
  --section-gap: 24px;
  --grid-gap: 20px;

  /* Glass */
  --glass-bg: #F8F9FA;
  --glass-border: #E5E7EB;
  --glass-bg-hover: #E5E7EB;
  --glass-blur: 0px;

  /* Shadows */
  --shadow-card: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
}

/* ── Reset ────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  line-height: 1.5;
}

/* ── Nav ──────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding: 0 16px;
}
nav::-webkit-scrollbar { display: none; }
nav a {
  flex: 0 0 auto; padding: 16px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
  white-space: nowrap; border-bottom: 2px solid transparent;
  transition: all 0.2s; min-height: 48px;
  display: flex; align-items: center; gap: 5px;
  border-radius: 0;
}
nav a:hover { color: var(--text-primary); background: var(--bg-surface); }
nav a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
nav a:active { background: var(--accent-light); }

/* ── Main ─────────────────────────────── */
main {
  padding: var(--section-gap);
  max-width: 1280px;
  margin: 0 auto;
}

/* ── Section Headers ──────────────────── */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; margin-top: 8px;
}
.section-header h2 {
  font-size: var(--fs-lg); font-weight: 700; color: var(--text-primary);
}
.section-header .section-subtitle {
  font-size: var(--fs-sm); color: var(--text-muted);
}

/* ── Cards ────────────────────────────── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad); margin-bottom: var(--section-gap);
  box-shadow: var(--shadow-card);
  transition: all 0.25s ease;
}
.card:hover {
  border-color: var(--border-strong);
}
.card-primary { border-top: 2px solid var(--accent); }
.card-warn { border-top: 2px solid var(--amber); }
.card-danger { border-top: 2px solid var(--red); }
.card-success { border-top: 2px solid var(--green); }
.card-title {
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.card-header .card-title { margin-bottom: 0; }

/* ── Status Grid ──────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--grid-gap); }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.stat {
  background: var(--bg-surface); border-radius: var(--radius-sm);
  padding: 14px 16px; border: 1px solid transparent;
  transition: border-color 0.2s, transform 0.15s;
}
.stat:hover { border-color: var(--border); transform: translateY(-1px); }
.stat-label { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: var(--fs-stat); font-weight: 700; letter-spacing: -0.5px; }
.stat-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }

/* ── Big stat ─────────────────────────── */
.big-stat { padding: 8px 0; }
.big-stat .stat-value { font-size: 28px; }

/* ── Status badges ────────────────────── */
.badge {
  display: inline-block; padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.2px;
}
.badge-online { background: var(--green-light); color: var(--green); }
.badge-offline { background: var(--red-light); color: var(--red); }
.badge-warn { background: var(--amber-light); color: var(--amber); }
.badge-hot { background: var(--red-light); color: var(--red); }
.badge-cold { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }

/* ── Buttons ──────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px; border-radius: var(--radius-sm); border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  min-height: 44px; min-width: 44px; letter-spacing: 0.2px;
  transition: all 0.2s; touch-action: manipulation;
  font-family: var(--font); color: #fff;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(129,140,248,0.2);
}
.btn-primary:hover { background: #6d7af0; }
.btn-danger { background: var(--red); }
.btn-warn { background: var(--amber); color: #0f172a; }
.btn-outline {
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--accent); background: var(--accent-light); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: var(--fs-sm); min-height: 36px; }

/* ── Log lines ────────────────────────── */
.log-line {
  font-family: var(--font-mono);
  font-size: 12px; line-height: 1.7; padding: 4px 0;
  border-bottom: 1px solid var(--border-light);
  white-space: pre-wrap; word-break: break-all; color: var(--text-secondary);
}
.log-line.error { color: var(--red); background: var(--red-light); padding: 4px 8px; border-radius: 4px; }
.log-line.warn { color: var(--amber); }
.log-container { max-height: 55vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ── Tables ───────────────────────────── */
.table-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: -4px -8px; padding: 4px 8px;
}
.table-scroll table { min-width: 520px; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border-light); }
th {
  color: var(--text-muted); font-weight: 600; font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: 0.5px;
}
tr:hover { background: var(--bg-surface); }
tr:active { background: var(--bg-card-hover); }

/* ── Chat ─────────────────────────────── */
.chat-msgs { max-height: 55vh; overflow-y: auto; margin-bottom: 12px; }
.chat-msg {
  margin-bottom: 10px; padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; line-height: 1.6;
}
.chat-msg.user { background: var(--accent); color: #fff; margin-left: 24px; }
.chat-msg.agent {
  background: var(--bg-surface); border: 1px solid var(--border);
  margin-right: 24px; color: var(--text-primary);
}
.chat-msg pre { font-size: 12px; overflow-x: auto; }
.chat-input-row { display: flex; gap: 10px; }
.chat-input-row input {
  flex: 1; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text-primary); font-size: 15px;
  font-family: var(--font); min-height: 48px;
}
.chat-input-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* ── Control Groups ───────────────────── */
.control-group { display: flex; flex-wrap: wrap; gap: 10px; }
.control-group .btn { flex: 1; min-width: 120px; }

/* ── Tabs ─────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  background: var(--bg-surface); color: var(--text-secondary); border: 1px solid transparent; cursor: pointer;
  white-space: nowrap; font-family: var(--font); min-height: 38px;
  transition: all 0.2s;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab:hover:not(.active) { color: var(--text-primary); background: var(--bg-card-hover); border-color: var(--border); }

/* ── Toast ────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 14px 28px; border-radius: var(--radius-lg); font-weight: 600; font-size: 14px;
  z-index: 999; opacity: 0; transition: opacity 0.3s;
  pointer-events: none; font-family: var(--font);
}
.toast.show { opacity: 1; }
.toast.ok { background: var(--green); color: #fff; }
.toast.err { background: var(--red); color: #fff; }

/* ── Skeleton ─────────────────────────── */
.sk { animation: pulse 1.5s infinite; background: #E5E7EB; border-radius: 4px; }
@keyframes pulse { 0%,100%{opacity:0.4} 50%{opacity:0.8} }
.sk-text { height: 14px; margin-bottom: 6px; width: 80%; }
.sk-val { height: 28px; width: 60%; }

/* ── Section ──────────────────────────── */
.section { margin-top: 4px; }
.section-title { font-size: var(--fs-lg); font-weight: 700; margin: var(--section-gap) 0 12px; }

/* ── System compact ───────────────────── */
.system-compact { font-size: var(--fs-sm); opacity: 0.8; }
.system-compact .stat-value { font-size: 16px; }

/* ── PnL colors ───────────────────────── */
.pnl-positive { color: var(--green); font-weight: 700; }
.pnl-negative { color: var(--red); font-weight: 700; }
.pnl-zero { color: var(--text-muted); }

/* ── Task timeline ────────────────────── */
.task-row {
  display: flex; align-items: center; padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
  gap: 10px; font-size: 14px;
}
.task-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.task-dot.ok { background: var(--green); }
.task-dot.pending { background: #D1D5DB; }
.task-dot.conditional { background: #F59E0B; }

/* ── Task group header ─────────────────── */
.task-group-header {
  display: flex; align-items: center; padding: 10px 0 4px 0;
  font-size: 13px; color: var(--text-primary);
  border-bottom: 2px solid var(--border-light);
  margin-top: 14px;
}
.task-group-header:first-child { margin-top: 0; }

/* ── Progress bar ─────────────────────── */
.progress-bar {
  height: 8px; border-radius: 4px; background: #E5E7EB;
  margin: 6px 0; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 4px; background: var(--accent);
  transition: width 0.4s ease;
}

/* ── Misc utilities ───────────────────── */
.ts { font-size: var(--fs-sm); color: var(--text-muted); }
.empty { text-align: center; color: var(--text-muted); padding: 40px 16px; font-size: 14px; }
.mono { font-family: var(--font-mono); }
.highlight { color: var(--accent); }
.green { color: var(--green); }
.red { color: var(--red); }
.yellow { color: var(--amber); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.gap-8 { display: flex; gap: 10px; flex-wrap: wrap; }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-muted, .muted { color: var(--text-muted); }

/* ── Page header ──────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--section-gap);
}
.page-title {
  font-size: var(--fs-2xl); font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.5px;
}

/* ── Live clock ──────────────────────── */
.live-clock { font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); }

/* ── Metric Grid (V7 Tier 1) ──────────── */
.metric-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--grid-gap);
  margin-bottom: var(--section-gap);
}
.metric-card {
  background: var(--glass-bg);
  border-radius: var(--radius-lg); padding: var(--card-pad);
  box-shadow: var(--shadow-card); border: 1px solid var(--glass-border);
  transition: all 0.25s ease;
}
.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
.metric-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 12px;
  background: var(--accent-light); color: var(--accent);
}
.metric-icon.green { background: var(--green-light); color: var(--green); }
.metric-icon.amber { background: var(--amber-light); color: var(--amber); }
.metric-label {
  font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 4px;
}
.metric-value {
  font-size: var(--fs-stat); font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.5px; line-height: 1.1;
}
.metric-trend {
  font-size: var(--fs-xs); margin-top: 6px; display: flex; align-items: center; gap: 4px;
}
.metric-trend.up { color: var(--green); }
.metric-trend.down { color: var(--red); }
.metric-trend.flat { color: var(--text-muted); }

/* ── Split Grid (V7 Tier 2) ───────────── */
.split-grid {
  display: grid; grid-template-columns: 3fr 2fr; gap: var(--grid-gap);
  margin-bottom: var(--section-gap);
}

/* ── Chart Grid (V7 Tier 3) ───────────── */
.chart-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--grid-gap);
  margin-bottom: var(--section-gap);
}
.chart-card { padding: 16px; }
.chart-card .chart-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 12px;
}
.chart-container { position: relative; width: 100%; }
.chart-container canvas { width: 100% !important; }

/* ── Layer Grid (V7 Tier 4) ───────────── */
.layer-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--grid-gap);
  margin-bottom: var(--section-gap);
}
.layer-health {
  padding: 20px; border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card);
  transition: all 0.2s;
}
.layer-health:hover {
  border-color: var(--border-strong);
}
.layer-indicator {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
  margin-right: 8px; vertical-align: middle;
}
.layer-indicator.online { background: var(--green); }
.layer-indicator.degraded { background: var(--amber); }
.layer-indicator.offline { background: var(--red); }
.layer-name { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.layer-ok { color: var(--green); }
.layer-err { color: var(--red); }
.layer-offline { opacity: 0.5; }
.layer-updated { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 6px; }
.layer-alerts {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-sm);
  font-size: var(--fs-xs); font-weight: 600;
}
.layer-alerts.none { background: var(--green-light); color: var(--green); }
.layer-alerts.warn { background: var(--amber-light); color: var(--amber); }
.layer-alerts.err { background: var(--red-light); color: var(--red); }

/* ── World Cup Grid ───────────────────── */
.worldcup-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--grid-gap);
  margin-bottom: var(--section-gap);
}
.worldcup-metric {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-card);
}
.worldcup-metric .wc-label { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 6px; }
.worldcup-metric .wc-value { font-size: 22px; font-weight: 700; }
.worldcup-metric .wc-detail { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 4px; }

/* ── Rec List (V7 home) ───────────────── */
.rec-list { display: flex; flex-direction: column; }
.rec-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.rec-item:last-child { border-bottom: none; }
.rec-league {
  font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500;
  min-width: 60px;
}
.rec-teams {
  flex: 1; min-width: 140px; font-weight: 600; font-size: 14px;
}
.rec-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.rec-pick {
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: var(--fs-xs); font-weight: 700;
  background: var(--accent-light); color: var(--accent);
}
.rec-odds {
  font-family: var(--font-mono); font-size: 14px; font-weight: 600;
  min-width: 50px; text-align: center; color: var(--text-primary);
}
.rec-ev { width: 60px; }
.rec-score { font-size: 20px; font-weight: 700; min-width: 36px; text-align: center; }

/* ── Risk Monitor (V7 home) ───────────── */
.risk-grid { display: flex; flex-direction: column; gap: 2px; }
.risk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light);
}
.risk-item:last-child { border-bottom: none; }
.risk-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.risk-dot.green { background: var(--green); }
.risk-dot.yellow { background: var(--amber); }
.risk-dot.red { background: var(--red); }
.risk-dot.grey { background: #D1D5DB; }
.risk-label { flex: 1; font-size: 14px; font-weight: 500; }
.risk-status { font-size: var(--fs-sm); font-weight: 600; }
.risk-value { font-size: var(--fs-sm); font-weight: 600; }

/* ── Matchday Switcher ────────────────── */
.matchday-switcher {
  display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; padding-bottom: 2px;
}
.matchday-tab {
  flex: 0 0 auto; padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: 600;
  background: var(--bg-surface); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer;
  white-space: nowrap; min-height: 38px;
  transition: all 0.2s; font-family: var(--font);
}
.matchday-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.matchday-tab.today { border-color: var(--green-border); }
.matchday-tab.today.active { border-color: var(--accent); }
.matchday-tab:hover:not(.active) { background: var(--bg-card-hover); border-color: var(--border-strong); }
.matchday-tab .tab-sub { font-size: 11px; font-weight: 400; display: block; opacity: 0.7; }

/* ── Date Select Dropdown ──────────────── */
.date-select {
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; font-family: var(--font); font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.date-select:hover { border-color: var(--accent); }
.date-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

/* ── Compact Match Cell ────────────────── */
.match-cell { display: flex; flex-direction: column; gap: 1px; }
.match-home { font-weight: 600; font-size: 13px; line-height: 1.3; }
.match-vs { font-size: 11px; color: var(--text-muted); line-height: 1.3; }

/* ── Sports Table (compact) ────────────── */
.sports-table th { font-size: 11px; padding: 8px 6px; white-space: nowrap; }
.sports-table td { padding: 8px 6px; vertical-align: middle; }
.sports-table th:first-child, .sports-table td:first-child { padding-left: 2px; }
.sports-table th:last-child, .sports-table td:last-child { padding-right: 2px; }
@media (max-width: 480px) {
  .sports-table th:nth-child(3),
  .sports-table td:nth-child(3) { display: none; }
}

/* ── History Collapse ──────────────────── */
.history-toggle {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 10px 12px; font-weight: 600; font-size: 13px; color: var(--text-secondary);
  user-select: none; min-height: 44px; border-radius: var(--radius-sm);
  background: var(--bg-surface); transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.history-toggle:active { background: var(--bg-card-hover); }
.history-toggle:hover { color: var(--text-primary); }
.history-toggle .toggle-arrow { transition: transform 0.2s; font-size: 10px; }
.history-toggle.open .toggle-arrow { transform: rotate(90deg); }
.history-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.history-body.open { max-height: 8000px; }
.history-body table { font-size: 13px; }
.history-body .table-scroll table { min-width: 0; }
@media (max-width: 480px) {
  .history-body table { font-size: 10px; }
  .history-body th, .history-body td { padding: 4px 2px; }
  .history-body th { font-size: 8px; letter-spacing: 0; }
  .history-body .mono { font-size: 9px; }
}

/* ── Expandable Cards ─────────────────── */
.card-expandable .card-header { cursor: pointer; user-select: none; }
.card-expandable .expand-icon {
  transition: transform 0.2s; font-size: 12px; color: var(--text-muted);
  display: inline-block; margin-left: 6px;
}
.card-expandable.open .expand-icon { transform: rotate(180deg); }
.expand-body { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.expand-body.open { max-height: 6000px; }

/* ── Analysis Layers ──────────────────── */
.layer-section {
  margin-top: 8px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-surface); border-left: 3px solid var(--accent);
}
.layer-section.fundamental { border-left-color: var(--green); }
.layer-section.odds { border-left-color: var(--accent); }
.layer-section.anomaly { border-left-color: var(--orange); }
.layer-section.conclusion { border-left-color: var(--purple); }
.layer-section.post-match { border-left-color: var(--green); }
.layer-title {
  font-size: var(--fs-xs); font-weight: 700; color: var(--accent);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.layer-section.fundamental .layer-title { color: var(--green); }
.layer-section.odds .layer-title { color: var(--accent); }
.layer-section.anomaly .layer-title { color: var(--orange); }
.layer-section.conclusion .layer-title { color: var(--purple); }
.layer-section.post-match .layer-title { color: var(--green); }
.layer-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; padding: 3px 0; color: var(--text-secondary);
}
.layer-row .lbl { color: var(--text-muted); }
.layer-row .val { font-weight: 600; color: var(--text-primary); }

/* ── History Timeline ──────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 10px; top: 0; bottom: 0;
  width: 2px; background: #E5E7EB;
}
.timeline-item {
  position: relative; margin-bottom: 12px; padding: 12px 14px;
  background: var(--bg-surface); border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent); cursor: pointer;
  transition: all 0.2s;
}
.timeline-item:hover { background: var(--bg-card-hover); }
.timeline-item.losing { border-left-color: var(--red); }
.timeline-item.winning { border-left-color: var(--green); }
.timeline-item::before {
  content: ''; position: absolute; left: -22px; top: 18px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-page);
}
.timeline-item.winning::before { background: var(--green); }
.timeline-item.losing::before { background: var(--red); }

/* ── Combo EV Card ────────────────────── */
.combo-ev {
  background: var(--green-light); border: 1px solid var(--green-border);
  border-radius: var(--radius-sm); padding: 14px; margin-top: 10px;
}
.combo-ev .ev-value { font-size: 24px; font-weight: 700; }
.combo-ev .ev-positive { color: var(--green); }
.combo-ev .ev-negative { color: var(--red); }
.combo-ev .combo-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; margin-top: 8px; color: var(--text-secondary); }

/* ── Hit/Miss Badges ──────────────────── */
.hit-badge {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700;
}
.hit-badge.hit { background: var(--green-light); color: var(--green); }
.hit-badge.miss { background: var(--red-light); color: var(--red); }
.hit-badge.pending { background: var(--bg-surface); color: var(--text-muted); }

/* ── Yesterday Summary Bar ────────────── */
.yesterday-summary {
  display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
  padding: 14px; background: var(--bg-surface); border-radius: var(--radius-sm);
  margin-bottom: 14px; border: 1px solid var(--border-light);
}
.yesterday-summary .ys-metric { text-align: center; }
.yesterday-summary .ys-metric .value { font-size: 20px; font-weight: 700; }
.yesterday-summary .ys-metric .label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Post-Match Row Highlight ─────────── */
tr.row-hit { background: var(--green-light); }
tr.row-miss { background: var(--red-light); }
tr.row-hit:hover { background: rgba(5,150,105,0.12); }
tr.row-miss:hover { background: rgba(220,38,38,0.12); }

/* ── Section Divider ──────────────────── */
.section-divider {
  margin: 20px 0; border: none; border-top: 1px solid var(--border);
}

/* ── Cold Radar ───────────────────────── */
.cold-item {
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.cold-item:last-child { border-bottom: none; }
.danger-tag {
  display: inline-block; padding: 3px 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700; margin-right: 4px;
  background: var(--red-light); color: var(--red);
}

/* ── Risk Light ───────────────────────── */
.risk-light {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; flex-shrink: 0;
}
.risk-light.green { background: var(--green); }
.risk-light.yellow { background: var(--amber); }
.risk-light.red { background: var(--red); animation: pulse 2s infinite; }

/* ── Schedule Integrity ──────────────── */
.integrity-ok { color: var(--green); font-weight: 700; }
.integrity-warn { color: var(--amber); font-weight: 700; }

/* ── Equity Curve ─────────────────────── */
.equity-bar-ctn {
  display: flex; align-items: flex-end; gap: 3px; height: 48px;
  margin: 8px 0; padding: 4px 0;
}
.equity-bar-ctn .bar {
  flex: 1; min-width: 6px; border-radius: 2px 2px 0 0;
  opacity: 0.85; transition: opacity 0.15s;
  background: var(--accent);
}
.equity-bar-ctn .bar:hover { opacity: 1; }

/* ── Broker-style table ──────────────── */
.broker-table td.num { font-family: var(--font-mono); font-size: 13px; }
.broker-table td.name-col { font-weight: 600; }

/* ── Position suggestion ──────────────── */
.suggestion-badge {
  display: inline-block; font-size: 14px; font-weight: 600;
  padding: 6px 14px; border-radius: var(--radius-sm); background: var(--bg-surface);
  border: 1px solid var(--border);
}

/* ── Section label inline ─────────────── */
.section-inline { display: flex; align-items: center; gap: 8px; }

/* ── A股 中国股市配色 (红涨绿跌) ──────── */
.cn-market .pnl-positive { color: var(--red) !important; font-weight: 700; }
.cn-market .pnl-negative { color: var(--green) !important; font-weight: 700; }
.cn-market .green { color: var(--red) !important; }
.cn-market .red { color: var(--green) !important; }
.cn-market .card-success { border-top-color: var(--red); }
.cn-market .hit-badge.hit { background: var(--red-light); color: var(--red); }
.cn-market .hit-badge.miss { background: var(--green-light); color: var(--green); }
.cn-market tr.row-hit { background: var(--red-light); }
.cn-market tr.row-miss { background: var(--green-light); }
.cn-market tr.row-hit:hover { background: rgba(220,38,38,0.14); }
.cn-market tr.row-miss:hover { background: rgba(5,150,105,0.14); }
.cn-market .advice-buy,
.cn-market .advice-add { background: var(--red-light); color: var(--red); }
.cn-market .advice-sell,
.cn-market .advice-reduce,
.cn-market .advice-stop { background: var(--green-light); color: var(--green); }
.cn-market .advice-hold { color: var(--text-muted); }
.cn-market .advice-take-profit { background: var(--amber-light); color: var(--amber); }

/* ── 主线/龙头/风险/资金 (A股) ────────── */
.theme-primary { font-size: 17px; margin-bottom: 4px; font-weight: 700; }
.dragon-tier { display: flex; flex-direction: column; gap: 6px; }
.dragon-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.dragon-row + .dragon-row { border-top: 1px solid var(--border-light); }
.tier-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: var(--radius-sm); min-width: 52px; text-align: center;
}
.tier-1 { background: var(--amber-light); color: var(--amber); }
.tier-2 { background: var(--accent-light); color: var(--accent); }
.tier-3 { background: var(--bg-surface); color: var(--text-muted); }
.tier-risk { background: var(--red-light); color: var(--red); }

.risk-radar-item {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 0; border-bottom: 1px solid var(--border-light);
}
.risk-radar-item:last-child { border-bottom: none; }
.risk-severity { font-size: 12px; min-width: 24px; text-align: center; font-weight: 700; }
.severity-high { background: var(--red-light); border-radius: 4px; padding: 2px 4px; color: var(--red); }
.severity-mid { background: var(--amber-light); border-radius: 4px; padding: 2px 4px; color: var(--amber); }

.position-advice-badge {
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-sm);
}
.advice-buy, .advice-add { background: var(--green-light); color: var(--green); }
.advice-sell, .advice-reduce, .advice-stop { background: var(--red-light); color: var(--red); }
.advice-hold { color: var(--text-muted); }
.advice-take-profit { background: var(--amber-light); color: var(--amber); }

/* ── Form dots ───────────────────────── */
.form-dots { display: flex; gap: 3px; align-items: center; }
.form-dot { width: 9px; height: 9px; border-radius: 50%; }
.form-dot.w { background: var(--green); }
.form-dot.d { background: var(--text-muted); }
.form-dot.l { background: var(--red); }

/* ── H2H compact ─────────────────────── */
.h2h-compact { font-size: 12px; line-height: 1.5; }
.h2h-compact .h2h-bar {
  display: flex; height: 5px; border-radius: 3px; overflow: hidden;
  margin-top: 3px; width: 64px;
}
.h2h-bar .hw { background: var(--green); }
.h2h-bar .hd { background: var(--text-muted); }
.h2h-bar .hl { background: var(--red); }

/* ── Home/Away compare ───────────────── */
.ha-compare { font-size: 12px; }
.ha-compare .ha-bar {
  display: flex; gap: 2px; align-items: flex-end; height: 32px;
}
.ha-bar .ha-home, .ha-bar .ha-away {
  width: 18px; border-radius: 2px 2px 0 0; opacity: 0.85;
}
.ha-bar .ha-home { background: var(--accent); }
.ha-bar .ha-away { background: var(--text-muted); }

/* ── Sparkline canvas ────────────────── */
.sparkline-wrap { margin: 10px 0; }
.sparkline-wrap canvas { display: block; width: 100%; }

/* ── Number flow animation ───────────── */
.num-flow { display: inline-block; transition: color 0.3s; }
.num-flow.flash-green { color: var(--green); }
.num-flow.flash-red { color: var(--red); }

/* ── Index mini-row ──────────────────── */
.index-mini-row {
  display: flex; align-items: center; gap: 14px; padding: 10px 0;
  border-bottom: 1px solid var(--border-light); font-size: 14px;
}
.index-mini-row:last-child { border-bottom: none; }
.index-mini-row .idx-name { width: 75px; flex-shrink: 0; font-weight: 600; }
.index-mini-row .idx-price { width: 85px; text-align: right; font-family: var(--font-mono); }
.index-mini-row .idx-change { width: 75px; text-align: right; font-weight: 700; }
.index-mini-row .idx-spark { flex: 1; min-width: 60px; }
.index-mini-row .idx-spark canvas { width: 100%; height: 30px; }

/* ── Position weight bar ────────────── */
.weight-bar {
  width: 100%; height: 5px; background: #E5E7EB;
  border-radius: 3px; margin-bottom: 3px;
}
.weight-fill {
  height: 100%; background: var(--accent); border-radius: 3px;
  min-width: 2px; transition: width 0.5s ease;
}

/* ── Mobile bottom nav ───────────────── */
.mobile-bottom-nav {
  display: none;
  position: sticky; bottom: 0; left: 0; right: 0; z-index: 100;
  margin-top: 24px;
  background: #FFFFFF;
  border-top: 1px solid var(--glass-border);
  padding: 4px 0; padding-bottom: env(safe-area-inset-bottom, 4px);
}
.mobile-bottom-nav a {
  flex: 1; text-align: center; padding: 8px 4px;
  font-size: 11px; color: var(--text-muted); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.mobile-bottom-nav a.active { color: var(--accent); }
.mobile-bottom-nav a .nav-emoji { font-size: 18px; }

/* ── Match tier border ──────────────── */
.tier-L1 { border-left: 3px solid var(--green); }
.tier-L2 { border-left: 3px solid var(--accent); }
.tier-L3 { border-left: 3px solid var(--text-muted); }

/* ── Data update flash ──────────────── */
@keyframes dataFlash {
  0% { background: transparent; }
  50% { background: var(--accent-light); }
  100% { background: transparent; }
}
.data-flash { animation: dataFlash 0.6s ease; }

/* ── EV bar (mini) ───────────────────── */
.ev-mini-bar {
  height: 4px; border-radius: 2px; background: #E5E7EB;
  overflow: hidden; width: 60px;
}
.ev-mini-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.ev-mini-fill.high { background: var(--green); }
.ev-mini-fill.mid { background: var(--accent); }
.ev-mini-fill.low { background: var(--amber); }

/* ── Trend arrow ──────────────────────── */
.trend-up::before { content: '↑ '; }
.trend-down::before { content: '↓ '; }
.trend-flat::before { content: '→ '; }

/* ── responsive ──────────────────────── */
@media (max-width: 1024px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .split-grid { grid-template-columns: 1fr; }
  .layer-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .worldcup-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  main { padding: 16px; }
  .page-title { font-size: var(--fs-xl); }
  .grid3 { grid-template-columns: 1fr 1fr; }
  nav a { padding: 14px 12px; font-size: 13px; }
  .card { padding: 16px; margin-bottom: 16px; }
  .index-mini-row { font-size: 13px; gap: 8px; }
  .index-mini-row .idx-name { width: 60px; }
  .index-mini-row .idx-price { width: 70px; }
  .index-mini-row .idx-change { width: 60px; }
  .metric-grid { gap: 12px; }
  .metric-card { padding: 16px; }
  .metric-value { font-size: 24px; }
}

@media (max-width: 480px) {
  .grid3, .grid2 { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .worldcup-grid { grid-template-columns: 1fr; }
  .card { padding: 14px; border-radius: var(--radius-sm); }
  main { padding: 10px; }
  .stat { padding: 10px 12px; }
  .stat-value { font-size: 20px; }
  .big-stat .stat-value { font-size: 24px; }
  .metric-value { font-size: 22px; }
  nav { display: none; }
  .mobile-bottom-nav { display: flex; }
  body { padding-bottom: 64px; }
  .rec-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .rec-match { min-width: 0; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .hide-mobile { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   v6.0 竞彩Dashboard增强样式
   ─────────────────────────────────────────────────────────── */

/* ── LGBM管道可视化 ── */
.pipeline-container {
  display: flex; align-items: flex-start; gap: 0;
  overflow-x: auto; padding: 12px 4px; font-size: 11px;
  scrollbar-width: thin;
}
.pipeline-node {
  flex: 0 0 auto; text-align: center; min-width: 90px;
  padding: 8px 10px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.pipeline-node-icon { font-size: 20px; margin-bottom: 4px; }
.pipeline-node-title { font-weight: 700; margin-bottom: 3px; font-size: 11px; }
.pipeline-node-value {
  font-weight: 600; color: var(--accent); margin-bottom: 2px;
  font-size: 10px; word-break: break-all;
}
.pipeline-node-desc { font-size: 10px; color: var(--muted); }
.pipeline-arrow {
  flex: 0 0 auto; padding: 14px 2px; font-size: 16px;
  color: var(--border-strong); font-weight: 700;
}
.pipeline-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 2px;
}
.pipeline-dot.ok { background: var(--green); }
.pipeline-dot.warn { background: var(--amber); }
.pipeline-dot.off { background: var(--border-strong); }

/* ── 波胆内联显示 ── */
.scoreline-inline { margin-top: 4px; }
.scoreline-item {
  display: flex; align-items: center; gap: 4px;
  margin: 2px 0; font-size: 10px;
}
.scoreline-score {
  width: 32px; font-weight: 600; text-align: right;
  font-size: 10px;
}
.scoreline-mini-bar {
  display: inline-block; height: 6px;
  background: var(--green); border-radius: 3px;
  min-width: 2px;
}
.scoreline-pct {
  width: 30px; text-align: right; color: var(--muted);
  font-size: 9px;
}

/* ── 三层信号指示器 ── */
.layer-signals {
  display: inline-flex; gap: 4px; align-items: center;
  font-size: 14px; cursor: help;
}
.layer-dot { line-height: 1; }

/* ── LGBM方向徽章 ── */
.lgbm-pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.lgbm-follow {
  background: rgba(5,150,105,0.10); color: var(--green);
  border: 1px solid rgba(5,150,105,0.25);
}
.lgbm-reverse {
  background: rgba(220,38,38,0.08); color: var(--red);
  border: 1px solid rgba(220,38,38,0.20);
}
.lgbm-uncertain {
  background: rgba(107,114,128,0.08); color: var(--muted);
  border: 1px solid var(--border);
}
.lgbm-no-data {
  background: rgba(156,163,175,0.06); color: var(--border-strong);
  border: 1px dashed var(--border); font-style: italic;
}

/* ── 分析摘要单元格 ── */
.analysis-summary-cell {
  font-size: 11px; color: var(--text-secondary);
  line-height: 1.4; cursor: pointer;
  max-width: 140px; overflow: hidden;
}
.analysis-summary-cell:hover { color: var(--text-primary); }

/* ── 增强型比赛表格 ── */
.sports-table-enhanced { min-width: 900px; }
.sports-table-enhanced th {
  font-size: 10px; padding: 6px 6px; white-space: nowrap;
}
.sports-table-enhanced td {
  padding: 6px; vertical-align: middle; font-size: 13px;
}

/* ── 预测vs赛果对比 ── */
.pred-vs-real {
  border-left: 4px solid var(--accent) !important;
  padding: 14px 16px !important;
}
.pred-vs-real .stat-label { font-size: 10px; }
.pred-vs-real .stat-value { font-size: 18px; }

/* ── 共识权重条 ── */
.consensus-bar {
  height: 6px; border-radius: 3px; background: var(--bg);
  overflow: hidden; display: flex; margin-top: 2px;
}
.consensus-bar-fund { background: var(--green); }
.consensus-bar-market { background: var(--accent); }

/* ── 管道卡片在移动端隐藏 ── */
@media (max-width: 768px) {
  .pipeline-container {
    flex-wrap: nowrap; overflow-x: auto; gap: 0;
  }
  .pipeline-node { min-width: 72px; padding: 6px 8px; }
  .pipeline-arrow { padding: 14px 0px; font-size: 14px; }
  .sports-table-enhanced { min-width: 750px; }
  .sports-table-enhanced th,
  .sports-table-enhanced td { padding: 4px 3px; font-size: 10px; }
  .analysis-summary-cell { max-width: 80px; }
}

/* ── v6.0 响应式比赛卡片（移动端替代表格）── */
@media (max-width: 480px) {
  .sports-table-enhanced { min-width: 0; }
  .sports-table-enhanced thead { display: none; }
  .sports-table-enhanced tbody, .sports-table-enhanced tr,
  .sports-table-enhanced td {
    display: block; width: 100%;
  }
  .sports-table-enhanced tr {
    margin-bottom: 12px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px;
    background: var(--bg-card);
  }
  .sports-table-enhanced td {
    padding: 3px 0; border: none; text-align: left;
    display: flex; justify-content: space-between;
    font-size: 12px;
  }
  .sports-table-enhanced td:before {
    content: attr(data-label);
    font-weight: 600; font-size: 10px; color: var(--muted);
    min-width: 60px;
  }
  .scoreline-inline { margin-top: 2px; }
  .analysis-summary-cell { max-width: none; }
  .pipeline-node:nth-child(n+5) { display: none; }
  .pipeline-arrow:nth-of-type(n+4) { display: none; }
}

