:root {
  --bg: #080d16;
  --surface: #111827;
  --surface-soft: #0f172a;
  --surface-raised: #172033;
  --ink: #e5edf7;
  --muted: #94a3b8;
  --line: #263449;
  --line-strong: #334155;
  --blue: #38bdf8;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #f43f5e;
  --purple: #a78bfa;
  --cyan: #2dd4bf;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% -10%, rgba(56, 189, 248, 0.18), transparent 34%),
    radial-gradient(circle at 85% 0%, rgba(167, 139, 250, 0.16), transparent 32%),
    linear-gradient(180deg, #0b1220 0, #080d16 360px),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(22, 50, 79, 0.86) 52%, rgba(15, 58, 63, 0.86) 100%);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  min-height: 116px;
  padding: 28px clamp(18px, 4vw, 42px);
}

.topbar > *,
.target,
.panel,
.card,
.summary-grid > *,
.latest > *,
.records > *,
.analysis-grid > * {
  min-width: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  line-height: 1;
}

.topbar p,
.target span {
  color: #9fb4ce;
  font-size: 13px;
  font-weight: 700;
  margin-top: 10px;
  text-transform: uppercase;
}

.target {
  background: rgba(15, 23, 42, 0.44);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  min-width: 210px;
  padding: 14px 16px;
  text-align: right;
}

.target strong {
  display: block;
  font-size: 19px;
  margin-top: 5px;
}

main {
  margin: 0 auto;
  max-width: 1320px;
  padding: 22px clamp(14px, 3vw, 28px) 36px;
}

.tabbar {
  align-items: center;
  background: rgba(15, 23, 42, 0.84);
  border: 1px solid rgba(51, 65, 85, 0.86);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: -44px 0 20px;
  padding: 10px;
  position: sticky;
  top: 10px;
  z-index: 10;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab,
.refresh-btn {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 800;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab {
  background: transparent;
  color: #b6c2d2;
}

.tab:hover {
  background: #1e293b;
}

.tab.active {
  background: #e5edf7;
  border-color: #e5edf7;
  color: #0f172a;
}

.refresh-btn {
  background: #0284c7;
  border-color: #0ea5e9;
  color: #ffffff;
}

.refresh-btn:hover {
  background: #0369a1;
}

.refresh-btn:disabled {
  cursor: progress;
  opacity: 0.65;
}

.tab:focus-visible,
.refresh-btn:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.34);
  outline-offset: 2px;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 18px;
}

.card,
.panel {
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.card {
  border-top: 4px solid var(--blue);
  min-height: 108px;
  padding: 15px 14px;
  position: relative;
}

.card span,
.panel-head span,
.zones span,
.latest span,
.records span,
.score-row span,
.summary-grid span,
.prediction-grid span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card strong {
  display: block;
  font-size: clamp(21px, 2.2vw, 28px);
  line-height: 1.05;
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.card small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 5px;
}

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.28fr) minmax(340px, 0.72fr);
}

.grid.two > .panel:only-child {
  grid-column: 1 / -1;
}

.grid.two > .compliance-panel {
  grid-column: 1 / -1;
}

.compliance-panel {
  overflow: visible;
}

.panel {
  overflow: hidden;
  padding: 18px;
}

.panel.compliance-panel {
  overflow: visible;
}

.panel-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: -2px 0 16px;
  padding-bottom: 12px;
}

.panel-head h2 {
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

canvas {
  display: block;
  width: 100%;
}

.chart-tooltip {
  background: rgba(8, 13, 22, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  color: #e5edf7;
  display: none;
  font-size: 12px;
  line-height: 1.35;
  max-width: 220px;
  padding: 8px 10px;
  pointer-events: none;
  position: fixed;
  z-index: 50;
}

.chart-tooltip.visible {
  display: grid;
  gap: 2px;
}

.chart-tooltip strong {
  color: #f8fafc;
  font-size: 12px;
}

.chart-tooltip span {
  color: #cbd5e1;
}

.course-tooltip {
  max-width: 260px;
}

#weeklyChart,
#runChart {
  height: 240px;
  max-height: 240px;
}

#runChart {
  height: 260px;
  max-height: 260px;
}

#courseMap {
  height: 360px;
  max-height: 360px;
}

#courseProfile {
  height: 280px;
  max-height: 280px;
}

.pies {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
  text-align: center;
}

.pies > div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 8px 10px;
}

.pies canvas {
  height: 210px;
  margin: 0 auto;
  max-width: 220px;
}

.pies h3 {
  color: #dbe7f5;
  font-size: 13px;
  font-weight: 800;
  margin-top: 6px;
}

.advice {
  border-left: 5px solid var(--blue);
}

.advice h3 {
  color: #f8fafc;
  font-size: clamp(21px, 2.5vw, 30px);
  line-height: 1.12;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.advice p {
  color: #b6c2d2;
  line-height: 1.55;
}

.tomorrow-advice {
  background: rgba(120, 53, 15, 0.24);
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-left: 5px solid var(--orange);
  border-radius: 8px;
  margin-top: 18px;
  padding: 14px;
}

.tomorrow-advice span {
  color: #fbbf24;
  margin-bottom: 6px;
}

.tomorrow-advice h4 {
  color: #fff7ed;
  font-size: 17px;
  line-height: 1.25;
  margin: 0 0 8px;
}

.tomorrow-advice ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.tomorrow-advice li {
  color: #d6dee9;
  line-height: 1.45;
  margin-bottom: 5px;
}

.zones {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 18px;
}

.zones div,
.latest div,
.records div,
.score-row div,
.summary-grid div,
.prediction-grid div,
.analysis-grid article {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.zones strong,
.latest strong,
.records strong {
  display: block;
  font-size: 15px;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.latest small,
.records small,
.prediction-grid small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 6px;
}

.nutrition ul,
.analysis ul,
.compliance-wrap ul {
  margin: 0;
  padding-left: 18px;
}

.nutrition li,
.analysis li,
.compliance-wrap li {
  color: #cbd5e1;
  line-height: 1.52;
  margin-bottom: 8px;
}

.latest,
.records {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}

.compliance-wrap {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
}

.compliance-panel .compliance-wrap {
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
}

.compliance-wrap canvas {
  height: 220px;
  max-width: 220px;
}

.compliance-visual {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 160px minmax(0, 1fr);
}

.compliance-visual canvas {
  height: 160px;
  max-width: 160px;
}

.training-mascot {
  aspect-ratio: 217.2 / 724;
  background-image: url("assets/training-squirrel-emotions-transparent.png");
  background-position: 0% 50%;
  background-repeat: no-repeat;
  background-size: 1000% 100%;
  border-radius: 8px;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.32));
  margin: 0 auto;
  max-height: 210px;
  min-height: 150px;
  width: auto;
}

.mascot-label {
  color: #cbd5e1;
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  margin-top: 8px;
  text-align: center;
}

.compliance-panel .table-wrap.compact table {
  min-width: 760px;
}

.compliance-kpi-strip {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 12px 0 8px;
}

.compliance-kpi-strip div {
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 9px;
}

.compliance-kpi-strip span,
.compliance-kpi-strip small {
  color: var(--muted);
  display: block;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.compliance-kpi-strip strong {
  color: #f8fafc;
  display: block;
  font-size: 17px;
  line-height: 1.15;
  margin: 4px 0 2px;
  overflow-wrap: anywhere;
}

.compliance-intent {
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.18);
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.4;
  margin: 8px 0 10px;
  padding: 9px 10px;
}

.zone-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0;
}

.zone-distribution {
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 10px;
}

.zone-title {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.zone-title span,
.zone-title strong {
  color: #e5edf7;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.zone-title strong {
  color: var(--muted);
}

.zone-stack {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
  display: flex;
  height: 10px;
  overflow: hidden;
}

.zone-stack span {
  display: block;
  min-width: 1px;
}

.zone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 8px;
}

.zone-legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  gap: 4px;
  line-height: 1.2;
}

.zone-legend i {
  border-radius: 999px;
  display: inline-block;
  height: 7px;
  width: 7px;
}

.compliance-measure-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.compliance-measure {
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid var(--line);
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  min-width: 0;
  padding: 9px 10px;
}

.compliance-measure.ok {
  border-left-color: #22c55e;
}

.measure-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 7px;
}

.measure-head strong {
  color: #f8fafc;
  font-size: 13px;
  line-height: 1.2;
  margin: 0;
}

.measure-values {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.measure-values div {
  min-width: 0;
}

.measure-values span {
  color: var(--muted);
  display: block;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0 0 2px;
  text-transform: uppercase;
}

.measure-values strong {
  color: #e5edf7;
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
  overflow-wrap: anywhere;
}

.compliance-wrap p,
.compliance-copy {
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 10px;
}

.compliance-wrap strong {
  color: #f8fafc;
}

.compliance-wrap span {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.compliance-kpi-strip span,
.compliance-kpi-strip small,
.measure-values span,
.measure-head .status-pill {
  margin-top: 0;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap.compact {
  margin: 14px 0;
}

.table-wrap.compact table {
  min-width: 640px;
}

.table-wrap.compact th,
.table-wrap.compact td {
  font-size: 12px;
  padding: 9px 8px;
}

.status-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  margin-top: 0;
  padding: 3px 8px;
  text-transform: uppercase;
}

.status-pill.ok {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.status-pill.warn {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 12px 10px;
  text-align: left;
  overflow-wrap: anywhere;
}

th {
  background: #0f172a;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
}

tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.62);
}

tbody tr:hover {
  background: rgba(56, 189, 248, 0.1);
}

.analysis {
  line-height: 1.5;
}

.analysis h3 {
  color: #f8fafc;
  font-size: 18px;
  margin: 24px 0 10px;
}

.analysis p {
  color: #cbd5e1;
  margin-bottom: 12px;
}

.notice {
  background: rgba(120, 53, 15, 0.24);
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 8px;
  color: #fed7aa;
  padding: 12px;
}

.garmin-panel {
  overflow: hidden;
}

.garmin-readiness {
  align-items: stretch;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(120px, 150px) 1fr;
}

.garmin-score {
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  display: grid;
  justify-items: center;
  min-height: 132px;
  padding: 14px;
}

.garmin-readiness.good .garmin-score {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.42);
}

.garmin-readiness.watch .garmin-score {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.42);
}

.garmin-readiness.bad .garmin-score {
  background: rgba(244, 63, 94, 0.13);
  border-color: rgba(244, 63, 94, 0.42);
}

.garmin-score span,
.garmin-kpis span,
.garmin-empty span,
.weight-tile span {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.garmin-score strong {
  color: #f8fafc;
  font-size: 44px;
  line-height: 1;
}

.garmin-score small,
.garmin-kpis small,
.garmin-empty small,
.weight-tile small {
  color: #94a3b8;
}

.garmin-summary p {
  color: #dbeafe;
  margin: 0 0 12px;
}

.garmin-kpis {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.garmin-kpis div,
.garmin-empty,
.weight-tile {
  background: rgba(15, 23, 42, 0.74);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  min-width: 0;
  padding: 12px;
}

.garmin-kpis strong,
.garmin-empty strong,
.weight-tile strong {
  color: #f8fafc;
  display: block;
  font-size: 18px;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.weight-tile {
  display: grid;
  gap: 7px;
  min-height: 112px;
}

.weight-head strong {
  color: #f8fafc;
}

.weight-sparkline {
  display: block;
  height: 54px;
  max-width: 100%;
  width: 100%;
}

.weight-sparkline line {
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 1;
}

.weight-sparkline polyline {
  fill: none;
  stroke: #2dd4bf;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.weight-sparkline circle {
  fill: #f8fafc;
  stroke: #2dd4bf;
  stroke-width: 2;
}

.garmin-signals {
  color: #cbd5e1;
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding-left: 18px;
}

.garmin-empty {
  margin-top: 12px;
}

.score-row,
.summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin: 16px 0;
}

.summary-grid {
  grid-template-columns: repeat(6, 1fr);
}

.summary-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-grid.compact strong {
  font-size: 16px;
  line-height: 1.25;
}

.score-row strong,
.summary-grid strong,
.prediction-grid strong {
  display: block;
  font-size: 21px;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.analysis-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.analysis-grid h3 {
  margin-top: 0;
}

.race-summary strong {
  font-size: 19px;
}

.race-visuals {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  margin: 16px 0 18px;
}

.race-visuals article {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 14px;
}

.race-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.race-legend span {
  align-items: center;
  color: #cbd5e1;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
}

.race-legend i {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.race-legend .start {
  background: #22c55e;
}

.race-legend .finish {
  background: #f43f5e;
}

.race-legend .ravito {
  background: #f59e0b;
}

.race-legend .col {
  background: #a78bfa;
}

.race-bottom {
  margin-top: 16px;
}

.embedded {
  box-shadow: none;
}

.prediction-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    display: grid;
    gap: 16px;
    min-height: 170px;
  }

  .target {
    text-align: left;
  }

  main {
    padding-inline: 12px;
  }

  .tabbar {
    align-items: stretch;
    display: grid;
    margin-top: -54px;
    position: static;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tab,
  .refresh-btn {
    min-height: 42px;
    padding: 10px 8px;
  }

  .refresh-btn {
    width: 100%;
  }

  .garmin-readiness {
    grid-template-columns: 1fr;
  }

  .garmin-score {
    min-height: 104px;
  }

  .garmin-score strong {
    font-size: 36px;
  }

  .garmin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics,
  .latest,
  .records,
  .zones,
  .score-row,
  .analysis-grid,
  .prediction-grid,
  .zone-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .race-visuals {
    grid-template-columns: 1fr;
  }

  .pies {
    grid-template-columns: 1fr;
  }

  .compliance-wrap {
    grid-template-columns: 1fr;
  }

  .compliance-panel .compliance-wrap {
    grid-template-columns: 1fr;
  }

  .compliance-visual {
    grid-template-columns: 160px minmax(0, 1fr);
    justify-content: center;
  }

  .compliance-wrap canvas {
    margin: 0 auto;
  }

  .compliance-kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel {
    padding: 15px;
  }

  #weeklyChart,
  #runChart,
  #courseProfile {
    height: 220px;
    max-height: 220px;
  }

  #courseMap {
    height: 300px;
    max-height: 300px;
  }
}

@media (max-width: 560px) {
  body {
    background:
      linear-gradient(180deg, #0b1220 0, #080d16 300px),
      var(--bg);
  }

  .topbar {
    gap: 12px;
    min-height: 150px;
    padding: 20px 14px 68px;
  }

  h1 {
    font-size: 28px;
  }

  .topbar p,
  .target span {
    font-size: 11px;
    line-height: 1.35;
  }

  .target {
    width: 100%;
  }

  .target strong {
    font-size: 17px;
  }

  main {
    padding: 0 10px 28px;
  }

  .tabbar {
    margin-top: -50px;
    padding: 8px;
  }

  .metrics {
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card {
    min-height: 92px;
    padding: 12px 10px;
  }

  .card span,
  .panel-head span,
  .zones span,
  .latest span,
  .records span,
  .score-row span,
  .summary-grid span,
  .prediction-grid span {
    font-size: 10px;
    line-height: 1.25;
  }

  .card strong {
    font-size: 20px;
    margin-top: 9px;
  }

  .card small {
    font-size: 11px;
    line-height: 1.25;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  .tab,
  .refresh-btn {
    min-height: 38px;
  }

  .grid {
    gap: 12px;
    margin-bottom: 12px;
  }

  .panel {
    padding: 12px;
  }

  .panel-head {
    align-items: flex-start;
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
  }

  .panel-head h2 {
    font-size: 16px;
  }

  .summary-grid,
  .summary-grid.compact,
  .latest,
  .records,
  .zones,
  .score-row,
  .prediction-grid {
    gap: 9px;
    grid-template-columns: 1fr;
  }

  .summary-grid strong,
  .score-row strong,
  .prediction-grid strong {
    font-size: 18px;
  }

  .advice h3 {
    font-size: 21px;
  }

  .tomorrow-advice {
    margin-top: 14px;
    padding: 12px;
  }

  .compliance-wrap {
    gap: 10px;
    min-width: 0;
  }

  .compliance-wrap canvas {
    height: 136px;
    max-width: 136px;
    width: 136px;
  }

  .compliance-visual {
    align-items: center;
    gap: 10px;
    grid-template-columns: minmax(112px, 136px) minmax(72px, 96px);
    justify-content: center;
    justify-items: center;
  }

  .compliance-visual canvas {
    height: 136px;
    margin: 0 auto;
    max-width: 136px;
    width: 136px;
  }

  .training-mascot {
    max-height: 132px;
    min-height: 112px;
  }

  .mascot-label {
    font-size: 11px;
    line-height: 1.25;
    margin-top: 5px;
  }

  .compliance-copy {
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .compliance-copy > strong {
    display: block;
    margin-bottom: 5px;
  }

  .compliance-copy span {
    font-size: 12px;
    line-height: 1.35;
  }

  .compliance-panel .summary-grid.compact {
    grid-template-columns: 1fr;
  }

  .table-wrap.compact {
    border: 0;
    overflow: visible;
  }

  .table-wrap.compact table,
  .table-wrap.compact thead,
  .table-wrap.compact tbody,
  .table-wrap.compact tr,
  .table-wrap.compact th,
  .table-wrap.compact td {
    display: block;
    min-width: 0;
    width: 100%;
  }

  .table-wrap.compact thead {
    display: none;
  }

  .table-wrap.compact tr {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 8px 9px;
  }

  .table-wrap.compact td {
    border-bottom: 0;
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(68px, 78px) minmax(0, 1fr);
    padding: 4px 0;
    white-space: normal;
  }

  .table-wrap.compact td::before {
    color: var(--muted);
    content: "";
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  .table-wrap.compact td:nth-child(1)::before {
    content: "Mesure";
  }

  .table-wrap.compact td:nth-child(2)::before {
    content: "Attendu";
  }

  .table-wrap.compact td:nth-child(3)::before {
    content: "Realise";
  }

  .table-wrap.compact td:nth-child(4)::before {
    content: "Ecart";
  }

  .table-wrap.compact td:nth-child(5)::before {
    content: "Statut";
  }

  table {
    min-width: 760px;
  }

  .notice,
  .analysis p,
  .advice p,
  .tomorrow-advice li,
  .nutrition li,
  .analysis li,
  .compliance-wrap li {
    font-size: 14px;
  }

  .compliance-panel {
    overflow: visible;
    padding: 12px;
  }

  .compliance-panel .panel-head {
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
  }

  .compliance-panel .panel-head h2 {
    font-size: 15px;
    line-height: 1.2;
  }

  .compliance-panel .panel-head span {
    font-size: 11px;
    white-space: nowrap;
  }

  .compliance-panel .compliance-wrap {
    gap: 8px;
    overflow: visible;
  }

  .compliance-panel .compliance-visual {
    gap: 8px;
    grid-template-columns: 106px 72px;
    margin: 0 auto 4px;
    max-width: 190px;
  }

  .compliance-panel .compliance-visual canvas {
    height: 106px;
    max-width: 106px;
    width: 106px;
  }

  .compliance-panel .training-mascot {
    max-height: 104px;
    min-height: 88px;
  }

  .compliance-panel .mascot-label {
    font-size: 9px;
    line-height: 1.15;
    margin-top: 3px;
  }

  .compliance-panel .compliance-copy {
    font-size: 11px;
    line-height: 1.38;
    margin-bottom: 7px;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .compliance-panel .compliance-copy span {
    font-size: 10px;
    line-height: 1.25;
    margin-top: 4px;
  }

  .compliance-panel .table-wrap.compact {
    margin: 8px 0;
    max-width: 100%;
  }

  .compliance-panel .table-wrap.compact tr {
    margin-bottom: 7px;
    padding: 6px 7px;
  }

  .compliance-panel .table-wrap.compact td {
    font-size: 10.5px;
    gap: 5px;
    grid-template-columns: 58px minmax(0, 1fr);
    line-height: 1.25;
    padding: 3px 0;
  }

  .compliance-panel .table-wrap.compact td::before {
    font-size: 8px;
    line-height: 1.2;
  }

  .compliance-kpi-strip {
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 8px 0;
  }

  .compliance-kpi-strip div {
    padding: 7px;
  }

  .compliance-kpi-strip span,
  .compliance-kpi-strip small {
    font-size: 8px;
    line-height: 1.15;
  }

  .compliance-kpi-strip strong {
    font-size: 13px;
    line-height: 1.15;
  }

  .compliance-intent {
    font-size: 10.5px;
    line-height: 1.3;
    margin: 7px 0;
    padding: 7px;
  }

  .compliance-measure-list {
    gap: 6px;
  }

  .compliance-measure {
    padding: 7px;
  }

  .measure-head {
    margin-bottom: 5px;
  }

  .measure-head strong {
    font-size: 11px;
  }

  .measure-values {
    gap: 5px;
    grid-template-columns: 1fr;
  }

  .measure-values span {
    font-size: 8px;
  }

  .measure-values strong {
    font-size: 10.5px;
  }

  .compliance-panel .status-pill {
    font-size: 9px;
    padding: 2px 6px;
  }

  .compliance-panel .summary-grid.compact {
    gap: 7px;
    margin-top: 8px;
  }

  .compliance-panel .summary-grid.compact div {
    padding: 8px;
  }

  .compliance-panel .summary-grid.compact span,
  .compliance-panel .summary-grid.compact small {
    font-size: 9px;
    line-height: 1.2;
  }

  .compliance-panel .summary-grid.compact strong {
    font-size: 13px;
    line-height: 1.2;
  }

  #weeklyChart,
  #runChart,
  #courseProfile {
    height: 200px;
    max-height: 200px;
  }

  #courseMap {
    height: 260px;
    max-height: 260px;
  }
}

@media (max-width: 380px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .garmin-kpis {
    grid-template-columns: 1fr;
  }

  .compliance-panel {
    padding: 10px;
  }

  .compliance-panel .compliance-visual {
    grid-template-columns: 92px 62px;
    max-width: 164px;
  }

  .compliance-panel .compliance-visual canvas {
    height: 92px;
    max-width: 92px;
    width: 92px;
  }

  .compliance-panel .training-mascot {
    max-height: 92px;
    min-height: 76px;
  }

  .compliance-panel .compliance-copy {
    font-size: 10.5px;
  }

  .compliance-panel .table-wrap.compact td {
    font-size: 10px;
    grid-template-columns: 52px minmax(0, 1fr);
  }
}
