/* Training Hub — Styles (Dark + Light Mode) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #22263a;
  --border: #2d3148;
  --text: #e2e8f0;
  --muted: #64748b;
  --accent: #6366f1;
  --accent-soft: rgba(99,102,241,.08);
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
}

/* ── Light Mode ── */
body.light {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #94a3b8;
  --accent-soft: rgba(99,102,241,.06);
}

body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; transition: background .2s, color .2s; }

/* ── Header ── */
header { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 16px; position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; max-width: 700px; margin: 0 auto; }
h1 { font-size: 18px; font-weight: 700; }
nav { display: flex; gap: 4px; padding-bottom: 0; overflow-x: auto; max-width: 700px; margin: 0 auto; }
.tab-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 8px 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Theme Toggle */
.theme-toggle { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 16px; line-height: 1; }
.theme-toggle:hover { opacity: .8; }

/* ── Main ── */
main { padding: 16px; max-width: 700px; margin: 0 auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Cards ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.card-value { font-size: 32px; font-weight: 700; line-height: 1; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.mt { margin-top: 12px; }

/* ── Grid ── */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media(max-width: 480px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }

/* ── Utilities ── */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.green { color: var(--green); }
.red { color: var(--red); }
.yellow { color: var(--yellow); }

/* ── Race Banner ── */
.race-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(192,132,252,.1));
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 12px;
}
.race-banner-title { font-size: 15px; font-weight: 700; }
.race-banner-sub { font-size: 12px; color: var(--text); opacity: .8; margin-top: 2px; }
.race-banner-meta { font-size: 11px; color: var(--text); opacity: .75; }
.race-banner-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.race-banner-stat { display: flex; flex-direction: column; align-items: center; }
.race-banner-divider { width: 1px; height: 40px; background: rgba(255,255,255,.2); }
.race-banner-days { font-size: 36px; font-weight: 800; color: var(--accent); line-height: 1; }
.race-banner-days-label { font-size: 11px; color: var(--text); opacity: .7; text-align: center; text-transform: uppercase; }

/* ── Sleep bars ── */
.sleep-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sleep-bar-row { display: flex; align-items: center; gap: 8px; }
.sleep-bar-label { width: 48px; font-size: 12px; color: var(--muted); }
.sleep-bar-track { flex: 1; height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.sleep-bar-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.sleep-bar-val { width: 50px; font-size: 12px; color: var(--muted); text-align: right; }

/* ── Activities ── */
.activity-icon { font-size: 24px; width: 36px; text-align: center; flex-shrink: 0; }
.activity-info { flex: 1; min-width: 0; }
.activity-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-meta { font-size: 13px; }
.activity-tss { font-size: 12px; color: var(--accent); white-space: nowrap; text-align: right; }

/* ── Weekly bars ── */
.weekly-bars { display: flex; flex-direction: column; gap: 8px; }
.week-bar-row { display: flex; align-items: center; gap: 8px; }
.week-label { width: 36px; font-size: 12px; color: var(--muted); }
.bar-track { flex: 1; height: 10px; background: var(--bg3); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 5px; transition: width .4s; }
.week-val { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 120px; text-align: right; }

/* ── Analyse ── */
.recs { display: flex; flex-direction: column; gap: 10px; }
.rec-item { background: var(--bg3); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.stat-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.stat-row:last-child { border-bottom: none; }

/* ── PMC Pills ── */
.pmc-pills { display: flex; gap: 16px; margin-top: 10px; }
.pmc-pill { text-align: center; flex: 1; }
.pmc-pill-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pmc-pill-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
.pmc-pill-sub { font-size: 11px; color: var(--muted); }
.pmc-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--muted); }

/* ── Status ── */
.status-list { display: flex; flex-direction: column; gap: 12px; }
.status-item { display: flex; align-items: flex-start; gap: 10px; }
.status-icon { font-size: 18px; margin-top: 2px; flex-shrink: 0; }

/* ── Button ── */
.btn { display: inline-block; background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { opacity: .85; }

code { background: var(--bg3); padding: 2px 6px; border-radius: 4px; font-size: 12px; font-family: monospace; }
