/* =========================================================================
   Asgard Fit — interface
   Charte Asgard v1.0 « Voûte » · liquid glass · sombre par défaut
   Reprise stricte des tokens de la vitrine (asgard-web/site/styles.css) :
   mêmes couleurs, mêmes rayons, mêmes typographies. Seuls s'ajoutent ici les
   tokens propres à une application (rail de navigation, anneaux de macros).
   ========================================================================= */

/* ----- Tokens : mode sombre (principal) ----- */
:root {
  --bg: #0A0C11;
  --surface: #12151C;
  --border: #262B36;
  --text: #E9ECF3;
  --text-2: #98A0B3;
  --text-3: #5A6273;
  --blue: #4C8CFF;
  --violet: #9B8CFF;
  --green: #3E8E5A;
  --on-blue: #08101F;

  --glass-bg: rgba(18, 21, 28, 0.55);
  --glass-strong: rgba(16, 19, 26, 0.82);
  --glass-border: rgba(233, 236, 243, 0.10);
  --glass-rim: rgba(255, 255, 255, 0.14);
  --glass-sheen: rgba(255, 255, 255, 0.055);
  --shadow: 0 24px 60px -26px rgba(0, 0, 0, 0.7);

  --halo-blue: rgba(76, 140, 255, 0.22);
  --halo-violet: rgba(155, 140, 255, 0.18);

  --radius-card: 18px;
  --radius-el: 11px;
  --maxw: 1240px;
  --font-title: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* Macros — une couleur par macronutriment, stable dans toute l'app */
  --m-prot: #4C8CFF;
  --m-gluc: #9B8CFF;
  --m-lip: #E0A458;
  --m-warn: #E06C5A;
  --track: rgba(233, 236, 243, 0.09);
  --rail-w: 244px;
}

/* ----- Tokens : mode clair (secondaire) ----- */
:root[data-theme="light"] {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --border: #E4E7ED;
  --text: #10131A;
  --text-2: #576070;
  --text-3: #8A93A3;
  --blue: #2563EB;
  --violet: #6D5CE0;
  --green: #2E9E5B;
  --on-blue: #F4F8FF;

  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(16, 19, 26, 0.10);
  --glass-rim: rgba(255, 255, 255, 0.85);
  --glass-sheen: rgba(255, 255, 255, 0.5);
  --shadow: 0 22px 50px -28px rgba(16, 19, 26, 0.3);

  --halo-blue: rgba(37, 99, 235, 0.12);
  --halo-violet: rgba(109, 92, 224, 0.10);

  --m-prot: #2563EB;
  --m-gluc: #6D5CE0;
  --m-lip: #C07A20;
  --m-warn: #C4432C;
  --track: rgba(16, 19, 26, 0.08);
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--blue); color: var(--on-blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
img, svg { max-width: 100%; }
pre { overflow-x: auto; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ----- Halos d'ambiance ----- */
.ambient {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 55% at 12% 0%, var(--halo-blue), transparent 60%),
    radial-gradient(55% 50% at 95% 15%, var(--halo-violet), transparent 62%),
    radial-gradient(50% 45% at 65% 100%, var(--halo-blue), transparent 65%);
}

/* ----- Surface vitrée ----- */
.glass {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
  backdrop-filter: blur(22px) saturate(145%);
  box-shadow: inset 0 1px 0 var(--glass-rim), var(--shadow);
}
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(133deg, var(--glass-sheen) 0%, transparent 34%);
}
@supports not (backdrop-filter: blur(2px)) {
  .glass { background: var(--surface); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* =========================================================================
   Ossature : rail + contenu
   ========================================================================= */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

.rail {
  position: sticky; top: 0; align-self: start;
  height: 100vh; display: flex; flex-direction: column; gap: 1.1rem;
  padding: 1.1rem .85rem;
  border-right: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem .1rem; }
.brand-mark { width: 30px; height: 30px; color: var(--blue); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--font-title); font-weight: 600; font-size: 1.14rem; }
.brand-sub { font-family: var(--font-mono); font-size: .55rem; letter-spacing: .40em; color: var(--text-2); margin-top: 3px; }

.rail-nav { display: flex; flex-direction: column; gap: .15rem; }
.rail-nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .7rem; border-radius: var(--radius-el);
  color: var(--text-2); font-weight: 500; font-size: .94rem;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.rail-nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.rail-nav a:hover { color: var(--text); background: var(--track); }
.rail-nav a.is-active {
  color: var(--text); background: color-mix(in srgb, var(--blue) 14%, transparent);
  border-color: color-mix(in srgb, var(--blue) 34%, transparent);
}
.rail-nav a.is-active svg { color: var(--blue); opacity: 1; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: .55rem; }
.rail-stat {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: .72rem; color: var(--text-3);
  padding: 0 .7rem;
}
.rail-stat b { color: var(--text-2); font-weight: 500; }

.zone { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.6rem;
  border-bottom: 1px solid var(--glass-border);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.topbar h1 { font-size: 1.3rem; }
.topbar-sub { font-family: var(--font-mono); font-size: .74rem; color: var(--text-3); letter-spacing: .04em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .55rem; }
.vue { padding: 1.6rem; max-width: var(--maxw); width: 100%; }

/* =========================================================================
   Composants
   ========================================================================= */
.btn {
  --h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  height: var(--h); padding: 0 1.05rem;
  border-radius: var(--radius-el);
  font-weight: 600; font-size: .92rem;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .14s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-sm { --h: 33px; padding: 0 .8rem; font-size: .85rem; }
.btn-primary { background: var(--blue); color: var(--on-blue); box-shadow: 0 10px 26px -12px var(--blue); }
.btn-primary:not(:disabled):hover { box-shadow: 0 16px 32px -14px var(--blue); }
.btn-ghost { background: var(--glass-bg); color: var(--text); border-color: var(--glass-border); }
.btn-ghost:not(:disabled):hover { border-color: color-mix(in srgb, var(--blue) 50%, transparent); }
.btn-danger { background: transparent; color: var(--m-warn); border-color: color-mix(in srgb, var(--m-warn) 40%, transparent); }
.btn-danger:not(:disabled):hover { background: color-mix(in srgb, var(--m-warn) 12%, transparent); }
.btn-icone { width: 36px; height: 36px; padding: 0; border-radius: 10px; background: transparent; border-color: var(--glass-border); color: var(--text-2); }
.btn-icone:hover { color: var(--text); background: var(--track); }

.chip {
  display: inline-flex; align-items: center; gap: .35em;
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .02em;
  color: var(--text-2); padding: .28em .62em; border-radius: 999px;
  border: 1px solid var(--glass-border); background: var(--glass-bg);
}
.chip svg { width: 14px; height: 14px; flex: none; }
.chip-ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.chip-warn { color: var(--m-warn); border-color: color-mix(in srgb, var(--m-warn) 45%, transparent); }
.chip-info { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, transparent); }

.eyebrow {
  font-family: var(--font-mono); font-size: .7rem; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase; color: var(--blue); margin: 0 0 .6rem;
}

/* Grille de cartes */
.grille { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grille-2 { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.carte { padding: 1.4rem 1.55rem; }
.carte-titre { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }

/* Empilement vertical de blocs : gap entre chaque enfant direct */
.pile { display: flex; flex-direction: column; gap: 1.5rem; }
.carte-titre h2, .carte-titre h3 { font-size: 1.02rem; }
.carte-titre .btn { margin-left: auto; }

/* Anneau de progression (calories) */
.anneau { display: grid; place-items: center; position: relative; }
.anneau svg { transform: rotate(-90deg); width: 168px; height: 168px; }
.anneau-piste { fill: none; stroke: var(--track); stroke-width: 12; }
.anneau-jauge { fill: none; stroke: var(--blue); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .5s ease, stroke .3s ease; }
.anneau-centre { position: absolute; text-align: center; line-height: 1.15; }
.anneau-val { font-family: var(--font-title); font-size: 2rem; font-weight: 600; letter-spacing: -0.03em; }
.anneau-unite { font-family: var(--font-mono); font-size: .68rem; color: var(--text-3); letter-spacing: .12em; text-transform: uppercase; }
.anneau-sous { font-size: .82rem; color: var(--text-2); margin-top: .3rem; }

/* Barres de macros */
.macros { display: flex; flex-direction: column; gap: .8rem; }
.macro-tete { display: flex; justify-content: space-between; align-items: baseline; font-size: .86rem; margin-bottom: .3rem; }
.macro-tete b { font-weight: 600; }
.macro-tete span { font-family: var(--font-mono); font-size: .78rem; color: var(--text-2); }
.jauge { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.jauge i { display: block; height: 100%; border-radius: 999px; width: 0; transition: width .45s ease; }
.jauge.depasse i { background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(0,0,0,.22) 5px 10px); }

/* Statistiques compactes */
.stats { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.stat { padding: .85rem .95rem; border-radius: var(--radius-el); background: var(--track); }
.stat-val { font-family: var(--font-title); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.stat-lib { font-size: .78rem; color: var(--text-2); }
.stat-note { font-family: var(--font-mono); font-size: .7rem; color: var(--text-3); margin-top: .15rem; }

/* Listes */
.liste { display: flex; flex-direction: column; }
.ligne {
  display: flex; align-items: center; gap: .8rem;
  padding: .68rem .2rem; border-bottom: 1px solid var(--glass-border);
}
.ligne:last-child { border-bottom: 0; }
.ligne-corps { min-width: 0; flex: 1; }
.ligne-titre { font-weight: 500; font-size: .94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-detail { font-size: .8rem; color: var(--text-2); }
.ligne-val { font-family: var(--font-mono); font-size: .84rem; color: var(--text-2); text-align: right; flex: none; }
.ligne-actions { display: flex; gap: .3rem; flex: none; }

.vide { text-align: center; padding: 2rem 1rem; color: var(--text-3); font-size: .9rem; }
.vide svg { width: 32px; height: 32px; opacity: .35; margin-bottom: .6rem; }

/* Formulaires */
.champ { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.champ > label { font-size: .84rem; color: var(--text-2); font-weight: 500; }
.champ .aide { font-size: .76rem; color: var(--text-3); }
input[type="text"], input[type="number"], input[type="date"], input[type="password"], select, textarea {
  width: 100%; padding: .58rem .75rem;
  background: var(--track); color: var(--text);
  border: 1px solid var(--glass-border); border-radius: var(--radius-el);
  transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--blue) 55%, transparent); outline: none; }
textarea { resize: vertical; min-height: 78px; }
.champs-ligne { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Segments (choix exclusif) */
.segments { display: flex; flex-wrap: wrap; gap: .4rem; }
.segments button {
  padding: .5rem .85rem; border-radius: var(--radius-el);
  background: var(--track); border: 1px solid transparent; color: var(--text-2);
  cursor: pointer; font-size: .88rem; font-weight: 500; transition: all .15s ease;
}
.segments button:hover { color: var(--text); }
.segments button.is-active {
  background: color-mix(in srgb, var(--blue) 16%, transparent);
  border-color: color-mix(in srgb, var(--blue) 40%, transparent); color: var(--text);
}
.segments.cartes button { flex-direction: column; align-items: flex-start; display: flex; gap: .15rem; text-align: left; flex: 1 1 180px; }
.segments.cartes button small { color: var(--text-3); font-weight: 400; font-size: .76rem; }

/* Onglets */
.onglets { display: flex; gap: .3rem; border-bottom: 1px solid var(--glass-border); margin-bottom: 1.2rem; }
.onglets button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: .6rem .9rem; color: var(--text-2); cursor: pointer; font-weight: 500; font-size: .93rem;
}
.onglets button.is-active { color: var(--text); border-bottom-color: var(--blue); }

/* Semaine (7 jours) */
.semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.jour {
  padding: .7rem .55rem; border-radius: var(--radius-el);
  background: var(--track); text-align: center; cursor: pointer;
  border: 1px solid transparent; transition: border-color .15s ease;
}
.jour:hover { border-color: var(--glass-border); }
.jour.is-active { border-color: color-mix(in srgb, var(--blue) 45%, transparent); background: color-mix(in srgb, var(--blue) 12%, transparent); }
.jour.futur { opacity: .55; }
.jour-nom { font-family: var(--font-mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); }
.jour-num { font-family: var(--font-title); font-size: 1.15rem; font-weight: 600; }
.jour-kcal { font-family: var(--font-mono); font-size: .7rem; color: var(--text-2); }
.jour-barre { height: 3px; border-radius: 2px; background: var(--track); margin-top: .35rem; overflow: hidden; }
.jour-barre i { display: block; height: 100%; background: var(--blue); width: 0; }
.jour-repos { opacity: .65; background: color-mix(in srgb, var(--text-3) 10%, var(--track)); }
.jour-kcal-repos { color: var(--text-3); font-style: italic; }

/* Courbe (SVG) */
.courbe { width: 100%; height: 190px; display: block; overflow: visible; }
.courbe .grille-h { stroke: var(--track); stroke-width: 1; }
.courbe .trace { fill: none; stroke: var(--blue); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.courbe .tendance { fill: none; stroke: var(--violet); stroke-width: 1.6; stroke-dasharray: 5 4; }
.courbe .aire { fill: url(#degradeCourbe); opacity: .28; }
.courbe .pt { fill: var(--blue); }
.courbe .lib { fill: var(--text-3); font-family: var(--font-mono); font-size: 10px; }

/* Repas / plan */
.repas-carte { padding: .9rem 1rem; border-radius: var(--radius-el); background: var(--track); margin-bottom: .6rem; }
.repas-tete { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .35rem; }
.repas-slot { font-family: var(--font-mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: var(--blue); }
.repas-nom { font-weight: 600; font-size: .96rem; }
.repas-macros { font-family: var(--font-mono); font-size: .76rem; color: var(--text-2); margin-left: auto; }
.repas-ing { font-size: .82rem; color: var(--text-2); line-height: 1.5; }
.repas-etapes { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .82rem; color: var(--text-2); }
.repas-etapes li { margin-bottom: .18rem; }

/* Liste de courses */
.rayon { margin-bottom: 1.3rem; }
.rayon h3 { font-size: .92rem; margin-bottom: .5rem; color: var(--text-2); font-family: var(--font-body); font-weight: 600; }
.course { display: flex; align-items: center; gap: .7rem; padding: .48rem .1rem; border-bottom: 1px solid var(--glass-border); cursor: pointer; }
.course:last-child { border-bottom: 0; }
.course input { width: 17px; height: 17px; accent-color: var(--blue); flex: none; cursor: pointer; }
.course.coche .course-nom, .course.coche .course-qte { text-decoration: line-through; opacity: .45; }
.course-nom { flex: 1; font-size: .92rem; }
.course-qte { font-family: var(--font-mono); font-size: .8rem; color: var(--text-2); }

/* Modale */
.modale-fond {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 1rem;
  background: rgba(3, 5, 9, .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.modale {
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto;
  padding: 1.4rem 1.5rem;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border); border-radius: var(--radius-card);
  box-shadow: inset 0 1px 0 var(--glass-rim), var(--shadow);
  -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
}
.modale h2 { font-size: 1.15rem; margin-bottom: 1rem; }
.modale-pied { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; }

/* Notifications */
.toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; max-width: 380px; }
.toast {
  padding: .75rem 1rem; border-radius: var(--radius-el);
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: var(--shadow); font-size: .9rem;
  animation: toast-in .22s ease;
}
.toast.err { border-color: color-mix(in srgb, var(--m-warn) 50%, transparent); }
.toast.ok { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Bandeau d'information / alerte */
.bandeau {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .8rem 1rem; border-radius: var(--radius-el);
  background: color-mix(in srgb, var(--blue) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--blue) 28%, transparent);
  font-size: .88rem; margin-bottom: 1rem;
}
.bandeau svg { width: 18px; height: 18px; flex: none; margin-top: .12rem; color: var(--blue); }
.bandeau.warn { background: color-mix(in srgb, var(--m-warn) 10%, transparent); border-color: color-mix(in srgb, var(--m-warn) 30%, transparent); }
.bandeau.warn svg { color: var(--m-warn); }
.bandeau b { display: block; margin-bottom: .1rem; }

/* Agent */
.job { padding: .85rem 1rem; border-radius: var(--radius-el); background: var(--track); margin-bottom: .6rem; }
.job-tete { display: flex; align-items: center; gap: .6rem; }
.job-nom { font-weight: 600; font-size: .93rem; }
.job-date { font-family: var(--font-mono); font-size: .72rem; color: var(--text-3); margin-left: auto; }
.job-corps { margin-top: .6rem; font-size: .87rem; color: var(--text-2); white-space: pre-wrap; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Connexion */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.connexion .glass { padding: 2rem; width: min(400px, 100%); }
.connexion .brand { justify-content: center; margin-bottom: 1.4rem; }

/* Écran de chargement */
.chargement { min-height: 100vh; display: grid; place-items: center; color: var(--text-3); font-family: var(--font-mono); font-size: .85rem; letter-spacing: .1em; }

/* =========================================================================
   Adaptatif — le rail devient une barre d'onglets en bas sur mobile
   ========================================================================= */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: auto; z-index: 30; flex-direction: row; gap: 0;
    padding: .35rem .35rem calc(.35rem + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--glass-border);
  }
  .brand, .rail-foot { display: none; }
  .rail-nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .rail-nav a { flex-direction: column; gap: .18rem; padding: .45rem .2rem; font-size: .64rem; border-radius: 10px; }
  .rail-nav a span { font-family: var(--font-mono); letter-spacing: .02em; }
  .rail-nav a svg { width: 20px; height: 20px; }
  .zone { padding-bottom: 74px; }
  .topbar { padding: .85rem 1rem; }
  .vue { padding: 1.1rem; gap: 1.2rem; }
  .carte { padding: 1.1rem 1.2rem; }
  .semaine { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .jour-nom { font-size: .58rem; }
  .jour-num { font-size: 1rem; }
  .toasts { left: 1rem; right: 1rem; bottom: 80px; max-width: none; }
  /* Topbar : le titre peut se retrouver serré avec les boutons d'action */
  .topbar { flex-wrap: wrap; gap: .5rem; }
  .topbar h1 { font-size: 1.15rem; }
}

/* Petit téléphone (≤ 520px) */
@media (max-width: 520px) {
  .vue { padding: .85rem .75rem; gap: 1rem; }
  .carte { padding: 1rem 1rem; }
  .topbar { padding: .7rem .85rem; }
  .topbar h1 { font-size: 1.05rem; }
  .topbar-actions { gap: .3rem; }
  /* Anneau de macros : plus compact */
  .anneau svg { width: 136px; height: 136px; }
  .anneau-val { font-size: 1.65rem; }
  /* Stats : 2 colonnes minimum */
  .stats { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
  /* Frise de batch : étiquette plus étroite */
  .frise-ligne { grid-template-columns: 68px 1fr; }
  .frise-poste { font-size: .66rem; }
  /* Modale */
  .modale { padding: 1.1rem 1rem; }
  /* Connexion : pas de débordement sur très petit écran */
  .connexion { padding: 1rem .75rem; }
  .connexion .glass { padding: 1.5rem 1.2rem; }
  /* Scrollable horizontalement plutôt que cassé */
  pre, code { overflow-x: auto; max-width: 100%; display: block; }
  .champs-ligne { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Impression : la liste de courses doit sortir proprement sur papier. */
@media print {
  .rail, .topbar, .btn, .onglets { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
  .glass, .glass::before { background: none; border: 0; box-shadow: none; backdrop-filter: none; }
  .course { border-bottom: 1px solid #ddd; }
}

/* Onglets avec icône (Semaine : Plan / Courses) */
.onglets button { display: inline-flex; align-items: center; gap: .45rem; }
.onglets button svg { width: 16px; height: 16px; opacity: .8; }
.onglets button.is-active svg { color: var(--blue); opacity: 1; }

/* =========================================================================
   Supersets — un bloc visuellement solidaire
   ========================================================================= */
.repas-carte.en-superset {
  border-left: 3px solid color-mix(in srgb, var(--violet) 65%, transparent);
  background: color-mix(in srgb, var(--violet) 7%, var(--track));
}
.badge-superset {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 7px;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 600;
  color: var(--violet);
  background: color-mix(in srgb, var(--violet) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--violet) 40%, transparent);
}
.lien-superset { display: flex; justify-content: center; margin: -.35rem 0 .25rem; position: relative; }
.lien-superset::before {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 1px; height: 100%; background: var(--glass-border);
}
.lien-superset .btn { position: relative; z-index: 1; font-size: .78rem; opacity: .65; }
.lien-superset:hover .btn { opacity: 1; }
.lien-superset.actif .btn {
  opacity: 1; color: var(--violet);
  border-color: color-mix(in srgb, var(--violet) 45%, transparent);
  background: color-mix(in srgb, var(--violet) 10%, transparent);
}

/* Bloc de séance affiché en lecture (répertoire, programme) */
.bloc { padding: .8rem .95rem; border-radius: var(--radius-el); background: var(--track); margin-bottom: .55rem; }
.bloc.superset { border-left: 3px solid color-mix(in srgb, var(--violet) 65%, transparent); }
.bloc-tete { display: flex; align-items: center; gap: .55rem; margin-bottom: .45rem; }
.bloc-tete .titre { font-weight: 600; font-size: .9rem; }
.bloc-tete .repos { margin-left: auto; font-family: var(--font-mono); font-size: .74rem; color: var(--text-3); }
.bloc-exo { display: flex; align-items: baseline; gap: .5rem; padding: .22rem 0; font-size: .9rem; }
.bloc-exo .series { font-family: var(--font-mono); font-size: .8rem; color: var(--text-2); margin-left: auto; flex: none; }
.bloc-exo .consigne { display: block; font-size: .78rem; color: var(--text-3); }
.muscles { display: flex; flex-wrap: wrap; gap: .3em; margin: .4rem 0 .6rem; }
.muscles-exo { display: flex; flex-wrap: wrap; gap: .25em; margin: .2em 0 .1em; }

/* =========================================================================
   Coach — conversation
   ========================================================================= */
.fil { display: flex; flex-direction: column; gap: .8rem; margin-bottom: 1rem; }
.bulle { max-width: 78%; padding: .75rem 1rem; border-radius: 14px; font-size: .93rem; line-height: 1.55; }
.bulle p { margin: 0 0 .5rem; }
.bulle p:last-child, .bulle ul:last-child { margin-bottom: 0; }
.bulle ul { margin: .3rem 0 .5rem; padding-left: 1.1rem; }
.bulle.coach {
  align-self: flex-start;
  background: var(--track);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
}
.bulle.moi {
  align-self: flex-end;
  background: color-mix(in srgb, var(--blue) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--blue) 32%, transparent);
  border-bottom-right-radius: 4px;
}
.bulle-meta { font-family: var(--font-mono); font-size: .66rem; color: var(--text-3); margin-bottom: .3rem; letter-spacing: .04em; }
.composeur { display: flex; gap: .6rem; align-items: flex-end; }
.composeur textarea { min-height: 62px; }
.phase { display: flex; gap: .3rem; align-items: center; font-family: var(--font-mono); font-size: .7rem; color: var(--text-3); }
.phase b { color: var(--blue); font-weight: 500; }

/* Objectifs */
.objectif { display: flex; align-items: flex-start; gap: .7rem; padding: .7rem .2rem; border-bottom: 1px solid var(--glass-border); }
.objectif:last-child { border-bottom: 0; }
.objectif input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--green); margin-top: .18rem; flex: none; cursor: pointer; }
.objectif.atteint .objectif-titre { text-decoration: line-through; opacity: .5; }
.objectif-corps { flex: 1; min-width: 0; }
.objectif-titre { font-weight: 500; font-size: .93rem; }
.objectif-detail { font-size: .79rem; color: var(--text-2); }
.objectif-echeance { font-family: var(--font-mono); font-size: .72rem; color: var(--text-3); flex: none; }
.objectif-echeance.proche { color: var(--m-lip); }
.objectif-echeance.depasse { color: var(--m-warn); }

/* =========================================================================
   Batch cooking — frise de déroulé
   ========================================================================= */
.frise { display: flex; flex-direction: column; gap: .35rem; margin: .8rem 0 1rem; }
.frise-ligne { display: grid; grid-template-columns: 108px 1fr; align-items: center; gap: .6rem; }
.frise-poste { font-family: var(--font-mono); font-size: .72rem; color: var(--text-2); text-align: right; }
.frise-piste { position: relative; height: 30px; background: var(--track); border-radius: 8px; overflow: hidden; }
.frise-bloc {
  position: absolute; top: 3px; bottom: 3px;
  border-radius: 6px; padding: 0 .5rem;
  display: flex; align-items: center;
  font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--on-blue); background: var(--blue);
}
.frise-bloc.four { background: var(--m-lip); }
.frise-bloc.froid { background: var(--green); color: #fff; }
.frise-echelle { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .68rem; color: var(--text-3); padding-left: 114px; }

/* Étiquettes de contenants (impression) */
.etiquettes { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.etiquette {
  padding: .55rem .7rem; border-radius: 9px;
  border: 1px dashed var(--glass-border); font-size: .82rem;
}
.etiquette b { display: block; font-size: .88rem; }
.etiquette .quand { font-family: var(--font-mono); font-size: .7rem; color: var(--text-3); }
.etiquette.congele { border-color: color-mix(in srgb, var(--blue) 45%, transparent); }

/* =========================================================================
   Réglages
   ========================================================================= */
.diag { display: flex; align-items: center; gap: .55rem; padding: .5rem 0; font-size: .89rem; }
.diag-pastille { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--text-3); }
.diag.ok .diag-pastille { background: var(--green); }
.diag.ko .diag-pastille { background: var(--m-warn); }
.diag code { font-size: .8rem; color: var(--text-2); }
.champ-fige input { opacity: .6; }
