:root {
  --bg-base: #090b10;
  --bg-surface: #11151f;
  --bg-card: #161b28;
  --bg-card-hover: #1c2233;
  --bg-input: #0d1018;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(249, 115, 22, 0.45);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent: #f97316;
  --accent-hover: #fb923c;
  --accent-glow: rgba(249, 115, 22, 0.18);
  --volt: #a3e635;
  --blue: #38bdf8;
  --purple: #c084fc;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* TOP NAVBAR */
.topbar {
  background: rgba(17, 21, 31, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #ea580c);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 0.9rem;
  box-shadow: 0 0 18px var(--accent-glow);
}

.brand span.accent-text {
  color: var(--accent);
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ========================================================================= */
/* LANDING HOME PAGE & AUTHENTICATION                                        */
/* ========================================================================= */
.landing-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 18% 22%, rgba(249, 115, 22, 0.14), transparent 42%),
    radial-gradient(circle at 82% 75%, rgba(163, 230, 53, 0.09), transparent 40%),
    var(--bg-base);
}

.landing-topbar {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-hero-grid {
  max-width: 1280px;
  width: 100%;
  margin: auto;
  padding: 20px 24px 48px;
  display: grid;
  grid-template-columns: 1.25fr 430px;
  gap: 44px;
  align-items: center;
}

@media (max-width: 980px) {
  .landing-hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

.landing-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(249, 115, 22, 0.14);
  border: 1px solid rgba(249, 115, 22, 0.35);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.landing-title {
  font-size: clamp(2rem, 3.3vw, 2.9rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.landing-subtitle {
  font-size: 0.96rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 26px;
}

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

@media (max-width: 640px) {
  .landing-features-grid {
    grid-template-columns: 1fr;
  }
}

.landing-feature-card {
  background: rgba(22, 27, 40, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.landing-feature-icon {
  font-size: 1.35rem;
  background: rgba(249, 115, 22, 0.12);
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.landing-feature-card h3 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.landing-feature-card p {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

/* BUTTONS & INPUTS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ea580c);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  transform: translateY(-1px);
}

.btn-volt {
  background: rgba(163, 230, 53, 0.14);
  border-color: rgba(163, 230, 53, 0.35);
  color: var(--volt);
}

.btn-volt:hover {
  background: rgba(163, 230, 53, 0.24);
}

.btn-danger {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.1);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 0.74rem;
}

.btn-icon {
  padding: 4px 7px;
}

input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 0.8rem;
  font-family: inherit;
  transition: border-color 0.15s ease;
  min-width: 0;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* VIEWS */
.view-section {
  display: none;
  flex: 1;
  padding: 14px 16px;
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
}

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

/* BUILDER 3-COLUMN LAYOUT (EDIT MODE) & 2-COLUMN FOCUS LAYOUT (LOCKED MODE) */
.builder-grid {
  display: grid;
  grid-template-columns: 270px minmax(360px, 1.05fr) minmax(390px, 0.95fr);
  gap: 14px;
  align-items: start;
  width: 100%;
  transition: grid-template-columns 0.25s ease, gap 0.25s ease;
}

/* MODE FOCUS VERROUILLÉ : Masque le catalogue à gauche et alloue tout l'espace à la séance et l'analyse */
.builder-grid.locked-focus-mode {
  grid-template-columns: minmax(480px, 1.18fr) minmax(420px, 0.82fr);
  gap: 20px;
}

.builder-grid.locked-focus-mode .catalog-panel {
  display: none !important;
}

.builder-grid.locked-focus-mode .edit-only-control,
.builder-grid.locked-focus-mode .opt-fields-bar,
.builder-grid.locked-focus-mode .col-actions,
.builder-grid.locked-focus-mode .empty-in-focus {
  display: none !important;
}

.builder-grid.locked-focus-mode .program-meta-bar input,
.builder-grid.locked-focus-mode .program-meta-bar select,
.builder-grid.locked-focus-mode .day-header-card input,
.builder-grid.locked-focus-mode .sets-table input,
.builder-grid.locked-focus-mode .sets-table select,
.builder-grid.locked-focus-mode .exercise-notes-input {
  pointer-events: none;
  border-color: transparent !important;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  font-weight: 700;
}

.builder-grid.locked-focus-mode .program-title-input {
  background: transparent !important;
  font-size: 1.2rem;
}

.builder-grid.locked-focus-mode select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 6px;
}

.builder-grid.locked-focus-mode .exercise-notes-input {
  background: rgba(249, 115, 22, 0.07);
  border-left: 3px solid var(--accent) !important;
  border-radius: 0 6px 6px 0;
  padding: 6px 10px;
  color: #fed7aa;
  font-weight: 500;
}

.builder-focus-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  white-space: nowrap;
}

.btn-lock-toggle {
  font-weight: 800 !important;
  padding: 6px 13px !important;
  font-size: 0.78rem !important;
  border-radius: 8px !important;
  transition: all 0.18s ease !important;
}

.btn-lock-toggle.is-editing {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border-color: #34d399 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-lock-toggle.is-editing:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.btn-lock-toggle.is-locked {
  background: linear-gradient(135deg, #f97316, #ea580c) !important;
  border-color: #fb923c !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
}

.btn-lock-toggle.is-locked:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.45);
}

.builder-center {
  min-width: 0;
  width: 100%;
}

@media (max-width: 1180px) {
  .builder-grid {
    grid-template-columns: 255px minmax(0, 1fr);
  }
  .builder-grid.locked-focus-mode {
    grid-template-columns: minmax(0, 1fr);
  }
  .analytics-panel {
    grid-column: 1 / -1;
  }
}

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

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 0;
}

.panel-sticky {
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 84px);
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-title {
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ANATOMICAL EXERCISE THUMBNAILS (CATALOG + CENTER EXERCISE CARDS) */
.ex-thumb-box {
  position: relative;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 32%, #242e47 0%, #111624 68%, #090c14 100%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 10px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ex-thumb-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ex-thumb-catalog {
  width: 54px;
  height: 60px;
  border-radius: 9px;
}

.ex-thumb-card {
  width: 78px;
  height: 86px;
  border-radius: 12px;
  border-color: rgba(249, 115, 22, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 6px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.builder-grid.locked-focus-mode .ex-thumb-card {
  width: 86px;
  height: 94px;
}

.exercise-card:hover .ex-thumb-card {
  border-color: rgba(249, 115, 22, 0.6);
  transform: scale(1.03);
}

/* LEFT PANEL: EXERCISE CATALOG */
.catalog-filters {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.catalog-filters input {
  width: 100%;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
}

.catalog-list {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.catalog-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 9px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.catalog-item:hover {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
}

.catalog-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.catalog-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 5px;
}

.catalog-item-name {
  font-weight: 600;
  font-size: 0.77rem;
  color: var(--text-main);
  line-height: 1.28;
}

.catalog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font-size: 0.66rem;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.tag-muscle {
  background: rgba(249, 115, 22, 0.15);
  color: #fdba74;
}

.tag-mechanic {
  background: rgba(56, 189, 248, 0.13);
  color: #7dd3fc;
}

/* CENTER PANEL: COMPACT PROGRAM & WORKOUT BUILDER */
.program-meta-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.program-meta-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.program-title-input {
  font-size: 1.05rem;
  font-weight: 800;
  background: transparent;
  border: 1px dashed transparent;
  padding: 2px 6px;
  margin-left: -6px;
  color: var(--text-main);
  flex: 1;
  min-width: 180px;
}

.program-title-input:hover, .program-title-input:focus {
  border-color: var(--border-subtle);
  background: var(--bg-input);
}

.program-meta-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 1200px) {
  .program-meta-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.meta-field label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* DAYS TABS BAR */
.days-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.day-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.day-pill:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.day-pill.active {
  background: rgba(249, 115, 22, 0.14);
  border-color: var(--accent);
  color: #fff;
}

.day-pill .day-count {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 99px;
}

/* ACTIVE DAY HEADER */
.day-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.day-header-inputs {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}

/* EXERCISE CARDS IN BUILDER */
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exercise-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 11px 13px;
  position: relative;
  transition: border-color 0.2s ease;
  min-width: 0;
}

.exercise-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.exercise-card.superset-linked {
  border-left: 4px solid var(--purple);
  margin-bottom: 4px;
}

.superset-connector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 -6px 16px;
  padding: 2px 10px;
  background: rgba(192, 132, 252, 0.15);
  border: 1px solid rgba(192, 132, 252, 0.4);
  color: #e9d5ff;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  width: fit-content;
  z-index: 2;
  position: relative;
}

.exercise-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.exercise-card-identity {
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 1;
  min-width: 240px;
}

.exercise-card-meta-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.exercise-card-title-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.exercise-index {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(249, 115, 22, 0.18);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.exercise-card-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffffff;
}

.exercise-cues {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--accent);
  padding: 4px 8px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 8px;
}

/* OPTIONAL FIELDS TOGGLE BAR (+ REPOS, + RPE, + TEMPO) */
.opt-fields-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.07);
}

.opt-fields-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

.opt-pills-group {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.opt-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.opt-pill:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.opt-pill.active {
  background: rgba(249, 115, 22, 0.16);
  border-color: var(--accent);
  color: #fdba74;
}

/* SETS TABLE */
.sets-table-wrap {
  width: 100%;
  margin-bottom: 8px;
}

.sets-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.sets-table th {
  text-align: center;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 4px 4px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sets-table th.col-index, .sets-table td.col-index { width: 34px; text-align: center; }
.sets-table th.col-type, .sets-table td.col-type { width: 138px; text-align: left; }
.sets-table th.col-actions, .sets-table td.col-actions { width: 58px; text-align: right; }

.sets-table td {
  padding: 3px 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.sets-table input, .sets-table select {
  width: 100%;
  padding: 4px 5px;
  font-size: 0.76rem;
  text-align: center;
}

.set-type-select {
  font-weight: 700;
  text-align: left !important;
}

.set-warmup { color: #9ca3af; background: rgba(156, 163, 175, 0.12); }
.set-work { color: #38bdf8; background: rgba(56, 189, 248, 0.12); }
.set-top { color: #f97316; background: rgba(249, 115, 22, 0.16); }
.set-backoff { color: #a3e635; background: rgba(163, 230, 53, 0.14); }
.set-drop { color: #ef4444; background: rgba(239, 68, 68, 0.15); }
.set-rp { color: #c084fc; background: rgba(192, 132, 252, 0.15); }

.exercise-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

.exercise-notes-input {
  flex: 1;
  min-width: 150px;
  font-size: 0.74rem;
}

/* RIGHT PANEL: SPACIOUS ANALYTICS & ANATOMY MAP */
.analytics-body {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

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

.kpi-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.kpi-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.kpi-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

.kpi-sub {
  font-size: 0.68rem;
  color: var(--accent);
}

/* SVG BODY HEATMAP (ENLARGED FOR BIOMECHANICAL FOCUS) */
.anatomy-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.anatomy-svgs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  justify-items: center;
}

.body-svg {
  width: 155px;
  height: 270px;
}

.muscle-region {
  fill: #262f45;
  stroke: #0d1018;
  stroke-width: 1.5;
  transition: fill 0.25s ease, filter 0.25s ease;
  cursor: pointer;
}

.muscle-region:hover {
  stroke: #ffffff;
  filter: brightness(1.25);
}

.heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}

/* MUSCLE VOLUME BARS (2-COLUMN GRID WHEN WIDE) */
.volume-bars-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

@media (max-width: 1350px) {
  .volume-bars-list {
    grid-template-columns: 1fr;
  }
}

.volume-bar-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.volume-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
}

.volume-bar-track {
  width: 100%;
  height: 7px;
  background: var(--bg-input);
  border-radius: 99px;
  overflow: hidden;
}

.volume-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* PROGRAMS LIBRARY VIEW */
.programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.program-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.2s ease;
}

.program-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.program-card.active-prog {
  border-color: var(--accent);
  box-shadow: 0 0 25px rgba(249, 115, 22, 0.12);
}

/* LIVE WORKOUT PLAYER VIEW */
.live-container {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.live-selector-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.live-selector-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  flex: 1;
}

.live-session-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timer-banner {
  background: linear-gradient(135deg, #161b28, #1e1b4b);
  border: 1px solid rgba(192, 132, 252, 0.35);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.live-timers-group {
  display: flex;
  align-items: stretch;
  gap: 14px;
  flex-wrap: wrap;
}

.timer-box {
  background: rgba(9, 11, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.timer-box-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 2px;
}

.timer-display {
  font-size: 2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--volt);
  line-height: 1.1;
}

.timer-display.session-clock {
  color: var(--accent);
}

.live-perf-input {
  background: #090b10;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.84rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: center;
}

.live-perf-input::placeholder {
  color: rgba(156, 163, 175, 0.55);
  font-weight: 500;
}

.live-perf-input:focus {
  border-color: var(--volt);
  box-shadow: 0 0 0 2px rgba(163, 230, 53, 0.18);
}

.live-set-row.completed {
  background: rgba(16, 185, 129, 0.11);
}

.live-set-row.completed .live-perf-input {
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--volt);
}

/* HISTORY / SUMMARY CARDS */
.history-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

/* 1RM & TOOLS VIEW */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* PDF PREVIEW SHEET MODAL */
.pdf-modal-box {
  max-width: 980px;
  max-height: 92vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pdf-modal-toolbar {
  padding: 14px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.pdf-sheet-scroll {
  padding: 24px;
  overflow-y: auto;
  background: #0d1017;
  flex: 1;
}

.pdf-sheet-page {
  background: #ffffff;
  color: #111827;
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 36px;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-family: 'Inter', sans-serif;
}

.pdf-sheet-header {
  border-bottom: 3px solid #f97316;
  padding-bottom: 14px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.pdf-day-block {
  margin-bottom: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  page-break-inside: avoid;
}

.pdf-day-title {
  background: #111827;
  color: #ffffff;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.pdf-table th {
  background: #f3f4f6;
  color: #374151;
  text-transform: uppercase;
  font-size: 0.68rem;
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid #d1d5db;
}

.pdf-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  color: #1f2937;
  vertical-align: top;
}

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
}

@media print {
  body * {
    visibility: hidden;
  }
  #pdf-preview-modal, #pdf-sheet-content, #pdf-sheet-content * {
    visibility: visible;
  }
  #pdf-preview-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff;
    padding: 0;
    display: block !important;
  }
  .pdf-modal-toolbar {
    display: none !important;
  }
  .pdf-sheet-scroll {
    padding: 0;
    overflow: visible;
    background: #fff;
  }
  .pdf-sheet-page {
    box-shadow: none;
    max-width: 100%;
    padding: 10px;
  }
}

/* ========================================================================== */
/* WIDGET FLOTTANT : COOLDOWN DE REPOS INTERACTIF & ALARME SONORE             */
/* ========================================================================== */
.cooldown-overlay {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(94vw, 460px);
  pointer-events: auto;
  animation: cooldownSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cooldownSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.cooldown-card {
  background: rgba(15, 19, 30, 0.96);
  backdrop-filter: blur(14px);
  border: 2px solid var(--accent);
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 28px rgba(249, 115, 22, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.25s ease;
}

.cooldown-card.alarm-ringing {
  background: linear-gradient(135deg, rgba(124, 45, 18, 0.97), rgba(153, 27, 27, 0.97));
  border-color: var(--volt);
  box-shadow: 0 20px 55px rgba(249, 115, 22, 0.6), 0 0 40px rgba(163, 230, 53, 0.55);
  animation: alarmPulseCard 0.65s infinite alternate ease-in-out;
}

@keyframes alarmPulseCard {
  from {
    transform: scale(1);
    border-color: var(--volt);
  }
  to {
    transform: scale(1.03);
    border-color: #ffffff;
  }
}

.cooldown-top-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cooldown-ring-wrap {
  position: relative;
  width: 78px;
  height: 78px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cooldown-svg {
  width: 78px;
  height: 78px;
  transform: rotate(-90deg);
}

.cooldown-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 6;
}

.cooldown-ring-fg {
  fill: none;
  stroke: var(--volt);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 213.6;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.35s linear, stroke 0.25s ease;
}

.cooldown-clock-text {
  position: absolute;
  font-size: 1.25rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.cooldown-info-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cooldown-title {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--volt);
}

.cooldown-card.alarm-ringing .cooldown-title {
  color: #ffffff;
  font-size: 0.9rem;
}

.cooldown-subtitle {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cooldown-linear-bar {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}

.cooldown-linear-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--volt));
  border-radius: 99px;
  transition: width 0.35s linear;
}

.cooldown-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========================================================================== */
/* INTERFACE MOBILE DÉDIÉE (@media max-width: 768px)                          */
/* UNIQUEMENT MODE SÉANCE LIVE SUR TÉLÉPHONE — ORDINATEUR 100% INTACT         */
/* ========================================================================== */
@media (max-width: 768px) {
  /* 1. Page de connexion optimisée pour écran de téléphone */
  .landing-screen {
    padding: 16px 12px;
    align-items: flex-start;
  }

  .landing-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .landing-hero-title {
    font-size: 1.45rem;
    margin-bottom: 6px;
  }

  .landing-hero-desc,
  .landing-features-grid {
    display: none !important;
  }

  .landing-auth-card {
    padding: 18px 16px;
  }

  /* 2. Barre du haut Mobile : masquer tous les onglets PC et garder uniquement le Mode Séance Live */
  .topbar {
    height: auto;
    min-height: 54px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-tabs {
    display: none !important;
  }

  .topbar-actions > button[onclick="openCustomExerciseModal()"],
  .topbar-actions > button[onclick="openPdfPreviewModal()"] {
    display: none !important;
  }

  .topbar-actions {
    gap: 6px;
    margin-left: auto;
  }

  #cloud-sync-text {
    font-size: 0.68rem;
  }

  .user-profile-pill {
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  /* Forcer uniquement l'affichage de #view-live sur mobile */
  #view-builder,
  #view-programs,
  #view-history,
  #view-tools {
    display: none !important;
  }

  /* 3. Conteneur Mode Séance Live ergonomique sur Mobile */
  .view-section#view-live {
    padding: 10px 10px 135px 10px;
  }

  .live-container {
    gap: 10px;
  }

  .live-selector-bar {
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .live-selector-inputs {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .live-selector-inputs select {
    font-size: 16px !important;
    padding: 10px 12px;
    height: 44px;
  }

  .live-session-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .live-session-controls #btn-start-session {
    grid-column: 1 / -1;
    justify-content: center;
    padding: 12px;
    font-size: 0.95rem;
  }

  .live-session-controls #btn-finish-session {
    grid-column: 1 / -1;
    justify-content: center;
    padding: 12px;
    font-size: 0.92rem;
  }

  .live-session-controls .btn-danger {
    grid-column: 1 / -1;
    justify-content: center;
    padding: 8px;
  }

  /* Bannière Chrono Séance Mobile */
  .timer-banner {
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #live-workout-title {
    font-size: 1.05rem !important;
  }

  .live-timers-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .timer-box {
    padding: 10px 12px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .timer-box.rest-box {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .timer-box.rest-box > div:last-child {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px !important;
  }

  .timer-box.rest-box button {
    justify-content: center;
    padding: 8px 4px;
    font-size: 0.78rem;
  }

  .timer-display.session-clock {
    font-size: 1.45rem;
  }

  /* Note globale mobile */
  .live-global-note-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
  }

  .live-global-note-bar input {
    font-size: 16px !important;
    padding: 9px 10px;
  }

  /* 4. Transformation des Tableaux d'Exercices en Cartes Tactiles Mobile */
  #view-live .exercise-card {
    padding: 12px;
    border-radius: 14px;
  }

  #view-live .exercise-card-title {
    font-size: 0.98rem;
  }

  #view-live .sets-table thead {
    display: none;
  }

  #view-live .sets-table,
  #view-live .sets-table tbody {
    display: block;
    width: 100%;
  }

  #view-live .live-set-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
    align-items: end;
  }

  #view-live .live-set-row.completed {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.45);
  }

  #view-live .live-set-row td {
    display: block;
    width: 100% !important;
    padding: 0;
    border: none;
    text-align: left !important;
  }

  /* Ligne 1 de la carte de série : Numéro + Type + Objectif */
  #view-live .live-set-row td.col-index {
    grid-column: 1 / 2;
    font-size: 0.88rem;
    color: var(--accent) !important;
  }

  #view-live .live-set-row td.col-type {
    grid-column: 2 / 4;
    text-align: right !important;
  }

  #view-live .live-set-row td.live-col-target {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.03);
    padding: 5px 8px !important;
    border-radius: 6px;
    font-size: 0.8rem !important;
    margin-bottom: 2px;
  }

  /* Champs de saisie avec label au-dessus sur mobile */
  #view-live .live-set-row td[data-mobile-label]::before {
    content: attr(data-mobile-label);
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 3px;
  }

  #view-live .live-perf-input {
    font-size: 16px !important;
    height: 42px;
    padding: 6px 8px;
    border-radius: 8px;
  }

  /* Bouton Valider Série pleine largeur en bas de la carte */
  #view-live .live-set-row td.live-col-action {
    grid-column: 1 / -1;
    margin-top: 2px;
  }

  #view-live .live-set-row td.live-col-action button {
    height: 44px;
    font-size: 0.9rem;
    font-weight: 800;
    justify-content: center;
    border-radius: 10px;
  }

  #view-live .exercise-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #view-live .exercise-footer button {
    justify-content: center;
    padding: 9px;
  }

  #view-live .exercise-notes-input {
    font-size: 16px !important;
    padding: 9px 10px;
  }

  /* Cooldown flottant sur Mobile */
  .cooldown-overlay {
    bottom: 10px;
    width: calc(100vw - 16px);
  }

  .cooldown-card {
    padding: 12px 14px;
  }

  .cooldown-actions-row button {
    padding: 8px 12px;
    font-size: 0.82rem;
  }
}

