  :root {
    --bg: #f4f5f7; --panel: #ffffff; --ink: #1d2330; --muted: #5d6675; --line: #dde1e7;
    --accent: #2563eb; --accent-ink: #ffffff; --chip: #eef1f5; --z1: #d6e4ff; --z3: #eceef2;
  }
  @media (prefers-color-scheme: dark) {
    :root { --bg: #11151c; --panel: #1a2029; --ink: #e6e9ee; --muted: #9aa4b2; --line: #2b3340;
            --accent: #4c8dff; --accent-ink: #0b0f15; --chip: #242c38;
            --z1: #1f3558; --z3: #222a35; }
  }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--ink);
         font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
           padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
  h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: .01em; }
  h1 span { color: var(--muted); font-weight: 500; }
  label.run { display: flex; align-items: center; gap: 8px; color: var(--muted); }
  select, input[type=date] { font: inherit; color: var(--ink); background: var(--chip); border: 1px solid var(--line);
           border-radius: 8px; padding: 5px 8px; color-scheme: light dark; }
  label.run[hidden] { display: none; }
  main { max-width: 1540px; margin: 0 auto; padding: 12px 16px 24px; }
  nav { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
  nav .grp { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 6px; }
  nav .grp span { flex: 0 0 132px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase;
                  letter-spacing: .03em; }
  nav button { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
               padding: 4px 11px; border-radius: 999px; cursor: pointer; }
  @media (max-width: 600px) { nav .grp span { flex-basis: 100%; } }
  nav button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .frame { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
           overflow: hidden; aspect-ratio: 1502 / 906; }
  .frame img { display: block; width: 100%; height: 100%; }
  .frame .msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
  .frame .msg[hidden] { display: none; }
  .frame.pick img { cursor: crosshair; }
  .tip { position: absolute; z-index: 2; min-width: 170px; max-width: 280px; padding: 7px 9px; border-radius: 8px;
         background: rgba(15, 20, 30, .92); color: #fff; font-size: 13px; line-height: 1.35; pointer-events: none;
         box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
  .tip b { font-weight: 650; }
  .tip small { color: #b8c2d0; }
  #pick[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 12px 0 8px; }
  .controls button { font: inherit; min-width: 40px; padding: 6px 10px; border-radius: 8px; cursor: pointer;
                     border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
  /* curseur unique : la piste est coloree par zone (pas 1 h puis pas 3 h), libelles dans la piste ;
     --f : position du changement de pas (0-1), 22px : diametre du bouton */
  .track { --f: 1; --t: 22px; --cut: calc(var(--t) / 2 + (100% - var(--t)) * var(--f));
           position: relative; flex: 1 1 260px; min-width: 0; height: 24px; border-radius: 12px;
           border: 1px solid var(--line); background: var(--z3); font-size: 11px; line-height: 22px; color: var(--muted); }
  .track.split { background: linear-gradient(to right, var(--z1) var(--cut), var(--line) var(--cut),
                 var(--line) calc(var(--cut) + 2px), var(--z3) calc(var(--cut) + 2px)); }
  .track .lab { position: absolute; top: 0; white-space: nowrap; pointer-events: none; }
  .track .l1 { left: 10px; }
  .track .l3 { right: 10px; }
  .track:not(.split) .lab { display: none; }
  .track input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
                             -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
  .track input[type=range]::-webkit-slider-runnable-track { height: 22px; background: transparent; }
  .track input[type=range]::-moz-range-track { height: 22px; background: transparent; }
  .track input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: var(--t); height: var(--t);
      border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--accent); }
  .track input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent);
      border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--accent); }
  /* run en cours : point vert qui pulse au bout du curseur ; badge a chaque nouvelle echeance rendue */
  .track.live::after { content: ""; position: absolute; right: -13px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
                       border-radius: 50%; background: #22c55e; animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
  .track .fresh { position: absolute; right: 0; bottom: calc(100% + 4px); padding: 1px 7px; border-radius: 8px;
                  background: #22c55e; color: #06210f; font-size: 11px; line-height: 16px; font-weight: 600; white-space: nowrap;
                  pointer-events: none; opacity: 0; transition: opacity .4s; }
  .track .fresh.on { opacity: 1; }
  .track input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
  .when { font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto; }
  .when b { font-weight: 650; }
  .when small { color: var(--muted); }
  .legend { display: flex; align-items: stretch; margin-top: 6px; padding-bottom: 4px; }
  .legend .unit { color: var(--muted); margin-right: 10px; align-self: flex-start; line-height: 14px; }
  .legend .c { display: flex; flex-direction: column; align-items: flex-start; flex: 1 1 0; min-width: 0; max-width: 64px; }
  .legend .c i { display: block; width: 100%; height: 14px; }
  .legend .c span { font-size: 11px; color: var(--muted); margin-top: 2px; transform: translateX(-40%); white-space: nowrap; }
  .note { color: var(--muted); font-size: 13px; margin-top: 8px; }
  footer { color: var(--muted); font-size: 12px; margin-top: 18px; }
  footer a { color: var(--accent); }
