/* Remise à zéro de base */
:root { color-scheme: light; }
body { margin: 0; font-size: 14px; }
[hidden] { display: none !important; }
img { max-width: 100%; }
/* Layout: colonne mobile, bilan collant en haut de l'écran de saisie, navigation en bas. */
:root {
  --bg: #f2f4f1; --surface: #ffffff; --ink: #19231f; --muted: #5d6b65; --line: #dfe4de;
  --accent: #1d6b5f; --accent-ink: #ffffff; --soft: #e3efea; --warn: #d92626; --ok: #2c7a49;
  --m-low-bg: #ffcdcd; --m-low-fg: #9b1111; --m-ok-bg: #cfeed9; --m-ok-fg: #14532d; --m-over-bg: #ffdcb3; --m-over-fg: #7a3d00;
  --m-nul-bg: #e6e8e6; --m-nul-fg: #3a4440; --sport-bg: #ddebf7; --d-orange: #d98a1f; --s1: #1d6b5f; --s2: #2f6fb3; --s3: #8a5fbf; --ok-b: #43a047;
  --f-display: "Bricolage Grotesque", "Segoe UI", sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --surface: #1e1e1f; --ink: #ececec; --muted: #a3a3a8; --line: #313133;
    --accent: #5cc4ad; --accent-ink: #07201a; --soft: #2a2a2d; --warn: #ff6b6b; --ok: #6fcf94;
    --m-low-bg: #5c2222; --m-low-fg: #ffb3b3; --m-ok-bg: #1d4a30; --m-ok-fg: #a6e8c0; --m-over-bg: #5a3a14; --m-over-fg: #ffd199;
    --m-nul-bg: #38383b; --m-nul-fg: #c9c9cc; --sport-bg: #1f3347; --d-orange: #f0a64b; --s1: #5cc4ad; --s2: #6aa8e8; --s3: #b79af0; --ok-b: #7ddc8c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --surface: #1e1e1f; --ink: #ececec; --muted: #a3a3a8; --line: #313133;
  --accent: #5cc4ad; --accent-ink: #07201a; --soft: #2a2a2d; --warn: #ff6b6b; --ok: #6fcf94;
    --m-low-bg: #5c2222; --m-low-fg: #ffb3b3; --m-ok-bg: #1d4a30; --m-ok-fg: #a6e8c0; --m-over-bg: #5a3a14; --m-over-fg: #ffd199;
    --m-nul-bg: #38383b; --m-nul-fg: #c9c9cc; --sport-bg: #1f3347; --d-orange: #f0a64b; --s1: #5cc4ad; --s2: #6aa8e8; --s3: #b79af0; --ok-b: #7ddc8c; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 var(--f-body); padding-block: calc(14px + env(safe-area-inset-top, 0px)) 96px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
main { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ex { font-size: 12px; color: var(--muted); }

/* En-tête et navigation entre les jours */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.top h1 { font-size: 24px; line-height: 1.1; }
.top .date { color: var(--muted); font-size: 14px; text-transform: capitalize; }
.pill { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; background: var(--soft); color: var(--accent); }
.pill.ok { background: var(--ok); color: var(--bg); }
.jn { display: flex; align-items: center; gap: 8px; }
.jn > button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 44px; height: 44px; font-size: 20px; color: var(--accent); }
.jn .mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.jn .mid b { font-family: var(--f-display); font-size: 18px; text-transform: capitalize; text-align: center; }
.jn input[type="date"] { border: 0; background: transparent; color: var(--muted); font-size: 13px; text-align: center; max-width: 100%; }
.ligne-outils { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 13px; }
.chip b { font-weight: 600; }
.alerte { background: var(--soft); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.alerte p { margin: 0; flex: 1 1 200px; font-size: 14px; }
.import { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.import b { font-family: var(--f-display); }

/* Bilan collant */
.bilan { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 6px 14px -10px rgba(0,0,0,.35); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { min-width: 0; }
.stat span { display: block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.stat b { font-family: var(--f-display); font-size: 24px; line-height: 1.15; }
.stat small { font-size: 12px; color: var(--muted); }
.stat.reste b { color: var(--ok); }
.stat.reste.neg b { color: var(--warn); }
.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mc { border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; min-width: 0; }
.mc span { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.mc b { font-size: 18px; font-family: var(--f-display); line-height: 1.2; }
.mc small { font-size: 11.5px; }
.m-low { background: var(--m-low-bg); color: var(--m-low-fg); }
.m-ok { background: var(--m-ok-bg); color: var(--m-ok-fg); }
.m-over { background: var(--m-over-bg); color: var(--m-over-fg); }
.m-nul { background: var(--m-nul-bg); color: var(--m-nul-fg); }
.mchip { display: inline-block; border-radius: 8px; padding: 2px 8px; font-size: 13px; font-weight: 600; }
.pick .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.jt { overflow-x: auto; }
.jt table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.jt th { text-align: right; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 4px 6px; }
.jt td { text-align: right; padding: 5px 6px; border-top: 1px solid var(--surface); font-weight: 600; }
.jt th:first-child, .jt td:first-child { text-align: left; }
.jt td:nth-child(2) { font-weight: 400; }
.jt td.sp { background: var(--sport-bg); color: var(--ink); }
.jt .lien { border: 0; background: transparent; color: var(--accent); font-weight: 600; padding: 0; text-align: left; text-transform: capitalize; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.info { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--accent); background: transparent; color: var(--accent); font: 700 14px/1 var(--f-display); padding: 0; margin-left: auto; }
.car { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.car::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; }
.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; }
.seg2 button { border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg2 button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.chart .g.z { stroke: var(--muted); stroke-width: 1.5; }
.chart .b.okz { fill: var(--ok-b); }
.chart .b.prev.okz { stroke: var(--ok-b); }
.legende i.g { background: var(--ok-b); }
.chart .b.bd-nul { fill: var(--muted); }
.chart .b.bd-ok { fill: var(--ok); }
.chart .b.bd-over { fill: var(--d-orange); }
.chart .b.bd-low { fill: var(--warn); }
.chart .zn { fill-opacity: .16; }
.chart .zn-nul { fill: var(--muted); }
.chart .zn-ok { fill: var(--ok); }
.chart .zn-over { fill: var(--d-orange); }
.chart .zn-low { fill: var(--warn); }
.al { border-radius: 10px; padding: 7px 10px; font-size: 13.5px; font-weight: 600; }
.legende i.d-nul { background: var(--muted); }
.legende i.d-ok { background: var(--ok); }
.legende i.d-over { background: var(--d-orange); }
.legende i.d-low { background: var(--warn); }
.leg { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.leg li { display: flex; gap: 12px; align-items: center; font-size: 14.5px; }
.sw { flex: none; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); }
.sw.dash { background: transparent; border: 1px dashed var(--accent); }
.sw.line { height: 0; border: 0; border-top: 2px dashed var(--ink); border-radius: 0; }
.ih { font-size: 15px; }
.hd h3 { flex: 1; }
.tg { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; padding: 0; }
.tg svg { transition: transform .2s; }
.tg[aria-expanded="false"] svg { transform: rotate(-90deg); }
.sem .macros { margin: 4px 0; }
#lines { display: flex; flex-direction: column; gap: 14px; }
/* Carte de repas : bandeau de titre sur fond distinct, contenu en dessous */
.repas { padding: 0; gap: 0; overflow: hidden; }
.repas-h { align-items: center; gap: 10px; background: var(--soft); padding: 9px 12px 9px 14px; }
.repas-h h3 { flex: 1; color: var(--accent); }
.repas-h .tg { background: var(--surface); }
.plus { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--accent); background: var(--surface); color: var(--accent); font: 600 20px/1 var(--f-body); padding: 0 0 2px; }
.rb { display: flex; flex-direction: column; gap: 6px; padding: 8px 14px 12px; }
.rb > .ligne:first-child { border-top: 0; }
.mvb { border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 0 4px; margin-left: 4px; }
.mv { display: block; font-size: 12px; padding: 3px 6px; border: 1px solid var(--accent); border-radius: 6px; background: var(--bg); color: var(--accent); max-width: 100%; margin-top: 4px; }
.hal { flex: none; vertical-align: -3px; margin-left: 14px; color: var(--accent); }
.seg2.s3 { grid-template-columns: repeat(3, 1fr); }
/* Jauge des apports */
.gcard { gap: 8px; position: relative; }
.info.gi { position: absolute; top: 7px; right: 8px; width: 20px; height: 20px; font-size: 11px; margin: 0; }
.gcard .excess { margin-right: 28px; }
.grow { display: grid; grid-template-columns: minmax(66px, .9fr) minmax(0, 1.9fr) minmax(66px, .9fr); gap: 6px; align-items: center; }
.gside { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.gside > div { display: flex; flex-direction: column; gap: 2px; }
.gside.r > div { align-items: flex-end; }
.gm b { font-size: 16px; color: var(--muted); }
.gside span { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); line-height: 1.2; }
.gside b { font: 700 22px var(--f-display); line-height: 1.1; }
.gside small { font-size: 11px; color: var(--muted); }
.gside.r { text-align: right; align-items: flex-end; gap: 12px; }
.gfoot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.gfoot .al { flex: 1; }
.gcard svg { display: block; width: 100%; max-width: 190px; height: auto; margin: 0 auto; }
html.pc .gcard svg { max-width: 250px; }
#g-needle { transform-origin: 100px 100px; transition: transform .8s cubic-bezier(.3, 1.25, .45, 1); }
.g-v { fill: var(--ink); font: 700 27px var(--f-display); }
.g-k { fill: var(--muted); font: 11px var(--f-body); }
.g-e { fill: var(--muted); font: 10px var(--f-body); }
.gnote { margin: 0; flex: 1; font-size: 13px; color: var(--muted); }
.excess { text-align: center; font: 700 17px var(--f-display); letter-spacing: .07em; padding: 9px 10px; border-radius: 10px; background: var(--warn); color: #fff; }
.excess small { display: block; font: 500 12px var(--f-body); letter-spacing: 0; margin-top: 2px; }
@keyframes fondu { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
.pulse { animation: fondu 2.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } #g-needle { transition: none; } }
.donut svg { display: block; width: 100%; max-width: 220px; height: auto; margin: 4px auto; }
.donut .dn { fill: var(--ink); font: 700 30px var(--f-display); }
.donut .dt { fill: var(--muted); font: 11px var(--f-body); }
.leg.lg li b { margin-left: auto; font-weight: 600; }
/* Beignet du jour dans le résumé du jour */
.dd { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.donut.sm svg { width: 112px; max-width: 112px; margin: 0; }
.donut.sm .dn { font-size: 34px; }
.donut.sm .dt { font-size: 19px; }
.donut.sm.md svg { width: 140px; max-width: 140px; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dpick { flex: none; border: 1px solid var(--accent); background: var(--surface); color: var(--accent); border-radius: 8px; padding: 4px 6px; font: 600 13px var(--f-body); max-width: 150px; }
.dd .leg { flex: 1; min-width: 160px; gap: 6px; }
.dd .leg li { font-size: 13.5px; gap: 8px; }
.dd .sw { width: 14px; height: 14px; }
.pick svg.hal { display: inline-block; width: 16px; height: 16px; margin-left: 10px; vertical-align: -3px; }
.jt .mois-h th { text-align: left; background: var(--soft); color: var(--accent); font: 600 13px var(--f-display); text-transform: capitalize; letter-spacing: 0; padding: 6px 8px; }
.jt td:first-child { white-space: nowrap; }

/* Version web (classe .pc sur <html>, ajoutée par le fichier web) */
html.pc body { padding-block: 84px 40px; }
html.pc main { max-width: 1560px; }
html.pc main.v-produits, html.pc main.v-profil { max-width: 780px; }
html.pc nav { top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); padding-block: 8px; }
html.pc nav div { max-width: 1560px; display: flex; align-items: center; gap: 6px; }
html.pc nav div::before { content: "Journal 3.0"; font: 700 19px var(--f-display); margin-right: 22px; }
html.pc nav button { padding: 9px 18px; font-size: 14.5px; }
html.pc .bilan { position: static; box-shadow: none; }
html.pc .pc-jour { display: grid; grid-template-columns: minmax(340px, 480px) minmax(0, 1fr); gap: 16px; align-items: start; }
html.pc .pc-left { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; }
html.pc .fond { align-items: center; }
html.pc .feuille { border-radius: 18px; max-height: 86%; }
.pc-ctl { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.pc-ctl .seg { flex: none; width: 400px; max-width: 100%; }
.pc-ctl .jn, .pc-ctl .dates { flex: 1; min-width: 280px; }
.pc-ctl > .ex { flex: 1 0 100%; }
.pc-suivi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(0, .9fr); gap: 16px; align-items: start; }
.pc-suivi .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.seg3 { display: flex; gap: 4px; flex-wrap: wrap; }
.seg3 button { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 6px 14px; font-weight: 600; font-size: 13.5px; color: var(--muted); text-transform: capitalize; }
.seg3 button[aria-pressed="true"] { background: var(--soft); color: var(--accent); border-color: var(--accent); }
.mois-t { font: 600 14px var(--f-display); color: var(--accent); text-transform: capitalize; padding: 4px 2px 8px; }
@media (max-width: 1180px) { .pc-suivi { grid-template-columns: 1fr 1fr; } .pc-suivi .col:nth-child(2) { grid-column: 1 / -1; order: 3; } }
@media (max-width: 760px) { .pc-suivi, html.pc .pc-jour { grid-template-columns: 1fr; } html.pc .pc-left { position: static; } }
@media (prefers-reduced-motion: reduce) { .tg svg { transition: none; } }
.detail { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.jauge { height: 6px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.jauge i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.jauge.neg i { background: var(--warn); }

/* Repas */
.repas { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.repas-h { display: flex; justify-content: space-between; align-items: baseline; }
.repas-h h3 { font-size: 17px; }
.repas-h .num { color: var(--muted); font-size: 14px; }
.ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto 68px 30px; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.ligne .nom { min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; }
.ligne .nom small { color: var(--accent); font-size: 12px; }
.qte { display: flex; align-items: center; gap: 4px; }
.qte input { width: 68px; padding: 6px 4px; text-align: center; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.qte button { border: 0; background: var(--soft); color: var(--accent); border-radius: 6px; padding: 6px 7px; font-size: 12px; font-weight: 600; min-width: 26px; }
.qte button.fixe { background: transparent; color: var(--muted); }
.kc { text-align: right; font-size: 14px; white-space: nowrap; }
.kc small { font-size: 10.5px; color: var(--muted); }
.x { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px; border-radius: 6px; }
.vide { margin: 0; color: var(--muted); font-size: 13.5px; }
.add { margin-top: 4px; border: 1px dashed var(--accent); background: transparent; color: var(--accent); border-radius: 10px; padding: 9px; font-weight: 600; }

/* Cartes, sport */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { font-size: 17px; }
.sport { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sport label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sport input { width: 100%; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 16px; text-transform: none; letter-spacing: 0; }

/* Validation */
.valider { border: 0; border-radius: 12px; padding: 14px; font-weight: 600; font-size: 16px; background: var(--accent); color: var(--accent-ink); }
.valider.rouvrir { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.note { text-align: center; color: var(--muted); font-size: 13px; margin: 0; }

/* Navigation basse */
nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; background: var(--surface); border-top: 1px solid var(--line);
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
nav div { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
nav button { border: 0; background: transparent; padding: 10px 2px; border-radius: 10px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
nav button[aria-selected="true"] { background: var(--soft); color: var(--accent); }
/* Téléphone à l'horizontal (mise en page mobile seulement) : le menu passe sur le côté gauche et la page prend toute la hauteur */
@media (orientation: landscape) and (max-height: 520px) {
  html:not(.pc) body { padding-block: calc(10px + env(safe-area-inset-top, 0px)) 16px; padding-left: calc(104px + env(safe-area-inset-left, 0px)); }
  html:not(.pc) main { max-width: 760px; }
  html:not(.pc) nav { top: 0; bottom: 0; right: auto; width: calc(92px + env(safe-area-inset-left, 0px)); border-top: 0; border-right: 1px solid var(--line);
    padding: 8px 8px 8px calc(8px + env(safe-area-inset-left, 0px)); display: flex; }
  html:not(.pc) nav div { max-width: none; margin: 0; width: 100%; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
  html:not(.pc) nav button { padding: 12px 2px; font-size: 12px; }
  html:not(.pc) #toast { bottom: 20px; }
}

/* Suivi */
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 8px 2px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--soft); color: var(--accent); }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dates label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dates input { padding: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 15px; text-transform: none; letter-spacing: 0; min-width: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .g { stroke: var(--line); stroke-width: 1; }
.chart .t { fill: var(--muted); font: 10px var(--f-body); }
.chart .b { fill: var(--accent); }
.chart .b.over { fill: var(--warn); }
.chart .b.prev { fill-opacity: .35; stroke: var(--accent); stroke-dasharray: 3 2; stroke-width: 1; }
.chart .b.prev.over { stroke: var(--warn); }
.chart .selb { fill: var(--soft); }
.chart .obj { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 4 3; }
.chart rect.hit { fill: transparent; cursor: pointer; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--accent); }
.legende i.w { background: var(--warn); }
.legende i.p { background: none; border: 1px dashed var(--accent); }
.legende i.o { background: none; border-top: 2px dashed var(--ink); height: 0; border-radius: 0; vertical-align: 3px; }
.pick { font-size: 14px; background: var(--soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.sem { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.sem:first-of-type { border-top: 0; }
.sem b { font-family: var(--f-display); font-size: 20px; text-align: right; }
.sem .mac { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.sem .lab { font-weight: 600; }
.sem .lab small { display: block; font-weight: 400; color: var(--muted); }
.mois { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* Produits et profil */
.prod { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.prod:first-of-type { border-top: 0; }
.prod .n { font-weight: 600; overflow-wrap: anywhere; }
.prod .ptype { padding: 8px 10px; font-size: 14px; }
.prod .ptools { display: flex; gap: 8px; align-items: center; }
.prod .ptools .ptype { flex: 1; min-width: 0; }
.prod .danger { color: var(--warn); border-color: currentColor; white-space: nowrap; }
.pv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pv label, .champs label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pv input, .champs input, .champs select { width: 100%; padding: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 15px; text-transform: none; letter-spacing: 0; min-width: 0; }
.champs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.champs .large { grid-column: 1 / -1; }
.poids { display: grid; grid-template-columns: 1fr auto auto 30px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.poids:first-of-type { border-top: 0; }
.poids .d { color: var(--muted); }

/* Feuille d'ajout */
.fond { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.feuille { width: 100%; max-width: 560px; max-height: 88%; overflow-y: auto; background: var(--surface); border-radius: 18px 18px 0 0; padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 12px; }
.feuille header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.feuille h2 { font-size: 20px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; }
.tabs button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.champ { width: 100%; padding: 11px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.liste { display: flex; flex-direction: column; max-height: 210px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.liste button { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 10px 12px; display: flex; justify-content: space-between; gap: 10px; }
.liste button:last-child { border-bottom: 0; }
.liste button[aria-pressed="true"] { background: var(--soft); color: var(--accent); font-weight: 600; }
.liste small { color: var(--muted); white-space: nowrap; }
.form { display: flex; flex-direction: column; gap: 10px; }
.rang { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rang input { width: 90px; }
.rang input[type="date"] { width: auto; }
.apercu { font-size: 14px; background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.apercu ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.ok-btn { border: 0; border-radius: 12px; padding: 13px; font-weight: 600; background: var(--accent); color: var(--accent-ink); }
.ok-btn:disabled { opacity: .4; }
.ghost { border: 1px solid var(--line); background: transparent; border-radius: 10px; padding: 7px 12px; }
.ghost.accent { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--soft); border-radius: 6px; padding: 2px 7px; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: 90%; text-align: center; }
@media (prefers-reduced-motion: reduce) { .jauge i { transition: none; } }

/* Enregistrement, connexion et chargement */
.sync { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 25; background: var(--ink); color: var(--bg); padding: 7px 14px; border-radius: 99px; font-size: 13px; max-width: 92%; text-align: center; }
.sync.echec { background: var(--warn); color: #fff; }
.sync button { margin-left: 8px; border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 8px; padding: 2px 8px; }
html.pc .sync { top: 66px; left: auto; right: 20px; transform: none; }
body.attente nav { display: none; }
.connexion { max-width: 420px; margin: 40px auto 0; }
.connexion h1 { font-size: 26px; }
.connexion .ghost { margin-top: 2px; }
.centre { text-align: center; margin-top: 60px; }
/* Calendrier de l'app et boutons de date */
.datebtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--accent); border-radius: 8px; padding: 6px 10px; font: 600 13px var(--f-body); text-transform: none; letter-spacing: 0; }
.datebtn svg { width: 15px; height: 15px; flex: none; }
.jn .mid .datebtn { margin-top: 2px; }
.dates .datebtn { width: 100%; justify-content: flex-start; padding: 9px; font-size: 15px; }
.champs .datebtn { width: 100%; justify-content: flex-start; padding: 8px; font-size: 15px; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.cal-nav select { flex: 1; min-width: 0; text-transform: capitalize; }
.cal-nav .ghost { width: 40px; padding: 8px 0; font-size: 18px; }
.cal-grille { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grille .e { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 2px 0; }
.cal-grille button { position: relative; aspect-ratio: 1 / 1; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: 500 15px var(--f-body); padding: 0; }
.cal-grille button:hover:not(:disabled) { background: var(--soft); }
.cal-grille button.sel { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.cal-grille button.auj:not(.sel) { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-grille button:disabled { opacity: .28; }
.cal-grille button.avec::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--ok-b); }
.cal-grille button.sel.avec::after { background: var(--accent-ink); }
.datebtn.ico { padding: 5px 9px; }

