@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-style: italic; font-display: swap; src: url("fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 200 800; font-style: normal; font-display: swap; src: url("fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); }
:root {
  --fog: #edf2ef;
  --paper: #fbfdfc;
  --ink: #17262b;
  --muted: #55676b;
  --pine: #1d5c54;
  --pine-soft: #d3e6e0;
  --sky: #bfd9e0;
  --plum: #9b3d5a;
  --plum-soft: #f3dde4;
  --line: #cfdad6;
  --slot: #dbe5e1;
  --on-pine: #f4faf8;
  --display: "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fog: #10191b;
    --paper: #172326;
    --ink: #e6eeeb;
    --muted: #9db0ae;
    --pine: #6fc3b3;
    --pine-soft: #1f3a37;
    --sky: #27434b;
    --plum: #e08aa5;
    --plum-soft: #3a2029;
    --line: #2b3b3d;
    --slot: #24363a;
    --on-pine: #0d1a18;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
}
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 6vw, 2.9rem); font-weight: 700; }
h2 { font-size: 1.45rem; font-weight: 700; margin-top: 2.4rem; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0.6rem 0; max-width: 62ch; }
a { color: var(--pine); }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 1rem; z-index: 50; }

/* Shell */
.shell { max-width: 1080px; margin: 0 auto; padding: 0 16px 96px; }
.brand { padding: 18px 0 6px; }
.brand-name { display: inline-flex; align-items: center; gap: 10px; color: var(--pine); text-decoration: none; font: 700 1.35rem var(--display); }
main { outline: none; padding-top: 10px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 8px 2px 7px; font-size: 0.7rem; text-decoration: none; color: var(--muted);
}
.tabs .ico { font-size: 1.15rem; line-height: 1.2; }
.tabs a[aria-current="page"] { color: var(--pine); font-weight: 700; box-shadow: inset 0 3px 0 var(--pine); }

@media (min-width: 860px) {
  .shell { display: grid; grid-template-columns: 200px 1fr; grid-template-rows: auto 1fr; column-gap: 48px; padding-bottom: 64px; }
  .brand { grid-column: 1; padding-top: 32px; }
  .tabs {
    position: sticky; top: 24px; align-self: start; grid-column: 1; grid-row: 2;
    display: flex; flex-direction: column; background: none; border: 0; padding: 12px 0 0;
  }
  .tabs a { flex-direction: row; gap: 12px; font-size: 1rem; padding: 10px 12px; border-radius: 8px; }
  .tabs a[aria-current="page"] { box-shadow: none; background: var(--pine-soft); }
  main { grid-column: 2; grid-row: 1 / span 2; padding-top: 36px; }
}

/* Building blocks */
.lede { font-size: 1.15rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-top: 16px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.notice { border-left: 5px solid var(--plum); background: var(--plum-soft); padding: 14px 16px; border-radius: 0 10px 10px 0; margin-top: 18px; }
.notice p { margin: 0.3rem 0; }
.notice.calm { border-color: var(--pine); background: var(--pine-soft); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }

button, .btn {
  font: inherit; cursor: pointer; border-radius: 10px; border: 1.5px solid var(--pine);
  background: transparent; color: var(--pine); padding: 10px 16px; min-height: 46px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover, .btn:hover { background: var(--pine-soft); }
button.primary, .btn.primary { background: var(--pine); color: var(--on-pine); font-weight: 700; }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); background: var(--pine); }
button.quiet { border-color: transparent; color: var(--muted); padding: 6px 10px; min-height: 40px; }
button.danger { border-color: var(--plum); color: var(--plum); }
button.big, .btn.big { width: 100%; font-size: 1.1rem; min-height: 58px; }

label { display: block; font-weight: 700; margin-top: 14px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }
input[type="number"], input[type="text"], input[type="password"], input[type="time"], select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-height: 46px; width: 100%; max-width: 260px; margin-top: 6px;
}
fieldset { border: 0; padding: 0; margin: 14px 0 0; }
legend { font-weight: 700; padding: 0; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; margin-top: 8px; font-weight: 400; cursor: pointer; background: var(--paper); }
.choice:has(input:checked) { border-color: var(--pine); background: var(--pine-soft); }
.choice input { margin-top: 6px; accent-color: var(--pine); width: 18px; height: 18px; flex: none; }
.choice strong { display: block; }

/* Today */
.daynav { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.daynav button { min-height: 40px; padding: 4px 12px; }
.count { font: 700 clamp(3.4rem, 15vw, 6rem)/0.95 var(--display); letter-spacing: -0.03em; margin-top: 10px; }
.count small { font-size: 0.32em; font-weight: 500; letter-spacing: 0; color: var(--muted); display: block; margin-top: 8px; line-height: 1.3; }
.count.over { color: var(--plum); }
.glasses { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 6px; }
.glass {
  position: relative; width: 36px; height: 48px; background: var(--slot);
  clip-path: polygon(0 0, 100% 0, 84% 100%, 16% 100%);
}
.glass i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--pine); transition: height 0.35s ease; }
.glass.extra i { background: var(--plum); }
.drinks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.drinks button { flex-direction: column; align-items: flex-start; gap: 0; text-align: left; padding: 10px 14px; background: var(--paper); border-color: var(--line); color: var(--ink); }
.drinks button:hover { border-color: var(--pine); background: var(--pine-soft); }
.drinks button span { color: var(--muted); font-size: 0.85rem; }
.log { list-style: none; padding: 0; margin: 10px 0 0; }
.log li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; width: 3.2em; }
.log .what { flex: 1; }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; align-items: end; }
.inline-form label { margin-top: 0; }
.inline-form input { max-width: none; }

/* Onboarding stepper */
.stepper { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stepper .name { flex: 1; }
.stepper .name span { display: block; color: var(--muted); font-size: 0.85rem; }
.stepper button { min-width: 46px; padding: 0; font-size: 1.3rem; }
.stepper output { width: 2ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.total { font: 700 1.5rem var(--display); margin-top: 14px; }

/* Plan */
.stairs { width: 100%; height: auto; display: block; margin-top: 8px; }
.stairs .path { fill: none; stroke: var(--pine); stroke-width: 3; stroke-linejoin: round; }
.stairs .area { fill: var(--pine-soft); }
.stairs .axis { stroke: var(--line); stroke-width: 1; }
.stairs text { fill: var(--muted); font: 20px var(--body); }
.stairs .here { fill: var(--plum); stroke: var(--paper); stroke-width: 3; }
.stairs .here-label { fill: var(--ink); font-weight: 700; }
.steps { list-style: none; padding: 0; margin: 12px 0 0; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; padding: 9px 8px; border-bottom: 1px solid var(--line); align-items: baseline; }
.steps li::before { content: counter(s); color: var(--muted); font-variant-numeric: tabular-nums; }
.steps li.done { color: var(--muted); }
.steps li.now { background: var(--pine-soft); border-radius: 8px; font-weight: 700; border-bottom-color: transparent; }
.steps .lim { font-variant-numeric: tabular-nums; }

/* Craving */
.breath-wrap { display: grid; place-items: center; padding: 28px 0 10px; }
.breath {
  width: min(64vw, 260px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--pine-soft) 0 58%, transparent 59%);
  display: grid; place-items: center; text-align: center; position: relative;
}
.breath::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--pine);
  animation: breathe 10s ease-in-out infinite;
}
.breath.idle::before { animation: none; transform: scale(0.8); }
@keyframes breathe { 0% { transform: scale(0.72); } 40% { transform: scale(1); } 100% { transform: scale(0.72); } }
.breath .clock { font: 700 2.6rem var(--display); font-variant-numeric: tabular-nums; }
.breath .phase { color: var(--muted); }
.idea { font-size: 1.2rem; min-height: 3.4em; text-align: center; max-width: 34ch; margin: 8px auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { min-height: 40px; padding: 6px 14px; border-radius: 999px; border-color: var(--line); color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: var(--on-pine); }

/* Stats */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin-top: 14px; border-top: 1px solid var(--line); }
.figures div { padding: 14px 14px 14px 0; border-bottom: 1px solid var(--line); }
.figures b { display: block; font: 700 2rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.figures span { color: var(--muted); font-size: 0.92rem; }
.chart { max-width: 720px; width: 100%; height: auto; display: block; margin-top: 10px; }
.chart .bar { fill: var(--pine); }
.chart .bar.over { fill: var(--plum); }
.chart .none { fill: var(--line); }
.chart .limit { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart text { fill: var(--muted); font: 17px var(--body); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.88rem; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bars { list-style: none; padding: 0; margin: 10px 0 0; }
.bars li { display: grid; grid-template-columns: 9em 1fr 2em; gap: 10px; align-items: center; padding: 4px 0; }
.bars .track { height: 12px; background: var(--slot); border-radius: 6px; overflow: hidden; }
.bars .track i { display: block; height: 100%; background: var(--pine); }

/* Advice */
details { border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; padding: 14px 0; font: 700 1.1rem var(--display); list-style-position: outside; }
details[open] summary { color: var(--pine); }
details .body { padding: 0 0 16px; }
details ul, .plain-list { padding-left: 1.2em; margin: 0.4rem 0; max-width: 62ch; }
details li, .plain-list li { margin: 0.35rem 0; }

/* Help */
.phone { display: grid; gap: 2px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.phone a.num { font: 700 1.9rem var(--display); text-decoration: none; font-variant-numeric: tabular-nums; }
.phone.urgent a.num { color: var(--plum); }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--fog); padding: 10px 18px; border-radius: 999px; transition: 0.25s; z-index: 30; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .breath::before { animation: none; transform: scale(0.9); }
  .glass i, #toast { transition: none; }
}

.log input.t { width: auto; max-width: 8em; min-height: 40px; margin: 0; padding: 4px 8px; font-variant-numeric: tabular-nums; }
#summary .notice { margin-top: 10px; }
#pin-msg { min-height: 1.6em; }

/* Délai conseillé, réveil, cagnotte, bilan */
.pace input.end { width: auto; max-width: 8em; min-height: 38px; margin: 0 0 0 4px; padding: 2px 8px; }
.lbl { font-weight: 700; margin: 12px 0 0; }
.track.big { height: 18px; background: var(--slot); border-radius: 9px; overflow: hidden; max-width: 520px; }
.track.big i { display: block; height: 100%; background: var(--pine); }
.scroll { overflow-x: auto; margin-top: 10px; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { color: var(--muted); font-weight: 400; font-size: 0.9rem; white-space: nowrap; }
.table tbody th { font-weight: 700; }

@media print {
  :root { --fog: #fff; --paper: #fff; --ink: #000; --muted: #333; --pine: #000; --line: #999; }
  .tabs, .brand, .no-print, #toast, .skip { display: none !important; }
  .shell { display: block; padding: 0; max-width: none; }
  body { font-size: 11pt; }
  h1 { font-size: 18pt; } h2 { font-size: 13pt; margin-top: 14pt; }
  .scroll { overflow: visible; }
  tr { break-inside: avoid; }
}

.code { font: 700 1.25rem/1.5 var(--display); letter-spacing: 0.06em; background: var(--paper); border: 1.5px dashed var(--pine); border-radius: 10px; padding: 12px 14px; user-select: all; overflow-wrap: anywhere; max-width: max-content; }

/* Modification d'une heure : bouton, puis champ + OK */
.tbtn { min-height: 40px; padding: 4px 10px; border-color: var(--line); color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
.pace .tbtn { margin-left: 4px; }
.tform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tform label { margin: 0; }
.tform input[type="time"] { width: auto; max-width: 9em; margin: 0; font-size: 1.1rem; }
.tform button { min-height: 44px; padding: 6px 14px; }
.log li:has(.tform) { flex-wrap: wrap; }
