/* ════════════════════════════════════════════════════════
   ZoomZoom · AI Running Coach — Design System
   ════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────── */
:root {
  --bg:            oklch(0.09  0.012 248);
  --surface:       oklch(0.125 0.012 248);
  --surface-hi:    oklch(0.155 0.014 248);
  --surface-hover: oklch(0.19  0.014 248);
  --border:        oklch(0.23  0.012 248);
  --border-sub:    oklch(0.16  0.010 248);
  --text-1:        oklch(0.95  0.006 248);
  --text-2:        oklch(0.68  0.010 248);
  --text-3:        oklch(0.50  0.008 248);

  /* Accent colours — hex for Chart.js canvas compat */
  --c-ctl:  #d4bc28;
  --c-atl:  #e05838;
  --c-tsb:  #48d478;
  --c-dist: #30c8e0;
  --c-time: #c858a8;
  --c-load: #8840d0;
  --c-eff:  #32d890;
  --c-rpe:  #c08830;
  --c-temp: #c07828;
  --c-pace: #e0d090;
  --c-cta:  #d4bc28;

  --nav-h:      52px;
  --content-w:  1140px;
  --panel-w:    480px;
  --r:          6px;
  --r-sm:       4px;
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text-1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── Navigation ──────────────────────────────────────── */
.app-nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  background: oklch(0.075 0.012 248);
  border-bottom: 1px solid var(--border-sub);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  z-index: 200;
}
.nav-brand {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--c-cta);
  margin-right: 24px;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  padding: 0 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.nav-tab:hover { color: var(--text-1); }
.nav-tab.active { color: var(--text-1); border-bottom-color: var(--c-cta); }
.nav-sub { font-size: 10px; color: var(--text-3); }
.nav-meta {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-3);
  flex-shrink: 0;
  padding-left: 16px;
}

/* ── Layout ──────────────────────────────────────────── */
.app-main {
  margin-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
}
.view {
  display: none;
  padding: 28px 24px 60px;
  max-width: var(--content-w);
  margin: 0 auto;
}
.view.active { display: block; }
.section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* ── Shared buttons ──────────────────────────────────── */
.btn-cta {
  padding: 8px 16px;
  background: var(--c-cta);
  color: #1a1208;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter .12s;
  white-space: nowrap;
}
.btn-cta:hover { filter: brightness(1.1); }
.btn-sec {
  padding: 8px 14px;
  background: var(--surface-hi);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .1s;
  white-space: nowrap;
}
.btn-sec:hover { background: var(--surface-hover); }
.btn-sm {
  padding: 5px 11px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: background .1s, color .1s;
}
.btn-sm:hover { background: var(--surface-hover); color: var(--text-1); }
.btn-badge {
  font-size: 9.5px;
  padding: 2px 5px;
  background: oklch(0.45 0.15 260 / 0.25);
  color: oklch(0.74 0.15 260);
  border-radius: 3px;
}

/* ── Fitness Cards ───────────────────────────────────── */
.fitness-section { margin-bottom: 16px; }
.fitness-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-left: 3px solid var(--mc, var(--border));
  border-radius: var(--r);
  padding: 8px 12px 7px;
  cursor: pointer;
  transition: background .12s;
  user-select: none;
  text-align: center;
}
.metric-card:hover { background: var(--surface-hi); }
.metric-card.active { background: var(--surface-hi); }
.mc-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 4px;
}
.mc-icon { font-size: 13px; line-height: 1; }
.mc-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--mc, var(--text-3));
  flex-shrink: 0;
}
.mc-value {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--mc, var(--text-1));
  line-height: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
}
.mc-unit { font-size: 13px; font-weight: 400; color: var(--text-3); }
.mc-tap { font-size: 9.5px; color: var(--text-3); margin-top: 4px; }

/* Trend expand */
.trend-expand {
  overflow: hidden;
  max-height: 0;
  transition: max-height .32s cubic-bezier(.4,0,.2,1), margin .32s;
}
.trend-expand.open { max-height: 280px; margin-top: 8px; margin-bottom: 4px; }
.trend-inner {
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-radius: var(--r);
  padding: 12px 14px;
  height: 220px;
  display: flex;
  flex-direction: column;
}
.trend-inner canvas {
  flex: 1;
  min-height: 0;
}
.trend-label {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
}
  color: var(--text-3);
}

/* ── Runs Table ──────────────────────────────────────── */
.runs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.runs-hint { font-size: 11px; color: var(--text-3); }
.runs-scroll-outer {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: var(--r) var(--r) 0 0;
}
.runs-scroll-outer::-webkit-scrollbar { display: none; }
.runs-table-wrap {
  border-radius: var(--r) var(--r) 0 0;
  overflow: hidden;
  border: 1px solid var(--border-sub);
  min-width: 560px;
}
.runs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}
.runs-table thead tr { border-bottom: 1px solid var(--border-sub); }
.runs-table th {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 9px 11px;
  text-align: right;
  white-space: nowrap;
}
.runs-table th.left { text-align: left; }
.runs-table tbody tr {
  border-bottom: 1px solid var(--border-sub);
  cursor: pointer;
  transition: background .1s;
}
.runs-table tbody tr:last-child { border-bottom: none; }
.runs-table tbody tr:hover { background: var(--surface-hi); }
.runs-table tbody tr.active { background: var(--surface-hi); }
.runs-table td {
  padding: 10px 11px;
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}
.runs-table td.left { text-align: left; }
.td-mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.td-date { color: var(--text-2); font-size: 11.5px; }
.runs-show-more {
  width: 100%;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.runs-show-more:hover { background: var(--surface-hi); color: var(--text-1); }

/* ── Run Panel ───────────────────────────────────────── */
.run-panel {
  position: fixed;
  inset: auto 0 0 0;
  height: 72vh;
  background: var(--surface);
  border-top: 2px solid var(--pa, var(--border));
  border-radius: 12px 12px 0 0;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.run-panel.open { transform: translateY(0); }
.panel-backdrop {
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  background: oklch(0 0 0 / 0.45);
  z-index: 99;
  display: none;
  cursor: pointer;
}
.panel-backdrop.open { display: block; }
/* drawer handle row */
.drawer-handle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-sub);
}
.drawer-handle-name { font-size: 15px; font-weight: 700; }
/* two-column inner layout */
.drawer-cols {
  display: grid;
  grid-template-columns: 55fr 45fr;
  flex: 1;
  overflow: hidden;
}
.drawer-left {
  overflow-y: auto;
  border-right: 1px solid var(--border-sub);
  overscroll-behavior: contain;
}
.drawer-right {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.panel-scroll {
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}
.panel-meta {
  padding: 14px 18px 13px;
  border-left: 4px solid var(--pa, var(--border));
  border-bottom: 1px solid var(--border-sub);
  position: relative;
}
.panel-meta-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 5px;
  padding-right: 38px;
}
.panel-meta-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 11.5px;
  color: var(--text-2);
}
.pms-val { font-family: 'JetBrains Mono', monospace; color: var(--text-1); }
.panel-meta-planned {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.plan-pip {
  width: 7px; height: 7px;
  background: var(--c-dist);
  border-radius: 1px;
  flex-shrink: 0;
}
.panel-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 26px; height: 26px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.panel-close:hover { background: var(--surface-hover); color: var(--text-1); }
.p-section {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-sub);
}
.p-section.overflow { overflow-x: auto; }
.p-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 9px;
}
.itable {
  width: 100%;
  border-collapse: collapse;
}
.itable th {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 5px 7px;
  text-align: right;
  border-bottom: 1px solid var(--border-sub);
  white-space: nowrap;
}
.itable th:first-child { text-align: left; padding-left: 0; }
.itable td {
  padding: 6px 5px;
  text-align: right;
  border-bottom: 1px solid oklch(0.16 0.010 248 / 0.4);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  white-space: nowrap;
}
.itable td:first-child {
  text-align: left;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  padding-left: 0;
  max-width: 100px;
}
.itable tr.is-rest { display: none; }
.itable tr.is-rest.show { display: table-row; }
.itable tr.is-rest td { color: var(--text-3); font-size: 11px; }
.itable tr.is-rest td:first-child { font-style: italic; }
.rest-toggle {
  margin-top: 8px;
  background: none;
  border: none;
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  transition: color .1s;
}
.rest-toggle:hover { color: var(--text-2); }
.panel-actions {
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-sub);
}
.panel-model { font-size: 10.5px; color: var(--text-3); margin-left: auto; }
.panel-analysis {
  padding: 14px 18px;
  min-height: 80px;
}
.analysis-empty { font-size: 13px; color: var(--text-3); }
.analysis-body { font-size: 13.5px; line-height: 1.72; }
.analysis-body p { margin-bottom: 12px; }
.analysis-body p:last-child { margin-bottom: 0; }
.analysis-feedback {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
}
.fb-label { font-size: 11px; color: var(--text-3); }
.fb-btn {
  width: 30px; height: 30px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.fb-btn:hover { background: var(--surface-hover); }
.fb-btn.up { background: oklch(0.14 0.05 148); border-color: var(--c-tsb); }
.fb-btn.dn { background: oklch(0.14 0.05 30);  border-color: var(--c-atl); }

/* ── Adaptation View ─────────────────────────────────── */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-radius: var(--r);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.chart-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.chart-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.chart-sub { font-size: 11px; color: var(--text-3); }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.leg-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); }
.leg-line { width: 22px; height: 2px; border-radius: 2px; flex-shrink: 0; }
.chart-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.coll-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-radius: var(--r);
  cursor: pointer;
  transition: background .1s;
  user-select: none;
}
.coll-hd:hover { background: var(--surface-hi); }
.coll-hd.open { border-radius: var(--r) var(--r) 0 0; }
.coll-title { font-size: 13px; font-weight: 600; }
.coll-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.coll-chev {
  color: var(--text-3);
  font-size: 12px;
  transition: transform .2s;
  flex-shrink: 0;
}
.coll-hd.open .coll-chev { transform: rotate(180deg); }
.coll-body {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.coll-body.open { display: block; }

/* Lactate form */
.lac-note { font-size: 12px; color: var(--text-3); margin-bottom: 16px; line-height: 1.6; }
.lac-sub-label {
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 7px;
}
.lac-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 6px;
}
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label-sm { font-size: 9.5px; color: var(--text-3); font-weight: 500; }
.form-input {
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color .12s;
}
.form-input:focus { border-color: var(--c-eff); }
.btn-add {
  padding: 7px 11px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  height: 34px;
  transition: background .1s;
}
.btn-add:hover { background: var(--surface-hover); }
.lac-readings { margin-bottom: 12px; }
.lac-reading {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-sub);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-2);
}
.lac-reading .hl { color: var(--c-eff); }
.lac-tab-bar {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-sub);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-bottom: 14px;
  width: fit-content;
}
.lac-tab {
  padding: 6px 14px;
  font-size: 12px;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: background .1s, color .1s;
}
.lac-tab.active { background: var(--surface-hi); color: var(--text-1); }

/* ── Weekly View ─────────────────────────────────────── */
.week-grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 28px;
  scrollbar-width: none;
}
.week-grid-wrap::-webkit-scrollbar { display: none; }
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 8px;
  min-width: 700px;
}
.week-day {
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-radius: var(--r);
  padding: 11px 10px;
  min-height: 108px;
}
.week-day.today { border-color: oklch(0.82 0.19 83 / 0.35); }
.wd-name {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 9px;
}
.week-day.today .wd-name { color: var(--c-cta); }
.w-chip {
  border-radius: var(--r-sm);
  padding: 4px 7px;
  font-size: 10.5px;
  margin-bottom: 5px;
  line-height: 1.3;
}
.w-chip-label {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .6;
  margin-bottom: 1px;
}
.chip-plan {
  background: oklch(0.19 0.015 248);
  border: 1px solid var(--border-sub);
  color: var(--text-2);
}
.chip-plan.z2  { border-left: 2px solid var(--c-dist); }
.chip-plan.lt  { border-left: 2px solid var(--c-atl); }
.chip-plan.rec { border-left: 2px solid var(--text-3); opacity: .7; }
.chip-plan.mlr { border-left: 2px solid var(--c-ctl); }
.chip-plan.cross { border-left: 2px solid var(--c-load); }
.chip-plan.rest { opacity: .35; }
.chip-actual {
  background: oklch(0.14 0.05 148 / 0.35);
  border: 1px solid oklch(0.35 0.12 148 / 0.3);
  color: var(--c-tsb);
}
.chip-upcoming {
  border: 1px dashed var(--border-sub);
  color: var(--text-3);
  font-size: 10px;
  text-align: center;
}
.report-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.report-body { max-width: 720px; }
.report-section { margin-bottom: 18px; }
.report-section:last-child { margin-bottom: 0; }
.report-sh {
  font-size: 12px;
  font-weight: 700;
  color: oklch(0.62 0.09 83 / 0.85);
  margin-bottom: 4px;
  margin-top: 20px;
}
.report-section:first-child .report-sh { margin-top: 4px; }
.report-paras {
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-1);
}
.report-paras p { margin-bottom: 8px; }
.report-paras p:last-child { margin-bottom: 0; }
.report-subhead {
  font-size: 12px;
  font-weight: 700;
  color: oklch(0.62 0.09 83 / 0.85);
  margin-top: 6px;
  margin-bottom: 2px;
}
.recs-label {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: oklch(0.62 0.09 83 / 0.85);
  border: 1px solid oklch(0.62 0.09 83 / 0.25);
  border-radius: 3px;
  padding: 3px 8px;
  margin-bottom: 20px;
  margin-top: 4px;
}
.report-recs { }
.report-rec {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
  align-items: baseline;
}
.report-rec:last-child { margin-bottom: 0; }
.rec-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 17px;
  font-weight: 500;
  color: var(--c-cta);
  line-height: 1;
  flex-shrink: 0;
  width: 34px;
}
.rec-text { font-size: 14px; line-height: 1.72; color: var(--text-1); }

/* ── Race pacing table (race plan, section 1) ────────── */
.race-pace-scroll { overflow-x: auto; margin-bottom: 8px; }
/* Reconciliation caption under the pacing table (Phase 2 sum guard). */
.race-pace-reconcile { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.race-pace-reconcile.warn { color: var(--c-atl, #d9534f); font-weight: 600; }
/* Race card — condensed race-morning view, shown in a screenshot-friendly
   modal (.race-card-modal below) sized for a phone screen. */
.race-card { font-size: 14px; }
.race-card-head { font-weight: 700; font-size: 15px; margin-bottom: 6px; padding-right: 26px; }
.race-card-sh { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin: 14px 0 5px; font-weight: 600; }
.race-card-band { width: 100%; border-collapse: collapse; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.race-card-band td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
.race-card-band td:nth-child(3) { font-family: 'Nunito', sans-serif; color: var(--text-3); white-space: normal; }
.race-card-body { color: var(--text-2); line-height: 1.5; font-size: 13px; }
.race-card-body p { margin: 0 0 8px; }
.race-card-body p:last-child { margin-bottom: 0; }

/* ── Race card modal — centered on desktop, near-fullscreen on phone so the
   whole race-morning sheet fits in one screenshot. ────────────────────── */
.race-card-modal {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.race-card-modal.open { display: flex; }
.race-card-modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.55);
  z-index: 205;
  display: none;
  cursor: pointer;
}
.race-card-modal-backdrop.open { display: block; }
.race-card-sheet {
  position: relative;
  background: var(--bg-card, #14110c);
  border: 1px solid var(--border);
  border-radius: var(--r);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 20px 16px;
}
.race-card-close {
  position: absolute;
  top: 12px; right: 12px;
  background: none; border: none; color: var(--text-3);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 4px;
}
.race-card-close:hover { color: var(--text-1); }
@media (max-width: 480px) {
  .race-card-modal { padding: 0; }
  .race-card-sheet {
    max-width: 100vw;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
}
.race-pace-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 13px;
}
.race-pace-table th {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-sub);
  white-space: nowrap;
}
.race-pace-table td {
  padding: 6px 8px;
  border-bottom: 1px solid oklch(0.14 0.01 248);
  vertical-align: top;
  color: var(--text-1);
  line-height: 1.4;
}
.race-pace-table td:first-child, .race-pace-table td:nth-child(2) {
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  color: var(--text-2);
}

/* ── Lactate inline data table ───────────────────────── */
.lac-data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  margin-bottom: 8px;
}
.lac-data-table th {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 4px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border-sub);
}
.lac-data-table td {
  padding: 2px 4px;
  border-bottom: 1px solid oklch(0.14 0.01 248);
  vertical-align: middle;
}
.lac-inline-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  width: 58px;
  padding: 2px 3px;
  transition: border-color .15s, background .15s;
}
.lac-inline-input:focus {
  outline: none;
  border-bottom: 1px solid var(--c-cta);
  background: oklch(0.15 0.01 248 / 0.6);
}
.lac-lt-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 2px 4px;
  text-align: center;
  transition: border-color .15s;
}
.lac-lt-input:focus {
  outline: none;
  border-bottom-color: var(--c-cta);
}
.lac-del-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 1px 5px;
  transition: color .1s;
}
.lac-del-btn:hover { color: #e05838; }

/* ── Dashboard availability flag (moved from Season → Profile; surfaced here
   so an open illness/injury/travel/life entry can't be forgotten) ───────── */
.dash-availability-flag {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 12px; margin-top: 16px;
  background: oklch(0.82 0.19 83 / 0.10);
  border: 1px solid oklch(0.82 0.19 83 / 0.35);
  border-radius: var(--r); font-size: 12px; color: var(--c-cta); cursor: pointer;
}
.dash-availability-flag:hover { background: oklch(0.82 0.19 83 / 0.16); }
.dash-availability-flag-link { font-size: 11px; opacity: .8; white-space: nowrap; }

/* ── Season View ─────────────────────────────────────── */
.season-list { max-width: 720px; }
/* Race calendar suggestions/drift cards match the race-list width below them
   (season-list caps at 720px; this container has no cap of its own). */
#race-calendar-suggestions { max-width: 720px; }
.season-item-wrap { margin-bottom: 10px; }
.season-item {
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-radius: var(--r);
  padding: 13px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.season-item.current { border-left: 3px solid var(--c-cta); padding-left: 14px; }
/* min-width (not 0) so the action-button row wraps onto its own line when it
   doesn't fit, instead of squeezing name/dates/phase-chips down to fit —
   button count differs per season (current has more actions than upcoming),
   so a min-width:0 squeeze produced inconsistent wrapping between cards. */
.si-left { flex: 1; min-width: 240px; }
.si-name { font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.si-meta {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  font-size: 11px; color: var(--text-3); margin-bottom: 8px;
}
.si-dates { font-family: 'JetBrains Mono', monospace; }
.si-week { color: var(--c-eff); font-weight: 600; }
.si-km   { font-family: 'JetBrains Mono', monospace; }
/* flex-basis:100% forces its own full-width row inside .season-item
   (which now allows wrapping); width:100% covers the mobile breakpoint,
   where .season-item switches to flex-direction:column. */
.si-goal { flex: 1 0 100%; width: 100%; font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.si-badge {
  font-size: 9px; padding: 2px 6px;
  background: oklch(0.82 0.19 83 / 0.12);
  color: var(--c-cta); border-radius: 3px; font-weight: 700;
  vertical-align: middle; margin-left: 6px;
}
.si-badge-upcoming {
  background: oklch(0.55 0.12 220 / 0.15);
  color: oklch(0.72 0.10 220);
}
/* Race list badges — two distinct visual families so priority (what kind of
   race) never reads the same as status (has-a-plan / has-a-result).
   Priority = solid saturated pill; status = lighter outlined chip. */
.race-priority-badge {
  font-size: 9px; padding: 2px 7px; border-radius: 3px; font-weight: 700;
  letter-spacing: .03em; vertical-align: middle; margin-left: 6px;
}
.race-priority-badge.goal   { background: var(--c-cta, #e0a82e); color: var(--bg-card, #14110c); }
.race-priority-badge.tuneup { background: oklch(0.70 0.15 55 / 0.16); color: #e08a3a; }
.race-status-chip {
  font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: 600;
  vertical-align: middle; margin-left: 6px;
  background: transparent; border: 1px solid currentColor;
}
.race-status-chip.plan   { color: #4a90e2; }
.race-status-chip.result { color: var(--c-tsb, #4caf50); }
.race-status-chip.gpx    { color: var(--text-3, #888); }
.si-actions { display: flex; gap: 7px; flex-shrink: 0; }
/* Phase bar inside season card */
.phase-bar {
  display: flex; gap: 5px; flex-wrap: wrap;
}
.phase-chip {
  font-size: 10px; font-weight: 600;
  padding: 3px 9px;
  background: var(--surface-hi);
  border: 1px solid var(--border-sub);
  border-radius: 3px;
  color: var(--text-3);
  transition: background .1s;
}
.phase-chip.active {
  background: oklch(0.14 0.05 160 / 0.4);
  border-color: var(--c-eff);
  color: var(--c-eff);
}
/* Phase manager panel */
.phase-manager {
  display: none;
  background: oklch(0.11 0.012 248);
  border: 1px solid var(--border-sub);
  border-top: none;
  padding: 12px 16px;
  border-radius: 0 0 var(--r) var(--r);
  margin-top: -2px;
}
.phase-manager.open { display: block; }
.pm-label {
  font-size: 9px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 9px;
}
.phase-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-sub);
  font-size: 12px;
  flex-wrap: wrap;
}
.phase-row:last-of-type { border-bottom: none; }
.phase-row.active .pr-name { color: var(--c-eff); font-weight: 700; }
.pr-indicator {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border); flex-shrink: 0;
}
.phase-row.active .pr-indicator { background: var(--c-eff); }
.pr-name { font-weight: 600; flex: 1; }
.pr-dates { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-3); }
/* Season review */
.season-review {
  background: oklch(0.11 0.012 248);
  border: 1px solid var(--border-sub);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  padding: 13px 16px;
  margin-top: -2px;
  display: none;
}
.season-review.open { display: block; }
.season-new-btn {
  width: 100%; max-width: 720px; margin-top: 10px; padding: 10px;
  background: none; border: 1px dashed var(--border);
  border-radius: var(--r); color: var(--text-3);
  font-size: 13px; cursor: pointer; text-align: center;
  transition: background .1s, border-color .1s, color .1s;
}
.season-new-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text-1); }
.new-season-form {
  display: none; max-width: 720px;
  background: var(--surface); border: 1px solid var(--border-sub);
  border-radius: var(--r); padding: 16px 18px; margin-top: 8px;
}
.new-season-form.open { display: block; }
.nsf-title { font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.nsf-row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 12px; }
.nsf-actions { display: flex; gap: 8px; }

/* ── Profile View ────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 820px;
}
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border-sub);
  border-radius: var(--r);
  padding: 18px 20px;
}
.pc-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-sub);
}
.pf-field { margin-bottom: 13px; }
.pf-field:last-child { margin-bottom: 0; }
.pf-label { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.pf-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
}
.pf-val.computed { font-size: 16px; font-weight: 500; color: var(--c-eff); }
.pf-input {
  padding: 7px 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color .12s;
  resize: none;
}
.pf-input:focus { border-color: var(--c-eff); }
.profile-save { margin-top: 18px; }

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .chart-2col { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .view { padding: 20px 14px 48px; }
  /* Nav: whole bar scrolls as one strip */
  .app-nav { overflow-x: auto; padding: 0 10px; flex-wrap: nowrap; }
  .app-nav::-webkit-scrollbar { display: none; }
  .nav-brand { font-size: 15px; margin-right: 10px; flex-shrink: 0; }
  .nav-tab { padding: 0 10px; font-size: 12px; flex-shrink: 0; }
  .nav-meta { display: none; }
  /* Cards: 3-column compact */
  .fitness-row { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .metric-card { padding: 6px 7px 5px; }
  .mc-value { font-size: 19px; }
  .mc-label { font-size: 8px; gap: 3px; }
  .mc-icon { font-size: 10px; }
  .mc-unit { font-size: 11px; }
  .mc-tap { display: none; }
  .col-gap, .col-time, .col-rpe { display: none; }
  .week-grid { gap: 5px; min-width: 560px; }
  .week-day { padding: 9px 6px; }
  .w-chip { font-size: 10px; padding: 3px 5px; }
  /* Drawer: full height, no rounded corners */
  .run-panel {
    height: calc(100dvh - var(--nav-h));
    border-radius: 0;
    border-top: 2px solid var(--pa, var(--border));
  }
  .drawer-cols { grid-template-columns: 1fr; }
  .drawer-left { border-right: none; border-bottom: 1px solid var(--border-sub); }
  /* Season cards: stack actions below info */
  .season-item { flex-direction: column; gap: 10px; }
  .si-actions { flex-wrap: wrap; gap: 6px; }
  .si-actions .btn-sm { flex: 1 1 auto; text-align: center; min-width: 60px; }
  .nsf-row { flex-direction: column; }
}
