:root{
  /* dark instrument-panel theme */
  --bg:#0e1116; --surface:#161b22; --surface-2:#1c232e; --line:#2a323f;
  --text:#e7eaf0; --muted:#8b95a4;
  --green:#35c48d; --green-soft:rgba(53,196,141,.15);
  --amber:#eab24a; --amber-soft:rgba(234,178,74,.15);
  --blue:#66a6e6; --blue-soft:rgba(102,166,230,.15);
  --rose:#e06a5b;
  --disp:"Bricolage Grotesque", system-ui, sans-serif;
  --body:"Inter", system-ui, sans-serif;
  --mono:"Space Mono", ui-monospace, monospace;
  --r:14px;
}
*{box-sizing:border-box}
html,body{margin:0}
body{font-family:var(--body); color:var(--text); background:var(--bg);
  -webkit-font-smoothing:antialiased; line-height:1.45; padding-bottom:env(safe-area-inset-bottom)}
.mono{font-family:var(--mono); font-variant-numeric:tabular-nums; letter-spacing:-.02em}
.muted{color:var(--muted)} .small{font-size:.85rem} .xs{font-size:.75rem}
h1,h2{font-family:var(--disp); margin:0; letter-spacing:-.02em}
a{color:inherit}

.wrap{max-width:1120px; margin:0 auto; padding:24px 18px 108px}

/* header */
.top{display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:18px}
.eyebrow{margin:0 0 3px; font-size:.72rem; text-transform:uppercase; letter-spacing:.14em; color:var(--muted); font-weight:600}
.top h1{font-size:2rem; font-weight:800; line-height:1}
.wk{color:var(--green)}
.nudge{margin:8px 0 0; color:var(--text); font-size:.95rem; font-weight:500}
.sem{display:flex; flex-direction:column; align-items:flex-end; line-height:1; flex:0 0 auto}
.sem-pct{font-size:1.4rem; font-weight:700}
.sem-lbl{font-size:.66rem; text-transform:uppercase; letter-spacing:.1em; color:var(--muted)}

/* focus banner */
.focus{border-radius:var(--r); padding:14px 16px; margin-bottom:18px; border:1px solid transparent}
.focus p{margin:6px 0 0; font-weight:500; color:var(--text)}
.focus-tag{font-family:var(--disp); font-weight:700; font-size:.85rem}
.focus-stage{background:var(--amber-soft); border-color:rgba(234,178,74,.35)}
.focus-stage .focus-tag{color:var(--amber)}
.focus-revisions{background:var(--blue-soft); border-color:rgba(102,166,230,.35)}
.focus-revisions .focus-tag{color:var(--blue)}
.focus.slim{padding:9px 14px; margin-bottom:14px}

/* board grid */
.board{display:grid; grid-template-columns:1fr; gap:16px}
@media(min-width:900px){
  .board{grid-template-columns:1.35fr 1fr; align-items:start}
  .span-2{grid-column:1 / -1}
}
.stack{display:flex; flex-direction:column; gap:16px}

/* hero */
.hero{display:flex; gap:22px; align-items:center; background:var(--surface);
  border:1px solid var(--line); border-radius:var(--r); padding:18px}
.ring-box{position:relative; width:136px; height:136px; flex:0 0 auto}
.ring{width:136px; height:136px; transform:rotate(-90deg)}
.ring-bg{fill:none; stroke:var(--surface-2); stroke-width:11}
.ring-fg{fill:none; stroke:var(--green); stroke-width:11; stroke-linecap:round;
  transition:stroke-dashoffset 1s cubic-bezier(.22,1,.36,1)}
.ring-label{position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center}
.big{font-size:2rem; font-weight:700; line-height:1}
.big i{font-size:.9rem; font-style:normal; color:var(--muted)}
.ring-sub{font-size:.66rem; text-transform:uppercase; letter-spacing:.09em; color:var(--muted); margin-top:3px}
.streaks{display:flex; flex-direction:column; gap:10px; flex:1}
.streak{display:flex; align-items:baseline; gap:11px; background:var(--surface-2);
  border:1px solid var(--line); border-radius:12px; padding:10px 13px}
.streak .num{font-size:1.5rem; font-weight:700; color:var(--amber); min-width:1.6ch; text-align:right}
.s-lbl{font-size:.76rem; color:var(--muted); line-height:1.2}

/* panels */
.panel{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:17px}
.panel h2{font-size:1.02rem; font-weight:700; margin-bottom:13px; display:flex; align-items:baseline; gap:8px}
.h2-sub{font-family:var(--body); font-weight:500; font-size:.74rem; color:var(--muted); text-transform:uppercase; letter-spacing:.08em}

/* objective bars */
.bars{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:13px}
.bar-head{display:flex; justify-content:space-between; align-items:baseline; margin-bottom:6px}
.bar-name{font-weight:600; font-size:.92rem}
.bar-val{font-size:.82rem; color:var(--muted)}
.bar-val em{font-style:normal; color:var(--green); font-weight:700; margin-left:2px}
.track{height:8px; background:var(--surface-2); border-radius:99px; overflow:hidden}
.fill{height:100%; background:var(--green); border-radius:99px; transition:width .8s cubic-bezier(.22,1,.36,1)}
.bar-row.done .bar-name::after{content:" ✓"; color:var(--green)}
.bar-row.paused{opacity:.5}
.bar-row.paused .fill{background:var(--muted)}
.bar-row.paused .bar-val em{color:var(--muted); font-weight:500}

/* sleep */
.sleep{display:flex; flex-direction:column; gap:10px}
.sleep-num{display:flex; flex-direction:column}
.spark{width:100%; height:60px}
.spark-line{fill:none; stroke:var(--blue); stroke-width:2.5; stroke-linejoin:round; stroke-linecap:round}
.spark-target{stroke:var(--line); stroke-width:1.5; stroke-dasharray:3 4}

/* countdowns */
.counts{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px}
.counts li{display:flex; align-items:baseline; gap:12px; padding-bottom:10px; border-bottom:1px solid var(--line)}
.counts li:last-child{border-bottom:0; padding-bottom:0}
.cnum{font-size:1.1rem; font-weight:700; min-width:4.4ch}
.count-fac .cnum{color:var(--blue)}
.count-perso .cnum{color:var(--amber)}
.cname{font-size:.9rem}

/* consistency grid */
.cwrap{overflow-x:auto; padding-bottom:6px}
.cgrid{display:flex; gap:3px; min-width:max-content}
.ccol{display:grid; grid-template-rows:repeat(7,1fr); gap:3px}
.ccell{width:13px; height:13px; border-radius:3px; background:var(--surface-2); display:inline-block}
.ccell.void{background:transparent}
.ccell.lv0{background:var(--surface-2)}
.ccell.lv1{background:rgba(53,196,141,.28)}
.ccell.lv2{background:rgba(53,196,141,.5)}
.ccell.lv3{background:rgba(53,196,141,.75)}
.ccell.lv4{background:var(--green)}
.ccell.today{outline:1.5px solid var(--text); outline-offset:1px}
.cleg{display:flex; align-items:center; gap:5px; margin-top:12px; font-size:.72rem; color:var(--muted)}
.cleg .ccell{width:11px; height:11px}

/* ribbon */
.ribbon-panel{overflow:hidden}
.ribbon{display:flex; gap:4px; overflow-x:auto; padding-bottom:8px; scroll-snap-type:x proximity}
.ribbon::-webkit-scrollbar{height:0}
.cell{scroll-snap-align:center; flex:0 0 auto; width:44px; height:56px; border-radius:9px;
  display:flex; flex-direction:column; align-items:center; justify-content:space-between;
  padding:6px 0; background:var(--surface-2); border:1px solid transparent}
.cell-lbl{font-family:var(--disp); font-weight:700; font-size:.7rem; line-height:1; text-align:center}
.cell-num{font-size:.6rem; color:var(--muted)}
.cell.k-cours{background:var(--green-soft)}
.cell.k-medians{background:var(--amber-soft)}
.cell.k-vacances{background:var(--surface-2)}
.cell.k-finaux{background:rgba(224,106,91,.18)}
.cell.past{opacity:.4}
.cell.now{border-color:var(--text); box-shadow:0 0 0 2px var(--bg),0 0 0 3px var(--text)}
.cell.now .cell-num{color:var(--text); font-weight:700}
.legend{display:flex; gap:14px; margin-top:11px; flex-wrap:wrap}
.lg{font-size:.72rem; color:var(--muted); display:flex; align-items:center; gap:5px}
.lg::before{content:""; width:11px; height:11px; border-radius:3px; display:inline-block}
.lg.k-cours::before{background:var(--green-soft)}
.lg.k-medians::before{background:var(--amber-soft)}
.lg.k-vacances::before{background:var(--surface-2)}
.lg.k-finaux::before{background:rgba(224,106,91,.18)}

/* CTAs */
.cta-row{display:flex; gap:10px}
.cta{display:inline-flex; align-items:center; justify-content:center; text-decoration:none;
  background:var(--green); color:#08120d; font-family:var(--disp); font-weight:700;
  padding:13px 18px; border-radius:12px; border:0; font-size:1rem; cursor:pointer; flex:1}
.cta.ghost{background:transparent; color:var(--text); border:1px solid var(--line); flex:0 0 auto}
.cta.full{width:100%; margin-top:8px}
.cta.small{padding:9px 14px; font-size:.88rem; flex:0 0 auto}
.cta:active{transform:translateY(1px)}

/* tabbar -> floating pill on desktop */
.tabbar{position:fixed; bottom:0; left:0; right:0; display:flex; background:var(--surface);
  border-top:1px solid var(--line); padding-bottom:env(safe-area-inset-bottom); z-index:20}
.tabbar a{flex:1; display:flex; flex-direction:column; align-items:center; gap:2px;
  padding:9px 0 10px; text-decoration:none; color:var(--muted); font-size:.68rem; font-weight:600}
.tabbar a.on{color:var(--green)}
.tabbar .ic{font-size:1.15rem; line-height:1}
@media(min-width:900px){
  .tabbar{left:50%; right:auto; bottom:20px; transform:translateX(-50%); width:auto;
    border:1px solid var(--line); border-radius:99px; padding:6px; gap:6px;
    box-shadow:0 10px 30px rgba(0,0,0,.4)}
  .tabbar a{flex:0 0 auto; flex-direction:row; gap:8px; padding:9px 20px; border-radius:99px; font-size:.85rem}
  .tabbar a.on{background:var(--green-soft)}
}

/* forms kept readable width */
.dayform,.setform,.daypick{max-width:600px}
.daypick{display:flex; gap:8px; align-items:center; margin-bottom:14px; flex-wrap:wrap}
.chip{padding:8px 12px; border-radius:99px; border:1px solid var(--line); text-decoration:none;
  font-size:.82rem; font-weight:600; background:var(--surface); color:var(--muted)}
.chip.on{background:var(--green); color:#08120d; border-color:var(--green)}
.date-in{margin-left:auto; padding:8px 10px; border:1px solid var(--line); border-radius:10px;
  font-family:var(--mono); font-size:.82rem; background:var(--surface); color:var(--text); color-scheme:dark}

.dayform{display:flex; flex-direction:column; gap:16px}
.field{display:flex; flex-direction:column; gap:7px}
.field>label{font-family:var(--disp); font-weight:700; font-size:.95rem}
.hint{font-family:var(--body); font-weight:500; font-size:.72rem; color:var(--muted); margin-left:6px}
.inline{display:flex; align-items:center; gap:10px}
input[type=number],input[type=text],input[type=password],input[type=date]{
  font-family:var(--body); font-size:1rem; padding:12px 13px; border:1px solid var(--line);
  border-radius:11px; background:var(--surface-2); color:var(--text); width:100%; color-scheme:dark}
.inline input[type=number]{max-width:120px; font-family:var(--mono); font-size:1.05rem}
.unit{color:var(--muted); font-size:.9rem}
input:focus-visible,button:focus-visible,a:focus-visible{outline:2px solid var(--green); outline-offset:2px}
.note{font-size:.85rem !important; padding:9px 11px !important}

.segs{display:grid; grid-template-columns:repeat(4,1fr); gap:6px}
.seg{display:flex; align-items:center; justify-content:center; padding:11px 4px; border:1px solid var(--line);
  border-radius:11px; font-size:.86rem; font-weight:600; color:var(--muted); cursor:pointer; background:var(--surface-2)}
.seg.on{background:var(--green); color:#08120d; border-color:var(--green)}
.seg input{position:absolute; opacity:0; pointer-events:none}

.checks{border:1px solid var(--line); border-radius:var(--r); padding:15px; margin:0; display:flex; flex-direction:column; gap:13px}
.checks legend{font-family:var(--disp); font-weight:700; font-size:.95rem; padding:0 6px}
.check-row{display:flex; flex-direction:column; gap:7px}
.big-check{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:15px}
.check{display:flex; align-items:center; gap:11px; font-weight:600; cursor:pointer}
.check input{position:absolute; opacity:0; width:0; height:0}
.box{width:22px; height:22px; border-radius:7px; border:2px solid var(--line); flex:0 0 auto; position:relative; transition:.15s; background:var(--surface-2)}
.check input:checked+.box{background:var(--green); border-color:var(--green)}
.check input:checked+.box::after{content:"✓"; color:#08120d; position:absolute; inset:0; display:flex;
  align-items:center; justify-content:center; font-size:.85rem; font-weight:700}
.check input:focus-visible+.box{outline:2px solid var(--green); outline-offset:2px}

/* settings */
.setform{display:flex; flex-direction:column; gap:16px}
.tgrid{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.tgrid label{display:flex; flex-direction:column; gap:4px; font-weight:600; font-size:.9rem}
.tgrid label span{font-weight:500; font-size:.72rem; color:var(--muted)}
.tgrid label.wide{grid-column:1 / -1}
.tgrid input{font-family:var(--mono)}
.dl-row{display:flex; gap:8px; margin-bottom:8px}
.dl-row input[type=text]{flex:2} .dl-row input[type=date]{flex:1; font-family:var(--mono)}
.logout-form{margin-top:26px; text-align:center}
.linkbtn{background:none; border:0; color:var(--muted); text-decoration:underline; cursor:pointer; font-size:.86rem}

/* login */
.login{min-height:82vh; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:18px}
.login-mark{font-family:var(--disp); font-weight:800; font-size:2rem; text-align:center; line-height:1}
.login-mark span{display:block; font-size:.78rem; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--green); margin-top:5px}
.login-card{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:22px; width:100%; max-width:340px; display:flex; flex-direction:column; gap:10px}
.login-card label{font-weight:600; font-size:.9rem}
.login-card button{margin-top:6px; background:var(--green); color:#08120d; border:0; padding:13px; border-radius:11px; font-family:var(--disp); font-weight:700; font-size:1rem; cursor:pointer}
.err{color:var(--rose); font-size:.85rem; margin:0}
.login-foot{color:var(--muted); font-size:.75rem}

/* toast */
.toast{position:fixed; left:50%; bottom:88px; transform:translateX(-50%); background:var(--surface);
  border:1px solid var(--line); color:var(--text); padding:11px 18px; border-radius:99px; font-weight:600;
  font-size:.88rem; z-index:30; box-shadow:0 10px 30px rgba(0,0,0,.45)}
.toast.static{position:static; transform:none; display:inline-block; margin-bottom:16px; background:var(--green-soft); border-color:rgba(53,196,141,.4); color:var(--green)}

@media(prefers-reduced-motion:reduce){ .ring-fg,.fill{transition:none} }
