:root {
  color-scheme: dark;
  --bg: #111318;
  --bg-elevated: #171a21;
  --panel: #1d222b;
  --panel-strong: #232936;
  --line: #333b48;
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #f4f7ee;
  --muted: #aab3c0;
  --subtle: #747f91;
  /* Accent pilotable : --accent est la seule couleur à changer, le reste en dérive.
     --accent-text est éclairci pour rester lisible en texte sur fond sombre,
     --accent-ink est l'encre posée SUR un aplat d'accent. */
  --accent: #7bf1a8;
  --accent-strong: #35d77d;
  --accent-text: #7bf1a8;
  --accent-ink: #0e1410;
  --accent-rgb: 123, 241, 168;
  --green: var(--accent);
  --green-strong: var(--accent-strong);
  --coral: #ff7a59;
  --blue: #69b7ff;
  --yellow: #ffd166;
  --danger: #ff5e6c;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.06), transparent 28rem),
    radial-gradient(circle at top right, rgba(105, 183, 255, 0.08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 17.5rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100vh;
  padding: 1.25rem;
  background: rgba(17, 19, 24, 0.92);
  border-right: 1px solid var(--line-soft);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  align-items: center;
  gap: 0.8rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 3.25rem;
  height: auto;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.sidebar-card small,
.muted {
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 0.45rem;
}

.nav-item,
.ghost-button,
.primary-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.nav-item {
  width: 100%;
  padding: 0.78rem 0.9rem;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: var(--panel);
  border-color: var(--line-soft);
  color: var(--text);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--green);
}

.sidebar-card,
.panel,
.stat-card,
.exercise-card,
.meal-card,
.timeline-item,
.source-card {
  background: rgba(29, 34, 43, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.sidebar-card {
  margin-top: auto;
  padding: 1rem;
}

.sidebar-card strong {
  display: block;
  margin: 0.35rem 0;
}

.main-area {
  min-width: 0;
  overflow-x: hidden;
  padding: 1.25rem clamp(1rem, 3vw, 2rem) 2.5rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: -1.25rem calc(clamp(1rem, 3vw, 2rem) * -1) 1.4rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  background: rgba(17, 19, 24, 0.82);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(18px);
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.2vw, 2.4rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.15rem;
}

h3 {
  margin-bottom: 0.45rem;
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-text);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 1rem;
}

.dashboard-grid {
  grid-template-columns: minmax(19rem, 0.95fr) minmax(0, 1.45fr);
  align-items: start;
}

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

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

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

.panel {
  min-width: 0;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.stat-card {
  padding: 0.9rem;
  min-height: 6rem;
}

.stat-card span {
  display: block;
  color: var(--subtle);
  font-size: 0.82rem;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin: 0.35rem 0 0.25rem;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1;
}

.stat-card small {
  color: var(--muted);
}

.quick-form,
.compact-form {
  display: grid;
  gap: 0.8rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

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

.field {
  display: grid;
  gap: 0.35rem;
}

.field.full {
  grid-column: 1 / -1;
}

label,
.label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
textarea {
  min-width: 0;
  width: 100%;
  min-height: 2.65rem;
  padding: 0.72rem 0.78rem;
  background: #101319;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
}

.check-row input {
  width: 1.1rem;
  min-height: 1.1rem;
  accent-color: var(--green);
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 2.65rem;
  padding: 0.72rem 0.95rem;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: var(--green-strong);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-soft);
  color: var(--text);
  text-decoration: none;
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.danger-button {
  background: rgba(255, 94, 108, 0.14);
  border: 1px solid rgba(255, 94, 108, 0.38);
  border-radius: var(--radius);
  color: #ffd9dd;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-soft);
  color: var(--text);
}

.icon-button:hover,
.icon-button.admin-unlocked {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.35);
  color: var(--accent-text);
}

.icon-button svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 18rem;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 18rem;
}

.chart-wrap.large canvas {
  height: 24rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.tab-button {
  flex: 0 0 auto;
  min-height: 2.45rem;
  padding: 0.58rem 0.8rem;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
}

.tab-button.active {
  background: var(--text);
  color: #101216;
}

.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1rem;
}

.exercise-card {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.exercise-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 18rem;
  background: #fff;
  overflow: hidden;
}

/* Les fichiers sources font 180x180 (limite imposée par la licence Gym visual).
   On les agrandit à l'affichage sans jamais redistribuer de résolution
   supérieure ; au-delà de ~17rem le rendu commence à ramollir. */
.exercise-media img {
  width: min(100%, 17rem);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}


.exercise-body {
  min-width: 0;
  display: grid;
  gap: 0.8rem;
  padding: 0.95rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.chip.green {
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.22);
  color: var(--accent-text);
}

.chip.coral {
  background: rgba(255, 122, 89, 0.12);
  border-color: rgba(255, 122, 89, 0.22);
  color: var(--coral);
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.set-grid input {
  padding-inline: 0.45rem;
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 42rem;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.meal-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.8rem;
}

.meal-card {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem;
}

.meal-card strong {
  display: block;
}

.meal-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 0.75rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 8.5rem 1fr auto;
  gap: 1rem;
  padding: 0.95rem;
  align-items: center;
}

.timeline-item time {
  color: var(--accent-text);
  font-weight: 900;
}

.timeline-item p {
  margin-bottom: 0;
  color: var(--muted);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.8rem;
}

.photo-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.photo-card div {
  padding: 0.75rem;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 0.8rem;
}

.source-card {
  padding: 0.9rem;
}

.source-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-modal[hidden] {
  display: none;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.admin-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 10, 0.72);
  backdrop-filter: blur(10px);
}

.admin-dialog {
  position: relative;
  width: min(42rem, 100%);
  max-height: min(90vh, 48rem);
  overflow: auto;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.admin-dialog .panel-header {
  margin-bottom: 1.2rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.switch-row span {
  display: block;
}

.switch-row small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 3.25rem;
  height: 1.75rem;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  opacity: 0;
}

.switch i {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #0f1218;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.switch i::after {
  content: "";
  position: absolute;
  top: 0.22rem;
  left: 0.24rem;
  width: 1.22rem;
  height: 1.22rem;
  background: var(--muted);
  border-radius: 50%;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.switch input:checked + i {
  background: rgba(var(--accent-rgb), 0.16);
  border-color: rgba(var(--accent-rgb), 0.45);
}

.switch input:checked + i::after {
  transform: translateX(1.45rem);
  background: var(--green);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  background: var(--text);
  border-radius: var(--radius);
  color: #101216;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.7rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 12rem;
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stack {
  display: grid;
  gap: 1rem;
}

.metric-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.metric-line:last-child {
  border-bottom: 0;
}

.metric-line span:first-child {
  color: var(--muted);
}

.metric-line strong {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .dashboard-grid,
  .two-col,
  .three-col,
  .four-col,
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 0.9rem;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .brand {
    grid-template-columns: 2.5rem 1fr;
  }

  .brand-mark {
    width: 2.5rem;
    height: 2.5rem;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .sidebar-card {
    display: none;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    margin-top: 0;
  }

  .dashboard-grid,
  .two-col,
  .three-col,
  .four-col,
  .stat-grid,
  .form-grid,
  .form-grid.wide,
  .timeline-item {
    grid-template-columns: 1fr;
  }

  .metric-line strong {
    text-align: left;
  }

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* ---- Sélecteur de couleur du thème ---- */
.theme-picker {
  position: relative;
  flex: none;
}

.theme-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 30;
  display: grid;
  gap: 0.7rem;
  width: 15.5rem;
  padding: 0.9rem;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.theme-panel[hidden] {
  display: none;
}

.theme-panel .eyebrow {
  margin: 0;
}

.theme-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
}

.theme-swatch {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--swatch);
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease;
}

.theme-swatch:hover {
  transform: translateY(-1px);
}

.theme-swatch.active {
  box-shadow:
    0 0 0 2px var(--panel-strong),
    0 0 0 4px var(--swatch);
}

.theme-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.theme-custom input[type="color"] {
  width: 2.75rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.theme-custom input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.theme-custom input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.theme-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.theme-preview .primary-button {
  min-height: 2.1rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.theme-reset {
  min-height: 2.2rem;
  font-size: 0.82rem;
}

@media (max-width: 720px) {
  .theme-panel {
    position: fixed;
    right: 1rem;
    left: 1rem;
    top: auto;
    bottom: 1rem;
    width: auto;
  }
}

/* ---- Mention d'attribution et bouton info sur la vignette ---- */

.info-button {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.28rem 0.45rem;
  background: rgba(17, 19, 24, 0.86);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.74rem;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.info-button:hover {
  background: rgba(17, 19, 24, 0.96);
  border-color: rgba(var(--accent-rgb), 0.5);
  color: var(--accent-text);
}

.info-button svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ---- Bande de récupération en pied de carte ---- */
.rest-strip {
  margin: 0 0 0.6rem;
}

.rest-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 2.35rem;
  padding: 0.4rem 0.7rem;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px dashed rgba(var(--accent-rgb), 0.4);
  border-radius: var(--radius);
  color: var(--accent-text);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.rest-start:hover {
  background: rgba(var(--accent-rgb), 0.16);
  border-style: solid;
}

.rest-start svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ---- Minuteur flottant ---- */
.rest-timer {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 25;
  display: grid;
  gap: 0.6rem;
  width: min(17rem, calc(100vw - 2rem));
  padding: 0.9rem;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.rest-timer[hidden] {
  display: none;
}

.rest-timer-head .eyebrow {
  margin: 0 0 0.15rem;
}

.rest-timer-head strong {
  display: block;
  font-size: 1.85rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.rest-timer-head small {
  color: var(--muted);
}

.rest-timer-bar {
  height: 0.3rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.rest-timer-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 900ms linear;
}

.rest-timer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.rest-timer-actions .ghost-button {
  min-height: 2.2rem;
  font-size: 0.82rem;
}

/* ---- Fiche technique ---- */
.guide-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.guide-modal[hidden] {
  display: none;
}

.guide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 12, 0.72);
  backdrop-filter: blur(3px);
}

.guide-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.9rem;
  width: min(44rem, 100%);
  max-height: min(85vh, 46rem);
  overflow-y: auto;
  padding: 1.2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.guide-body {
  display: grid;
  grid-template-columns: 11.25rem minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.guide-media {
  width: 11.25rem;
  height: 11.25rem;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius);
}

.guide-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.55rem;
}

.guide-steps li {
  padding-left: 0.15rem;
  line-height: 1.5;
}

.guide-steps li::marker {
  color: var(--accent-text);
  font-weight: 900;
}

.guide-meta {
  margin: 0;
}

.guide-credit {
  margin: 0;
  color: var(--subtle);
  font-size: 0.76rem;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .guide-body {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .rest-timer {
    left: 1rem;
    right: 1rem;
    width: auto;
  }
}

/* ---- Planificateur de la semaine ---- */
.planner-hint {
  margin: 0 0 0.9rem;
  font-size: 0.86rem;
}

.planner-layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.food-panel {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.6rem;
  padding: 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.food-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.cat-chip {
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

.cat-chip.active {
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.45);
  color: var(--accent-text);
}

.food-list {
  display: grid;
  gap: 0.35rem;
  max-height: 32rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.food-item {
  display: grid;
  gap: 0.1rem;
  padding: 0.5rem 0.6rem;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--text);
  text-align: left;
  cursor: grab;
  transition:
    border-color 140ms ease,
    transform 140ms ease;
}

.food-item:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--accent-rgb), 0.5);
}

.food-item.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.food-name {
  font-weight: 800;
  font-size: 0.88rem;
}

.food-portion {
  color: var(--muted);
  font-size: 0.75rem;
}

.food-macros {
  color: var(--subtle);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.planner-main {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.planner-grid {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  overflow-x: auto;
}

.planner-row {
  display: grid;
  grid-template-columns: 8.5rem repeat(4, minmax(8rem, 1fr)) 7.5rem;
  gap: 0.4rem;
  align-items: stretch;
}

.planner-head {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.planner-head > div {
  padding: 0.3rem 0.5rem;
}

.planner-day {
  display: grid;
  gap: 0.25rem;
  align-content: center;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.planner-day .chip {
  justify-self: start;
  font-size: 0.68rem;
}

.planner-cell {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.25rem;
  min-height: 4.2rem;
  padding: 0.4rem;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease;
}

.planner-cell:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
}

.planner-cell.active {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
}

.planner-cell.over {
  border-style: solid;
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.16);
}

.cell-hint {
  align-self: center;
  margin: auto;
  color: var(--subtle);
  font-size: 1.1rem;
}

.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.2rem 0.4rem;
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 999px;
  color: var(--accent-text);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.plan-chip i {
  font-style: normal;
  opacity: 0.6;
}

.plan-chip:hover {
  background: rgba(var(--danger-rgb, 255, 94, 108), 0.16);
  border-color: var(--danger);
  color: var(--danger);
}

.planner-total {
  display: grid;
  align-content: center;
  gap: 0.05rem;
  padding: 0.4rem 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--line);
  border-radius: 6px;
  text-align: right;
}

.planner-total strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.planner-total small,
.planner-total span {
  color: var(--muted);
  font-size: 0.72rem;
}

.planner-total em {
  color: var(--coral);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
}

.planner-total.ok {
  border-left-color: var(--accent);
}

.planner-total.bas {
  border-left-color: var(--blue);
}

.planner-total.haut {
  border-left-color: var(--coral);
}

.planner-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.5rem;
  padding: 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.planner-verdict {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.86rem;
}

@media (max-width: 1100px) {
  .planner-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .food-panel {
    position: static;
  }

  .food-list {
    max-height: 18rem;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  }

  .planner-grid {
    overflow-x: auto;
  }

  .planner-row {
    grid-template-columns: 7rem repeat(4, minmax(7.5rem, 1fr)) 6.5rem;
    min-width: 44rem;
  }
}

/* Le résumé empile libellé et valeur : .metric-line est prévu pour du pleine largeur. */
.planner-summary .metric-line {
  display: grid;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}

.planner-summary .metric-line span:first-child {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.planner-summary .metric-line strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

/* ---- Verrouillage par schéma ---- */

body.app-locked {
  overflow: hidden;
  touch-action: none;
}

body.app-locked .app-shell,
body.app-locked .mtopbar,
body.app-locked .mtabs {
  opacity: 0;
  pointer-events: none;
}

.pattern-lock[hidden] {
  display: none !important;
}

.pattern-lock {
  position: fixed;
  inset: 0;
  z-index: 2000;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.1), transparent 24rem),
    radial-gradient(circle at 78% 12%, rgba(105, 183, 255, 0.12), transparent 28rem),
    var(--bg);
  color: var(--text);
}

.pattern-shell {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: max(1.2rem, env(safe-area-inset-top)) 1.2rem max(1.2rem, env(safe-area-inset-bottom));
}

.pattern-panel {
  width: min(100%, 28rem);
  text-align: center;
}

.pattern-brand {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
}

.pattern-brand img {
  width: 4rem;
  height: auto;
  object-fit: contain;
}

.pattern-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.pattern-panel h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(2rem, 9vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.pattern-panel [data-pattern-help] {
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted);
}

.pattern-board {
  position: relative;
  width: min(82vw, 23rem);
  aspect-ratio: 1;
  margin: 2rem auto 1rem;
  touch-action: none;
  user-select: none;
}

.pattern-board canvas,
.pattern-grid {
  position: absolute;
  inset: 0;
}

.pattern-board canvas {
  width: 100%;
  height: 100%;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  align-items: center;
  justify-items: center;
  padding: 9%;
}

.pattern-dot {
  width: clamp(1rem, 5vw, 1.75rem);
  height: clamp(1rem, 5vw, 1.75rem);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0);
  transform: scale(1);
  transition:
    box-shadow 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.pattern-dot.active {
  background: var(--accent);
  box-shadow: 0 0 0 0.7rem rgba(var(--accent-rgb), 0.12);
  transform: scale(1.25);
}

.pattern-message {
  min-height: 1.35rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.pattern-message.error {
  color: var(--danger);
}

.pattern-message.ok {
  color: var(--accent-text);
}

.pattern-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.pattern-actions button {
  min-width: 7.8rem;
}

.hidden {
  display: none !important;
}

/* L'état arrive du serveur : on masque le contenu le temps du chargement
   pour éviter un flash de thème par défaut. */
body.loading .app-shell,
body.loading .mtopbar,
body.loading .mtabs {
  opacity: 0;
}

.app-shell {
  opacity: 1;
  transition: opacity 180ms ease;
}

.save-state {
  opacity: 0;
  padding: 0.28rem 0.5rem;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-text);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
  transition: opacity 220ms ease;
}

.save-state.visible {
  opacity: 1;
}

.save-state.failed {
  background: rgba(255, 94, 108, 0.16);
  color: var(--danger);
}

/* Éléments réservés au mobile : invisibles et inertes sur desktop.
   mobile.css (chargé sous 860px) les réactive. */
.mtopbar,
.mtabs {
  display: none;
}

/* ============================================================
   Historique des séances
   ============================================================ */

.tone-push { --tone: 197, 140, 255; }
.tone-pull { --tone: 105, 183, 255; }
.tone-legs { --tone: 255, 209, 102; }
.tone-upper { --tone: 255, 122, 89; }
.tone-lower { --tone: 255, 94, 156; }
.tone-full { --tone: 79, 209, 197; }
.tone-core { --tone: 123, 241, 168; }
.tone-other { --tone: 170, 179, 192; }

.hs-dot {
  display: inline-block;
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  background: rgb(var(--tone, var(--accent-rgb)));
  border-radius: 999px;
}

.hs-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.hs-stat {
  position: relative;
  display: grid;
  gap: 0.15rem;
  padding: 1rem 1.05rem;
  background: rgba(29, 34, 43, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
}

.hs-stat::after {
  content: "";
  position: absolute;
  inset: auto -30% -60% auto;
  width: 9rem;
  height: 9rem;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.12), transparent 70%);
  pointer-events: none;
}

.hs-stat-icon {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 0.55rem;
  background: rgba(var(--accent-rgb), 0.13);
  border-radius: 10px;
  color: var(--accent-text);
}

.hs-stat-icon svg,
.hs-round svg,
.hs-chevron,
.hs-empty-icon svg,
.hs-thumb svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hs-stat-label {
  color: var(--subtle);
  font-size: 0.8rem;
  font-weight: 700;
}

.hs-stat strong {
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hs-stat small {
  color: var(--muted);
  font-size: 0.82rem;
}

.hs-top {
  display: grid;
  grid-template-columns: minmax(18rem, 0.85fr) minmax(0, 1.4fr);
  gap: 1rem;
  margin-top: 1rem;
}

.hs-card {
  min-width: 0;
  padding: 1.1rem;
  background: rgba(29, 34, 43, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.hs-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.hs-card-head h2 {
  margin: 0;
}

.hs-month-nav {
  display: flex;
  gap: 0.35rem;
}

.hs-round {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  background: var(--panel-strong);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--text);
  transition: transform 160ms ease, background 160ms ease;
}

.hs-round:hover:not(:disabled) {
  background: rgba(var(--accent-rgb), 0.16);
}

.hs-round:active:not(:disabled) {
  transform: scale(0.92);
}

.hs-round:disabled {
  opacity: 0.35;
  cursor: default;
}

.hs-weekdays,
.hs-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.3rem;
}

.hs-weekdays span {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.hs-month {
  margin-top: 0.4rem;
}

.hs-day {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  max-height: 2.9rem;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hs-day.blank {
  visibility: hidden;
}

.hs-day.future {
  color: var(--subtle);
  opacity: 0.45;
}

.hs-day.today {
  border-color: rgba(var(--accent-rgb), 0.55);
  color: var(--text);
}

.hs-day.done {
  background: rgba(var(--tone), 0.2);
  border-color: rgba(var(--tone), 0.45);
  color: rgb(var(--tone));
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease;
}

.hs-day.done:hover {
  background: rgba(var(--tone), 0.32);
}

.hs-day.done:active {
  transform: scale(0.9);
}

.hs-day-more {
  position: absolute;
  top: 8%;
  right: 8%;
  width: 0.45rem;
  height: 0.45rem;
  background: rgb(var(--tone));
  border: 2px solid var(--panel);
  border-radius: 999px;
}

.hs-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.8rem;
}

.hs-legend-count strong {
  color: var(--text);
}

.hs-legend-keys {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.hs-legend-keys span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
}

.hs-segment {
  display: inline-flex;
  padding: 0.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}

.hs-segment button {
  padding: 0.35rem 0.8rem;
  background: none;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  transition: background 200ms ease, color 200ms ease;
}

.hs-segment button.active {
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hs-chart-avg {
  margin: -0.35rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.hs-chart-avg strong {
  color: var(--text);
}

.hs-bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  height: 13.5rem;
  padding-bottom: 1.4rem;
}

.hs-avg-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(1.4rem + (100% - 1.4rem - 1.6rem) * var(--avg) / 100);
  border-top: 1px dashed rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.hs-bar {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
  padding: 1.6rem 0 0;
  background: none;
  border: 0;
  color: inherit;
}

.hs-bar-fill {
  display: block;
  width: 100%;
  max-width: 2.6rem;
  height: var(--h);
  margin: 0 auto;
  background: linear-gradient(180deg, rgb(var(--tone)), rgba(var(--tone), 0.45));
  border-radius: 8px 8px 4px 4px;
  transform-origin: bottom;
  animation: hsGrow 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: filter 160ms ease;
}

.hs-bar:nth-child(odd) .hs-bar-fill { animation-delay: 40ms; }
.hs-bar:nth-child(3n) .hs-bar-fill { animation-delay: 80ms; }

@keyframes hsGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.hs-bar small {
  position: absolute;
  left: 50%;
  bottom: -1.4rem;
  transform: translateX(-50%);
  color: var(--subtle);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.hs-bar-tip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--h) + 0.35rem);
  transform: translate(-50%, 4px);
  padding: 0.2rem 0.45rem;
  background: var(--text);
  border-radius: 6px;
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 2;
}

.hs-bar:hover .hs-bar-tip,
.hs-bar:focus-visible .hs-bar-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hs-bar:hover .hs-bar-fill {
  filter: brightness(1.15);
}

.hs-chart-empty {
  display: grid;
  place-items: center;
  min-height: 9rem;
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.hs-toolbar {
  margin: 1.4rem 0 0.4rem;
}

.hs-filters {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.hs-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  background: rgba(29, 34, 43, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 160ms ease;
}

.hs-filter span {
  min-width: 1.35rem;
  padding: 0.05rem 0.4rem;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  font-size: 0.74rem;
  text-align: center;
}

.hs-filter:hover {
  color: var(--text);
}

.hs-filter:active {
  transform: scale(0.96);
}

.hs-filter.active {
  background: rgba(var(--tone, var(--accent-rgb)), 0.16);
  border-color: rgba(var(--tone, var(--accent-rgb)), 0.5);
  color: rgb(var(--tone, var(--accent-rgb)));
}

.hs-group {
  margin-top: 1.2rem;
}

.hs-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 0.55rem 0.2rem;
}

.hs-group-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.hs-group-head span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.hs-rows {
  display: grid;
  background: rgba(29, 34, 43, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
}

.hs-row {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto 1.1rem;
  align-items: center;
  gap: 0.95rem;
  width: 100%;
  padding: 0.8rem 1rem;
  background: none;
  border: 0;
  border-top: 1px solid var(--line-soft);
  color: var(--text);
  text-align: left;
  transition: background 160ms ease;
}

.hs-row:first-child {
  border-top: 0;
}

.hs-row:hover {
  background: rgba(255, 255, 255, 0.035);
}

.hs-row:active {
  background: rgba(255, 255, 255, 0.06);
}

.hs-date {
  display: grid;
  place-items: center;
  gap: 0;
  width: 3.2rem;
  height: 3.2rem;
  background: rgba(var(--tone), 0.14);
  border: 1px solid rgba(var(--tone), 0.28);
  border-radius: 12px;
  line-height: 1;
}

.hs-date small {
  color: rgb(var(--tone));
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hs-date strong {
  margin-top: -0.35rem;
  font-size: 1.22rem;
  font-variant-numeric: tabular-nums;
}

.hs-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.hs-main strong {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  overflow: hidden;
  font-size: 1rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hs-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hs-pr-pill {
  display: inline-flex;
  padding: 0.08rem 0.42rem;
  background: rgba(255, 209, 102, 0.15);
  border-radius: 999px;
  color: var(--yellow);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hs-figure {
  display: grid;
  justify-items: end;
  gap: 0.15rem;
}

.hs-figure strong {
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hs-delta {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hs-delta.up {
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-text);
}

.hs-delta.down {
  background: rgba(255, 94, 108, 0.14);
  color: var(--danger);
}

.hs-delta.flat {
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}

.hs-delta.none {
  visibility: hidden;
}

.hs-chevron {
  color: var(--subtle);
}

.hs-empty {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  max-width: 30rem;
  margin: 3rem auto;
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.hs-empty-icon {
  display: grid;
  place-items: center;
  width: 4.2rem;
  height: 4.2rem;
  margin-bottom: 0.6rem;
  background: rgba(var(--accent-rgb), 0.14);
  border-radius: 999px;
  color: var(--accent-text);
}

.hs-empty-icon svg {
  width: 1.9rem;
  height: 1.9rem;
}

.hs-empty h2 {
  margin: 0;
}

.hs-empty p {
  margin: 0 0 1rem;
  color: var(--muted);
}

/* ---------- Fiche détaillée : tiroir à droite sur desktop ---------- */

.hs-sheet {
  position: fixed;
  inset: 0;
  z-index: 45;
}

.hs-sheet[hidden] {
  display: none;
}

.hs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 9, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.hs-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(35rem, 100%);
  background: var(--bg-elevated);
  border-left: 1px solid var(--line-soft);
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
}

.hs-sheet.is-entering .hs-backdrop { animation: hsFade 300ms ease both; }
.hs-sheet.is-entering .hs-panel { animation: hsSlideIn 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.hs-sheet.is-closing .hs-backdrop { animation: hsFade 260ms ease reverse both; }
.hs-sheet.is-closing .hs-panel { animation: hsSlideIn 260ms cubic-bezier(0.4, 0, 1, 1) reverse both; }

@keyframes hsFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hsSlideIn {
  from { transform: translateX(100%); }
  to { transform: none; }
}

.hs-panel-head {
  padding: 1.2rem 1.4rem 1rem;
  background: radial-gradient(120% 140% at 100% 0%, rgba(var(--tone), 0.22), transparent 60%);
  border-bottom: 1px solid var(--line-soft);
}

.hs-grabber {
  display: none;
}

.hs-panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.hs-kicker {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: rgb(var(--tone));
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hs-panel-head h2 {
  margin: 0.55rem 0 0;
  font-size: 1.55rem;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.hs-time {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hs-panel-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.1rem 1.4rem 1.4rem;
}

.hs-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.hs-tile {
  display: grid;
  justify-items: start;
  gap: 0.15rem;
  padding: 0.7rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}

.hs-tile > span:first-child {
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 800;
}

.hs-tile strong {
  font-size: 1.12rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.hs-compare {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.hs-compare button {
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent-text);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hs-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 1.4rem 0 0.7rem;
}

.hs-section-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.hs-section-head > span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.hs-exercises {
  display: grid;
  gap: 0.6rem;
}

.hs-ex {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
}

.hs-ex-head {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.hs-thumb {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  overflow: hidden;
  background: #fff;
  border-radius: 10px;
  color: var(--bg);
}

.hs-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hs-ex-title {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.hs-ex-title strong {
  overflow: hidden;
  font-size: 0.96rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hs-ex-title span {
  color: var(--muted);
  font-size: 0.8rem;
}

.hs-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.hs-badge.pr {
  background: rgba(255, 209, 102, 0.16);
  color: var(--yellow);
}

.hs-badge.first {
  background: rgba(105, 183, 255, 0.14);
  color: var(--blue);
}

.hs-sets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.3rem, 1fr));
  gap: 0.4rem;
}

.hs-set {
  display: grid;
  justify-items: center;
  gap: 0;
  padding: 0.45rem 0.3rem 0.4rem;
  background: rgba(var(--tone), 0.09);
  border: 1px solid rgba(var(--tone), 0.2);
  border-radius: 10px;
  line-height: 1.15;
}

.hs-set small {
  color: var(--subtle);
  font-size: 0.64rem;
  font-weight: 800;
}

.hs-set strong {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.hs-set em {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.hs-ex-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
}

.hs-ex-vol strong {
  color: var(--text);
}

.hs-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.hs-share {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.hs-share i {
  display: block;
  height: 100%;
  background: rgb(var(--tone));
  border-radius: inherit;
}

.hs-note {
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.035);
  border-left: 2px solid rgba(var(--tone), 0.6);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}

.hs-panel-foot {
  display: flex;
  gap: 0.6rem;
  padding: 0.9rem 1.4rem 1.1rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--line-soft);
}

.hs-panel-foot .primary-button {
  flex: 1;
}

@media (max-width: 1100px) {
  .hs-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hs-top {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hs-bar-fill,
  .hs-sheet.is-entering .hs-panel,
  .hs-sheet.is-closing .hs-panel {
    animation: none;
  }
}
