/*
 * Muscu Log — thème sombre inspiré Basic-Fit.
 * Règles : l'orange = l'action à faire maintenant ; l'émeraude = un progrès (record, rep gagnée, objectif) ;
 * « fait » reste neutre. Texte sombre sur orange (contraste 5,6:1). Cibles tactiles ≥ 48 px, 56+ en séance.
 */
:root {
  --bg: #0a0a0a;
  --surface: #151515;
  --surface-2: #1e1e1e;
  --anthracite: #2a2a2a;
  --line: #2e2e2e;
  --text: #f4f4f5;
  --muted: #b4b4bb;
  --dim: #8a8a93;
  --orange: #ea580c;
  --orange-hi: #fb923c;
  --orange-soft: rgba(234, 88, 12, 0.14);
  --on-orange: #0a0a0a;
  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.14);
  --amber: #fbbf24;
  --red: #ef4444;
  --radius: 16px;
  --bar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:disabled { cursor: default; opacity: 0.5; }
a { color: var(--orange-hi); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 14px; }
.center { text-align: center; }
.green { color: var(--green); }
.orange { color: var(--orange-hi); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.boot { display: grid; place-items: center; min-height: 100dvh; color: var(--muted); padding: 24px; text-align: center; }

/* ---------- Shell ---------- */
.app { max-width: 640px; margin: 0 auto; padding-bottom: 32px; }
body.has-bar .app { padding-bottom: calc(var(--bar-h) + var(--safe-b) + 24px); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: calc(var(--safe-t) + 8px) 16px 0;
  border-bottom: 1px solid var(--line);
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--orange);
  display: grid; place-items: center; font-weight: 900; color: var(--on-orange); font-size: 18px;
}
.brand { flex: 1; min-width: 0; }
.brand b { display: block; font-weight: 900; letter-spacing: 0.06em; font-size: 15px; text-transform: uppercase; }
.brand span { display: block; font-size: 13px; color: var(--muted); }
.icon-btn {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text); font-size: 19px; flex: 0 0 auto;
}
.sync { font-size: 13px; color: var(--orange-hi); background: var(--orange-soft); border-radius: 99px; padding: 4px 10px; white-space: nowrap; }
.tabs { display: flex; gap: 2px; margin: 6px -16px 0; padding: 0 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: 0 0 auto; padding: 12px 11px 13px; font-weight: 700; font-size: 15px;
  color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab.on { color: var(--text); border-bottom-color: var(--orange); }
.tab .dot { position: absolute; top: 9px; right: 1px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
main { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Blocs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2, .section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 800; }
.card h2 { margin-bottom: 12px; }
.section-title { margin: 6px 2px -4px; }
h3.mini { font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
.eyebrow { font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--orange-hi); }
.hero {
  background: linear-gradient(160deg, #1d1d1d 0%, #111 70%);
  border: 1px solid var(--line); border-radius: 20px; padding: 20px 18px; display: flex; flex-direction: column; gap: 12px;
}
.hero h1 { font-size: 28px; font-weight: 900; }
.hero p { margin: 0; }
.reason { color: var(--text); font-weight: 600; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.facts li { font-size: 14px; color: var(--muted); background: var(--anthracite); border-radius: 99px; padding: 4px 10px; }
.facts li.up { color: var(--green); background: var(--green-soft); }
.stack { display: flex; flex-direction: column; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  min-height: 52px; padding: 0 18px; border-radius: 14px; font-weight: 800; font-size: 16px;
  background: var(--anthracite); color: var(--text); text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--orange); color: var(--on-orange); }
.btn-primary:active { background: #c2410c; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn-danger { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-xl { min-height: 64px; font-size: 19px; border-radius: 18px; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }
.btn-row.end { justify-content: flex-end; margin-top: 6px; }
.btn-row.end > .btn { flex: 0 0 auto; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.btn-col .btn { justify-content: flex-start; }
.link-btn { color: var(--muted); font-size: 15px; text-decoration: underline; padding: 12px; align-self: center; min-height: 48px; }

.switch-row { display: flex; align-items: center; gap: 12px; min-height: 44px; user-select: none; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; flex: 0 0 auto; width: 50px; height: 30px; border-radius: 99px; background: var(--anthracite); transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch-row input:checked + .switch { background: var(--orange); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--anthracite); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: var(--orange-hi); }
.pill.done { background: #f4f4f5; color: #0a0a0a; }

.banner { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--orange-soft); border: 1px solid rgba(234, 88, 12, 0.4); }
.banner > div:first-child { flex: 1; }
.banner.warn { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.4); flex-wrap: wrap; }
.banner .btn-col { flex: 0 0 auto; }
.warn-card { border-color: rgba(251, 191, 36, 0.45); }

/* ---------- Accueil ---------- */
.week-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.week-head h2 { margin: 0; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; border-radius: 12px; background: var(--surface-2); }
.day.today { outline: 2px solid var(--orange); }
.dname { font-size: 13px; color: var(--muted); font-weight: 700; }
.dmark { display: flex; flex-direction: column; gap: 3px; align-items: center; min-height: 26px; }
.tag { font-style: normal; font-weight: 900; font-size: 13px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.tA, .tB { background: #f4f4f5; color: #0a0a0a; }
.tD { background: var(--anthracite); color: var(--text); }
.tv { color: var(--orange-hi); border: 1px dashed var(--orange-hi); }
.tM { background: var(--orange); color: var(--on-orange); }
.tnone { color: var(--dim); }
.body-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.body-grid > div { display: flex; flex-direction: column; gap: 2px; }
.body-grid b { font-size: 26px; font-weight: 900; }

/* ---------- Programme ---------- */
.ex-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ex-row { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px; }
.ex-num { flex: 0 0 30px; height: 30px; border-radius: 9px; background: var(--anthracite); display: grid; place-items: center; font-weight: 900; font-size: 14px; color: var(--muted); }
.ex-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ex-name { font-weight: 800; }
.ex-meta { font-size: 14px; color: var(--muted); }
.ex-cons { font-size: 14px; color: var(--dim); margin-top: 2px; }
.ex-load { text-align: right; flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ex-load .kg { font-weight: 900; font-size: 18px; }
.ex-load .rec { font-size: 13px; color: var(--green); font-weight: 700; }
.adv { font-size: 13px; font-weight: 800; border-radius: 8px; padding: 2px 7px; white-space: nowrap; }
.adv.up { color: var(--green); background: var(--green-soft); }
.adv.down { color: var(--amber); background: rgba(251, 191, 36, 0.12); }
.adv.flat { color: var(--muted); background: var(--anthracite); }

/* ---------- Grille des machines ---------- */
.active-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.active-head h1 { font-size: 26px; font-weight: 900; }
.elapsed { font-size: 20px; font-weight: 800; color: var(--muted); }
.progress { height: 6px; border-radius: 99px; background: var(--anthracite); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 99px; transition: width 0.3s; }
.hint { text-align: center; color: var(--muted); font-size: 15px; margin: 0; }
.warm-card { display: flex; flex-direction: column; gap: 10px; }
.warm-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; }
.warm-done { display: block; width: 100%; text-align: left; min-height: 48px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; }
.machine-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mcard {
  position: relative; text-align: left; display: flex; flex-direction: column; gap: 3px;
  min-height: 124px; padding: 13px; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line);
}
.mcard:active { transform: scale(0.98); }
.mtop { display: flex; justify-content: space-between; align-items: center; }
.mnum { font-weight: 900; color: var(--dim); font-size: 14px; }
.mname { font-weight: 900; font-size: 17px; line-height: 1.15; margin-top: 3px; }
.mmuscle { font-size: 14px; color: var(--muted); }
.mload { margin-top: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mload .num { font-weight: 900; font-size: 20px; }
.mcard.doing { border-color: var(--orange); }
.mcard.done { background: var(--surface-2); border-color: #3a3a3a; }
.mcard.done .mname, .mcard.done .mload .num { color: var(--muted); }
.mcard.skipped { opacity: 0.5; border-style: dashed; }
.mcard.span2 { grid-column: span 2; min-height: 96px; }
.strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 2px solid var(--orange); }
.strip > div { flex: 1; min-width: 120px; }
.strip-time { font-size: 22px; font-weight: 900; }

/* ---------- Vue machine ---------- */
.focus-mode main { padding-top: 0; padding-bottom: calc(110px + var(--safe-b)); gap: 12px; }
.fbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  margin: 0 -16px; padding: calc(var(--safe-t) + 4px) 12px 4px; background: rgba(10, 10, 10, 0.95); border-bottom: 1px solid var(--line);
}
.fback { min-height: 48px; padding: 0 8px; font-weight: 800; font-size: 16px; color: var(--text); }
.ftitle { flex: 1; text-align: center; font-weight: 800; color: var(--muted); }
.fbar .elapsed { font-size: 16px; }
.fhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fhead h1 { font-size: 26px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.01em; }
.reglages { text-align: left; min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--surface); border: 1px dashed #3a3a3a; color: var(--muted); font-size: 15px; font-weight: 600; }
.adv-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--green-soft); border: 1px solid rgba(16, 185, 129, 0.45); }
.adv-banner > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.adv-banner b { color: var(--green); }
.adv-banner.down, .adv-banner.plateau { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.4); }
.adv-banner.down b, .adv-banner.plateau b { color: var(--amber); }
.adv-banner .btn { min-height: 56px; }

.loadbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.load-top { display: flex; align-items: center; gap: 8px; }
.step { flex: 0 0 64px; height: 72px; border-radius: 18px; background: var(--anthracite); font-size: 32px; font-weight: 700; }
.step:active { background: #3a3a3a; }
.load-val { flex: 1; text-align: center; min-height: 72px; border-radius: 14px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: 4px; }
.load-val .big { font-size: 56px; font-weight: 900; line-height: 1.1; letter-spacing: -0.03em; }
.load-val .unit { font-size: 20px; font-weight: 800; color: var(--muted); }
.load-split { flex-basis: 100%; font-size: 14px; color: var(--muted); }
.delta { text-align: center; font-size: 15px; font-weight: 700; color: var(--muted); }
.delta.warn { color: var(--amber); }
.delta.rec { color: var(--green); }
.load-panel { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.chip-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.chip { min-height: 48px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 800; font-size: 16px; }
.chip.on { background: var(--orange); border-color: var(--orange); color: var(--on-orange); }
.micro { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-width: 64px; min-height: 46px; border-radius: 11px; font-weight: 800; color: var(--muted); }
.seg button.on { background: var(--anthracite); color: var(--text); box-shadow: inset 0 0 0 2px var(--orange); }
.seg.wide { width: 100%; }
.sticky-seg { position: sticky; top: 104px; z-index: 10; }

.sets-table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.srow { display: grid; grid-template-columns: 1fr 1.4fr 1.4fr; align-items: center; width: 100%; min-height: 52px; padding: 0 16px; border-top: 1px solid var(--line); text-align: left; font-size: 18px; }
.srow.head { min-height: 36px; border-top: 0; font-size: 13px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.srow .sl { color: var(--dim); text-align: center; }
.srow .st { text-align: center; font-weight: 900; }
.srow.next { background: var(--orange-soft); }
.srow.next .sn { color: var(--orange-hi); font-weight: 900; }
.srow.done .sn::after { content: " ✓"; color: var(--muted); }
.srow.editing { background: var(--surface-2); }
.plus { font-style: normal; color: var(--green); font-size: 14px; font-weight: 800; margin-left: 4px; }
.srow-edit { display: flex; justify-content: center; padding: 8px; background: var(--surface-2); }

.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper b { font-size: 28px; font-weight: 900; min-width: 36px; text-align: center; }
.sbtn { width: 56px; height: 56px; border-radius: 16px; background: var(--anthracite); font-size: 28px; font-weight: 700; }
.sbtn:active { background: #3a3a3a; }

.rest { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; border-radius: 20px; background: #000; border: 2px solid var(--line); }
.rest-label { font-size: 15px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; color: var(--muted); }
.rest-time { font-size: 112px; font-weight: 900; line-height: 0.95; letter-spacing: -0.04em; }
.rest .progress { width: 100%; }
.rest-over { color: var(--amber); min-height: 18px; }
.rest-reps { display: flex; align-items: center; gap: 14px; font-weight: 800; }
.rest .btn-row { width: 100%; }
.rest .btn-row .btn { min-height: 56px; }
.rest.go { border-color: var(--green); }
.rest.go .rest-time, .rest.go .rest-label { color: var(--green); }

.consigne { background: var(--surface); border-radius: 12px; padding: 0 14px; color: #d4d4d8; font-size: 15px; }
.consigne summary { min-height: 48px; display: flex; align-items: center; color: var(--muted); font-weight: 700; cursor: pointer; }
.consigne[open] { padding-bottom: 12px; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, rgba(10, 10, 10, 0)); }
.dock-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; max-width: 608px; margin: 0 auto;
  min-height: 84px; border-radius: 22px; background: var(--orange); color: var(--on-orange);
  font-size: 24px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.03em;
  box-shadow: 0 10px 30px rgba(234, 88, 12, 0.3);
}
.dock-btn small { font-size: 14px; font-weight: 700; text-transform: none; letter-spacing: 0; opacity: 0.8; }
.dock-btn:active { transform: scale(0.985); background: #c2410c; }
.dock-btn.outline { background: var(--bg); color: var(--orange-hi); box-shadow: inset 0 0 0 2px var(--orange); }
.dock-btn.ghost { background: var(--anthracite); color: var(--text); box-shadow: none; }
.dock-btn:disabled { background: var(--anthracite); color: var(--dim); box-shadow: none; }

/* ---------- Barre minuteur ---------- */
.timerbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: rgba(21, 21, 21, 0.97); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tb-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 8px; min-height: 52px; }
.tb-label { font-size: 15px; color: var(--muted); font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-time { font-size: 30px; font-weight: 900; min-width: 80px; text-align: center; }
.tb-btn { min-height: 52px; min-width: 56px; padding: 0 12px; border-radius: 14px; background: var(--anthracite); font-weight: 800; font-size: 16px; }
.tb-btn.primary { background: var(--orange); color: var(--on-orange); }
.tb-grow { flex: 1; min-width: 0; }
.timerbar.running { border-top: 2px solid var(--orange); }
.timerbar.go { border-top: 2px solid var(--green); }
.timerbar.go .tb-time { color: var(--green); }
.tb-bar { position: absolute; left: 0; top: -2px; height: 2px; background: var(--orange-hi); transition: width 0.25s linear; }

/* ---------- Suivi ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi b { display: block; font-size: 32px; font-weight: 900; line-height: 1.1; }
.kpi span { font-size: 14px; color: var(--muted); }
.kpi.big { grid-column: span 2; background: linear-gradient(140deg, rgba(234, 88, 12, 0.2), var(--surface) 60%); }
.kpi.big b { font-size: 44px; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--dim); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 6px 4px; }
td { padding: 10px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
tr[data-action] { cursor: pointer; }
td.r, th.r { text-align: right; white-space: nowrap; }
td .sub { display: block; font-size: 13px; color: var(--dim); }
.delta-up { color: var(--green); font-weight: 800; }
.delta-down { color: #fca5a5; font-weight: 800; }
.spark { display: block; margin-top: 4px; }
.chart { display: block; width: 100%; height: auto; }
.gain { color: var(--green); font-weight: 800; font-size: 14px; }
.rec-banner { text-align: center; font-weight: 900; color: var(--green); background: var(--green-soft); border: 1px solid rgba(16, 185, 129, 0.45); border-radius: 12px; padding: 10px; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
details.card > summary.sum-title { list-style: none; cursor: pointer; min-height: 28px; font-weight: 800; color: var(--muted); }
details.card > summary.sum-title::-webkit-details-marker { display: none; }
details.card[open] > summary.sum-title { margin-bottom: 12px; }

.hist { display: flex; flex-direction: column; gap: 8px; }
.hist details { background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line); }
.hist summary { list-style: none; padding: 12px 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 56px; }
.hist summary::-webkit-details-marker { display: none; }
.htype { flex: 0 0 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; background: var(--anthracite); }
.htype.A, .htype.B { background: #f4f4f5; color: #0a0a0a; }
.hmain { flex: 1; min-width: 0; }
.hmain b { display: block; font-size: 15px; }
.hmain span { font-size: 14px; color: var(--muted); }
.hbody { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.card > .hbody { padding: 0; }
.hline { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.add-session { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.add-session .btn { grid-column: span 2; }
.edit-form { display: flex; flex-direction: column; gap: 12px; }
.edit-ex { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.edit-row { display: flex; gap: 6px; }
.edit-row .input { height: 46px; font-size: 16px; padding: 0 8px; min-width: 0; }
.edit-row.reps .input { text-align: center; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: span 2; }
.field label { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.input { width: 100%; height: 50px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 17px; color-scheme: dark; }
.input:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.big-input { height: 60px; font-size: 26px; font-weight: 800; text-align: center; }
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick label { position: relative; }
.daypick input { position: absolute; opacity: 0; }
.daypick span { display: grid; place-items: center; min-height: 48px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 800; color: var(--muted); }
.daypick input:checked + span { background: var(--orange); border-color: var(--orange); color: var(--on-orange); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row > div { flex: 1; min-width: 0; }
.list-row small { display: block; color: var(--dim); font-size: 13px; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { flex: 1; font-size: 14px; }

/* ---------- Feuilles du bas ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.6); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 88dvh; overflow-y: auto;
  max-width: 640px; margin: 0 auto; padding: 20px 16px calc(16px + var(--safe-b));
  background: var(--surface); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line);
  animation: up 0.18s ease-out;
}
.sheet-title { font-size: 21px; font-weight: 900; margin-bottom: 12px; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Pass ---------- */
.focus-head { display: flex; align-items: center; gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; min-height: 48px; padding: 0 4px; }
.pass-qr { background: #fff; border-radius: 20px; padding: 16px; display: grid; place-items: center; }
.pass-qr img { display: block; width: 100%; max-width: 360px; height: auto; image-rendering: pixelated; }
.pass-qr.small { padding: 8px; max-width: 160px; }
.pass-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: #d4d4d8; }

/* ---------- Connexion ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 20px calc(24px + var(--safe-b)); max-width: 420px; margin: 0 auto; text-align: center; }
.login .logo { width: 64px; height: 64px; border-radius: 18px; font-size: 32px; }
.login h1 { font-size: 26px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.dots { display: flex; gap: 14px; justify-content: center; min-height: 20px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--dim); }
.dots i.on { background: var(--orange); border-color: var(--orange); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 320px; }
.key { height: 68px; border-radius: 20px; background: var(--surface-2); font-size: 28px; font-weight: 800; border: 1px solid var(--line); }
.key:active { background: var(--anthracite); }
.key.ghost { background: transparent; border: 0; font-size: 22px; color: var(--muted); }
.login .err { color: #fca5a5; min-height: 22px; margin: 0; font-weight: 700; }
.login .check { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 15px; }
.login form { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 12px); transform: translateX(-50%) translateY(-20px);
  background: #f4f4f5; color: #0a0a0a; padding: 12px 18px; border-radius: 14px; font-weight: 800; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 70; max-width: calc(100% - 32px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.green { background: var(--green); color: #04150f; }
.toast.err { background: var(--red); color: #fff; }

@media (min-width: 560px) {
  .machine-grid { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .kpi.big { grid-column: span 4; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
