:root{--brand:#183c91;--brand-2:#2450b7;--brand-soft:#e8efff;--bg:#f3f6fc;--ink:#192640;--muted:#5a6780;--line:#dde4f0;--edge:#ccd6e7;--ok:#168064;--ok-soft:#e3f6ee;--warn:#9a5b00;--warn-soft:#fff1d6;--bad:#b3233d;--head:64px}
*{box-sizing:border-box}
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-tap-highlight-color:transparent}

/* En-tête fixe : marque à gauche, actions en icônes à droite */
header{position:sticky;top:0;z-index:20;height:var(--head);background:#fff;padding:0 max(16px,5%,calc((100% - 1440px)/2 + 72px));display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid #dbe2ef}
.brand{font-weight:800;font-size:20px;color:var(--brand);text-decoration:none;display:flex;align-items:center;gap:10px;min-width:0}
.brand span:last-child{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.logo{background:var(--brand);color:#fff;border-radius:10px;width:36px;height:36px;display:grid;place-items:center;font-size:20px;flex:none}
.hdr{display:flex;gap:8px;flex:none}
main{max-width:1440px;margin:auto;padding:24px max(16px,5%) 48px}
h1{font-size:clamp(22px,3vw,32px);letter-spacing:-.5px;line-height:1.2;margin:0}
h2{font-size:20px;margin:0 0 14px}
p{margin:8px 0 16px}
.muted{color:var(--muted)}
.hint{color:var(--muted);font-size:14px;margin:6px 0 14px}
.hint .ico{width:16px;height:16px;vertical-align:-3px}
small{font-size:14px}
code{overflow-wrap:anywhere}

/* Icônes et boutons */
.ico{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
button,input,select{font:inherit}
button{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid var(--edge);background:#fff;color:#21375f;border-radius:12px;padding:9px 16px;cursor:pointer;min-height:44px;touch-action:manipulation;text-align:center}
button:not(:disabled):hover{background:#e9effb}
button:disabled{opacity:.45;cursor:default}
.primary,.active{background:var(--brand);color:#fff;border-color:var(--brand)}
.primary:not(:disabled):hover,.active:not(:disabled):hover{background:var(--brand-2)}
.danger{color:var(--bad)}
.danger:not(:disabled):hover{background:#fdecee}
button.icon{width:44px;padding:0;flex:none}
.link{border:0;background:none;color:var(--brand);text-decoration:underline;padding:8px 0;min-height:auto}
.link:not(:disabled):hover{background:none;color:var(--brand-2)}
.link:disabled{text-decoration:none}
.row,.people{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.row.between{justify-content:space-between;flex-wrap:nowrap}
.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:22px}
.actions .danger{margin-left:auto}

/* Formulaires */
input,select{display:block;width:100%;padding:11px 12px;border:1px solid #bac8de;border-radius:10px;background:#fff;color:var(--ink);min-height:46px}
input[type=checkbox]{width:22px;height:22px;min-height:0;accent-color:var(--brand);flex:none;margin:0}
label{display:block;margin:14px 0;font-weight:600}
label span{display:block;margin-bottom:6px}
label.inline{display:flex;align-items:center;gap:10px;font-weight:400}
input:focus,select:focus,button:focus-visible,summary:focus-visible{outline:3px solid #86acff;outline-offset:2px}
fieldset{border:0;padding:0;margin:14px 0}
legend{font-weight:600;padding:0;margin-bottom:8px}
.cols{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
.cols label{min-width:0}
.field{display:flex;gap:8px;align-items:center;margin:6px 0}
.field input{flex:1 1 auto;min-width:0}
.field>button:not(.icon){flex:none}
.field-label{font-weight:600;margin:4px 0 6px}
input.code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:20px;font-weight:700;letter-spacing:3px}
.days{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;max-width:440px}
.pill{margin:0;position:relative}
.pill input{position:absolute;opacity:0;width:1px;height:1px}
.pill span{display:grid;place-items:center;height:44px;margin:0;border:1px solid var(--edge);border-radius:12px;background:#fff;cursor:pointer;font-size:14px}
.pill input:checked+span{background:var(--brand);border-color:var(--brand);color:#fff}
.pill input:focus-visible+span{outline:3px solid #86acff;outline-offset:2px}

/* Écrans de connexion */
.panel{background:#fff;border:1px solid var(--line);border-radius:20px;padding:24px}
.auth{max-width:460px;margin:24px auto}
.auth h1{margin-bottom:4px}
.auth button:not(.link){width:100%;margin-top:10px}
.auth .link{display:flex;margin:10px auto 0}
.notice{background:var(--brand-soft);border-radius:14px;padding:12px 16px;margin:0 0 16px;font-size:15px}
.demo{background:#fff4cf;border:1px solid #e5ca6c}
.foot{margin-top:24px;font-size:14px;color:var(--muted)}

/* Tête du planning : salutation et score */
.top{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:12px}
.top>div:first-child{min-width:0}
.top h1{overflow-wrap:anywhere}
.eyebrow{margin:0 0 2px;color:var(--muted);font-size:14px;font-weight:600}
.score{display:grid;grid-template-columns:auto 1fr;align-items:baseline;column-gap:10px;min-width:230px;background:var(--brand);color:#fff;padding:12px 18px;border-radius:16px;flex:none}
.score strong{font-size:24px;line-height:1.1}
.score span{font-size:14px;opacity:.9}
.progress{height:8px;background:#dce4f4;border-radius:8px;overflow:hidden}
.progress div{height:100%;background:var(--ok);transition:width .3s}
.score .progress{grid-column:1/-1;margin-top:10px;background:#4e6bab}
.score .progress div{background:#79e3bc}

/* Barre de navigation, collée sous l'en-tête pendant le défilement */
.toolbar{position:sticky;top:var(--head);z-index:10;display:flex;align-items:center;gap:12px;flex-wrap:wrap;background:var(--bg);padding:10px 0}
.nav{display:flex;align-items:center;gap:8px;flex:0 1 auto;min-width:0}
.period{display:block;font-size:17px;padding:0 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.period::first-letter{text-transform:uppercase}
.seg{display:inline-flex;margin-left:auto;gap:4px;border:1px solid var(--edge);border-radius:12px;padding:3px;background:#fff}
.seg button{border:0;min-height:36px;border-radius:9px;padding:6px 12px}

/* Filtre par membre */
.people{margin:4px 0 16px;gap:8px}
.legend{display:inline-flex;align-items:center;gap:6px;border:1px solid #d7e0ee;background:#fff;border-radius:30px;padding:5px 14px 5px 6px;min-height:40px;color:inherit;flex:none}
.legend>.ico{width:18px;height:18px;margin-left:6px}
button.legend:not(:disabled):hover{background:#e9effb}
.legend.on{background:var(--brand-soft);border-color:var(--brand);box-shadow:inset 0 0 0 1px var(--brand)}
.people.filtering .legend:not(.on){opacity:.6}
.person{font-size:14px;display:inline-flex;gap:7px;align-items:center;min-width:0}
.avatar{display:inline-grid;place-items:center;background:var(--person,#4169e1);color:var(--on,#fff);width:28px;height:28px;border-radius:50%;font-size:13px;font-weight:700;flex-shrink:0}

/* Semaine et journées */
.week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:10px;align-items:stretch}
.day{min-width:0;background:#e9eef7;border-radius:16px;padding:8px}
.day.today{background:#dce7ff;box-shadow:inset 0 0 0 2px #648cf0}
.dayhead{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:0 0 8px;min-height:44px}
.dlink{display:inline-flex;align-items:center;border:0;background:none;padding:4px 8px;min-height:36px;font-weight:700;font-size:14px;color:inherit}
.dlink::first-letter{text-transform:uppercase}
.dayhead h2{font-size:18px;margin:0 4px}
.dayhead h2::first-letter{text-transform:uppercase}
button.addday{width:36px;min-height:36px;color:var(--brand);background:transparent;border-color:transparent}
button.addday:not(:disabled):hover{background:#fff}
.empty{color:#68758b;font-size:14px;padding:10px 6px}
.week.single{grid-template-columns:1fr;max-width:780px;margin:auto}
.single .day{padding:12px}

/* Carte de tâche : rond à cocher, titre et personne, actions en icônes */
.task{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;background:#fff;border:1px solid #e0e6f0;border-left:4px solid var(--person);border-radius:12px;padding:10px 12px;margin-bottom:8px}
.task:last-child{margin-bottom:0}
.task h3{font-size:16px;line-height:1.3;margin:0;overflow-wrap:anywhere}
.task.done{background:#f3fbf7}
.task.done h3{color:#4c6a5e;text-decoration:line-through;text-decoration-color:#9cc9b6}
.meta{display:flex;align-items:center;flex-wrap:wrap;gap:4px 10px;margin-top:4px;font-size:13px;color:var(--muted)}
.meta .person{font-size:13px;gap:6px}
.meta .avatar{width:20px;height:20px;font-size:11px}
.status{font-weight:700}
.task.late .status{color:var(--bad)}
.task.pending .status{color:var(--warn)}
.rot{display:inline-flex}
.rot .ico{width:15px;height:15px}
.check{width:42px;height:42px;min-height:42px;padding:0;border-radius:50%;border:2px solid #b8c5db;background:#fff;color:transparent;display:inline-grid;place-items:center;flex:none}
.check .ico{width:22px;height:22px;stroke-width:3}
@media(hover:hover){.task:not(.done):not(.pending) button.check:not(:disabled):hover{border-color:var(--ok);color:#9cc9b6;background:#fff}}
button.check:disabled{border-style:dashed;opacity:.6}
span.check{border-style:dashed;opacity:.7}
.task.late .check{border-color:#e3a1ad}
.task.done .check{background:var(--ok);border-color:var(--ok);color:#fff;border-style:solid;opacity:1}
.task.pending .check{background:var(--warn-soft);border-color:#e0a546;color:var(--warn);border-style:solid;opacity:1}
.task.pending .check .ico{stroke-width:2}
.pop{animation:pop .45s cubic-bezier(.3,1.6,.5,1)}
@keyframes pop{0%{transform:scale(.6)}60%{transform:scale(1.25)}100%{transform:scale(1)}}
.flame{display:inline-flex;align-items:center;gap:2px;flex:none;font-size:12px;font-weight:700;line-height:1;color:#a8460b;background:#fff1e0;border:1px solid #ffd4a8;border-radius:30px;padding:3px 7px;white-space:nowrap;vertical-align:middle}
.flame.big{font-size:.5em;padding:4px 9px;letter-spacing:0;position:relative;top:-.12em}
.confetti{position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;z-index:40}
@media(prefers-reduced-motion:reduce){.pop{animation:none}}
.medal{font-size:20px;line-height:1;flex:none}
.dayhead .medal{margin-right:auto}
.sday{position:relative}
.smedal{position:absolute;top:-7px;right:-5px;font-style:normal;font-size:15px;line-height:1}
.trophy{display:flex;align-items:center;gap:14px;background:linear-gradient(135deg,#fff7dc,#ffe7a6);border:1px solid #efc350;color:#5f4300;border-radius:14px;padding:12px 16px;margin:0 0 14px}
.trophy .cup{font-size:34px;line-height:1}
.trophy strong{display:block;font-size:17px}
.trophy span{font-size:14px}
.awards{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 0}
.awards span{font-size:13px;font-weight:600;color:#5f4300;background:#fff7dc;border:1px solid #f3d27d;border-radius:30px;padding:3px 9px}
.acts{display:flex;gap:8px}
.acts .icon{width:38px;min-height:38px;border-color:transparent;background:transparent;color:var(--muted)}
.acts .icon:not(:disabled):hover{background:#eef2f9;color:var(--ink)}
.acts .approve{background:var(--ok-soft);border-color:#b7e2cf;color:var(--ok)}
.acts .approve:not(:disabled):hover{background:#cfeee1;color:var(--ok)}
.acts .danger{color:var(--bad)}
.acts .danger:not(:disabled):hover{background:#fdecee;color:var(--bad)}

/* Bandeau des sept jours (téléphone) */
.strip{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;margin:0 0 12px}
.sday{flex-direction:column;gap:0;padding:6px 0;min-height:62px;border-radius:12px;line-height:1.2}
.sday span{font-size:12px;color:var(--muted)}
.sday span::first-letter{text-transform:uppercase}
.sday b{font-size:18px}
.sday i{font-style:normal;font-size:11px;color:var(--muted)}
.sday.today{box-shadow:inset 0 0 0 2px #648cf0}
.sday.full i{color:var(--ok);font-weight:700}
.sday.late i{color:var(--bad);font-weight:700}
.sday.sel,.sday.sel:not(:disabled):hover{background:var(--brand);border-color:var(--brand);color:#fff}
.sday.sel span,.sday.sel i{color:#dfe7fb}

/* Modales */
dialog{border:0;border-radius:20px;padding:0;width:min(600px,94vw);max-height:90dvh;overflow:hidden;color:var(--ink);box-shadow:0 20px 80px #132b5260}
dialog[open]{display:flex;flex-direction:column}
dialog::backdrop{background:#12223b80}
.modal-head{flex:none;gap:12px;padding:14px 16px 12px 24px;border-bottom:1px solid #dbe2ef}
.modal-head h2{margin:0;font-size:20px}
.modal-head h2::first-letter{text-transform:uppercase}
.modal-body{overflow:auto;min-height:0;padding:16px 24px 24px;overscroll-behavior:contain}
.section{border:1px solid var(--line);border-radius:14px;margin:0 0 10px;background:#fff}
.section>summary{list-style:none;display:flex;align-items:center;gap:12px;padding:12px 16px;min-height:52px;font-weight:700;cursor:pointer;border-radius:14px}
.section>summary::-webkit-details-marker{display:none}
.section>summary .ico{color:var(--brand)}
.section>summary::after{content:"";margin-left:auto;width:8px;height:8px;border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:translateY(-2px) rotate(45deg);transition:transform .2s}
.section[open]>summary::after{transform:translateY(2px) rotate(-135deg)}
.section>summary:hover{background:#f6f8fc}
.section-body{padding:2px 16px 16px}
.section-body>:first-child{margin-top:0}
.profil{border:1px solid var(--line);border-radius:12px;padding:8px 8px 8px 12px;margin:8px 0}
.profil-head{display:flex;align-items:center;gap:12px}
.who{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.3}
.who strong{overflow-wrap:anywhere}
.who small{color:var(--muted);font-size:13px;overflow-wrap:anywhere}
.profil .field{margin:8px 4px 4px 0}
#newmember{margin-top:12px}
.swatch{position:relative;display:inline-grid;margin:0;flex:none;cursor:pointer;border-radius:50%}
.swatch .avatar{display:grid;width:40px;height:40px;margin:0;font-size:16px;box-shadow:0 0 0 2px #fff,0 0 0 3px var(--edge)}
.swatch:hover .avatar,.swatch:focus-within .avatar{box-shadow:0 0 0 2px #fff,0 0 0 4px #86acff}
.swatch input{position:absolute;inset:0;width:100%;height:100%;min-height:0;padding:0;border:0;opacity:0;cursor:pointer}
.assign{margin:8px 0 2px;font-size:14px}
.line{display:flex;gap:8px;align-items:center;margin:10px 0}
.line input{flex:1 1 auto;min-width:0}
.line select{flex:0 1 150px;width:auto}
#addline{margin:4px 0 8px}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{display:inline-flex;border:1px solid var(--edge);border-radius:20px;overflow:hidden;background:#fff}
.chip button{border:0;border-radius:0;min-height:38px;padding:6px 12px;font-size:14px}
.chip button+button{padding:6px 12px;color:var(--muted);border-left:1px solid #e0e6f0}

/* Messages */
#toast{position:fixed;bottom:calc(24px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);padding:12px 20px;border-radius:12px;background:#192640;color:#fff;display:none;z-index:30;width:max-content;max-width:min(560px,calc(100vw - 32px));text-align:center;box-shadow:0 8px 24px #0003}
.alert{background:#fdecee;border:1px solid #eab3bc;border-left:4px solid var(--bad);border-radius:14px;padding:12px 16px;margin:0 0 16px;color:#5c0f1c}
.alert strong{display:block;font-size:16px;color:#8c1328}
.alert p{margin:4px 0 10px;font-size:14px}
.alert p:last-child{margin-bottom:0}
.alert .primary{background:var(--bad);border-color:var(--bad)}
.alert .primary:not(:disabled):hover{background:#d13a52}

/* Grand écran : sept colonnes étroites, les actions passent sous le titre */
@media(min-width:1101px){
.week:not(.single) .task{grid-template-columns:auto minmax(0,1fr);gap:8px;padding:8px}
.week:not(.single) .task .check{width:34px;height:34px;min-height:34px}
.week:not(.single) .task .check .ico{width:18px;height:18px}
.week:not(.single) .task h3{font-size:15px}
.week:not(.single) .acts{grid-column:2;justify-content:flex-end;margin:-4px -2px -2px 0}
.week:not(.single) .acts .icon{width:34px;min-height:34px}
.week:not(.single) .acts .ico{width:18px;height:18px}
}
@media(max-width:1100px){.week{grid-template-columns:repeat(3,minmax(0,1fr))}
.fab{width:44px;padding:0}
.fab span{display:none}}

/* Téléphone */
@media(max-width:650px){
:root{--head:56px}
header{padding:0 12px 0 16px}
.brand{font-size:17px;gap:8px}
.logo{width:32px;height:32px;border-radius:9px;font-size:18px}
main{padding:14px 16px calc(96px + env(safe-area-inset-bottom))}
.panel{padding:20px}
.auth{margin:8px auto}
.top{gap:12px;margin-bottom:6px}
.score{min-width:0;width:112px;padding:8px 12px;border-radius:14px}
.score strong{font-size:19px}
.score span{display:none}
.score .progress{margin-top:6px;height:6px}
.toolbar{position:static;padding:4px 0}
.seg{display:none}
.nav{flex:1 1 auto}
.period{flex:1;text-align:center;font-size:16px}
.people{flex-wrap:nowrap;overflow-x:auto;margin:6px -16px 12px;padding:2px 16px;scrollbar-width:none}
.people::-webkit-scrollbar{display:none}
.fab{position:fixed;right:16px;bottom:calc(16px + env(safe-area-inset-bottom));z-index:15;width:58px;height:58px;padding:0;border-radius:18px;box-shadow:0 8px 24px #183c9166}
.fab span{display:none}
.fab .ico{width:28px;height:28px}
.single .day{padding:10px}
.dayhead h2{font-size:17px}
.week~.foot{display:none}
#toast{bottom:calc(88px + env(safe-area-inset-bottom))}
dialog{width:100%;max-width:100%;margin:auto 0 0;max-height:94dvh;border-radius:20px 20px 0 0}
.modal-head{padding:10px 10px 10px 20px}
.modal-body{padding:14px 16px calc(20px + env(safe-area-inset-bottom))}
.section-body{padding:2px 12px 14px}
.cols:not(.two){grid-template-columns:1fr}
.line{flex-wrap:wrap}
.line input{flex-basis:calc(100% - 52px)}
.line select{flex:1 1 auto;order:3}
.actions>button{flex:1 1 auto}
.actions .danger{margin-left:0}
}
