/* upmee — mise en page de l'application (les composants sont dans gd.css). */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
a { color: var(--accent-ink); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Coquille : barre latérale (ordinateur) / barre du bas (téléphone) ---------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidenav-width) minmax(0, 1fr); min-height: 100vh; }
.shell .gd-sidenav { position: sticky; top: 0; height: 100vh; }
.brand-logo { display: block; height: 26px; width: auto; }
.shell .gd-sidenav__foot span { color: var(--ink-muted); }
.shell .gd-sidenav__foot a { color: var(--ink-2); font-weight: 700; text-decoration: none; }
.view { padding: var(--space-8); min-width: 0; max-width: var(--content-max); width: 100%; display: flex; flex-direction: column; gap: var(--space-6); }
.mobile-nav { display: none; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mobile-only { display: none; }
@media (max-width: 899px) {
  .shell { display: block; }
  .shell .gd-sidenav { display: none; }
  .view { padding: var(--space-5) var(--space-4) calc(var(--nav-height) + var(--space-6)); gap: var(--space-4); }
  .mobile-nav { display: grid; grid-template-columns: repeat(6, 1fr); }
  .mobile-nav a { font-size: 10px; }
  .mobile-nav .gd-nav-ind { width: 44px; }
  .gd-pagehead__title { font-size: 32px; line-height: 36px; }
  .mobile-only { display: inline-grid; }
  .gd-pagehead { position: relative; padding-right: 52px; }
  .gd-pagehead > .page-actions { width: calc(100% + 52px); margin-right: -52px; }
  .page-actions .gd-btn { flex: 1 1 auto; padding: 0 12px; font-size: 14px; }
  .page-actions > .gd-iconbtn.mobile-only { position: absolute; top: 0; right: 0; }
}

/* ---- Grille de contenu ---------------------------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-6); align-items: start; }
.col { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s12 { grid-column: span 12; }
@media (max-width: 1199px) { .s3, .s4, .s5 { grid-column: span 6; } .s7, .s8 { grid-column: span 12; } }
@media (max-width: 899px) { .grid { gap: var(--space-4); } .grid > * { grid-column: span 12 !important; } .col { gap: var(--space-4); } }
.dials { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
@media (max-width: 599px) { .two { grid-template-columns: 1fr; } }
.ring-row { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; }
.ring-row > .grow { flex: 1 1 200px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.macro-line { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.macro-line b { color: var(--ink); }
.macro-line span:last-child { color: var(--ink-2); }
.facts3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; width: 100%; }
.center { align-items: center; text-align: center; }
.muted { color: var(--ink-muted); }
.small { font-size: 13px; }

/* ---- Barres simples (aperçus de séries) ------------------------------------------------------------------- */
.bars { position: relative; display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid var(--chart-axis); }
.bars__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; height: 100%; }
.bars__seg { width: 100%; max-width: 28px; margin: 0 auto; }
.bars__seg:first-child { border-radius: 6px 6px 0 0; }
.bars__target { position: absolute; left: 0; right: 0; border-top: 1px solid var(--chart-target); }
.bars__target span { position: absolute; right: 0; bottom: 4px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.bars__labels { display: flex; gap: 10px; font-size: 11px; font-weight: 600; color: var(--ink-muted); }
.bars__labels span { flex: 1; text-align: center; }

/* ---- Feuille du bas / fenêtre (ajout d'aliment, exercices) --------------------------------------------------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.overlay .gd-sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; }
@media (min-width: 900px) { .overlay { align-items: center; } .overlay .gd-sheet { border-radius: var(--radius-xl); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.sheet-head h2 { font-family: var(--font-display); font-size: 22px; line-height: 26px; font-weight: 800; }
.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; width: 100%; }
.list__item:hover { background: var(--surface-sunken); }
.list__main { display: flex; flex-direction: column; min-width: 0; }
.list__title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__sub { font-size: 13px; color: var(--ink-muted); }
.list__val { font-weight: 800; white-space: nowrap; }
.section-label { font-size: 13px; font-weight: 800; color: var(--ink-2); margin-top: var(--space-2); }

/* ---- Scanner ---------------------------------------------------------------------------------------------- */
.scanner { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #000; }
.scanner video { flex: 1; width: 100%; object-fit: cover; }
.scanner__frame { position: absolute; left: 50%; top: 40%; width: 260px; height: 150px; transform: translate(-50%, -50%); border: 3px solid #ffffff; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45); }
.scanner__bar { position: absolute; left: 16px; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; }
.scanner__msg { padding: 10px 14px; border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.6); color: #ffffff; text-align: center; font-weight: 600; }
.scanner .gd-iconbtn { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; }

/* ---- Hypnogramme ------------------------------------------------------------------------------------------- */
.hypno { position: relative; height: 104px; }
.hypno__label { position: absolute; left: 0; font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.hypno__seg { position: absolute; height: 18px; border-radius: 5px; }

/* ---- Divers ------------------------------------------------------------------------------------------------- */
.route { width: 100%; height: 280px; display: block; border-radius: 20px; background: var(--run-soft); }
.route .casing { fill: none; stroke: #ffffff; stroke-width: 10; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.route .line { fill: none; stroke: var(--zone-3); stroke-width: 4; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.route .start { fill: var(--forme); stroke: #ffffff; stroke-width: 3; vector-effect: non-scaling-stroke; }
.wip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--radius-pill); background: var(--warning-soft); font-size: 13px; font-weight: 800; letter-spacing: 0.04em; }
.gd-composer input:disabled, .gd-composer button:disabled { cursor: not-allowed; opacity: 0.55; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.loading { opacity: 0.6; transition: opacity 0.2s; }
.empty-line { padding: 10px 0 4px; color: var(--ink-2); }
.timer { font-variant-numeric: tabular-nums; }
.gd-sets input { min-width: 0; }
@media (max-width: 599px) { .gd-sets { grid-template-columns: 22px minmax(0, 0.9fr) 64px 52px 44px; gap: 6px; } }

/* ---- Connexion ------------------------------------------------------------------------------------------------ */

/* ---- Texte ---------------------------------------------------------------------------------------------------- */
.screen-title { font-family: var(--font-display); font-size: 32px; line-height: 36px; font-weight: 800; letter-spacing: -0.02em; margin: var(--space-4) 0 var(--space-5); }
.card-title { font-family: var(--font-display); font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }
.caption { font-size: 13px; line-height: 18px; }
.code { font-family: var(--font-mono); font-size: 12px; }
.preview-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius-md); background: var(--surface-sunken); }
.ring-mini { flex: none; display: inline-flex; }
.ring-mini text { display: none; }
@media (min-width: 900px) { #gd-toasts { left: auto !important; right: 24px !important; bottom: 24px !important; width: 400px; } }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.check-row input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--strength); }
.rest-slot:empty { display: none; }

/* ---- Champs supplémentaires ------------------------------------------------------------------------------------ */
.field-label { font-size: 13px; line-height: 18px; font-weight: 700; color: var(--ink-2); }
.gd-select, .gd-textarea { width: 100%; box-sizing: border-box; border: 1.5px solid var(--line-control); background: var(--surface); color: var(--ink); font: 600 16px/22px var(--font-sans); }
.gd-select { height: var(--control-md); padding: 0 var(--space-4); border-radius: var(--radius-pill); }
.gd-textarea { min-height: 72px; padding: 10px var(--space-4); border-radius: var(--radius-md); resize: vertical; font-weight: 500; }
.gd-select:focus, .gd-textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
.grow { flex: 1; min-width: 0; }
.coach-line { font-weight: 700; line-height: 22px; }
audio { width: 100%; height: 40px; }

/* ---- Menu « Plus » (téléphone) ----------------------------------------------------------------------------------- */
.more-item { text-decoration: none; color: var(--ink); }
.more-item__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--dom-soft, var(--surface-sunken)); color: var(--dom-ink, var(--ink)); }

/* ---- Coach : messagerie ------------------------------------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 460px; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head .grow { display: flex; flex-direction: column; }
.chat-head__name { font-family: var(--font-display); font-size: 17px; line-height: 22px; font-weight: 800; }
.chat-head__status { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.chat-head__status.is-typing { color: var(--good-ink); font-weight: 700; }
.chat-avatar { position: relative; flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: var(--on-ink); }
.chat-avatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--surface); background: var(--ink-muted); }
.chat-avatar.is-online::after { background: var(--good); }
.chat-alert:empty { display: none; }
.chat-alert { padding: 10px 14px 0; }
.chat__scroll { flex: 1; min-height: 0; display: flex; }
.chat__thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; padding: 12px 16px 16px; }
.chat-day { align-self: center; margin: 14px 0 6px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-muted); }
.chat-msg { max-width: min(80%, 560px); margin-top: 8px; padding: 9px 14px; border-radius: 20px; font-size: 15px; line-height: 21px; white-space: pre-wrap; overflow-wrap: anywhere; animation: chat-in 0.18s ease-out; }
.chat-msg.is-cont { margin-top: 2px; }
.chat-msg--me { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.chat-msg--me.is-cont { border-top-right-radius: 6px; }
.chat-msg--coach { align-self: flex-start; background: var(--surface-sunken); color: var(--ink); border-bottom-left-radius: 6px; }
.chat-msg--coach.is-cont { border-top-left-radius: 6px; }
.chat-card { max-width: min(92%, 560px); padding: 14px 16px; white-space: normal; }
.chat-card__label { font-size: 12px; line-height: 16px; font-weight: 800; color: var(--ink-2); }
.chat-card__title { margin: 4px 0 10px; font-weight: 800; }
.chat-card .gd-brief li { grid-template-columns: 10px 1fr; font-size: 14px; line-height: 20px; }
.chat-card__focus { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.side-review { max-width: none; padding: 0; background: none; animation: none; }
.chat-plan { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; white-space: normal; }
.chat-plan .grow { display: flex; flex-direction: column; }
.chat-plan__text { font-size: 14px; color: var(--ink-2); }
.chat-plan__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--run-soft); color: var(--run-ink); }
.chat-system { align-self: center; max-width: 90%; margin: 10px 0 2px; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--critical-soft); font-size: 13px; line-height: 18px; text-align: center; }
.chat-typing { align-self: flex-start; display: inline-flex; gap: 5px; margin-top: 8px; padding: 14px 16px; border-radius: 20px; border-bottom-left-radius: 6px; background: var(--surface-sunken); }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-muted); animation: chat-dot 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes chat-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.chat-suggest { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 10px; scrollbar-width: none; }
.chat-suggest::-webkit-scrollbar { display: none; }
.chat-suggest .gd-chip { flex: none; }
.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-compose textarea { flex: 1; min-width: 0; height: 44px; max-height: 140px; box-sizing: border-box; resize: none; overflow-y: hidden; padding: 11px 16px; border: 1.5px solid transparent; border-radius: 22px; background: var(--surface-sunken); color: var(--ink); font: 500 16px/20px var(--font-sans); }
.chat-compose textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.chat-compose button { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: pointer; }
.chat-compose button:disabled { opacity: 0.35; cursor: default; }
@media (max-width: 899px) {
  .desktop-only { display: none !important; }
  .view.is-chat { padding: 12px 12px calc(var(--nav-height) + 12px); }
  .chat { height: calc(100dvh - var(--nav-height) - 24px); min-height: 0; border-radius: var(--radius-lg); }
  .chat-msg { max-width: 86%; }
}

/* ---- Programme -------------------------------------------------------------------------------------------------- */
.plan-week { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: stretch; }
@media (min-width: 1100px) { .plan-week { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.plan-day { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px; border-radius: var(--radius-lg); background: var(--surface); }
.plan-day.is-today { box-shadow: inset 0 0 0 2px var(--run); }
.plan-day.is-past { opacity: 0.8; }
.plan-day__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.plan-day__name { font-family: var(--font-display); font-size: 16px; font-weight: 800; }
.plan-day__date { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.plan-day .gd-badge { height: 22px; padding: 0 8px; font-size: 11px; }
.plan-session { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--dom-soft); border-left: 4px solid var(--dom); }
.plan-session__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.plan-session__top .gd-badge { height: 22px; padding: 0 8px; font-size: 11px; background: var(--surface); }
.plan-session__kind { font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dom-ink); }
.plan-session__title { font-size: 15px; line-height: 20px; font-weight: 800; }
.plan-session__facts { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.plan-session__target { font-size: 13px; font-weight: 700; color: var(--dom-ink); }
.plan-session__details { font-size: 13px; line-height: 18px; color: var(--ink-2); }
.plan-ex { display: grid; gap: 2px; margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; line-height: 18px; }
.plan-ex li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; }
.plan-ex__sets { flex: none; font-weight: 700; color: var(--ink-2); }
.plan-rest { padding: 8px 12px; border-radius: var(--radius-md); background: var(--surface-sunken); font-size: 13px; font-weight: 700; color: var(--ink-2); }
.plan-extra { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--good-ink); }
.plan-extra .gd-icon { width: 16px; height: 16px; }
.plan-empty { color: var(--ink-muted); font-size: 13px; }
.plan-settings summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
.plan-settings summary::-webkit-details-marker { display: none; }
.plan-settings[open] summary { margin-bottom: var(--space-4); }
@media (max-width: 599px) { .plan-week { grid-template-columns: 1fr; } }

/* ---- Podcasts ---------------------------------------------------------------------------------------------------- */
.episode__summary { color: var(--ink-2); line-height: 22px; }
.episode__review { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.episode__review .gd-btn { justify-self: start; }
.stars { display: flex; gap: 2px; }
.stars button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--line-control); cursor: pointer; }
.stars button:hover { background: var(--surface-sunken); }
.stars button.is-on { color: var(--nutrition); }
.stars button.is-on .gd-icon { fill: currentColor; }
.stars .gd-icon { width: 26px; height: 26px; }
.chip-x { display: inline-flex; align-items: center; gap: 6px; }
.chip-x .gd-icon { width: 14px; height: 14px; color: var(--ink-muted); }
.voices summary { margin-top: var(--space-3); font-weight: 700; cursor: pointer; }
.voices[open] summary { margin-bottom: var(--space-3); }
.plan-session__main { font-size: 14px; line-height: 19px; font-weight: 700; color: var(--ink); }
.plan-session__more summary { font-size: 12px; font-weight: 800; color: var(--dom-ink); cursor: pointer; margin-top: 4px; }
.plan-session__more[open] summary { margin-bottom: 4px; }
.plan-ex li > span:first-child { font-weight: 600; }

/* ---- Programme : cartes compactes + détail ---------------------------------------------------------------------- */
.plan-chip { display: flex; flex-direction: column; gap: 4px; width: 100%; box-sizing: border-box; padding: 10px 12px; border: 0; border-left: 4px solid var(--dom);
  border-radius: var(--radius-md); background: var(--dom-soft); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: box-shadow 0.15s; }
.plan-chip:hover { box-shadow: inset 0 0 0 1.5px var(--dom); }
.plan-chip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.plan-chip.is-missed { opacity: 0.75; }
.plan-chip__top { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 20px; }
.plan-chip__kind { font-size: 11px; line-height: 14px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dom-ink); }
.plan-chip__title { font-size: 14px; line-height: 18px; font-weight: 800; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plan-chip__meta { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plan-status { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; }
.plan-status .gd-icon { width: 13px; height: 13px; stroke-width: 3; }
.plan-status--done { background: var(--good); color: #ffffff; }
.plan-status--missed { background: var(--critical-soft); color: var(--critical); }
.plan-day { gap: 8px; }
.plan-day__head { min-height: 24px; }
.session-detail { display: flex; flex-direction: column; gap: 10px; }
.session-detail__facts { font-weight: 700; color: var(--ink-2); }
.session-detail__main { font-size: 16px; line-height: 23px; font-weight: 700; padding: 12px 14px; border-radius: var(--radius-md); background: var(--dom-soft); border-left: 4px solid var(--dom); }
.session-detail__target { font-size: 14px; font-weight: 700; color: var(--dom-ink); }
.session-detail__notes { font-size: 14px; line-height: 20px; color: var(--ink-2); }
.ex-list { display: flex; flex-direction: column; }
.ex-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ex-row:last-child { border-bottom: 0; }
.ex-row__name { font-weight: 700; }
.ex-row__sets { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.ex-row__load { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); }
@media (max-width: 599px) {
  .plan-week { grid-template-columns: 1fr; }
  .plan-day { display: grid; grid-template-columns: 76px 1fr; align-items: start; column-gap: 10px; }
  .plan-day__head { flex-direction: column; gap: 0; }
  .plan-day > :not(.plan-day__head) { grid-column: 2; }
  .plan-day__head .gd-badge { display: none; }
}
