/* Fit — même système que le reste d'oddra.me : papier bleuté, encre
   ardoise, accent sarcelle ; Plex Sans pour le texte, Mono pour les
   chiffres alignés, Serif pour les titres de page. Mobile d'abord. */

/* ── Polices auto-hébergées ─────────────────────────────────────────── */
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url(fonts/IBMPlexSans-400-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url(fonts/IBMPlexSans-400-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url(fonts/IBMPlexSans-500-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url(fonts/IBMPlexSans-500-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url(fonts/IBMPlexSans-600-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url(fonts/IBMPlexSans-600-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url(fonts/IBMPlexMono-400-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(fonts/IBMPlexMono-500-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Serif'; font-weight: 600; font-display: swap; src: url(fonts/IBMPlexSerif-600-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Serif'; font-weight: 600; font-display: swap; src: url(fonts/IBMPlexSerif-600-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }

/* ── Jetons ─────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --paper: #F2F4F6; --surface: #FFFFFF; --surface-2: #E7ECEF;
  --ink: #16222C; --ink-2: #4A5A66; --ink-3: #6B7C85;
  --rule: #D2D9DE; --rule-strong: #B4BFC6;
  --accent: #0B5D6B; --accent-soft: #DBEAED; --on-accent: #FFFFFF;
  --keep: #1F6B4A; --keep-soft: #DCEBE3;
  --drop: #A2402C; --drop-soft: #F3E2DD;
  --hold: #835F14; --hold-soft: #F1E8D4;
  --bar-muted: color-mix(in srgb, var(--accent) 40%, var(--surface));
  --shadow: 0 1px 2px rgb(22 34 44 / .05), 0 4px 16px rgb(22 34 44 / .06);
  --scrim: rgb(15 25 31 / .42);

  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'IBM Plex Serif', Georgia, serif;
  --r: 14px; --r-s: 10px;
  --nav-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0F191F; --surface: #16232B; --surface-2: #1D2E37;
    --ink: #E3EBEF; --ink-2: #A2B3BD; --ink-3: #8394A0;
    --rule: #293C46; --rule-strong: #3A505C;
    --accent: #54B6C6; --accent-soft: #15313A; --on-accent: #0B1A20;
    --keep: #63C293; --keep-soft: #132E23;
    --drop: #E28D75; --drop-soft: #33211B;
    --hold: #D8B45E; --hold-soft: #2D2617;
    --bar-muted: color-mix(in srgb, var(--accent) 38%, var(--surface));
    --shadow: none;
    --scrim: rgb(0 0 0 / .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0F191F; --surface: #16232B; --surface-2: #1D2E37;
  --ink: #E3EBEF; --ink-2: #A2B3BD; --ink-3: #8394A0;
  --rule: #293C46; --rule-strong: #3A505C;
  --accent: #54B6C6; --accent-soft: #15313A; --on-accent: #0B1A20;
  --keep: #63C293; --keep-soft: #132E23;
  --drop: #E28D75; --drop-soft: #33211B;
  --hold: #D8B45E; --hold-soft: #2D2617;
  --bar-muted: color-mix(in srgb, var(--accent) 38%, var(--surface));
  --shadow: none;
  --scrim: rgb(0 0 0 / .6);
}

/* ── Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
body:has(dialog[open]) { overflow: hidden; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font: 600 25px/1.2 var(--serif); letter-spacing: -.01em; }
h2 { font-size: 16px; line-height: 1.3; }
h3 { font-size: 15px; }
p { margin: 8px 0 0; }
small { font-size: 12.5px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.block { display: block; }
.cap::first-letter { text-transform: uppercase; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font: 500 11.5px/1.3 var(--mono); color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; }
.eyebrow.cap { text-transform: none; letter-spacing: .01em; font-size: 12.5px; }

/* ── Structure ──────────────────────────────────────────────────────── */
.app { position: relative; max-width: 640px; margin: 0 auto; min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px); }
.view { padding: 0 16px 8px; }
.view.staging { position: absolute; inset: 0 0 auto 0; visibility: hidden; pointer-events: none; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 0 6px; }
.topbar > div { min-width: 0; }
.section-title { font: 500 12px/1.3 var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 8px; }

.card { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 16px; margin-top: 12px; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.card > h2 + * { margin-top: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head + * { margin-top: 12px; }
.card.error { border-color: var(--drop); background: var(--drop-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.grid2 > .card { margin-top: 0; }

/* ── Tuiles ─────────────────────────────────────────────────────────── */
.tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
a.tile:active { transform: scale(.985); }
.tile-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.tile-value { font: 600 27px/1.15 var(--sans); letter-spacing: -.01em; margin-top: 2px; }
.tile-unit { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 4px; letter-spacing: 0; }
.tile-sub { font-size: 12.5px; color: var(--ink-3); margin-top: auto; padding-top: 4px; }
.tile-trend { font: 500 12px var(--mono); color: var(--ink-2); }
.pips { display: flex; gap: 5px; margin: 4px 0 2px; }
.pips i { width: 18px; height: 6px; border-radius: 3px; background: var(--accent-soft); }
.pips i.on { background: var(--accent); }
.pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font: 500 13px var(--mono); white-space: nowrap; }
.pill.small { min-height: 22px; font-size: 11.5px; padding: 0 8px; }

.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.hero-value { font: 600 48px/1 var(--sans); letter-spacing: -.02em; margin-top: 4px; }
.hero-value .tile-unit { font-size: 18px; }
.goal { text-align: right; }
.goal-value { font: 600 20px/1.2 var(--sans); margin-top: 2px; }

/* ── Jauges ─────────────────────────────────────────────────────────── */
.meter + .meter { margin-top: 14px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.meter-label { font-weight: 500; font-size: 14px; }
.meter-val { font-size: 13.5px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.meter-val b { color: var(--ink); font-size: 15px; font-weight: 600; }
.meter-ok { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; color: var(--keep); font-family: var(--sans); font-size: 12.5px; font-weight: 500; vertical-align: -2px; }
.meter-track { position: relative; height: 10px; border-radius: 5px; background: var(--accent-soft); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 5px; background: var(--accent); transition: width .35s ease; }
.meter.done .meter-fill { background: var(--keep); }
.meter.done .meter-track { background: var(--keep-soft); }
.meter-mark { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--surface); }
.macro-line { margin-top: 12px; }

/* ── Boutons ────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px;
  border-radius: var(--r-s); border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  font: 500 15px/1.2 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; touch-action: manipulation; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.danger { color: var(--drop); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { display: flex; width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: transparent; color: var(--ink-2); cursor: pointer; flex: none; text-decoration: none; touch-action: manipulation; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { width: 36px; height: 36px; }
.icon-btn.disabled { opacity: .3; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions .btn { flex: 1 1 auto; }

.chips { display: flex; gap: 6px; margin-top: 10px; }
.chips.wrap { flex-wrap: wrap; }
.chips.scroll { overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink-2); font-size: 14px; cursor: pointer; white-space: nowrap; flex: none; touch-action: manipulation; }
.chip.small { min-height: 32px; font-size: 13px; padding: 0 11px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.tpl { border-style: dashed; color: var(--ink); }
.chip.tpl small { color: var(--ink-3); }

.seg { display: flex; padding: 3px; border-radius: 11px; background: var(--surface-2); gap: 2px; margin-top: 10px; }
.card-head .seg { margin-top: 0; }
.seg button { flex: 1; min-height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2);
  font-size: 13.5px; font-weight: 500; padding: 0 12px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }

/* ── Formulaires ────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid > .span2, .form-grid > .btn, .form-grid > p { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, fieldset legend { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field small { color: var(--ink-3); }
.field output { font-size: 13.5px; color: var(--ink-2); }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--rule-strong); border-radius: var(--r-s);
  background: var(--surface); color: var(--ink); font: 16px var(--sans); /* 16 px : pas de zoom sur iOS */
  appearance: none; -webkit-appearance: none;
}
input.num { font-variant-numeric: tabular-nums; }
textarea { padding: 10px 12px; min-height: 64px; resize: vertical; line-height: 1.4; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: .75; }
input[type="date"] { min-width: 0; }
input[type="range"] { padding: 0; min-height: 36px; background: transparent; border: 0; accent-color: var(--accent); appearance: auto; -webkit-appearance: auto; }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; padding: 0; appearance: auto; -webkit-appearance: auto; accent-color: var(--accent); flex: none; }
input:disabled { opacity: .5; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset legend { padding: 0; margin-bottom: 5px; }
.hms { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto; align-items: center; gap: 6px; }
.hms span { color: var(--ink-3); font-size: 13px; }
.hms input { text-align: center; }
.live { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 12px 14px; border-radius: var(--r-s); background: var(--accent-soft); margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.live small { display: block; font-size: 12px; color: var(--ink-2); }
.live b { font: 600 20px/1.2 var(--sans); color: var(--ink); }
.notes { margin-top: 14px; }

/* ── Listes ─────────────────────────────────────────────────────────── */
.plain { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.row:first-child { border-top: 0; }
.row > span:last-child { text-align: right; }
.compact .row { padding: 5px 0; border: 0; font-size: 13.5px; }
.item { width: 100%; text-align: left; cursor: pointer; font: inherit; }
.item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.item-meta { font-size: 13px; color: var(--ink-3); margin: 1px 0 6px; }
.item-head b::first-letter { text-transform: uppercase; }
.item-foot { font-size: 12.5px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--rule); }
.run-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-3); }
.run-stats b { font-weight: 600; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }

.card.list { padding: 4px 0; }
.list-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 11px 16px;
  border: 0; border-top: 1px solid var(--rule); background: none; text-align: left; color: inherit; text-decoration: none; cursor: pointer; }
.list-row:first-child { border-top: 0; }
.list-row small { display: block; color: var(--ink-3); }
.list-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-btn { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; box-shadow: var(--shadow); touch-action: manipulation; }
.quick-btn:active { transform: scale(.98); }
.quick-btn .ico { color: var(--accent); }
.quick-btn b { display: block; font-size: 14px; font-weight: 600; }
.quick-btn small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.3; }
.quick-btn.primary { grid-column: 1 / -1; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.quick-btn.primary .ico, .quick-btn.primary small { color: inherit; opacity: .9; }
.day-card .card-head .ico { color: var(--ink-3); }

.banner { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: var(--r);
  background: var(--hold-soft); color: var(--ink); text-decoration: none; border: 1px solid color-mix(in srgb, var(--hold) 35%, transparent); }
.banner .ico { color: var(--hold); }
.banner > span:nth-child(2) { flex: 1; font-size: 14px; }
.banner-cta { font-weight: 600; color: var(--hold); }

.empty { text-align: center; padding: 26px 16px; border: 1px dashed var(--rule-strong); border-radius: var(--r); color: var(--ink-3); margin-top: 12px; }
.empty p { margin: 0 0 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 14px 0 0; }
.stats div { background: var(--surface-2); border-radius: var(--r-s); padding: 9px 11px; }
.stats dt { font-size: 12px; color: var(--ink-3); }
.stats dd { margin: 2px 0 0; font-weight: 500; font-size: 14.5px; font-variant-numeric: tabular-nums; }

.table-scroll { overflow-x: auto; margin-inline: -16px; padding-inline: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 12px; }
.table th { font: 500 11.5px var(--mono); color: var(--ink-3); text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.table td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table .r { text-align: right; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }

.records { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.record { min-width: 0; }
.record-value { font: 600 22px/1.2 var(--sans); margin: 2px 0; }
.record small { display: block; line-height: 1.35; }

/* ── Nutrition ──────────────────────────────────────────────────────── */
.date-nav { display: flex; align-items: center; gap: 2px; }
.food-list li { display: flex; align-items: center; border-top: 1px solid var(--rule); }
.food-list li:first-child { border-top: 0; }
.food-row { flex: 1; display: flex; justify-content: space-between; gap: 10px; min-height: 44px; padding: 6px 0; border: 0; background: none; text-align: left; cursor: pointer; font-size: 14px; min-width: 0; }
.food-row > span:first-child { min-width: 0; }
.food-row small { color: var(--ink-3); }
.food-row .num { font-size: 12.5px; white-space: nowrap; }
.slot-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.food-title { font-size: 18px; margin-top: 10px; }
.conv-out { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule); }
.conv-main { font: 500 16px var(--sans); color: var(--ink-2); }
.conv-main b { font: 600 36px/1.1 var(--sans); color: var(--ink); letter-spacing: -.02em; }

/* ── Choix dans une liste (exercices, aliments) ─────────────────────── */
.pick-group { margin-top: 16px; }
.pick-group:first-child { margin-top: 4px; }
.pick-group h3 { margin-bottom: 4px; }
.pick { display: flex; flex-direction: column; gap: 1px; width: 100%; min-height: 48px; padding: 9px 0; border: 0; border-bottom: 1px solid var(--rule);
  background: none; text-align: left; cursor: pointer; color: var(--ink); }
.pick b { font-weight: 500; font-size: 15px; }
.pick em { font-style: normal; color: var(--ink-3); font-size: 13px; }
.pick small { color: var(--ink-3); }
.pick.archived { opacity: .55; }
details summary { cursor: pointer; color: var(--accent); font-weight: 500; min-height: 40px; display: flex; align-items: center; }
input[type="search"] { margin-top: 12px; }

/* ── Saisie de séance ───────────────────────────────────────────────── */
body[data-view="seance"] .nav { display: none; }
body[data-view="seance"] .app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.edit-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  margin: 0 -16px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 6px; background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.edit-title { flex: 1; min-width: 0; }
.edit-title h1 { font-size: 20px; }
.edit-title small { display: block; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chrono { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule-strong);
  background: var(--surface); font: 500 15px var(--mono); cursor: pointer; }
.chrono.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.block .block-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.block h3 { font-size: 16px; }
.block-head small { display: block; color: var(--ink-3); margin-top: 1px; }
.block-tools { display: flex; margin: -6px -8px 0 0; }
.last { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; margin-top: 10px; }
.last b { font-weight: 600; font-variant-numeric: tabular-nums; }
.set-row { display: grid; grid-template-columns: 22px 1fr 1.15fr .95fr 36px; align-items: center; gap: 6px; margin-top: 6px; }
.set-row input { text-align: center; padding: 0 6px; min-height: 46px; }
.set-head { margin-top: 12px; font: 500 11px var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.set-head span { text-align: center; }
.set-n { font: 500 13px var(--mono); color: var(--ink-3); text-align: center; }
.block-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.vol { font-size: 12.5px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.vol.up { color: var(--keep); }
.vol.down { color: var(--drop); }
.add-ex { margin-top: 12px; border-style: dashed; }
.edit-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  max-width: 640px; margin: 0 auto; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--rule); }
.edit-foot .btn.primary { flex: none; }
.rest { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rest-label { font-size: 12.5px; color: var(--ink-3); }
.rest .chip { min-height: 38px; padding: 0 11px; font-family: var(--mono); font-size: 13px; }
.rest-run { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--hold-soft); color: var(--ink); cursor: pointer; }
.rest-run b { font: 600 18px var(--mono); }
.rest-done { font-weight: 600; color: var(--keep); animation: pulse 1s ease 2; }
@keyframes pulse { 50% { opacity: .35; } }

/* ── Feuille modale ─────────────────────────────────────────────────── */
dialog.sheet { width: 100%; max-width: 640px; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 18px 18px 0 0; background: var(--surface); color: var(--ink); display: flex; flex-direction: column;
  box-shadow: 0 -8px 40px rgb(0 0 0 / .18); overflow: hidden; }
dialog.sheet:not([open]) { display: none; }
dialog.sheet[open] { animation: rise .22s cubic-bezier(.2, .8, .3, 1); }
dialog.sheet::backdrop { background: var(--scrim); }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--rule); flex: none; }
.sheet-head h2 { font-size: 17px; outline: none; }
.sheet-body { padding: 14px 16px 18px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); flex: none; }
.sheet-foot .btn.primary { min-width: 140px; }
.sheet-foot .btn.danger { margin-right: auto; }
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: 18px; max-height: 86vh; }
}

/* ── Message éphémère ───────────────────────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px;
  background: var(--ink); color: var(--paper); font-size: 14px; box-shadow: 0 8px 28px rgb(0 0 0 / .25); animation: rise .2s ease; }
.toast.error { background: var(--drop); color: #fff; }
.toast button { border: 0; background: none; color: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 6px 0; }
body[data-view="seance"] .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }

/* ── Barre de navigation ────────────────────────────────────────────── */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
.nav ul { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 640px; margin: 0 auto; padding: 0; list-style: none; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--nav-h);
  color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 500; touch-action: manipulation; }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"] .ico { stroke-width: 2.2; }

/* ── Graphiques ─────────────────────────────────────────────────────── */
.chart-box { margin-top: 10px; min-height: 60px; }
.chart { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; outline: none; }
.chart-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.chart-empty { color: var(--ink-3); font-size: 13.5px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--rule-strong); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { font: 10.5px var(--mono); fill: var(--ink-3); }
.chart .target { stroke: var(--keep); stroke-width: 1.25; }
.chart .target-label { font: 500 10.5px var(--sans); fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.chart .line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.chart .dot.active { stroke-width: 2.5; }
.chart .end-label, .chart .bar-label { font: 600 11.5px var(--mono); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.chart .bar-label { font-weight: 500; fill: var(--ink-2); }
.chart .bar { fill: var(--c); transition: opacity .15s; }
.chart .bar.active { opacity: .78; }
.chart .crosshair { stroke: var(--ink-3); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 120px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: 0 6px 20px rgb(0 0 0 / .14); font-size: 12.5px; }
.tip-head { color: var(--ink-3); font-size: 11.5px; margin-bottom: 3px; white-space: nowrap; }
.tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tip-row b { font: 600 14px var(--mono); color: var(--ink); }
.tip-row span { color: var(--ink-3); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; flex: none; }
.key.line { width: 14px; height: 2px; border-radius: 1px; background: var(--c); }
.key.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* ── Grand écran ────────────────────────────────────────────────────── */
@media (min-width: 560px) {
  .quick { grid-template-columns: repeat(3, 1fr); }
  .quick-btn.primary { grid-column: span 3; }
}
@media (max-width: 370px) {
  .records { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 23px; }
  .set-row { grid-template-columns: 18px 1fr 1.1fr .9fr 32px; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .chart .line { stroke: CanvasText; }
  .chart .bar, .chart .dot { fill: CanvasText; }
  .meter-fill { background: Highlight; }
}
