:root {
  --bg: #0b1020;
  --bg-soft: #131a2e;
  --panel: #18223d;
  --panel-2: #1f2c4d;
  --text: #eaf0ff;
  --muted: #9db0d8;
  --primary: #3b82f6;
  --accent: #8b5cf6;
  --objective: #f97316;
  --danger: #ff6b7a;
  --border: #2a3961;
  --shadow: 0 14px 30px rgba(4, 8, 20, 0.45);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(249, 115, 22, .18), transparent 33%),
    radial-gradient(circle at 100% 0%, rgba(139, 92, 246, .16), transparent 36%),
    radial-gradient(circle at 50% 100%, rgba(59, 130, 246, .18), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  min-height: 100vh;
}

.container { width: min(1200px, 100% - 2rem); margin: 1.5rem auto 6rem; }
h1, h2, h3 { margin: 0 0 .8rem; }
p { margin: 0 0 .8rem; }
.small { color: var(--muted); font-size: .9rem; }

.topbar { position: sticky; top: 0; z-index: 80; backdrop-filter: blur(8px); background: rgba(11, 16, 32, .85); border-bottom: 1px solid var(--border); }
.topbar-inner { width: min(1240px, 100% - 2rem); margin: 0 auto; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; text-decoration: none; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.topbar-actions { display: flex; gap: .7rem; }
.topbar-actions a { color: var(--muted); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; }
.topbar-actions a:hover { background: var(--panel); color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.grid > .card { grid-column: span 6; }
.card {
  background: linear-gradient(160deg, rgba(255,255,255,.03), transparent 55%), var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow);
}
.row { display: flex; gap: .7rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }

label { display: block; margin-bottom: .35rem; font-size: .9rem; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: .62rem .72rem;
  font: inherit;
}
textarea { min-height: 92px; resize: vertical; }
button, a.secondary-btn {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #f97316, #8b5cf6 55%, #3b82f6);
  color: #05122b;
  padding: .62rem .72rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  width: auto;
}
form button { width: 100%; }
button:hover { filter: brightness(1.05); }
.secondary-btn { background: var(--panel-2); color: var(--text); }
.danger-outline-btn { background: transparent; border-color: var(--danger); color: #ff9fad; }

.tags { display: flex; flex-wrap: wrap; gap: .45rem; }
.badge { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; border: 1px solid var(--border); padding: .22rem .55rem; font-size: .78rem; background: #1a2644; color: #cfe0ff; }
.badge-choice { width: auto; }
.badge-choice.active { outline: 2px solid #88b7ff; }

.list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.list li { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: .65rem; }

.table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.table th, .table td { border-bottom: 1px solid var(--border); text-align: left; padding: .65rem; vertical-align: top; }
.table th { background: #1d2a4a; color: #d9e6ff; }

.msg { border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; }
.msg.ok { background: rgba(45, 212, 191, .16); border: 1px solid rgba(45,212,191,.5); }
.msg.error { background: rgba(255, 107, 122, .16); border: 1px solid rgba(255,107,122,.5); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--border); background: rgba(11, 16, 32, .96); backdrop-filter: blur(8px); z-index: 90; }
.nav ul { margin: 0; padding: .35rem .55rem calc(.35rem + env(safe-area-inset-bottom)); list-style: none; display: flex; gap: .45rem; justify-content: space-between; overflow-x: auto; }
.nav a { color: var(--muted); text-decoration: none; border-radius: 10px; padding: .5rem .62rem; font-size: .82rem; display: flex; flex-direction: column; align-items: center; min-width: 74px; gap: .2rem; }
.nav a.active, .nav a:hover { background: var(--panel); color: var(--text); }

.exo-card-btn { text-align: left; background: var(--bg-soft); color: var(--text); }
.exo-card-btn strong { display: block; margin-bottom: .25rem; }
.hidden { display: none !important; }

.modal { display: none; position: fixed; inset: 0; z-index: 120; background: rgba(6, 10, 20, .7); backdrop-filter: blur(5px); padding: 1rem; }
.modal.open { display: block; }
.modal-content {
  width: min(760px, 100%);
  margin: 2vh auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem;
  max-height: 92vh;
  overflow: auto;
}
.modal-content img { width: 100%; border-radius: 12px; border: 1px solid var(--border); margin-bottom: .75rem; }
.rep-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .45rem; }
.rep-grid span { text-align: center; border-radius: 9px; border: 1px solid var(--border); padding: .35rem; background: var(--bg-soft); }

.page-seance .grid > .card:nth-child(1) { grid-column: span 4; }
.page-seance .grid > .card:nth-child(2) { grid-column: span 8; }
.page-exercices .grid > .card:nth-child(1) { grid-column: span 4; }
.page-exercices .grid > .card:nth-child(2) { grid-column: span 8; }



@media (max-width: 720px) {
  .calendar-wrapper .calendar { min-width: 600px; }
  .calendar .muted { display: none; }
  .calendar .day { min-height: 96px; }
  .calendar-fab { bottom: 84px; right: 12px; }
  .container { width: calc(100% - 1rem); margin-top: 1rem; }
  .topbar-inner { width: calc(100% - 1rem); }
  .table { display: block; overflow-x: auto; }
  .modal { padding: .4rem; }
  .modal-content { margin: 0; max-height: 96vh; border-radius: 12px; }
  .rep-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

.tag-chest { background: #4f2730; border-color: #8e4b5d; }
.tag-back { background: #24345f; border-color: #4464a8; }
.tag-legs { background: #1f4b42; border-color: #3c8b7a; }
.tag-arms { background: #554822; border-color: #8e7845; }
.tag-shoulders { background: #4a2f66; border-color: #8862b3; }
.tag-core { background: #5d233d; border-color: #a45072; }
.tag-default { background: #2b344b; border-color: #556489; }

.card.section-health::before,
.card.section-nutrition::before { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.card.section-objective::before { background: linear-gradient(90deg, #fb923c, #f97316); }
.card.section-sport::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  width: auto;
  padding: .52rem .78rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}
.action-btn {
  width: auto;
  padding: .4rem .65rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #233257;
  color: var(--text);
}
.goal-stepper { width: auto; min-width: 34px; padding: .32rem .55rem; border-radius: 8px; text-decoration: none; font-weight: 700; }
.goal-stepper.increment { background: rgba(56, 189, 248, .22); border: 1px solid rgba(56, 189, 248, .45); color: #dff4ff; }
.goal-stepper.decrement { background: rgba(139, 92, 246, .2); border: 1px solid rgba(139, 92, 246, .45); color: #ece2ff; }

.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.calendar-wrapper { overflow-x: auto; padding-bottom: 6px; }
.calendar-wrapper .calendar { min-width: 760px; }
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.calendar .day {
  border: 1px solid #31456e;
  border-radius: 12px;
  min-height: 130px;
  padding: 8px;
  background: #121b33;
  font-size: 12px;
  transition: border-color .2s ease, background .2s ease;
}
.calendar .day.done {
  border-color: #38bdf8;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .6);
  background: rgba(59, 130, 246, .2);
}
.calendar .day.has-session {
  border-color: color-mix(in srgb, var(--session-color, #a78bfa) 70%, #2b364d 30%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--session-color, #a78bfa) 60%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--session-color, #a78bfa) 18%, transparent), rgba(18, 27, 51, .88));
}
.calendar .day.mixed {
  background: linear-gradient(160deg, rgba(56,189,248,.22), rgba(139,92,246,.22) 62%, rgba(18, 27, 51, .9));
  border-color: rgba(154, 126, 251, .8);
}
.calendar .muted { opacity: .35; }
.calendar-large .day,
.calendar-google .day { min-height: 150px; }
.calendar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.calendar-goal { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 5px; margin-top: 4px; overflow: hidden; white-space: nowrap; }
.calendar-goal.emoji-only { font-size: 20px; line-height: 1.1; }
.goal-dot {
  position: relative;
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--goal-color, #3b82f6);
  margin-right: 4px;
}
.goal-dot::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #111827;
}
.goal-dot.is-done::after { background: #38bdf8; }
.calendar-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: 18px;
  bottom: 92px;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  font-size: 28px;
  line-height: 46px;
  padding: 0;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  border: 1px solid rgba(180, 161, 255, .7);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .35);
  z-index: 20;
}


.rating-grid { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; align-items: center; }
.score-ring {
  --progress: 0;
  width: min(220px, 100%);
  aspect-ratio: 1;
  position: relative;
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #243455; stroke-width: 10; }
.ring-value {
  fill: none;
  stroke: url(#ringGradient);
  stroke: #3b82f6;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: calc(314 - (314 * var(--progress) / 100));
  transition: stroke-dashoffset .35s ease;
}
.steps-ring-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .2rem;
}
.steps-ring-content strong { font-size: 1.8rem; }
.text-ok { color: #67e8f9; font-weight: 700; }
.text-ko { color: #fb923c; font-weight: 700; }

.page-profil button,
.page-profil .action-btn {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  color: #041429;
}

@media (max-width: 880px) {
  .rating-grid { grid-template-columns: 1fr; }
}
.fit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.fit-grid article {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 12px;
}

.fit-number {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0;
}

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

.fit-table {
  width: 100%;
  border-collapse: collapse;
}

.fit-table th,
.fit-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align: left;
}

.health-overview {
  margin-bottom: 16px;
}
.health-header {
  align-items: baseline;
}
.health-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}
.steps-ring-card {
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: 14px;
}
.steps-ring {
  --size: 220px;
  width: var(--size);
  height: var(--size);
  margin: 8px auto 0;
  position: relative;
}
.steps-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.steps-ring circle {
  fill: none;
  stroke-width: 10;
}
.steps-ring .ring-bg {
  stroke: rgba(255, 255, 255, .12);
}
.steps-ring .ring-value {
  stroke: #22c55e;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: calc(314 - (314 * var(--progress, 0)) / 100);
  transition: stroke-dashoffset .35s ease;
}
.steps-ring-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.steps-ring-content strong {
  font-size: 1.65rem;
}
.steps-ring-content em {
  margin-top: 4px;
  color: var(--muted);
  font-style: normal;
  font-size: .84rem;
}
.health-goals-form {
  margin-top: 10px;
}
.health-charts {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.trend-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 12px;
}
.sparkline-wrap {
  height: 110px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(15,17,22,.55);
  padding: 8px;
}
.sparkline {
  width: 100%;
  height: 100%;
}
.sparkline polyline {
  fill: none;
  stroke: #60a5fa;
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

@media (max-width: 900px) {
  .health-grid {
    grid-template-columns: 1fr;
  }
  .steps-ring {
    --size: 180px;
  }
}

.dot-chart-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
}
.dot-chart {
  min-width: 620px;
  height: 130px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 8px;
  background: rgba(15, 17, 21, .56);
}
.dot-col {
  width: 40px;
  height: 100%;
  position: relative;
}
.dot-value {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
}
.dot-point {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateX(-50%);
}
.steps-dot {
  background: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, .2);
}
.weight-dot {
  background: #f472b6;
  box-shadow: 0 0 0 4px rgba(244, 114, 182, .2);
}
.dot-date {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--muted);
}
@media (max-width: 980px) {
  .grid {display: block}
}