:root {
  --ink: #f2f2f2; --muted: #999; --line: #333; --soft: #1d1d1d; --paper: #111; --done: #f2f2f2; --warn: #e88;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font: 16px/1.4 system-ui, -apple-system, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 96px); }
h1 { font-size: 1.4rem; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: .8rem; margin: 28px 0 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--warn); font-size: .9rem; }
button, .button { font: inherit; color: inherit; background: var(--soft); border: 0; border-radius: 10px; padding: 12px 14px; min-height: 44px; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
button.primary { background: var(--ink); color: var(--paper); font-weight: 600; }
button.block { display: block; width: 100%; margin-top: 10px; }
button.link { display: block; background: none; padding: 8px 0; min-height: 0; color: var(--muted); text-decoration: underline; }
button.chip { min-width: 48px; padding: 10px; }
button.chip.on { background: var(--ink); color: var(--paper); }
input, select, textarea { font: inherit; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px; width: 100%; min-height: 44px; font-size: 16px; }
textarea { min-height: 88px; }
.row { display: flex; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.item { display: block; width: 100%; text-align: left; background: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 0; }
.item strong { font-weight: 600; }
.banner { background: var(--soft); border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: .9rem; }
.bar { position: sticky; top: 0; z-index: 5; background: var(--paper); margin: 0 -16px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.clock { font-variant-numeric: tabular-nums; font-size: 1.15rem; font-weight: 600; }
.card { border-top: 1px solid var(--line); padding: 16px 0 12px; }
.card h3 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.sets { display: grid; grid-template-columns: 20px 82px 1fr 1fr 62px; gap: 6px; margin-top: 10px; align-items: center; }
.sets.short { grid-template-columns: 20px 82px 1fr 62px; }
.planned { min-height: 44px; padding: 2px 4px; font-size: .78rem; line-height: 1.15; background: none; border: 1px dashed var(--line); color: var(--muted); }
.goal { font-size: .85rem; }
.chart polyline.alt { stroke: var(--muted); stroke-dasharray: 4 3; }
.legend { font-size: .75rem; color: var(--muted); }
.progress-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.progress-row .record { font-weight: 700; }
.mode { font-size: .8rem; color: var(--muted); padding: 4px 6px; min-height: 32px; width: auto; margin-top: 6px; }
.sets .head { font-size: .72rem; color: var(--muted); text-align: center; }
.sets .num { text-align: center; color: var(--muted); font-size: .9rem; }
.sets input, .sets select { text-align: center; padding: 8px 2px; }
.sets button { padding: 0; min-height: 44px; }
.sets button.ok { background: var(--done); color: var(--paper); }
.sets .filled { font-weight: 600; border-color: var(--ink); }
.restbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--ink); color: var(--paper); padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px); }
.restbar .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.restbar button { background: transparent; color: inherit; border: 1px solid currentColor; min-height: 38px; padding: 6px 10px; }
.results { max-height: 280px; overflow: auto; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: .75rem; }
th, td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.chart rect { fill: var(--ink); }
.chart.track { max-height: 240px; }
.bubble { background: var(--soft); border-radius: 10px; padding: 8px 12px; margin: 6px 24px 6px 0; }
.bubble.mine { margin: 6px 0 6px 24px; }
.bubble small { color: var(--muted); display: block; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 10px -16px 4px; padding: 0 16px 6px; }
.tabs button { min-height: 36px; padding: 6px 12px; font-size: .85rem; white-space: nowrap; }
.tabs button.on { background: var(--ink); color: var(--paper); }
.dot { background: var(--ink); color: var(--paper); border-radius: 10px; padding: 0 8px; font-size: .8rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); gap: 6px; margin-top: 6px; }
.fields input { padding: 8px 2px; text-align: center; }
.field small { color: var(--muted); display: block; font-size: .72rem; }
.planrow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.scale { display: flex; gap: 6px; }
.scale button { flex: 1; padding: 10px 0; }
.scale button.on { background: var(--ink); color: var(--paper); }
.question { margin: 18px 0; }
.question label { font-weight: 600; display: block; margin-bottom: 6px; }
textarea.note { min-height: 44px; margin-top: 8px; font-size: 15px; }
.linkish { background: none; padding: 0; min-height: 0; font-weight: 600; font-size: 1.05rem; text-align: left; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 10px; }
.month .wd { text-align: center; font-size: .72rem; color: var(--muted); padding-bottom: 4px; }
.day { padding: 6px 0 4px; min-height: 52px; border-radius: 8px; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.day.today { outline: 1px solid var(--muted); }
.day.on { background: var(--soft); }
.marks { font-size: .55rem; letter-spacing: 1px; color: var(--muted); min-height: 10px; line-height: 1; }
.marks .faite { color: var(--ink); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.fact { background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.fact strong { display: block; font-size: 1.1rem; }
.fact small { color: var(--muted); }
.chart { width: 100%; height: auto; display: block; margin: 6px 0 2px; }
.chart polyline { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.chart circle { fill: var(--ink); }
.chart line { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 10px; }
.ranges { display: flex; gap: 6px; margin-top: 8px; }
.ranges button { min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.ranges button.on { background: var(--ink); color: var(--paper); }
.pre { white-space: pre-wrap; font-size: .85rem; color: var(--muted); }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photos.two { grid-template-columns: repeat(2, 1fr); }
.photos img, .nophoto { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; background: var(--soft); }
.photos select { width: 100%; margin-bottom: 6px; }
.nophoto { display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.button.center { text-align: center; cursor: pointer; }
.hidden { display: none; }
.center { text-align: center; }
.arrow { background: none; font-size: 1.6rem; min-height: 44px; padding: 0 12px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0 4px; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 60px; background: none; }
.wday small { color: var(--muted); font-size: .7rem; }
.wday span { font-weight: 600; }
.wday.today span { text-decoration: underline; text-underline-offset: 3px; }
.wday i { flex: none; display: block; width: 6px; height: 6px; border-radius: 50%; border: 1px solid transparent; }
.wday i.mark-done { background: currentColor; }
.wday i.mark-plan { border-color: currentColor; }
.wday.on { background: var(--ink); color: var(--paper); }
.wday.on small { color: var(--paper); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border-top: 1px solid var(--line); padding: 4px 0 calc(env(safe-area-inset-bottom) + 4px); }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; color: var(--muted); font-size: .7rem; padding: 6px 0; min-height: 50px; }
.tabbar button.on { color: var(--ink); }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#timers { flex-wrap: wrap; }
#timers button { white-space: nowrap; flex: 1 0 auto; }
button.timer { padding: 8px 12px; font-size: 1.1rem; }
.fields label { min-width: 0; }
/* forme du jour et triage coach */
.ready-card { border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: var(--soft); border-left: 4px solid var(--muted); }
.ready-card.vert, .ready.vert { border-color: #3f8f5f; }
.ready-card.orange, .ready.orange { border-color: #c9803a; }
.ready-card.rouge, .ready.rouge { border-color: #b04a4a; }
.ready { font-size: .75rem; border: 1px solid var(--muted); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.coachbar { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.coachbar input { flex: 1; min-height: 40px; padding: 8px 10px; }
.coachbar button { min-height: 40px; padding: 6px 12px; }
.reason { font-size: .85rem; color: var(--ink); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { min-width: 40px; min-height: 40px; padding: 4px; font-weight: 600; }
.stepper input { text-align: center; min-width: 0; padding: 6px 2px; }
.diff { font-size: .85rem; }
.old { color: var(--muted); text-decoration: line-through; }
@media (min-width: 1000px) {
  main.wide { max-width: 1200px; display: grid; grid-template-columns: 340px 1fr; gap: 24px; }
  main.wide > .side { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; }
}
.fields.steppers { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stepper input { min-width: 44px; }
details.help { background: var(--soft); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
details.help summary { cursor: pointer; font-size: .9rem; }
a.item { color: inherit; text-decoration: none; }
.legend-list { display: grid; gap: 4px; margin: 6px 0 10px; font-size: .8rem; color: var(--muted); }
.legend-row { display: flex; gap: 8px; align-items: baseline; }
.legend-row strong { color: var(--ink); font-weight: 600; }
.swatch { flex: none; width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch.dashed { height: 0; border-radius: 0; border-top: 2px dashed; background: none; transform: translateY(-3px); }
.small { font-size: .78rem; display: block; margin-top: 4px; }
a.button.block { display: block; box-sizing: border-box; text-decoration: none; }
.add-photo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.button.primary { background: var(--ink); color: var(--paper); font-weight: 600; }
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; }
.add-photo.two { grid-template-columns: repeat(2, 1fr); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chips .chip { flex: 1; }
.camera { position: fixed; inset: 0; z-index: 50; background: var(--paper); overflow-y: auto; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.camera-top { display: flex; justify-content: space-between; align-items: center; }
.camera-frame { position: relative; margin-top: 8px; }
.camera-video { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #000; border-radius: 10px; }
.camera-video.mirror { transform: scaleX(-1); }
.camera-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 6rem; font-weight: 700; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.7); pointer-events: none; }
select.ghost { color: var(--muted); }
.ghost-text { color: var(--muted); font-weight: 400; }
.verdict { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; }
.verdict.ok { border-color: hsl(120 55% 42%); }
.verdict.warn { border-color: hsl(30 85% 52%); }
.sets.checks { grid-template-columns: 34px 76px 1fr 1fr 62px; }
.sets.checks.short { grid-template-columns: 34px 76px 1fr 62px; }
.item.on { border: 1px solid var(--ink); }
