:root {
  --bg: #F2F2F7; --card: #FFFFFF; --card2: #F2F2F7; --text: #000; --text2: #3C3C43; --muted: #8E8E93;
  --sep: rgba(60, 60, 67, .16); --fill: rgba(120, 120, 128, .12); --fill2: rgba(120, 120, 128, .2);
  --accent: #007AFF; --good: #34C759; --mid: #FF9500; --bad: #FF3B30; --future: #C7C7CC;
  --bar: rgba(249, 249, 249, .86);
  --r: 14px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: calc(54px + var(--safe-b));
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000; --card: #1C1C1E; --card2: #2C2C2E; --text: #fff; --text2: #EBEBF5; --muted: #8E8E93;
    --sep: rgba(84, 84, 88, .55); --fill: rgba(120, 120, 128, .24); --fill2: rgba(120, 120, 128, .36);
    --accent: #0A84FF; --good: #30D158; --mid: #FF9F0A; --bad: #FF453A; --future: #48484A;
    --bar: rgba(22, 22, 24, .86);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body {
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }

#app { height: 100%; }
#view {
  position: fixed; inset: 0; bottom: var(--tab-h); overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 8px) 16px 96px;
}
#app.onboarding #view { bottom: 0; }
#app.onboarding #tabbar, #app.onboarding #fab { display: none; }

/* --- Barre d'onglets --- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab-h); padding-bottom: var(--safe-b);
  display: flex; background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep); z-index: 20;
}
#tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 10.5px; font-weight: 500; }
#tabbar svg { width: 26px; height: 26px; }
#tabbar button.on { color: var(--accent); }

#fab {
  position: fixed; right: 18px; bottom: calc(var(--tab-h) + 16px); width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; z-index: 15;
  box-shadow: 0 8px 22px rgba(0, 122, 255, .35), 0 2px 6px rgba(0, 0, 0, .15); transition: transform .15s;
}
#fab:active { transform: scale(.92); }
#fab svg { width: 28px; height: 28px; }
#fab[hidden] { display: none; }

/* --- Titres --- */
.large-title { padding: 10px 4px 14px; }
.large-title h1 { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; padding: 8px 6px; line-height: 1.4; }
.center { text-align: center; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 20px 6px 8px; }
.section-head h4 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.section-head .muted, .section-head .link { font-size: 15px; }

.good-t { color: var(--good); } .mid-t { color: var(--mid); } .bad-t { color: var(--bad); } .none-t { color: var(--muted); }

.card { background: var(--card); border-radius: var(--r); padding: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.link { color: var(--accent); font-size: 16px; }
.link.bold { font-weight: 600; }
.link.danger { color: var(--bad); }
.btn { background: var(--accent); color: #fff; border-radius: 12px; padding: 13px 18px; font-weight: 600; font-size: 16px; }
.btn.ghost { background: var(--fill); color: var(--accent); }
.btn:disabled { opacity: .5; }
.btn:active, .link:active { opacity: .6; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); font-size: 26px; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { background: var(--fill); }
.icon-btn:disabled { color: var(--future); }

/* --- Résumé du jour --- */
.summary { display: flex; align-items: center; gap: 18px; padding: 18px; }
.summary .big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.summary .big span { font-size: 24px; color: var(--muted); font-weight: 700; }
.summary .muted { margin: 4px 0 6px; font-size: 15px; }
.summary .link { font-size: 15px; font-weight: 600; }

.ring { position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-bg { stroke: var(--fill); }
.ring-fg { transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1); stroke: var(--future); }
.ring-good .ring-fg { stroke: var(--good); } .ring-mid .ring-fg { stroke: var(--mid); } .ring-bad .ring-fg { stroke: var(--bad); }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.ring-label small { font-size: .55em; font-weight: 700; color: var(--muted); }

.banner { width: 100%; display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 14px; border-radius: var(--r);
  background: color-mix(in srgb, var(--bad) 12%, var(--card)); color: var(--text); font-size: 15px; text-align: left; }
.banner-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); flex: none; }
.banner span:nth-child(2) { flex: 1; }
.banner-cta { color: var(--bad); font-weight: 600; }

/* --- Lignes de tâches --- */
.list { background: var(--card); border-radius: var(--r); overflow: hidden; }
.task { display: flex; align-items: center; gap: 12px; padding: 11px 14px; position: relative; }
.task + .task, .recap-row + .recap-row { border-top: .5px solid var(--sep); }
.recap-row + .recap-row .task { border: 0; }
.check {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--future); display: grid; place-items: center;
  color: transparent; transition: background .2s, border-color .2s, transform .15s;
}
.check svg { width: 17px; height: 17px; transform: scale(.4); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.check:active { transform: scale(.85); }
.check.sm { width: 22px; height: 22px; border-width: 1.6px; }
.check.sm svg { width: 13px; height: 13px; }
.st-pending .check { border-color: var(--mid); }
.st-missed .check, .st-moved .check { border-color: var(--bad); }
.st-done .check { background: var(--good); border-color: var(--good); color: #fff; }
.st-done .check svg { transform: scale(1); }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }
.st-moved .task-title { color: var(--muted); }
.task-sub { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.task-sub .ico svg { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; }
.prio { color: var(--bad); font-weight: 800; margin-right: 4px; }
.cat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; flex: none; }
.cat-dot.lg { width: 12px; height: 12px; margin-right: 10px; vertical-align: -1px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-left: 2px; }
.tag-missed { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.tag-moved { background: var(--fill); color: var(--muted); }
.recap-row { display: flex; align-items: center; padding-right: 12px; }
.recap-row .task { flex: 1; min-width: 0; }
.pill { flex: none; background: var(--fill); color: var(--accent); font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 99px; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-ico { font-size: 44px; width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; background: var(--card); display: grid; place-items: center; color: var(--good); font-weight: 800; }
.empty p { margin-bottom: 16px; }
.empty.small { padding: 18px; background: var(--card); border-radius: var(--r); }
.empty.small p { margin-bottom: 6px; }

/* --- Contrôle segmenté --- */
.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; }
.seg button { flex: 1; padding: 7px 4px; font-size: 14px; font-weight: 500; border-radius: 7px; transition: background .2s; }
.seg button.on { background: var(--card); font-weight: 600; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #636366; } }
.cal-seg { margin: 6px 0 10px; }

/* --- Calendrier --- */
.cal-nav { display: flex; align-items: center; gap: 4px; padding: 4px 0 10px; }
.cal-nav h2 { font-size: 22px; font-weight: 700; flex: 1; text-align: center; letter-spacing: -.01em; }
.today-btn { flex: none; margin-left: 2px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--fill); padding: 4px 10px; border-radius: 99px; }
.month { padding: 10px 6px 6px; }
.wd-head, .mgrid { display: grid; grid-template-columns: repeat(7, 1fr); }
.wd-head span { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding-bottom: 6px; }
.mcell { height: 56px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 3px; }
.mcell .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; font-weight: 500; transition: background .2s; }
.mcell.out { opacity: .3; }
.mcell.today .num { color: var(--accent); font-weight: 700; }
.mcell .tint-good { background: color-mix(in srgb, var(--good) 24%, transparent); }
.mcell .tint-mid { background: color-mix(in srgb, var(--mid) 24%, transparent); }
.mcell .tint-bad { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.mcell.sel .num { background: var(--text); color: var(--bg); font-weight: 700; }
.mcell.today.sel .num { background: var(--accent); color: #fff; }
.mdots { height: 14px; display: flex; align-items: center; }
.mdots .pct { font-style: normal; font-size: 10px; font-weight: 700; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.dot.future { background: var(--future); } .dot.good { background: var(--good); } .dot.mid { background: var(--mid); } .dot.bad { background: var(--bad); }

.badge { display: inline-block; min-width: 42px; text-align: center; font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 99px; color: #fff; background: var(--future); }
.badge.good { background: var(--good); } .badge.mid { background: var(--mid); } .badge.bad { background: var(--bad); }
.badge.future { background: var(--fill2); color: var(--text2); }

.week-sum, .day-sum { display: flex; align-items: center; gap: 10px; padding: 0 6px 10px; font-size: 15px; }
.week-sum .link, .day-sum .link { margin-left: auto; font-size: 15px; }
.wlist { padding: 0 12px; }
.wrow { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 0; text-align: left; }
.wrow + .wrow { border-top: .5px solid var(--sep); }
.wrow-day { width: 40px; flex: none; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.wrow-day span { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.wrow-day b { font-size: 21px; font-weight: 600; }
.wrow.today .wrow-day b, .wrow.today .wrow-day span { color: var(--accent); }
.wrow-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.wrow-pct { flex: none; }
.chip-mini { font-size: 12px; padding: 3px 7px; border-radius: 6px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--fill); }
.chip-mini.st-done { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.chip-mini.st-missed, .chip-mini.st-moved { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.chip-mini.st-pending { background: color-mix(in srgb, var(--mid) 18%, transparent); color: var(--mid); }
.chip-mini.more { color: var(--muted); }

.strip { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 12px; }
.strip-day { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; }
.strip-day span { font-size: 11px; color: var(--muted); font-weight: 600; }
.strip-day b { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; font-weight: 500; }
.strip-day.today b { color: var(--accent); font-weight: 700; }
.strip-day.sel b { background: var(--text); color: var(--bg); }
.strip-day.today.sel b { background: var(--accent); color: #fff; }

.timeline { position: relative; margin-top: 14px; }
.hour { position: absolute; left: 0; right: 0; height: 0; border-top: .5px solid var(--sep); }
.hour span { position: absolute; top: -8px; left: 0; font-size: 11px; color: var(--muted); background: var(--bg); padding-right: 6px; font-variant-numeric: tabular-nums; }
.now { position: absolute; left: 46px; right: 0; height: 2px; background: var(--bad); z-index: 3; }
.now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.ev {
  position: absolute; border-radius: 8px; padding: 4px 6px; display: flex; gap: 6px; align-items: flex-start; overflow: hidden; z-index: 2;
  background: color-mix(in srgb, var(--c) 20%, var(--card)); border-left: 3px solid var(--c);
}
.ev-txt { flex: 1; min-width: 0; font-size: 13px; line-height: 1.2; cursor: pointer; }
.ev-txt b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-txt span { color: var(--muted); font-size: 12px; }
.ev.st-done { background: color-mix(in srgb, var(--good) 18%, var(--card)); border-left-color: var(--good); }
.ev.st-done b { text-decoration: line-through; color: var(--muted); }
.ev.st-missed, .ev.st-moved { background: color-mix(in srgb, var(--bad) 14%, var(--card)); border-left-color: var(--bad); }

/* --- Progrès --- */
.stat { padding: 14px; }
.mini-lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-val { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0; }
.stat-val small { font-size: 18px; font-weight: 700; }
.stat .muted { font-size: 13px; }
.cta { width: 100%; display: flex; justify-content: space-between; margin-top: 10px; font-weight: 600; color: var(--accent); }
.chart { width: 100%; height: auto; }
.chart .g { stroke: var(--sep); stroke-width: 1; }
.chart .g80 { stroke: var(--good); stroke-dasharray: 3 4; opacity: .7; }
.chart text { font-size: 10px; fill: var(--muted); text-anchor: middle; font-family: inherit; }
.chart text.v { fill: var(--text2); font-weight: 600; }
.chart .trend { fill: none; stroke: var(--text); stroke-width: 1.5; opacity: .35; stroke-linejoin: round; }
.c-good { fill: var(--good); background: var(--good); } .c-mid { fill: var(--mid); background: var(--mid); } .c-bad { fill: var(--bad); background: var(--bad); }
.c-none { fill: var(--fill2); }
.chart rect.cur { opacity: .85; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.heat { width: 100%; height: auto; }
.heat text { font-size: 8px; fill: var(--muted); font-family: inherit; }
.h-empty { fill: var(--fill); background: var(--fill); }
.h-bad { fill: var(--bad); background: var(--bad); opacity: .75; }
.h-mid { fill: var(--mid); background: var(--mid); opacity: .85; }
.h-good { fill: var(--good); background: var(--good); opacity: .7; }
.h-perfect { fill: var(--good); background: var(--good); }
.hbar + .hbar { margin-top: 12px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.hbar-top span:last-child { color: var(--muted); font-size: 13px; }
.hbar-track { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; background: var(--future); transition: width .5s; }
.hbar-fill.good { background: var(--good); } .hbar-fill.mid { background: var(--mid); } .hbar-fill.bad { background: var(--bad); }

/* --- Réglages / formulaires --- */
.group { background: var(--card); border-radius: var(--r); overflow: hidden; margin-bottom: 4px; }
.form .group { margin-bottom: 18px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 8px 16px; width: 100%; text-align: left; font-size: 17px;
}
.group > * + * { border-top: .5px solid var(--sep); }
.row.sub { padding-left: 32px; }
.row-label { padding: 12px 16px 6px; font-size: 14px; color: var(--muted); line-height: 1.4; }
.chev { color: var(--future); font-size: 20px; }
.link-row { color: var(--accent); }
.danger-btn { color: var(--bad); justify-content: center; }
.btn-row-full { justify-content: center; color: var(--accent); font-weight: 600; }
.row input[type=date], .row input[type=time], .row select {
  font: inherit; font-size: 16px; color: var(--accent); background: var(--fill); border: 0; border-radius: 8px; padding: 6px 10px; min-height: 34px; text-align: right;
  -webkit-appearance: none; appearance: none;
}
.row select { text-align-last: right; max-width: 60%; }
.title-input, .form textarea, .login-form input {
  width: 100%; font: inherit; font-size: 17px; color: var(--text); background: transparent; border: 0; padding: 13px 16px; outline: none; resize: none;
}
.title-input { font-size: 19px; font-weight: 600; }
.form textarea { font-size: 16px; color: var(--text2); }
.login-form { padding: 4px 0 12px; }
.login-form input { background: var(--fill); border-radius: 10px; margin: 8px 16px 0; width: calc(100% - 32px); font-size: 16px; padding: 12px 14px; }
.btn-row { display: flex; gap: 8px; padding: 12px 16px 0; }
.btn-row .btn { flex: 1; }

.switch {
  -webkit-appearance: none; appearance: none; flex: none; width: 51px; height: 31px; border-radius: 99px; background: var(--fill2); position: relative; transition: background .25s; cursor: pointer; margin: 0;
}
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .25s cubic-bezier(.3, .9, .4, 1.1); }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(20px); }

.days { display: flex; gap: 6px; width: 100%; justify-content: space-between; }
.day-chip { width: 38px; height: 38px; border-radius: 50%; background: var(--fill); font-weight: 600; font-size: 15px; }
.day-chip.on { background: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 14px; }
.chip { display: flex; align-items: center; padding: 7px 12px; border-radius: 99px; background: var(--fill); font-size: 15px; border: 2px solid transparent; }
.chip.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); font-weight: 600; }
.prio-seg { margin: 2px 12px 12px; }
.colors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; padding: 16px; justify-items: center; }
.color { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 2px var(--card); }
.color.on { border-color: var(--text); }

.editor .when-time, .editor .when-weekly, .editor .when-repeat, .editor .when-until { display: none; }
.editor.has-time .when-time, .editor.is-weekly .when-weekly, .editor.is-repeat .when-repeat, .editor.has-until .when-until { display: flex; }
.editor .group .hint { padding: 10px 16px; }

.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* --- Feuilles --- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); opacity: 0; transition: opacity .28s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - var(--safe-t) - 14px); background: var(--bg);
  border-radius: 14px 14px 0 0; transform: translateY(100%); transition: transform .32s cubic-bezier(.2, .9, .25, 1);
  display: flex; flex-direction: column; box-shadow: 0 -4px 30px rgba(0, 0, 0, .2);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--fill2); margin: 7px auto 0; flex: none; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px calc(24px + var(--safe-b)); }
.sheet.editor { height: calc(100% - var(--safe-t) - 14px); }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 0 16px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.sheet-head h3 { font-size: 17px; font-weight: 600; }
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
body.has-sheet #view { overflow: hidden; }

.sheet.actions { background: transparent; box-shadow: none; padding: 0 8px; }
.sheet.actions .grabber { display: none; }
.sheet.actions .sheet-body { padding: 0 0 calc(8px + var(--safe-b)); }
.as-title { background: var(--card); border-radius: 14px 14px 0 0; text-align: center; color: var(--muted); font-size: 13px; padding: 14px 16px; border-bottom: .5px solid var(--sep); }
.as-group { background: var(--card); border-radius: 0 0 14px 14px; overflow: hidden; }
.as-title + .as-group { border-radius: 0 0 14px 14px; }
.as-group:first-child { border-radius: 14px; }
.as-btn { display: block; width: 100%; padding: 17px; font-size: 19px; color: var(--accent); text-align: center; }
.as-btn + .as-btn { border-top: .5px solid var(--sep); }
.as-btn.danger { color: var(--bad); }
.as-cancel { background: var(--card); border-radius: 14px; margin-top: 8px; font-weight: 600; }
.as-btn:active { background: var(--fill); }

/* --- Bilans --- */
.recap-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0 10px; }
.recap-hero .ring-label { font-size: 34px; }
.recap-big { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.recap-big span { color: var(--muted); font-weight: 600; font-size: 18px; }
.recap-msg { font-size: 16px; color: var(--text2); max-width: 300px; }
.delta { font-weight: 700; font-size: 16px; }
.delta span { font-weight: 400; color: var(--muted); font-size: 14px; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.week-nav { display: flex; align-items: center; justify-content: space-between; font-weight: 600; padding-bottom: 8px; }
.wbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wbar { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wbar-val { font-size: 11px; font-weight: 700; color: var(--text2); height: 14px; }
.wbar-track { width: 100%; max-width: 30px; height: 110px; background: var(--fill); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.wbar-fill { width: 100%; border-radius: 8px; background: var(--future); transition: height .5s; }
.wbar-fill.good { background: var(--good); } .wbar-fill.mid { background: var(--mid); } .wbar-fill.bad { background: var(--bad); }
.wbar-fill.future { background: var(--fill2); }
.wbar-lbl { font-size: 12px; font-weight: 600; }
.wbar-sub { font-size: 11px; color: var(--muted); }
.mini { text-align: center; }
.mini-val { font-weight: 700; font-size: 17px; margin-top: 2px; }

/* --- Accueil --- */
.onboard { max-width: 420px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 30px 4px; }
.onboard-logo { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.onboard h1 { font-size: 34px; font-weight: 800; }
.onboard .login-form { width: 100%; background: var(--card); border-radius: var(--r); }
.install-tip { font-size: 15px; text-align: left; line-height: 1.45; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 90px); transform: translate(-50%, 20px); background: rgba(30, 30, 32, .92); color: #fff;
  padding: 11px 18px; border-radius: 14px; font-size: 15px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
  max-width: calc(100% - 40px); text-align: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  #view { padding-left: calc(50% - 320px); padding-right: calc(50% - 320px); }
  .sheet { max-width: 640px; margin: 0 auto; }
}

/* =========================================================
   MOTION DESIGN — transitions, ressorts, lumière, célébrations
   ========================================================= */
:root { --spring: cubic-bezier(.2, 1.25, .35, 1); --ease: cubic-bezier(.16, 1, .3, 1); --glow-a: rgba(10, 132, 255, .16); --glow-b: rgba(191, 90, 242, .12); --glow-c: rgba(48, 209, 88, .10); }
@media (prefers-color-scheme: dark) { :root { --glow-a: rgba(10, 132, 255, .22); --glow-b: rgba(191, 90, 242, .18); --glow-c: rgba(48, 209, 88, .12); } }

/* Lumière d'ambiance qui dérive lentement derrière l'app */
#app::before {
  content: ""; position: fixed; inset: -30% -30% auto; height: 90vh; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 50% at 20% 30%, var(--glow-a), transparent 70%),
    radial-gradient(35% 45% at 80% 20%, var(--glow-b), transparent 70%),
    radial-gradient(30% 40% at 55% 60%, var(--glow-c), transparent 70%);
  filter: blur(30px); animation: aurora 22s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(6%, 4%, 0) rotate(8deg) scale(1.08); }
  100% { transform: translate3d(-5%, 2%, 0) rotate(-6deg) scale(1.04); }
}
#view { z-index: 1; background: transparent; }

/* Cartes : relief doux, liseré lumineux, pression à ressort */
.card, .list, .banner {
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px -12px rgba(0, 0, 0, .12);
  transition: transform .45s var(--spring), box-shadow .3s;
}
@media (prefers-color-scheme: dark) { .card, .list, .banner { box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 10px 30px -14px rgba(0, 0, 0, .8); } }
button.card:active, .banner:active, .mcell:active, .row-link:active { transform: scale(.97); transition-duration: .12s; }
.btn { transition: transform .4s var(--spring), opacity .2s, box-shadow .3s; box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn:active { transform: scale(.95); opacity: .9; }
.task { transition: background .25s; }
.task:active { background: var(--fill); }

/* Titres : apparition avec flou (effet objectif) */
.large-title h1 { background: linear-gradient(180deg, var(--text) 30%, color-mix(in srgb, var(--text) 70%, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* --- Entrées de page en cascade --- */
.enter-up > * { animation: riseIn .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
.enter-up > .large-title { animation-name: titleIn; animation-duration: .9s; }
.enter-fade > * { animation: fadeIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.enter-left > * { animation: slideL .55s var(--ease) both; }
.enter-right > * { animation: slideR .55s var(--ease) both; }
.enter-sheet > * { animation: riseIn .7s var(--ease) both; animation-delay: calc(80ms + var(--i, 0) * 50ms); }
.enter-up .list > .task { animation: rowIn .7s var(--ease) both; animation-delay: calc(180ms + var(--j, 0) * 45ms); }
.enter-up .mcell, .enter-fade .mcell { animation: cellIn .6s var(--spring) both; animation-delay: calc(var(--j, 0) * 9ms); }
@keyframes riseIn { from { opacity: 0; transform: translate3d(0, 22px, 0) scale(.985); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes titleIn { from { opacity: 0; transform: translate3d(0, 14px, 0); filter: blur(12px); letter-spacing: .02em; } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes fadeIn { from { opacity: 0; transform: scale(.99); } to { opacity: 1; transform: none; } }
@keyframes slideL { from { opacity: 0; transform: translate3d(40px, 0, 0); filter: blur(4px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes slideR { from { opacity: 0; transform: translate3d(-40px, 0, 0); filter: blur(4px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes rowIn { from { opacity: 0; transform: translate3d(0, 12px, 0); } to { opacity: 1; transform: none; } }
@keyframes cellIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }

/* --- Anneau : halo coloré qui respire --- */
.summary .ring::before, .recap-hero .ring::before {
  content: ""; position: absolute; inset: 8%; border-radius: 50%; z-index: -1;
  background: var(--future); filter: blur(18px); opacity: .35; animation: breathe 4s ease-in-out infinite;
}
.ring-good::before { background: var(--good) !important; } .ring-mid::before { background: var(--mid) !important; } .ring-bad::before { background: var(--bad) !important; }
.summary, .recap-hero { isolation: isolate; }
@keyframes breathe { 0%, 100% { transform: scale(.9); opacity: .25; } 50% { transform: scale(1.08); opacity: .45; } }
.summary .big b { font-weight: inherit; }
.recap-big span.n { color: inherit; font-size: inherit; font-weight: inherit; }

/* --- Case à cocher : ressort, onde, coche qui se dessine --- */
.check { position: relative; transition: background .3s, border-color .3s, transform .45s var(--spring); }
.check:active { transform: scale(.8); transition-duration: .1s; }
.check path { stroke-dasharray: 22; stroke-dashoffset: 0; }
.check::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--good); opacity: 0; pointer-events: none; }
.just-done .check { animation: checkPop .6s var(--spring); }
.just-done .check path { animation: draw .45s .08s var(--ease) both; }
.just-done .check::after { animation: ripple .7s var(--ease); }
.just-done { animation: doneFlash 1s var(--ease); }
.just-done .task-title { animation: settle .6s var(--ease); }
.just-undone .check { animation: checkPop .5s var(--spring); }
@keyframes checkPop { 0% { transform: scale(.6); } 55% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes draw { from { stroke-dashoffset: 22; } to { stroke-dashoffset: 0; } }
@keyframes ripple { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(2.2); } }
@keyframes doneFlash { 0% { background: color-mix(in srgb, var(--good) 22%, transparent); } 100% { background: transparent; } }
@keyframes settle { from { transform: translateX(6px); opacity: .5; } to { transform: none; opacity: 1; } }

/* --- Barre d'onglets : pastille qui glisse + icône qui rebondit --- */
#tabbar { isolation: isolate; }
.tab-pill {
  position: absolute; top: 5px; left: 0; width: 56px; height: 32px; border-radius: 16px; z-index: -1;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  transition: transform .6s var(--spring);
}
#tabbar button { transition: color .3s; }
#tabbar button.on svg { animation: tabPop .6s var(--spring); }
#tabbar button:active svg { transform: scale(.85); }
@keyframes tabPop { 0% { transform: scale(.7) translateY(2px); } 60% { transform: scale(1.15) translateY(-2px); } 100% { transform: none; } }

/* --- Bouton + : dégradé, reflet qui passe, rotation --- */
#fab {
  background: linear-gradient(135deg, #3d9bff, var(--accent) 45%, #5e5ce6); overflow: hidden;
  transition: transform .5s var(--spring), box-shadow .3s;
  box-shadow: 0 10px 28px -6px rgba(10, 132, 255, .6), 0 2px 6px rgba(0, 0, 0, .15), inset 0 1px 0 rgba(255, 255, 255, .35);
}
#fab::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%); transform: translateX(-120%); animation: sheen 6s 2s ease-in-out infinite; }
#fab:active { transform: scale(.88) rotate(90deg); transition-duration: .2s; }
@keyframes sheen { 0%, 80% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

/* --- Feuilles : ressort, fond flouté, profondeur --- */
.sheet-backdrop { background: rgba(0, 0, 0, .35); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); transition: opacity .4s, backdrop-filter .5s, -webkit-backdrop-filter .5s; }
.sheet-wrap.open .sheet-backdrop { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet { transition: transform .6s cubic-bezier(.22, 1.15, .36, 1); border-radius: 22px 22px 0 0; }
body.has-sheet #view { transform: scale(.965) translateY(6px); border-radius: 18px; filter: brightness(.92); }
#view { transition: transform .55s var(--ease), filter .55s, border-radius .55s; }

/* --- Toast : ressort + verre --- */
#toast { transition: opacity .3s, transform .55s var(--spring); transform: translate(-50%, 24px) scale(.9); border-radius: 18px; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .4); }
#toast.show { transform: translate(-50%, 0) scale(1); }

/* --- Calendrier --- */
.mcell .num { transition: background .35s, color .35s, transform .45s var(--spring); }
.mcell.sel .num { animation: selPop .5s var(--spring); }
@keyframes selPop { 0% { transform: scale(.7); } 100% { transform: scale(1); } }
.now { animation: nowPulse 2.4s ease-in-out infinite; }
@keyframes nowPulse { 50% { opacity: .55; } }

/* --- Célébrations --- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; perspective: 600px; }
.fx-p { position: absolute; width: 7px; height: 7px; border-radius: 50%; }
.fx-p.star { width: 9px; height: 3px; border-radius: 2px; }
.fx-wave { position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--good); }
.fx-c { position: absolute; width: 8px; height: 13px; border-radius: 2px; will-change: transform; }
.fx-badge {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); text-align: center; padding: 26px 34px; border-radius: 28px;
  background: color-mix(in srgb, var(--card) 72%, transparent); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .4); width: max-content; max-width: 86vw; white-space: nowrap;
}
.fx-badge-ico { font-size: 44px; line-height: 1; background: linear-gradient(135deg, #FFD60A, #F5A623 50%, #FFE58A); -webkit-background-clip: text; background-clip: text; color: transparent; animation: spinIn 1.2s var(--spring); }
.fx-badge-t { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.fx-badge-s { color: var(--muted); font-size: 15px; margin-top: 2px; }
@keyframes spinIn { from { transform: rotate(-180deg) scale(.3); } to { transform: none; } }

/* Accueil */
.onboard-logo { animation: logoFloat 5s ease-in-out infinite; }
@keyframes logoFloat { 50% { transform: translateY(-6px) rotate(-2deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
