:root {
  --bg: #F5F5EF; --card: #FFFFFF; --ink: #17201B; --muted: #5C665F; --line: #D3D9D0; --soft: #E4E8E1;
  --green: #1F7A55; --green-soft: #E3F1E9; --late: #9A4A0B; --late-soft: #FDEBD8; --sig: #1D3E9E; --sig-soft: #DCE7FF;
  --head: 'Bricolage Grotesque', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 Inter, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
h1, h2 { margin: 0; }
.screen { max-width: 520px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 20px calc(110px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.muted { color: var(--muted); }
.top { display: flex; justify-content: space-between; align-items: flex-end; }
.top p { margin: 0; font-size: 14px; font-weight: 500; }
h1 { font-family: var(--head); font-size: 36px; font-weight: 800; letter-spacing: -0.5px; }
.count { margin: 0 0 6px !important; font-family: var(--head); font-size: 22px !important; font-weight: 600 !important; color: var(--green); }
.count span { color: var(--muted); font-size: 16px; }
.bar { height: 8px; margin-top: -4px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar div { height: 100%; background: var(--green); border-radius: 99px; transition: width .4s ease; }

.shortcuts { display: flex; flex-wrap: wrap; gap: 10px; }
.sc { width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 1.5px solid var(--line); background: #F0F4EE; display: flex; align-items: center; justify-content: center; transition: transform .1s; }
.sc:active { transform: scale(.92); }
.sc.on { background: var(--green-soft); border-color: var(--green); }
.sc.more { background: transparent; border-style: dashed; border-color: #8A958D; }
.other { display: flex; gap: 8px; margin-top: -6px; }
.other input { flex: 1; min-width: 0; height: 44px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--card); }

.chips { display: flex; gap: 8px; }
.chip { height: 40px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task { background: var(--card); border-radius: 18px; padding: 12px 14px 12px 12px; display: flex; align-items: center; gap: 12px; transition: opacity .3s; }
.task.done { opacity: .72; }
.task.done .title { text-decoration: line-through; }
.check { width: 44px; height: 44px; flex: none; padding: 0; border-radius: 50%; border: 2px solid #8A958D; background: var(--card); display: flex; align-items: center; justify-content: center; transition: background .2s, transform .15s; }
.task.done .check { background: var(--green); border-color: var(--green); }
.check:active { transform: scale(.9); }
.body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.title { font-size: 16px; font-weight: 600; }
.meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.badge { align-self: flex-start; margin-top: 2px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.badge.late { color: var(--late); background: var(--late-soft); }
.badge.sig { color: var(--sig); background: var(--sig-soft); }
.avs { display: flex; flex: none; }
.x { width: 36px; height: 44px; flex: none; margin: 0 -8px 0 -4px; padding: 0; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.av { width: 32px; height: 32px; border-radius: 50%; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; border: 2px solid var(--card); }
.avs .av + .av { margin-left: -10px; }
.av.small { width: 26px; height: 26px; font-size: 12px; }
.av.ghost { opacity: .45; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(76px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--soft); display: flex; align-items: center; justify-content: space-around; }
nav.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 500; text-decoration: none; color: var(--muted); min-width: 64px; }
nav.tabs a[aria-current] { color: var(--green); font-weight: 600; }
nav.tabs a.plus { width: 56px; min-width: 0; height: 56px; border-radius: 50%; background: var(--ink); color: #fff; justify-content: center; margin-top: -18px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); max-width: 488px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 16px; padding: 6px 6px 6px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 24px rgba(23,32,27,.25); animation: up .2s ease; z-index: 5; }
.toast span { flex: 1; font-size: 14px; padding: 8px 0; }
.toast button { height: 44px; padding: 0 12px; border: 0; background: transparent; color: #9FE0BE; font-weight: 600; font-size: 14px; }
@keyframes up { from { transform: translateY(20px); opacity: 0; } }

/* Tout est fait */
.fini { position: fixed; inset: 0; overflow: hidden; background: #1E5A41; color: #FFF8E1; text-align: center; display: flex; flex-direction: column; align-items: center; padding: calc(56px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom)); }
.fini > * { position: relative; max-width: 440px; }
.fini h1 { margin-top: 24px; font-size: 42px; line-height: 1.05; }
.fini p { margin: 14px 0 0; font-size: 17px; color: #D7E8DD; max-width: 320px; }
.fini .sun { animation: spin 40s linear infinite; }
.fini .stats { margin-top: 26px; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fini .stats div { background: #24684C; border-radius: 16px; padding: 14px 8px; display: flex; flex-direction: column; }
.fini .stats b { font-family: var(--head); font-size: 26px; color: #FFCF4D; }
.fini .stats span { font-size: 12px; color: #D7E8DD; }
.fini .demain { margin-top: 12px; width: 100%; background: #FFF8E1; color: var(--ink); border-radius: 18px; padding: 16px; text-align: left; font-size: 15px; font-weight: 500; }
.fini .demain small { display: block; font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.fini .shortcuts { margin-top: auto; justify-content: center; padding-top: 20px; }
.fini .sc { background: #24684C; border-color: #3C7E61; color: #FFF8E1; }
.fini .sc.on { background: #FFCF4D; border-color: #FFCF4D; color: var(--ink); }
.fini .sc.more { display: none; }
.fini .back { margin-top: 16px; height: 48px; padding: 0 24px; border-radius: 99px; border: 1.5px solid #D7E8DD; background: transparent; color: #FFF8E1; font-weight: 600; font-size: 15px; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear infinite; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(540deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .confetti, .fini .sun { animation: none; display: none; } }

/* Planning */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week button { border: 2px solid transparent; border-radius: 14px; padding: 6px 0 8px; background: var(--card); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.week button.today { background: var(--green); color: #fff; }
.week button[aria-pressed="true"] { border-color: var(--ink); }
.week span { font-size: 12px; font-weight: 500; }
.week b { font-size: 17px; font-weight: 600; }
.week small { font-size: 11px; font-weight: 500; opacity: .85; min-height: 14px; }
h2.sec { margin: 4px 4px 0; font-size: 13px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.list { background: var(--card); border-radius: 18px; padding: 4px 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; text-decoration: none; color: inherit; min-height: 44px; }
.row + .row { border-top: 1px solid #EDEFE9; }
.row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row .when { font-size: 12px; font-weight: 600; color: var(--muted); }
.row .when.today { color: var(--green); }
.row .when.late { color: var(--late); }
.row .ic { width: 36px; height: 36px; flex: none; border-radius: 50%; background: #F0F4EE; display: flex; align-items: center; justify-content: center; }
.card { background: var(--card); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card p { margin: 0; font-size: 14px; color: var(--muted); }

/* Formulaire */
.formtop { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.formtop a, .formtop span { width: 70px; font-weight: 500; text-decoration: none; }
.formtop h1 { font-size: 22px; }
label.lbl, .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.field { height: 48px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--card); width: 100%; }
textarea.field { height: auto; padding: 12px 14px; resize: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; background: #EEF0EA; border-radius: 12px; padding: 4px; }
.seg button { height: 40px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--card); font-weight: 600; box-shadow: 0 1px 3px rgba(23,32,27,.15); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper div { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 20px; }
.stepper b { min-width: 28px; text-align: center; font-size: 18px; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days button, .people button, .icons button { height: 44px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font-size: 14px; font-weight: 600; }
.days button[aria-pressed="true"], .icons button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.people { display: flex; gap: 8px; }
.people button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; }
.people button[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }
.icons { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.icons button { display: flex; align-items: center; justify-content: center; padding: 0; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: 15px; }
.switch input { width: 22px; height: 22px; accent-color: var(--green); margin: 0; }
.summary { background: var(--green-soft); border-radius: 18px; padding: 14px 16px; font-size: 14px; }
.primary { height: 54px; border: 0; border-radius: 16px; background: var(--ink); color: #fff; font-size: 16px; font-weight: 600; width: 100%; }
.danger { height: 48px; border: 0; background: transparent; color: #B3261E; font-weight: 600; }
.err { color: #B3261E; font-size: 14px; margin: 0; }

/* Connexion */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 14px; max-width: 360px; margin: 0 auto; padding: 24px; }
.login img { width: 72px; height: 72px; border-radius: 18px; }
